diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-05-01 16:54:50 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-05-01 16:54:50 +0000 |
commit | 877a15fc3db18be9131c886720516eae6f582886 (patch) | |
tree | 2e4602c376e4cd53020c8ab2b292426a9b716c00 /docs/module-doc/modules_8cpp-source.html | |
parent | ce9efee8c8f22425e21165465e0ba63255eacffe (diff) |
Added extra docs to cover OnUserSync etc
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@769 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 | 1082 |
1 files changed, 625 insertions, 457 deletions
diff --git a/docs/module-doc/modules_8cpp-source.html b/docs/module-doc/modules_8cpp-source.html index 7d63ff9d7..5d6a33b5e 100644 --- a/docs/module-doc/modules_8cpp-source.html +++ b/docs/module-doc/modules_8cpp-source.html @@ -6,493 +6,661 @@ <!-- Generated by Doxygen 1.3-rc3 --> <center> <a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> -<hr><h1>modules.cpp</h1><a href="modules_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> -00002 <span class="comment"></span> -00003 <span class="comment"></span> -00004 <span class="comment">*/</span> -00005 -00006 -00007 -00008 <span class="preprocessor">#include <typeinfo></span> -00009 <span class="preprocessor">#include <iostream></span> -00010 <span class="preprocessor">#include "globals.h"</span> -00011 <span class="preprocessor">#include "<a class="code" href="modules_8h.html">modules.h</a>"</span> -00012 <span class="preprocessor">#include "<a class="code" href="ctables_8h.html">ctables.h</a>"</span> -00013 <span class="preprocessor">#include "inspircd_io.h"</span> -00014 <span class="preprocessor">#include "wildcard.h"</span> -00015 <span class="preprocessor">#include "<a class="code" href="mode_8h.html">mode.h</a>"</span> -00016 <span class="preprocessor">#include "<a class="code" href="message_8h.html">message.h</a>"</span> -00017 <span class="preprocessor">#include "<a class="code" href="commands_8h.html">commands.h</a>"</span> -00018 -00019 <span class="comment">// class type for holding an extended mode character - internal to core</span> -00020 -<a name="l00021"></a><a class="code" href="classExtMode.html">00021</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> -00022 { -00023 <span class="keyword">public</span>: -<a name="l00024"></a><a class="code" href="classExtMode.html#m0">00024</a> <span class="keywordtype">char</span> <a class="code" href="classExtMode.html#m0">modechar</a>; -<a name="l00025"></a><a class="code" href="classExtMode.html#m1">00025</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#m1">type</a>; -<a name="l00026"></a><a class="code" href="classExtMode.html#m2">00026</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#m2">params_when_on</a>; -<a name="l00027"></a><a class="code" href="classExtMode.html#m3">00027</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#m3">params_when_off</a>; -<a name="l00028"></a><a class="code" href="classExtMode.html#m4">00028</a> <span class="keywordtype">bool</span> <a class="code" href="classExtMode.html#m4">needsoper</a>; -<a name="l00029"></a><a class="code" href="classExtMode.html#m5">00029</a> <span class="keywordtype">bool</span> <a class="code" href="classExtMode.html#m5">list</a>; -<a name="l00030"></a><a class="code" href="classExtMode.html#a0">00030</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) : modechar(mc), type(ty), needsoper(oper), params_when_on(p_on), params_when_off(p_off) { }; -00031 }; -00032 -<a name="l00033"></a><a class="code" href="modules_8cpp.html#a0">00033</a> <span class="keyword">typedef</span> std::vector<ExtMode> <a class="code" href="modules_8cpp.html#a0">ExtModeList</a>; -<a name="l00034"></a><a class="code" href="modules_8cpp.html#a1">00034</a> <span class="keyword">typedef</span> ExtModeList::iterator <a class="code" href="modules_8cpp.html#a1">ExtModeListIter</a>; -00035 -<a name="l00036"></a><a class="code" href="modules_8cpp.html#a2">00036</a> <a class="code" href="modules_8cpp.html#a0">ExtModeList</a> <a class="code" href="modules_8cpp.html#a2">EMode</a>; -00037 -00038 <span class="comment">// returns true if an extended mode character is in use</span> -<a name="l00039"></a><a class="code" href="modules_8cpp.html#a4">00039</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a4">ModeDefined</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00040 { -00041 log(DEBUG,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a2">EMode</a>.size()); -00042 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a1">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a2">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a2">EMode</a>.end(); i++) -00043 { -00044 log(DEBUG,<span class="stringliteral">"i->modechar==%c, modechar=%c, i->type=%d, type=%d"</span>,i->modechar,modechar,i->type,type); -00045 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) -00046 { -00047 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00048 } -00049 } -00050 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00051 } -00052 -<a name="l00053"></a><a class="code" href="modules_8cpp.html#a5">00053</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a5">ModeIsListMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00054 { -00055 log(DEBUG,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a2">EMode</a>.size()); -00056 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a1">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a2">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a2">EMode</a>.end(); i++) -00057 { -00058 log(DEBUG,<span class="stringliteral">"i->modechar==%c, modechar=%c, i->type=%d, type=%d"</span>,i->modechar,modechar,i->type,type); -00059 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->list == <span class="keyword">true</span>)) -00060 { -00061 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00062 } -00063 } -00064 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00065 } -00066 -<a name="l00067"></a><a class="code" href="modules_8cpp.html#a6">00067</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a6">ModeDefinedOper</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00068 { -00069 log(DEBUG,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a2">EMode</a>.size()); -00070 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a1">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a2">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a2">EMode</a>.end(); i++) -00071 { -00072 log(DEBUG,<span class="stringliteral">"i->modechar==%c, modechar=%c, i->type=%d, type=%d"</span>,i->modechar,modechar,i->type,type); -00073 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->needsoper == <span class="keyword">true</span>)) -00074 { -00075 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00076 } -00077 } -00078 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00079 } -00080 -00081 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> -<a name="l00082"></a><a class="code" href="modules_8cpp.html#a7">00082</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a7">ModeDefinedOn</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00083 { -00084 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a1">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a2">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a2">EMode</a>.end(); i++) -00085 { -00086 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) -00087 { -00088 <span class="keywordflow">return</span> i->params_when_on; -00089 } -00090 } -00091 <span class="keywordflow">return</span> 0; -00092 } -00093 -00094 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> -<a name="l00095"></a><a class="code" href="modules_8cpp.html#a8">00095</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a8">ModeDefinedOff</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00096 { -00097 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a1">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a2">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a2">EMode</a>.end(); i++) -00098 { -00099 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) -00100 { -00101 <span class="keywordflow">return</span> i->params_when_off; +<hr><h1>modules.cpp</h1><a href="modules_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#include "inspircd.h"</span> +00002 <span class="preprocessor">#include "inspircd_io.h"</span> +00003 <span class="preprocessor">#include "inspircd_util.h"</span> +00004 <span class="preprocessor">#include "inspircd_config.h"</span> +00005 <span class="preprocessor">#include <unistd.h></span> +00006 <span class="preprocessor">#include <fcntl.h></span> +00007 <span class="preprocessor">#include <sys/errno.h></span> +00008 <span class="preprocessor">#include <sys/ioctl.h></span> +00009 <span class="preprocessor">#include <sys/utsname.h></span> +00010 <span class="preprocessor">#include <cstdio></span> +00011 <span class="preprocessor">#include <time.h></span> +00012 <span class="preprocessor">#include <string></span> +00013 <span class="preprocessor">#ifdef GCC3</span> +00014 <span class="preprocessor"></span><span class="preprocessor">#include <ext/hash_map></span> +00015 <span class="preprocessor">#else</span> +00016 <span class="preprocessor"></span><span class="preprocessor">#include <hash_map></span> +00017 <span class="preprocessor">#endif</span> +00018 <span class="preprocessor"></span><span class="preprocessor">#include <map></span> +00019 <span class="preprocessor">#include <sstream></span> +00020 <span class="preprocessor">#include <vector></span> +00021 <span class="preprocessor">#include <errno.h></span> +00022 <span class="preprocessor">#include <deque></span> +00023 <span class="preprocessor">#include <errno.h></span> +00024 <span class="preprocessor">#include <unistd.h></span> +00025 <span class="preprocessor">#include <sched.h></span> +00026 <span class="preprocessor">#include "<a class="code" href="connection_8h.html">connection.h</a>"</span> +00027 <span class="preprocessor">#include "<a class="code" href="users_8h.html">users.h</a>"</span> +00028 <span class="preprocessor">#include "<a class="code" href="servers_8h.html">servers.h</a>"</span> +00029 <span class="preprocessor">#include "<a class="code" href="ctables_8h.html">ctables.h</a>"</span> +00030 <span class="preprocessor">#include "globals.h"</span> +00031 <span class="preprocessor">#include "<a class="code" href="modules_8h.html">modules.h</a>"</span> +00032 <span class="preprocessor">#include "dynamic.h"</span> +00033 <span class="preprocessor">#include "wildcard.h"</span> +00034 <span class="preprocessor">#include "<a class="code" href="message_8h.html">message.h</a>"</span> +00035 <span class="preprocessor">#include "<a class="code" href="mode_8h.html">mode.h</a>"</span> +00036 <span class="preprocessor">#include "<a class="code" href="xline_8h.html">xline.h</a>"</span> +00037 <span class="preprocessor">#include "<a class="code" href="commands_8h.html">commands.h</a>"</span> +00038 +00039 <span class="preprocessor">#ifdef GCC3</span> +00040 <span class="preprocessor"></span><span class="preprocessor">#define nspace __gnu_cxx</span> +00041 <span class="preprocessor"></span><span class="preprocessor">#else</span> +<a name="l00042"></a><a class="code" href="modules_8cpp.html#a0">00042</a> <span class="preprocessor"></span><span class="preprocessor">#define nspace std</span> +00043 <span class="preprocessor"></span><span class="preprocessor">#endif</span> +00044 <span class="preprocessor"></span> +00045 <span class="keyword">using</span> <span class="keyword">namespace </span>std; +00046 +00047 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a>; +<a name="l00048"></a><a class="code" href="modules_8cpp.html#a2">00048</a> <span class="keyword">extern</span> vector<Module*> <a class="code" href="channels_8cpp.html#a2">modules</a>; +<a name="l00049"></a><a class="code" href="modules_8cpp.html#a3">00049</a> <span class="keyword">extern</span> vector<ircd_module*> <a class="code" href="channels_8cpp.html#a3">factory</a>; +00050 +<a name="l00051"></a><a class="code" href="modules_8cpp.html#a4">00051</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a4">LogLevel</a>; +<a name="l00052"></a><a class="code" href="modules_8cpp.html#a5">00052</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a5">ServerName</a>[MAXBUF]; +<a name="l00053"></a><a class="code" href="modules_8cpp.html#a6">00053</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a6">Network</a>[MAXBUF]; +<a name="l00054"></a><a class="code" href="modules_8cpp.html#a7">00054</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a7">ServerDesc</a>[MAXBUF]; +<a name="l00055"></a><a class="code" href="modules_8cpp.html#a8">00055</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a8">AdminName</a>[MAXBUF]; +<a name="l00056"></a><a class="code" href="modules_8cpp.html#a9">00056</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a9">AdminEmail</a>[MAXBUF]; +<a name="l00057"></a><a class="code" href="modules_8cpp.html#a10">00057</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a10">AdminNick</a>[MAXBUF]; +<a name="l00058"></a><a class="code" href="modules_8cpp.html#a11">00058</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a11">diepass</a>[MAXBUF]; +<a name="l00059"></a><a class="code" href="modules_8cpp.html#a12">00059</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a12">restartpass</a>[MAXBUF]; +<a name="l00060"></a><a class="code" href="modules_8cpp.html#a13">00060</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a13">motd</a>[MAXBUF]; +<a name="l00061"></a><a class="code" href="modules_8cpp.html#a14">00061</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a14">rules</a>[MAXBUF]; +<a name="l00062"></a><a class="code" href="modules_8cpp.html#a15">00062</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a15">list</a>[MAXBUF]; +<a name="l00063"></a><a class="code" href="modules_8cpp.html#a16">00063</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a16">PrefixQuit</a>[MAXBUF]; +<a name="l00064"></a><a class="code" href="modules_8cpp.html#a17">00064</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a17">DieValue</a>[MAXBUF]; +00065 +<a name="l00066"></a><a class="code" href="modules_8cpp.html#a18">00066</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a18">debugging</a>; +<a name="l00067"></a><a class="code" href="modules_8cpp.html#a19">00067</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a19">WHOWAS_STALE</a>; +<a name="l00068"></a><a class="code" href="modules_8cpp.html#a20">00068</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a20">WHOWAS_MAX</a>; +<a name="l00069"></a><a class="code" href="modules_8cpp.html#a21">00069</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a21">DieDelay</a>; +<a name="l00070"></a><a class="code" href="modules_8cpp.html#a22">00070</a> <span class="keyword">extern</span> time_t <a class="code" href="channels_8cpp.html#a22">startup_time</a>; +<a name="l00071"></a><a class="code" href="modules_8cpp.html#a23">00071</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a23">NetBufferSize</a>; +<a name="l00072"></a><a class="code" href="modules_8cpp.html#a24">00072</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a24">MaxWhoResults</a>; +<a name="l00073"></a><a class="code" href="modules_8cpp.html#a25">00073</a> <span class="keyword">extern</span> time_t <a class="code" href="channels_8cpp.html#a25">nb_start</a>; +00074 +<a name="l00075"></a><a class="code" href="modules_8cpp.html#a26">00075</a> <span class="keyword">extern</span> std::vector<int> <a class="code" href="channels_8cpp.html#a26">fd_reap</a>; +<a name="l00076"></a><a class="code" href="modules_8cpp.html#a27">00076</a> <span class="keyword">extern</span> std::vector<std::string> <a class="code" href="channels_8cpp.html#a27">module_names</a>; +00077 +<a name="l00078"></a><a class="code" href="modules_8cpp.html#a28">00078</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a28">bannerBuffer</a>[MAXBUF]; +<a name="l00079"></a><a class="code" href="modules_8cpp.html#a29">00079</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a29">boundPortCount</a>; +<a name="l00080"></a><a class="code" href="modules_8cpp.html#a30">00080</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a30">portCount</a>; +<a name="l00081"></a><a class="code" href="modules_8cpp.html#a31">00081</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a31">UDPportCount</a>; +<a name="l00082"></a><a class="code" href="modules_8cpp.html#a32">00082</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a32">ports</a>[MAXSOCKS]; +<a name="l00083"></a><a class="code" href="modules_8cpp.html#a33">00083</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a33">defaultRoute</a>; +00084 +<a name="l00085"></a><a class="code" href="modules_8cpp.html#a34">00085</a> <span class="keyword">extern</span> std::vector<long> <a class="code" href="channels_8cpp.html#a34">auth_cookies</a>; +<a name="l00086"></a><a class="code" href="modules_8cpp.html#a35">00086</a> <span class="keyword">extern</span> std::stringstream <a class="code" href="channels_8cpp.html#a35">config_f</a>; +00087 +<a name="l00088"></a><a class="code" href="modules_8cpp.html#a36">00088</a> <span class="keyword">extern</span> <a class="code" href="classserverrec.html">serverrec</a>* <a class="code" href="channels_8cpp.html#a36">me</a>[32]; +00089 +<a name="l00090"></a><a class="code" href="modules_8cpp.html#a37">00090</a> <span class="keyword">extern</span> FILE *<a class="code" href="channels_8cpp.html#a37">log_file</a>; +00091 +00092 +<a name="l00093"></a><a class="code" href="namespacenspace.html">00093</a> <span class="keyword">namespace </span><a class="code" href="channels_8cpp.html#a0">nspace</a> +00094 { +<a name="l00095"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01in__addr_01_4.html">00095</a> <span class="keyword">template</span><> <span class="keyword">struct </span><a class="code" href="channels_8cpp.html#a0">nspace</a>::hash<in_addr> +00096 { +<a name="l00097"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01in__addr_01_4.html#a0">00097</a> size_t operator()(<span class="keyword">const</span> <span class="keyword">struct</span> in_addr &a)<span class="keyword"> const</span> +00098 <span class="keyword"> </span>{ +00099 size_t q; +00100 memcpy(&q,&a,<span class="keyword">sizeof</span>(size_t)); +00101 <span class="keywordflow">return</span> q; 00102 } -00103 } -00104 <span class="keywordflow">return</span> 0; -00105 } -00106 -00107 <span class="comment">// returns true if an extended mode character is in use</span> -<a name="l00108"></a><a class="code" href="modules_8cpp.html#a9">00108</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a9">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) -00109 { -00110 <span class="keywordflow">if</span> (<a class="code" href="modules_8cpp.html#a4">ModeDefined</a>(modechar,type)) { -00111 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00112 } -00113 <a class="code" href="modules_8cpp.html#a2">EMode</a>.push_back(<a class="code" href="classExtMode.html">ExtMode</a>(modechar,type,requires_oper,params_on,params_off)); -00114 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00115 } -00116 -00117 <span class="comment">// turns a mode into a listmode</span> -<a name="l00118"></a><a class="code" href="modules_8cpp.html#a10">00118</a> <span class="keywordtype">void</span> <a class="code" href="modules_8cpp.html#a10">ModeMakeList</a>(<span class="keywordtype">char</span> modechar) -00119 { -00120 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a1">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a2">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a2">EMode</a>.end(); i++) -00121 { -00122 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == <a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>)) -00123 { -00124 i->list = <span class="keyword">true</span>; -00125 <span class="keywordflow">return</span>; -00126 } -00127 } -00128 <span class="keywordflow">return</span>; -00129 } -00130 -00131 <span class="comment">// version is a simple class for holding a modules version number</span> -00132 -<a name="l00133"></a><a class="code" href="classVersion.html#a0">00133</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) : Major(major), Minor(minor), Revision(revision), Build(build) { }; +00103 }; +00104 +<a name="l00105"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01string_01_4.html">00105</a> <span class="keyword">template</span><> <span class="keyword">struct </span><a class="code" href="channels_8cpp.html#a0">nspace</a>::hash<string> +00106 { +<a name="l00107"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01string_01_4.html#a0">00107</a> size_t operator()(<span class="keyword">const</span> string &s)<span class="keyword"> const</span> +00108 <span class="keyword"> </span>{ +00109 <span class="keywordtype">char</span> a[MAXBUF]; +00110 <span class="keyword">static</span> <span class="keyword">struct </span>hash<const char *> strhash; +00111 strcpy(a,s.c_str()); +00112 strlower(a); +00113 <span class="keywordflow">return</span> strhash(a); +00114 } +00115 }; +00116 } +00117 +00118 +<a name="l00119"></a><a class="code" href="structStrHashComp.html">00119</a> <span class="keyword">struct </span><a class="code" href="structStrHashComp.html">StrHashComp</a> +00120 { +00121 +<a name="l00122"></a><a class="code" href="structStrHashComp.html#a0">00122</a> <span class="keywordtype">bool</span> <a class="code" href="structStrHashComp.html#a0">operator()</a>(<span class="keyword">const</span> string& s1, <span class="keyword">const</span> string& s2)<span class="keyword"> const</span> +00123 <span class="keyword"> </span>{ +00124 <span class="keywordtype">char</span> a[MAXBUF],b[MAXBUF]; +00125 strcpy(a,s1.c_str()); +00126 strcpy(b,s2.c_str()); +00127 <span class="keywordflow">return</span> (strcasecmp(a,b) == 0); +00128 } +00129 +00130 }; +00131 +<a name="l00132"></a><a class="code" href="structInAddr__HashComp.html">00132</a> <span class="keyword">struct </span><a class="code" href="structInAddr__HashComp.html">InAddr_HashComp</a> +00133 { 00134 -00135 <span class="comment">// admin is a simple class for holding a server's administrative info</span> -00136 -<a name="l00137"></a><a class="code" href="classAdmin.html#a0">00137</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) { }; -00138 -<a name="l00139"></a><a class="code" href="classModule.html#a0">00139</a> <a class="code" href="classModule.html#a0">Module::Module</a>() { } -<a name="l00140"></a><a class="code" href="classModule.html#a1">00140</a> <a class="code" href="classModule.html#a1">Module::~Module</a>() { } -<a name="l00141"></a><a class="code" href="classModule.html#a3">00141</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="l00142"></a><a class="code" href="classModule.html#a4">00142</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="l00143"></a><a class="code" href="classModule.html#a5">00143</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="l00144"></a><a class="code" href="classModule.html#a6">00144</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="l00145"></a><a class="code" href="classModule.html#a7">00145</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a7">Module::OnPacketTransmit</a>(<span class="keywordtype">char</span> *p) { } -<a name="l00146"></a><a class="code" href="classModule.html#a8">00146</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a8">Module::OnPacketReceive</a>(<span class="keywordtype">char</span> *p) { } -<a name="l00147"></a><a class="code" href="classModule.html#a9">00147</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a9">Module::OnRehash</a>() { } -<a name="l00148"></a><a class="code" href="classModule.html#a10">00148</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="l00149"></a><a class="code" href="classModule.html#a12">00149</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="l00150"></a><a class="code" href="classModule.html#a11">00150</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="l00151"></a><a class="code" href="classModule.html#a2">00151</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 name="l00152"></a><a class="code" href="classModule.html#a13">00152</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a13">Module::OnOper</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { }; -<a name="l00153"></a><a class="code" href="classModule.html#a14">00153</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a14">Module::OnInfo</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { }; -<a name="l00154"></a><a class="code" href="classModule.html#a15">00154</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a15">Module::OnWhois</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* dest) { }; -<a name="l00155"></a><a class="code" href="classModule.html#a16">00155</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a16">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="l00156"></a><a class="code" href="classModule.html#a17">00156</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a17">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="l00157"></a><a class="code" href="classModule.html#a18">00157</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a18">Module::OnUserPreNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newnick) { <span class="keywordflow">return</span> 0; }; -<a name="l00158"></a><a class="code" href="classModule.html#a19">00158</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a19">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>; }; -00159 -00160 <span class="comment">// server is a wrapper class that provides methods to all of the C-style</span> -00161 <span class="comment">// exports in the core</span> -00162 <span class="comment">//</span> +<a name="l00135"></a><a class="code" href="structInAddr__HashComp.html#a0">00135</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> +00136 <span class="keyword"> </span>{ +00137 size_t q; +00138 size_t p; +00139 +00140 memcpy(&q,&s1,<span class="keyword">sizeof</span>(size_t)); +00141 memcpy(&p,&s2,<span class="keyword">sizeof</span>(size_t)); +00142 +00143 <span class="keywordflow">return</span> (q == p); +00144 } +00145 +00146 }; +00147 +00148 +<a name="l00149"></a><a class="code" href="modules_8cpp.html#a38">00149</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="l00150"></a><a class="code" href="modules_8cpp.html#a39">00150</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="l00151"></a><a class="code" href="modules_8cpp.html#a40">00151</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="l00152"></a><a class="code" href="modules_8cpp.html#a41">00152</a> <span class="keyword">typedef</span> std::deque<command_t> <a class="code" href="modules_8cpp.html#a41">command_table</a>; +00153 +00154 +<a name="l00155"></a><a class="code" href="modules_8cpp.html#a42">00155</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="l00156"></a><a class="code" href="modules_8cpp.html#a43">00156</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="l00157"></a><a class="code" href="modules_8cpp.html#a44">00157</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="l00158"></a><a class="code" href="modules_8cpp.html#a45">00158</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="l00159"></a><a class="code" href="modules_8cpp.html#a46">00159</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a22">file_cache</a> <a class="code" href="modules_8cpp.html#a46">MOTD</a>; +<a name="l00160"></a><a class="code" href="modules_8cpp.html#a47">00160</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a22">file_cache</a> <a class="code" href="modules_8cpp.html#a47">RULES</a>; +<a name="l00161"></a><a class="code" href="modules_8cpp.html#a48">00161</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>; +00162 00163 -<a name="l00164"></a><a class="code" href="classServer.html#a0">00164</a> <a class="code" href="classServer.html#a0">Server::Server</a>() -00165 { -00166 } -00167 -<a name="l00168"></a><a class="code" href="classServer.html#a1">00168</a> <a class="code" href="classServer.html#a1">Server::~Server</a>() -00169 { -00170 } -00171 -<a name="l00172"></a><a class="code" href="classServer.html#a2">00172</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a2">Server::SendOpers</a>(std::string s) -00173 { -00174 WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str()); -00175 } -00176 -<a name="l00177"></a><a class="code" href="classServer.html#a30">00177</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a30">Server::MatchText</a>(std::string sliteral, std::string spattern) -00178 { -00179 <span class="keywordtype">char</span> literal[MAXBUF],pattern[MAXBUF]; -00180 strncpy(literal,sliteral.c_str(),MAXBUF); -00181 strncpy(pattern,spattern.c_str(),MAXBUF); -00182 <span class="keywordflow">return</span> match(literal,pattern); -00183 } -00184 -<a name="l00185"></a><a class="code" href="classServer.html#a25">00185</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) +00164 <span class="comment">// class type for holding an extended mode character - internal to core</span> +00165 +<a name="l00166"></a><a class="code" href="classExtMode.html">00166</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> +00167 { +00168 <span class="keyword">public</span>: +<a name="l00169"></a><a class="code" href="classExtMode.html#m0">00169</a> <span class="keywordtype">char</span> <a class="code" href="classExtMode.html#m0">modechar</a>; +<a name="l00170"></a><a class="code" href="classExtMode.html#m1">00170</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#m1">type</a>; +<a name="l00171"></a><a class="code" href="classExtMode.html#m2">00171</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#m2">params_when_on</a>; +<a name="l00172"></a><a class="code" href="classExtMode.html#m3">00172</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#m3">params_when_off</a>; +<a name="l00173"></a><a class="code" href="classExtMode.html#m4">00173</a> <span class="keywordtype">bool</span> <a class="code" href="classExtMode.html#m4">needsoper</a>; +<a name="l00174"></a><a class="code" href="classExtMode.html#m5">00174</a> <span class="keywordtype">bool</span> <a class="code" href="channels_8cpp.html#a15">list</a>; +<a name="l00175"></a><a class="code" href="classExtMode.html#a0">00175</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) : modechar(mc), type(ty), needsoper(oper), params_when_on(p_on), params_when_off(p_off) { }; +00176 }; +00177 +<a name="l00178"></a><a class="code" href="modules_8cpp.html#a49">00178</a> <span class="keyword">typedef</span> std::vector<ExtMode> <a class="code" href="modules_8cpp.html#a49">ExtModeList</a>; +<a name="l00179"></a><a class="code" href="modules_8cpp.html#a50">00179</a> <span class="keyword">typedef</span> ExtModeList::iterator <a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a>; +00180 +00181 +<a name="l00182"></a><a class="code" href="modules_8cpp.html#a51">00182</a> <a class="code" href="modules_8cpp.html#a49">ExtModeList</a> <a class="code" href="modules_8cpp.html#a51">EMode</a>; +00183 +00184 <span class="comment">// returns true if an extended mode character is in use</span> +<a name="l00185"></a><a class="code" href="modules_8cpp.html#a52">00185</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) 00186 { -00187 WriteMode(modes.c_str(),flags,<span class="stringliteral">"%s"</span>,text.c_str()); -00188 } -00189 -<a name="l00190"></a><a class="code" href="classServer.html#a26">00190</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) -00191 { -00192 <span class="keywordflow">return</span> add_channel(user,cname.c_str(),key.c_str(),<span class="keyword">true</span>); -00193 } -00194 -<a name="l00195"></a><a class="code" href="classServer.html#a27">00195</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) -00196 { -00197 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>); -00198 } -00199 -<a name="l00200"></a><a class="code" href="classServer.html#a28">00200</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) -00201 { -00202 force_nickchange(user,nickname.c_str()); -00203 } -00204 -<a name="l00205"></a><a class="code" href="classServer.html#a29">00205</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) -00206 { -00207 <a class="code" href="message_8h.html#a19">send_network_quit</a>(user-><a class="code" href="classuserrec.html#m0">nick</a>,reason.c_str()); -00208 kill_link(user,reason.c_str()); -00209 } -00210 -<a name="l00211"></a><a class="code" href="classServer.html#a34">00211</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a34">Server::IsUlined</a>(std::string server) -00212 { -00213 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a70">is_uline</a>(server.c_str()); -00214 } -00215 -<a name="l00216"></a><a class="code" href="classServer.html#a31">00216</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) -00217 { -00218 call_handler(commandname.c_str(),parameters,pcnt,user); -00219 } -00220 -<a name="l00221"></a><a class="code" href="classServer.html#a3">00221</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) -00222 { -00223 log(level,<span class="stringliteral">"%s"</span>,s.c_str()); -00224 } -00225 -<a name="l00226"></a><a class="code" href="classServer.html#a23">00226</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) -00227 { -00228 <a class="code" href="modules_8h.html#a25">createcommand</a>(cmd,f,flags,minparams); -00229 } -00230 -<a name="l00231"></a><a class="code" href="classServer.html#a24">00231</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) -00232 { -00233 <a class="code" href="modules_8h.html#a26">server_mode</a>(parameters,pcnt,user); -00234 } -00235 -<a name="l00236"></a><a class="code" href="classServer.html#a4">00236</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) -00237 { -00238 Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); -00239 } -00240 -<a name="l00241"></a><a class="code" href="classServer.html#a5">00241</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) +00187 log(DEBUG,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); +00188 <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++) +00189 { +00190 log(DEBUG,<span class="stringliteral">"i->modechar==%c, modechar=%c, i->type=%d, type=%d"</span>,i->modechar,modechar,i->type,type); +00191 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) +00192 { +00193 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00194 } +00195 } +00196 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00197 } +00198 +<a name="l00199"></a><a class="code" href="modules_8cpp.html#a53">00199</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) +00200 { +00201 log(DEBUG,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); +00202 <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++) +00203 { +00204 log(DEBUG,<span class="stringliteral">"i->modechar==%c, modechar=%c, i->type=%d, type=%d"</span>,i->modechar,modechar,i->type,type); +00205 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->list == <span class="keyword">true</span>)) +00206 { +00207 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00208 } +00209 } +00210 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00211 } +00212 +<a name="l00213"></a><a class="code" href="modules_8cpp.html#a54">00213</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) +00214 { +00215 log(DEBUG,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); +00216 <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++) +00217 { +00218 log(DEBUG,<span class="stringliteral">"i->modechar==%c, modechar=%c, i->type=%d, type=%d"</span>,i->modechar,modechar,i->type,type); +00219 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->needsoper == <span class="keyword">true</span>)) +00220 { +00221 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00222 } +00223 } +00224 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00225 } +00226 +00227 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> +<a name="l00228"></a><a class="code" href="modules_8cpp.html#a55">00228</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) +00229 { +00230 <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++) +00231 { +00232 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) +00233 { +00234 <span class="keywordflow">return</span> i->params_when_on; +00235 } +00236 } +00237 <span class="keywordflow">return</span> 0; +00238 } +00239 +00240 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> +<a name="l00241"></a><a class="code" href="modules_8cpp.html#a56">00241</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) 00242 { -00243 WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); -00244 } -00245 -<a name="l00246"></a><a class="code" href="classServer.html#a6">00246</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) -00247 { -00248 WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00249 } -00250 -<a name="l00251"></a><a class="code" href="classServer.html#a7">00251</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) -00252 { -00253 <span class="keywordflow">if</span> (!Source) -00254 { -00255 <span class="comment">// if source is NULL, then the message originates from the local server</span> -00256 Write(Dest-><a class="code" href="classconnection.html#m0">fd</a>,<span class="stringliteral">":%s %s"</span>,this->GetServerName().c_str(),s.c_str()); -00257 } -00258 <span class="keywordflow">else</span> -00259 { -00260 <span class="comment">// otherwise it comes from the user specified</span> -00261 WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str()); -00262 } -00263 } -00264 -<a name="l00265"></a><a class="code" href="classServer.html#a8">00265</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) -00266 { -00267 <span class="keywordflow">if</span> (IncludeSender) -00268 { -00269 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00270 } -00271 <span class="keywordflow">else</span> -00272 { -00273 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00274 } +00243 <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++) +00244 { +00245 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) +00246 { +00247 <span class="keywordflow">return</span> i->params_when_off; +00248 } +00249 } +00250 <span class="keywordflow">return</span> 0; +00251 } +00252 +00253 <span class="comment">// returns true if an extended mode character is in use</span> +<a name="l00254"></a><a class="code" href="modules_8cpp.html#a57">00254</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) +00255 { +00256 <span class="keywordflow">if</span> (<a class="code" href="modules_8cpp.html#a52">ModeDefined</a>(modechar,type)) { +00257 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00258 } +00259 <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)); +00260 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00261 } +00262 +00263 <span class="comment">// turns a mode into a listmode</span> +<a name="l00264"></a><a class="code" href="modules_8cpp.html#a58">00264</a> <span class="keywordtype">void</span> <a class="code" href="modules_8cpp.html#a58">ModeMakeList</a>(<span class="keywordtype">char</span> modechar) +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 == <a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>)) +00269 { +00270 i->list = <span class="keyword">true</span>; +00271 <span class="keywordflow">return</span>; +00272 } +00273 } +00274 <span class="keywordflow">return</span>; 00275 } 00276 -<a name="l00277"></a><a class="code" href="classServer.html#a9">00277</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) -00278 { -00279 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a0">common_channels</a>(u1,u2) != 0); -00280 } -00281 -<a name="l00282"></a><a class="code" href="classServer.html#a10">00282</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) -00283 { -00284 <span class="keywordflow">if</span> (IncludeSender) -00285 { -00286 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str()); -00287 } -00288 <span class="keywordflow">else</span> -00289 { -00290 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str()); -00291 } -00292 } -00293 -<a name="l00294"></a><a class="code" href="classServer.html#a11">00294</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) -00295 { -00296 WriteWallOps(User,<span class="keyword">false</span>,<span class="stringliteral">"%s"</span>,text.c_str()); -00297 } -00298 -<a name="l00299"></a><a class="code" href="classServer.html#a32">00299</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) -00300 { -00301 <a class="code" href="message_8h.html#a11">ChangeDisplayedHost</a>(user,host.c_str()); -00302 } -00303 -<a name="l00304"></a><a class="code" href="classServer.html#a33">00304</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) -00305 { -00306 <a class="code" href="message_8h.html#a10">ChangeName</a>(user,gecos.c_str()); -00307 } +00277 <span class="comment">// version is a simple class for holding a modules version number</span> +00278 +<a name="l00279"></a><a class="code" href="classVersion.html#a0">00279</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) : Major(major), Minor(minor), Revision(revision), Build(build) { }; +00280 +00281 <span class="comment">// admin is a simple class for holding a server's administrative info</span> +00282 +<a name="l00283"></a><a class="code" href="classAdmin.html#a0">00283</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) { }; +00284 +<a name="l00285"></a><a class="code" href="classModule.html#a0">00285</a> <a class="code" href="classModule.html#a0">Module::Module</a>() { } +<a name="l00286"></a><a class="code" href="classModule.html#a1">00286</a> <a class="code" href="classModule.html#a1">Module::~Module</a>() { } +<a name="l00287"></a><a class="code" href="classModule.html#a3">00287</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="l00288"></a><a class="code" href="classModule.html#a4">00288</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="l00289"></a><a class="code" href="classModule.html#a5">00289</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="l00290"></a><a class="code" href="classModule.html#a6">00290</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="l00291"></a><a class="code" href="classModule.html#a7">00291</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a7">Module::OnPacketTransmit</a>(<span class="keywordtype">char</span> *p) { } +<a name="l00292"></a><a class="code" href="classModule.html#a8">00292</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a8">Module::OnPacketReceive</a>(<span class="keywordtype">char</span> *p) { } +<a name="l00293"></a><a class="code" href="classModule.html#a9">00293</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a9">Module::OnRehash</a>() { } +<a name="l00294"></a><a class="code" href="classModule.html#a10">00294</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="l00295"></a><a class="code" href="classModule.html#a12">00295</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="l00296"></a><a class="code" href="classModule.html#a11">00296</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="l00297"></a><a class="code" href="classModule.html#a2">00297</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 name="l00298"></a><a class="code" href="classModule.html#a13">00298</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a13">Module::OnOper</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { }; +<a name="l00299"></a><a class="code" href="classModule.html#a14">00299</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a14">Module::OnInfo</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { }; +<a name="l00300"></a><a class="code" href="classModule.html#a15">00300</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a15">Module::OnWhois</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* dest) { }; +<a name="l00301"></a><a class="code" href="classModule.html#a16">00301</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a16">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="l00302"></a><a class="code" href="classModule.html#a17">00302</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a17">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="l00303"></a><a class="code" href="classModule.html#a18">00303</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a18">Module::OnUserPreNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newnick) { <span class="keywordflow">return</span> 0; }; +<a name="l00304"></a><a class="code" href="classModule.html#a19">00304</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a19">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="l00305"></a><a class="code" href="classModule.html#a20">00305</a> <a class="code" href="modules_8h.html#a23">string_list</a> <a class="code" href="classModule.html#a20">Module::OnUserSync</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { <a class="code" href="modules_8h.html#a23">string_list</a> empty; <span class="keywordflow">return</span> empty; } +<a name="l00306"></a><a class="code" href="classModule.html#a21">00306</a> <a class="code" href="modules_8h.html#a23">string_list</a> <a class="code" href="classModule.html#a21">Module::OnChannelSync</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) { <a class="code" href="modules_8h.html#a23">string_list</a> empty; <span class="keywordflow">return</span> empty; } +00307 00308 -<a name="l00309"></a><a class="code" href="classServer.html#a12">00309</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a12">Server::IsNick</a>(std::string nick) -00310 { -00311 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a13">isnick</a>(nick.c_str()) != 0); -00312 } -00313 -<a name="l00314"></a><a class="code" href="classServer.html#a14">00314</a> <a class="code" href="classuserrec.html">userrec</a>* <a class="code" href="classServer.html#a14">Server::FindNick</a>(std::string nick) -00315 { -00316 <span class="keywordflow">return</span> Find(nick); -00317 } -00318 -<a name="l00319"></a><a class="code" href="classServer.html#a15">00319</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a15">Server::FindChannel</a>(std::string channel) -00320 { -00321 <span class="keywordflow">return</span> FindChan(channel.c_str()); -00322 } -00323 -<a name="l00324"></a><a class="code" href="classServer.html#a16">00324</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) -00325 { -00326 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a14">cmode</a>(User,Chan); -00327 } -00328 -<a name="l00329"></a><a class="code" href="classServer.html#a17">00329</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) -00330 { -00331 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a16">has_channel</a>(User,Chan); +00309 <span class="comment">// server is a wrapper class that provides methods to all of the C-style</span> +00310 <span class="comment">// exports in the core</span> +00311 <span class="comment">//</span> +00312 +<a name="l00313"></a><a class="code" href="classServer.html#a0">00313</a> <a class="code" href="classServer.html#a0">Server::Server</a>() +00314 { +00315 } +00316 +<a name="l00317"></a><a class="code" href="classServer.html#a1">00317</a> <a class="code" href="classServer.html#a1">Server::~Server</a>() +00318 { +00319 } +00320 +<a name="l00321"></a><a class="code" href="classServer.html#a2">00321</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a2">Server::SendOpers</a>(std::string s) +00322 { +00323 WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str()); +00324 } +00325 +<a name="l00326"></a><a class="code" href="classServer.html#a30">00326</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a30">Server::MatchText</a>(std::string sliteral, std::string spattern) +00327 { +00328 <span class="keywordtype">char</span> literal[MAXBUF],pattern[MAXBUF]; +00329 strncpy(literal,sliteral.c_str(),MAXBUF); +00330 strncpy(pattern,spattern.c_str(),MAXBUF); +00331 <span class="keywordflow">return</span> match(literal,pattern); 00332 } 00333 -<a name="l00334"></a><a class="code" href="classServer.html#a18">00334</a> std::string <a class="code" href="classServer.html#a18">Server::GetServerName</a>() +<a name="l00334"></a><a class="code" href="classServer.html#a25">00334</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) 00335 { -00336 <span class="keywordflow">return</span> getservername(); +00336 WriteMode(modes.c_str(),flags,<span class="stringliteral">"%s"</span>,text.c_str()); 00337 } 00338 -<a name="l00339"></a><a class="code" href="classServer.html#a19">00339</a> std::string <a class="code" href="classServer.html#a19">Server::GetNetworkName</a>() +<a name="l00339"></a><a class="code" href="classServer.html#a26">00339</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) 00340 { -00341 <span class="keywordflow">return</span> getnetworkname(); +00341 <span class="keywordflow">return</span> add_channel(user,cname.c_str(),key.c_str(),<span class="keyword">true</span>); 00342 } 00343 -<a name="l00344"></a><a class="code" href="classServer.html#a20">00344</a> <a class="code" href="classAdmin.html">Admin</a> <a class="code" href="classServer.html#a20">Server::GetAdmin</a>() +<a name="l00344"></a><a class="code" href="classServer.html#a27">00344</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) 00345 { -00346 <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick()); +00346 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>); 00347 } 00348 -00349 -00350 -<a name="l00351"></a><a class="code" href="classServer.html#a21">00351</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) -00352 { -00353 <span class="keywordflow">if</span> (type == <a class="code" href="modules_8h.html#a7">MT_SERVER</a>) +<a name="l00349"></a><a class="code" href="classServer.html#a35">00349</a> <a class="code" href="modules_8h.html#a24">chanuserlist</a> <a class="code" href="classServer.html#a35">Server::GetUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) +00350 { +00351 <a class="code" href="modules_8h.html#a24">chanuserlist</a> userl; +00352 userl.clear(); +00353 <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++) 00354 { -00355 log(DEBUG,<span class="stringliteral">"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"</span>); -00356 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00357 } -00358 <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>)) -00359 { -00360 log(DEBUG,<span class="stringliteral">"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"</span>); -00361 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00362 } -00363 <span class="keywordflow">if</span> ((params_when_on>1) || (params_when_off>1)) -00364 { -00365 log(DEBUG,<span class="stringliteral">"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"</span>); -00366 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00367 } -00368 <span class="keywordflow">return</span> <a class="code" href="modules_8cpp.html#a9">DoAddExtendedMode</a>(modechar,type,requires_oper,params_when_on,params_when_off); -00369 } -00370 -<a name="l00371"></a><a class="code" href="classServer.html#a22">00371</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a22">Server::AddExtendedListMode</a>(<span class="keywordtype">char</span> modechar) -00372 { -00373 <span class="keywordtype">bool</span> res = <a class="code" href="modules_8cpp.html#a9">DoAddExtendedMode</a>(modechar,MT_CHANNEL,<span class="keyword">false</span>,1,1); -00374 <span class="keywordflow">if</span> (res) -00375 <a class="code" href="modules_8cpp.html#a10">ModeMakeList</a>(modechar); -00376 <span class="keywordflow">return</span> res; +00355 <span class="keywordflow">if</span> (i->second) +00356 { +00357 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a16">has_channel</a>(i->second,chan)) +00358 { +00359 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a13">isnick</a>(i->second->nick)) +00360 { +00361 userl.push_back(i->second); +00362 } +00363 } +00364 } +00365 } +00366 <span class="keywordflow">return</span> userl; +00367 } +<a name="l00368"></a><a class="code" href="classServer.html#a28">00368</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) +00369 { +00370 force_nickchange(user,nickname.c_str()); +00371 } +00372 +<a name="l00373"></a><a class="code" href="classServer.html#a29">00373</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) +00374 { +00375 <a class="code" href="message_8h.html#a19">send_network_quit</a>(user-><a class="code" href="classuserrec.html#m0">nick</a>,reason.c_str()); +00376 kill_link(user,reason.c_str()); 00377 } 00378 -<a name="l00379"></a><a class="code" href="classServer.html#a13">00379</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) +<a name="l00379"></a><a class="code" href="classServer.html#a34">00379</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a34">Server::IsUlined</a>(std::string server) 00380 { -00381 <span class="keywordflow">return</span> usercount(c); +00381 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a70">is_uline</a>(server.c_str()); 00382 } 00383 -00384 -<a name="l00385"></a><a class="code" href="classConfigReader.html#a0">00385</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>() -00386 { -00387 this-><a class="code" href="classConfigReader.html#n0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00388 this-><a class="code" href="classConfigReader.html#n1">error</a> = LoadConf(CONFIG_FILE,this->cache); -00389 } -00390 -00391 -<a name="l00392"></a><a class="code" href="classConfigReader.html#a2">00392</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>() -00393 { -00394 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#n0">cache</a>) -00395 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#n0">cache</a>; -00396 } -00397 +<a name="l00384"></a><a class="code" href="classServer.html#a31">00384</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) +00385 { +00386 call_handler(commandname.c_str(),parameters,pcnt,user); +00387 } +00388 +<a name="l00389"></a><a class="code" href="classServer.html#a3">00389</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) +00390 { +00391 log(level,<span class="stringliteral">"%s"</span>,s.c_str()); +00392 } +00393 +<a name="l00394"></a><a class="code" href="classServer.html#a23">00394</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) +00395 { +00396 <a class="code" href="modules_8h.html#a26">createcommand</a>(cmd,f,flags,minparams); +00397 } 00398 -<a name="l00399"></a><a class="code" href="classConfigReader.html#a1">00399</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(std::string filename) +<a name="l00399"></a><a class="code" href="classServer.html#a24">00399</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) 00400 { -00401 this-><a class="code" href="classConfigReader.html#n0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00402 this-><a class="code" href="classConfigReader.html#n1">error</a> = LoadConf(filename.c_str(),this-><a class="code" href="classConfigReader.html#n0">cache</a>); -00403 }; -00404 -<a name="l00405"></a><a class="code" href="classConfigReader.html#a3">00405</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) -00406 { -00407 <span class="keywordtype">char</span> val[MAXBUF]; -00408 <span class="keywordtype">char</span> t[MAXBUF]; -00409 <span class="keywordtype">char</span> n[MAXBUF]; -00410 strncpy(t,tag.c_str(),MAXBUF); -00411 strncpy(n,name.c_str(),MAXBUF); -00412 ReadConf(cache,t,n,index,val); -00413 <span class="keywordflow">return</span> std::string(val); -00414 } -00415 -00416 -<a name="l00417"></a><a class="code" href="classConfigReader.html#a4">00417</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a4">ConfigReader::Enumerate</a>(std::string tag) -00418 { -00419 <span class="keywordflow">return</span> EnumConf(cache,tag.c_str()); -00420 } -00421 -<a name="l00422"></a><a class="code" href="classConfigReader.html#a6">00422</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a6">ConfigReader::EnumerateValues</a>(std::string tag, <span class="keywordtype">int</span> index) -00423 { -00424 <span class="keywordflow">return</span> EnumValues(cache, tag.c_str(), index); -00425 } -00426 -<a name="l00427"></a><a class="code" href="classConfigReader.html#a5">00427</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a5">ConfigReader::Verify</a>() -00428 { -00429 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#n1">error</a>; -00430 } -00431 +00401 <a class="code" href="modules_8h.html#a27">server_mode</a>(parameters,pcnt,user); +00402 } +00403 +<a name="l00404"></a><a class="code" href="classServer.html#a4">00404</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) +00405 { +00406 Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); +00407 } +00408 +<a name="l00409"></a><a class="code" href="classServer.html#a5">00409</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) +00410 { +00411 WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); +00412 } +00413 +<a name="l00414"></a><a class="code" href="classServer.html#a6">00414</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) +00415 { +00416 WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00417 } +00418 +<a name="l00419"></a><a class="code" href="classServer.html#a7">00419</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) +00420 { +00421 <span class="keywordflow">if</span> (!Source) +00422 { +00423 <span class="comment">// if source is NULL, then the message originates from the local server</span> +00424 Write(Dest-><a class="code" href="classconnection.html#m0">fd</a>,<span class="stringliteral">":%s %s"</span>,this->GetServerName().c_str(),s.c_str()); +00425 } +00426 <span class="keywordflow">else</span> +00427 { +00428 <span class="comment">// otherwise it comes from the user specified</span> +00429 WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str()); +00430 } +00431 } 00432 -<a name="l00433"></a><a class="code" href="classFileReader.html#a1">00433</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(std::string filename) +<a name="l00433"></a><a class="code" href="classServer.html#a8">00433</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) 00434 { -00435 <a class="code" href="modules_8h.html#a22">file_cache</a> c; -00436 readfile(c,filename.c_str()); -00437 this-><a class="code" href="classFileReader.html#o0">fc</a> = c; -00438 } -00439 -<a name="l00440"></a><a class="code" href="classFileReader.html#a0">00440</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>() -00441 { -00442 } -00443 -<a name="l00444"></a><a class="code" href="classFileReader.html#a3">00444</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(std::string filename) -00445 { -00446 <a class="code" href="modules_8h.html#a22">file_cache</a> c; -00447 readfile(c,filename.c_str()); -00448 this-><a class="code" href="classFileReader.html#o0">fc</a> = c; -00449 } -00450 -00451 -<a name="l00452"></a><a class="code" href="classFileReader.html#a2">00452</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>() -00453 { -00454 } -00455 -<a name="l00456"></a><a class="code" href="classFileReader.html#a4">00456</a> <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">FileReader::Exists</a>() -00457 { -00458 <span class="keywordflow">if</span> (<a class="code" href="classFileReader.html#o0">fc</a>.size() == 0) -00459 { -00460 <span class="keywordflow">return</span>(false); -00461 } -00462 <span class="keywordflow">else</span> -00463 { -00464 <span class="keywordflow">return</span>(true); -00465 } -00466 } -00467 -<a name="l00468"></a><a class="code" href="classFileReader.html#a5">00468</a> std::string <a class="code" href="classFileReader.html#a5">FileReader::GetLine</a>(<span class="keywordtype">int</span> x) -00469 { -00470 <span class="keywordflow">if</span> ((x<0) || (x><a class="code" href="classFileReader.html#o0">fc</a>.size())) -00471 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; -00472 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#o0">fc</a>[x]; -00473 } -00474 -<a name="l00475"></a><a class="code" href="classFileReader.html#a6">00475</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileReader::FileSize</a>() -00476 { -00477 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#o0">fc</a>.size(); -00478 } -00479 -00480 -00481 std::vector<Module*> <a class="code" href="modules_8cpp.html#a11">modules</a>(255); -00482 std::vector<ircd_module*> <a class="code" href="modules_8cpp.html#a12">factory</a>(255); -00483 -<a name="l00484"></a><a class="code" href="modules_8cpp.html#a3">00484</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a3">MODCOUNT</a> = -1; -00485 +00435 <span class="keywordflow">if</span> (IncludeSender) +00436 { +00437 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00438 } +00439 <span class="keywordflow">else</span> +00440 { +00441 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00442 } +00443 } +00444 +<a name="l00445"></a><a class="code" href="classServer.html#a9">00445</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) +00446 { +00447 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a0">common_channels</a>(u1,u2) != 0); +00448 } +00449 +<a name="l00450"></a><a class="code" href="classServer.html#a10">00450</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) +00451 { +00452 <span class="keywordflow">if</span> (IncludeSender) +00453 { +00454 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str()); +00455 } +00456 <span class="keywordflow">else</span> +00457 { +00458 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str()); +00459 } +00460 } +00461 +<a name="l00462"></a><a class="code" href="classServer.html#a11">00462</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) +00463 { +00464 WriteWallOps(User,<span class="keyword">false</span>,<span class="stringliteral">"%s"</span>,text.c_str()); +00465 } +00466 +<a name="l00467"></a><a class="code" href="classServer.html#a32">00467</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) +00468 { +00469 <a class="code" href="message_8h.html#a11">ChangeDisplayedHost</a>(user,host.c_str()); +00470 } +00471 +<a name="l00472"></a><a class="code" href="classServer.html#a33">00472</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) +00473 { +00474 <a class="code" href="message_8h.html#a10">ChangeName</a>(user,gecos.c_str()); +00475 } +00476 +<a name="l00477"></a><a class="code" href="classServer.html#a12">00477</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a12">Server::IsNick</a>(std::string nick) +00478 { +00479 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a13">isnick</a>(nick.c_str()) != 0); +00480 } +00481 +<a name="l00482"></a><a class="code" href="classServer.html#a14">00482</a> <a class="code" href="classuserrec.html">userrec</a>* <a class="code" href="classServer.html#a14">Server::FindNick</a>(std::string nick) +00483 { +00484 <span class="keywordflow">return</span> Find(nick); +00485 } 00486 -</pre></div><hr><address style="align: right;"><small>Generated on Sat May 1 13:39:00 2004 for InspIRCd by +<a name="l00487"></a><a class="code" href="classServer.html#a15">00487</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a15">Server::FindChannel</a>(std::string channel) +00488 { +00489 <span class="keywordflow">return</span> FindChan(channel.c_str()); +00490 } +00491 +<a name="l00492"></a><a class="code" href="classServer.html#a16">00492</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) +00493 { +00494 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a14">cmode</a>(User,Chan); +00495 } +00496 +<a name="l00497"></a><a class="code" href="classServer.html#a17">00497</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) +00498 { +00499 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a16">has_channel</a>(User,Chan); +00500 } +00501 +<a name="l00502"></a><a class="code" href="classServer.html#a18">00502</a> std::string <a class="code" href="classServer.html#a18">Server::GetServerName</a>() +00503 { +00504 <span class="keywordflow">return</span> getservername(); +00505 } +00506 +<a name="l00507"></a><a class="code" href="classServer.html#a19">00507</a> std::string <a class="code" href="classServer.html#a19">Server::GetNetworkName</a>() +00508 { +00509 <span class="keywordflow">return</span> getnetworkname(); +00510 } +00511 +<a name="l00512"></a><a class="code" href="classServer.html#a20">00512</a> <a class="code" href="classAdmin.html">Admin</a> <a class="code" href="classServer.html#a20">Server::GetAdmin</a>() +00513 { +00514 <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick()); +00515 } +00516 +00517 +00518 +<a name="l00519"></a><a class="code" href="classServer.html#a21">00519</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) +00520 { +00521 <span class="keywordflow">if</span> (type == <a class="code" href="modules_8h.html#a7">MT_SERVER</a>) +00522 { +00523 log(DEBUG,<span class="stringliteral">"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"</span>); +00524 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00525 } +00526 <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>)) +00527 { +00528 log(DEBUG,<span class="stringliteral">"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"</span>); +00529 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00530 } +00531 <span class="keywordflow">if</span> ((params_when_on>1) || (params_when_off>1)) +00532 { +00533 log(DEBUG,<span class="stringliteral">"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"</span>); +00534 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00535 } +00536 <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); +00537 } +00538 +<a name="l00539"></a><a class="code" href="classServer.html#a22">00539</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a22">Server::AddExtendedListMode</a>(<span class="keywordtype">char</span> modechar) +00540 { +00541 <span class="keywordtype">bool</span> res = <a class="code" href="modules_8cpp.html#a57">DoAddExtendedMode</a>(modechar,MT_CHANNEL,<span class="keyword">false</span>,1,1); +00542 <span class="keywordflow">if</span> (res) +00543 <a class="code" href="modules_8cpp.html#a58">ModeMakeList</a>(modechar); +00544 <span class="keywordflow">return</span> res; +00545 } +00546 +<a name="l00547"></a><a class="code" href="classServer.html#a13">00547</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) +00548 { +00549 <span class="keywordflow">return</span> usercount(c); +00550 } +00551 +00552 +<a name="l00553"></a><a class="code" href="classConfigReader.html#a0">00553</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>() +00554 { +00555 this-><a class="code" href="classConfigReader.html#n0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00556 this-><a class="code" href="classConfigReader.html#n1">error</a> = LoadConf(CONFIG_FILE,this->cache); +00557 } +00558 +00559 +<a name="l00560"></a><a class="code" href="classConfigReader.html#a2">00560</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>() +00561 { +00562 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#n0">cache</a>) +00563 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#n0">cache</a>; +00564 } +00565 +00566 +<a name="l00567"></a><a class="code" href="classConfigReader.html#a1">00567</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(std::string filename) +00568 { +00569 this-><a class="code" href="classConfigReader.html#n0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00570 this-><a class="code" href="classConfigReader.html#n1">error</a> = LoadConf(filename.c_str(),this-><a class="code" href="classConfigReader.html#n0">cache</a>); +00571 }; +00572 +<a name="l00573"></a><a class="code" href="classConfigReader.html#a3">00573</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) +00574 { +00575 <span class="keywordtype">char</span> val[MAXBUF]; +00576 <span class="keywordtype">char</span> t[MAXBUF]; +00577 <span class="keywordtype">char</span> n[MAXBUF]; +00578 strncpy(t,tag.c_str(),MAXBUF); +00579 strncpy(n,name.c_str(),MAXBUF); +00580 ReadConf(cache,t,n,index,val); +00581 <span class="keywordflow">return</span> std::string(val); +00582 } +00583 +00584 +<a name="l00585"></a><a class="code" href="classConfigReader.html#a4">00585</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a4">ConfigReader::Enumerate</a>(std::string tag) +00586 { +00587 <span class="keywordflow">return</span> EnumConf(cache,tag.c_str()); +00588 } +00589 +<a name="l00590"></a><a class="code" href="classConfigReader.html#a6">00590</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a6">ConfigReader::EnumerateValues</a>(std::string tag, <span class="keywordtype">int</span> index) +00591 { +00592 <span class="keywordflow">return</span> EnumValues(cache, tag.c_str(), index); +00593 } +00594 +<a name="l00595"></a><a class="code" href="classConfigReader.html#a5">00595</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a5">ConfigReader::Verify</a>() +00596 { +00597 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#n1">error</a>; +00598 } +00599 +00600 +<a name="l00601"></a><a class="code" href="classFileReader.html#a1">00601</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(std::string filename) +00602 { +00603 <a class="code" href="modules_8h.html#a22">file_cache</a> c; +00604 readfile(c,filename.c_str()); +00605 this-><a class="code" href="classFileReader.html#o0">fc</a> = c; +00606 } +00607 +<a name="l00608"></a><a class="code" href="classFileReader.html#a0">00608</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>() +00609 { +00610 } +00611 +<a name="l00612"></a><a class="code" href="classFileReader.html#a3">00612</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(std::string filename) +00613 { +00614 <a class="code" href="modules_8h.html#a22">file_cache</a> c; +00615 readfile(c,filename.c_str()); +00616 this-><a class="code" href="classFileReader.html#o0">fc</a> = c; +00617 } +00618 +00619 +<a name="l00620"></a><a class="code" href="classFileReader.html#a2">00620</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>() +00621 { +00622 } +00623 +<a name="l00624"></a><a class="code" href="classFileReader.html#a4">00624</a> <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">FileReader::Exists</a>() +00625 { +00626 <span class="keywordflow">if</span> (<a class="code" href="classFileReader.html#o0">fc</a>.size() == 0) +00627 { +00628 <span class="keywordflow">return</span>(false); +00629 } +00630 <span class="keywordflow">else</span> +00631 { +00632 <span class="keywordflow">return</span>(true); +00633 } +00634 } +00635 +<a name="l00636"></a><a class="code" href="classFileReader.html#a5">00636</a> std::string <a class="code" href="classFileReader.html#a5">FileReader::GetLine</a>(<span class="keywordtype">int</span> x) +00637 { +00638 <span class="keywordflow">if</span> ((x<0) || (x><a class="code" href="classFileReader.html#o0">fc</a>.size())) +00639 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; +00640 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#o0">fc</a>[x]; +00641 } +00642 +<a name="l00643"></a><a class="code" href="classFileReader.html#a6">00643</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileReader::FileSize</a>() +00644 { +00645 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#o0">fc</a>.size(); +00646 } +00647 +00648 +00649 std::vector<Module*> <a class="code" href="modules_8cpp.html#a59">modules</a>(255); +00650 std::vector<ircd_module*> <a class="code" href="modules_8cpp.html#a60">factory</a>(255); +00651 +<a name="l00652"></a><a class="code" href="modules_8cpp.html#a1">00652</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a> = -1; +00653 +00654 +</pre></div><hr><address style="align: right;"><small>Generated on Sat May 1 17:50:06 2004 for InspIRCd by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.3-rc3 </small></address> |