mirror of
https://github.com/aria2/aria2.git
synced 2025-04-06 14:07:37 +03:00
2009-12-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added changePosition XML-RPC method. It takes 3 parameters: gid, pos and how. This method changes the position of download denoted by gid. If how is POS_SET, it moves the download to a position relative to the beginning of the queue. If how is POS_CUR, it moves the download to a position relative to the current position. If how is POS_END, it moves the download to a position relative to the end of the queue. If the destination position is less than 0 or beyond the end of the queue, it moves the download to the beginning or the end of the queue respectively. Returns the destination position. * src/RequestGroupMan.cc * src/RequestGroupMan.h * src/XmlRpcMethodFactory.cc * src/XmlRpcMethodImpl.cc * src/XmlRpcMethodImpl.h * test/RequestGroupManTest.cc * test/XmlRpcMethodTest.cc
This commit is contained in:
parent
d78b2721a5
commit
dd98c64161
8 changed files with 210 additions and 0 deletions
|
@ -727,6 +727,35 @@ BDE GetGlobalOptionXmlRpcMethod::process
|
|||
return result;
|
||||
}
|
||||
|
||||
BDE ChangePositionXmlRpcMethod::process
|
||||
(const XmlRpcRequest& req, DownloadEngine* e)
|
||||
{
|
||||
const BDE& params = req._params;
|
||||
assert(params.isList());
|
||||
|
||||
if(params.size() != 3 ||
|
||||
!params[0].isString() || !params[1].isInteger() || !params[2].isString()) {
|
||||
throw DL_ABORT_EX("Illegal argument.");
|
||||
}
|
||||
int32_t gid = util::parseInt(params[0].s());
|
||||
int pos = params[1].i();
|
||||
const std::string& howStr = params[2].s();
|
||||
RequestGroupMan::HOW how;
|
||||
if(howStr == "POS_SET") {
|
||||
how = RequestGroupMan::POS_SET;
|
||||
} else if(howStr == "POS_CUR") {
|
||||
how = RequestGroupMan::POS_CUR;
|
||||
} else if(howStr == "POS_END") {
|
||||
how = RequestGroupMan::POS_END;
|
||||
} else {
|
||||
throw DL_ABORT_EX("Illegal argument.");
|
||||
}
|
||||
size_t destPos =
|
||||
e->_requestGroupMan->changeReservedGroupPosition(gid, pos, how);
|
||||
BDE result(destPos);
|
||||
return result;
|
||||
}
|
||||
|
||||
BDE NoSuchMethodXmlRpcMethod::process
|
||||
(const XmlRpcRequest& req, DownloadEngine* e)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue