diff options
| author | 2009-03-15 22:36:03 +0000 | |
|---|---|---|
| committer | 2009-03-15 22:36:03 +0000 | |
| commit | 0e6219128011ab929900807deecc0aaf93906487 (patch) | |
| tree | adeb1f871f801ba862ae1ce741bdc687ca5edc5d /src/modules | |
| parent | updated nsis installer for win32; fix for #267 (diff) | |
| download | KVIrc-0e6219128011ab929900807deecc0aaf93906487.tar.gz KVIrc-0e6219128011ab929900807deecc0aaf93906487.tar.bz2 KVIrc-0e6219128011ab929900807deecc0aaf93906487.zip | |
implemented #340
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3147 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/tmphighlight/libkvitmphighlight.cpp | 210 |
1 files changed, 185 insertions, 25 deletions
diff --git a/src/modules/tmphighlight/libkvitmphighlight.cpp b/src/modules/tmphighlight/libkvitmphighlight.cpp index 359e73eee..ee1f7e986 100644 --- a/src/modules/tmphighlight/libkvitmphighlight.cpp +++ b/src/modules/tmphighlight/libkvitmphighlight.cpp @@ -5,7 +5,7 @@ // // This file is part of the KVirc irc client distribution // Copyright (C) 2002 Juanjo Alvarez (juanjux@yahoo.es) -// Copyright (C) 2002-2008 Szymon Stefanek (kvirc@tin.it) +// Copyright (C) 2002-2009 Szymon Stefanek (kvirc@tin.it) // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -29,25 +29,25 @@ #include "kvi_channel.h" /* - @doc: tmphighlight.add + @doc: tmphighlight.addNick @type: command @title: - tmphighlight.add + tmphighlight.addNick @short: Adds a user to the channel temporary highlight list @syntax: - tmphighlight.add <nick:string> + tmphighlight.addNick <nick:string> @description: This command adds a user to the channel temporary highlight list, so that user messages[br] will be highlighted until you close the channel. This is useful when you are in a very crowded [br] channel with lots of conversations running in parallel and you want to follow one of them.[br] @seealso: - [fnc]$tmphighlight.remove[/fnc] - [fnc]$tmphighlight.ishighlighted[/fnc] + [fnc]$tmphighlight.removeNick[/fnc] + [fnc]$tmphighlight.isNickHighlighted[/fnc] */ -static bool tmphighlight_kvs_cmd_add(KviKvsModuleCommandCall * c) +static bool tmphighlight_kvs_cmd_addnick(KviKvsModuleCommandCall * c) { QString szNick; @@ -69,24 +69,24 @@ static bool tmphighlight_kvs_cmd_add(KviKvsModuleCommandCall * c) } /* - @doc: tmphighlight.remove + @doc: tmphighlight.removeNick @type: command @title: - tmphighlight.remove + tmphighlight.removeNick @short: Remove a user from the channel temporary highlight list @syntax: - tmphighlight.remove <nick:string> + tmphighlight.removeNick <nick:string> @description: This command remove a user from the channel temporary highlight list, so that user messages[br] stop being highlighted. @seealso: - [fnc]$tmphighlight.add[/fnc] - [fnc]$tmphighlight.ishighlighted[/fnc] + [fnc]$tmphighlight.addNick[/fnc] + [fnc]$tmphighlight.isNickHighlighted[/fnc] */ -static bool tmphighlight_kvs_cmd_remove(KviKvsModuleCommandCall * c) +static bool tmphighlight_kvs_cmd_removenick(KviKvsModuleCommandCall * c) { QString szNick; KVSM_PARAMETERS_BEGIN(c) @@ -106,24 +106,130 @@ static bool tmphighlight_kvs_cmd_remove(KviKvsModuleCommandCall * c) } /* - @doc: tmphighlight.ishighlighted + @doc: tmphighlight.addChannel + @type: + command + @title: + tmphighlight.addChannel + @short: + Adds a channel to the irc context temporary highlight list + @syntax: + tmphighlight.addChannel [window_id:integer] + @description: + This command adds a channel to the irc context temporary highlight list, so that every user message + from that channel will be highlighted until you close that irc context. This is useful when you want + to follow every message in a low traffic channel. If you don't specify a channel, the current one + is used. + @seealso: + [fnc]$tmphighlight.removeChannel[/fnc] + [fnc]$tmphighlight.isChannelHighlighted[/fnc] + [fnc]$channel[/fnc] +*/ + +static bool tmphighlight_kvs_cmd_addchannel(KviKvsModuleCommandCall * c) +{ + QString szWnd; + KviWindow * pWnd; + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("window_id",KVS_PT_STRING,KVS_PF_OPTIONAL,szWnd) + KVSM_PARAMETERS_END(c) + if(c->parameterList()->count() == 0) + { + pWnd = c->window(); + } else { + pWnd = g_pApp->findWindow(szWnd.toUtf8().data()); + if(!pWnd) + { + c->warning(__tr2qs("Unable to find a window with the specified window id")); + return false; + } + } + + if( !pWnd->console() )return c->context()->errorNoIrcContext(); + if( pWnd->console()->isNotConnected() )return c->context()->errorNoIrcContext(); + + if(!pWnd->type() == KVI_WINDOW_TYPE_CHANNEL) + { + c->warning(__tr2qs("Current window is not a channel")); + return false; + } + + ((KviConsole *)pWnd->console())->addHighlightedChannel(pWnd->windowName()); + + return true; +} + +/* + @doc: tmphighlight.removeChannel + @type: + command + @title: + tmphighlight.removeChannel + @short: + Remove a channel from the irc context temporary highlight list + @syntax: + tmphighlight.removeChannel [window_id:integer] + @description: + This command remove a channel from the irc context temporary highlight list. + If you don't specify a channel, the current one is used. + @seealso: + [fnc]$tmphighlight.addChannel[/fnc] + [fnc]$tmphighlight.isChannelHighlighted[/fnc] + [fnc]$channel[/fnc] +*/ + +static bool tmphighlight_kvs_cmd_removechannel(KviKvsModuleCommandCall * c) +{ + QString szWnd; + KviWindow * pWnd; + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("window_id",KVS_PT_STRING,KVS_PF_OPTIONAL,szWnd) + KVSM_PARAMETERS_END(c) + if(c->parameterList()->count() == 0) + { + pWnd = c->window(); + } else { + pWnd = g_pApp->findWindow(szWnd.toUtf8().data()); + if(!pWnd) + { + c->warning(__tr2qs("Unable to find a window with the specified window id")); + return false; + } + } + + if( !pWnd->console() )return c->context()->errorNoIrcContext(); + if( pWnd->console()->isNotConnected() )return c->context()->errorNoIrcContext(); + + if(!pWnd->type() == KVI_WINDOW_TYPE_CHANNEL) + { + c->warning(__tr2qs("Current window is not a channel")); + return false; + } + + ((KviConsole *)pWnd->console())->removeHighlightedChannel(pWnd->windowName()); + + return true; +} + +/* + @doc: tmphighlight.isNickHighlighted @type: function @title: - $tmphighlight.ishighlighted + $tmphighlight.isNickHighlighted @short: Returns 1 if the user is highlighted on this channel, 0 otherwise @syntax: - <boolean> $tmphighlight.ishighlighted <nick:string> + <boolean> $tmphighlight.isNickHighlighted <nick:string> @description: This command returns 1 if the user is highlighted on this channel and on this session of 0 otherwise. @seealso: - [fnc]$tmphighlight.add[/fnc] - [fnc]$tmphighlight.remove[/fnc] + [fnc]$tmphighlight.addNick[/fnc] + [fnc]$tmphighlight.removeNick[/fnc] */ -static bool tmphighlight_kvs_fnc_ishighlighted(KviKvsModuleFunctionCall * c) +static bool tmphighlight_kvs_fnc_isnickhighlighted(KviKvsModuleFunctionCall * c) { QString szNick; KVSM_PARAMETERS_BEGIN(c) @@ -141,12 +247,65 @@ static bool tmphighlight_kvs_fnc_ishighlighted(KviKvsModuleFunctionCall * c) return true; } +/* + @doc: tmphighlight.isChannelHighlighted + @type: + function + @title: + $tmphighlight.isChannelHighlighted + @short: + Returns 1 if the channel is highlighted on this irc network, 0 otherwise + @syntax: + <boolean> $tmphighlight.isChannelHighlighted[window_id:integer] + @description: + This command returns 1 if the channel is highlighted on this irc network, 0 otherwise. + @seealso: + [fnc]$tmphighlight.addChannel[/fnc] + [fnc]$tmphighlight.removeChannel[/fnc] + [fnc]$channel[/fnc] + +*/ + +static bool tmphighlight_kvs_fnc_ischannelhighlighted(KviKvsModuleFunctionCall * c) +{ + QString szWnd; + KviWindow * pWnd; + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("window_id",KVS_PT_STRING,KVS_PF_OPTIONAL,szWnd) + KVSM_PARAMETERS_END(c) + if(c->parameterList()->count() == 0) + { + pWnd = c->window(); + } else { + pWnd = g_pApp->findWindow(szWnd.toUtf8().data()); + if(!pWnd) + { + c->warning(__tr2qs("Unable to find a window with the specified window id")); + return false; + } + } + + if( !pWnd->console() )return c->context()->errorNoIrcContext(); + if( pWnd->console()->isNotConnected() )return c->context()->errorNoIrcContext(); + + if(!pWnd->type() == KVI_WINDOW_TYPE_CHANNEL) + { + c->warning(__tr2qs("Current window is not a channel")); + return false; + } + + c->returnValue()->setBoolean(((KviConsole *)pWnd->console())->isHighlightedChannel(pWnd->windowName())); + return true; +} + static bool tmphighlight_module_init(KviModule * m) { - KVSM_REGISTER_SIMPLE_COMMAND(m,"add",tmphighlight_kvs_cmd_add); - KVSM_REGISTER_SIMPLE_COMMAND(m,"remove",tmphighlight_kvs_cmd_remove); - KVSM_REGISTER_FUNCTION(m,"isHighVisible",tmphighlight_kvs_fnc_ishighlighted); - KVSM_REGISTER_FUNCTION(m,"isHighLighted",tmphighlight_kvs_fnc_ishighlighted); + KVSM_REGISTER_SIMPLE_COMMAND(m,"addNick",tmphighlight_kvs_cmd_addnick); + KVSM_REGISTER_SIMPLE_COMMAND(m,"removeNick",tmphighlight_kvs_cmd_removenick); + KVSM_REGISTER_SIMPLE_COMMAND(m,"addChannel",tmphighlight_kvs_cmd_addchannel); + KVSM_REGISTER_SIMPLE_COMMAND(m,"removeChannel",tmphighlight_kvs_cmd_removechannel); + KVSM_REGISTER_FUNCTION(m,"isNickHighLighted",tmphighlight_kvs_fnc_isnickhighlighted); + KVSM_REGISTER_FUNCTION(m,"isChannelHighLighted",tmphighlight_kvs_fnc_ischannelhighlighted); return true; } @@ -163,8 +322,9 @@ static bool tmphighlight_module_can_unload(KviModule *) KVIRC_MODULE( "TmpHighlight", // module name "4.0.0", // module version - "(C) 2002 Juanjo Alvarez (juanjux@yahoo.es)", // author & (C) - "Temporal Highlightining of channel users", + "(C) 2002 Juanjo Alvarez (juanjux@yahoo.es)" \ + "(C) 2009 Fabio Bas (ctrlaltca at libero dot it)", // author & (C) + "Temporal Highlightining of channel and nicknames", tmphighlight_module_init, tmphighlight_module_can_unload, 0, |
