From 9c57fb511378fabd7ba1ead3400ad19e95f43e66 Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Fri, 11 Jan 2008 16:38:56 +0000 Subject: More work on the context module and some QT4 port in trunk: no longer use Q3PtrList but also leave the client code untouched git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1071 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/context/libkvicontext.cpp | 113 ++++++++++++++++++++++++++++++---- 1 file changed, 100 insertions(+), 13 deletions(-) (limited to 'src/modules/context/libkvicontext.cpp') diff --git a/src/modules/context/libkvicontext.cpp b/src/modules/context/libkvicontext.cpp index 28f3fb1bf..f205b5930 100644 --- a/src/modules/context/libkvicontext.cpp +++ b/src/modules/context/libkvicontext.cpp @@ -1,6 +1,6 @@ //============================================================================= // -// File : libkvistr.cpp +// File : libkvicontext.cpp // Creation date : Wed Jan 02 2007 03:04:12 GMT by Szymon Stefanek // // This file is part of the KVirc irc client distribution @@ -72,31 +72,61 @@ return true; \ } +/* + @doc: context.networkName + @type: + function + @title: + $context.networkName + @short: + Returns the IRC network name of an IRC context + @syntax: + $contex.networkName + $contex.networkName() + @description: + Returns the name of the network 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: + $context.serverHostName +*/ + +STANDARD_IRC_CONNECTION_TARGET_PARAMETER( + context_kvs_fnc_networkName, + c->returnValue()->setString(pConnection->target()->network()->name()) + ) /* - @doc: context.serverName + @doc: context.serverHostName @type: function @title: - $context.serverName + $context.serverHostName @short: Returns the IRC server name of an IRC context @syntax: - $contex.serverName - $contex.serverName() + $contex.serverHostName + $contex.serverHostName() @description: - Returns the name of the IRC server for the specified irc context. + Returns the host name of the IRC server that was used to perform + the connection in 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. + If the returned value is non empty then it will always be a valid + DNS hostname that can be used to perform a real connection. + Please note that this is different from $my.server() which might + return an invalid DNS entry. @seealso: $context.serverPort, $context.serverIpAddress, $context.serverPassword */ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( - context_kvs_fnc_serverName, + context_kvs_fnc_serverHostName, c->returnValue()->setString(pConnection->target()->server()->hostName()) ) @@ -118,7 +148,7 @@ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( returns nothing. If the specified IRC context is not currently connected then this function returns nothing. @seealso: - $context.serverPort, $context.serverName, $context.serverPassword + $context.serverPort, $context.serverHostName, $context.serverPassword */ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( @@ -126,6 +156,60 @@ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( c->returnValue()->setString(pConnection->target()->server()->ipAddress()) ) +/* + @doc: context.serverIsIPV6 + @type: + function + @title: + $context.serverIsIPV6 + @short: + Returns the IPV6 state of an IRC context + @syntax: + $contex.serverIsIPV6 + $contex.serverIsIPV6() + @description: + Returns true if the current irc context connection runs over IPV6. + 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: + $context.serverPort, $context.serverHostName, $context.serverPassword +*/ + +STANDARD_IRC_CONNECTION_TARGET_PARAMETER( + context_kvs_fnc_serverIsIPV6, + c->returnValue()->setBoolean(pConnection->target()->server()->isIpV6()) + ) + +/* + @doc: context.serverIsSSL + @type: + function + @title: + $context.serverIsSSL + @short: + Returns the SSL state of an IRC context + @syntax: + $contex.serverIsSSL + $contex.serverIsSSL() + @description: + Returns true if the current irc context connection runs over SSL. + 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: + $context.serverPort, $context.serverHostName, $context.serverPassword +*/ + +STANDARD_IRC_CONNECTION_TARGET_PARAMETER( + context_kvs_fnc_serverIsSSL, + c->returnValue()->setBoolean(pConnection->target()->server()->useSSL()) + ) + /* @doc: context.serverPassword @type: @@ -144,7 +228,7 @@ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( returns nothing. If the specified IRC context is not currently connected then this function returns nothing. @seealso: - $context.serverName, $context.serverIpAddress, $context.serverPort + $context.serverHostName, $context.serverIpAddress, $context.serverPort */ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( @@ -171,7 +255,7 @@ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( returns nothing. If the specified IRC context is not currently connected then this function returns nothing. @seealso: - $context.serverName, $context.serverIpAddress + $context.serverHostName, $context.serverIpAddress */ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( @@ -198,7 +282,7 @@ STANDARD_IRC_CONNECTION_TARGET_PARAMETER( If the irc_context_id specification is not valid then this function returns nothing. @seealso: - $context.serverName, $context.serverIpAddress + $context.serverHostName, $context.serverIpAddress */ static bool context_kvs_fnc_state(KviKvsModuleFunctionCall * c) @@ -250,7 +334,7 @@ static bool context_kvs_fnc_state(KviKvsModuleFunctionCall * c) Print the names of the currently connected servers [example] foreach(%ic,$context.list) - echo "IRC Context" %ic ": " $context.serverName + echo "IRC Context" %ic ": " $context.serverHostName [/example] */ @@ -275,10 +359,13 @@ static bool context_kvs_fnc_list(KviKvsModuleFunctionCall * c) static bool context_module_init(KviModule * m) { - KVSM_REGISTER_FUNCTION(m,"serverName",context_kvs_fnc_serverName); + KVSM_REGISTER_FUNCTION(m,"serverHostName",context_kvs_fnc_serverHostName); KVSM_REGISTER_FUNCTION(m,"serverIpAddress",context_kvs_fnc_serverIpAddress); KVSM_REGISTER_FUNCTION(m,"serverPort",context_kvs_fnc_serverPort); + KVSM_REGISTER_FUNCTION(m,"serverIsIPV6",context_kvs_fnc_serverIsIPV6); + KVSM_REGISTER_FUNCTION(m,"serverIsSSL",context_kvs_fnc_serverIsSSL); KVSM_REGISTER_FUNCTION(m,"serverPassword",context_kvs_fnc_serverPassword); + 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); -- cgit v1.3.1-10-gc9f91