mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-09 03:32:29 +00:00
* Working on new infrastructure for parseing commands. It now passes a
list instead of a string when calling a multi-parameter command, which handles escaped spaces, commas and quotes correctly. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@877 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+11
-11
@@ -116,21 +116,21 @@ CommandScheduler::call_item(value_type item) {
|
||||
}
|
||||
|
||||
void
|
||||
CommandScheduler::parse(const std::string& arg) {
|
||||
char key[21];
|
||||
char bufAbsolute[21];
|
||||
char bufInterval[21];
|
||||
char command[2048];
|
||||
CommandScheduler::parse(const std::string& key, const std::string& bufAbsolute, const std::string& bufInterval, const std::string& command) {
|
||||
// char key[21];
|
||||
// char bufAbsolute[21];
|
||||
// char bufInterval[21];
|
||||
// char command[2048];
|
||||
|
||||
if (std::sscanf(arg.c_str(), "%20[^,],%20[^,],%20[^,],%2047[^\n]", key, bufAbsolute, bufInterval, command) != 4)
|
||||
throw torrent::input_error("Invalid arguments to command.");
|
||||
// if (std::sscanf(arg.c_str(), "%20[^,],%20[^,],%20[^,],%2047[^\n]", key, bufAbsolute, bufInterval, command) != 4)
|
||||
// throw torrent::input_error("Invalid arguments to command.");
|
||||
|
||||
uint32_t absolute = parse_absolute(bufAbsolute);
|
||||
uint32_t interval = parse_interval(bufInterval);
|
||||
uint32_t absolute = parse_absolute(bufAbsolute.c_str());
|
||||
uint32_t interval = parse_interval(bufInterval.c_str());
|
||||
|
||||
CommandSchedulerItem* item = *insert(rak::trim(std::string(key)));
|
||||
CommandSchedulerItem* item = *insert(key);
|
||||
|
||||
item->set_command(rak::trim(std::string(command)));
|
||||
item->set_command(command);
|
||||
item->set_interval(interval);
|
||||
|
||||
item->enable((cachedTime + rak::timer::from_seconds(absolute)).round_seconds());
|
||||
|
||||
Reference in New Issue
Block a user