aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/context
diff options
context:
space:
mode:
authorGravatar Fabio Bas2011-03-13 15:29:35 +0000
committerGravatar Fabio Bas2011-03-13 15:29:35 +0000
commitfb3b6af0df0f38b111b01faf77c167c597968cf0 (patch)
tree185ef6c1135fe20bece42db11b8628b09dd67f21 /src/modules/context
parentMore work on kvs class webview (diff)
downloadKVIrc-fb3b6af0df0f38b111b01faf77c167c597968cf0.tar.gz
KVIrc-fb3b6af0df0f38b111b01faf77c167c597968cf0.tar.bz2
KVIrc-fb3b6af0df0f38b111b01faf77c167c597968cf0.zip
added $context.connectionStartTime and $context.lastMessageTime
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5574 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/context')
-rw-r--r--src/modules/context/libkvicontext.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/modules/context/libkvicontext.cpp b/src/modules/context/libkvicontext.cpp
index 9fd5dbf42..e7ce372d7 100644
--- a/src/modules/context/libkvicontext.cpp
+++ b/src/modules/context/libkvicontext.cpp
@@ -38,6 +38,7 @@
#include "KviIrcConnectionServerInfo.h"
#include "KviIrcConnectionUserInfo.h"
#include "KviIrcConnectionTarget.h"
+#include "KviIrcConnectionStatistics.h"
#define GET_CONSOLE_FROM_STANDARD_PARAMS \
kvs_uint_t iContextId; \
@@ -487,6 +488,57 @@ static bool context_kvs_fnc_list(KviKvsModuleFunctionCall * c)
return true;
}
+/*
+ @doc: context.connectionStartTime
+ @type:
+ function
+ @title:
+ $context.connectionStartTime
+ @short:
+ Returns the connection start time of an IRC context
+ @syntax:
+ <string> $context.connectionStartTime
+ <string> $context.connectionStartTime(<irc_context_id:uint>)
+ @description:
+ Returns the connection start time for the specified IRC context.
+ 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 nothing. If the specified IRC context is not currently connected
+ then this function returns nothing.
+ @seealso:
+ [fnc]$context.lastMessageTime[/fnc]
+*/
+
+STANDARD_IRC_CONNECTION_TARGET_PARAMETER(
+ context_kvs_fnc_connectionStartTime,
+ c->returnValue()->setInteger((kvs_int_t)(pConnection->statistics()->connectionStartTime()));
+ )
+
+/*
+ @doc: context.lastMessageTime
+ @type:
+ function
+ @title:
+ $context.lastMessageTime
+ @short:
+ Returns the last message time of an IRC context
+ @syntax:
+ <string> $context.lastMessageTime
+ <string> $context.lastMessageTime(<irc_context_id:uint>)
+ @description:
+ Returns the last message time for the specified IRC context.
+ 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 nothing. If the specified IRC context is not currently connected
+ then this function returns nothing.
+ @seealso:
+ [fnc]$context.connectionStartTime[/fnc]
+*/
+
+STANDARD_IRC_CONNECTION_TARGET_PARAMETER(
+ context_kvs_fnc_lastMessageTime,
+ c->returnValue()->setInteger((kvs_int_t)(pConnection->statistics()->lastMessageTime()));
+ )
/*
@doc: context.clearqueue
@@ -534,6 +586,8 @@ static bool context_module_init(KviModule * m)
KVSM_REGISTER_FUNCTION(m,"state",context_kvs_fnc_state);
KVSM_REGISTER_FUNCTION(m,"list",context_kvs_fnc_list);
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_SIMPLE_COMMAND(m,"clearQueue",context_kvs_cmd_clearQueue);