From 37d393e28cc12d56c3be0f854446068a154829ac Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Thu, 24 Mar 2011 04:33:50 +0000 Subject: Add .queueSize() git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5683 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/context/libkvicontext.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/modules/context/libkvicontext.cpp') diff --git a/src/modules/context/libkvicontext.cpp b/src/modules/context/libkvicontext.cpp index e7ce372d7..c1eb06851 100644 --- a/src/modules/context/libkvicontext.cpp +++ b/src/modules/context/libkvicontext.cpp @@ -571,6 +571,34 @@ static bool context_kvs_cmd_clearQueue(KviKvsModuleCommandCall * c) return true; } +/* + @doc: context.queueSize + @type: + function + @title: + $context.queueSize + @short: + Returns the size of the current server message queue + @syntax: + $context.queueSize + $context.queueSize() + @description: + Returns the number of messages currently in the server message queue. + If no irc_context_id is specified then the current irc_context is used. + If the irc_context_id specification is not valid then this function + returns 0. + @seealso: + [cmd]context.clearqueue[/cmd], +*/ + +static bool context_kvs_fnc_queueSize(KviKvsModuleFunctionCall * c) +{ + GET_CONNECTION_FROM_STANDARD_PARAMS; + + c->returnValue()->setInteger(pConnection ? pConnection->outputQueueSize() : 0); + + return true; +} static bool context_module_init(KviModule * m) { @@ -588,6 +616,7 @@ static bool context_module_init(KviModule * m) KVSM_REGISTER_FUNCTION(m,"serverSoftware",context_kvs_fnc_serverSoftware); KVSM_REGISTER_FUNCTION(m,"connectionStartTime",context_kvs_fnc_connectionStartTime); KVSM_REGISTER_FUNCTION(m,"lastMessageTime",context_kvs_fnc_lastMessageTime); + KVSM_REGISTER_FUNCTION(m,"queueSize",context_kvs_fnc_queueSize); KVSM_REGISTER_SIMPLE_COMMAND(m,"clearQueue",context_kvs_cmd_clearQueue); -- cgit v1.3.1-10-gc9f91