<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>modules.h Source File</title> <link href="inspircd.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.3-rc3 --> <center> <a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>modules.h</h1><a href="modules_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> 00002 <span class="comment"></span> 00003 <span class="comment"></span> 00004 <span class="comment"></span> 00005 <span class="comment">*/</span> 00006 00007 00008 <span class="preprocessor">#ifndef __PLUGIN_H</span> 00009 <span class="preprocessor"></span><span class="preprocessor">#define __PLUGIN_H</span> 00010 <span class="preprocessor"></span> <a name="l00011"></a><a class="code" href="modules_8h.html#a0">00011</a> <span class="preprocessor">#define DEBUG 10</span> <a name="l00012"></a><a class="code" href="modules_8h.html#a1">00012</a> <span class="preprocessor"></span><span class="preprocessor">#define VERBOSE 20</span> <a name="l00013"></a><a class="code" href="modules_8h.html#a2">00013</a> <span class="preprocessor"></span><span class="preprocessor">#define DEFAULT 30</span> <a name="l00014"></a><a class="code" href="modules_8h.html#a3">00014</a> <span class="preprocessor"></span><span class="preprocessor">#define SPARSE 40</span> <a name="l00015"></a><a class="code" href="modules_8h.html#a4">00015</a> <span class="preprocessor"></span><span class="preprocessor">#define NONE 50</span> 00016 <span class="preprocessor"></span> <a name="l00017"></a><a class="code" href="modules_8h.html#a5">00017</a> <span class="preprocessor">#define MT_CHANNEL 1</span> <a name="l00018"></a><a class="code" href="modules_8h.html#a6">00018</a> <span class="preprocessor"></span><span class="preprocessor">#define MT_CLIENT 2</span> <a name="l00019"></a><a class="code" href="modules_8h.html#a7">00019</a> <span class="preprocessor"></span><span class="preprocessor">#define MT_SERVER 3</span> 00020 <span class="preprocessor"></span> 00021 <span class="preprocessor">#include "dynamic.h"</span> 00022 <span class="preprocessor">#include "<a class="code" href="base_8h.html">base.h</a>"</span> 00023 <span class="preprocessor">#include "<a class="code" href="ctables_8h.html">ctables.h</a>"</span> 00024 <span class="preprocessor">#include <string></span> 00025 <span class="preprocessor">#include <deque></span> 00026 <span class="preprocessor">#include <sstream></span> 00027 <a name="l00030"></a><a class="code" href="modules_8h.html#a10">00030</a> <span class="keyword">typedef</span> std::deque<std::string> <a class="code" href="modules_8h.html#a10">file_cache</a>; <a name="l00031"></a><a class="code" href="modules_8h.html#a11">00031</a> <span class="keyword">typedef</span> <a class="code" href="modules_8h.html#a10">file_cache</a> <a class="code" href="modules_8h.html#a11">string_list</a>; 00032 00033 00034 <span class="comment">// This #define allows us to call a method in all</span> 00035 <span class="comment">// loaded modules in a readable simple way, e.g.:</span> 00036 <span class="comment">// 'FOREACH_MOD OnConnect(user);'</span> 00037 <a name="l00038"></a><a class="code" href="modules_8h.html#a8">00038</a> <span class="preprocessor">#define FOREACH_MOD for (int i = 0; i <= MODCOUNT; i++) modules[i]-></span> 00039 <span class="preprocessor"></span> 00040 <span class="comment">// This define is similar to the one above but returns a result in MOD_RESULT.</span> 00041 <span class="comment">// The first module to return a nonzero result is the value to be accepted,</span> 00042 <span class="comment">// and any modules after are ignored.</span> 00043 00044 <span class="comment">// *********************************************************************************************</span> 00045 <a name="l00046"></a><a class="code" href="modules_8h.html#a9">00046</a> <span class="preprocessor">#define FOREACH_RESULT(x) { MOD_RESULT = 0; \</span> 00047 <span class="preprocessor"> for (int i = 0; i <= MODCOUNT; i++) { \</span> 00048 <span class="preprocessor"> int res = modules[i]->x ; \</span> 00049 <span class="preprocessor"> if (res) { \</span> 00050 <span class="preprocessor"> MOD_RESULT = res; \</span> 00051 <span class="preprocessor"> break; \</span> 00052 <span class="preprocessor"> } \</span> 00053 <span class="preprocessor"> } \</span> 00054 <span class="preprocessor"> } </span> 00055 <span class="preprocessor"></span> 00056 <span class="comment">// *********************************************************************************************</span> 00057 00058 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="modules_8h.html#a13">createcommand</a>(<span class="keywordtype">char</span>* cmd, handlerfunc f, <span class="keywordtype">char</span> flags, <span class="keywordtype">int</span> minparams); 00059 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="modules_8h.html#a14">server_mode</a>(<span class="keywordtype">char</span> **parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a> *user); 00060 00061 <span class="comment">// class Version holds the version information of a Module, returned</span> 00062 <span class="comment">// by Module::GetVersion (thanks RD)</span> 00063 <a name="l00068"></a><a class="code" href="classVersion.html">00068</a> <span class="keyword">class </span><a class="code" href="classVersion.html">Version</a> : <span class="keyword">public</span> <a class="code" href="classclassbase.html">classbase</a> 00069 { 00070 <span class="keyword">public</span>: <a name="l00071"></a><a class="code" href="classVersion.html#m2">00071</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classVersion.html#m0">Major</a>, <a class="code" href="classVersion.html#m1">Minor</a>, <a class="code" href="classVersion.html#m2">Revision</a>, <a class="code" href="classVersion.html#m3">Build</a>; 00072 <a class="code" href="classVersion.html#a0">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); 00073 }; 00074 <a name="l00080"></a><a class="code" href="classAdmin.html">00080</a> <span class="keyword">class </span><a class="code" href="classAdmin.html">Admin</a> : <span class="keyword">public</span> <a class="code" href="classclassbase.html">classbase</a> 00081 { 00082 <span class="keyword">public</span>: <a name="l00083"></a><a class="code" href="classAdmin.html#m2">00083</a> <span class="keyword">const</span> std::string <a class="code" href="classAdmin.html#m0">Name</a>, <a class="code" href="classAdmin.html#m1">Email</a>, <a class="code" href="classAdmin.html#m2">Nick</a>; 00084 <a class="code" href="classAdmin.html#a0">Admin</a>(std::string name, std::string email, std::string nick); 00085 }; 00086 <a name="l00092"></a><a class="code" href="classModule.html">00092</a> <span class="keyword">class </span><a class="code" href="classModule.html">Module</a> : <span class="keyword">public</span> <a class="code" href="classclassbase.html">classbase</a> 00093 { 00094 <span class="keyword">public</span>: 00095 00099 <a class="code" href="classModule.html#a0">Module</a>(); 00100 00104 <span class="keyword">virtual</span> <a class="code" href="classModule.html#a1">~Module</a>(); 00105 00110 <span class="keyword">virtual</span> <a class="code" href="classVersion.html">Version</a> <a class="code" href="classModule.html#a2">GetVersion</a>(); 00111 00115 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a3">OnUserConnect</a>(<a class="code" href="classuserrec.html">userrec</a>* user); 00116 00120 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a4">OnUserQuit</a>(<a class="code" href="classuserrec.html">userrec</a>* user); 00121 00126 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a5">OnUserJoin</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* channel); 00127 00132 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a6">OnUserPart</a>(<a class="code" href="classuserrec.html">userrec</a>* user, <a class="code" href="classchanrec.html">chanrec</a>* channel); 00133 00140 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a7">OnPacketTransmit</a>(<span class="keywordtype">char</span> *p); 00141 00149 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a8">OnPacketReceive</a>(<span class="keywordtype">char</span> *p); 00150 00156 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a9">OnRehash</a>(); 00157 00164 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a10">OnServerRaw</a>(std::string &raw, <span class="keywordtype">bool</span> inbound); 00165 00175 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classModule.html#a11">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); 00176 00189 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a12">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); 00190 00191 00196 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a13">OnOper</a>(<a class="code" href="classuserrec.html">userrec</a>* user); 00197 00206 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a14">OnInfo</a>(<a class="code" href="classuserrec.html">userrec</a>* user); 00207 00212 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModule.html#a15">OnWhois</a>(<a class="code" href="classuserrec.html">userrec</a>* source, <a class="code" href="classuserrec.html">userrec</a>* dest); 00213 00222 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a16">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); 00223 00232 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classModule.html#a17">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); 00233 }; 00234 00235 <a name="l00241"></a><a class="code" href="classServer.html">00241</a> <span class="keyword">class </span><a class="code" href="classServer.html">Server</a> : <span class="keyword">public</span> <a class="code" href="classclassbase.html">classbase</a> 00242 { 00243 <span class="keyword">public</span>: 00247 <a class="code" href="classServer.html#a0">Server</a>(); 00251 <span class="keyword">virtual</span> <a class="code" href="classServer.html#a1">~Server</a>(); 00252 00256 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a2">SendOpers</a>(std::string s); 00261 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a3">Log</a>(<span class="keywordtype">int</span> level, std::string s); 00266 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a4">Send</a>(<span class="keywordtype">int</span> Socket, std::string s); 00271 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a5">SendServ</a>(<span class="keywordtype">int</span> Socket, std::string s); 00276 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a6">SendFrom</a>(<span class="keywordtype">int</span> Socket, <a class="code" href="classuserrec.html">userrec</a>* User, std::string s); 00291 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a7">SendTo</a>(<a class="code" href="classuserrec.html">userrec</a>* Source, <a class="code" href="classuserrec.html">userrec</a>* Dest, std::string s); 00298 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a8">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); 00303 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a9">CommonChannels</a>(<a class="code" href="classuserrec.html">userrec</a>* u1, <a class="code" href="classuserrec.html">userrec</a>* u2); 00311 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a10">SendCommon</a>(<a class="code" href="classuserrec.html">userrec</a>* User, std::string text,<span class="keywordtype">bool</span> IncludeSender); 00316 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a11">SendWallops</a>(<a class="code" href="classuserrec.html">userrec</a>* User, std::string text); 00317 00321 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a12">IsNick</a>(std::string nick); 00325 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classServer.html#a13">CountUsers</a>(<a class="code" href="classchanrec.html">chanrec</a>* c); 00329 <span class="keyword">virtual</span> <a class="code" href="classuserrec.html">userrec</a>* <a class="code" href="classServer.html#a14">FindNick</a>(std::string nick); 00333 <span class="keyword">virtual</span> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a15">FindChannel</a>(std::string channel); 00338 <span class="keyword">virtual</span> std::string <a class="code" href="classServer.html#a16">ChanMode</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Chan); 00341 <span class="keyword">virtual</span> std::string <a class="code" href="classServer.html#a17">GetServerName</a>(); 00344 <span class="keyword">virtual</span> std::string <a class="code" href="classServer.html#a18">GetNetworkName</a>(); 00350 <span class="keyword">virtual</span> <a class="code" href="classAdmin.html">Admin</a> <a class="code" href="classServer.html#a19">GetAdmin</a>(); 00369 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a20">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); 00370 00385 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a21">AddCommand</a>(<span class="keywordtype">char</span>* cmd, handlerfunc f, <span class="keywordtype">char</span> flags, <span class="keywordtype">int</span> minparams); 00386 00408 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a22">SendMode</a>(<span class="keywordtype">char</span> **parameters, <span class="keywordtype">int</span> pcnt, <a class="code" href="classuserrec.html">userrec</a> *user); 00409 00422 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a23">SendToModeMask</a>(std::string modes, <span class="keywordtype">int</span> flags, std::string text); 00423 00429 <span class="keyword">virtual</span> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a24">JoinUserToChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string cname, std::string key); 00430 00436 <span class="keyword">virtual</span> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a25">PartUserFromChannel</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string cname, std::string reason); 00437 00443 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a26">ChangeUserNick</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string nickname); 00444 00455 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a27">QuitUser</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string reason); 00456 00461 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a28">MatchText</a>(std::string sliteral, std::string spattern); 00462 00474 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a29">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); 00475 00481 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a30">ChangeHost</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string host); 00482 00488 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a31">ChangeGECOS</a>(<a class="code" href="classuserrec.html">userrec</a>* user, std::string gecos); 00489 }; 00490 <a name="l00497"></a><a class="code" href="classConfigReader.html">00497</a> <span class="keyword">class </span><a class="code" href="classConfigReader.html">ConfigReader</a> : <span class="keyword">public</span> <a class="code" href="classclassbase.html">classbase</a> 00498 { 00499 <span class="keyword">protected</span>: <a name="l00505"></a><a class="code" href="classConfigReader.html#n0">00505</a> std::stringstream *<a class="code" href="classConfigReader.html#n0">cache</a>; <a name="l00508"></a><a class="code" href="classConfigReader.html#n1">00508</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#n1">error</a>; 00509 00510 <span class="keyword">public</span>: 00515 <a class="code" href="classConfigReader.html#a0">ConfigReader</a>(); <span class="comment">// default constructor reads ircd.conf</span> 00519 <span class="comment"></span> <a class="code" href="classConfigReader.html#a0">ConfigReader</a>(std::string filename); <span class="comment">// read a module-specific config</span> 00523 <span class="comment"></span> <a class="code" href="classConfigReader.html#a2">~ConfigReader</a>(); 00528 std::string <a class="code" href="classConfigReader.html#a3">ReadValue</a>(std::string tag, std::string name, <span class="keywordtype">int</span> index); 00535 <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a4">Enumerate</a>(std::string tag); 00540 <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a5">Verify</a>(); 00541 00547 <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a6">EnumerateValues</a>(std::string tag, <span class="keywordtype">int</span> index); 00548 }; 00549 00550 00551 <a name="l00557"></a><a class="code" href="classFileReader.html">00557</a> <span class="keyword">class </span><a class="code" href="classFileReader.html">FileReader</a> : <span class="keyword">public</span> <a class="code" href="classclassbase.html">classbase</a> 00558 { <a name="l00559"></a><a class="code" href="classFileReader.html#o0">00559</a> <a class="code" href="modules_8h.html#a10">file_cache</a> <a class="code" href="classFileReader.html#o0">fc</a>; 00560 <span class="keyword">public</span>: 00565 <a class="code" href="classFileReader.html#a0">FileReader</a>(); 00566 00572 <a class="code" href="classFileReader.html#a0">FileReader</a>(std::string filename); 00573 00577 <a class="code" href="classFileReader.html#a2">~FileReader</a>(); 00578 00584 <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">LoadFile</a>(std::string filename); 00585 00589 <span class="keywordtype">bool</span> <a class="code" href="classFileReader.html#a4">Exists</a>(); 00590 00595 std::string <a class="code" href="classFileReader.html#a5">GetLine</a>(<span class="keywordtype">int</span> x); 00596 00602 <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a6">FileSize</a>(); 00603 }; 00604 00605 <a name="l00612"></a><a class="code" href="classModuleFactory.html">00612</a> <span class="keyword">class </span><a class="code" href="classModuleFactory.html">ModuleFactory</a> : <span class="keyword">public</span> <a class="code" href="classclassbase.html">classbase</a> 00613 { 00614 <span class="keyword">public</span>: <a name="l00615"></a><a class="code" href="classModuleFactory.html#a0">00615</a> <a class="code" href="classModuleFactory.html#a0">ModuleFactory</a>() { } <a name="l00616"></a><a class="code" href="classModuleFactory.html#a1">00616</a> <span class="keyword">virtual</span> <a class="code" href="classModuleFactory.html#a1">~ModuleFactory</a>() { } 00621 <span class="keyword">virtual</span> <a class="code" href="classModule.html">Module</a> * <a class="code" href="classModuleFactory.html#a2">CreateModule</a>() = 0; 00622 }; 00623 00624 <a name="l00625"></a><a class="code" href="modules_8h.html#a12">00625</a> <span class="keyword">typedef</span> DLLFactory<ModuleFactory> <a class="code" href="modules_8h.html#a12">ircd_module</a>; 00626 00627 <span class="preprocessor">#endif</span> </pre></div><hr><address style="align: right;"><small>Generated on Mon Apr 19 02:34:32 2004 for InspIRCd by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.3-rc3 </small></address> </body> </html>