Changeset 963
- Timestamp:
- 08/23/07 17:21:11 (5 years ago)
- Location:
- trunk
- Files:
-
- 10 modified
-
libtorrent/rak/socket_address.h (modified) (1 diff)
-
rtorrent/doc/rtorrent.1.xml (modified) (1 diff)
-
rtorrent/rak/socket_address.h (modified) (1 diff)
-
rtorrent/src/command_download.cc (modified) (2 diffs)
-
rtorrent/src/command_helpers.h (modified) (2 diffs)
-
rtorrent/src/command_local.cc (modified) (5 diffs)
-
rtorrent/src/control.cc (modified) (1 diff)
-
rtorrent/src/control.h (modified) (1 diff)
-
rtorrent/src/core/download_factory.cc (modified) (1 diff)
-
rtorrent/src/main.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtorrent/rak/socket_address.h
r962 r963 75 75 #else 76 76 static const sa_family_t af_local = AF_UNIX; 77 static const i tnpf_local = PF_UNIX;77 static const int pf_local = PF_UNIX; 78 78 #endif 79 79 -
trunk/rtorrent/doc/rtorrent.1.xml
r961 r963 982 982 983 983 <varlistentry> 984 <term> working_directory= <replaceable>directory</replaceable></term>984 <term>cwd = <replaceable>directory</replaceable></term> 985 985 <listitem><para> 986 986 -
trunk/rtorrent/rak/socket_address.h
r962 r963 75 75 #else 76 76 static const sa_family_t af_local = AF_UNIX; 77 static const i tnpf_local = PF_UNIX;77 static const int pf_local = PF_UNIX; 78 78 #endif 79 79 -
trunk/rtorrent/src/command_download.cc
r962 r963 313 313 ADD_CD_SLOT("d.set_" key, call_string, rpc::set_variable_d_fn(firstKey, secondKey), "i:s", ""); 314 314 315 #define ADD_CD_VARIABLE_STRING_PUBLIC(key, firstKey, secondKey) \ 316 ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::get_variable_d_fn(firstKey, secondKey), "i:", ""); \ 317 ADD_CD_SLOT_PUBLIC("d.set_" key, call_string, rpc::set_variable_d_fn(firstKey, secondKey), "i:s", ""); 318 315 319 #define ADD_CD_VALUE_UNI(key, get) \ 316 320 ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::object_void_d_fn(get), "i:", "") … … 371 375 ADD_CD_VALUE_UNI("is_hash_checking", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::is_hash_checking))); 372 376 ADD_CD_VALUE_UNI("is_multi_file", rak::on(std::mem_fun(&core::Download::file_list), std::mem_fun(&torrent::FileList::is_multi_file))); 377 378 ADD_CD_VARIABLE_STRING_PUBLIC("custom1", "rtorrent", "custom1"); 379 ADD_CD_VARIABLE_STRING_PUBLIC("custom2", "rtorrent", "custom2"); 380 ADD_CD_VARIABLE_STRING_PUBLIC("custom3", "rtorrent", "custom3"); 381 ADD_CD_VARIABLE_STRING_PUBLIC("custom4", "rtorrent", "custom4"); 382 ADD_CD_VARIABLE_STRING_PUBLIC("custom5", "rtorrent", "custom5"); 373 383 374 384 // 0 - stopped -
trunk/rtorrent/src/command_helpers.h
r959 r963 89 89 add_variable("get_" key, "set_" key, key, &rpc::CommandVariable::get_string, &rpc::CommandVariable::set_string, std::string(defaultValue)); 90 90 91 #define ADD_ VARIABLE_C_STRING(key, defaultValue) \92 add_variable( "get_"key, NULL, NULL, &rpc::CommandVariable::get_string, NULL, std::string(defaultValue));91 #define ADD_C_STRING(key, defaultValue) \ 92 add_variable(key, NULL, NULL, &rpc::CommandVariable::get_string, NULL, std::string(defaultValue)); 93 93 94 94 #define ADD_COMMAND_SLOT(key, function, slot, parm, doc) \ … … 116 116 ADD_COMMAND_SLOT("get_" key, call_unknown, rpc::object_void_fn(get), "i:", "") 117 117 118 #define ADD_COMMAND_VALUE_ TRI_OCT(key, set, get)\118 #define ADD_COMMAND_VALUE_SET_OCT(prefix, key, set) \ 119 119 ADD_COMMAND_SLOT_PRIVATE(key, call_value_oct, rpc::object_value_fn(set)) \ 120 ADD_COMMAND_COPY("set_" key, call_value, "i:i", "") \ 121 ADD_COMMAND_SLOT("get_" key, call_unknown, rpc::object_void_fn(get), "i:", "") 120 ADD_COMMAND_COPY(prefix "set_" key, call_value, "i:i", "") 122 121 123 #define ADD_COMMAND_STRING_TRI(key, set, get) \ 122 #define ADD_COMMAND_VALUE_TRI_OCT(prefix, key, set, get) \ 123 ADD_COMMAND_SLOT_PRIVATE(key, call_value_oct, rpc::object_value_fn(set)) \ 124 ADD_COMMAND_COPY(prefix "set_" key, call_value, "i:i", "") \ 125 ADD_COMMAND_SLOT(prefix "get_" key, call_unknown, rpc::object_void_fn(get), "i:", "") 126 127 #define ADD_COMMAND_STRING_PREFIX(prefix, key, set, get) \ 124 128 ADD_COMMAND_SLOT_PRIVATE(key, call_string, rpc::object_string_fn(set)) \ 125 ADD_COMMAND_COPY("set_" key, call_string, "i:s", "") \ 126 ADD_COMMAND_SLOT("get_" key, call_unknown, rpc::object_void_fn(get), "s:", "") 129 ADD_COMMAND_COPY(prefix "set_" key, call_string, "i:s", "") \ 130 ADD_COMMAND_SLOT(prefix "get_" key, call_unknown, rpc::object_void_fn(get), "s:", "") 131 132 #define ADD_COMMAND_STRING_TRI(key, set, get) \ 133 ADD_COMMAND_STRING_PREFIX("", key, set, get) 127 134 128 135 #define ADD_COMMAND_VOID(key, slot) \ -
trunk/rtorrent/src/command_local.cc
r959 r963 42 42 #include <rak/path.h> 43 43 #include <sys/types.h> 44 #include <sys/stat.h> 44 45 #include <torrent/torrent.h> 45 46 #include <torrent/chunk_manager.h> … … 82 83 83 84 torrent::Object 84 apply_get_hostname() {85 system_hostname() { 85 86 char buffer[1024]; 86 87 … … 94 95 } 95 96 97 torrent::Object 98 system_get_cwd() { 99 char* buffer = getcwd(NULL, 0); 100 101 if (buffer == NULL) 102 throw torrent::input_error("Unable to read cwd."); 103 104 torrent::Object result = torrent::Object(std::string(buffer)); 105 free(buffer); 106 107 return result; 108 } 109 110 torrent::Object 111 system_set_cwd(const torrent::Object& rawArgs) { 112 if (::chdir(rawArgs.as_string().c_str()) != 0) 113 throw torrent::input_error("Could not change current working directory."); 114 115 return torrent::Object(); 116 } 117 96 118 void 97 119 initialize_command_local() { … … 100 122 core::DownloadStore* dStore = control->core()->download_store(); 101 123 102 ADD_ VARIABLE_C_STRING("client_version",PACKAGE_VERSION);103 ADD_ VARIABLE_C_STRING("library_version",torrent::version());124 ADD_C_STRING("system.client_version", PACKAGE_VERSION); 125 ADD_C_STRING("system.library_version", torrent::version()); 104 126 105 ADD_COMMAND_VOID(" get_hostname", rak::ptr_fun(&apply_get_hostname));106 ADD_COMMAND_VOID(" get_pid",rak::ptr_fun(&getpid));127 ADD_COMMAND_VOID("system.hostname", rak::ptr_fun(&system_hostname)); 128 ADD_COMMAND_VOID("system.pid", rak::ptr_fun(&getpid)); 107 129 108 ADD_VARIABLE_STRING("name", ""); 130 ADD_COMMAND_VALUE_SET_OCT("system.", "umask", std::ptr_fun(&umask)); 131 ADD_COMMAND_STRING_PREFIX("system.", "cwd", std::ptr_fun(system_set_cwd), rak::ptr_fun(&system_get_cwd)); 132 133 ADD_VARIABLE_STRING("name", ""); 109 134 110 135 ADD_VARIABLE_VALUE("max_file_size", -1); … … 126 151 ADD_COMMAND_VOID("session_save", rak::make_mem_fun(dList, &core::DownloadList::session_save)); 127 152 128 ADD_COMMAND_VALUE_TRI_OCT("umask", rak::make_mem_fun(control, &Control::set_umask), rak::make_mem_fun(control, &Control::umask));129 ADD_COMMAND_STRING_TRI("working_directory", rak::make_mem_fun(control, &Control::set_working_directory), rak::make_mem_fun(control, &Control::working_directory));130 131 153 ADD_COMMAND_LIST("execute", rak::bind2_mem_fn(&rpc::execFile, &rpc::ExecFile::execute_object, rpc::ExecFile::flag_throw | rpc::ExecFile::flag_expand_tilde)); 132 154 ADD_COMMAND_LIST("execute_nothrow", rak::bind2_mem_fn(&rpc::execFile, &rpc::ExecFile::execute_object, rpc::ExecFile::flag_expand_tilde)); -
trunk/rtorrent/src/control.cc
r938 r963 160 160 return m_core->get_poll_manager()->get_torrent_poll(); 161 161 } 162 163 void164 Control::set_umask(mode_t m) {165 ::umask(m);166 167 m_umask = m;168 }169 170 void171 Control::set_working_directory(const std::string& dir) {172 if (::chdir(dir.c_str()) != 0)173 throw torrent::input_error("Could not change working directory.");174 } -
trunk/rtorrent/src/control.h
r938 r963 106 106 void inc_tick() { m_tick++; } 107 107 108 mode_t umask() const { return m_umask; }109 void set_umask(mode_t m);110 111 108 const std::string& working_directory() const { return m_workingDirectory; } 112 109 void set_working_directory(const std::string& dir); -
trunk/rtorrent/src/core/download_factory.cc
r955 r963 175 175 initialize_rtorrent(download, rtorrent); 176 176 177 if (!rtorrent->has_key_string("custom1")) rtorrent->insert_key("custom1", std::string()); 178 if (!rtorrent->has_key_string("custom2")) rtorrent->insert_key("custom2", std::string()); 179 if (!rtorrent->has_key_string("custom3")) rtorrent->insert_key("custom3", std::string()); 180 if (!rtorrent->has_key_string("custom4")) rtorrent->insert_key("custom4", std::string()); 181 if (!rtorrent->has_key_string("custom5")) rtorrent->insert_key("custom5", std::string()); 182 177 183 // Move to 'rtorrent'. 178 184 rpc::call_command_d("d.set_connection_leech", download, m_variables["connection_leech"]); -
trunk/rtorrent/src/main.cc
r961 r963 167 167 168 168 rpc::parse_command_multiple(rpc::make_target(), 169 // "set_name = $cat={$ get_hostname=,:,$get_pid=}\n"170 "set_name = \"$cat=$ get_hostname=,:,$get_pid=\"\n"169 // "set_name = $cat={$system.hostname=,:,$system.pid=}\n" 170 "set_name = \"$cat=$system.hostname=,:,$system.pid=\"\n" 171 171 172 172 // Currently not doing any sorting on main.
