aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/dcc/libkvidcc.cpp
diff options
context:
space:
mode:
authorGravatar Noldor2007-01-23 16:31:02 +0000
committerGravatar Noldor2007-01-23 16:31:02 +0000
commit52c050dd0ff72f7399cb1bd743d20c7d447e094b (patch)
tree157dff75036a7d72df47787ad3eeebc5a095944e /src/modules/dcc/libkvidcc.cpp
parentadded seenserv command (diff)
downloadKVIrc-52c050dd0ff72f7399cb1bd743d20c7d447e094b.tar.gz
KVIrc-52c050dd0ff72f7399cb1bd743d20c7d447e094b.tar.bz2
KVIrc-52c050dd0ff72f7399cb1bd743d20c7d447e094b.zip
added new buttongroup classes,dcc.setBandwidthLimit; fixed/removed some old code, added doc to dynamictooltips
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@234 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/dcc/libkvidcc.cpp')
-rw-r--r--src/modules/dcc/libkvidcc.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/modules/dcc/libkvidcc.cpp b/src/modules/dcc/libkvidcc.cpp
index 42bc757fc..c8736216b 100644
--- a/src/modules/dcc/libkvidcc.cpp
+++ b/src/modules/dcc/libkvidcc.cpp
@@ -1626,7 +1626,43 @@ static bool dcc_kvs_cmd_abort(KviKvsModuleCommandCall * c)
return true;
}
+/*
+ @doc: dcc.setBandwidthLimit
+ @type:
+ command
+ @title:
+ dcc.setBandwidthLimit
+ @short:
+ Set the bandwidthlimit of a dcc.send session.
+ @syntax:
+ dcc.setBandwidthLimit [-q] [dcc_id:uint]
+ @description:
+ Terminates the Direct Client Connection specified by <dcc_id>.[br]
+ If <dcc_id> is omitted then the DCC Session associated
+ to the current window is assumed.[br]
+ If <dcc_id> is not a valid DCC session identifier (or it is omitted
+ and the current window has no associated DCC session) then
+ this function prints a warning unless the -q switch is used.[br]
+ If <dcc_id> does not refers to a file transfer a warning will be printing unless the -q switch is used.[br]
+ See the [module:dcc]dcc module[/module] documentation for more informations.[br]
+ @examples:
+*/
+static bool dcc_kvs_cmd_setBandwidthLimit(KviKvsModuleCommandCall * c)
+{
+ kvs_uint_t uDccId,uVal;
+ KVSM_PARAMETERS_BEGIN(c)
+ KVSM_PARAMETER("limit_value",KVS_PT_UINT,0,uVal)
+ KVSM_PARAMETER("dcc_id",KVS_PT_UINT,KVS_PF_OPTIONAL,uDccId)
+ KVSM_PARAMETERS_END(c)
+ KviDccDescriptor * dcc = dcc_kvs_find_dcc_descriptor(uDccId,c,!c->switches()->find('q',"quiet"));
+ if(dcc)
+ {
+ if (dcc->transfer())dcc->transfer()->setBandwidthLimit(uVal);
+ else if (!c->switches()->find('q',"quiet"))c->warning(__tr2qs_ctx("This DCC session is not a DCC transfer session","dcc"));
+ }
+ return true;
+}
/*
@doc: dcc.protocol
@type:
@@ -2671,6 +2707,7 @@ static bool dcc_module_init(KviModule * m)
KVSM_REGISTER_SIMPLE_COMMAND(m,"rsend",dcc_kvs_cmd_rsend);
KVSM_REGISTER_SIMPLE_COMMAND(m,"get",dcc_kvs_cmd_get);
KVSM_REGISTER_SIMPLE_COMMAND(m,"abort",dcc_kvs_cmd_abort);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"setBandwidthLimit",dcc_kvs_cmd_setBandwidthLimit);
// FIXME: file upload / download state ?