diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-20 15:48:27 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-20 15:48:27 +0000 |
commit | 2db0df5813e46fe5e077e014003acbd10698b913 (patch) | |
tree | 8d18035c30623c3dcd677c2b93fd832e6cb3d09d /docs/module-doc/modules_8cpp-source.html | |
parent | 15228d509a36036af6d8ab1f63f0ccbc0eeb0c3d (diff) |
Added module message passing architecture
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1136 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'docs/module-doc/modules_8cpp-source.html')
-rw-r--r-- | docs/module-doc/modules_8cpp-source.html | 1639 |
1 files changed, 855 insertions, 784 deletions
diff --git a/docs/module-doc/modules_8cpp-source.html b/docs/module-doc/modules_8cpp-source.html index 35bab1de2..48b1ce27a 100644 --- a/docs/module-doc/modules_8cpp-source.html +++ b/docs/module-doc/modules_8cpp-source.html @@ -155,818 +155,889 @@ 00148 <span class="keywordtype">char</span> a[MAXBUF],b[MAXBUF]; 00149 strlcpy(a,s1.c_str(),MAXBUF); 00150 strlcpy(b,s2.c_str(),MAXBUF); -00151 <span class="keywordflow">return</span> (strcasecmp(a,b) == 0); -00152 } -00153 -00154 }; +00151 strlower(a); +00152 strlower(b); +00153 <span class="keywordflow">return</span> (strcasecmp(a,b) == 0); +00154 } 00155 -<a name="l00156"></a><a class="code" href="structInAddr__HashComp.html">00156</a> <span class="keyword">struct </span><a class="code" href="structInAddr__HashComp.html">InAddr_HashComp</a> -00157 { -00158 -<a name="l00159"></a><a class="code" href="structInAddr__HashComp.html#a0">00159</a> <span class="keywordtype">bool</span> <a class="code" href="structInAddr__HashComp.html#a0">operator()</a>(<span class="keyword">const</span> in_addr &s1, <span class="keyword">const</span> in_addr &s2)<span class="keyword"> const</span> -00160 <span class="keyword"> </span>{ -00161 size_t q; -00162 size_t p; -00163 -00164 memcpy(&q,&s1,<span class="keyword">sizeof</span>(size_t)); -00165 memcpy(&p,&s2,<span class="keyword">sizeof</span>(size_t)); -00166 -00167 <span class="keywordflow">return</span> (q == p); -00168 } -00169 -00170 }; +00156 }; +00157 +<a name="l00158"></a><a class="code" href="structInAddr__HashComp.html">00158</a> <span class="keyword">struct </span><a class="code" href="structInAddr__HashComp.html">InAddr_HashComp</a> +00159 { +00160 +<a name="l00161"></a><a class="code" href="structInAddr__HashComp.html#a0">00161</a> <span class="keywordtype">bool</span> <a class="code" href="structInAddr__HashComp.html#a0">operator()</a>(<span class="keyword">const</span> in_addr &s1, <span class="keyword">const</span> in_addr &s2)<span class="keyword"> const</span> +00162 <span class="keyword"> </span>{ +00163 size_t q; +00164 size_t p; +00165 +00166 memcpy(&q,&s1,<span class="keyword">sizeof</span>(size_t)); +00167 memcpy(&p,&s2,<span class="keyword">sizeof</span>(size_t)); +00168 +00169 <span class="keywordflow">return</span> (q == p); +00170 } 00171 -00172 -<a name="l00173"></a><a class="code" href="modules_8cpp.html#a38">00173</a> <span class="keyword">typedef</span> nspace::hash_map<std::string, userrec*, nspace::hash<string>, <a class="code" href="structStrHashComp.html">StrHashComp</a>> <a class="code" href="modules_8cpp.html#a38">user_hash</a>; -<a name="l00174"></a><a class="code" href="modules_8cpp.html#a39">00174</a> <span class="keyword">typedef</span> nspace::hash_map<std::string, chanrec*, nspace::hash<string>, <a class="code" href="structStrHashComp.html">StrHashComp</a>> <a class="code" href="modules_8cpp.html#a39">chan_hash</a>; -<a name="l00175"></a><a class="code" href="modules_8cpp.html#a40">00175</a> <span class="keyword">typedef</span> nspace::hash_map<in_addr,string*, nspace::hash<in_addr>, <a class="code" href="structInAddr__HashComp.html">InAddr_HashComp</a>> <a class="code" href="modules_8cpp.html#a40">address_cache</a>; -<a name="l00176"></a><a class="code" href="modules_8cpp.html#a41">00176</a> <span class="keyword">typedef</span> std::deque<command_t> <a class="code" href="modules_8cpp.html#a41">command_table</a>; -00177 -00178 -<a name="l00179"></a><a class="code" href="modules_8cpp.html#a42">00179</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a38">user_hash</a> <a class="code" href="modules_8cpp.html#a42">clientlist</a>; -<a name="l00180"></a><a class="code" href="modules_8cpp.html#a43">00180</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a39">chan_hash</a> <a class="code" href="modules_8cpp.html#a43">chanlist</a>; -<a name="l00181"></a><a class="code" href="modules_8cpp.html#a44">00181</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a38">user_hash</a> <a class="code" href="modules_8cpp.html#a44">whowas</a>; -<a name="l00182"></a><a class="code" href="modules_8cpp.html#a45">00182</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a41">command_table</a> <a class="code" href="modules_8cpp.html#a45">cmdlist</a>; -<a name="l00183"></a><a class="code" href="modules_8cpp.html#a46">00183</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a31">file_cache</a> <a class="code" href="modules_8cpp.html#a46">MOTD</a>; -<a name="l00184"></a><a class="code" href="modules_8cpp.html#a47">00184</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a31">file_cache</a> <a class="code" href="modules_8cpp.html#a47">RULES</a>; -<a name="l00185"></a><a class="code" href="modules_8cpp.html#a48">00185</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a40">address_cache</a> <a class="code" href="modules_8cpp.html#a48">IP</a>; -00186 -00187 -00188 <span class="comment">// class type for holding an extended mode character - internal to core</span> +00172 }; +00173 +00174 +<a name="l00175"></a><a class="code" href="modules_8cpp.html#a38">00175</a> <span class="keyword">typedef</span> nspace::hash_map<std::string, userrec*, nspace::hash<string>, <a class="code" href="structStrHashComp.html">StrHashComp</a>> <a class="code" href="modules_8cpp.html#a38">user_hash</a>; +<a name="l00176"></a><a class="code" href="modules_8cpp.html#a39">00176</a> <span class="keyword">typedef</span> nspace::hash_map<std::string, chanrec*, nspace::hash<string>, <a class="code" href="structStrHashComp.html">StrHashComp</a>> <a class="code" href="modules_8cpp.html#a39">chan_hash</a>; +<a name="l00177"></a><a class="code" href="modules_8cpp.html#a40">00177</a> <span class="keyword">typedef</span> nspace::hash_map<in_addr,string*, nspace::hash<in_addr>, <a class="code" href="structInAddr__HashComp.html">InAddr_HashComp</a>> <a class="code" href="modules_8cpp.html#a40">address_cache</a>; +<a name="l00178"></a><a class="code" href="modules_8cpp.html#a41">00178</a> <span class="keyword">typedef</span> std::deque<command_t> <a class="code" href="modules_8cpp.html#a41">command_table</a>; +00179 +00180 +<a name="l00181"></a><a class="code" href="modules_8cpp.html#a42">00181</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a38">user_hash</a> <a class="code" href="modules_8cpp.html#a42">clientlist</a>; +<a name="l00182"></a><a class="code" href="modules_8cpp.html#a43">00182</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a39">chan_hash</a> <a class="code" href="modules_8cpp.html#a43">chanlist</a>; +<a name="l00183"></a><a class="code" href="modules_8cpp.html#a44">00183</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a38">user_hash</a> <a class="code" href="modules_8cpp.html#a44">whowas</a>; +<a name="l00184"></a><a class="code" href="modules_8cpp.html#a45">00184</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a41">command_table</a> <a class="code" href="modules_8cpp.html#a45">cmdlist</a>; +<a name="l00185"></a><a class="code" href="modules_8cpp.html#a46">00185</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a31">file_cache</a> <a class="code" href="modules_8cpp.html#a46">MOTD</a>; +<a name="l00186"></a><a class="code" href="modules_8cpp.html#a47">00186</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a31">file_cache</a> <a class="code" href="modules_8cpp.html#a47">RULES</a>; +<a name="l00187"></a><a class="code" href="modules_8cpp.html#a48">00187</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a40">address_cache</a> <a class="code" href="modules_8cpp.html#a48">IP</a>; +00188 00189 -<a name="l00190"></a><a class="code" href="classExtMode.html">00190</a> <span class="keyword">class </span><a class="code" href="classExtMode.html">ExtMode</a> : <span class="keyword">public</span> <a class="code" href="classclassbase.html">classbase</a> -00191 { -00192 <span class="keyword">public</span>: -<a name="l00193"></a><a class="code" href="classExtMode.html#o0">00193</a> <span class="keywordtype">char</span> <a class="code" href="classExtMode.html#o0">modechar</a>; -<a name="l00194"></a><a class="code" href="classExtMode.html#o1">00194</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o1">type</a>; -<a name="l00195"></a><a class="code" href="classExtMode.html#o2">00195</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o2">params_when_on</a>; -<a name="l00196"></a><a class="code" href="classExtMode.html#o3">00196</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o3">params_when_off</a>; -<a name="l00197"></a><a class="code" href="classExtMode.html#o4">00197</a> <span class="keywordtype">bool</span> <a class="code" href="classExtMode.html#o4">needsoper</a>; -<a name="l00198"></a><a class="code" href="classExtMode.html#o5">00198</a> <span class="keywordtype">bool</span> <a class="code" href="channels_8cpp.html#a15">list</a>; -<a name="l00199"></a><a class="code" href="classExtMode.html#a0">00199</a> <a class="code" href="classExtMode.html#a0">ExtMode</a>(<span class="keywordtype">char</span> mc, <span class="keywordtype">int</span> ty, <span class="keywordtype">bool</span> oper, <span class="keywordtype">int</span> p_on, <span class="keywordtype">int</span> p_off) : <a class="code" href="classExtMode.html#o0">modechar</a>(mc), <a class="code" href="classExtMode.html#o1">type</a>(ty), <a class="code" href="classExtMode.html#o4">needsoper</a>(oper), <a class="code" href="classExtMode.html#o2">params_when_on</a>(p_on), <a class="code" href="classExtMode.html#o3">params_when_off</a>(p_off) { }; -00200 }; -00201 -<a name="l00202"></a><a class="code" href="modules_8cpp.html#a49">00202</a> <span class="keyword">typedef</span> std::vector<ExtMode> <a class="code" href="modules_8cpp.html#a49">ExtModeList</a>; -<a name="l00203"></a><a class="code" href="modules_8cpp.html#a50">00203</a> <span class="keyword">typedef</span> ExtModeList::iterator <a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a>; -00204 -00205 -<a name="l00206"></a><a class="code" href="modules_8cpp.html#a51">00206</a> <a class="code" href="modules_8cpp.html#a49">ExtModeList</a> <a class="code" href="modules_8cpp.html#a51">EMode</a>; +00190 <span class="comment">// class type for holding an extended mode character - internal to core</span> +00191 +<a name="l00192"></a><a class="code" href="classExtMode.html">00192</a> <span class="keyword">class </span><a class="code" href="classExtMode.html">ExtMode</a> : <span class="keyword">public</span> <a class="code" href="classclassbase.html">classbase</a> +00193 { +00194 <span class="keyword">public</span>: +<a name="l00195"></a><a class="code" href="classExtMode.html#o0">00195</a> <span class="keywordtype">char</span> <a class="code" href="classExtMode.html#o0">modechar</a>; +<a name="l00196"></a><a class="code" href="classExtMode.html#o1">00196</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o1">type</a>; +<a name="l00197"></a><a class="code" href="classExtMode.html#o2">00197</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o2">params_when_on</a>; +<a name="l00198"></a><a class="code" href="classExtMode.html#o3">00198</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o3">params_when_off</a>; +<a name="l00199"></a><a class="code" href="classExtMode.html#o4">00199</a> <span class="keywordtype">bool</span> <a class="code" href="classExtMode.html#o4">needsoper</a>; +<a name="l00200"></a><a class="code" href="classExtMode.html#o5">00200</a> <span class="keywordtype">bool</span> <a class="code" href="channels_8cpp.html#a15">list</a>; +<a name="l00201"></a><a class="code" href="classExtMode.html#a0">00201</a> <a class="code" href="classExtMode.html#a0">ExtMode</a>(<span class="keywordtype">char</span> mc, <span class="keywordtype">int</span> ty, <span class="keywordtype">bool</span> oper, <span class="keywordtype">int</span> p_on, <span class="keywordtype">int</span> p_off) : <a class="code" href="classExtMode.html#o0">modechar</a>(mc), <a class="code" href="classExtMode.html#o1">type</a>(ty), <a class="code" href="classExtMode.html#o4">needsoper</a>(oper), <a class="code" href="classExtMode.html#o2">params_when_on</a>(p_on), <a class="code" href="classExtMode.html#o3">params_when_off</a>(p_off) { }; +00202 }; +00203 +<a name="l00204"></a><a class="code" href="modules_8cpp.html#a49">00204</a> <span class="keyword">typedef</span> std::vector<ExtMode> <a class="code" href="modules_8cpp.html#a49">ExtModeList</a>; +<a name="l00205"></a><a class="code" href="modules_8cpp.html#a50">00205</a> <span class="keyword">typedef</span> ExtModeList::iterator <a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a>; +00206 00207 -00208 <span class="comment">// returns true if an extended mode character is in use</span> -<a name="l00209"></a><a class="code" href="modules_8cpp.html#a52">00209</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a52">ModeDefined</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00210 { -00211 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); -00212 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) -00213 { -00214 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) -00215 { -00216 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00217 } -00218 } -00219 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00220 } -00221 -<a name="l00222"></a><a class="code" href="modules_8cpp.html#a53">00222</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a53">ModeIsListMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00223 { -00224 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); -00225 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) -00226 { -00227 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->list == <span class="keyword">true</span>)) -00228 { -00229 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00230 } -00231 } -00232 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00233 } -00234 -<a name="l00235"></a><a class="code" href="modules_8cpp.html#a54">00235</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a54">ModeDefinedOper</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00236 { -00237 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); -00238 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) -00239 { -00240 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->needsoper == <span class="keyword">true</span>)) -00241 { -00242 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00243 } -00244 } -00245 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00246 } -00247 -00248 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> -<a name="l00249"></a><a class="code" href="modules_8cpp.html#a55">00249</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a55">ModeDefinedOn</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00250 { -00251 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) -00252 { -00253 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) -00254 { -00255 <span class="keywordflow">return</span> i->params_when_on; -00256 } -00257 } -00258 <span class="keywordflow">return</span> 0; -00259 } -00260 -00261 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> -<a name="l00262"></a><a class="code" href="modules_8cpp.html#a56">00262</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a56">ModeDefinedOff</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00263 { -00264 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) -00265 { -00266 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) -00267 { -00268 <span class="keywordflow">return</span> i->params_when_off; -00269 } -00270 } -00271 <span class="keywordflow">return</span> 0; -00272 } -00273 -00274 <span class="comment">// returns true if an extended mode character is in use</span> -<a name="l00275"></a><a class="code" href="modules_8cpp.html#a57">00275</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a57">DoAddExtendedMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type, <span class="keywordtype">bool</span> requires_oper, <span class="keywordtype">int</span> params_on, <span class="keywordtype">int</span> params_off) -00276 { -00277 <span class="keywordflow">if</span> (<a class="code" href="modules_8cpp.html#a52">ModeDefined</a>(modechar,type)) { -00278 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00279 } -00280 <a class="code" href="modules_8cpp.html#a51">EMode</a>.push_back(<a class="code" href="classExtMode.html">ExtMode</a>(modechar,type,requires_oper,params_on,params_off)); -00281 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00282 } -00283 -00284 <span class="comment">// turns a mode into a listmode</span> -<a name="l00285"></a><a class="code" href="modules_8cpp.html#a58">00285</a> <span class="keywordtype">void</span> <a class="code" href="modules_8cpp.html#a58">ModeMakeList</a>(<span class="keywordtype">char</span> modechar) -00286 { -00287 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) -00288 { -00289 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == <a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>)) -00290 { -00291 i->list = <span class="keyword">true</span>; -00292 <span class="keywordflow">return</span>; -00293 } -00294 } -00295 <span class="keywordflow">return</span>; -00296 } -00297 -00298 <span class="comment">// version is a simple class for holding a modules version number</span> +<a name="l00208"></a><a class="code" href="modules_8cpp.html#a51">00208</a> <a class="code" href="modules_8cpp.html#a49">ExtModeList</a> <a class="code" href="modules_8cpp.html#a51">EMode</a>; +00209 +00210 <span class="comment">// returns true if an extended mode character is in use</span> +<a name="l00211"></a><a class="code" href="modules_8cpp.html#a52">00211</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a52">ModeDefined</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) +00212 { +00213 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); +00214 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00215 { +00216 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) +00217 { +00218 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00219 } +00220 } +00221 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00222 } +00223 +<a name="l00224"></a><a class="code" href="modules_8cpp.html#a53">00224</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a53">ModeIsListMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) +00225 { +00226 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); +00227 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00228 { +00229 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->list == <span class="keyword">true</span>)) +00230 { +00231 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00232 } +00233 } +00234 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00235 } +00236 +<a name="l00237"></a><a class="code" href="modules_8cpp.html#a54">00237</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a54">ModeDefinedOper</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) +00238 { +00239 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); +00240 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00241 { +00242 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->needsoper == <span class="keyword">true</span>)) +00243 { +00244 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00245 } +00246 } +00247 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00248 } +00249 +00250 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> +<a name="l00251"></a><a class="code" href="modules_8cpp.html#a55">00251</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a55">ModeDefinedOn</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) +00252 { +00253 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00254 { +00255 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) +00256 { +00257 <span class="keywordflow">return</span> i->params_when_on; +00258 } +00259 } +00260 <span class="keywordflow">return</span> 0; +00261 } +00262 +00263 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> +<a name="l00264"></a><a class="code" href="modules_8cpp.html#a56">00264</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a56">ModeDefinedOff</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) +00265 { +00266 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00267 { +00268 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) +00269 { +00270 <span class="keywordflow">return</span> i->params_when_off; +00271 } +00272 } +00273 <span class="keywordflow">return</span> 0; +00274 } +00275 +00276 <span class="comment">// returns true if an extended mode character is in use</span> +<a name="l00277"></a><a class="code" href="modules_8cpp.html#a57">00277</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a57">DoAddExtendedMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type, <span class="keywordtype">bool</span> requires_oper, <span class="keywordtype">int</span> params_on, <span class="keywordtype">int</span> params_off) +00278 { +00279 <span class="keywordflow">if</span> (<a class="code" href="modules_8cpp.html#a52">ModeDefined</a>(modechar,type)) { +00280 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00281 } +00282 <a class="code" href="modules_8cpp.html#a51">EMode</a>.push_back(<a class="code" href="classExtMode.html">ExtMode</a>(modechar,type,requires_oper,params_on,params_off)); +00283 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00284 } +00285 +00286 <span class="comment">// turns a mode into a listmode</span> +<a name="l00287"></a><a class="code" href="modules_8cpp.html#a58">00287</a> <span class="keywordtype">void</span> <a class="code" href="modules_8cpp.html#a58">ModeMakeList</a>(<span class="keywordtype">char</span> modechar) +00288 { +00289 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00290 { +00291 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == <a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>)) +00292 { +00293 i->list = <span class="keyword">true</span>; +00294 <span class="keywordflow">return</span>; +00295 } +00296 } +00297 <span class="keywordflow">return</span>; +00298 } 00299 -<a name="l00300"></a><a class="code" href="classVersion.html#a0">00300</a> <a class="code" href="classVersion.html#a0">Version::Version</a>(<span class="keywordtype">int</span> major, <span class="keywordtype">int</span> minor, <span class="keywordtype">int</span> revision, <span class="keywordtype">int</span> build, <span class="keywordtype">int</span> flags) : Major(major), Minor(minor), Revision(revision), Build(build), Flags(flags) { }; +00300 <span class="comment">// version is a simple class for holding a modules version number</span> 00301 -00302 <span class="comment">// admin is a simple class for holding a server's administrative info</span> +<a name="l00302"></a><a class="code" href="classVersion.html#a0">00302</a> <a class="code" href="classVersion.html#a0">Version::Version</a>(<span class="keywordtype">int</span> major, <span class="keywordtype">int</span> minor, <span class="keywordtype">int</span> revision, <span class="keywordtype">int</span> build, <span class="keywordtype">int</span> flags) : Major(major), Minor(minor), Revision(revision), Build(build), Flags(flags) { }; 00303 -<a name="l00304"></a><a class="code" href="classAdmin.html#a0">00304</a> <a class="code" href="classAdmin.html#a0">Admin::Admin</a>(std::string name, std::string email, std::string nick) : Name(name), Email(email), Nick(nick) { }; +00304 <span class="comment">// admin is a simple class for holding a server's administrative info</span> 00305 -<a name="l00306"></a><a class="code" href="classModule.html#a0">00306</a> <a class="code" href="classModule.html#a0">Module::Module</a>() { } -<a name="l00307"></a><a class="code" href="classModule.html#a1">00307</a> <a class="code" href="classModule.html#a1">Module::~Module</a>() { } -<a name="l00308"></a><a class="code" href="classModule.html#a3">00308</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a3">Module::OnUserConnect</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { } -<a name="l00309"></a><a class="code" href="classModule.html#a4">00309</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a4">Module::OnUserQuit</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { } -<a name="l00310"></a><a class="code" href="classModule.html#a5">00310</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a5">Module::OnUserJoin</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* channel) { } -<a name="l00311"></a><a class="code" href="classModule.html#a6">00311</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a6">Module::OnUserPart</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* channel) { } -<a name="l00312"></a><a class="code" href="classModule.html#a7">00312</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a7">Module::OnPacketTransmit</a>(std::string &data, std::string serv) { } -<a name="l00313"></a><a class="code" href="classModule.html#a8">00313</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a8">Module::OnPacketReceive</a>(std::string &data, std::string serv) { } -<a name="l00314"></a><a class="code" href="classModule.html#a9">00314</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a9">Module::OnRehash</a>() { } -<a name="l00315"></a><a class="code" href="classModule.html#a10">00315</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a10">Module::OnServerRaw</a>(std::string &raw, <span class="keywordtype">bool</span> inbound, <a class="code" href="classuserrec.html">userrec</a>* user) { } -<a name="l00316"></a><a class="code" href="classModule.html#a12">00316</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a12">Module::OnUserPreJoin</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, <span class="keyword">const</span> <span class="keywordtype">char</span>* cname) { <span class="keywordflow">return</span> 0; } -<a name="l00317"></a><a class="code" href="classModule.html#a11">00317</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a11">Module::OnExtendedMode</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <span class="keywordtype">void</span>* target, <span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type, <span class="keywordtype">bool</span> mode_on, string_list &params) { <span class="keywordflow">return</span> <span class="keyword">false</span>; } -<a name="l00318"></a><a class="code" href="classModule.html#a2">00318</a> <a class="code" href="classVersion.html">Version</a> <a class="code" href="classModule.html#a2">Module::GetVersion</a>() { <span class="keywordflow">return</span> <a class="code" href="classVersion.html">Version</a>(1,0,0,0,<a class="code" href="modules_8h.html#a21">VF_VENDOR</a>); } -<a name="l00319"></a><a class="code" href="classModule.html#a15">00319</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a15">Module::OnOper</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { }; -<a name="l00320"></a><a class="code" href="classModule.html#a16">00320</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a16">Module::OnInfo</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { }; -<a name="l00321"></a><a class="code" href="classModule.html#a17">00321</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a17">Module::OnWhois</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* dest) { }; -<a name="l00322"></a><a class="code" href="classModule.html#a18">00322</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a18">Module::OnUserPreInvite</a>(<a class="code" href="classuserrec.html">userrec</a>* source,<a class="code" href="classuserrec.html">userrec</a>* dest,<a class="code" href="classchanrec.html">chanrec</a>* channel) { <span class="keywordflow">return</span> 0; }; -<a name="l00323"></a><a class="code" href="classModule.html#a19">00323</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a19">Module::OnUserPreMessage</a>(<a class="code" href="classuserrec.html">userrec</a>* user,<span class="keywordtype">void</span>* dest,<span class="keywordtype">int</span> target_type, std::string &text) { <span class="keywordflow">return</span> 0; }; -<a name="l00324"></a><a class="code" href="classModule.html#a20">00324</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a20">Module::OnUserPreNotice</a>(<a class="code" href="classuserrec.html">userrec</a>* user,<span class="keywordtype">void</span>* dest,<span class="keywordtype">int</span> target_type, std::string &text) { <span class="keywordflow">return</span> 0; }; -<a name="l00325"></a><a class="code" href="classModule.html#a21">00325</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a21">Module::OnUserPreNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newnick) { <span class="keywordflow">return</span> 0; }; -<a name="l00326"></a><a class="code" href="classModule.html#a22">00326</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a22">Module::OnUserPostNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string oldnick) { }; -<a name="l00327"></a><a class="code" href="classModule.html#a23">00327</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a23">Module::OnAccessCheck</a>(<a class="code" href="classuserrec.html">userrec</a>* source,<a class="code" href="classuserrec.html">userrec</a>* dest,<a class="code" href="classchanrec.html">chanrec</a>* channel,<span class="keywordtype">int</span> access_type) { <span class="keywordflow">return</span> <a class="code" href="modules_8h.html#a8">ACR_DEFAULT</a>; }; -<a name="l00328"></a><a class="code" href="classModule.html#a24">00328</a> <a class="code" href="modules_8h.html#a32">string_list</a> <a class="code" href="classModule.html#a24">Module::OnUserSync</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { <a class="code" href="modules_8h.html#a32">string_list</a> empty; <span class="keywordflow">return</span> empty; } -<a name="l00329"></a><a class="code" href="classModule.html#a25">00329</a> <a class="code" href="modules_8h.html#a32">string_list</a> <a class="code" href="classModule.html#a25">Module::OnChannelSync</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) { <a class="code" href="modules_8h.html#a32">string_list</a> empty; <span class="keywordflow">return</span> empty; } -<a name="l00330"></a><a class="code" href="classModule.html#a26">00330</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a26">Module::On005Numeric</a>(std::string &output) { }; -<a name="l00331"></a><a class="code" href="classModule.html#a27">00331</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a27">Module::OnKill</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* dest, std::string reason) { <span class="keywordflow">return</span> 0; }; -<a name="l00332"></a><a class="code" href="classModule.html#a28">00332</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a28">Module::OnLoadModule</a>(<a class="code" href="classModule.html">Module</a>* mod,std::string name) { }; -<a name="l00333"></a><a class="code" href="classModule.html#a29">00333</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a29">Module::OnBackgroundTimer</a>(time_t curtime) { }; -<a name="l00334"></a><a class="code" href="classModule.html#a30">00334</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a30">Module::OnSendList</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* channel, <span class="keywordtype">char</span> mode) { }; -<a name="l00335"></a><a class="code" href="classModule.html#a31">00335</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a31">Module::OnPreCommand</a>(std::string command, <span class="keywordtype">char</span> **parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a> *user) { <span class="keywordflow">return</span> 0; }; -<a name="l00336"></a><a class="code" href="classModule.html#a32">00336</a> <span class="keywordtype">bool</span> <a class="code" href="classModule.html#a32">Module::OnCheckReady</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { <span class="keywordflow">return</span> <span class="keyword">true</span>; }; -<a name="l00337"></a><a class="code" href="classModule.html#a33">00337</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a33">Module::OnUserRegister</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { }; -<a name="l00338"></a><a class="code" href="classModule.html#a13">00338</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a13">Module::OnUserPreKick</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, std::string reason) { <span class="keywordflow">return</span> 0; }; -<a name="l00339"></a><a class="code" href="classModule.html#a14">00339</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a14">Module::OnUserKick</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, std::string reason) { }; -<a name="l00340"></a><a class="code" href="classModule.html#a34">00340</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a34">Module::OnRawMode</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, <span class="keywordtype">char</span> mode, std::string param, <span class="keywordtype">bool</span> adding, <span class="keywordtype">int</span> pcnt) { <span class="keywordflow">return</span> 0; }; -<a name="l00341"></a><a class="code" href="classModule.html#a35">00341</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a35">Module::OnCheckInvite</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan) { <span class="keywordflow">return</span> 0; }; -<a name="l00342"></a><a class="code" href="classModule.html#a36">00342</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a36">Module::OnCheckKey</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, std::string keygiven) { <span class="keywordflow">return</span> 0; }; -<a name="l00343"></a><a class="code" href="classModule.html#a37">00343</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a37">Module::OnCheckLimit</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan) { <span class="keywordflow">return</span> 0; }; -<a name="l00344"></a><a class="code" href="classModule.html#a38">00344</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a38">Module::OnCheckBan</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan) { <span class="keywordflow">return</span> 0; }; -<a name="l00345"></a><a class="code" href="classModule.html#a39">00345</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a39">Module::OnStats</a>(<span class="keywordtype">char</span> symbol) { }; -<a name="l00346"></a><a class="code" href="classModule.html#a40">00346</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a40">Module::OnChangeLocalUserHost</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newhost) { <span class="keywordflow">return</span> 0; }; -<a name="l00347"></a><a class="code" href="classModule.html#a41">00347</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a41">Module::OnChangeLocalUserGECOS</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newhost) { <span class="keywordflow">return</span> 0; }; -<a name="l00348"></a><a class="code" href="classModule.html#a42">00348</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a42">Module::OnLocalTopicChange</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, std::string topic) { <span class="keywordflow">return</span> 0; }; -<a name="l00349"></a><a class="code" href="classModule.html#a43">00349</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a43">Module::OnMeshToken</a>(<span class="keywordtype">char</span> token,string_list params,<a class="code" href="classserverrec.html">serverrec</a>* source,<a class="code" href="classserverrec.html">serverrec</a>* reply, std::string tcp_host,std::string ipaddr,<span class="keywordtype">int</span> port) { <span class="keywordflow">return</span> 0; }; -00350 -00351 <span class="comment">// server is a wrapper class that provides methods to all of the C-style</span> -00352 <span class="comment">// exports in the core</span> -00353 <span class="comment">//</span> +<a name="l00306"></a><a class="code" href="classAdmin.html#a0">00306</a> <a class="code" href="classAdmin.html#a0">Admin::Admin</a>(std::string name, std::string email, std::string nick) : Name(name), Email(email), Nick(nick) { }; +00307 +<a name="l00308"></a><a class="code" href="classRequest.html#a0">00308</a> <a class="code" href="classRequest.html#a0">Request::Request</a>(<span class="keywordtype">char</span>* anydata, <a class="code" href="classModule.html">Module</a>* src, <a class="code" href="classModule.html">Module</a>* dst) : data(anydata), source(src), dest(dst) { }; +00309 +<a name="l00310"></a><a class="code" href="classRequest.html#a1">00310</a> <span class="keywordtype">char</span>* <a class="code" href="classRequest.html#a1">Request::GetData</a>() +00311 { +00312 <span class="keywordflow">return</span> this-><a class="code" href="classRequest.html#p0">data</a>; +00313 } +00314 +<a name="l00315"></a><a class="code" href="classRequest.html#a2">00315</a> <a class="code" href="classModule.html">Module</a>* <a class="code" href="classRequest.html#a2">Request::GetSource</a>() +00316 { +00317 <span class="keywordflow">return</span> this-><a class="code" href="classRequest.html#p1">source</a>; +00318 } +00319 +<a name="l00320"></a><a class="code" href="classRequest.html#a3">00320</a> <a class="code" href="classModule.html">Module</a>* <a class="code" href="classRequest.html#a3">Request::GetDest</a>() +00321 { +00322 <span class="keywordflow">return</span> this-><a class="code" href="classRequest.html#p2">dest</a>; +00323 } +00324 +<a name="l00325"></a><a class="code" href="classRequest.html#a4">00325</a> <span class="keywordtype">char</span>* <a class="code" href="classRequest.html#a4">Request::Send</a>() +00326 { +00327 <span class="keywordflow">if</span> (this-><a class="code" href="classRequest.html#p2">dest</a>) +00328 { +00329 <span class="keywordflow">return</span> <a class="code" href="classRequest.html#p2">dest</a>-><a class="code" href="classModule.html#a46">OnRequest</a>(<span class="keyword">this</span>); +00330 } +00331 <span class="keywordflow">else</span> +00332 { +00333 <span class="keywordflow">return</span> NULL; +00334 } +00335 } +00336 +<a name="l00337"></a><a class="code" href="classEvent.html#a0">00337</a> <a class="code" href="classEvent.html#a0">Event::Event</a>(<span class="keywordtype">char</span>* anydata, <a class="code" href="classModule.html">Module</a>* src, std::string eventid) : data(anydata), source(src), id(eventid) { }; +00338 +<a name="l00339"></a><a class="code" href="classEvent.html#a1">00339</a> <span class="keywordtype">char</span>* <a class="code" href="classEvent.html#a1">Event::GetData</a>() +00340 { +00341 <span class="keywordflow">return</span> this-><a class="code" href="classEvent.html#p0">data</a>; +00342 } +00343 +<a name="l00344"></a><a class="code" href="classEvent.html#a2">00344</a> <a class="code" href="classModule.html">Module</a>* <a class="code" href="classEvent.html#a2">Event::GetSource</a>() +00345 { +00346 <span class="keywordflow">return</span> this-><a class="code" href="classEvent.html#p1">source</a>; +00347 } +00348 +<a name="l00349"></a><a class="code" href="classEvent.html#a4">00349</a> <span class="keywordtype">char</span>* <a class="code" href="classEvent.html#a4">Event::Send</a>() +00350 { +00351 <a class="code" href="modules_8h.html#a24">FOREACH_MOD</a> OnEvent(<span class="keyword">this</span>); +00352 <span class="keywordflow">return</span> NULL; +00353 } 00354 -<a name="l00355"></a><a class="code" href="classServer.html#a0">00355</a> <a class="code" href="classServer.html#a0">Server::Server</a>() +<a name="l00355"></a><a class="code" href="classEvent.html#a3">00355</a> std::string <a class="code" href="classEvent.html#a3">Event::GetEventID</a>() 00356 { -00357 } -00358 -<a name="l00359"></a><a class="code" href="classServer.html#a1">00359</a> <a class="code" href="classServer.html#a1">Server::~Server</a>() -00360 { -00361 } -00362 -<a name="l00363"></a><a class="code" href="classServer.html#a2">00363</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a2">Server::SendOpers</a>(std::string s) -00364 { -00365 WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str()); -00366 } -00367 -<a name="l00368"></a><a class="code" href="classServer.html#a30">00368</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a30">Server::MatchText</a>(std::string sliteral, std::string spattern) -00369 { -00370 <span class="keywordtype">char</span> literal[MAXBUF],pattern[MAXBUF]; -00371 strlcpy(literal,sliteral.c_str(),MAXBUF); -00372 strlcpy(pattern,spattern.c_str(),MAXBUF); -00373 <span class="keywordflow">return</span> match(literal,pattern); -00374 } -00375 -<a name="l00376"></a><a class="code" href="classServer.html#a25">00376</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a25">Server::SendToModeMask</a>(std::string modes, <span class="keywordtype">int</span> flags, std::string text) -00377 { -00378 WriteMode(modes.c_str(),flags,<span class="stringliteral">"%s"</span>,text.c_str()); -00379 } -00380 -<a name="l00381"></a><a class="code" href="classServer.html#a26">00381</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a26">Server::JoinUserToChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string cname, std::string key) -00382 { -00383 <span class="keywordflow">return</span> add_channel(user,cname.c_str(),key.c_str(),<span class="keyword">true</span>); -00384 } -00385 -<a name="l00386"></a><a class="code" href="classServer.html#a27">00386</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a27">Server::PartUserFromChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string cname, std::string reason) -00387 { -00388 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>); -00389 } -00390 -<a name="l00391"></a><a class="code" href="classServer.html#a35">00391</a> <a class="code" href="modules_8h.html#a33">chanuserlist</a> <a class="code" href="classServer.html#a35">Server::GetUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) -00392 { -00393 <a class="code" href="modules_8h.html#a33">chanuserlist</a> userl; -00394 userl.clear(); -00395 <span class="keywordflow">for</span> (user_hash::const_iterator i = <a class="code" href="modules_8cpp.html#a42">clientlist</a>.begin(); i != <a class="code" href="modules_8cpp.html#a42">clientlist</a>.end(); i++) -00396 { -00397 <span class="keywordflow">if</span> (i->second) -00398 { -00399 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a16">has_channel</a>(i->second,chan)) -00400 { -00401 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a13">isnick</a>(i->second->nick)) -00402 { -00403 userl.push_back(i->second); -00404 } -00405 } -00406 } -00407 } -00408 <span class="keywordflow">return</span> userl; -00409 } -<a name="l00410"></a><a class="code" href="classServer.html#a28">00410</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a28">Server::ChangeUserNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string nickname) -00411 { -00412 force_nickchange(user,nickname.c_str()); -00413 } -00414 -<a name="l00415"></a><a class="code" href="classServer.html#a29">00415</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a29">Server::QuitUser</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string reason) -00416 { -00417 <a class="code" href="message_8h.html#a19">send_network_quit</a>(user-><a class="code" href="classuserrec.html#o0">nick</a>,reason.c_str()); -00418 kill_link(user,reason.c_str()); -00419 } -00420 -<a name="l00421"></a><a class="code" href="classServer.html#a34">00421</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a34">Server::IsUlined</a>(std::string server) -00422 { -00423 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a74">is_uline</a>(server.c_str()); -00424 } -00425 -<a name="l00426"></a><a class="code" href="classServer.html#a31">00426</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a31">Server::CallCommandHandler</a>(std::string commandname, <span class="keywordtype">char</span>** parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a>* user) -00427 { -00428 call_handler(commandname.c_str(),parameters,pcnt,user); -00429 } -00430 -<a name="l00431"></a><a class="code" href="classServer.html#a3">00431</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a3">Server::Log</a>(<span class="keywordtype">int</span> level, std::string s) -00432 { -00433 log(level,<span class="stringliteral">"%s"</span>,s.c_str()); -00434 } -00435 -<a name="l00436"></a><a class="code" href="classServer.html#a23">00436</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a23">Server::AddCommand</a>(<span class="keywordtype">char</span>* cmd, handlerfunc f, <span class="keywordtype">char</span> flags, <span class="keywordtype">int</span> minparams, <span class="keywordtype">char</span>* source) -00437 { -00438 <a class="code" href="modules_8h.html#a35">createcommand</a>(cmd,f,flags,minparams,source); -00439 } -00440 -<a name="l00441"></a><a class="code" href="classServer.html#a24">00441</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a24">Server::SendMode</a>(<span class="keywordtype">char</span> **parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a> *user) -00442 { -00443 <a class="code" href="modules_8h.html#a36">server_mode</a>(parameters,pcnt,user); -00444 } -00445 -<a name="l00446"></a><a class="code" href="classServer.html#a4">00446</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a4">Server::Send</a>(<span class="keywordtype">int</span> Socket, std::string s) -00447 { -00448 Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); -00449 } -00450 -<a name="l00451"></a><a class="code" href="classServer.html#a5">00451</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a5">Server::SendServ</a>(<span class="keywordtype">int</span> Socket, std::string s) -00452 { -00453 WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); -00454 } -00455 -<a name="l00456"></a><a class="code" href="classServer.html#a6">00456</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a6">Server::SendFrom</a>(<span class="keywordtype">int</span> Socket, <a class="code" href="classuserrec.html">userrec</a>* User, std::string s) -00457 { -00458 WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00459 } -00460 -<a name="l00461"></a><a class="code" href="classServer.html#a7">00461</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a7">Server::SendTo</a>(<a class="code" href="classuserrec.html">userrec</a>* Source, <a class="code" href="classuserrec.html">userrec</a>* Dest, std::string s) -00462 { -00463 <span class="keywordflow">if</span> (!Source) -00464 { -00465 <span class="comment">// if source is NULL, then the message originates from the local server</span> -00466 Write(Dest-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">":%s %s"</span>,this->GetServerName().c_str(),s.c_str()); -00467 } -00468 <span class="keywordflow">else</span> -00469 { -00470 <span class="comment">// otherwise it comes from the user specified</span> -00471 WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str()); -00472 } -00473 } -00474 -<a name="l00475"></a><a class="code" href="classServer.html#a8">00475</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a8">Server::SendChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Channel, std::string s,<span class="keywordtype">bool</span> IncludeSender) -00476 { -00477 <span class="keywordflow">if</span> (IncludeSender) -00478 { -00479 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00480 } -00481 <span class="keywordflow">else</span> -00482 { -00483 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00484 } -00485 } -00486 -<a name="l00487"></a><a class="code" href="classServer.html#a9">00487</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a9">Server::CommonChannels</a>(<a class="code" href="classuserrec.html">userrec</a>* u1, <a class="code" href="classuserrec.html">userrec</a>* u2) -00488 { -00489 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a0">common_channels</a>(u1,u2) != 0); -00490 } -00491 -<a name="l00492"></a><a class="code" href="classServer.html#a10">00492</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a10">Server::SendCommon</a>(<a class="code" href="classuserrec.html">userrec</a>* User, std::string text,<span class="keywordtype">bool</span> IncludeSender) -00493 { -00494 <span class="keywordflow">if</span> (IncludeSender) -00495 { -00496 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str()); -00497 } -00498 <span class="keywordflow">else</span> -00499 { -00500 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str()); -00501 } -00502 } -00503 -<a name="l00504"></a><a class="code" href="classServer.html#a11">00504</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a11">Server::SendWallops</a>(<a class="code" href="classuserrec.html">userrec</a>* User, std::string text) -00505 { -00506 WriteWallOps(User,<span class="keyword">false</span>,<span class="stringliteral">"%s"</span>,text.c_str()); -00507 } -00508 -<a name="l00509"></a><a class="code" href="classServer.html#a32">00509</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a32">Server::ChangeHost</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string host) -00510 { -00511 <a class="code" href="message_8h.html#a11">ChangeDisplayedHost</a>(user,host.c_str()); -00512 } -00513 -<a name="l00514"></a><a class="code" href="classServer.html#a33">00514</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a33">Server::ChangeGECOS</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string gecos) -00515 { -00516 <a class="code" href="message_8h.html#a10">ChangeName</a>(user,gecos.c_str()); -00517 } -00518 -<a name="l00519"></a><a class="code" href="classServer.html#a12">00519</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a12">Server::IsNick</a>(std::string nick) -00520 { -00521 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a13">isnick</a>(nick.c_str()) != 0); -00522 } -00523 -<a name="l00524"></a><a class="code" href="classServer.html#a14">00524</a> <a class="code" href="classuserrec.html">userrec</a>* <a class="code" href="classServer.html#a14">Server::FindNick</a>(std::string nick) -00525 { -00526 <span class="keywordflow">return</span> Find(nick); -00527 } -00528 -<a name="l00529"></a><a class="code" href="classServer.html#a15">00529</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a15">Server::FindChannel</a>(std::string channel) -00530 { -00531 <span class="keywordflow">return</span> FindChan(channel.c_str()); +00357 <span class="keywordflow">return</span> this-><a class="code" href="classEvent.html#p2">id</a>; +00358 } +00359 +00360 +<a name="l00361"></a><a class="code" href="classModule.html#a0">00361</a> <a class="code" href="classModule.html#a0">Module::Module</a>() { } +<a name="l00362"></a><a class="code" href="classModule.html#a1">00362</a> <a class="code" href="classModule.html#a1">Module::~Module</a>() { } +<a name="l00363"></a><a class="code" href="classModule.html#a3">00363</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a3">Module::OnUserConnect</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { } +<a name="l00364"></a><a class="code" href="classModule.html#a4">00364</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a4">Module::OnUserQuit</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { } +<a name="l00365"></a><a class="code" href="classModule.html#a5">00365</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a5">Module::OnUserDisconnect</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { } +<a name="l00366"></a><a class="code" href="classModule.html#a6">00366</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a6">Module::OnUserJoin</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* channel) { } +<a name="l00367"></a><a class="code" href="classModule.html#a7">00367</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a7">Module::OnUserPart</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* channel) { } +<a name="l00368"></a><a class="code" href="classModule.html#a8">00368</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a8">Module::OnPacketTransmit</a>(std::string &data, std::string serv) { } +<a name="l00369"></a><a class="code" href="classModule.html#a9">00369</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a9">Module::OnPacketReceive</a>(std::string &data, std::string serv) { } +<a name="l00370"></a><a class="code" href="classModule.html#a10">00370</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a10">Module::OnRehash</a>() { } +<a name="l00371"></a><a class="code" href="classModule.html#a11">00371</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a11">Module::OnServerRaw</a>(std::string &raw, <span class="keywordtype">bool</span> inbound, <a class="code" href="classuserrec.html">userrec</a>* user) { } +<a name="l00372"></a><a class="code" href="classModule.html#a13">00372</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a13">Module::OnUserPreJoin</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, <span class="keyword">const</span> <span class="keywordtype">char</span>* cname) { <span class="keywordflow">return</span> 0; } +<a name="l00373"></a><a class="code" href="classModule.html#a12">00373</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a12">Module::OnExtendedMode</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <span class="keywordtype">void</span>* target, <span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type, <span class="keywordtype">bool</span> mode_on, string_list &params) { <span class="keywordflow">return</span> <span class="keyword">false</span>; } +<a name="l00374"></a><a class="code" href="classModule.html#a2">00374</a> <a class="code" href="classVersion.html">Version</a> <a class="code" href="classModule.html#a2">Module::GetVersion</a>() { <span class="keywordflow">return</span> <a class="code" href="classVersion.html">Version</a>(1,0,0,0,<a class="code" href="modules_8h.html#a21">VF_VENDOR</a>); } +<a name="l00375"></a><a class="code" href="classModule.html#a16">00375</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a16">Module::OnOper</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { }; +<a name="l00376"></a><a class="code" href="classModule.html#a17">00376</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a17">Module::OnInfo</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { }; +<a name="l00377"></a><a class="code" href="classModule.html#a18">00377</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a18">Module::OnWhois</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* dest) { }; +<a name="l00378"></a><a class="code" href="classModule.html#a19">00378</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a19">Module::OnUserPreInvite</a>(<a class="code" href="classuserrec.html">userrec</a>* source,<a class="code" href="classuserrec.html">userrec</a>* dest,<a class="code" href="classchanrec.html">chanrec</a>* channel) { <span class="keywordflow">return</span> 0; }; +<a name="l00379"></a><a class="code" href="classModule.html#a20">00379</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a20">Module::OnUserPreMessage</a>(<a class="code" href="classuserrec.html">userrec</a>* user,<span class="keywordtype">void</span>* dest,<span class="keywordtype">int</span> target_type, std::string &text) { <span class="keywordflow">return</span> 0; }; +<a name="l00380"></a><a class="code" href="classModule.html#a21">00380</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a21">Module::OnUserPreNotice</a>(<a class="code" href="classuserrec.html">userrec</a>* user,<span class="keywordtype">void</span>* dest,<span class="keywordtype">int</span> target_type, std::string &text) { <span class="keywordflow">return</span> 0; }; +<a name="l00381"></a><a class="code" href="classModule.html#a22">00381</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a22">Module::OnUserPreNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newnick) { <span class="keywordflow">return</span> 0; }; +<a name="l00382"></a><a class="code" href="classModule.html#a23">00382</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a23">Module::OnUserPostNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string oldnick) { }; +<a name="l00383"></a><a class="code" href="classModule.html#a24">00383</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a24">Module::OnAccessCheck</a>(<a class="code" href="classuserrec.html">userrec</a>* source,<a class="code" href="classuserrec.html">userrec</a>* dest,<a class="code" href="classchanrec.html">chanrec</a>* channel,<span class="keywordtype">int</span> access_type) { <span class="keywordflow">return</span> <a class="code" href="modules_8h.html#a8">ACR_DEFAULT</a>; }; +<a name="l00384"></a><a class="code" href="classModule.html#a25">00384</a> <a class="code" href="modules_8h.html#a32">string_list</a> <a class="code" href="classModule.html#a25">Module::OnUserSync</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { <a class="code" href="modules_8h.html#a32">string_list</a> empty; <span class="keywordflow">return</span> empty; } +<a name="l00385"></a><a class="code" href="classModule.html#a26">00385</a> <a class="code" href="modules_8h.html#a32">string_list</a> <a class="code" href="classModule.html#a26">Module::OnChannelSync</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) { <a class="code" href="modules_8h.html#a32">string_list</a> empty; <span class="keywordflow">return</span> empty; } +<a name="l00386"></a><a class="code" href="classModule.html#a27">00386</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a27">Module::On005Numeric</a>(std::string &output) { }; +<a name="l00387"></a><a class="code" href="classModule.html#a28">00387</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a28">Module::OnKill</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* dest, std::string reason) { <span class="keywordflow">return</span> 0; }; +<a name="l00388"></a><a class="code" href="classModule.html#a29">00388</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a29">Module::OnLoadModule</a>(<a class="code" href="classModule.html">Module</a>* mod,std::string name) { }; +<a name="l00389"></a><a class="code" href="classModule.html#a30">00389</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a30">Module::OnBackgroundTimer</a>(time_t curtime) { }; +<a name="l00390"></a><a class="code" href="classModule.html#a31">00390</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a31">Module::OnSendList</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* channel, <span class="keywordtype">char</span> mode) { }; +<a name="l00391"></a><a class="code" href="classModule.html#a32">00391</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a32">Module::OnPreCommand</a>(std::string command, <span class="keywordtype">char</span> **parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a> *user) { <span class="keywordflow">return</span> 0; }; +<a name="l00392"></a><a class="code" href="classModule.html#a33">00392</a> <span class="keywordtype">bool</span> <a class="code" href="classModule.html#a33">Module::OnCheckReady</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { <span class="keywordflow">return</span> <span class="keyword">true</span>; }; +<a name="l00393"></a><a class="code" href="classModule.html#a34">00393</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a34">Module::OnUserRegister</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { }; +<a name="l00394"></a><a class="code" href="classModule.html#a14">00394</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a14">Module::OnUserPreKick</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, std::string reason) { <span class="keywordflow">return</span> 0; }; +<a name="l00395"></a><a class="code" href="classModule.html#a15">00395</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a15">Module::OnUserKick</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, std::string reason) { }; +<a name="l00396"></a><a class="code" href="classModule.html#a35">00396</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a35">Module::OnRawMode</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, <span class="keywordtype">char</span> mode, std::string param, <span class="keywordtype">bool</span> adding, <span class="keywordtype">int</span> pcnt) { <span class="keywordflow">return</span> 0; }; +<a name="l00397"></a><a class="code" href="classModule.html#a36">00397</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a36">Module::OnCheckInvite</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan) { <span class="keywordflow">return</span> 0; }; +<a name="l00398"></a><a class="code" href="classModule.html#a37">00398</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a37">Module::OnCheckKey</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, std::string keygiven) { <span class="keywordflow">return</span> 0; }; +<a name="l00399"></a><a class="code" href="classModule.html#a38">00399</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a38">Module::OnCheckLimit</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan) { <span class="keywordflow">return</span> 0; }; +<a name="l00400"></a><a class="code" href="classModule.html#a39">00400</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a39">Module::OnCheckBan</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan) { <span class="keywordflow">return</span> 0; }; +<a name="l00401"></a><a class="code" href="classModule.html#a40">00401</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a40">Module::OnStats</a>(<span class="keywordtype">char</span> symbol) { }; +<a name="l00402"></a><a class="code" href="classModule.html#a41">00402</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a41">Module::OnChangeLocalUserHost</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newhost) { <span class="keywordflow">return</span> 0; }; +<a name="l00403"></a><a class="code" href="classModule.html#a42">00403</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a42">Module::OnChangeLocalUserGECOS</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newhost) { <span class="keywordflow">return</span> 0; }; +<a name="l00404"></a><a class="code" href="classModule.html#a43">00404</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a43">Module::OnLocalTopicChange</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, std::string topic) { <span class="keywordflow">return</span> 0; }; +<a name="l00405"></a><a class="code" href="classModule.html#a44">00405</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a44">Module::OnMeshToken</a>(<span class="keywordtype">char</span> token,string_list params,<a class="code" href="classserverrec.html">serverrec</a>* source,<a class="code" href="classserverrec.html">serverrec</a>* reply, std::string tcp_host,std::string ipaddr,<span class="keywordtype">int</span> port) { <span class="keywordflow">return</span> 0; }; +<a name="l00406"></a><a class="code" href="classModule.html#a45">00406</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a45">Module::OnEvent</a>(<a class="code" href="classEvent.html">Event</a>* event) { <span class="keywordflow">return</span>; }; +<a name="l00407"></a><a class="code" href="classModule.html#a46">00407</a> <span class="keywordtype">char</span>* <a class="code" href="classModule.html#a46">Module::OnRequest</a>(<a class="code" href="classRequest.html">Request</a>* request) { <span class="keywordflow">return</span> NULL; }; +00408 +00409 +00410 <span class="comment">// server is a wrapper class that provides methods to all of the C-style</span> +00411 <span class="comment">// exports in the core</span> +00412 <span class="comment">//</span> +00413 +<a name="l00414"></a><a class="code" href="classServer.html#a0">00414</a> <a class="code" href="classServer.html#a0">Server::Server</a>() +00415 { +00416 } +00417 +<a name="l00418"></a><a class="code" href="classServer.html#a1">00418</a> <a class="code" href="classServer.html#a1">Server::~Server</a>() +00419 { +00420 } +00421 +<a name="l00422"></a><a class="code" href="classServer.html#a2">00422</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a2">Server::SendOpers</a>(std::string s) +00423 { +00424 WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str()); +00425 } +00426 +<a name="l00427"></a><a class="code" href="classServer.html#a30">00427</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a30">Server::MatchText</a>(std::string sliteral, std::string spattern) +00428 { +00429 <span class="keywordtype">char</span> literal[MAXBUF],pattern[MAXBUF]; +00430 strlcpy(literal,sliteral.c_str(),MAXBUF); +00431 strlcpy(pattern,spattern.c_str(),MAXBUF); +00432 <span class="keywordflow">return</span> match(literal,pattern); +00433 } +00434 +<a name="l00435"></a><a class="code" href="classServer.html#a25">00435</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a25">Server::SendToModeMask</a>(std::string modes, <span class="keywordtype">int</span> flags, std::string text) +00436 { +00437 WriteMode(modes.c_str(),flags,<span class="stringliteral">"%s"</span>,text.c_str()); +00438 } +00439 +<a name="l00440"></a><a class="code" href="classServer.html#a26">00440</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a26">Server::JoinUserToChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string cname, std::string key) +00441 { +00442 <span class="keywordflow">return</span> add_channel(user,cname.c_str(),key.c_str(),<span class="keyword">true</span>); +00443 } +00444 +<a name="l00445"></a><a class="code" href="classServer.html#a27">00445</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a27">Server::PartUserFromChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string cname, std::string reason) +00446 { +00447 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>); +00448 } +00449 +<a name="l00450"></a><a class="code" href="classServer.html#a35">00450</a> <a class="code" href="modules_8h.html#a33">chanuserlist</a> <a class="code" href="classServer.html#a35">Server::GetUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) +00451 { +00452 <a class="code" href="modules_8h.html#a33">chanuserlist</a> userl; +00453 userl.clear(); +00454 <span class="keywordflow">for</span> (user_hash::const_iterator i = <a class="code" href="modules_8cpp.html#a42">clientlist</a>.begin(); i != <a class="code" href="modules_8cpp.html#a42">clientlist</a>.end(); i++) +00455 { +00456 <span class="keywordflow">if</span> (i->second) +00457 { +00458 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a16">has_channel</a>(i->second,chan)) +00459 { +00460 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a13">isnick</a>(i->second->nick)) +00461 { +00462 userl.push_back(i->second); +00463 } +00464 } +00465 } +00466 } +00467 <span class="keywordflow">return</span> userl; +00468 } +<a name="l00469"></a><a class="code" href="classServer.html#a28">00469</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a28">Server::ChangeUserNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string nickname) +00470 { +00471 force_nickchange(user,nickname.c_str()); +00472 } +00473 +<a name="l00474"></a><a class="code" href="classServer.html#a29">00474</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a29">Server::QuitUser</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string reason) +00475 { +00476 <a class="code" href="message_8h.html#a19">send_network_quit</a>(user-><a class="code" href="classuserrec.html#o0">nick</a>,reason.c_str()); +00477 kill_link(user,reason.c_str()); +00478 } +00479 +<a name="l00480"></a><a class="code" href="classServer.html#a34">00480</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a34">Server::IsUlined</a>(std::string server) +00481 { +00482 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a74">is_uline</a>(server.c_str()); +00483 } +00484 +<a name="l00485"></a><a class="code" href="classServer.html#a31">00485</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a31">Server::CallCommandHandler</a>(std::string commandname, <span class="keywordtype">char</span>** parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a>* user) +00486 { +00487 call_handler(commandname.c_str(),parameters,pcnt,user); +00488 } +00489 +<a name="l00490"></a><a class="code" href="classServer.html#a3">00490</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a3">Server::Log</a>(<span class="keywordtype">int</span> level, std::string s) +00491 { +00492 log(level,<span class="stringliteral">"%s"</span>,s.c_str()); +00493 } +00494 +<a name="l00495"></a><a class="code" href="classServer.html#a23">00495</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a23">Server::AddCommand</a>(<span class="keywordtype">char</span>* cmd, handlerfunc f, <span class="keywordtype">char</span> flags, <span class="keywordtype">int</span> minparams, <span class="keywordtype">char</span>* source) +00496 { +00497 <a class="code" href="modules_8h.html#a35">createcommand</a>(cmd,f,flags,minparams,source); +00498 } +00499 +<a name="l00500"></a><a class="code" href="classServer.html#a24">00500</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a24">Server::SendMode</a>(<span class="keywordtype">char</span> **parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a> *user) +00501 { +00502 <a class="code" href="modules_8h.html#a36">server_mode</a>(parameters,pcnt,user); +00503 } +00504 +<a name="l00505"></a><a class="code" href="classServer.html#a4">00505</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a4">Server::Send</a>(<span class="keywordtype">int</span> Socket, std::string s) +00506 { +00507 Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); +00508 } +00509 +<a name="l00510"></a><a class="code" href="classServer.html#a5">00510</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a5">Server::SendServ</a>(<span class="keywordtype">int</span> Socket, std::string s) +00511 { +00512 WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); +00513 } +00514 +<a name="l00515"></a><a class="code" href="classServer.html#a6">00515</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a6">Server::SendFrom</a>(<span class="keywordtype">int</span> Socket, <a class="code" href="classuserrec.html">userrec</a>* User, std::string s) +00516 { +00517 WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00518 } +00519 +<a name="l00520"></a><a class="code" href="classServer.html#a7">00520</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a7">Server::SendTo</a>(<a class="code" href="classuserrec.html">userrec</a>* Source, <a class="code" href="classuserrec.html">userrec</a>* Dest, std::string s) +00521 { +00522 <span class="keywordflow">if</span> (!Source) +00523 { +00524 <span class="comment">// if source is NULL, then the message originates from the local server</span> +00525 Write(Dest-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">":%s %s"</span>,this->GetServerName().c_str(),s.c_str()); +00526 } +00527 <span class="keywordflow">else</span> +00528 { +00529 <span class="comment">// otherwise it comes from the user specified</span> +00530 WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str()); +00531 } 00532 } 00533 -<a name="l00534"></a><a class="code" href="classServer.html#a16">00534</a> std::string <a class="code" href="classServer.html#a16">Server::ChanMode</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Chan) +<a name="l00534"></a><a class="code" href="classServer.html#a8">00534</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a8">Server::SendChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Channel, std::string s,<span class="keywordtype">bool</span> IncludeSender) 00535 { -00536 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a14">cmode</a>(User,Chan); -00537 } -00538 -<a name="l00539"></a><a class="code" href="classServer.html#a17">00539</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a17">Server::IsOnChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Chan) -00540 { -00541 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a16">has_channel</a>(User,Chan); -00542 } -00543 -<a name="l00544"></a><a class="code" href="classServer.html#a18">00544</a> std::string <a class="code" href="classServer.html#a18">Server::GetServerName</a>() -00545 { -00546 <span class="keywordflow">return</span> getservername(); -00547 } -00548 -<a name="l00549"></a><a class="code" href="classServer.html#a19">00549</a> std::string <a class="code" href="classServer.html#a19">Server::GetNetworkName</a>() -00550 { -00551 <span class="keywordflow">return</span> getnetworkname(); -00552 } -00553 -<a name="l00554"></a><a class="code" href="classServer.html#a20">00554</a> <a class="code" href="classAdmin.html">Admin</a> <a class="code" href="classServer.html#a20">Server::GetAdmin</a>() -00555 { -00556 <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick()); -00557 } -00558 -00559 -00560 -<a name="l00561"></a><a class="code" href="classServer.html#a21">00561</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a21">Server::AddExtendedMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type, <span class="keywordtype">bool</span> requires_oper, <span class="keywordtype">int</span> params_when_on, <span class="keywordtype">int</span> params_when_off) -00562 { -00563 <span class="keywordflow">if</span> (type == <a class="code" href="modules_8h.html#a7">MT_SERVER</a>) -00564 { -00565 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"</span>); -00566 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00567 } -00568 <span class="keywordflow">if</span> (((params_when_on>0) || (params_when_off>0)) && (type == <a class="code" href="modules_8h.html#a6">MT_CLIENT</a>)) -00569 { -00570 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"</span>); -00571 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00572 } -00573 <span class="keywordflow">if</span> ((params_when_on>1) || (params_when_off>1)) -00574 { -00575 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"</span>); -00576 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00577 } -00578 <span class="keywordflow">return</span> <a class="code" href="modules_8cpp.html#a57">DoAddExtendedMode</a>(modechar,type,requires_oper,params_when_on,params_when_off); -00579 } -00580 -<a name="l00581"></a><a class="code" href="classServer.html#a22">00581</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a22">Server::AddExtendedListMode</a>(<span class="keywordtype">char</span> modechar) -00582 { -00583 <span class="keywordtype">bool</span> res = <a class="code" href="modules_8cpp.html#a57">DoAddExtendedMode</a>(modechar,<a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>,<span class="keyword">false</span>,1,1); -00584 <span class="keywordflow">if</span> (res) -00585 <a class="code" href="modules_8cpp.html#a58">ModeMakeList</a>(modechar); -00586 <span class="keywordflow">return</span> res; -00587 } -00588 -<a name="l00589"></a><a class="code" href="classServer.html#a13">00589</a> <span class="keywordtype">int</span> <a class="code" href="classServer.html#a13">Server::CountUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* c) -00590 { -00591 <span class="keywordflow">return</span> usercount(c); -00592 } -00593 -00594 -<a name="l00595"></a><a class="code" href="classServer.html#a36">00595</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a36">Server::UserToPseudo</a>(<a class="code" href="classuserrec.html">userrec</a>* user,std::string message) -00596 { -00597 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> old_fd = user-><a class="code" href="classconnection.html#o0">fd</a>; -00598 user-><a class="code" href="classconnection.html#o0">fd</a> = <a class="code" href="modules_8h.html#a26">FD_MAGIC_NUMBER</a>; -00599 Write(old_fd,<span class="stringliteral">"ERROR :Closing link (%s@%s) [%s]"</span>,user-><a class="code" href="classuserrec.html#o1">ident</a>,user-><a class="code" href="classconnection.html#o1">host</a>,message.c_str()); -00600 close(old_fd); -00601 shutdown (old_fd,2); -00602 } -00603 -<a name="l00604"></a><a class="code" href="classServer.html#a37">00604</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a37">Server::PseudoToUser</a>(<a class="code" href="classuserrec.html">userrec</a>* alive,<a class="code" href="classuserrec.html">userrec</a>* zombie,std::string message) -00605 { -00606 zombie-><a class="code" href="classconnection.html#o0">fd</a> = alive-><a class="code" href="classconnection.html#o0">fd</a>; -00607 alive-><a class="code" href="classconnection.html#o0">fd</a> = <a class="code" href="modules_8h.html#a26">FD_MAGIC_NUMBER</a>; -00608 Write(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">":%s!%s@%s NICK %s"</span>,alive-><a class="code" href="classuserrec.html#o0">nick</a>,alive-><a class="code" href="classuserrec.html#o1">ident</a>,alive-><a class="code" href="classconnection.html#o1">host</a>,zombie-><a class="code" href="classuserrec.html#o0">nick</a>); -00609 kill_link(alive,message.c_str()); -00610 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i != MAXCHANS; i++) -00611 { -00612 <span class="keywordflow">if</span> (zombie-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a> != NULL) -00613 { -00614 <span class="keywordflow">if</span> (zombie-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a>-><a class="code" href="classchanrec.html#o0">name</a>) -00615 { -00616 <a class="code" href="classchanrec.html">chanrec</a>* Ptr = zombie-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a>; -00617 WriteFrom(zombie-><a class="code" href="classconnection.html#o0">fd</a>,zombie,<span class="stringliteral">"JOIN %s"</span>,Ptr-><a class="code" href="classchanrec.html#o0">name</a>); -00618 <span class="keywordflow">if</span> (Ptr-><a class="code" href="classchanrec.html#o4">topicset</a>) -00619 { -00620 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"332 %s %s :%s"</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>, Ptr-><a class="code" href="classchanrec.html#o2">topic</a>); -00621 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"333 %s %s %s %d"</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>, Ptr-><a class="code" href="classchanrec.html#o5">setby</a>, Ptr-><a class="code" href="classchanrec.html#o4">topicset</a>); -00622 } -00623 userlist(zombie,Ptr); -00624 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"366 %s %s :End of /NAMES list."</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>); -00625 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"324 %s %s +%s"</span>,zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>,chanmodes(Ptr)); -00626 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"329 %s %s %d"</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>, Ptr-><a class="code" href="classchanrec.html#o3">created</a>); -00627 -00628 } -00629 } -00630 } -00631 -00632 } -00633 -<a name="l00634"></a><a class="code" href="classServer.html#a38">00634</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a38">Server::AddGLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string hostmask) -00635 { -00636 <a class="code" href="xline_8h.html#a1">add_gline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), hostmask.c_str()); -00637 } -00638 -<a name="l00639"></a><a class="code" href="classServer.html#a39">00639</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a39">Server::AddQLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string nickname) -00640 { -00641 <a class="code" href="xline_8h.html#a2">add_qline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), nickname.c_str()); -00642 } -00643 -<a name="l00644"></a><a class="code" href="classServer.html#a40">00644</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a40">Server::AddZLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string ipaddr) -00645 { -00646 <a class="code" href="xline_8h.html#a3">add_zline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), ipaddr.c_str()); -00647 } -00648 -<a name="l00649"></a><a class="code" href="classServer.html#a41">00649</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a41">Server::AddKLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string hostmask) -00650 { -00651 <a class="code" href="xline_8h.html#a4">add_kline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), hostmask.c_str()); -00652 } +00536 <span class="keywordflow">if</span> (IncludeSender) +00537 { +00538 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00539 } +00540 <span class="keywordflow">else</span> +00541 { +00542 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00543 } +00544 } +00545 +<a name="l00546"></a><a class="code" href="classServer.html#a9">00546</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a9">Server::CommonChannels</a>(<a class="code" href="classuserrec.html">userrec</a>* u1, <a class="code" href="classuserrec.html">userrec</a>* u2) +00547 { +00548 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a0">common_channels</a>(u1,u2) != 0); +00549 } +00550 +<a name="l00551"></a><a class="code" href="classServer.html#a10">00551</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a10">Server::SendCommon</a>(<a class="code" href="classuserrec.html">userrec</a>* User, std::string text,<span class="keywordtype">bool</span> IncludeSender) +00552 { +00553 <span class="keywordflow">if</span> (IncludeSender) +00554 { +00555 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str()); +00556 } +00557 <span class="keywordflow">else</span> +00558 { +00559 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str()); +00560 } +00561 } +00562 +<a name="l00563"></a><a class="code" href="classServer.html#a11">00563</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a11">Server::SendWallops</a>(<a class="code" href="classuserrec.html">userrec</a>* User, std::string text) +00564 { +00565 WriteWallOps(User,<span class="keyword">false</span>,<span class="stringliteral">"%s"</span>,text.c_str()); +00566 } +00567 +<a name="l00568"></a><a class="code" href="classServer.html#a32">00568</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a32">Server::ChangeHost</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string host) +00569 { +00570 <a class="code" href="message_8h.html#a11">ChangeDisplayedHost</a>(user,host.c_str()); +00571 } +00572 +<a name="l00573"></a><a class="code" href="classServer.html#a33">00573</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a33">Server::ChangeGECOS</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string gecos) +00574 { +00575 <a class="code" href="message_8h.html#a10">ChangeName</a>(user,gecos.c_str()); +00576 } +00577 +<a name="l00578"></a><a class="code" href="classServer.html#a12">00578</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a12">Server::IsNick</a>(std::string nick) +00579 { +00580 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a13">isnick</a>(nick.c_str()) != 0); +00581 } +00582 +<a name="l00583"></a><a class="code" href="classServer.html#a14">00583</a> <a class="code" href="classuserrec.html">userrec</a>* <a class="code" href="classServer.html#a14">Server::FindNick</a>(std::string nick) +00584 { +00585 <span class="keywordflow">return</span> Find(nick); +00586 } +00587 +<a name="l00588"></a><a class="code" href="classServer.html#a15">00588</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a15">Server::FindChannel</a>(std::string channel) +00589 { +00590 <span class="keywordflow">return</span> FindChan(channel.c_str()); +00591 } +00592 +<a name="l00593"></a><a class="code" href="classServer.html#a16">00593</a> std::string <a class="code" href="classServer.html#a16">Server::ChanMode</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Chan) +00594 { +00595 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a14">cmode</a>(User,Chan); +00596 } +00597 +<a name="l00598"></a><a class="code" href="classServer.html#a17">00598</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a17">Server::IsOnChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Chan) +00599 { +00600 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a16">has_channel</a>(User,Chan); +00601 } +00602 +<a name="l00603"></a><a class="code" href="classServer.html#a18">00603</a> std::string <a class="code" href="classServer.html#a18">Server::GetServerName</a>() +00604 { +00605 <span class="keywordflow">return</span> getservername(); +00606 } +00607 +<a name="l00608"></a><a class="code" href="classServer.html#a19">00608</a> std::string <a class="code" href="classServer.html#a19">Server::GetNetworkName</a>() +00609 { +00610 <span class="keywordflow">return</span> getnetworkname(); +00611 } +00612 +<a name="l00613"></a><a class="code" href="classServer.html#a20">00613</a> <a class="code" href="classAdmin.html">Admin</a> <a class="code" href="classServer.html#a20">Server::GetAdmin</a>() +00614 { +00615 <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick()); +00616 } +00617 +00618 +00619 +<a name="l00620"></a><a class="code" href="classServer.html#a21">00620</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a21">Server::AddExtendedMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type, <span class="keywordtype">bool</span> requires_oper, <span class="keywordtype">int</span> params_when_on, <span class="keywordtype">int</span> params_when_off) +00621 { +00622 <span class="keywordflow">if</span> (type == <a class="code" href="modules_8h.html#a7">MT_SERVER</a>) +00623 { +00624 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"</span>); +00625 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00626 } +00627 <span class="keywordflow">if</span> (((params_when_on>0) || (params_when_off>0)) && (type == <a class="code" href="modules_8h.html#a6">MT_CLIENT</a>)) +00628 { +00629 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"</span>); +00630 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00631 } +00632 <span class="keywordflow">if</span> ((params_when_on>1) || (params_when_off>1)) +00633 { +00634 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"</span>); +00635 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00636 } +00637 <span class="keywordflow">return</span> <a class="code" href="modules_8cpp.html#a57">DoAddExtendedMode</a>(modechar,type,requires_oper,params_when_on,params_when_off); +00638 } +00639 +<a name="l00640"></a><a class="code" href="classServer.html#a22">00640</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a22">Server::AddExtendedListMode</a>(<span class="keywordtype">char</span> modechar) +00641 { +00642 <span class="keywordtype">bool</span> res = <a class="code" href="modules_8cpp.html#a57">DoAddExtendedMode</a>(modechar,<a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>,<span class="keyword">false</span>,1,1); +00643 <span class="keywordflow">if</span> (res) +00644 <a class="code" href="modules_8cpp.html#a58">ModeMakeList</a>(modechar); +00645 <span class="keywordflow">return</span> res; +00646 } +00647 +<a name="l00648"></a><a class="code" href="classServer.html#a13">00648</a> <span class="keywordtype">int</span> <a class="code" href="classServer.html#a13">Server::CountUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* c) +00649 { +00650 <span class="keywordflow">return</span> usercount(c); +00651 } +00652 00653 -<a name="l00654"></a><a class="code" href="classServer.html#a42">00654</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a42">Server::AddELine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string hostmask) +<a name="l00654"></a><a class="code" href="classServer.html#a36">00654</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a36">Server::UserToPseudo</a>(<a class="code" href="classuserrec.html">userrec</a>* user,std::string message) 00655 { -00656 <a class="code" href="xline_8h.html#a5">add_eline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), hostmask.c_str()); -00657 } -00658 -<a name="l00659"></a><a class="code" href="classServer.html#a43">00659</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a43">Server::DelGLine</a>(std::string hostmask) -00660 { -00661 <a class="code" href="xline_8h.html#a6">del_gline</a>(hostmask.c_str()); -00662 } -00663 -<a name="l00664"></a><a class="code" href="classServer.html#a44">00664</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a44">Server::DelQLine</a>(std::string nickname) -00665 { -00666 <a class="code" href="xline_8h.html#a7">del_qline</a>(nickname.c_str()); -00667 } -00668 -<a name="l00669"></a><a class="code" href="classServer.html#a45">00669</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a45">Server::DelZLine</a>(std::string ipaddr) -00670 { -00671 <a class="code" href="xline_8h.html#a8">del_zline</a>(ipaddr.c_str()); -00672 } -00673 -<a name="l00674"></a><a class="code" href="classServer.html#a46">00674</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a46">Server::DelKLine</a>(std::string hostmask) -00675 { -00676 <a class="code" href="xline_8h.html#a9">del_kline</a>(hostmask.c_str()); -00677 } -00678 -<a name="l00679"></a><a class="code" href="classServer.html#a47">00679</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a47">Server::DelELine</a>(std::string hostmask) -00680 { -00681 <a class="code" href="xline_8h.html#a10">del_eline</a>(hostmask.c_str()); -00682 } -00683 -<a name="l00684"></a><a class="code" href="classServer.html#a48">00684</a> <span class="keywordtype">long</span> <a class="code" href="classServer.html#a48">Server::CalcDuration</a>(std::string delta) -00685 { -00686 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a75">duration</a>(delta.c_str()); -00687 } -00688 -<a name="l00689"></a><a class="code" href="classServer.html#a49">00689</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a49">Server::IsValidMask</a>(std::string mask) -00690 { -00691 <span class="keyword">const</span> <span class="keywordtype">char</span>* dest = mask.c_str(); -00692 <span class="keywordflow">if</span> (strchr(dest,<span class="charliteral">'!'</span>)==0) -00693 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00694 <span class="keywordflow">if</span> (strchr(dest,<span class="charliteral">'@'</span>)==0) -00695 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00696 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(dest); i++) -00697 <span class="keywordflow">if</span> (dest[i] < 32) -00698 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00699 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(dest); i++) -00700 <span class="keywordflow">if</span> (dest[i] > 126) -00701 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00702 <span class="keywordtype">int</span> c = 0; -00703 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(dest); i++) -00704 <span class="keywordflow">if</span> (dest[i] == <span class="charliteral">'!'</span>) -00705 c++; -00706 <span class="keywordflow">if</span> (c>1) -00707 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00708 c = 0; -00709 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(dest); i++) -00710 <span class="keywordflow">if</span> (dest[i] == <span class="charliteral">'@'</span>) -00711 c++; -00712 <span class="keywordflow">if</span> (c>1) -00713 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00714 -00715 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00656 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> old_fd = user-><a class="code" href="classconnection.html#o0">fd</a>; +00657 user-><a class="code" href="classconnection.html#o0">fd</a> = <a class="code" href="modules_8h.html#a26">FD_MAGIC_NUMBER</a>; +00658 Write(old_fd,<span class="stringliteral">"ERROR :Closing link (%s@%s) [%s]"</span>,user-><a class="code" href="classuserrec.html#o1">ident</a>,user-><a class="code" href="classconnection.html#o1">host</a>,message.c_str()); +00659 close(old_fd); +00660 shutdown (old_fd,2); +00661 } +00662 +<a name="l00663"></a><a class="code" href="classServer.html#a37">00663</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a37">Server::PseudoToUser</a>(<a class="code" href="classuserrec.html">userrec</a>* alive,<a class="code" href="classuserrec.html">userrec</a>* zombie,std::string message) +00664 { +00665 zombie-><a class="code" href="classconnection.html#o0">fd</a> = alive-><a class="code" href="classconnection.html#o0">fd</a>; +00666 alive-><a class="code" href="classconnection.html#o0">fd</a> = <a class="code" href="modules_8h.html#a26">FD_MAGIC_NUMBER</a>; +00667 Write(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">":%s!%s@%s NICK %s"</span>,alive-><a class="code" href="classuserrec.html#o0">nick</a>,alive-><a class="code" href="classuserrec.html#o1">ident</a>,alive-><a class="code" href="classconnection.html#o1">host</a>,zombie-><a class="code" href="classuserrec.html#o0">nick</a>); +00668 kill_link(alive,message.c_str()); +00669 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i != MAXCHANS; i++) +00670 { +00671 <span class="keywordflow">if</span> (zombie-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a> != NULL) +00672 { +00673 <span class="keywordflow">if</span> (zombie-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a>-><a class="code" href="classchanrec.html#o0">name</a>) +00674 { +00675 <a class="code" href="classchanrec.html">chanrec</a>* Ptr = zombie-><a class="code" href="classuserrec.html#o5">chans</a>[i].<a class="code" href="classucrec.html#o1">channel</a>; +00676 WriteFrom(zombie-><a class="code" href="classconnection.html#o0">fd</a>,zombie,<span class="stringliteral">"JOIN %s"</span>,Ptr-><a class="code" href="classchanrec.html#o0">name</a>); +00677 <span class="keywordflow">if</span> (Ptr-><a class="code" href="classchanrec.html#o4">topicset</a>) +00678 { +00679 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"332 %s %s :%s"</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>, Ptr-><a class="code" href="classchanrec.html#o2">topic</a>); +00680 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"333 %s %s %s %d"</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>, Ptr-><a class="code" href="classchanrec.html#o5">setby</a>, Ptr-><a class="code" href="classchanrec.html#o4">topicset</a>); +00681 } +00682 userlist(zombie,Ptr); +00683 WriteServ(zombie-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"366 %s %s :End of /NAMES list."</span>, zombie-><a class="code" href="classuserrec.html#o0">nick</a>, Ptr-><a class="code" href="classchanrec.html#o0">name</a>); +00684 <span class="comment">//WriteServ(zombie->fd,"324 %s %s +%s",zombie->nick, Ptr->name,chanmodes(Ptr));</span> +00685 <span class="comment">//WriteServ(zombie->fd,"329 %s %s %d", zombie->nick, Ptr->name, Ptr->created);</span> +00686 +00687 } +00688 } +00689 } +00690 +00691 } +00692 +<a name="l00693"></a><a class="code" href="classServer.html#a38">00693</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a38">Server::AddGLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string hostmask) +00694 { +00695 <a class="code" href="xline_8h.html#a1">add_gline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), hostmask.c_str()); +00696 } +00697 +<a name="l00698"></a><a class="code" href="classServer.html#a39">00698</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a39">Server::AddQLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string nickname) +00699 { +00700 <a class="code" href="xline_8h.html#a2">add_qline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), nickname.c_str()); +00701 } +00702 +<a name="l00703"></a><a class="code" href="classServer.html#a40">00703</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a40">Server::AddZLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string ipaddr) +00704 { +00705 <a class="code" href="xline_8h.html#a3">add_zline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), ipaddr.c_str()); +00706 } +00707 +<a name="l00708"></a><a class="code" href="classServer.html#a41">00708</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a41">Server::AddKLine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string hostmask) +00709 { +00710 <a class="code" href="xline_8h.html#a4">add_kline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), hostmask.c_str()); +00711 } +00712 +<a name="l00713"></a><a class="code" href="classServer.html#a42">00713</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a42">Server::AddELine</a>(<span class="keywordtype">long</span> duration, std::string source, std::string reason, std::string hostmask) +00714 { +00715 <a class="code" href="xline_8h.html#a5">add_eline</a>(<a class="code" href="commands_8h.html#a75">duration</a>, source.c_str(), reason.c_str(), hostmask.c_str()); 00716 } 00717 -<a name="l00718"></a><a class="code" href="classServer.html#a50">00718</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a50">Server::MeshSendAll</a>(std::string text) +<a name="l00718"></a><a class="code" href="classServer.html#a43">00718</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a43">Server::DelGLine</a>(std::string hostmask) 00719 { -00720 NetSendToAll((<span class="keywordtype">char</span>*)text.c_str()); +00720 <a class="code" href="xline_8h.html#a6">del_gline</a>(hostmask.c_str()); 00721 } 00722 -<a name="l00723"></a><a class="code" href="classServer.html#a51">00723</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a51">Server::MeshSendCommon</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string text) +<a name="l00723"></a><a class="code" href="classServer.html#a44">00723</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a44">Server::DelQLine</a>(std::string nickname) 00724 { -00725 <span class="keywordflow">if</span> (user) -00726 NetSendToCommon(user,(<span class="keywordtype">char</span>*)text.c_str()); -00727 } -00728 -<a name="l00729"></a><a class="code" href="classServer.html#a52">00729</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a52">Server::MeshSendAllAlive</a>(std::string text) -00730 { -00731 NetSendToAllAlive((<span class="keywordtype">char</span>*)text.c_str()); -00732 } -00733 -<a name="l00734"></a><a class="code" href="classServer.html#a53">00734</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a53">Server::MeshSendUnicast</a>(std::string destination, std::string text) -00735 { -00736 NetSendToOne((<span class="keywordtype">char</span>*)destination.c_str(),(<span class="keywordtype">char</span>*)text.c_str()); -00737 } -00738 -<a name="l00739"></a><a class="code" href="classServer.html#a54">00739</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a54">Server::MeshSendAllExcept</a>(std::string target, std::string text) -00740 { -00741 NetSendToAllExcept(target.c_str(),(<span class="keywordtype">char</span>*)text.c_str()); -00742 } -00743 -<a name="l00744"></a><a class="code" href="classServer.html#a55">00744</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a55">Server::MeshCheckChan</a>(<a class="code" href="classchanrec.html">chanrec</a> *c,std::string servername) -00745 { -00746 <span class="keywordflow">if</span> (c) -00747 { -00748 <span class="keywordflow">return</span> ChanAnyOnThisServer(c,(<span class="keywordtype">char</span>*)servername.c_str()); -00749 } -00750 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; -00751 } -00752 -<a name="l00753"></a><a class="code" href="classServer.html#a56">00753</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a56">Server::MeshCheckCommon</a>(<a class="code" href="classuserrec.html">userrec</a>* u,std::string servername) -00754 { -00755 <span class="keywordflow">if</span> (u) -00756 { -00757 <span class="keywordflow">return</span> CommonOnThisServer(u,(<span class="keywordtype">char</span>*)servername.c_str()); -00758 } -00759 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; -00760 } -00761 -<a name="l00762"></a><a class="code" href="classConfigReader.html#a0">00762</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>() -00763 { -00764 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00765 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00766 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(CONFIG_FILE,this->cache,this->errorlog); -00767 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) -00768 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a30">CONF_FILE_NOT_FOUND</a>; -00769 } -00770 -00771 -<a name="l00772"></a><a class="code" href="classConfigReader.html#a2">00772</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>() -00773 { -00774 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p0">cache</a>) -00775 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p0">cache</a>; -00776 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p1">errorlog</a>) -00777 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p1">errorlog</a>; -00778 } -00779 -00780 -<a name="l00781"></a><a class="code" href="classConfigReader.html#a1">00781</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(std::string filename) -00782 { -00783 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00784 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00785 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(filename.c_str(),this-><a class="code" href="classConfigReader.html#p0">cache</a>,this-><a class="code" href="classConfigReader.html#p1">errorlog</a>); -00786 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) -00787 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a30">CONF_FILE_NOT_FOUND</a>; -00788 }; -00789 -<a name="l00790"></a><a class="code" href="classConfigReader.html#a3">00790</a> std::string <a class="code" href="classConfigReader.html#a3">ConfigReader::ReadValue</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index) -00791 { -00792 <span class="keywordtype">char</span> val[MAXBUF]; -00793 <span class="keywordtype">char</span> t[MAXBUF]; -00794 <span class="keywordtype">char</span> n[MAXBUF]; -00795 strlcpy(t,tag.c_str(),MAXBUF); -00796 strlcpy(n,name.c_str(),MAXBUF); -00797 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00798 <span class="keywordflow">if</span> (!res) -00799 { -00800 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>; -00801 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; -00802 } -00803 <span class="keywordflow">return</span> std::string(val); -00804 } -00805 -<a name="l00806"></a><a class="code" href="classConfigReader.html#a4">00806</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a4">ConfigReader::ReadFlag</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index) -00807 { -00808 <span class="keywordtype">char</span> val[MAXBUF]; -00809 <span class="keywordtype">char</span> t[MAXBUF]; -00810 <span class="keywordtype">char</span> n[MAXBUF]; -00811 strlcpy(t,tag.c_str(),MAXBUF); -00812 strlcpy(n,name.c_str(),MAXBUF); -00813 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00814 <span class="keywordflow">if</span> (!res) +00725 <a class="code" href="xline_8h.html#a7">del_qline</a>(nickname.c_str()); +00726 } +00727 +<a name="l00728"></a><a class="code" href="classServer.html#a45">00728</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a45">Server::DelZLine</a>(std::string ipaddr) +00729 { +00730 <a class="code" href="xline_8h.html#a8">del_zline</a>(ipaddr.c_str()); +00731 } +00732 +<a name="l00733"></a><a class="code" href="classServer.html#a46">00733</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a46">Server::DelKLine</a>(std::string hostmask) +00734 { +00735 <a class="code" href="xline_8h.html#a9">del_kline</a>(hostmask.c_str()); +00736 } +00737 +<a name="l00738"></a><a class="code" href="classServer.html#a47">00738</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a47">Server::DelELine</a>(std::string hostmask) +00739 { +00740 <a class="code" href="xline_8h.html#a10">del_eline</a>(hostmask.c_str()); +00741 } +00742 +<a name="l00743"></a><a class="code" href="classServer.html#a48">00743</a> <span class="keywordtype">long</span> <a class="code" href="classServer.html#a48">Server::CalcDuration</a>(std::string delta) +00744 { +00745 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a75">duration</a>(delta.c_str()); +00746 } +00747 +<a name="l00748"></a><a class="code" href="classServer.html#a49">00748</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a49">Server::IsValidMask</a>(std::string mask) +00749 { +00750 <span class="keyword">const</span> <span class="keywordtype">char</span>* dest = mask.c_str(); +00751 <span class="keywordflow">if</span> (strchr(dest,<span class="charliteral">'!'</span>)==0) +00752 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00753 <span class="keywordflow">if</span> (strchr(dest,<span class="charliteral">'@'</span>)==0) +00754 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00755 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(dest); i++) +00756 <span class="keywordflow">if</span> (dest[i] < 32) +00757 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00758 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(dest); i++) +00759 <span class="keywordflow">if</span> (dest[i] > 126) +00760 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00761 <span class="keywordtype">int</span> c = 0; +00762 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(dest); i++) +00763 <span class="keywordflow">if</span> (dest[i] == <span class="charliteral">'!'</span>) +00764 c++; +00765 <span class="keywordflow">if</span> (c>1) +00766 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00767 c = 0; +00768 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(dest); i++) +00769 <span class="keywordflow">if</span> (dest[i] == <span class="charliteral">'@'</span>) +00770 c++; +00771 <span class="keywordflow">if</span> (c>1) +00772 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00773 +00774 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00775 } +00776 +<a name="l00777"></a><a class="code" href="classServer.html#a50">00777</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a50">Server::MeshSendAll</a>(std::string text) +00778 { +00779 NetSendToAll((<span class="keywordtype">char</span>*)text.c_str()); +00780 } +00781 +<a name="l00782"></a><a class="code" href="classServer.html#a51">00782</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a51">Server::MeshSendCommon</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string text) +00783 { +00784 <span class="keywordflow">if</span> (user) +00785 NetSendToCommon(user,(<span class="keywordtype">char</span>*)text.c_str()); +00786 } +00787 +<a name="l00788"></a><a class="code" href="classServer.html#a52">00788</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a52">Server::MeshSendAllAlive</a>(std::string text) +00789 { +00790 NetSendToAllAlive((<span class="keywordtype">char</span>*)text.c_str()); +00791 } +00792 +<a name="l00793"></a><a class="code" href="classServer.html#a53">00793</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a53">Server::MeshSendUnicast</a>(std::string destination, std::string text) +00794 { +00795 NetSendToOne((<span class="keywordtype">char</span>*)destination.c_str(),(<span class="keywordtype">char</span>*)text.c_str()); +00796 } +00797 +<a name="l00798"></a><a class="code" href="classServer.html#a54">00798</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a54">Server::MeshSendAllExcept</a>(std::string target, std::string text) +00799 { +00800 NetSendToAllExcept(target.c_str(),(<span class="keywordtype">char</span>*)text.c_str()); +00801 } +00802 +<a name="l00803"></a><a class="code" href="classServer.html#a55">00803</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a55">Server::MeshCheckChan</a>(<a class="code" href="classchanrec.html">chanrec</a> *c,std::string servername) +00804 { +00805 <span class="keywordflow">if</span> (c) +00806 { +00807 <span class="keywordflow">return</span> ChanAnyOnThisServer(c,(<span class="keywordtype">char</span>*)servername.c_str()); +00808 } +00809 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; +00810 } +00811 +<a name="l00812"></a><a class="code" href="classServer.html#a56">00812</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a56">Server::MeshCheckCommon</a>(<a class="code" href="classuserrec.html">userrec</a>* u,std::string servername) +00813 { +00814 <span class="keywordflow">if</span> (u) 00815 { -00816 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>; -00817 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00818 } -00819 std::string s = val; -00820 <span class="keywordflow">return</span> ((s == <span class="stringliteral">"yes"</span>) || (s == <span class="stringliteral">"YES"</span>) || (s == <span class="stringliteral">"true"</span>) || (s == <span class="stringliteral">"TRUE"</span>) || (s == <span class="stringliteral">"1"</span>)); -00821 } -00822 -<a name="l00823"></a><a class="code" href="classConfigReader.html#a5">00823</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a5">ConfigReader::ReadInteger</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index, <span class="keywordtype">bool</span> needs_unsigned) -00824 { -00825 <span class="keywordtype">char</span> val[MAXBUF]; -00826 <span class="keywordtype">char</span> t[MAXBUF]; -00827 <span class="keywordtype">char</span> n[MAXBUF]; -00828 strlcpy(t,tag.c_str(),MAXBUF); -00829 strlcpy(n,name.c_str(),MAXBUF); -00830 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00831 <span class="keywordflow">if</span> (!res) -00832 { -00833 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>; -00834 <span class="keywordflow">return</span> 0; -00835 } -00836 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(val); i++) -00837 { -00838 <span class="keywordflow">if</span> (!isdigit(val[i])) -00839 { -00840 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a27">CONF_NOT_A_NUMBER</a>; -00841 <span class="keywordflow">return</span> 0; -00842 } -00843 } -00844 <span class="keywordflow">if</span> ((needs_unsigned) && (atoi(val)<0)) -00845 { -00846 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a28">CONF_NOT_UNSIGNED</a>; -00847 <span class="keywordflow">return</span> 0; -00848 } -00849 <span class="keywordflow">return</span> atoi(val); -00850 } +00816 <span class="keywordflow">return</span> CommonOnThisServer(u,(<span class="keywordtype">char</span>*)servername.c_str()); +00817 } +00818 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; +00819 } +00820 +<a name="l00821"></a><a class="code" href="classServer.html#a57">00821</a> <a class="code" href="classModule.html">Module</a>* <a class="code" href="classServer.html#a57">Server::FindModule</a>(std::string name) +00822 { +00823 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i <= <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a>; i++) +00824 { +00825 <span class="keywordflow">if</span> (<a class="code" href="channels_8cpp.html#a27">module_names</a>[i] == name) +00826 { +00827 <span class="keywordflow">return</span> <a class="code" href="channels_8cpp.html#a2">modules</a>[i]; +00828 } +00829 } +00830 <span class="keywordflow">return</span> NULL; +00831 } +00832 +<a name="l00833"></a><a class="code" href="classConfigReader.html#a0">00833</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>() +00834 { +00835 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00836 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00837 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(CONFIG_FILE,this->cache,this->errorlog); +00838 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) +00839 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a30">CONF_FILE_NOT_FOUND</a>; +00840 } +00841 +00842 +<a name="l00843"></a><a class="code" href="classConfigReader.html#a2">00843</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>() +00844 { +00845 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p0">cache</a>) +00846 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p0">cache</a>; +00847 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p1">errorlog</a>) +00848 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p1">errorlog</a>; +00849 } +00850 00851 -<a name="l00852"></a><a class="code" href="classConfigReader.html#a6">00852</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a6">ConfigReader::GetError</a>() +<a name="l00852"></a><a class="code" href="classConfigReader.html#a1">00852</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(std::string filename) 00853 { -00854 <span class="keywordtype">long</span> olderr = this-><a class="code" href="classConfigReader.html#p3">error</a>; -00855 this->error = 0; -00856 <span class="keywordflow">return</span> olderr; -00857 } -00858 -<a name="l00859"></a><a class="code" href="classConfigReader.html#a9">00859</a> <span class="keywordtype">void</span> <a class="code" href="classConfigReader.html#a9">ConfigReader::DumpErrors</a>(<span class="keywordtype">bool</span> bail, <a class="code" href="classuserrec.html">userrec</a>* user) -00860 { -00861 <span class="keywordflow">if</span> (bail) -00862 { -00863 printf(<span class="stringliteral">"There were errors in your configuration:\n%s"</span>,<a class="code" href="classConfigReader.html#p1">errorlog</a>->str().c_str()); -00864 exit(0); -00865 } -00866 <span class="keywordflow">else</span> -00867 { -00868 <span class="keywordtype">char</span> dataline[1024]; -00869 <span class="keywordflow">if</span> (user) -00870 { -00871 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); -00872 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) -00873 { -00874 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); -00875 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :%s"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>,dataline); -00876 } -00877 } -00878 <span class="keywordflow">else</span> -00879 { -00880 WriteOpers(<span class="stringliteral">"There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); -00881 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) -00882 { -00883 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); -00884 WriteOpers(dataline); -00885 } -00886 } -00887 <span class="keywordflow">return</span>; -00888 } -00889 } -00890 -00891 -<a name="l00892"></a><a class="code" href="classConfigReader.html#a7">00892</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a7">ConfigReader::Enumerate</a>(std::string tag) -00893 { -00894 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#p0">cache</a>,tag.c_str()); -00895 } -00896 -<a name="l00897"></a><a class="code" href="classConfigReader.html#a10">00897</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a10">ConfigReader::EnumerateValues</a>(std::string tag, <span class="keywordtype">int</span> index) -00898 { -00899 <span class="keywordflow">return</span> EnumValues(<a class="code" href="classConfigReader.html#p0">cache</a>, tag.c_str(), index); -00900 } -00901 -<a name="l00902"></a><a class="code" href="classConfigReader.html#a8">00902</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a8">ConfigReader::Verify</a>() -00903 { -00904 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#p2">readerror</a>; -00905 } -00906 -00907 -<a name="l00908"></a><a class="code" href="classFileReader.html#a1">00908</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(std::string filename) -00909 { -00910 <a class="code" href="modules_8h.html#a31">file_cache</a> c; -00911 readfile(c,filename.c_str()); -00912 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; -00913 } -00914 -<a name="l00915"></a><a class="code" href="classFileReader.html#a0">00915</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>() -00916 { -00917 } -00918 -<a name="l00919"></a><a class="code" href="classFileReader.html#a3">00919</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(std::string filename) -00920 { -00921 <a class="code" href="modules_8h.html#a31">file_cache</a> c; -00922 readfile(c,filename.c_str()); -00923 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; -00924 } -00925 -00926 -<a name="l00927"></a><a class="code" href="classFileReader.html#a2">00927</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>() -00928 { -00929 } -00930 -<a name="l00931"></a><a class="code" href="classFileReader.html#a4">00931</a> <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">FileReader::Exists</a>() -00932 { -00933 <span class="keywordflow">if</span> (<a class="code" href="classFileReader.html#r0">fc</a>.size() == 0) -00934 { -00935 <span class="keywordflow">return</span>(<span class="keyword">false</span>); +00854 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00855 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00856 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(filename.c_str(),this-><a class="code" href="classConfigReader.html#p0">cache</a>,this-><a class="code" href="classConfigReader.html#p1">errorlog</a>); +00857 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) +00858 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a30">CONF_FILE_NOT_FOUND</a>; +00859 }; +00860 +<a name="l00861"></a><a class="code" href="classConfigReader.html#a3">00861</a> std::string <a class="code" href="classConfigReader.html#a3">ConfigReader::ReadValue</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index) +00862 { +00863 <span class="keywordtype">char</span> val[MAXBUF]; +00864 <span class="keywordtype">char</span> t[MAXBUF]; +00865 <span class="keywordtype">char</span> n[MAXBUF]; +00866 strlcpy(t,tag.c_str(),MAXBUF); +00867 strlcpy(n,name.c_str(),MAXBUF); +00868 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00869 <span class="keywordflow">if</span> (!res) +00870 { +00871 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>; +00872 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; +00873 } +00874 <span class="keywordflow">return</span> std::string(val); +00875 } +00876 +<a name="l00877"></a><a class="code" href="classConfigReader.html#a4">00877</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a4">ConfigReader::ReadFlag</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index) +00878 { +00879 <span class="keywordtype">char</span> val[MAXBUF]; +00880 <span class="keywordtype">char</span> t[MAXBUF]; +00881 <span class="keywordtype">char</span> n[MAXBUF]; +00882 strlcpy(t,tag.c_str(),MAXBUF); +00883 strlcpy(n,name.c_str(),MAXBUF); +00884 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00885 <span class="keywordflow">if</span> (!res) +00886 { +00887 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>; +00888 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00889 } +00890 std::string s = val; +00891 <span class="keywordflow">return</span> ((s == <span class="stringliteral">"yes"</span>) || (s == <span class="stringliteral">"YES"</span>) || (s == <span class="stringliteral">"true"</span>) || (s == <span class="stringliteral">"TRUE"</span>) || (s == <span class="stringliteral">"1"</span>)); +00892 } +00893 +<a name="l00894"></a><a class="code" href="classConfigReader.html#a5">00894</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a5">ConfigReader::ReadInteger</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index, <span class="keywordtype">bool</span> needs_unsigned) +00895 { +00896 <span class="keywordtype">char</span> val[MAXBUF]; +00897 <span class="keywordtype">char</span> t[MAXBUF]; +00898 <span class="keywordtype">char</span> n[MAXBUF]; +00899 strlcpy(t,tag.c_str(),MAXBUF); +00900 strlcpy(n,name.c_str(),MAXBUF); +00901 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00902 <span class="keywordflow">if</span> (!res) +00903 { +00904 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_VALUE_NOT_FOUND</a>; +00905 <span class="keywordflow">return</span> 0; +00906 } +00907 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(val); i++) +00908 { +00909 <span class="keywordflow">if</span> (!isdigit(val[i])) +00910 { +00911 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a27">CONF_NOT_A_NUMBER</a>; +00912 <span class="keywordflow">return</span> 0; +00913 } +00914 } +00915 <span class="keywordflow">if</span> ((needs_unsigned) && (atoi(val)<0)) +00916 { +00917 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a28">CONF_NOT_UNSIGNED</a>; +00918 <span class="keywordflow">return</span> 0; +00919 } +00920 <span class="keywordflow">return</span> atoi(val); +00921 } +00922 +<a name="l00923"></a><a class="code" href="classConfigReader.html#a6">00923</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a6">ConfigReader::GetError</a>() +00924 { +00925 <span class="keywordtype">long</span> olderr = this-><a class="code" href="classConfigReader.html#p3">error</a>; +00926 this->error = 0; +00927 <span class="keywordflow">return</span> olderr; +00928 } +00929 +<a name="l00930"></a><a class="code" href="classConfigReader.html#a9">00930</a> <span class="keywordtype">void</span> <a class="code" href="classConfigReader.html#a9">ConfigReader::DumpErrors</a>(<span class="keywordtype">bool</span> bail, <a class="code" href="classuserrec.html">userrec</a>* user) +00931 { +00932 <span class="keywordflow">if</span> (bail) +00933 { +00934 printf(<span class="stringliteral">"There were errors in your configuration:\n%s"</span>,<a class="code" href="classConfigReader.html#p1">errorlog</a>->str().c_str()); +00935 exit(0); 00936 } 00937 <span class="keywordflow">else</span> 00938 { -00939 <span class="keywordflow">return</span>(<span class="keyword">true</span>); -00940 } -00941 } -00942 -<a name="l00943"></a><a class="code" href="classFileReader.html#a5">00943</a> std::string <a class="code" href="classFileReader.html#a5">FileReader::GetLine</a>(<span class="keywordtype">int</span> x) -00944 { -00945 <span class="keywordflow">if</span> ((x<0) || (x><a class="code" href="classFileReader.html#r0">fc</a>.size())) -00946 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; -00947 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>[x]; -00948 } -00949 -<a name="l00950"></a><a class="code" href="classFileReader.html#a6">00950</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileReader::FileSize</a>() -00951 { -00952 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>.size(); -00953 } -00954 -00955 -00956 std::vector<Module*> <a class="code" href="modules_8cpp.html#a59">modules</a>(255); -00957 std::vector<ircd_module*> <a class="code" href="modules_8cpp.html#a60">factory</a>(255); -00958 -<a name="l00959"></a><a class="code" href="modules_8cpp.html#a1">00959</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a> = -1; -00960 +00939 <span class="keywordtype">char</span> dataline[1024]; +00940 <span class="keywordflow">if</span> (user) +00941 { +00942 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); +00943 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) +00944 { +00945 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); +00946 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :%s"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>,dataline); +00947 } +00948 } +00949 <span class="keywordflow">else</span> +00950 { +00951 WriteOpers(<span class="stringliteral">"There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); +00952 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) +00953 { +00954 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); +00955 WriteOpers(dataline); +00956 } +00957 } +00958 <span class="keywordflow">return</span>; +00959 } +00960 } 00961 -</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sat Apr 16 18:57:13 2005 for InspIRCd by +00962 +<a name="l00963"></a><a class="code" href="classConfigReader.html#a7">00963</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a7">ConfigReader::Enumerate</a>(std::string tag) +00964 { +00965 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#p0">cache</a>,tag.c_str()); +00966 } +00967 +<a name="l00968"></a><a class="code" href="classConfigReader.html#a10">00968</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a10">ConfigReader::EnumerateValues</a>(std::string tag, <span class="keywordtype">int</span> index) +00969 { +00970 <span class="keywordflow">return</span> EnumValues(<a class="code" href="classConfigReader.html#p0">cache</a>, tag.c_str(), index); +00971 } +00972 +<a name="l00973"></a><a class="code" href="classConfigReader.html#a8">00973</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a8">ConfigReader::Verify</a>() +00974 { +00975 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#p2">readerror</a>; +00976 } +00977 +00978 +<a name="l00979"></a><a class="code" href="classFileReader.html#a1">00979</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(std::string filename) +00980 { +00981 <a class="code" href="modules_8h.html#a31">file_cache</a> c; +00982 readfile(c,filename.c_str()); +00983 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; +00984 } +00985 +<a name="l00986"></a><a class="code" href="classFileReader.html#a0">00986</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>() +00987 { +00988 } +00989 +<a name="l00990"></a><a class="code" href="classFileReader.html#a3">00990</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(std::string filename) +00991 { +00992 <a class="code" href="modules_8h.html#a31">file_cache</a> c; +00993 readfile(c,filename.c_str()); +00994 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; +00995 } +00996 +00997 +<a name="l00998"></a><a class="code" href="classFileReader.html#a2">00998</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>() +00999 { +01000 } +01001 +<a name="l01002"></a><a class="code" href="classFileReader.html#a4">01002</a> <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">FileReader::Exists</a>() +01003 { +01004 <span class="keywordflow">if</span> (<a class="code" href="classFileReader.html#r0">fc</a>.size() == 0) +01005 { +01006 <span class="keywordflow">return</span>(<span class="keyword">false</span>); +01007 } +01008 <span class="keywordflow">else</span> +01009 { +01010 <span class="keywordflow">return</span>(<span class="keyword">true</span>); +01011 } +01012 } +01013 +<a name="l01014"></a><a class="code" href="classFileReader.html#a5">01014</a> std::string <a class="code" href="classFileReader.html#a5">FileReader::GetLine</a>(<span class="keywordtype">int</span> x) +01015 { +01016 <span class="keywordflow">if</span> ((x<0) || (x><a class="code" href="classFileReader.html#r0">fc</a>.size())) +01017 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; +01018 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>[x]; +01019 } +01020 +<a name="l01021"></a><a class="code" href="classFileReader.html#a6">01021</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileReader::FileSize</a>() +01022 { +01023 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>.size(); +01024 } +01025 +01026 +01027 std::vector<Module*> <a class="code" href="modules_8cpp.html#a59">modules</a>(255); +01028 std::vector<ircd_module*> <a class="code" href="modules_8cpp.html#a60">factory</a>(255); +01029 +<a name="l01030"></a><a class="code" href="modules_8cpp.html#a1">01030</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a> = -1; +01031 +01032 +</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Apr 20 15:46:55 2005 for InspIRCd by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.3 </small></address> |