From 128ac3dd722b24f161501ab6ab63e2f4dd89f7cf Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Fri, 19 Feb 2010 11:08:09 +0000 Subject: added a specialized serverinfo structure for ircd-seven; added funzion $context.serverSoftware() git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3989 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/context/libkvicontext.cpp | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/modules/context') diff --git a/src/modules/context/libkvicontext.cpp b/src/modules/context/libkvicontext.cpp index 5be368633..eae3af7d7 100644 --- a/src/modules/context/libkvicontext.cpp +++ b/src/modules/context/libkvicontext.cpp @@ -72,6 +72,22 @@ return true; \ } +#define STANDARD_SERVERINFO_TARGET_PARAMETER(_fncName,_setCall) \ + static bool _fncName(KviKvsModuleFunctionCall * c) \ + { \ + GET_CONNECTION_FROM_STANDARD_PARAMS \ + if(pConnection) \ + { \ + if(pConnection->serverInfo()) \ + { \ + _setCall; \ + return true; \ + } \ + } \ + c->returnValue()->setNothing(); \ + return true; \ + } + /* @doc: context.networkName @type: @@ -218,6 +234,36 @@ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( c->returnValue()->setBoolean(pConnection->target()->server()->useSSL()) ) +/* + @doc: context.serverSoftware + @type: + function + @title: + $context.serverSoftware + @short: + Returns the software running on the irc server, if recognized + @syntax: + $context.serverSoftware + $context.serverSoftware() + @description: + Returns the software running on the irc server, if it has been + recognized at connection time. + 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 (that evaluates to false). If the specified IRC context + is not currently connected then this function returns nothing (that + evaluates to false). + @seealso: + [fnc]$context.serverPort[/fnc], + [fnc]$context.serverHostName[/fnc], + [fnc]$context.serverPassword[/fnc] +*/ + +STANDARD_SERVERINFO_TARGET_PARAMETER( + context_kvs_fnc_serverSoftware, + c->returnValue()->setString(pConnection->serverInfo()->software()) + ) + /* @doc: context.serverPassword @type: @@ -380,6 +426,7 @@ static bool context_module_init(KviModule * m) KVSM_REGISTER_FUNCTION(m,"networkName",context_kvs_fnc_networkName); 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); return true; } -- cgit v1.3.1-10-gc9f91