summaryrefslogtreecommitdiff
path: root/docs/module-doc/modules_8cpp-source.html
blob: b651919d5eabfae75bb106660255a51d23a9c2a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<!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.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3-rc2 -->
<center>
<a class="qindex" href="main.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>modules.cpp</h1><a href="modules_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>
00002 <span class="comment"></span>
00003 <span class="comment">$Log$
00003 <span class="comment">Revision 1.1  2003/01/23 19:45:58  brain
00003 <span class="comment">Initial revision
00003 <span class="comment">
00003 <span class="comment">Revision 1.9  2003/01/22 20:59:12  brain
00003 <span class="comment">Added FileReader class documentation
00003 <span class="comment"></span>
00004 <span class="comment">Revision 1.7  2003/01/22 20:49:16  brain</span>
00005 <span class="comment">Added FileReader file-caching class</span>
00006 <span class="comment">Changed m_randquote to use FileReader class</span>
00007 <span class="comment"></span>
00008 <span class="comment">Revision 1.6  2003/01/21 20:31:24  brain</span>
00009 <span class="comment">Modified to add documentation</span>
00010 <span class="comment">Added ConfigReader class for modules</span>
00011 <span class="comment"></span>
00012 <span class="comment">Revision 1.5  2003/01/13 22:30:50  brain</span>
00013 <span class="comment">Added Admin class (holds /admin info for modules)</span>
00014 <span class="comment">Added methods to Server class</span>
00015 <span class="comment"></span>
00016 <span class="comment"></span>
00017 <span class="comment">*/</span>
00018 
00019 
00020 
00021 <span class="preprocessor">#include &lt;typeinfo&gt;</span>
00022 <span class="preprocessor">#include &lt;iostream.h&gt;</span>
00023 <span class="preprocessor">#include "globals.h"</span>
00024 <span class="preprocessor">#include "<a class="code" href="modules_8h.html">modules.h</a>"</span>
00025 <span class="preprocessor">#include "inspircd_io.h"</span>
00026 
00027 <span class="comment">// version is a simple class for holding a modules version number</span>
00028 
<a name="l00029"></a><a class="code" href="classVersion.html#a0">00029</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) { };
00030 
00031 <span class="comment">// admin is a simple class for holding a server's administrative info</span>
00032 
<a name="l00033"></a><a class="code" href="classAdmin.html#a0">00033</a> <a class="code" href="classAdmin.html#a0">Admin::Admin</a>(string name, string email, string nick) : Name(name), Email(email), Nick(nick) { };
00034 
00035 <span class="comment">//</span>
00036 <span class="comment">// Announce to the world that the Module base</span>
00037 <span class="comment">// class has been created or destroyed</span>
00038 <span class="comment">//</span>
00039 
<a name="l00040"></a><a class="code" href="classModule.html#a0">00040</a> <a class="code" href="classModule.html#a0">Module::Module</a>() { }
<a name="l00041"></a><a class="code" href="classModule.html#a1">00041</a> <a class="code" href="classModule.html#a1">Module::~Module</a>() { }
<a name="l00042"></a><a class="code" href="classModule.html#a3">00042</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="l00043"></a><a class="code" href="classModule.html#a4">00043</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="l00044"></a><a class="code" href="classModule.html#a5">00044</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="l00045"></a><a class="code" href="classModule.html#a6">00045</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="l00046"></a><a class="code" href="classModule.html#a2">00046</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); }
00047 
00048 <span class="comment">// server is a wrapper class that provides methods to all of the C-style</span>
00049 <span class="comment">// exports in the core</span>
00050 <span class="comment">//</span>
00051 
<a name="l00052"></a><a class="code" href="classServer.html#a0">00052</a> <a class="code" href="classServer.html#a0">Server::Server</a>()
00053 {
00054 }
00055 
<a name="l00056"></a><a class="code" href="classServer.html#a1">00056</a> <a class="code" href="classServer.html#a1">Server::~Server</a>()
00057 {
00058 }
00059 
<a name="l00060"></a><a class="code" href="classServer.html#a2">00060</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a2">Server::SendOpers</a>(string s)
00061 {
00062         WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str());
00063 }
00064 
<a name="l00065"></a><a class="code" href="classServer.html#a3">00065</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a3">Server::Debug</a>(string s)
00066 {
00067         debug(<span class="stringliteral">"%s"</span>,s.c_str());
00068 }
00069 
<a name="l00070"></a><a class="code" href="classServer.html#a4">00070</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a4">Server::Send</a>(<span class="keywordtype">int</span> Socket, string s)
00071 {
00072         Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str());
00073 }
00074 
<a name="l00075"></a><a class="code" href="classServer.html#a5">00075</a> <span class="keywordtype">void</span> <a class="code" href="classServer.html#a5">Server::SendServ</a>(<span class="keywordtype">int</span> Socket, string s)
00076 {
00077         WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str());
00078 }
00079 
<a name="l00080"></a><a class="code" href="classServer.html#a6">00080</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, string s)
00081 {
00082         WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str());
00083 }
00084 
<a name="l00085"></a><a class="code" href="classServer.html#a7">00085</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, string s)
00086 {
00087         WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str());
00088 }
00089 
<a name="l00090"></a><a class="code" href="classServer.html#a8">00090</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, string s,<span class="keywordtype">bool</span> IncludeSender)
00091 {
00092         <span class="keywordflow">if</span> (IncludeSender)
00093         {
00094                 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str());
00095         }
00096         <span class="keywordflow">else</span>
00097         {
00098                 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str());
00099         }
00100 }
00101 
<a name="l00102"></a><a class="code" href="classServer.html#a9">00102</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)
00103 {
00104         <span class="keywordflow">return</span> (common_channels(u1,u2) != 0);
00105 }
00106 
<a name="l00107"></a><a class="code" href="classServer.html#a10">00107</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, string text,<span class="keywordtype">bool</span> IncludeSender)
00108 {
00109         <span class="keywordflow">if</span> (IncludeSender)
00110         {
00111                 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str());
00112         }
00113         <span class="keywordflow">else</span>
00114         {
00115                 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str());
00116         }
00117 }
00118 
<a name="l00119"></a><a class="code" href="classServer.html#a11">00119</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, string text)
00120 {
00121         WriteWallOps(User,<span class="stringliteral">"%s"</span>,text.c_str());
00122 }
00123 
<a name="l00124"></a><a class="code" href="classServer.html#a12">00124</a> <span class="keywordtype">bool</span> <a class="code" href="classServer.html#a12">Server::IsNick</a>(string nick)
00125 {
00126         <span class="keywordflow">return</span> (isnick(nick.c_str()) != 0);
00127 }
00128 
<a name="l00129"></a><a class="code" href="classServer.html#a13">00129</a> <a class="code" href="classuserrec.html">userrec</a>* <a class="code" href="classServer.html#a13">Server::FindNick</a>(string nick)
00130 {
00131         <span class="keywordflow">return</span> Find(nick);
00132 }
00133 
<a name="l00134"></a><a class="code" href="classServer.html#a14">00134</a> <a class="code" href="classchanrec.html">chanrec</a>* <a class="code" href="classServer.html#a14">Server::FindChannel</a>(string channel)
00135 {
00136         <span class="keywordflow">return</span> FindChan(channel.c_str());
00137 }
00138 
<a name="l00139"></a><a class="code" href="classServer.html#a15">00139</a> string <a class="code" href="classServer.html#a15">Server::ChanMode</a>(<a class="code" href="classuserrec.html">userrec</a>* User, <a class="code" href="classchanrec.html">chanrec</a>* Chan)
00140 {
00141         string mode = cmode(User,Chan);
00142         <span class="keywordflow">return</span> mode;
00143 }
00144 
<a name="l00145"></a><a class="code" href="classServer.html#a16">00145</a> string <a class="code" href="classServer.html#a16">Server::GetServerName</a>()
00146 {
00147         <span class="keywordflow">return</span> getservername();
00148 }
00149 
<a name="l00150"></a><a class="code" href="classServer.html#a17">00150</a> string <a class="code" href="classServer.html#a17">Server::GetNetworkName</a>()
00151 {
00152         <span class="keywordflow">return</span> getnetworkname();
00153 }
00154 
<a name="l00155"></a><a class="code" href="classServer.html#a18">00155</a> <a class="code" href="classAdmin.html">Admin</a> <a class="code" href="classServer.html#a18">Server::GetAdmin</a>()
00156 {
00157         <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick());
00158 }
00159 
00160 
<a name="l00161"></a><a class="code" href="classConfigReader.html#a0">00161</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>()
00162 {
00163         <a class="code" href="classConfigReader.html#n0">fname</a> = CONFIG_FILE;
00164 }
00165 
00166 
<a name="l00167"></a><a class="code" href="classConfigReader.html#a2">00167</a> <a class="code" href="classConfigReader.html#a2">ConfigReader::~ConfigReader</a>()
00168 {
00169 }
00170 
00171 
<a name="l00172"></a><a class="code" href="classConfigReader.html#a1">00172</a> <a class="code" href="classConfigReader.html#a0">ConfigReader::ConfigReader</a>(string filename) : fname(filename) { };
00173 
<a name="l00174"></a><a class="code" href="classConfigReader.html#a3">00174</a> string <a class="code" href="classConfigReader.html#a3">ConfigReader::ReadValue</a>(string tag, string name, <span class="keywordtype">int</span> index)
00175 {
00176         <span class="keywordtype">char</span> val[MAXBUF];
00177         ReadConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str(),name.c_str(),index,val);
00178         string s = val;
00179         <span class="keywordflow">return</span> s;
00180 }
00181 
00182 
<a name="l00183"></a><a class="code" href="classConfigReader.html#a4">00183</a> <span class="keywordtype">int</span> <a class="code" href="classConfigReader.html#a4">ConfigReader::Enumerate</a>(string tag)
00184 {
00185         <span class="keywordflow">return</span> EnumConf(<a class="code" href="classConfigReader.html#n0">fname</a>.c_str(),tag.c_str());
00186 }
00187 
00188 
<a name="l00189"></a><a class="code" href="classConfigReader.html#a5">00189</a> <span class="keywordtype">bool</span> <a class="code" href="classConfigReader.html#a5">ConfigReader::Verify</a>()
00190 {
00191         <span class="keywordflow">return</span> <span class="keyword">true</span>;
00192 }
00193 
00194 
<a name="l00195"></a><a class="code" href="classFileReader.html#a1">00195</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>(string filename)
00196 {
00197         <a class="code" href="modules_8h.html#a1">file_cache</a> c;
00198         readfile(c,filename.c_str());
00199         this-&gt;<a class="code" href="classFileReader.html#o0">fc</a> = c;
00200 }
00201 
<a name="l00202"></a><a class="code" href="classFileReader.html#a0">00202</a> <a class="code" href="classFileReader.html#a0">FileReader::FileReader</a>()
00203 {
00204 }
00205 
<a name="l00206"></a><a class="code" href="classFileReader.html#a3">00206</a> <span class="keywordtype">void</span> <a class="code" href="classFileReader.html#a3">FileReader::LoadFile</a>(string filename)
00207 {
00208         <a class="code" href="modules_8h.html#a1">file_cache</a> c;
00209         readfile(c,filename.c_str());
00210         this-&gt;<a class="code" href="classFileReader.html#o0">fc</a> = c;
00211 }
00212 
<a name="l00213"></a><a class="code" href="classFileReader.html#a2">00213</a> <a class="code" href="classFileReader.html#a2">FileReader::~FileReader</a>()
00214 {
00215 }
00216 
<a name="l00217"></a><a class="code" href="classFileReader.html#a4">00217</a> string <a class="code" href="classFileReader.html#a4">FileReader::GetLine</a>(<span class="keywordtype">int</span> x)
00218 {
00219         <span class="keywordflow">if</span> ((x&lt;0) || (x&gt;<a class="code" href="classFileReader.html#o0">fc</a>.size()))
00220                 <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
00221         <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#o0">fc</a>[x];
00222 }
00223 
<a name="l00224"></a><a class="code" href="classFileReader.html#a5">00224</a> <span class="keywordtype">int</span> <a class="code" href="classFileReader.html#a5">FileReader::FileSize</a>()
00225 {
00226         <span class="keywordflow">return</span> <a class="code" href="classFileReader.html#o0">fc</a>.size();
00227 }
00228 
00229 
</pre></div><hr><address style="align: right;"><small>Generated on Wed Jan 22 20:56:47 2003 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-rc2 </small></address>
</body>
</html>