diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 02:13:59 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 02:13:59 +0000 |
commit | a6d58bb6052ac8cb01805a48c4ad2f129126116f (patch) | |
tree | dd867a099fcbb263a8009a9fb22695b87855dad6 /src/modules/perlcore/KVIrc.xs | |
download | kvirc-a6d58bb6052ac8cb01805a48c4ad2f129126116f.tar.gz kvirc-a6d58bb6052ac8cb01805a48c4ad2f129126116f.zip |
Added KDE3 version of kvirc
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1095341 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/perlcore/KVIrc.xs')
-rw-r--r-- | src/modules/perlcore/KVIrc.xs | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/src/modules/perlcore/KVIrc.xs b/src/modules/perlcore/KVIrc.xs new file mode 100644 index 00000000..37b040cf --- /dev/null +++ b/src/modules/perlcore/KVIrc.xs @@ -0,0 +1,139 @@ +MODULE = KVIrc PACKAGE = KVIrc + +void echo(text,colorset = 0,windowid = 0) + char * text + int colorset + char * windowid + CODE: + if(g_pCurrentKvsContext && text) + { + KviWindow * pWnd; + if(windowid) + { + pWnd = g_pApp->findWindow(windowid); + if(!pWnd)pWnd = g_pCurrentKvsContext->window(); + } else { + pWnd = g_pCurrentKvsContext->window(); + } + pWnd->outputNoFmt(colorset,QString::fromUtf8(text)); + } + +void say(text,windowid = 0) + char * text + char * windowid + CODE: + if(g_pCurrentKvsContext && text) + { + KviWindow * pWnd; + if(windowid) + { + pWnd = g_pApp->findWindow(windowid); + if(!pWnd)pWnd = g_pCurrentKvsContext->window(); + } else { + pWnd = g_pCurrentKvsContext->window(); + } + QString tmp = QString::fromUtf8(text); + KviUserInput::parse(tmp,pWnd); + } + +void warning(text) + char * text + CODE: + if((!g_bExecuteQuiet) && g_pCurrentKvsContext) + g_pCurrentKvsContext->warning(text); + +void internalWarning(text) + char * text + CODE: + if(!g_bExecuteQuiet) + g_lWarningList.append(QString(text)); + + +char * getLocal(varname) + char * varname + CODE: + QString tmp; + KviStr hack; + if(g_pCurrentKvsContext) + { + KviKvsVariant * pVar = g_pCurrentKvsContext->localVariables()->find(varname); + if(pVar) + { + pVar->asString(tmp); + hack = tmp; + RETVAL = hack.ptr(); + } else RETVAL = ""; + } + OUTPUT: + RETVAL + +void setLocal(varname,value) + char * varname + char * value + CODE: + if(g_pCurrentKvsContext) + { + if(value && *value) + { + KviKvsVariant * pVar = g_pCurrentKvsContext->localVariables()->get(varname); + pVar->setString(value); + } else { + g_pCurrentKvsContext->localVariables()->unset(varname); + } + } + +char * getGlobal(varname) + char * varname + CODE: + QString tmp; + KviStr hack; + if(g_pCurrentKvsContext) + { + KviKvsVariant * pVar = g_pCurrentKvsContext->globalVariables()->find(varname); + if(pVar) + { + pVar->asString(tmp); + hack = tmp; + RETVAL = hack.ptr(); + } else RETVAL = ""; + } + OUTPUT: + RETVAL + +void setGlobal(varname,value) + char * varname + char * value + CODE: + if(g_pCurrentKvsContext) + { + if(value && *value) + { + KviKvsVariant * pVar = g_pCurrentKvsContext->globalVariables()->get(varname); + pVar->setString(value); + } else { + g_pCurrentKvsContext->localVariables()->unset(varname); + } + } + + +char * eval(code) + char * code + CODE: + if(g_pCurrentKvsContext && code) + { + KviKvsVariant ret; + if(KviKvsScript::run(QString::fromUtf8(code),g_pCurrentKvsContext->window(),0,&ret)) + { + QString tmp; + ret.asString(tmp); + g_szLastReturnValue = tmp; + } else { + g_szLastReturnValue = ""; + } + RETVAL = g_szLastReturnValue.ptr(); + } else { + RETVAL = ""; + } + OUTPUT: + RETVAL + |