Options for -i list is now available in aria2.changeOption.

Options for -i list, except for PREF_CHECKSUM, PREF_DIR, PREF_DRY_RUN,
PREF_INDEX_OUT, PREF_LOWEST_SPEED_LIMIT,
PREF_MAX_CONNECTION_PER_SERVER, PREF_METALINK_BASE_URI, PREF_OUT,
PREF_PIECE_LENGTH, PREF_SELECT_FILE, PREF_SPLIT, PREF_PAUSE and
PREF_PARAMETERIZED_URI, are available in aria2.changeOption if the
download is waiting state, including paused downloads.
pull/2/head
Tatsuhiro Tsujikawa 2011-10-29 18:50:52 +09:00
parent 0ba6f8c352
commit 7cba24e8b2
9 changed files with 159 additions and 15 deletions

View File

@ -58,6 +58,7 @@ AbstractOptionHandler::AbstractOptionHandler
eraseAfterParse_(false), eraseAfterParse_(false),
initialOption_(false), initialOption_(false),
changeOption_(false), changeOption_(false),
changeOptionForReserved_(false),
globalChangeOption_(false), globalChangeOption_(false),
cumulative_(false) cumulative_(false)
{} {}

View File

@ -66,6 +66,7 @@ protected:
bool initialOption_; bool initialOption_;
bool changeOption_; bool changeOption_;
bool changeOptionForReserved_;
bool globalChangeOption_; bool globalChangeOption_;
bool cumulative_; bool cumulative_;
@ -154,6 +155,16 @@ public:
changeOption_ = f; changeOption_ = f;
} }
virtual bool getChangeOptionForReserved() const
{
return changeOptionForReserved_;
}
virtual void setChangeOptionForReserved(bool f)
{
changeOptionForReserved_ = f;
}
virtual bool getChangeGlobalOption() const virtual bool getChangeGlobalOption() const
{ {
return globalChangeOption_; return globalChangeOption_;

View File

@ -104,6 +104,8 @@ public:
virtual void setInitialOption(bool f) = 0; virtual void setInitialOption(bool f) = 0;
virtual bool getChangeOption() const = 0; virtual bool getChangeOption() const = 0;
virtual void setChangeOption(bool f) = 0; virtual void setChangeOption(bool f) = 0;
virtual bool getChangeOptionForReserved() const = 0;
virtual void setChangeOptionForReserved(bool f) = 0;
virtual bool getChangeGlobalOption() const = 0; virtual bool getChangeGlobalOption() const = 0;
virtual void setChangeGlobalOption(bool f) = 0; virtual void setChangeGlobalOption(bool f) = 0;
virtual bool getCumulative() const = 0; virtual bool getCumulative() const = 0;

View File

@ -60,6 +60,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_FILE); op->addTag(TAG_FILE);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -71,6 +72,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_ADVANCED); op->addTag(TAG_ADVANCED);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -84,6 +86,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
#ifdef ENABLE_ASYNC_DNS #ifdef ENABLE_ASYNC_DNS
@ -96,6 +99,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_ADVANCED); op->addTag(TAG_ADVANCED);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
#if defined HAVE_ARES_SET_SERVERS && HAVE_ARES_ADDR_NODE #if defined HAVE_ARES_SET_SERVERS && HAVE_ARES_ADDR_NODE
@ -119,6 +123,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_FILE); op->addTag(TAG_FILE);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -145,6 +150,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_CHECKSUM); op->addTag(TAG_CHECKSUM);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
#endif // ENABLE_MESSAGE_DIGEST #endif // ENABLE_MESSAGE_DIGEST
@ -158,6 +164,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -181,6 +188,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -246,6 +254,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_ADVANCED); op->addTag(TAG_ADVANCED);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
#endif // ENABLE_ASYNC_DNS #endif // ENABLE_ASYNC_DNS
@ -319,6 +328,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_FILE); op->addTag(TAG_FILE);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -345,6 +355,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_CHECKSUM); op->addTag(TAG_CHECKSUM);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
#endif // ENABLE_MESSAGE_DIGEST #endif // ENABLE_MESSAGE_DIGEST
@ -439,6 +450,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeOption(true); op->setChangeOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -474,6 +486,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -488,6 +501,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -509,6 +523,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_FILE); op->addTag(TAG_FILE);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -605,6 +620,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_CHECKSUM); op->addTag(TAG_CHECKSUM);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
#endif // ENABLE_MESSAGE_DIGEST #endif // ENABLE_MESSAGE_DIGEST
@ -617,6 +633,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_ADVANCED); op->addTag(TAG_ADVANCED);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -747,6 +764,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -783,6 +801,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -796,6 +815,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -809,6 +829,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -851,6 +872,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -863,6 +885,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -875,6 +898,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -943,6 +967,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -956,6 +981,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -970,6 +996,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
// HTTP Specific Options // HTTP Specific Options
@ -1012,6 +1039,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1023,6 +1051,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1035,6 +1064,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setInitialOption(true); op->setInitialOption(true);
op->setCumulative(true); op->setCumulative(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1046,6 +1076,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1057,6 +1088,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1068,6 +1100,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1079,6 +1112,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1090,6 +1124,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1119,6 +1154,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_METALINK); op->addTag(TAG_METALINK);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1138,6 +1174,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1160,6 +1197,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1173,6 +1211,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
// FTP Specific Options // FTP Specific Options
@ -1185,6 +1224,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1197,6 +1237,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_FTP); op->addTag(TAG_FTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1208,6 +1249,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_FTP); op->addTag(TAG_FTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1219,6 +1261,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_FTP); op->addTag(TAG_FTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1230,6 +1273,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1250,6 +1294,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1261,6 +1306,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1272,6 +1318,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1283,6 +1330,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTPS); op->addTag(TAG_HTTPS);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1295,6 +1343,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1307,6 +1356,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1317,6 +1367,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_FTP); op->addTag(TAG_FTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1328,6 +1379,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1339,6 +1391,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1351,6 +1404,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTPS); op->addTag(TAG_HTTPS);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1364,6 +1418,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1377,6 +1432,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setEraseAfterParse(true); op->setEraseAfterParse(true);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1390,6 +1446,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTPS); op->addTag(TAG_HTTPS);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1402,6 +1459,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_HTTP); op->addTag(TAG_HTTP);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
// BitTorrent/Metalink Options // BitTorrent/Metalink Options
@ -1441,6 +1499,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1453,6 +1512,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1464,6 +1524,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1485,6 +1546,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_CHECKSUM); op->addTag(TAG_CHECKSUM);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1506,6 +1568,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1518,6 +1581,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeOption(true); op->setChangeOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
@ -1530,6 +1594,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1541,6 +1606,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1550,6 +1616,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1562,6 +1629,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeOption(true); op->setChangeOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1573,6 +1641,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1593,6 +1662,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1604,6 +1674,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1615,6 +1686,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1635,6 +1707,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1646,6 +1719,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1657,6 +1731,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1668,6 +1743,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1775,6 +1851,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1786,6 +1863,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1831,6 +1909,7 @@ OptionHandlerFactory::createOptionHandlers()
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeOption(true); op->setChangeOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1869,6 +1948,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1880,6 +1960,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT); op->addTag(TAG_BITTORRENT);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1905,6 +1986,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_METALINK); op->addTag(TAG_METALINK);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1926,6 +2008,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_METALINK); op->addTag(TAG_METALINK);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1946,6 +2029,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_METALINK); op->addTag(TAG_METALINK);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1955,6 +2039,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_METALINK); op->addTag(TAG_METALINK);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1968,6 +2053,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_METALINK); op->addTag(TAG_METALINK);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1980,6 +2066,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_METALINK); op->addTag(TAG_METALINK);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
{ {
@ -1989,6 +2076,7 @@ OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_METALINK); op->addTag(TAG_METALINK);
op->setInitialOption(true); op->setInitialOption(true);
op->setChangeGlobalOption(true); op->setChangeGlobalOption(true);
op->setChangeOptionForReserved(true);
handlers.push_back(op); handlers.push_back(op);
} }
#endif // ENABLE_METALINK #endif // ENABLE_METALINK

View File

@ -807,6 +807,16 @@ void DeprecatedOptionHandler::setChangeOption(bool f)
depOptHandler_->setChangeOption(f); depOptHandler_->setChangeOption(f);
} }
bool DeprecatedOptionHandler::getChangeOptionForReserved() const
{
return depOptHandler_->getChangeOptionForReserved();
}
void DeprecatedOptionHandler::setChangeOptionForReserved(bool f)
{
depOptHandler_->setChangeOptionForReserved(f);
}
bool DeprecatedOptionHandler::getChangeGlobalOption() const bool DeprecatedOptionHandler::getChangeGlobalOption() const
{ {
return depOptHandler_->getChangeGlobalOption(); return depOptHandler_->getChangeGlobalOption();

View File

@ -315,6 +315,8 @@ public:
virtual void setInitialOption(bool f); virtual void setInitialOption(bool f);
virtual bool getChangeOption() const; virtual bool getChangeOption() const;
virtual void setChangeOption(bool f); virtual void setChangeOption(bool f);
virtual bool getChangeOptionForReserved() const;
virtual void setChangeOptionForReserved(bool f);
virtual bool getChangeGlobalOption() const; virtual bool getChangeGlobalOption() const;
virtual void setChangeGlobalOption(bool f); virtual void setChangeGlobalOption(bool f);
virtual bool getCumulative() const; virtual bool getCumulative() const;

View File

@ -137,6 +137,17 @@ void RpcMethod::gatherChangeableOption(Option* option, const Dict* optionsDict)
} }
} }
void RpcMethod::gatherChangeableOptionForReserved
(Option* option,
const Dict* optionsDict)
{
if(optionsDict) {
gatherOption(optionsDict->begin(), optionsDict->end(),
mem_fun_sh(&OptionHandler::getChangeOptionForReserved),
option, optionParser_);
}
}
void RpcMethod::gatherChangeableGlobalOption void RpcMethod::gatherChangeableGlobalOption
(Option* option, const Dict* optionsDict) (Option* option, const Dict* optionsDict)
{ {

View File

@ -76,6 +76,9 @@ protected:
void gatherChangeableOption(Option* option, const Dict* optionDict); void gatherChangeableOption(Option* option, const Dict* optionDict);
void gatherChangeableOptionForReserved
(Option* option, const Dict* optionsDict);
void gatherChangeableGlobalOption(Option* option, const Dict* optionDict); void gatherChangeableGlobalOption(Option* option, const Dict* optionDict);
SharedHandle<ValueBase> createErrorResponse SharedHandle<ValueBase> createErrorResponse

View File

@ -1113,22 +1113,12 @@ SharedHandle<ValueBase> RemoveDownloadResultRpcMethod::process
return VLB_OK; return VLB_OK;
} }
SharedHandle<ValueBase> ChangeOptionRpcMethod::process namespace {
(const RpcRequest& req, DownloadEngine* e) void changeOption
(const SharedHandle<RequestGroup>& group,
const Option& option,
DownloadEngine* e)
{ {
const String* gidParam = checkRequiredParam<String>(req, 0);
const Dict* optsParam = checkRequiredParam<Dict>(req, 1);
a2_gid_t gid = str2Gid(gidParam);
SharedHandle<RequestGroup> group =
findRequestGroup(e->getRequestGroupMan(), gid);
if(!group) {
throw DL_ABORT_EX
(fmt("Cannot change option for GID#%s",
util::itos(gid).c_str()));
}
Option option;
gatherChangeableOption(&option, optsParam);
group->getOption()->merge(option); group->getOption()->merge(option);
if(option.defined(PREF_MAX_DOWNLOAD_LIMIT)) { if(option.defined(PREF_MAX_DOWNLOAD_LIMIT)) {
group->setMaxDownloadSpeedLimit group->setMaxDownloadSpeedLimit
@ -1145,6 +1135,32 @@ SharedHandle<ValueBase> ChangeOptionRpcMethod::process
} }
} }
#endif // ENABLE_BITTORRENT #endif // ENABLE_BITTORRENT
}
} // namespace
SharedHandle<ValueBase> ChangeOptionRpcMethod::process
(const RpcRequest& req, DownloadEngine* e)
{
const String* gidParam = checkRequiredParam<String>(req, 0);
const Dict* optsParam = checkRequiredParam<Dict>(req, 1);
a2_gid_t gid = str2Gid(gidParam);
SharedHandle<RequestGroup> group =
e->getRequestGroupMan()->findRequestGroup(gid);
Option option;
if(group) {
gatherChangeableOption(&option, optsParam);
changeOption(group, option, e);
} else {
group = e->getRequestGroupMan()->findReservedGroup(gid);
if(group) {
gatherChangeableOptionForReserved(&option, optsParam);
changeOption(group, option, e);
} else {
throw DL_ABORT_EX
(fmt("Cannot change option for GID#%s", util::itos(gid).c_str()));
}
}
return VLB_OK; return VLB_OK;
} }