1 //============================================================================= 2 // 3 // File : KviKvsCoreFunctions.cpp 4 // Creation date : Fri 31 Oct 2003 01:52:04 by Szymon Stefanek 5 // 6 // This file is part of the KVIrc IRC client distribution 7 // Copyright (C) 2003-2010 Szymon Stefanek <pragma at kvirc dot net> 8 // 9 // This program is FREE software. You can redistribute it and/or 10 // modify it under the terms of the GNU General Public License 11 // as published by the Free Software Foundation; either version 2 12 // of the License, or (at your option) any later version. 13 // 14 // This program is distributed in the HOPE that it will be USEFUL, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 // See the GNU General Public License for more details. 18 // 19 // You should have received a copy of the GNU General Public License 20 // along with this program. If not, write to the Free Software Foundation, 21 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 // 23 //============================================================================= 24 25 #include "KviKvsCoreFunctions.h" 26 #include "KviKvsKernel.h" 27 #include "KviKvsObject.h" 28 #include "KviLocale.h" 29 30 namespace KviKvsCoreFunctions 31 { init()32 void init() 33 { 34 KviKvsKernel * pKern = KviKvsKernel::instance(); 35 36 #define _REGFNC(__fncName, __routine) \ 37 { \ 38 KviKvsCoreFunctionExecRoutine * r = new KviKvsCoreFunctionExecRoutine; \ 39 r->proc = KVI_PTR2MEMBER(KviKvsCoreFunctions::__routine); \ 40 pKern->registerCoreFunctionExecRoutine(QString(__fncName), r); \ 41 } 42 43 // a_f 44 _REGFNC("active", active) 45 _REGFNC("aliasBody", aliasBody) 46 _REGFNC("array", array) 47 _REGFNC("ascii", unicode) 48 _REGFNC("asciiToHex", asciiToHex) 49 _REGFNC("asciiToBase64", asciiToBase64) 50 _REGFNC("away", away) 51 _REGFNC("b", b) 52 _REGFNC("base64ToAscii", base64ToAscii) 53 _REGFNC("bool", boolean) 54 _REGFNC("boolean", boolean) 55 _REGFNC("certificate", certificate) 56 _REGFNC("channel", channel) 57 _REGFNC("char", charCKEYWORDWORKAROUND) 58 _REGFNC("classDefined", classDefined) 59 _REGFNC("console", console) 60 _REGFNC("context", context) 61 _REGFNC("countStatusBarItems", countStatusBarItems) 62 _REGFNC("cr", cr) 63 _REGFNC("date", date) 64 _REGFNC("escape", escape) 65 _REGFNC("false", falseCKEYWORDWORKAROUND) 66 _REGFNC("features", features) 67 _REGFNC("firstConnectedConsole", firstConnectedConsole) 68 _REGFNC("flatten", flatten) 69 _REGFNC("fmtlink", fmtlink) 70 // g_l 71 _REGFNC("gender", gender); 72 _REGFNC("globals", globals); 73 _REGFNC("hash", hash); 74 // _REGFNC("inputText",inputText); 75 _REGFNC("hexToAscii", hexToAscii); 76 _REGFNC("hostname", hostname); 77 _REGFNC("hptimestamp", hptimestamp); 78 _REGFNC("i", i); 79 _REGFNC("ic", context); 80 _REGFNC("icon", icon); 81 _REGFNC("iconName", iconName); 82 _REGFNC("insideAlias", insideAlias) 83 _REGFNC("int", integer) 84 _REGFNC("integer", integer) 85 _REGFNC("isBot", isBot) 86 _REGFNC("isEmpty", isEmpty) 87 _REGFNC("isEventEnabled", isEventEnabled) 88 _REGFNC("isMainWindowActive", isMainWindowActive) 89 _REGFNC("isMainWindowMinimized", isMainWindowMinimized) 90 _REGFNC("isNumeric", isNumeric) 91 _REGFNC("isSet", isSet) 92 _REGFNC("isTimer", isTimer) 93 _REGFNC("isWellKnown", isWellKnown) 94 _REGFNC("k", k) 95 _REGFNC("keys", keys) 96 _REGFNC("lag", lag) 97 _REGFNC("lang", lang) 98 _REGFNC("length", length) 99 _REGFNC("lf", lf) 100 _REGFNC("link", link) 101 _REGFNC("listtimers", listtimers) 102 // m_r 103 _REGFNC("mask", mask) 104 _REGFNC("me", me) 105 _REGFNC("msgtype", msgtype) 106 _REGFNC("new", newCKEYWORDWORKAROUND) 107 _REGFNC("nothing", nothing) 108 _REGFNC("null", nullCKEYWORDWORKAROUND) 109 _REGFNC("o", o) 110 _REGFNC("option", option) 111 _REGFNC("query", query) 112 _REGFNC("r", r) 113 _REGFNC("rand", rand) 114 _REGFNC("real", real) 115 _REGFNC("realname", realname) 116 _REGFNC("receivedBytes", receivedBytes) 117 _REGFNC("rsort", rsort) 118 // s_z 119 _REGFNC("scriptContextName", scriptContextName) 120 _REGFNC("selected", selected) 121 _REGFNC("sentBytes", sentBytes) 122 _REGFNC("serialize", serialize) 123 _REGFNC("server", server) 124 _REGFNC("sort", sort) 125 _REGFNC("string", string) 126 _REGFNC("sw", sw) 127 _REGFNC("target", target) 128 _REGFNC("this", thisCKEYWORDWORKAROUND) 129 _REGFNC("tr", tr) 130 _REGFNC("true", trueCKEYWORDWORKAROUND) 131 _REGFNC("typeof", typeofCKEYWORDWORKAROUND) 132 _REGFNC("u", u) 133 _REGFNC("uflags", uflags) 134 _REGFNC("unicode", unicode) 135 _REGFNC("unixtime", unixtime) 136 _REGFNC("unserialize", unserialize) 137 _REGFNC("username", username) 138 _REGFNC("version", version) 139 _REGFNC("window", window) 140 _REGFNC("$", thisCKEYWORDWORKAROUND) 141 _REGFNC("@", strayAt) 142 _REGFNC("@?", mightBeStrayAtOrThis) 143 #undef _REGCMD 144 } 145 146 static QString g_szStaticStrayConstantAt("@"); 147 KVSCF(strayAt)148 KVSCF(strayAt) 149 { 150 KVSCF_pRetBuffer->setString(g_szStaticStrayConstantAt); 151 return true; 152 } 153 KVSCF(mightBeStrayAtOrThis)154 KVSCF(mightBeStrayAtOrThis) 155 { 156 KviKvsObject * o = KVSCF_pContext->thisObject(); 157 if(o) 158 { 159 KVSCF_pRetBuffer->setHObject(o->handle()); 160 } 161 else 162 { 163 KVSCF_pRetBuffer->setString(g_szStaticStrayConstantAt); 164 } 165 return true; 166 } 167 }; 168