From 8e1fb06c090490317072f80b6b23838263186bc9 Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Wed, 2 Jan 2008 04:06:48 +0000 Subject: Added context module git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1050 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/window/libkviwindow.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/modules/window/libkviwindow.cpp') diff --git a/src/modules/window/libkviwindow.cpp b/src/modules/window/libkviwindow.cpp index 49baaa6b4..fee311552 100644 --- a/src/modules/window/libkviwindow.cpp +++ b/src/modules/window/libkviwindow.cpp @@ -686,6 +686,34 @@ static bool window_kvs_fnc_type(KviKvsModuleFunctionCall * c) return true; } +/* + @doc: window.context + @type: + function + @title: + $window.context + @short: + Returns the IRC context of a window + @syntax: + $window.context + $window.context() + @description: + Returns the IRC context of the window with the specified .[br] + The form with no parameters returns the IRC context of the current window.[br] + If the window with the specified id does not exist, an empty string is returned.[br] + @seealso: +*/ + +static bool window_kvs_fnc_context(KviKvsModuleFunctionCall * c) +{ + GET_KVS_FNC_WINDOW_ID + if(pWnd) + { + c->returnValue()->setInteger(pWnd->console() ? pWnd->console()->ircContextId() : 0); + } + return true; +} + /* @doc: window.caption @type: @@ -1450,6 +1478,7 @@ static bool window_module_init(KviModule *m) KVSM_REGISTER_FUNCTION(m,"list",window_kvs_fnc_list); KVSM_REGISTER_FUNCTION(m,"open",window_kvs_fnc_open); KVSM_REGISTER_FUNCTION(m,"inputText",window_kvs_fnc_inputText); + KVSM_REGISTER_FUNCTION(m,"context",window_kvs_fnc_context); KVSM_REGISTER_SIMPLE_COMMAND(m,"close",window_kvs_cmd_close); KVSM_REGISTER_SIMPLE_COMMAND(m,"clearOutput",window_kvs_cmd_clearOutput); -- cgit v1.3.1-10-gc9f91