diff options
Diffstat (limited to 'docs/module-doc/modules_8cpp-source.html')
-rw-r--r-- | docs/module-doc/modules_8cpp-source.html | 1398 |
1 files changed, 700 insertions, 698 deletions
diff --git a/docs/module-doc/modules_8cpp-source.html b/docs/module-doc/modules_8cpp-source.html index 8b4297c73..5079fa4a4 100644 --- a/docs/module-doc/modules_8cpp-source.html +++ b/docs/module-doc/modules_8cpp-source.html @@ -72,716 +72,718 @@ <a name="l00065"></a><a class="code" href="modules_8cpp.html#a2">00065</a> <span class="keyword">extern</span> std::vector<Module*> <a class="code" href="channels_8cpp.html#a2">modules</a>; <a name="l00066"></a><a class="code" href="modules_8cpp.html#a3">00066</a> <span class="keyword">extern</span> std::vector<ircd_module*> <a class="code" href="channels_8cpp.html#a3">factory</a>; 00067 -<a name="l00068"></a><a class="code" href="modules_8cpp.html#a4">00068</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a4">LogLevel</a>; -<a name="l00069"></a><a class="code" href="modules_8cpp.html#a5">00069</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a5">ServerName</a>[MAXBUF]; -<a name="l00070"></a><a class="code" href="modules_8cpp.html#a6">00070</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a6">Network</a>[MAXBUF]; -<a name="l00071"></a><a class="code" href="modules_8cpp.html#a7">00071</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a7">ServerDesc</a>[MAXBUF]; -<a name="l00072"></a><a class="code" href="modules_8cpp.html#a8">00072</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a8">AdminName</a>[MAXBUF]; -<a name="l00073"></a><a class="code" href="modules_8cpp.html#a9">00073</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a9">AdminEmail</a>[MAXBUF]; -<a name="l00074"></a><a class="code" href="modules_8cpp.html#a10">00074</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a10">AdminNick</a>[MAXBUF]; -<a name="l00075"></a><a class="code" href="modules_8cpp.html#a11">00075</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a11">diepass</a>[MAXBUF]; -<a name="l00076"></a><a class="code" href="modules_8cpp.html#a12">00076</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a12">restartpass</a>[MAXBUF]; -<a name="l00077"></a><a class="code" href="modules_8cpp.html#a13">00077</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a13">motd</a>[MAXBUF]; -<a name="l00078"></a><a class="code" href="modules_8cpp.html#a14">00078</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a14">rules</a>[MAXBUF]; -<a name="l00079"></a><a class="code" href="modules_8cpp.html#a15">00079</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a15">list</a>[MAXBUF]; -<a name="l00080"></a><a class="code" href="modules_8cpp.html#a16">00080</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a16">PrefixQuit</a>[MAXBUF]; -<a name="l00081"></a><a class="code" href="modules_8cpp.html#a17">00081</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a17">DieValue</a>[MAXBUF]; -00082 -<a name="l00083"></a><a class="code" href="modules_8cpp.html#a18">00083</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a18">debugging</a>; -<a name="l00084"></a><a class="code" href="modules_8cpp.html#a19">00084</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a19">WHOWAS_STALE</a>; -<a name="l00085"></a><a class="code" href="modules_8cpp.html#a20">00085</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a20">WHOWAS_MAX</a>; -<a name="l00086"></a><a class="code" href="modules_8cpp.html#a21">00086</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a21">DieDelay</a>; -<a name="l00087"></a><a class="code" href="modules_8cpp.html#a22">00087</a> <span class="keyword">extern</span> time_t <a class="code" href="channels_8cpp.html#a22">startup_time</a>; -<a name="l00088"></a><a class="code" href="modules_8cpp.html#a23">00088</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a23">NetBufferSize</a>; -<a name="l00089"></a><a class="code" href="modules_8cpp.html#a24">00089</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a24">MaxWhoResults</a>; -<a name="l00090"></a><a class="code" href="modules_8cpp.html#a25">00090</a> <span class="keyword">extern</span> time_t <a class="code" href="channels_8cpp.html#a25">nb_start</a>; -00091 -<a name="l00092"></a><a class="code" href="modules_8cpp.html#a26">00092</a> <span class="keyword">extern</span> std::vector<int> <a class="code" href="channels_8cpp.html#a26">fd_reap</a>; -<a name="l00093"></a><a class="code" href="modules_8cpp.html#a27">00093</a> <span class="keyword">extern</span> std::vector<std::string> <a class="code" href="channels_8cpp.html#a27">module_names</a>; -00094 -<a name="l00095"></a><a class="code" href="modules_8cpp.html#a28">00095</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a28">boundPortCount</a>; -<a name="l00096"></a><a class="code" href="modules_8cpp.html#a29">00096</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a29">portCount</a>; -<a name="l00097"></a><a class="code" href="modules_8cpp.html#a30">00097</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a30">UDPportCount</a>; -<a name="l00098"></a><a class="code" href="modules_8cpp.html#a31">00098</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a31">ports</a>[MAXSOCKS]; -<a name="l00099"></a><a class="code" href="modules_8cpp.html#a32">00099</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a32">defaultRoute</a>; -00100 -<a name="l00101"></a><a class="code" href="modules_8cpp.html#a33">00101</a> <span class="keyword">extern</span> std::vector<long> <a class="code" href="channels_8cpp.html#a33">auth_cookies</a>; -<a name="l00102"></a><a class="code" href="modules_8cpp.html#a34">00102</a> <span class="keyword">extern</span> std::stringstream <a class="code" href="channels_8cpp.html#a34">config_f</a>; -00103 -<a name="l00104"></a><a class="code" href="modules_8cpp.html#a35">00104</a> <span class="keyword">extern</span> <a class="code" href="classserverrec.html">serverrec</a>* <a class="code" href="channels_8cpp.html#a35">me</a>[32]; +<a name="l00068"></a><a class="code" href="modules_8cpp.html#a4">00068</a> <span class="keyword">extern</span> time_t <a class="code" href="channels_8cpp.html#a37">TIME</a>; +00069 +<a name="l00070"></a><a class="code" href="modules_8cpp.html#a5">00070</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a4">LogLevel</a>; +<a name="l00071"></a><a class="code" href="modules_8cpp.html#a6">00071</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a5">ServerName</a>[MAXBUF]; +<a name="l00072"></a><a class="code" href="modules_8cpp.html#a7">00072</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a6">Network</a>[MAXBUF]; +<a name="l00073"></a><a class="code" href="modules_8cpp.html#a8">00073</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a7">ServerDesc</a>[MAXBUF]; +<a name="l00074"></a><a class="code" href="modules_8cpp.html#a9">00074</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a8">AdminName</a>[MAXBUF]; +<a name="l00075"></a><a class="code" href="modules_8cpp.html#a10">00075</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a9">AdminEmail</a>[MAXBUF]; +<a name="l00076"></a><a class="code" href="modules_8cpp.html#a11">00076</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a10">AdminNick</a>[MAXBUF]; +<a name="l00077"></a><a class="code" href="modules_8cpp.html#a12">00077</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a11">diepass</a>[MAXBUF]; +<a name="l00078"></a><a class="code" href="modules_8cpp.html#a13">00078</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a12">restartpass</a>[MAXBUF]; +<a name="l00079"></a><a class="code" href="modules_8cpp.html#a14">00079</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a13">motd</a>[MAXBUF]; +<a name="l00080"></a><a class="code" href="modules_8cpp.html#a15">00080</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a14">rules</a>[MAXBUF]; +<a name="l00081"></a><a class="code" href="modules_8cpp.html#a16">00081</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a15">list</a>[MAXBUF]; +<a name="l00082"></a><a class="code" href="modules_8cpp.html#a17">00082</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a16">PrefixQuit</a>[MAXBUF]; +<a name="l00083"></a><a class="code" href="modules_8cpp.html#a18">00083</a> <span class="keyword">extern</span> <span class="keywordtype">char</span> <a class="code" href="channels_8cpp.html#a17">DieValue</a>[MAXBUF]; +00084 +<a name="l00085"></a><a class="code" href="modules_8cpp.html#a19">00085</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a18">debugging</a>; +<a name="l00086"></a><a class="code" href="modules_8cpp.html#a20">00086</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a19">WHOWAS_STALE</a>; +<a name="l00087"></a><a class="code" href="modules_8cpp.html#a21">00087</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a20">WHOWAS_MAX</a>; +<a name="l00088"></a><a class="code" href="modules_8cpp.html#a22">00088</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a21">DieDelay</a>; +<a name="l00089"></a><a class="code" href="modules_8cpp.html#a23">00089</a> <span class="keyword">extern</span> time_t <a class="code" href="channels_8cpp.html#a22">startup_time</a>; +<a name="l00090"></a><a class="code" href="modules_8cpp.html#a24">00090</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a23">NetBufferSize</a>; +<a name="l00091"></a><a class="code" href="modules_8cpp.html#a25">00091</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a24">MaxWhoResults</a>; +<a name="l00092"></a><a class="code" href="modules_8cpp.html#a26">00092</a> <span class="keyword">extern</span> time_t <a class="code" href="channels_8cpp.html#a25">nb_start</a>; +00093 +<a name="l00094"></a><a class="code" href="modules_8cpp.html#a27">00094</a> <span class="keyword">extern</span> std::vector<int> <a class="code" href="channels_8cpp.html#a26">fd_reap</a>; +<a name="l00095"></a><a class="code" href="modules_8cpp.html#a28">00095</a> <span class="keyword">extern</span> std::vector<std::string> <a class="code" href="channels_8cpp.html#a27">module_names</a>; +00096 +<a name="l00097"></a><a class="code" href="modules_8cpp.html#a29">00097</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a28">boundPortCount</a>; +<a name="l00098"></a><a class="code" href="modules_8cpp.html#a30">00098</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a29">portCount</a>; +<a name="l00099"></a><a class="code" href="modules_8cpp.html#a31">00099</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a30">UDPportCount</a>; +<a name="l00100"></a><a class="code" href="modules_8cpp.html#a32">00100</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a31">ports</a>[MAXSOCKS]; +<a name="l00101"></a><a class="code" href="modules_8cpp.html#a33">00101</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="channels_8cpp.html#a32">defaultRoute</a>; +00102 +<a name="l00103"></a><a class="code" href="modules_8cpp.html#a34">00103</a> <span class="keyword">extern</span> std::vector<long> <a class="code" href="channels_8cpp.html#a33">auth_cookies</a>; +<a name="l00104"></a><a class="code" href="modules_8cpp.html#a35">00104</a> <span class="keyword">extern</span> std::stringstream <a class="code" href="channels_8cpp.html#a34">config_f</a>; 00105 -<a name="l00106"></a><a class="code" href="modules_8cpp.html#a36">00106</a> <span class="keyword">extern</span> FILE *<a class="code" href="channels_8cpp.html#a36">log_file</a>; +<a name="l00106"></a><a class="code" href="modules_8cpp.html#a36">00106</a> <span class="keyword">extern</span> <a class="code" href="classserverrec.html">serverrec</a>* <a class="code" href="channels_8cpp.html#a35">me</a>[32]; 00107 -00108 -<a name="l00109"></a><a class="code" href="namespacenspace.html">00109</a> <span class="keyword">namespace </span><a class="code" href="channels_8cpp.html#a0">nspace</a> -00110 { -00111 <span class="preprocessor">#ifdef GCC34</span> -00112 <span class="preprocessor"></span> <span class="keyword">template</span><> <span class="keyword">struct </span>hash<in_addr> -00113 #else -<a name="l00114"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01in__addr_01_4.html">00114</a> template<> struct <a class="code" href="channels_8cpp.html#a0">nspace</a>::hash<in_addr> -00115 #endif -00116 { -<a name="l00117"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01in__addr_01_4.html#a0">00117</a> size_t operator()(<span class="keyword">const</span> <span class="keyword">struct</span> in_addr &a)<span class="keyword"> const</span> -00118 <span class="keyword"> </span>{ -00119 size_t q; -00120 memcpy(&q,&a,<span class="keyword">sizeof</span>(size_t)); -00121 <span class="keywordflow">return</span> q; -00122 } -00123 }; -00124 <span class="preprocessor">#ifdef GCC34</span> -00125 <span class="preprocessor"></span> <span class="keyword">template</span><> <span class="keyword">struct </span>hash<string> -00126 #else -<a name="l00127"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01string_01_4.html">00127</a> template<> struct <a class="code" href="channels_8cpp.html#a0">nspace</a>::hash<string> -00128 #endif -00129 { -<a name="l00130"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01string_01_4.html#a0">00130</a> size_t operator()(<span class="keyword">const</span> string &s)<span class="keyword"> const</span> -00131 <span class="keyword"> </span>{ -00132 <span class="keywordtype">char</span> a[MAXBUF]; -00133 <span class="keyword">static</span> <span class="keyword">struct </span>hash<const char *> strhash; -00134 strlcpy(a,s.c_str(),MAXBUF); -00135 strlower(a); -00136 <span class="keywordflow">return</span> strhash(a); -00137 } -00138 }; -00139 } -00140 -<a name="l00141"></a><a class="code" href="structStrHashComp.html">00141</a> <span class="keyword">struct </span><a class="code" href="structStrHashComp.html">StrHashComp</a> -00142 { -00143 -<a name="l00144"></a><a class="code" href="structStrHashComp.html#a0">00144</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> -00145 <span class="keyword"> </span>{ -00146 <span class="keywordtype">char</span> a[MAXBUF],b[MAXBUF]; -00147 strlcpy(a,s1.c_str(),MAXBUF); -00148 strlcpy(b,s2.c_str(),MAXBUF); -00149 <span class="keywordflow">return</span> (strcasecmp(a,b) == 0); -00150 } -00151 -00152 }; +<a name="l00108"></a><a class="code" href="modules_8cpp.html#a37">00108</a> <span class="keyword">extern</span> FILE *<a class="code" href="channels_8cpp.html#a36">log_file</a>; +00109 +00110 +<a name="l00111"></a><a class="code" href="namespacenspace.html">00111</a> <span class="keyword">namespace </span><a class="code" href="channels_8cpp.html#a0">nspace</a> +00112 { +00113 <span class="preprocessor">#ifdef GCC34</span> +00114 <span class="preprocessor"></span> <span class="keyword">template</span><> <span class="keyword">struct </span>hash<in_addr> +00115 #else +<a name="l00116"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01in__addr_01_4.html">00116</a> template<> struct <a class="code" href="channels_8cpp.html#a0">nspace</a>::hash<in_addr> +00117 #endif +00118 { +<a name="l00119"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01in__addr_01_4.html#a0">00119</a> size_t operator()(<span class="keyword">const</span> <span class="keyword">struct</span> in_addr &a)<span class="keyword"> const</span> +00120 <span class="keyword"> </span>{ +00121 size_t q; +00122 memcpy(&q,&a,<span class="keyword">sizeof</span>(size_t)); +00123 <span class="keywordflow">return</span> q; +00124 } +00125 }; +00126 <span class="preprocessor">#ifdef GCC34</span> +00127 <span class="preprocessor"></span> <span class="keyword">template</span><> <span class="keyword">struct </span>hash<string> +00128 #else +<a name="l00129"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01string_01_4.html">00129</a> template<> struct <a class="code" href="channels_8cpp.html#a0">nspace</a>::hash<string> +00130 #endif +00131 { +<a name="l00132"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01string_01_4.html#a0">00132</a> size_t operator()(<span class="keyword">const</span> string &s)<span class="keyword"> const</span> +00133 <span class="keyword"> </span>{ +00134 <span class="keywordtype">char</span> a[MAXBUF]; +00135 <span class="keyword">static</span> <span class="keyword">struct </span>hash<const char *> strhash; +00136 strlcpy(a,s.c_str(),MAXBUF); +00137 strlower(a); +00138 <span class="keywordflow">return</span> strhash(a); +00139 } +00140 }; +00141 } +00142 +<a name="l00143"></a><a class="code" href="structStrHashComp.html">00143</a> <span class="keyword">struct </span><a class="code" href="structStrHashComp.html">StrHashComp</a> +00144 { +00145 +<a name="l00146"></a><a class="code" href="structStrHashComp.html#a0">00146</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> +00147 <span class="keyword"> </span>{ +00148 <span class="keywordtype">char</span> a[MAXBUF],b[MAXBUF]; +00149 strlcpy(a,s1.c_str(),MAXBUF); +00150 strlcpy(b,s2.c_str(),MAXBUF); +00151 <span class="keywordflow">return</span> (strcasecmp(a,b) == 0); +00152 } 00153 -<a name="l00154"></a><a class="code" href="structInAddr__HashComp.html">00154</a> <span class="keyword">struct </span><a class="code" href="structInAddr__HashComp.html">InAddr_HashComp</a> -00155 { -00156 -<a name="l00157"></a><a class="code" href="structInAddr__HashComp.html#a0">00157</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> -00158 <span class="keyword"> </span>{ -00159 size_t q; -00160 size_t p; -00161 -00162 memcpy(&q,&s1,<span class="keyword">sizeof</span>(size_t)); -00163 memcpy(&p,&s2,<span class="keyword">sizeof</span>(size_t)); -00164 -00165 <span class="keywordflow">return</span> (q == p); -00166 } -00167 -00168 }; +00154 }; +00155 +<a name="l00156"></a><a class="code" href="structInAddr__HashComp.html">00156</a> <span class="keyword">struct </span><a class="code" href="structInAddr__HashComp.html">InAddr_HashComp</a> +00157 { +00158 +<a name="l00159"></a><a class="code" href="structInAddr__HashComp.html#a0">00159</a> <span class="keywordtype">bool</span> <a class="code" href="structInAddr__HashComp.html#a0">operator()</a>(<span class="keyword">const</span> in_addr &s1, <span class="keyword">const</span> in_addr &s2)<span class="keyword"> const</span> +00160 <span class="keyword"> </span>{ +00161 size_t q; +00162 size_t p; +00163 +00164 memcpy(&q,&s1,<span class="keyword">sizeof</span>(size_t)); +00165 memcpy(&p,&s2,<span class="keyword">sizeof</span>(size_t)); +00166 +00167 <span class="keywordflow">return</span> (q == p); +00168 } 00169 -00170 -<a name="l00171"></a><a class="code" href="modules_8cpp.html#a37">00171</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#a37">user_hash</a>; -<a name="l00172"></a><a class="code" href="modules_8cpp.html#a38">00172</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#a38">chan_hash</a>; -<a name="l00173"></a><a class="code" href="modules_8cpp.html#a39">00173</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#a39">address_cache</a>; -<a name="l00174"></a><a class="code" href="modules_8cpp.html#a40">00174</a> <span class="keyword">typedef</span> std::deque<command_t> <a class="code" href="modules_8cpp.html#a40">command_table</a>; -00175 -00176 -<a name="l00177"></a><a class="code" href="modules_8cpp.html#a41">00177</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a37">user_hash</a> <a class="code" href="modules_8cpp.html#a41">clientlist</a>; -<a name="l00178"></a><a class="code" href="modules_8cpp.html#a42">00178</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a38">chan_hash</a> <a class="code" href="modules_8cpp.html#a42">chanlist</a>; -<a name="l00179"></a><a class="code" href="modules_8cpp.html#a43">00179</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a37">user_hash</a> <a class="code" href="modules_8cpp.html#a43">whowas</a>; -<a name="l00180"></a><a class="code" href="modules_8cpp.html#a44">00180</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a40">command_table</a> <a class="code" href="modules_8cpp.html#a44">cmdlist</a>; -<a name="l00181"></a><a class="code" href="modules_8cpp.html#a45">00181</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a26">file_cache</a> <a class="code" href="modules_8cpp.html#a45">MOTD</a>; -<a name="l00182"></a><a class="code" href="modules_8cpp.html#a46">00182</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a26">file_cache</a> <a class="code" href="modules_8cpp.html#a46">RULES</a>; -<a name="l00183"></a><a class="code" href="modules_8cpp.html#a47">00183</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a39">address_cache</a> <a class="code" href="modules_8cpp.html#a47">IP</a>; -00184 -00185 -00186 <span class="comment">// class type for holding an extended mode character - internal to core</span> +00170 }; +00171 +00172 +<a name="l00173"></a><a class="code" href="modules_8cpp.html#a38">00173</a> <span class="keyword">typedef</span> nspace::hash_map<std::string, userrec*, nspace::hash<string>, <a class="code" href="structStrHashComp.html">StrHashComp</a>> <a class="code" href="modules_8cpp.html#a38">user_hash</a>; +<a name="l00174"></a><a class="code" href="modules_8cpp.html#a39">00174</a> <span class="keyword">typedef</span> nspace::hash_map<std::string, chanrec*, nspace::hash<string>, <a class="code" href="structStrHashComp.html">StrHashComp</a>> <a class="code" href="modules_8cpp.html#a39">chan_hash</a>; +<a name="l00175"></a><a class="code" href="modules_8cpp.html#a40">00175</a> <span class="keyword">typedef</span> nspace::hash_map<in_addr,string*, nspace::hash<in_addr>, <a class="code" href="structInAddr__HashComp.html">InAddr_HashComp</a>> <a class="code" href="modules_8cpp.html#a40">address_cache</a>; +<a name="l00176"></a><a class="code" href="modules_8cpp.html#a41">00176</a> <span class="keyword">typedef</span> std::deque<command_t> <a class="code" href="modules_8cpp.html#a41">command_table</a>; +00177 +00178 +<a name="l00179"></a><a class="code" href="modules_8cpp.html#a42">00179</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a38">user_hash</a> <a class="code" href="modules_8cpp.html#a42">clientlist</a>; +<a name="l00180"></a><a class="code" href="modules_8cpp.html#a43">00180</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a39">chan_hash</a> <a class="code" href="modules_8cpp.html#a43">chanlist</a>; +<a name="l00181"></a><a class="code" href="modules_8cpp.html#a44">00181</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a38">user_hash</a> <a class="code" href="modules_8cpp.html#a44">whowas</a>; +<a name="l00182"></a><a class="code" href="modules_8cpp.html#a45">00182</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a41">command_table</a> <a class="code" href="modules_8cpp.html#a45">cmdlist</a>; +<a name="l00183"></a><a class="code" href="modules_8cpp.html#a46">00183</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a30">file_cache</a> <a class="code" href="modules_8cpp.html#a46">MOTD</a>; +<a name="l00184"></a><a class="code" href="modules_8cpp.html#a47">00184</a> <span class="keyword">extern</span> <a class="code" href="modules_8h.html#a30">file_cache</a> <a class="code" href="modules_8cpp.html#a47">RULES</a>; +<a name="l00185"></a><a class="code" href="modules_8cpp.html#a48">00185</a> <span class="keyword">extern</span> <a class="code" href="modules_8cpp.html#a40">address_cache</a> <a class="code" href="modules_8cpp.html#a48">IP</a>; +00186 00187 -<a name="l00188"></a><a class="code" href="classExtMode.html">00188</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> -00189 { -00190 <span class="keyword">public</span>: -<a name="l00191"></a><a class="code" href="classExtMode.html#o0">00191</a> <span class="keywordtype">char</span> <a class="code" href="classExtMode.html#o0">modechar</a>; -<a name="l00192"></a><a class="code" href="classExtMode.html#o1">00192</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o1">type</a>; -<a name="l00193"></a><a class="code" href="classExtMode.html#o2">00193</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o2">params_when_on</a>; -<a name="l00194"></a><a class="code" href="classExtMode.html#o3">00194</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o3">params_when_off</a>; -<a name="l00195"></a><a class="code" href="classExtMode.html#o4">00195</a> <span class="keywordtype">bool</span> <a class="code" href="classExtMode.html#o4">needsoper</a>; -<a name="l00196"></a><a class="code" href="classExtMode.html#o5">00196</a> <span class="keywordtype">bool</span> <a class="code" href="channels_8cpp.html#a15">list</a>; -<a name="l00197"></a><a class="code" href="classExtMode.html#a0">00197</a> <a class="code" href="classExtMode.html#a0">ExtMode</a>(<span class="keywordtype">char</span> mc, <span class="keywordtype">int</span> ty, <span class="keywordtype">bool</span> oper, <span class="keywordtype">int</span> p_on, <span class="keywordtype">int</span> p_off) : <a class="code" href="classExtMode.html#o0">modechar</a>(mc), <a class="code" href="classExtMode.html#o1">type</a>(ty), <a class="code" href="classExtMode.html#o4">needsoper</a>(oper), <a class="code" href="classExtMode.html#o2">params_when_on</a>(p_on), <a class="code" href="classExtMode.html#o3">params_when_off</a>(p_off) { }; -00198 }; -00199 -<a name="l00200"></a><a class="code" href="modules_8cpp.html#a48">00200</a> <span class="keyword">typedef</span> std::vector<ExtMode> <a class="code" href="modules_8cpp.html#a48">ExtModeList</a>; -<a name="l00201"></a><a class="code" href="modules_8cpp.html#a49">00201</a> <span class="keyword">typedef</span> ExtModeList::iterator <a class="code" href="modules_8cpp.html#a49">ExtModeListIter</a>; -00202 -00203 -<a name="l00204"></a><a class="code" href="modules_8cpp.html#a50">00204</a> <a class="code" href="modules_8cpp.html#a48">ExtModeList</a> <a class="code" href="modules_8cpp.html#a50">EMode</a>; +00188 <span class="comment">// class type for holding an extended mode character - internal to core</span> +00189 +<a name="l00190"></a><a class="code" href="classExtMode.html">00190</a> <span class="keyword">class </span><a class="code" href="classExtMode.html">ExtMode</a> : <span class="keyword">public</span> <a class="code" href="classclassbase.html">classbase</a> +00191 { +00192 <span class="keyword">public</span>: +<a name="l00193"></a><a class="code" href="classExtMode.html#o0">00193</a> <span class="keywordtype">char</span> <a class="code" href="classExtMode.html#o0">modechar</a>; +<a name="l00194"></a><a class="code" href="classExtMode.html#o1">00194</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o1">type</a>; +<a name="l00195"></a><a class="code" href="classExtMode.html#o2">00195</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o2">params_when_on</a>; +<a name="l00196"></a><a class="code" href="classExtMode.html#o3">00196</a> <span class="keywordtype">int</span> <a class="code" href="classExtMode.html#o3">params_when_off</a>; +<a name="l00197"></a><a class="code" href="classExtMode.html#o4">00197</a> <span class="keywordtype">bool</span> <a class="code" href="classExtMode.html#o4">needsoper</a>; +<a name="l00198"></a><a class="code" href="classExtMode.html#o5">00198</a> <span class="keywordtype">bool</span> <a class="code" href="channels_8cpp.html#a15">list</a>; +<a name="l00199"></a><a class="code" href="classExtMode.html#a0">00199</a> <a class="code" href="classExtMode.html#a0">ExtMode</a>(<span class="keywordtype">char</span> mc, <span class="keywordtype">int</span> ty, <span class="keywordtype">bool</span> oper, <span class="keywordtype">int</span> p_on, <span class="keywordtype">int</span> p_off) : <a class="code" href="classExtMode.html#o0">modechar</a>(mc), <a class="code" href="classExtMode.html#o1">type</a>(ty), <a class="code" href="classExtMode.html#o4">needsoper</a>(oper), <a class="code" href="classExtMode.html#o2">params_when_on</a>(p_on), <a class="code" href="classExtMode.html#o3">params_when_off</a>(p_off) { }; +00200 }; +00201 +<a name="l00202"></a><a class="code" href="modules_8cpp.html#a49">00202</a> <span class="keyword">typedef</span> std::vector<ExtMode> <a class="code" href="modules_8cpp.html#a49">ExtModeList</a>; +<a name="l00203"></a><a class="code" href="modules_8cpp.html#a50">00203</a> <span class="keyword">typedef</span> ExtModeList::iterator <a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a>; +00204 00205 -00206 <span class="comment">// returns true if an extended mode character is in use</span> -<a name="l00207"></a><a class="code" href="modules_8cpp.html#a51">00207</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a51">ModeDefined</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00208 { -00209 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a50">EMode</a>.size()); -00210 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a49">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a50">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a50">EMode</a>.end(); i++) -00211 { -00212 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) -00213 { -00214 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00215 } -00216 } -00217 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00218 } -00219 -<a name="l00220"></a><a class="code" href="modules_8cpp.html#a52">00220</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a52">ModeIsListMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00221 { -00222 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a50">EMode</a>.size()); -00223 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a49">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a50">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a50">EMode</a>.end(); i++) -00224 { -00225 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->list == <span class="keyword">true</span>)) -00226 { -00227 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00228 } -00229 } -00230 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00231 } -00232 -<a name="l00233"></a><a class="code" href="modules_8cpp.html#a53">00233</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a53">ModeDefinedOper</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00234 { -00235 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a50">EMode</a>.size()); -00236 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a49">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a50">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a50">EMode</a>.end(); i++) -00237 { -00238 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->needsoper == <span class="keyword">true</span>)) -00239 { -00240 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00241 } -00242 } -00243 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00244 } -00245 -00246 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> -<a name="l00247"></a><a class="code" href="modules_8cpp.html#a54">00247</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a54">ModeDefinedOn</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00248 { -00249 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a49">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a50">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a50">EMode</a>.end(); i++) -00250 { -00251 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) -00252 { -00253 <span class="keywordflow">return</span> i->params_when_on; -00254 } -00255 } -00256 <span class="keywordflow">return</span> 0; -00257 } -00258 -00259 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> -<a name="l00260"></a><a class="code" href="modules_8cpp.html#a55">00260</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a55">ModeDefinedOff</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) -00261 { -00262 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a49">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a50">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a50">EMode</a>.end(); i++) -00263 { -00264 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) -00265 { -00266 <span class="keywordflow">return</span> i->params_when_off; -00267 } -00268 } -00269 <span class="keywordflow">return</span> 0; -00270 } -00271 -00272 <span class="comment">// returns true if an extended mode character is in use</span> -<a name="l00273"></a><a class="code" href="modules_8cpp.html#a56">00273</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a56">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) -00274 { -00275 <span class="keywordflow">if</span> (<a class="code" href="modules_8cpp.html#a51">ModeDefined</a>(modechar,type)) { -00276 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00277 } -00278 <a class="code" href="modules_8cpp.html#a50">EMode</a>.push_back(<a class="code" href="classExtMode.html">ExtMode</a>(modechar,type,requires_oper,params_on,params_off)); -00279 <span class="keywordflow">return</span> <span class="keyword">true</span>; -00280 } -00281 -00282 <span class="comment">// turns a mode into a listmode</span> -<a name="l00283"></a><a class="code" href="modules_8cpp.html#a57">00283</a> <span class="keywordtype">void</span> <a class="code" href="modules_8cpp.html#a57">ModeMakeList</a>(<span class="keywordtype">char</span> modechar) -00284 { -00285 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a49">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a50">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a50">EMode</a>.end(); i++) -00286 { -00287 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == <a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>)) -00288 { -00289 i->list = <span class="keyword">true</span>; -00290 <span class="keywordflow">return</span>; -00291 } -00292 } -00293 <span class="keywordflow">return</span>; -00294 } -00295 -00296 <span class="comment">// version is a simple class for holding a modules version number</span> +<a name="l00206"></a><a class="code" href="modules_8cpp.html#a51">00206</a> <a class="code" href="modules_8cpp.html#a49">ExtModeList</a> <a class="code" href="modules_8cpp.html#a51">EMode</a>; +00207 +00208 <span class="comment">// returns true if an extended mode character is in use</span> +<a name="l00209"></a><a class="code" href="modules_8cpp.html#a52">00209</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a52">ModeDefined</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) +00210 { +00211 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); +00212 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00213 { +00214 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) +00215 { +00216 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00217 } +00218 } +00219 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00220 } +00221 +<a name="l00222"></a><a class="code" href="modules_8cpp.html#a53">00222</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a53">ModeIsListMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) +00223 { +00224 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); +00225 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00226 { +00227 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->list == <span class="keyword">true</span>)) +00228 { +00229 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00230 } +00231 } +00232 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00233 } +00234 +<a name="l00235"></a><a class="code" href="modules_8cpp.html#a54">00235</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a54">ModeDefinedOper</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) +00236 { +00237 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"Size of extmodes vector is %d"</span>,<a class="code" href="modules_8cpp.html#a51">EMode</a>.size()); +00238 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00239 { +00240 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type) && (i->needsoper == <span class="keyword">true</span>)) +00241 { +00242 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00243 } +00244 } +00245 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00246 } +00247 +00248 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> +<a name="l00249"></a><a class="code" href="modules_8cpp.html#a55">00249</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a55">ModeDefinedOn</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) +00250 { +00251 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00252 { +00253 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) +00254 { +00255 <span class="keywordflow">return</span> i->params_when_on; +00256 } +00257 } +00258 <span class="keywordflow">return</span> 0; +00259 } +00260 +00261 <span class="comment">// returns number of parameters for a custom mode when it is switched on</span> +<a name="l00262"></a><a class="code" href="modules_8cpp.html#a56">00262</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a56">ModeDefinedOff</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type) +00263 { +00264 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00265 { +00266 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == type)) +00267 { +00268 <span class="keywordflow">return</span> i->params_when_off; +00269 } +00270 } +00271 <span class="keywordflow">return</span> 0; +00272 } +00273 +00274 <span class="comment">// returns true if an extended mode character is in use</span> +<a name="l00275"></a><a class="code" href="modules_8cpp.html#a57">00275</a> <span class="keywordtype">bool</span> <a class="code" href="modules_8cpp.html#a57">DoAddExtendedMode</a>(<span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type, <span class="keywordtype">bool</span> requires_oper, <span class="keywordtype">int</span> params_on, <span class="keywordtype">int</span> params_off) +00276 { +00277 <span class="keywordflow">if</span> (<a class="code" href="modules_8cpp.html#a52">ModeDefined</a>(modechar,type)) { +00278 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00279 } +00280 <a class="code" href="modules_8cpp.html#a51">EMode</a>.push_back(<a class="code" href="classExtMode.html">ExtMode</a>(modechar,type,requires_oper,params_on,params_off)); +00281 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00282 } +00283 +00284 <span class="comment">// turns a mode into a listmode</span> +<a name="l00285"></a><a class="code" href="modules_8cpp.html#a58">00285</a> <span class="keywordtype">void</span> <a class="code" href="modules_8cpp.html#a58">ModeMakeList</a>(<span class="keywordtype">char</span> modechar) +00286 { +00287 <span class="keywordflow">for</span> (<a class="code" href="modules_8cpp.html#a50">ExtModeListIter</a> i = <a class="code" href="modules_8cpp.html#a51">EMode</a>.begin(); i < <a class="code" href="modules_8cpp.html#a51">EMode</a>.end(); i++) +00288 { +00289 <span class="keywordflow">if</span> ((i->modechar == modechar) && (i->type == <a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>)) +00290 { +00291 i->list = <span class="keyword">true</span>; +00292 <span class="keywordflow">return</span>; +00293 } +00294 } +00295 <span class="keywordflow">return</span>; +00296 } 00297 -<a name="l00298"></a><a class="code" href="classVersion.html#a0">00298</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) { }; +00298 <span class="comment">// version is a simple class for holding a modules version number</span> 00299 -00300 <span class="comment">// admin is a simple class for holding a server's administrative info</span> +<a name="l00300"></a><a class="code" href="classVersion.html#a0">00300</a> <a class="code" href="classVersion.html#a0">Version::Version</a>(<span class="keywordtype">int</span> major, <span class="keywordtype">int</span> minor, <span class="keywordtype">int</span> revision, <span class="keywordtype">int</span> build, <span class="keywordtype">int</span> flags) : Major(major), Minor(minor), Revision(revision), Build(build), Flags(flags) { }; 00301 -<a name="l00302"></a><a class="code" href="classAdmin.html#a0">00302</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) { }; +00302 <span class="comment">// admin is a simple class for holding a server's administrative info</span> 00303 -<a name="l00304"></a><a class="code" href="classModule.html#a0">00304</a> <a class="code" href="classModule.html#a0">Module::Module</a>() { } -<a name="l00305"></a><a class="code" href="classModule.html#a1">00305</a> <a class="code" href="classModule.html#a1">Module::~Module</a>() { } -<a name="l00306"></a><a class="code" href="classModule.html#a3">00306</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="l00307"></a><a class="code" href="classModule.html#a4">00307</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="l00308"></a><a class="code" href="classModule.html#a5">00308</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="l00309"></a><a class="code" href="classModule.html#a6">00309</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="l00310"></a><a class="code" href="classModule.html#a7">00310</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a7">Module::OnPacketTransmit</a>(<span class="keywordtype">char</span> *p) { } -<a name="l00311"></a><a class="code" href="classModule.html#a8">00311</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a8">Module::OnPacketReceive</a>(<span class="keywordtype">char</span> *p) { } -<a name="l00312"></a><a class="code" href="classModule.html#a9">00312</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a9">Module::OnRehash</a>() { } -<a name="l00313"></a><a class="code" href="classModule.html#a10">00313</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="l00314"></a><a class="code" href="classModule.html#a12">00314</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="l00315"></a><a class="code" href="classModule.html#a11">00315</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="l00316"></a><a class="code" href="classModule.html#a2">00316</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="l00317"></a><a class="code" href="classModule.html#a13">00317</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="l00318"></a><a class="code" href="classModule.html#a14">00318</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="l00319"></a><a class="code" href="classModule.html#a15">00319</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="l00320"></a><a class="code" href="classModule.html#a16">00320</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a16">Module::OnUserPreInvite</a>(<a class="code" href="classuserrec.html">userrec</a>* source,<a class="code" href="classuserrec.html">userrec</a>* dest,<a class="code" href="classchanrec.html">chanrec</a>* channel) { <span class="keywordflow">return</span> 0; }; -<a name="l00321"></a><a class="code" href="classModule.html#a17">00321</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a17">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="l00322"></a><a class="code" href="classModule.html#a18">00322</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a18">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="l00323"></a><a class="code" href="classModule.html#a19">00323</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a19">Module::OnUserPreNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newnick) { <span class="keywordflow">return</span> 0; }; -<a name="l00324"></a><a class="code" href="classModule.html#a20">00324</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a20">Module::OnUserPostNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string oldnick) { }; -<a name="l00325"></a><a class="code" href="classModule.html#a21">00325</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a21">Module::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="l00326"></a><a class="code" href="classModule.html#a22">00326</a> <a class="code" href="modules_8h.html#a27">string_list</a> <a class="code" href="classModule.html#a22">Module::OnUserSync</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { <a class="code" href="modules_8h.html#a27">string_list</a> empty; <span class="keywordflow">return</span> empty; } -<a name="l00327"></a><a class="code" href="classModule.html#a23">00327</a> <a class="code" href="modules_8h.html#a27">string_list</a> <a class="code" href="classModule.html#a23">Module::OnChannelSync</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) { <a class="code" href="modules_8h.html#a27">string_list</a> empty; <span class="keywordflow">return</span> empty; } -<a name="l00328"></a><a class="code" href="classModule.html#a24">00328</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a24">Module::On005Numeric</a>(std::string &output) { }; -<a name="l00329"></a><a class="code" href="classModule.html#a25">00329</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a25">Module::OnKill</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* dest, std::string reason) { <span class="keywordflow">return</span> 0; }; -<a name="l00330"></a><a class="code" href="classModule.html#a26">00330</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a26">Module::OnLoadModule</a>(<a class="code" href="classModule.html">Module</a>* mod,std::string name) { }; -00331 -00332 -00333 <span class="comment">// server is a wrapper class that provides methods to all of the C-style</span> -00334 <span class="comment">// exports in the core</span> -00335 <span class="comment">//</span> -00336 -<a name="l00337"></a><a class="code" href="classServer.html#a0">00337</a> <a class="code" href="classServer.html#a0">Server::Server</a>() -00338 { -00339 } -00340 -<a name="l00341"></a><a class="code" href="classServer.html#a1">00341</a> <a class="code" href="classServer.html#a1">Server::~Server</a>() -00342 { -00343 } -00344 -<a name="l00345"></a><a class="code" href="classServer.html#a2">00345</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a2">Server::SendOpers</a>(std::string s) -00346 { -00347 WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str()); -00348 } -00349 -<a name="l00350"></a><a class="code" href="classServer.html#a30">00350</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a30">Server::MatchText</a>(std::string sliteral, std::string spattern) -00351 { -00352 <span class="keywordtype">char</span> literal[MAXBUF],pattern[MAXBUF]; -00353 strlcpy(literal,sliteral.c_str(),MAXBUF); -00354 strlcpy(pattern,spattern.c_str(),MAXBUF); -00355 <span class="keywordflow">return</span> match(literal,pattern); -00356 } -00357 -<a name="l00358"></a><a class="code" href="classServer.html#a25">00358</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) -00359 { -00360 WriteMode(modes.c_str(),flags,<span class="stringliteral">"%s"</span>,text.c_str()); -00361 } -00362 -<a name="l00363"></a><a class="code" href="classServer.html#a26">00363</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) -00364 { -00365 <span class="keywordflow">return</span> add_channel(user,cname.c_str(),key.c_str(),<span class="keyword">true</span>); -00366 } -00367 -<a name="l00368"></a><a class="code" href="classServer.html#a27">00368</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) -00369 { -00370 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>); -00371 } -00372 -<a name="l00373"></a><a class="code" href="classServer.html#a35">00373</a> <a class="code" href="modules_8h.html#a28">chanuserlist</a> <a class="code" href="classServer.html#a35">Server::GetUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) -00374 { -00375 <a class="code" href="modules_8h.html#a28">chanuserlist</a> userl; -00376 userl.clear(); -00377 <span class="keywordflow">for</span> (user_hash::const_iterator i = <a class="code" href="modules_8cpp.html#a41">clientlist</a>.begin(); i != <a class="code" href="modules_8cpp.html#a41">clientlist</a>.end(); i++) -00378 { -00379 <span class="keywordflow">if</span> (i->second) -00380 { -00381 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a16">has_channel</a>(i->second,chan)) -00382 { -00383 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a13">isnick</a>(i->second->nick)) -00384 { -00385 userl.push_back(i->second); -00386 } -00387 } -00388 } -00389 } -00390 <span class="keywordflow">return</span> userl; -00391 } -<a name="l00392"></a><a class="code" href="classServer.html#a28">00392</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) -00393 { -00394 force_nickchange(user,nickname.c_str()); -00395 } -00396 -<a name="l00397"></a><a class="code" href="classServer.html#a29">00397</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) -00398 { -00399 <a class="code" href="message_8h.html#a19">send_network_quit</a>(user-><a class="code" href="classuserrec.html#o0">nick</a>,reason.c_str()); -00400 kill_link(user,reason.c_str()); -00401 } -00402 -<a name="l00403"></a><a class="code" href="classServer.html#a34">00403</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a34">Server::IsUlined</a>(std::string server) -00404 { -00405 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a72">is_uline</a>(server.c_str()); -00406 } -00407 -<a name="l00408"></a><a class="code" href="classServer.html#a31">00408</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) -00409 { -00410 call_handler(commandname.c_str(),parameters,pcnt,user); -00411 } -00412 -<a name="l00413"></a><a class="code" href="classServer.html#a3">00413</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) -00414 { -00415 log(level,<span class="stringliteral">"%s"</span>,s.c_str()); -00416 } -00417 -<a name="l00418"></a><a class="code" href="classServer.html#a23">00418</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) -00419 { -00420 <a class="code" href="modules_8h.html#a30">createcommand</a>(cmd,f,flags,minparams); -00421 } -00422 -<a name="l00423"></a><a class="code" href="classServer.html#a24">00423</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) -00424 { -00425 <a class="code" href="modules_8h.html#a31">server_mode</a>(parameters,pcnt,user); -00426 } -00427 -<a name="l00428"></a><a class="code" href="classServer.html#a4">00428</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) -00429 { -00430 Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); -00431 } -00432 -<a name="l00433"></a><a class="code" href="classServer.html#a5">00433</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) -00434 { -00435 WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); -00436 } -00437 -<a name="l00438"></a><a class="code" href="classServer.html#a6">00438</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) -00439 { -00440 WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00441 } -00442 -<a name="l00443"></a><a class="code" href="classServer.html#a7">00443</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) -00444 { -00445 <span class="keywordflow">if</span> (!Source) -00446 { -00447 <span class="comment">// if source is NULL, then the message originates from the local server</span> -00448 Write(Dest-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">":%s %s"</span>,this->GetServerName().c_str(),s.c_str()); -00449 } -00450 <span class="keywordflow">else</span> -00451 { -00452 <span class="comment">// otherwise it comes from the user specified</span> -00453 WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str()); -00454 } -00455 } -00456 -<a name="l00457"></a><a class="code" href="classServer.html#a8">00457</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) -00458 { -00459 <span class="keywordflow">if</span> (IncludeSender) -00460 { -00461 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00462 } -00463 <span class="keywordflow">else</span> -00464 { -00465 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); -00466 } -00467 } -00468 -<a name="l00469"></a><a class="code" href="classServer.html#a9">00469</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) -00470 { -00471 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a0">common_channels</a>(u1,u2) != 0); -00472 } -00473 -<a name="l00474"></a><a class="code" href="classServer.html#a10">00474</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) -00475 { -00476 <span class="keywordflow">if</span> (IncludeSender) -00477 { -00478 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str()); -00479 } -00480 <span class="keywordflow">else</span> -00481 { -00482 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str()); -00483 } -00484 } -00485 -<a name="l00486"></a><a class="code" href="classServer.html#a11">00486</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) -00487 { -00488 WriteWallOps(User,<span class="keyword">false</span>,<span class="stringliteral">"%s"</span>,text.c_str()); -00489 } -00490 -<a name="l00491"></a><a class="code" href="classServer.html#a32">00491</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) -00492 { -00493 <a class="code" href="message_8h.html#a11">ChangeDisplayedHost</a>(user,host.c_str()); -00494 } -00495 -<a name="l00496"></a><a class="code" href="classServer.html#a33">00496</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) -00497 { -00498 <a class="code" href="message_8h.html#a10">ChangeName</a>(user,gecos.c_str()); -00499 } -00500 -<a name="l00501"></a><a class="code" href="classServer.html#a12">00501</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a12">Server::IsNick</a>(std::string nick) -00502 { -00503 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a13">isnick</a>(nick.c_str()) != 0); -00504 } -00505 -<a name="l00506"></a><a class="code" href="classServer.html#a14">00506</a> <a class="code" href="classuserrec.html">userrec</a>* <a class="code" href="classServer.html#a14">Server::FindNick</a>(std::string nick) -00507 { -00508 <span class="keywordflow">return</span> Find(nick); -00509 } -00510 -<a name="l00511"></a><a class="code" href="classServer.html#a15">00511</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a15">Server::FindChannel</a>(std::string channel) -00512 { -00513 <span class="keywordflow">return</span> FindChan(channel.c_str()); -00514 } -00515 -<a name="l00516"></a><a class="code" href="classServer.html#a16">00516</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) -00517 { -00518 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a14">cmode</a>(User,Chan); -00519 } -00520 -<a name="l00521"></a><a class="code" href="classServer.html#a17">00521</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) -00522 { -00523 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a16">has_channel</a>(User,Chan); -00524 } -00525 -<a name="l00526"></a><a class="code" href="classServer.html#a18">00526</a> std::string <a class="code" href="classServer.html#a18">Server::GetServerName</a>() -00527 { -00528 <span class="keywordflow">return</span> getservername(); -00529 } -00530 -<a name="l00531"></a><a class="code" href="classServer.html#a19">00531</a> std::string <a class="code" href="classServer.html#a19">Server::GetNetworkName</a>() -00532 { -00533 <span class="keywordflow">return</span> getnetworkname(); -00534 } -00535 -<a name="l00536"></a><a class="code" href="classServer.html#a20">00536</a> <a class="code" href="classAdmin.html">Admin</a> <a class="code" href="classServer.html#a20">Server::GetAdmin</a>() -00537 { -00538 <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick()); -00539 } -00540 -00541 +<a name="l00304"></a><a class="code" href="classAdmin.html#a0">00304</a> <a class="code" href="classAdmin.html#a0">Admin::Admin</a>(std::string name, std::string email, std::string nick) : Name(name), Email(email), Nick(nick) { }; +00305 +<a name="l00306"></a><a class="code" href="classModule.html#a0">00306</a> <a class="code" href="classModule.html#a0">Module::Module</a>() { } +<a name="l00307"></a><a class="code" href="classModule.html#a1">00307</a> <a class="code" href="classModule.html#a1">Module::~Module</a>() { } +<a name="l00308"></a><a class="code" href="classModule.html#a3">00308</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a3">Module::OnUserConnect</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { } +<a name="l00309"></a><a class="code" href="classModule.html#a4">00309</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a4">Module::OnUserQuit</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { } +<a name="l00310"></a><a class="code" href="classModule.html#a5">00310</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a5">Module::OnUserJoin</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* channel) { } +<a name="l00311"></a><a class="code" href="classModule.html#a6">00311</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a6">Module::OnUserPart</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* channel) { } +<a name="l00312"></a><a class="code" href="classModule.html#a7">00312</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a7">Module::OnPacketTransmit</a>(<span class="keywordtype">char</span> *p) { } +<a name="l00313"></a><a class="code" href="classModule.html#a8">00313</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a8">Module::OnPacketReceive</a>(<span class="keywordtype">char</span> *p) { } +<a name="l00314"></a><a class="code" href="classModule.html#a9">00314</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a9">Module::OnRehash</a>() { } +<a name="l00315"></a><a class="code" href="classModule.html#a10">00315</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a10">Module::OnServerRaw</a>(std::string &raw, <span class="keywordtype">bool</span> inbound, <a class="code" href="classuserrec.html">userrec</a>* user) { } +<a name="l00316"></a><a class="code" href="classModule.html#a12">00316</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a12">Module::OnUserPreJoin</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* chan, <span class="keyword">const</span> <span class="keywordtype">char</span>* cname) { <span class="keywordflow">return</span> 0; } +<a name="l00317"></a><a class="code" href="classModule.html#a11">00317</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a11">Module::OnExtendedMode</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <span class="keywordtype">void</span>* target, <span class="keywordtype">char</span> modechar, <span class="keywordtype">int</span> type, <span class="keywordtype">bool</span> mode_on, string_list &params) { <span class="keywordflow">return</span> <span class="keyword">false</span>; } +<a name="l00318"></a><a class="code" href="classModule.html#a2">00318</a> <a class="code" href="classVersion.html">Version</a> <a class="code" href="classModule.html#a2">Module::GetVersion</a>() { <span class="keywordflow">return</span> <a class="code" href="classVersion.html">Version</a>(1,0,0,0,<a class="code" href="modules_8h.html#a21">VF_VENDOR</a>); } +<a name="l00319"></a><a class="code" href="classModule.html#a13">00319</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="l00320"></a><a class="code" href="classModule.html#a14">00320</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="l00321"></a><a class="code" href="classModule.html#a15">00321</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="l00322"></a><a class="code" href="classModule.html#a16">00322</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a16">Module::OnUserPreInvite</a>(<a class="code" href="classuserrec.html">userrec</a>* source,<a class="code" href="classuserrec.html">userrec</a>* dest,<a class="code" href="classchanrec.html">chanrec</a>* channel) { <span class="keywordflow">return</span> 0; }; +<a name="l00323"></a><a class="code" href="classModule.html#a17">00323</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a17">Module::OnUserPreMessage</a>(<a class="code" href="classuserrec.html">userrec</a>* user,<span class="keywordtype">void</span>* dest,<span class="keywordtype">int</span> target_type, std::string &text) { <span class="keywordflow">return</span> 0; }; +<a name="l00324"></a><a class="code" href="classModule.html#a18">00324</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a18">Module::OnUserPreNotice</a>(<a class="code" href="classuserrec.html">userrec</a>* user,<span class="keywordtype">void</span>* dest,<span class="keywordtype">int</span> target_type, std::string &text) { <span class="keywordflow">return</span> 0; }; +<a name="l00325"></a><a class="code" href="classModule.html#a19">00325</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a19">Module::OnUserPreNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string newnick) { <span class="keywordflow">return</span> 0; }; +<a name="l00326"></a><a class="code" href="classModule.html#a20">00326</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a20">Module::OnUserPostNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string oldnick) { }; +<a name="l00327"></a><a class="code" href="classModule.html#a21">00327</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a21">Module::OnAccessCheck</a>(<a class="code" href="classuserrec.html">userrec</a>* source,<a class="code" href="classuserrec.html">userrec</a>* dest,<a class="code" href="classchanrec.html">chanrec</a>* channel,<span class="keywordtype">int</span> access_type) { <span class="keywordflow">return</span> <a class="code" href="modules_8h.html#a8">ACR_DEFAULT</a>; }; +<a name="l00328"></a><a class="code" href="classModule.html#a22">00328</a> <a class="code" href="modules_8h.html#a31">string_list</a> <a class="code" href="classModule.html#a22">Module::OnUserSync</a>(<a class="code" href="classuserrec.html">userrec</a>* user) { <a class="code" href="modules_8h.html#a31">string_list</a> empty; <span class="keywordflow">return</span> empty; } +<a name="l00329"></a><a class="code" href="classModule.html#a23">00329</a> <a class="code" href="modules_8h.html#a31">string_list</a> <a class="code" href="classModule.html#a23">Module::OnChannelSync</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) { <a class="code" href="modules_8h.html#a31">string_list</a> empty; <span class="keywordflow">return</span> empty; } +<a name="l00330"></a><a class="code" href="classModule.html#a24">00330</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a24">Module::On005Numeric</a>(std::string &output) { }; +<a name="l00331"></a><a class="code" href="classModule.html#a25">00331</a> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a25">Module::OnKill</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* dest, std::string reason) { <span class="keywordflow">return</span> 0; }; +<a name="l00332"></a><a class="code" href="classModule.html#a26">00332</a> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a26">Module::OnLoadModule</a>(<a class="code" href="classModule.html">Module</a>* mod,std::string name) { }; +00333 +00334 +00335 <span class="comment">// server is a wrapper class that provides methods to all of the C-style</span> +00336 <span class="comment">// exports in the core</span> +00337 <span class="comment">//</span> +00338 +<a name="l00339"></a><a class="code" href="classServer.html#a0">00339</a> <a class="code" href="classServer.html#a0">Server::Server</a>() +00340 { +00341 } +00342 +<a name="l00343"></a><a class="code" href="classServer.html#a1">00343</a> <a class="code" href="classServer.html#a1">Server::~Server</a>() +00344 { +00345 } +00346 +<a name="l00347"></a><a class="code" href="classServer.html#a2">00347</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a2">Server::SendOpers</a>(std::string s) +00348 { +00349 WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str()); +00350 } +00351 +<a name="l00352"></a><a class="code" href="classServer.html#a30">00352</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a30">Server::MatchText</a>(std::string sliteral, std::string spattern) +00353 { +00354 <span class="keywordtype">char</span> literal[MAXBUF],pattern[MAXBUF]; +00355 strlcpy(literal,sliteral.c_str(),MAXBUF); +00356 strlcpy(pattern,spattern.c_str(),MAXBUF); +00357 <span class="keywordflow">return</span> match(literal,pattern); +00358 } +00359 +<a name="l00360"></a><a class="code" href="classServer.html#a25">00360</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) +00361 { +00362 WriteMode(modes.c_str(),flags,<span class="stringliteral">"%s"</span>,text.c_str()); +00363 } +00364 +<a name="l00365"></a><a class="code" href="classServer.html#a26">00365</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) +00366 { +00367 <span class="keywordflow">return</span> add_channel(user,cname.c_str(),key.c_str(),<span class="keyword">true</span>); +00368 } +00369 +<a name="l00370"></a><a class="code" href="classServer.html#a27">00370</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) +00371 { +00372 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>); +00373 } +00374 +<a name="l00375"></a><a class="code" href="classServer.html#a35">00375</a> <a class="code" href="modules_8h.html#a32">chanuserlist</a> <a class="code" href="classServer.html#a35">Server::GetUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* chan) +00376 { +00377 <a class="code" href="modules_8h.html#a32">chanuserlist</a> userl; +00378 userl.clear(); +00379 <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++) +00380 { +00381 <span class="keywordflow">if</span> (i->second) +00382 { +00383 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a16">has_channel</a>(i->second,chan)) +00384 { +00385 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a13">isnick</a>(i->second->nick)) +00386 { +00387 userl.push_back(i->second); +00388 } +00389 } +00390 } +00391 } +00392 <span class="keywordflow">return</span> userl; +00393 } +<a name="l00394"></a><a class="code" href="classServer.html#a28">00394</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) +00395 { +00396 force_nickchange(user,nickname.c_str()); +00397 } +00398 +<a name="l00399"></a><a class="code" href="classServer.html#a29">00399</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) +00400 { +00401 <a class="code" href="message_8h.html#a19">send_network_quit</a>(user-><a class="code" href="classuserrec.html#o0">nick</a>,reason.c_str()); +00402 kill_link(user,reason.c_str()); +00403 } +00404 +<a name="l00405"></a><a class="code" href="classServer.html#a34">00405</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a34">Server::IsUlined</a>(std::string server) +00406 { +00407 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a74">is_uline</a>(server.c_str()); +00408 } +00409 +<a name="l00410"></a><a class="code" href="classServer.html#a31">00410</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) +00411 { +00412 call_handler(commandname.c_str(),parameters,pcnt,user); +00413 } +00414 +<a name="l00415"></a><a class="code" href="classServer.html#a3">00415</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) +00416 { +00417 log(level,<span class="stringliteral">"%s"</span>,s.c_str()); +00418 } +00419 +<a name="l00420"></a><a class="code" href="classServer.html#a23">00420</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a23">Server::AddCommand</a>(<span class="keywordtype">char</span>* cmd, handlerfunc f, <span class="keywordtype">char</span> flags, <span class="keywordtype">int</span> minparams, <span class="keywordtype">char</span>* source) +00421 { +00422 <a class="code" href="modules_8h.html#a34">createcommand</a>(cmd,f,flags,minparams,source); +00423 } +00424 +<a name="l00425"></a><a class="code" href="classServer.html#a24">00425</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) +00426 { +00427 <a class="code" href="modules_8h.html#a35">server_mode</a>(parameters,pcnt,user); +00428 } +00429 +<a name="l00430"></a><a class="code" href="classServer.html#a4">00430</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) +00431 { +00432 Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); +00433 } +00434 +<a name="l00435"></a><a class="code" href="classServer.html#a5">00435</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) +00436 { +00437 WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str()); +00438 } +00439 +<a name="l00440"></a><a class="code" href="classServer.html#a6">00440</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) +00441 { +00442 WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00443 } +00444 +<a name="l00445"></a><a class="code" href="classServer.html#a7">00445</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) +00446 { +00447 <span class="keywordflow">if</span> (!Source) +00448 { +00449 <span class="comment">// if source is NULL, then the message originates from the local server</span> +00450 Write(Dest-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">":%s %s"</span>,this->GetServerName().c_str(),s.c_str()); +00451 } +00452 <span class="keywordflow">else</span> +00453 { +00454 <span class="comment">// otherwise it comes from the user specified</span> +00455 WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str()); +00456 } +00457 } +00458 +<a name="l00459"></a><a class="code" href="classServer.html#a8">00459</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) +00460 { +00461 <span class="keywordflow">if</span> (IncludeSender) +00462 { +00463 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00464 } +00465 <span class="keywordflow">else</span> +00466 { +00467 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str()); +00468 } +00469 } +00470 +<a name="l00471"></a><a class="code" href="classServer.html#a9">00471</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) +00472 { +00473 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a0">common_channels</a>(u1,u2) != 0); +00474 } +00475 +<a name="l00476"></a><a class="code" href="classServer.html#a10">00476</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) +00477 { +00478 <span class="keywordflow">if</span> (IncludeSender) +00479 { +00480 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str()); +00481 } +00482 <span class="keywordflow">else</span> +00483 { +00484 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str()); +00485 } +00486 } +00487 +<a name="l00488"></a><a class="code" href="classServer.html#a11">00488</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) +00489 { +00490 WriteWallOps(User,<span class="keyword">false</span>,<span class="stringliteral">"%s"</span>,text.c_str()); +00491 } +00492 +<a name="l00493"></a><a class="code" href="classServer.html#a32">00493</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) +00494 { +00495 <a class="code" href="message_8h.html#a11">ChangeDisplayedHost</a>(user,host.c_str()); +00496 } +00497 +<a name="l00498"></a><a class="code" href="classServer.html#a33">00498</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) +00499 { +00500 <a class="code" href="message_8h.html#a10">ChangeName</a>(user,gecos.c_str()); +00501 } +00502 +<a name="l00503"></a><a class="code" href="classServer.html#a12">00503</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a12">Server::IsNick</a>(std::string nick) +00504 { +00505 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a13">isnick</a>(nick.c_str()) != 0); +00506 } +00507 +<a name="l00508"></a><a class="code" href="classServer.html#a14">00508</a> <a class="code" href="classuserrec.html">userrec</a>* <a class="code" href="classServer.html#a14">Server::FindNick</a>(std::string nick) +00509 { +00510 <span class="keywordflow">return</span> Find(nick); +00511 } +00512 +<a name="l00513"></a><a class="code" href="classServer.html#a15">00513</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a15">Server::FindChannel</a>(std::string channel) +00514 { +00515 <span class="keywordflow">return</span> FindChan(channel.c_str()); +00516 } +00517 +<a name="l00518"></a><a class="code" href="classServer.html#a16">00518</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) +00519 { +00520 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a14">cmode</a>(User,Chan); +00521 } +00522 +<a name="l00523"></a><a class="code" href="classServer.html#a17">00523</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) +00524 { +00525 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a16">has_channel</a>(User,Chan); +00526 } +00527 +<a name="l00528"></a><a class="code" href="classServer.html#a18">00528</a> std::string <a class="code" href="classServer.html#a18">Server::GetServerName</a>() +00529 { +00530 <span class="keywordflow">return</span> getservername(); +00531 } +00532 +<a name="l00533"></a><a class="code" href="classServer.html#a19">00533</a> std::string <a class="code" href="classServer.html#a19">Server::GetNetworkName</a>() +00534 { +00535 <span class="keywordflow">return</span> getnetworkname(); +00536 } +00537 +<a name="l00538"></a><a class="code" href="classServer.html#a20">00538</a> <a class="code" href="classAdmin.html">Admin</a> <a class="code" href="classServer.html#a20">Server::GetAdmin</a>() +00539 { +00540 <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick()); +00541 } 00542 -<a name="l00543"></a><a class="code" href="classServer.html#a21">00543</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) -00544 { -00545 <span class="keywordflow">if</span> (type == <a class="code" href="modules_8h.html#a7">MT_SERVER</a>) -00546 { -00547 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"</span>); -00548 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00549 } -00550 <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>)) -00551 { -00552 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"</span>); -00553 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00554 } -00555 <span class="keywordflow">if</span> ((params_when_on>1) || (params_when_off>1)) -00556 { -00557 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"</span>); -00558 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00559 } -00560 <span class="keywordflow">return</span> <a class="code" href="modules_8cpp.html#a56">DoAddExtendedMode</a>(modechar,type,requires_oper,params_when_on,params_when_off); -00561 } -00562 -<a name="l00563"></a><a class="code" href="classServer.html#a22">00563</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a22">Server::AddExtendedListMode</a>(<span class="keywordtype">char</span> modechar) -00564 { -00565 <span class="keywordtype">bool</span> res = <a class="code" href="modules_8cpp.html#a56">DoAddExtendedMode</a>(modechar,<a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>,<span class="keyword">false</span>,1,1); -00566 <span class="keywordflow">if</span> (res) -00567 <a class="code" href="modules_8cpp.html#a57">ModeMakeList</a>(modechar); -00568 <span class="keywordflow">return</span> res; -00569 } -00570 -<a name="l00571"></a><a class="code" href="classServer.html#a13">00571</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) -00572 { -00573 <span class="keywordflow">return</span> usercount(c); -00574 } -00575 -00576 -<a name="l00577"></a><a class="code" href="classConfigReader.html#a0">00577</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>() -00578 { -00579 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00580 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00581 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(CONFIG_FILE,this->cache,this->errorlog); -00582 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) -00583 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a25">CONF_FILE_NOT_FOUND</a>; -00584 } -00585 -00586 -<a name="l00587"></a><a class="code" href="classConfigReader.html#a2">00587</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>() -00588 { -00589 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p0">cache</a>) -00590 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p0">cache</a>; -00591 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p1">errorlog</a>) -00592 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p1">errorlog</a>; -00593 } -00594 -00595 -<a name="l00596"></a><a class="code" href="classConfigReader.html#a1">00596</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(std::string filename) -00597 { -00598 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00599 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); -00600 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(filename.c_str(),this-><a class="code" href="classConfigReader.html#p0">cache</a>,this-><a class="code" href="classConfigReader.html#p1">errorlog</a>); -00601 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) -00602 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a25">CONF_FILE_NOT_FOUND</a>; -00603 }; -00604 -<a name="l00605"></a><a class="code" href="classConfigReader.html#a3">00605</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) -00606 { -00607 <span class="keywordtype">char</span> val[MAXBUF]; -00608 <span class="keywordtype">char</span> t[MAXBUF]; -00609 <span class="keywordtype">char</span> n[MAXBUF]; -00610 strlcpy(t,tag.c_str(),MAXBUF); -00611 strlcpy(n,name.c_str(),MAXBUF); -00612 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00613 <span class="keywordflow">if</span> (!res) -00614 { -00615 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>; -00616 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; -00617 } -00618 <span class="keywordflow">return</span> std::string(val); -00619 } -00620 -<a name="l00621"></a><a class="code" href="classConfigReader.html#a4">00621</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a4">ConfigReader::ReadFlag</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index) -00622 { -00623 <span class="keywordtype">char</span> val[MAXBUF]; -00624 <span class="keywordtype">char</span> t[MAXBUF]; -00625 <span class="keywordtype">char</span> n[MAXBUF]; -00626 strlcpy(t,tag.c_str(),MAXBUF); -00627 strlcpy(n,name.c_str(),MAXBUF); -00628 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00629 <span class="keywordflow">if</span> (!res) -00630 { -00631 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>; -00632 <span class="keywordflow">return</span> <span class="keyword">false</span>; -00633 } -00634 std::string s = val; -00635 <span class="keywordflow">return</span> ((s == <span class="stringliteral">"yes"</span>) || (s == <span class="stringliteral">"YES"</span>) || (s == <span class="stringliteral">"true"</span>) || (s == <span class="stringliteral">"TRUE"</span>) || (s == <span class="stringliteral">"1"</span>)); -00636 } -00637 -<a name="l00638"></a><a class="code" href="classConfigReader.html#a5">00638</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a5">ConfigReader::ReadInteger</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index, <span class="keywordtype">bool</span> needs_unsigned) -00639 { -00640 <span class="keywordtype">char</span> val[MAXBUF]; -00641 <span class="keywordtype">char</span> t[MAXBUF]; -00642 <span class="keywordtype">char</span> n[MAXBUF]; -00643 strlcpy(t,tag.c_str(),MAXBUF); -00644 strlcpy(n,name.c_str(),MAXBUF); -00645 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); -00646 <span class="keywordflow">if</span> (!res) -00647 { -00648 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a24">CONF_VALUE_NOT_FOUND</a>; -00649 <span class="keywordflow">return</span> 0; -00650 } -00651 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(val); i++) -00652 { -00653 <span class="keywordflow">if</span> (!isdigit(val[i])) -00654 { -00655 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a22">CONF_NOT_A_NUMBER</a>; -00656 <span class="keywordflow">return</span> 0; -00657 } -00658 } -00659 <span class="keywordflow">if</span> ((needs_unsigned) && (atoi(val)<0)) -00660 { -00661 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a23">CONF_NOT_UNSIGNED</a>; -00662 <span class="keywordflow">return</span> 0; -00663 } -00664 <span class="keywordflow">return</span> atoi(val); -00665 } -00666 -<a name="l00667"></a><a class="code" href="classConfigReader.html#a6">00667</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a6">ConfigReader::GetError</a>() -00668 { -00669 <span class="keywordtype">long</span> olderr = this-><a class="code" href="classConfigReader.html#p3">error</a>; -00670 this->error = 0; -00671 <span class="keywordflow">return</span> olderr; -00672 } -00673 -<a name="l00674"></a><a class="code" href="classConfigReader.html#a9">00674</a> <span class="keywordtype">void</span> <a class="code" href="classConfigReader.html#a9">ConfigReader::DumpErrors</a>(<span class="keywordtype">bool</span> bail, <a class="code" href="classuserrec.html">userrec</a>* user) -00675 { -00676 <span class="keywordflow">if</span> (bail) -00677 { -00678 printf(<span class="stringliteral">"There were errors in your configuration:\n%s"</span>,<a class="code" href="classConfigReader.html#p1">errorlog</a>->str().c_str()); -00679 exit(0); -00680 } -00681 <span class="keywordflow">else</span> -00682 { -00683 <span class="keywordtype">char</span> dataline[1024]; -00684 <span class="keywordflow">if</span> (user) -00685 { -00686 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); -00687 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) -00688 { -00689 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); -00690 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :%s"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>,dataline); -00691 } -00692 } -00693 <span class="keywordflow">else</span> -00694 { -00695 WriteOpers(<span class="stringliteral">"There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); -00696 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) -00697 { -00698 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); -00699 WriteOpers(dataline); -00700 } -00701 } -00702 <span class="keywordflow">return</span>; -00703 } -00704 } -00705 -00706 -<a name="l00707"></a><a class="code" href="classConfigReader.html#a7">00707</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a7">ConfigReader::Enumerate</a>(std::string tag) -00708 { -00709 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#p0">cache</a>,tag.c_str()); -00710 } -00711 -<a name="l00712"></a><a class="code" href="classConfigReader.html#a10">00712</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a10">ConfigReader::EnumerateValues</a>(std::string tag, <span class="keywordtype">int</span> index) -00713 { -00714 <span class="keywordflow">return</span> EnumValues(<a class="code" href="classConfigReader.html#p0">cache</a>, tag.c_str(), index); -00715 } -00716 -<a name="l00717"></a><a class="code" href="classConfigReader.html#a8">00717</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a8">ConfigReader::Verify</a>() -00718 { -00719 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#p2">readerror</a>; -00720 } -00721 -00722 -<a name="l00723"></a><a class="code" href="classFileReader.html#a1">00723</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(std::string filename) -00724 { -00725 <a class="code" href="modules_8h.html#a26">file_cache</a> c; -00726 readfile(c,filename.c_str()); -00727 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; -00728 } -00729 -<a name="l00730"></a><a class="code" href="classFileReader.html#a0">00730</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>() -00731 { -00732 } -00733 -<a name="l00734"></a><a class="code" href="classFileReader.html#a3">00734</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(std::string filename) -00735 { -00736 <a class="code" href="modules_8h.html#a26">file_cache</a> c; -00737 readfile(c,filename.c_str()); -00738 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; -00739 } -00740 -00741 -<a name="l00742"></a><a class="code" href="classFileReader.html#a2">00742</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>() -00743 { -00744 } -00745 -<a name="l00746"></a><a class="code" href="classFileReader.html#a4">00746</a> <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">FileReader::Exists</a>() -00747 { -00748 <span class="keywordflow">if</span> (<a class="code" href="classFileReader.html#r0">fc</a>.size() == 0) -00749 { -00750 <span class="keywordflow">return</span>(<span class="keyword">false</span>); -00751 } -00752 <span class="keywordflow">else</span> -00753 { -00754 <span class="keywordflow">return</span>(<span class="keyword">true</span>); -00755 } -00756 } -00757 -<a name="l00758"></a><a class="code" href="classFileReader.html#a5">00758</a> std::string <a class="code" href="classFileReader.html#a5">FileReader::GetLine</a>(<span class="keywordtype">int</span> x) -00759 { -00760 <span class="keywordflow">if</span> ((x<0) || (x><a class="code" href="classFileReader.html#r0">fc</a>.size())) -00761 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; -00762 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>[x]; -00763 } -00764 -<a name="l00765"></a><a class="code" href="classFileReader.html#a6">00765</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileReader::FileSize</a>() -00766 { -00767 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>.size(); -00768 } -00769 -00770 -00771 std::vector<Module*> <a class="code" href="modules_8cpp.html#a58">modules</a>(255); -00772 std::vector<ircd_module*> <a class="code" href="modules_8cpp.html#a59">factory</a>(255); -00773 -<a name="l00774"></a><a class="code" href="modules_8cpp.html#a1">00774</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a> = -1; +00543 +00544 +<a name="l00545"></a><a class="code" href="classServer.html#a21">00545</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) +00546 { +00547 <span class="keywordflow">if</span> (type == <a class="code" href="modules_8h.html#a7">MT_SERVER</a>) +00548 { +00549 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"</span>); +00550 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00551 } +00552 <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>)) +00553 { +00554 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"</span>); +00555 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00556 } +00557 <span class="keywordflow">if</span> ((params_when_on>1) || (params_when_off>1)) +00558 { +00559 log(<a class="code" href="modules_8h.html#a0">DEBUG</a>,<span class="stringliteral">"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"</span>); +00560 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00561 } +00562 <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); +00563 } +00564 +<a name="l00565"></a><a class="code" href="classServer.html#a22">00565</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a22">Server::AddExtendedListMode</a>(<span class="keywordtype">char</span> modechar) +00566 { +00567 <span class="keywordtype">bool</span> res = <a class="code" href="modules_8cpp.html#a57">DoAddExtendedMode</a>(modechar,<a class="code" href="modules_8h.html#a5">MT_CHANNEL</a>,<span class="keyword">false</span>,1,1); +00568 <span class="keywordflow">if</span> (res) +00569 <a class="code" href="modules_8cpp.html#a58">ModeMakeList</a>(modechar); +00570 <span class="keywordflow">return</span> res; +00571 } +00572 +<a name="l00573"></a><a class="code" href="classServer.html#a13">00573</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) +00574 { +00575 <span class="keywordflow">return</span> usercount(c); +00576 } +00577 +00578 +<a name="l00579"></a><a class="code" href="classConfigReader.html#a0">00579</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>() +00580 { +00581 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00582 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00583 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(CONFIG_FILE,this->cache,this->errorlog); +00584 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) +00585 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_FILE_NOT_FOUND</a>; +00586 } +00587 +00588 +<a name="l00589"></a><a class="code" href="classConfigReader.html#a2">00589</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>() +00590 { +00591 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p0">cache</a>) +00592 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p0">cache</a>; +00593 <span class="keywordflow">if</span> (this-><a class="code" href="classConfigReader.html#p1">errorlog</a>) +00594 <span class="keyword">delete</span> this-><a class="code" href="classConfigReader.html#p1">errorlog</a>; +00595 } +00596 +00597 +<a name="l00598"></a><a class="code" href="classConfigReader.html#a1">00598</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(std::string filename) +00599 { +00600 this-><a class="code" href="classConfigReader.html#p0">cache</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00601 this-><a class="code" href="classConfigReader.html#p1">errorlog</a> = <span class="keyword">new</span> std::stringstream(std::stringstream::in | std::stringstream::out); +00602 this-><a class="code" href="classConfigReader.html#p2">readerror</a> = LoadConf(filename.c_str(),this-><a class="code" href="classConfigReader.html#p0">cache</a>,this-><a class="code" href="classConfigReader.html#p1">errorlog</a>); +00603 <span class="keywordflow">if</span> (!this-><a class="code" href="classConfigReader.html#p2">readerror</a>) +00604 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a29">CONF_FILE_NOT_FOUND</a>; +00605 }; +00606 +<a name="l00607"></a><a class="code" href="classConfigReader.html#a3">00607</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) +00608 { +00609 <span class="keywordtype">char</span> val[MAXBUF]; +00610 <span class="keywordtype">char</span> t[MAXBUF]; +00611 <span class="keywordtype">char</span> n[MAXBUF]; +00612 strlcpy(t,tag.c_str(),MAXBUF); +00613 strlcpy(n,name.c_str(),MAXBUF); +00614 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00615 <span class="keywordflow">if</span> (!res) +00616 { +00617 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a28">CONF_VALUE_NOT_FOUND</a>; +00618 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; +00619 } +00620 <span class="keywordflow">return</span> std::string(val); +00621 } +00622 +<a name="l00623"></a><a class="code" href="classConfigReader.html#a4">00623</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a4">ConfigReader::ReadFlag</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index) +00624 { +00625 <span class="keywordtype">char</span> val[MAXBUF]; +00626 <span class="keywordtype">char</span> t[MAXBUF]; +00627 <span class="keywordtype">char</span> n[MAXBUF]; +00628 strlcpy(t,tag.c_str(),MAXBUF); +00629 strlcpy(n,name.c_str(),MAXBUF); +00630 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00631 <span class="keywordflow">if</span> (!res) +00632 { +00633 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a28">CONF_VALUE_NOT_FOUND</a>; +00634 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00635 } +00636 std::string s = val; +00637 <span class="keywordflow">return</span> ((s == <span class="stringliteral">"yes"</span>) || (s == <span class="stringliteral">"YES"</span>) || (s == <span class="stringliteral">"true"</span>) || (s == <span class="stringliteral">"TRUE"</span>) || (s == <span class="stringliteral">"1"</span>)); +00638 } +00639 +<a name="l00640"></a><a class="code" href="classConfigReader.html#a5">00640</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a5">ConfigReader::ReadInteger</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index, <span class="keywordtype">bool</span> needs_unsigned) +00641 { +00642 <span class="keywordtype">char</span> val[MAXBUF]; +00643 <span class="keywordtype">char</span> t[MAXBUF]; +00644 <span class="keywordtype">char</span> n[MAXBUF]; +00645 strlcpy(t,tag.c_str(),MAXBUF); +00646 strlcpy(n,name.c_str(),MAXBUF); +00647 <span class="keywordtype">int</span> res = ReadConf(<a class="code" href="classConfigReader.html#p0">cache</a>,t,n,index,val); +00648 <span class="keywordflow">if</span> (!res) +00649 { +00650 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a28">CONF_VALUE_NOT_FOUND</a>; +00651 <span class="keywordflow">return</span> 0; +00652 } +00653 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < strlen(val); i++) +00654 { +00655 <span class="keywordflow">if</span> (!isdigit(val[i])) +00656 { +00657 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a26">CONF_NOT_A_NUMBER</a>; +00658 <span class="keywordflow">return</span> 0; +00659 } +00660 } +00661 <span class="keywordflow">if</span> ((needs_unsigned) && (atoi(val)<0)) +00662 { +00663 this-><a class="code" href="classConfigReader.html#p3">error</a> = <a class="code" href="modules_8h.html#a27">CONF_NOT_UNSIGNED</a>; +00664 <span class="keywordflow">return</span> 0; +00665 } +00666 <span class="keywordflow">return</span> atoi(val); +00667 } +00668 +<a name="l00669"></a><a class="code" href="classConfigReader.html#a6">00669</a> <span class="keywordtype">long</span> <a class="code" href="classConfigReader.html#a6">ConfigReader::GetError</a>() +00670 { +00671 <span class="keywordtype">long</span> olderr = this-><a class="code" href="classConfigReader.html#p3">error</a>; +00672 this->error = 0; +00673 <span class="keywordflow">return</span> olderr; +00674 } +00675 +<a name="l00676"></a><a class="code" href="classConfigReader.html#a9">00676</a> <span class="keywordtype">void</span> <a class="code" href="classConfigReader.html#a9">ConfigReader::DumpErrors</a>(<span class="keywordtype">bool</span> bail, <a class="code" href="classuserrec.html">userrec</a>* user) +00677 { +00678 <span class="keywordflow">if</span> (bail) +00679 { +00680 printf(<span class="stringliteral">"There were errors in your configuration:\n%s"</span>,<a class="code" href="classConfigReader.html#p1">errorlog</a>->str().c_str()); +00681 exit(0); +00682 } +00683 <span class="keywordflow">else</span> +00684 { +00685 <span class="keywordtype">char</span> dataline[1024]; +00686 <span class="keywordflow">if</span> (user) +00687 { +00688 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); +00689 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) +00690 { +00691 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); +00692 WriteServ(user-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">"NOTICE %s :%s"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>,dataline); +00693 } +00694 } +00695 <span class="keywordflow">else</span> +00696 { +00697 WriteOpers(<span class="stringliteral">"There were errors in the configuration file:"</span>,user-><a class="code" href="classuserrec.html#o0">nick</a>); +00698 <span class="keywordflow">while</span> (!<a class="code" href="classConfigReader.html#p1">errorlog</a>->eof()) +00699 { +00700 <a class="code" href="classConfigReader.html#p1">errorlog</a>->getline(dataline,1024); +00701 WriteOpers(dataline); +00702 } +00703 } +00704 <span class="keywordflow">return</span>; +00705 } +00706 } +00707 +00708 +<a name="l00709"></a><a class="code" href="classConfigReader.html#a7">00709</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a7">ConfigReader::Enumerate</a>(std::string tag) +00710 { +00711 <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#p0">cache</a>,tag.c_str()); +00712 } +00713 +<a name="l00714"></a><a class="code" href="classConfigReader.html#a10">00714</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a10">ConfigReader::EnumerateValues</a>(std::string tag, <span class="keywordtype">int</span> index) +00715 { +00716 <span class="keywordflow">return</span> EnumValues(<a class="code" href="classConfigReader.html#p0">cache</a>, tag.c_str(), index); +00717 } +00718 +<a name="l00719"></a><a class="code" href="classConfigReader.html#a8">00719</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a8">ConfigReader::Verify</a>() +00720 { +00721 <span class="keywordflow">return</span> this-><a class="code" href="classConfigReader.html#p2">readerror</a>; +00722 } +00723 +00724 +<a name="l00725"></a><a class="code" href="classFileReader.html#a1">00725</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(std::string filename) +00726 { +00727 <a class="code" href="modules_8h.html#a30">file_cache</a> c; +00728 readfile(c,filename.c_str()); +00729 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; +00730 } +00731 +<a name="l00732"></a><a class="code" href="classFileReader.html#a0">00732</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>() +00733 { +00734 } +00735 +<a name="l00736"></a><a class="code" href="classFileReader.html#a3">00736</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(std::string filename) +00737 { +00738 <a class="code" href="modules_8h.html#a30">file_cache</a> c; +00739 readfile(c,filename.c_str()); +00740 this-><a class="code" href="classFileReader.html#r0">fc</a> = c; +00741 } +00742 +00743 +<a name="l00744"></a><a class="code" href="classFileReader.html#a2">00744</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>() +00745 { +00746 } +00747 +<a name="l00748"></a><a class="code" href="classFileReader.html#a4">00748</a> <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">FileReader::Exists</a>() +00749 { +00750 <span class="keywordflow">if</span> (<a class="code" href="classFileReader.html#r0">fc</a>.size() == 0) +00751 { +00752 <span class="keywordflow">return</span>(<span class="keyword">false</span>); +00753 } +00754 <span class="keywordflow">else</span> +00755 { +00756 <span class="keywordflow">return</span>(<span class="keyword">true</span>); +00757 } +00758 } +00759 +<a name="l00760"></a><a class="code" href="classFileReader.html#a5">00760</a> std::string <a class="code" href="classFileReader.html#a5">FileReader::GetLine</a>(<span class="keywordtype">int</span> x) +00761 { +00762 <span class="keywordflow">if</span> ((x<0) || (x><a class="code" href="classFileReader.html#r0">fc</a>.size())) +00763 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; +00764 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>[x]; +00765 } +00766 +<a name="l00767"></a><a class="code" href="classFileReader.html#a6">00767</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileReader::FileSize</a>() +00768 { +00769 <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#r0">fc</a>.size(); +00770 } +00771 +00772 +00773 std::vector<Module*> <a class="code" href="modules_8cpp.html#a59">modules</a>(255); +00774 std::vector<ircd_module*> <a class="code" href="modules_8cpp.html#a60">factory</a>(255); 00775 -00776 -</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Apr 4 18:12:48 2005 for InspIRCd by +<a name="l00776"></a><a class="code" href="modules_8cpp.html#a1">00776</a> <span class="keywordtype">int</span> <a class="code" href="modules_8cpp.html#a1">MODCOUNT</a> = -1; +00777 +00778 +</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Apr 7 20:14:21 2005 for InspIRCd by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.3 </small></address> |