aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/chan/libkvichan.cpp
diff options
context:
space:
mode:
authorGravatar Fabio Bas2010-08-18 12:10:46 +0000
committerGravatar Fabio Bas2010-08-18 12:10:46 +0000
commiteb30cd5bfd5ae52979f21c4353a5e434a26e45cf (patch)
treef8bfe5116d6714a6709aae5748866d122fa459f5 /src/modules/chan/libkvichan.cpp
parentFixed replace in classeditor (diff)
downloadKVIrc-eb30cd5bfd5ae52979f21c4353a5e434a26e45cf.tar.gz
KVIrc-eb30cd5bfd5ae52979f21c4353a5e434a26e45cf.tar.bz2
KVIrc-eb30cd5bfd5ae52979f21c4353a5e434a26e45cf.zip
reworked the mode widget
added $chan.modeParam() misc fixes to mode handling git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4894 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/chan/libkvichan.cpp')
-rw-r--r--src/modules/chan/libkvichan.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/modules/chan/libkvichan.cpp b/src/modules/chan/libkvichan.cpp
index d5c767aaf..9f8acbae7 100644
--- a/src/modules/chan/libkvichan.cpp
+++ b/src/modules/chan/libkvichan.cpp
@@ -934,6 +934,10 @@ static bool chan_kvs_fnc_mode(KviKvsModuleFunctionCall * c)
the current window is a chnannel at all).[br]
If the window is not a channel, a warning is printed and an empty string is returned.[br]
If the channel has no key set, an empty string is returned.[br]
+ Alternatively, you could use $chan.modeParam(k) to get the current key.
+ @seealso:
+ [fnc]$chan.mode[/fnc]
+ [fnc]$chan.modeParam[/fnc]
*/
static bool chan_kvs_fnc_key(KviKvsModuleFunctionCall * c)
{
@@ -963,6 +967,10 @@ static bool chan_kvs_fnc_key(KviKvsModuleFunctionCall * c)
the current window is a chnannel at all).[br]
If the window is not a channel, a warning is printed and an empty string is returned.[br]
If the channel has no limit set, "0" is returned.[br]
+ Alternatively, you could use $chan.modeParam(l) to get the current limit.
+ @seealso:
+ [fnc]$chan.mode[/fnc]
+ [fnc]$chan.modeParam[/fnc]
*/
static bool chan_kvs_fnc_limit(KviKvsModuleFunctionCall * c)
{
@@ -982,6 +990,42 @@ static bool chan_kvs_fnc_limit(KviKvsModuleFunctionCall * c)
}
/*
+ @doc: chan.modeParam
+ @type:
+ function
+ @title:
+ $chan.modeParam
+ @short:
+ Returns the parameter for a set mode of a channel
+ @syntax:
+ <string> $chan.modeParam(<mode:string>[,<window_id:string>])
+ @description:
+ Returns the parameter for a set mode of a channel identified by <window_id>.[br]
+ If no <window_id> is passed, the current channel key is returned (assuming that
+ the current window is a chnannel at all).[br]
+ If the window is not a channel, a warning is printed and an empty string is returned.[br]
+ If the channel has no such a mode set, an empty string is returned.[br]
+ If you need to get the current channel key or user limit, you can use one of the specialized functions.[br]
+ @seealso:
+ [fnc]$chan.mode[/fnc]
+ [fnc]$chan.key[/fnc]
+ [fnc]$chan.limit[/fnc]
+*/
+static bool chan_kvs_fnc_modeParam(KviKvsModuleFunctionCall * c)
+{
+ QString szId;
+ QString szMode;
+ KVSM_PARAMETERS_BEGIN(c)
+ KVSM_PARAMETER("mode",KVS_PT_NONEMPTYSTRING,0,szMode)
+ KVSM_PARAMETER("window id",KVS_PT_STRING,KVS_PF_OPTIONAL,szId)
+ KVSM_PARAMETERS_END(c)
+ KviChannel * ch = chan_kvs_find_channel(c,szId);
+ char cMode = szMode.at(0).unicode();
+ if (ch) c->returnValue()->setString(ch->hasChannelMode(cMode) ? ch->channelModeParam(cMode) : "");
+ return true;
+}
+
+/*
@doc: chan.users
@type:
function
@@ -1636,6 +1680,7 @@ static bool chan_module_init(KviModule * m)
KVSM_REGISTER_FUNCTION(m,"matchbanexception",chan_kvs_fnc_matchbanexception);
KVSM_REGISTER_FUNCTION(m,"matchinvite",chan_kvs_fnc_matchinvite);
KVSM_REGISTER_FUNCTION(m,"mode",chan_kvs_fnc_mode);
+ KVSM_REGISTER_FUNCTION(m,"modeParam",chan_kvs_fnc_modeParam);
KVSM_REGISTER_FUNCTION(m,"name",chan_kvs_fnc_name);
KVSM_REGISTER_FUNCTION(m,"opcount",chan_kvs_fnc_opcount);
KVSM_REGISTER_FUNCTION(m,"ownercount",chan_kvs_fnc_ownercount);