]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/man/man3/Server.3
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2578 e03df62e-2008...
[user/henk/code/inspircd.git] / docs / man / man3 / Server.3
1 .TH "Server" 3 "19 Dec 2005" "Version 1.0Betareleases" "InspIRCd" \" -*- nroff -*-
2 .ad l
3 .nh
4 .SH NAME
5 Server \- Allows server output and query functions This class contains methods which allow a module to query the state of the irc server, and produce output to users and other servers.  
6
7 .PP
8 .SH SYNOPSIS
9 .br
10 .PP
11 \fC#include <modules.h>\fP
12 .PP
13 Inherits \fBclassbase\fP.
14 .PP
15 .SS "Public Member Functions"
16
17 .in +1c
18 .ti -1c
19 .RI "\fBServer\fP ()"
20 .br
21 .RI "\fIDefault constructor. \fP"
22 .ti -1c
23 .RI "virtual \fB~Server\fP ()"
24 .br
25 .RI "\fIDefault destructor. \fP"
26 .ti -1c
27 .RI "\fBServerConfig\fP * \fBGetConfig\fP ()"
28 .br
29 .RI "\fIObtains a pointer to the server's \fBServerConfig\fP object. \fP"
30 .ti -1c
31 .RI "virtual void \fBSendOpers\fP (\fBstd::string\fP s)"
32 .br
33 .RI "\fISends text to all opers. \fP"
34 .ti -1c
35 .RI "\fBstd::string\fP \fBGetVersion\fP ()"
36 .br
37 .RI "\fIReturns the version string of this server. \fP"
38 .ti -1c
39 .RI "virtual void \fBLog\fP (int level, \fBstd::string\fP s)"
40 .br
41 .RI "\fIWrites a log string. \fP"
42 .ti -1c
43 .RI "virtual void \fBSend\fP (int Socket, \fBstd::string\fP s)"
44 .br
45 .RI "\fISends a line of text down a TCP/IP socket. \fP"
46 .ti -1c
47 .RI "virtual void \fBSendServ\fP (int Socket, \fBstd::string\fP s)"
48 .br
49 .RI "\fISends text from the server to a socket. \fP"
50 .ti -1c
51 .RI "virtual void \fBSendChannelServerNotice\fP (\fBstd::string\fP ServName, \fBchanrec\fP *Channel, \fBstd::string\fP text)"
52 .br
53 .RI "\fIWrites text to a channel, but from a server, including all. \fP"
54 .ti -1c
55 .RI "virtual void \fBSendFrom\fP (int Socket, \fBuserrec\fP *User, \fBstd::string\fP s)"
56 .br
57 .RI "\fISends text from a user to a socket. \fP"
58 .ti -1c
59 .RI "virtual void \fBSendTo\fP (\fBuserrec\fP *Source, \fBuserrec\fP *Dest, \fBstd::string\fP s)"
60 .br
61 .RI "\fISends text from a user to another user. \fP"
62 .ti -1c
63 .RI "virtual void \fBSendChannel\fP (\fBuserrec\fP *User, \fBchanrec\fP *Channel, \fBstd::string\fP s, bool IncludeSender)"
64 .br
65 .RI "\fISends text from a user to a channel (mulicast). \fP"
66 .ti -1c
67 .RI "virtual bool \fBCommonChannels\fP (\fBuserrec\fP *u1, \fBuserrec\fP *u2)"
68 .br
69 .RI "\fIReturns true if two users share a common channel. \fP"
70 .ti -1c
71 .RI "virtual void \fBSendCommon\fP (\fBuserrec\fP *User, \fBstd::string\fP text, bool IncludeSender)"
72 .br
73 .RI "\fISends text from a user to one or more channels (mulicast). \fP"
74 .ti -1c
75 .RI "virtual void \fBSendWallops\fP (\fBuserrec\fP *User, \fBstd::string\fP text)"
76 .br
77 .RI "\fISends a WALLOPS message. \fP"
78 .ti -1c
79 .RI "virtual bool \fBIsNick\fP (\fBstd::string\fP nick)"
80 .br
81 .RI "\fIReturns true if a nick is valid. \fP"
82 .ti -1c
83 .RI "virtual int \fBCountUsers\fP (\fBchanrec\fP *c)"
84 .br
85 .RI "\fIReturns a count of the number of users on a channel. \fP"
86 .ti -1c
87 .RI "virtual \fBuserrec\fP * \fBFindNick\fP (\fBstd::string\fP nick)"
88 .br
89 .RI "\fIAttempts to look up a nick and return a pointer to it. \fP"
90 .ti -1c
91 .RI "virtual \fBuserrec\fP * \fBFindDescriptor\fP (int socket)"
92 .br
93 .RI "\fIAttempts to look up a nick using the file descriptor associated with that nick. \fP"
94 .ti -1c
95 .RI "virtual \fBchanrec\fP * \fBFindChannel\fP (\fBstd::string\fP channel)"
96 .br
97 .RI "\fIAttempts to look up a channel and return a pointer to it. \fP"
98 .ti -1c
99 .RI "virtual \fBstd::string\fP \fBChanMode\fP (\fBuserrec\fP *User, \fBchanrec\fP *Chan)"
100 .br
101 .RI "\fIAttempts to look up a user's privilages on a channel. \fP"
102 .ti -1c
103 .RI "virtual bool \fBIsOnChannel\fP (\fBuserrec\fP *User, \fBchanrec\fP *Chan)"
104 .br
105 .RI "\fIChecks if a user is on a channel. \fP"
106 .ti -1c
107 .RI "virtual \fBstd::string\fP \fBGetServerName\fP ()"
108 .br
109 .RI "\fIReturns the server name of the server where the module is loaded. \fP"
110 .ti -1c
111 .RI "virtual \fBstd::string\fP \fBGetNetworkName\fP ()"
112 .br
113 .RI "\fIReturns the network name, global to all linked servers. \fP"
114 .ti -1c
115 .RI "virtual \fBstd::string\fP \fBGetServerDescription\fP ()"
116 .br
117 .RI "\fIReturns the server description string of the local server. \fP"
118 .ti -1c
119 .RI "virtual \fBAdmin\fP \fBGetAdmin\fP ()"
120 .br
121 .RI "\fIReturns the information of the server as returned by the /ADMIN command. \fP"
122 .ti -1c
123 .RI "virtual bool \fBAddExtendedMode\fP (char modechar, int type, bool requires_oper, int params_when_on, int params_when_off)"
124 .br
125 .RI "\fIAdds an extended mode letter which is parsed by a module. \fP"
126 .ti -1c
127 .RI "virtual bool \fBAddExtendedListMode\fP (char modechar)"
128 .br
129 .RI "\fIAdds an extended mode letter which is parsed by a module and handled in a list fashion. \fP"
130 .ti -1c
131 .RI "virtual void \fBAddCommand\fP (\fBcommand_t\fP *f)"
132 .br
133 .RI "\fIAdds a command to the command table. \fP"
134 .ti -1c
135 .RI "virtual void \fBSendMode\fP (char **parameters, int pcnt, \fBuserrec\fP *user)"
136 .br
137 .RI "\fISends a servermode. \fP"
138 .ti -1c
139 .RI "virtual void \fBSendToModeMask\fP (\fBstd::string\fP modes, int flags, \fBstd::string\fP text)"
140 .br
141 .RI "\fISends to all users matching a mode mask You must specify one or more usermodes as the first parameter. \fP"
142 .ti -1c
143 .RI "virtual \fBchanrec\fP * \fBJoinUserToChannel\fP (\fBuserrec\fP *user, \fBstd::string\fP cname, \fBstd::string\fP key)"
144 .br
145 .RI "\fIForces a user to join a channel. \fP"
146 .ti -1c
147 .RI "virtual \fBchanrec\fP * \fBPartUserFromChannel\fP (\fBuserrec\fP *user, \fBstd::string\fP cname, \fBstd::string\fP reason)"
148 .br
149 .RI "\fIForces a user to part a channel. \fP"
150 .ti -1c
151 .RI "virtual void \fBChangeUserNick\fP (\fBuserrec\fP *user, \fBstd::string\fP nickname)"
152 .br
153 .RI "\fIForces a user nickchange. \fP"
154 .ti -1c
155 .RI "virtual void \fBQuitUser\fP (\fBuserrec\fP *user, \fBstd::string\fP reason)"
156 .br
157 .RI "\fIForces a user to quit with the specified reason. \fP"
158 .ti -1c
159 .RI "virtual bool \fBMatchText\fP (\fBstd::string\fP sliteral, \fBstd::string\fP spattern)"
160 .br
161 .RI "\fIMatches text against a glob pattern. \fP"
162 .ti -1c
163 .RI "virtual void \fBCallCommandHandler\fP (\fBstd::string\fP commandname, char **parameters, int pcnt, \fBuserrec\fP *user)"
164 .br
165 .RI "\fICalls the handler for a command, either implemented by the core or by another module. \fP"
166 .ti -1c
167 .RI "virtual bool \fBIsValidModuleCommand\fP (\fBstd::string\fP commandname, int pcnt, \fBuserrec\fP *user)"
168 .br
169 .ti -1c
170 .RI "virtual void \fBChangeHost\fP (\fBuserrec\fP *user, \fBstd::string\fP host)"
171 .br
172 .RI "\fIChange displayed hostname of a user. \fP"
173 .ti -1c
174 .RI "virtual void \fBChangeGECOS\fP (\fBuserrec\fP *user, \fBstd::string\fP gecos)"
175 .br
176 .RI "\fIChange GECOS (fullname) of a user. \fP"
177 .ti -1c
178 .RI "virtual bool \fBIsUlined\fP (\fBstd::string\fP server)"
179 .br
180 .RI "\fIReturns true if the servername you give is ulined. \fP"
181 .ti -1c
182 .RI "virtual \fBchanuserlist\fP \fBGetUsers\fP (\fBchanrec\fP *chan)"
183 .br
184 .RI "\fIFetches the userlist of a channel. \fP"
185 .ti -1c
186 .RI "virtual bool \fBUserToPseudo\fP (\fBuserrec\fP *user, \fBstd::string\fP message)"
187 .br
188 .RI "\fIRemove a user's connection to the irc server, but leave their client in existence in the user hash. \fP"
189 .ti -1c
190 .RI "virtual bool \fBPseudoToUser\fP (\fBuserrec\fP *alive, \fBuserrec\fP *zombie, \fBstd::string\fP message)"
191 .br
192 .RI "\fIThis user takes one user, and switches their file descriptor with another user, so that one user 'becomes' the other. \fP"
193 .ti -1c
194 .RI "virtual void \fBAddGLine\fP (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP hostmask)"
195 .br
196 .RI "\fIAdds a G-line The G-line is propogated to all of the servers in the mesh and enforced as soon as it is added. \fP"
197 .ti -1c
198 .RI "virtual void \fBAddQLine\fP (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP nickname)"
199 .br
200 .RI "\fIAdds a Q-line The Q-line is propogated to all of the servers in the mesh and enforced as soon as it is added. \fP"
201 .ti -1c
202 .RI "virtual void \fBAddZLine\fP (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP ipaddr)"
203 .br
204 .RI "\fIAdds a Z-line The Z-line is propogated to all of the servers in the mesh and enforced as soon as it is added. \fP"
205 .ti -1c
206 .RI "virtual void \fBAddKLine\fP (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP hostmask)"
207 .br
208 .RI "\fIAdds a K-line The K-line is enforced as soon as it is added. \fP"
209 .ti -1c
210 .RI "virtual void \fBAddELine\fP (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP hostmask)"
211 .br
212 .RI "\fIAdds a E-line The E-line is enforced as soon as it is added. \fP"
213 .ti -1c
214 .RI "virtual bool \fBDelGLine\fP (\fBstd::string\fP hostmask)"
215 .br
216 .RI "\fIDeletes a G-Line from all servers on the mesh. \fP"
217 .ti -1c
218 .RI "virtual bool \fBDelQLine\fP (\fBstd::string\fP nickname)"
219 .br
220 .RI "\fIDeletes a Q-Line from all servers on the mesh. \fP"
221 .ti -1c
222 .RI "virtual bool \fBDelZLine\fP (\fBstd::string\fP ipaddr)"
223 .br
224 .RI "\fIDeletes a Z-Line from all servers on the mesh. \fP"
225 .ti -1c
226 .RI "virtual bool \fBDelKLine\fP (\fBstd::string\fP hostmask)"
227 .br
228 .RI "\fIDeletes a local K-Line. \fP"
229 .ti -1c
230 .RI "virtual bool \fBDelELine\fP (\fBstd::string\fP hostmask)"
231 .br
232 .RI "\fIDeletes a local E-Line. \fP"
233 .ti -1c
234 .RI "virtual long \fBCalcDuration\fP (\fBstd::string\fP duration)"
235 .br
236 .RI "\fICalculates a duration This method will take a string containing a formatted duration (e.g. \fP"
237 .ti -1c
238 .RI "virtual bool \fBIsValidMask\fP (\fBstd::string\fP mask)"
239 .br
240 .RI "\fIReturns true if a nick!ident string is correctly formatted, false if otherwise. \fP"
241 .ti -1c
242 .RI "virtual \fBModule\fP * \fBFindModule\fP (\fBstd::string\fP name)"
243 .br
244 .RI "\fIThis function finds a module by name. \fP"
245 .ti -1c
246 .RI "virtual void \fBAddSocket\fP (\fBInspSocket\fP *sock)"
247 .br
248 .RI "\fIAdds a class derived from \fBInspSocket\fP to the server's socket engine. \fP"
249 .ti -1c
250 .RI "virtual void \fBDelSocket\fP (\fBInspSocket\fP *sock)"
251 .br
252 .RI "\fIDeletes a class derived from \fBInspSocket\fP from the server's socket engine. \fP"
253 .ti -1c
254 .RI "virtual void \fBRehashServer\fP ()"
255 .br
256 .in -1c
257 .SH "Detailed Description"
258 .PP 
259 Allows server output and query functions This class contains methods which allow a module to query the state of the irc server, and produce output to users and other servers. 
260
261 All modules should instantiate at least one copy of this class, and use its member functions to perform their tasks.
262 .PP
263 Definition at line 1114 of file modules.h.
264 .SH "Constructor & Destructor Documentation"
265 .PP 
266 .SS "Server::Server ()"
267 .PP
268 Default constructor. 
269 .PP
270 Creates a Server object.
271 .PP
272 Definition at line 304 of file modules.cpp.
273 .PP
274 .nf
275 305 {
276 306 }
277 .fi
278 .PP
279 .SS "Server::~Server ()\fC [virtual]\fP"
280 .PP
281 Default destructor. 
282 .PP
283 Destroys a Server object.
284 .PP
285 Definition at line 308 of file modules.cpp.
286 .PP
287 .nf
288 309 {
289 310 }
290 .fi
291 .PP
292 .SH "Member Function Documentation"
293 .PP 
294 .SS "void Server::AddCommand (\fBcommand_t\fP * f)\fC [virtual]\fP"
295 .PP
296 Adds a command to the command table. 
297 .PP
298 This allows modules to add extra commands into the command table. You must place a function within your module which is is of type handlerfunc:
299 .PP
300 typedef void (handlerfunc) (char**, int, userrec*); ... void handle_kill(char **parameters, int pcnt, userrec *user)
301 .PP
302 When the command is typed, the parameters will be placed into the parameters array (similar to argv) and the parameter count will be placed into pcnt (similar to argv). There will never be any less parameters than the 'minparams' value you specified when creating the command. The *user parameter is the class of the user which caused the command to trigger, who will always have the flag you specified in 'flags' when creating the initial command. For example to create an oper only command create the commands with flags='o'. The source parameter is used for resource tracking, and should contain the name of your module (with file extension) e.g. 'm_blarp.so'. If you place the wrong identifier here, you can cause crashes if your module is unloaded.
303 .PP
304 Definition at line 415 of file modules.cpp.
305 .PP
306 References InspIRCd::Parser.
307 .PP
308 .nf
309 416 {
310 417         ServerInstance->Parser->CreateCommand(f);
311 418 }
312 .fi
313 .PP
314 .SS "void Server::AddELine (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP hostmask)\fC [virtual]\fP"
315 .PP
316 Adds a E-line The E-line is enforced as soon as it is added. 
317 .PP
318 The duration must be in seconds, however you can use the \fBServer::CalcDuration\fP method to convert durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used to indicate who or what sent the data, usually this is the nickname of a person, or a server name.
319 .PP
320 Definition at line 659 of file modules.cpp.
321 .PP
322 References add_eline().
323 .PP
324 .nf
325 660 {
326 661         add_eline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
327 662 }
328 .fi
329 .PP
330 .SS "bool Server::AddExtendedListMode (char modechar)\fC [virtual]\fP"
331 .PP
332 Adds an extended mode letter which is parsed by a module and handled in a list fashion. 
333 .PP
334 This call is used to implement modes like +q and +a. The characteristics of these modes are as follows:
335 .PP
336 (1) They are ALWAYS on channels, not on users, therefore their type is MT_CHANNEL
337 .PP
338 (2) They always take exactly one parameter when being added or removed
339 .PP
340 (3) They can be set multiple times, usually on users in channels
341 .PP
342 (4) The mode and its parameter are NOT stored in the channels modes structure
343 .PP
344 It is down to the module handling the mode to maintain state and determine what 'items' (e.g. users, or a banlist) have the mode set on them, and process the modes at the correct times, e.g. during access checks on channels, etc. When the extended mode is triggered the OnExtendedMode method will be triggered as above. Note that the target you are given will be a channel, if for example your mode is set 'on a user' (in for example +a) you must use \fBServer::Find\fP to locate the user the mode is operating on. Your mode handler may return 1 to handle the mode AND tell the core to display the mode change, e.g. '+aaa one two three' in the case of the mode for 'two', or it may return -1 to 'eat' the mode change, so the above example would become '+aa one three' after processing.
345 .PP
346 Definition at line 583 of file modules.cpp.
347 .PP
348 References DoAddExtendedMode(), ModeMakeList(), and MT_CHANNEL.
349 .PP
350 .nf
351 584 {
352 585         bool res = DoAddExtendedMode(modechar,MT_CHANNEL,false,1,1);
353 586         if (res)
354 587                 ModeMakeList(modechar);
355 588         return res;
356 589 }
357 .fi
358 .PP
359 .SS "bool Server::AddExtendedMode (char modechar, int type, bool requires_oper, int params_when_on, int params_when_off)\fC [virtual]\fP"
360 .PP
361 Adds an extended mode letter which is parsed by a module. 
362 .PP
363 This allows modules to add extra mode letters, e.g. +x for hostcloak. the 'type' parameter is either MT_CHANNEL, MT_CLIENT, or MT_SERVER, to indicate wether the mode is a channel mode, a client mode, or a server mode. requires_oper is used with MT_CLIENT type modes only to indicate the mode can only be set or unset by an oper. If this is used for MT_CHANNEL type modes it is ignored. params_when_on is the number of modes to expect when the mode is turned on (for type MT_CHANNEL only), e.g. with mode +k, this would have a value of 1. the params_when_off value has a similar value to params_when_on, except it indicates the number of parameters to expect when the mode is disabled. Modes which act in a similar way to channel mode +l (e.g. require a parameter to enable, but not to disable) should use this parameter. The function returns false if the mode is unavailable, and will not attempt to allocate another character, as this will confuse users. This also means that as only one module can claim a specific mode character, the core does not need to keep track of which modules own which modes, which speeds up operation of the server. In this version, a mode can have at most one parameter, attempting to use more parameters will have undefined effects.
364 .PP
365 Definition at line 555 of file modules.cpp.
366 .PP
367 References DEBUG, DoAddExtendedMode(), log(), MT_CLIENT, and MT_SERVER.
368 .PP
369 .nf
370 556 {
371 557         if (((modechar >= 'A') && (modechar <= 'Z')) || ((modechar >= 'a') && (modechar <= 'z')))
372 558         {
373 559                 if (type == MT_SERVER)
374 560                 {
375 561                         log(DEBUG,'*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion');
376 562                         return false;
377 563                 }
378 564                 if (((params_when_on>0) || (params_when_off>0)) && (type == MT_CLIENT))
379 565                 {
380 566                         log(DEBUG,'*** API ERROR *** Parameters on MT_CLIENT modes are not supported');
381 567                         return false;
382 568                 }
383 569                 if ((params_when_on>1) || (params_when_off>1))
384 570                 {
385 571                         log(DEBUG,'*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported');
386 572                         return false;
387 573                 }
388 574                 return DoAddExtendedMode(modechar,type,requires_oper,params_when_on,params_when_off);
389 575         }
390 576         else
391 577         {
392 578                 log(DEBUG,'*** API ERROR *** Muppet modechar detected.');
393 579         }
394 580         return false;
395 581 }
396 .fi
397 .PP
398 .SS "void Server::AddGLine (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP hostmask)\fC [virtual]\fP"
399 .PP
400 Adds a G-line The G-line is propogated to all of the servers in the mesh and enforced as soon as it is added. 
401 .PP
402 The duration must be in seconds, however you can use the \fBServer::CalcDuration\fP method to convert durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used to indicate who or what sent the data, usually this is the nickname of a person, or a server name.
403 .PP
404 Definition at line 639 of file modules.cpp.
405 .PP
406 References add_gline().
407 .PP
408 .nf
409 640 {
410 641         add_gline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
411 642 }
412 .fi
413 .PP
414 .SS "void Server::AddKLine (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP hostmask)\fC [virtual]\fP"
415 .PP
416 Adds a K-line The K-line is enforced as soon as it is added. 
417 .PP
418 The duration must be in seconds, however you can use the \fBServer::CalcDuration\fP method to convert durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used to indicate who or what sent the data, usually this is the nickname of a person, or a server name.
419 .PP
420 Definition at line 654 of file modules.cpp.
421 .PP
422 References add_kline().
423 .PP
424 .nf
425 655 {
426 656         add_kline(duration, source.c_str(), reason.c_str(), hostmask.c_str());
427 657 }
428 .fi
429 .PP
430 .SS "void Server::AddQLine (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP nickname)\fC [virtual]\fP"
431 .PP
432 Adds a Q-line The Q-line is propogated to all of the servers in the mesh and enforced as soon as it is added. 
433 .PP
434 The duration must be in seconds, however you can use the \fBServer::CalcDuration\fP method to convert durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used to indicate who or what sent the data, usually this is the nickname of a person, or a server name.
435 .PP
436 Definition at line 644 of file modules.cpp.
437 .PP
438 References add_qline().
439 .PP
440 .nf
441 645 {
442 646         add_qline(duration, source.c_str(), reason.c_str(), nickname.c_str());
443 647 }
444 .fi
445 .PP
446 .SS "void Server::AddSocket (\fBInspSocket\fP * sock)\fC [virtual]\fP"
447 .PP
448 Adds a class derived from \fBInspSocket\fP to the server's socket engine. 
449 .PP
450 Definition at line 312 of file modules.cpp.
451 .PP
452 References module_sockets.
453 .PP
454 .nf
455 313 {
456 314         module_sockets.push_back(sock);
457 315 }
458 .fi
459 .PP
460 .SS "void Server::AddZLine (long duration, \fBstd::string\fP source, \fBstd::string\fP reason, \fBstd::string\fP ipaddr)\fC [virtual]\fP"
461 .PP
462 Adds a Z-line The Z-line is propogated to all of the servers in the mesh and enforced as soon as it is added. 
463 .PP
464 The duration must be in seconds, however you can use the \fBServer::CalcDuration\fP method to convert durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used to indicate who or what sent the data, usually this is the nickname of a person, or a server name.
465 .PP
466 Definition at line 649 of file modules.cpp.
467 .PP
468 References add_zline().
469 .PP
470 .nf
471 650 {
472 651         add_zline(duration, source.c_str(), reason.c_str(), ipaddr.c_str());
473 652 }
474 .fi
475 .PP
476 .SS "long Server::CalcDuration (\fBstd::string\fP duration)\fC [virtual]\fP"
477 .PP
478 Calculates a duration This method will take a string containing a formatted duration (e.g. 
479 .PP
480 '1w2d') and return its value as a total number of seconds. This is the same function used internally by /GLINE etc to set the ban times.
481 .PP
482 Definition at line 689 of file modules.cpp.
483 .PP
484 References duration().
485 .PP
486 .nf
487 690 {
488 691         return duration(delta.c_str());
489 692 }
490 .fi
491 .PP
492 .SS "void Server::CallCommandHandler (\fBstd::string\fP commandname, char ** parameters, int pcnt, \fBuserrec\fP * user)\fC [virtual]\fP"
493 .PP
494 Calls the handler for a command, either implemented by the core or by another module. 
495 .PP
496 You can use this function to trigger other commands in the ircd, such as PRIVMSG, JOIN, KICK etc, or even as a method of callback. By defining command names that are untypeable for users on irc (e.g. those which contain a  or 
497 .br
498 ) you may use them as callback identifiers. The first parameter to this method is the name of the command handler you wish to call, e.g. PRIVMSG. This will be a command handler previously registered by the core or wih \fBAddCommand()\fP. The second parameter is an array of parameters, and the third parameter is a count of parameters in the array. If you do not pass enough parameters to meet the minimum needed by the handler, the functiom will silently ignore it. The final parameter is the user executing the command handler, used for privilage checks, etc.
499 .PP
500 Definition at line 400 of file modules.cpp.
501 .PP
502 References InspIRCd::Parser.
503 .PP
504 .nf
505 401 {
506 402         ServerInstance->Parser->CallHandler(commandname,parameters,pcnt,user);
507 403 }
508 .fi
509 .PP
510 .SS "void Server::ChangeGECOS (\fBuserrec\fP * user, \fBstd::string\fP gecos)\fC [virtual]\fP"
511 .PP
512 Change GECOS (fullname) of a user. 
513 .PP
514 You should always call this method to change a user's GECOS rather than writing directly to the fullname member of userrec, as any change applied via this method will be propogated to any linked servers.
515 .PP
516 Definition at line 498 of file modules.cpp.
517 .PP
518 References ChangeName().
519 .PP
520 .nf
521 499 {
522 500         ChangeName(user,gecos.c_str());
523 501 }
524 .fi
525 .PP
526 .SS "void Server::ChangeHost (\fBuserrec\fP * user, \fBstd::string\fP host)\fC [virtual]\fP"
527 .PP
528 Change displayed hostname of a user. 
529 .PP
530 You should always call this method to change a user's host rather than writing directly to the dhost member of userrec, as any change applied via this method will be propogated to any linked servers.
531 .PP
532 Definition at line 493 of file modules.cpp.
533 .PP
534 References ChangeDisplayedHost().
535 .PP
536 .nf
537 494 {
538 495         ChangeDisplayedHost(user,host.c_str());
539 496 }
540 .fi
541 .PP
542 .SS "void Server::ChangeUserNick (\fBuserrec\fP * user, \fBstd::string\fP nickname)\fC [virtual]\fP"
543 .PP
544 Forces a user nickchange. 
545 .PP
546 This command works similarly to SVSNICK, and can be used to implement Q-lines etc. If you specify an invalid nickname, the nick change will be dropped and the target user will receive the error numeric for it.
547 .PP
548 Definition at line 385 of file modules.cpp.
549 .PP
550 References force_nickchange().
551 .PP
552 .nf
553 386 {
554 387         force_nickchange(user,nickname.c_str());
555 388 }
556 .fi
557 .PP
558 .SS "\fBstd::string\fP Server::ChanMode (\fBuserrec\fP * User, \fBchanrec\fP * Chan)\fC [virtual]\fP"
559 .PP
560 Attempts to look up a user's privilages on a channel. 
561 .PP
562 This function will return a string containing either @, %, +, or an empty string, representing the user's privilages upon the channel you specify.
563 .PP
564 Definition at line 523 of file modules.cpp.
565 .PP
566 References cmode().
567 .PP
568 .nf
569 524 {
570 525         return cmode(User,Chan);
571 526 }
572 .fi
573 .PP
574 .SS "bool Server::CommonChannels (\fBuserrec\fP * u1, \fBuserrec\fP * u2)\fC [virtual]\fP"
575 .PP
576 Returns true if two users share a common channel. 
577 .PP
578 This method is used internally by the NICK and QUIT commands, and the \fBServer::SendCommon\fP method.
579 .PP
580 Definition at line 471 of file modules.cpp.
581 .PP
582 References common_channels().
583 .PP
584 .nf
585 472 {
586 473         return (common_channels(u1,u2) != 0);
587 474 }
588 .fi
589 .PP
590 .SS "int Server::CountUsers (\fBchanrec\fP * c)\fC [virtual]\fP"
591 .PP
592 Returns a count of the number of users on a channel. 
593 .PP
594 This will NEVER be 0, as if the chanrec exists, it will have at least one user in the channel.
595 .PP
596 Definition at line 591 of file modules.cpp.
597 .PP
598 .nf
599 592 {
600 593         return usercount(c);
601 594 }
602 .fi
603 .PP
604 .SS "bool Server::DelELine (\fBstd::string\fP hostmask)\fC [virtual]\fP"
605 .PP
606 Deletes a local E-Line. 
607 .PP
608 Definition at line 684 of file modules.cpp.
609 .PP
610 References del_eline().
611 .PP
612 .nf
613 685 {
614 686         return del_eline(hostmask.c_str());
615 687 }
616 .fi
617 .PP
618 .SS "bool Server::DelGLine (\fBstd::string\fP hostmask)\fC [virtual]\fP"
619 .PP
620 Deletes a G-Line from all servers on the mesh. 
621 .PP
622 Definition at line 664 of file modules.cpp.
623 .PP
624 References del_gline().
625 .PP
626 .nf
627 665 {
628 666         return del_gline(hostmask.c_str());
629 667 }
630 .fi
631 .PP
632 .SS "bool Server::DelKLine (\fBstd::string\fP hostmask)\fC [virtual]\fP"
633 .PP
634 Deletes a local K-Line. 
635 .PP
636 Definition at line 679 of file modules.cpp.
637 .PP
638 References del_kline().
639 .PP
640 .nf
641 680 {
642 681         return del_kline(hostmask.c_str());
643 682 }
644 .fi
645 .PP
646 .SS "bool Server::DelQLine (\fBstd::string\fP nickname)\fC [virtual]\fP"
647 .PP
648 Deletes a Q-Line from all servers on the mesh. 
649 .PP
650 Definition at line 669 of file modules.cpp.
651 .PP
652 References del_qline().
653 .PP
654 .nf
655 670 {
656 671         return del_qline(nickname.c_str());
657 672 }
658 .fi
659 .PP
660 .SS "void Server::DelSocket (\fBInspSocket\fP * sock)\fC [virtual]\fP"
661 .PP
662 Deletes a class derived from \fBInspSocket\fP from the server's socket engine. 
663 .PP
664 Definition at line 333 of file modules.cpp.
665 .PP
666 References module_sockets.
667 .PP
668 .nf
669 334 {
670 335         for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++)
671 336         {
672 337                 if (*a == sock)
673 338                 {
674 339                         module_sockets.erase(a);
675 340                         return;
676 341                 }
677 342         }
678 343 }
679 .fi
680 .PP
681 .SS "bool Server::DelZLine (\fBstd::string\fP ipaddr)\fC [virtual]\fP"
682 .PP
683 Deletes a Z-Line from all servers on the mesh. 
684 .PP
685 Definition at line 674 of file modules.cpp.
686 .PP
687 References del_zline().
688 .PP
689 .nf
690 675 {
691 676         return del_zline(ipaddr.c_str());
692 677 }
693 .fi
694 .PP
695 .SS "\fBchanrec\fP * Server::FindChannel (\fBstd::string\fP channel)\fC [virtual]\fP"
696 .PP
697 Attempts to look up a channel and return a pointer to it. 
698 .PP
699 This function will return NULL if the channel does not exist.
700 .PP
701 Definition at line 518 of file modules.cpp.
702 .PP
703 References FindChan().
704 .PP
705 .nf
706 519 {
707 520         return FindChan(channel.c_str());
708 521 }
709 .fi
710 .PP
711 .SS "\fBuserrec\fP * Server::FindDescriptor (int socket)\fC [virtual]\fP"
712 .PP
713 Attempts to look up a nick using the file descriptor associated with that nick. 
714 .PP
715 This function will return NULL if the file descriptor is not associated with a valid user.
716 .PP
717 Definition at line 513 of file modules.cpp.
718 .PP
719 .nf
720 514 {
721 515         return (socket < 65536 ? fd_ref_table[socket] : NULL);
722 516 }
723 .fi
724 .PP
725 .SS "\fBModule\fP * Server::FindModule (\fBstd::string\fP name)\fC [virtual]\fP"
726 .PP
727 This function finds a module by name. 
728 .PP
729 You must provide the filename of the module. If the module cannot be found (is not loaded) the function will return NULL.
730 .PP
731 Definition at line 723 of file modules.cpp.
732 .PP
733 References MODCOUNT, ServerConfig::module_names, and modules.
734 .PP
735 .nf
736 724 {
737 725         for (int i = 0; i <= MODCOUNT; i++)
738 726         {
739 727                 if (Config->module_names[i] == name)
740 728                 {
741 729                         return modules[i];
742 730                 }
743 731         }
744 732         return NULL;
745 733 }
746 .fi
747 .PP
748 .SS "\fBuserrec\fP * Server::FindNick (\fBstd::string\fP nick)\fC [virtual]\fP"
749 .PP
750 Attempts to look up a nick and return a pointer to it. 
751 .PP
752 This function will return NULL if the nick does not exist.
753 .PP
754 Definition at line 508 of file modules.cpp.
755 .PP
756 References Find().
757 .PP
758 .nf
759 509 {
760 510         return Find(nick);
761 511 }
762 .fi
763 .PP
764 .SS "\fBAdmin\fP Server::GetAdmin ()\fC [virtual]\fP"
765 .PP
766 Returns the information of the server as returned by the /ADMIN command. 
767 .PP
768 See the \fBAdmin\fP class for further information of the return value. The members \fBAdmin::Nick\fP, \fBAdmin::Email\fP and \fBAdmin::Name\fP contain the information for the server where the module is loaded.
769 .PP
770 Definition at line 548 of file modules.cpp.
771 .PP
772 References ServerConfig::AdminEmail, ServerConfig::AdminName, and ServerConfig::AdminNick.
773 .PP
774 .nf
775 549 {
776 550         return Admin(Config->AdminName,Config->AdminEmail,Config->AdminNick);
777 551 }
778 .fi
779 .PP
780 .SS "\fBServerConfig\fP * Server::GetConfig ()"
781 .PP
782 Obtains a pointer to the server's \fBServerConfig\fP object. 
783 .PP
784 The \fBServerConfig\fP object contains most of the configuration data of the IRC server, as read from the config file by the core.
785 .PP
786 Definition at line 323 of file modules.cpp.
787 .PP
788 .nf
789 324 {
790 325         return Config;
791 326 }
792 .fi
793 .PP
794 .SS "\fBstd::string\fP Server::GetNetworkName ()\fC [virtual]\fP"
795 .PP
796 Returns the network name, global to all linked servers. 
797 .PP
798 Definition at line 538 of file modules.cpp.
799 .PP
800 References ServerConfig::Network.
801 .PP
802 .nf
803 539 {
804 540         return Config->Network;
805 541 }
806 .fi
807 .PP
808 .SS "\fBstd::string\fP Server::GetServerDescription ()\fC [virtual]\fP"
809 .PP
810 Returns the server description string of the local server. 
811 .PP
812 Definition at line 543 of file modules.cpp.
813 .PP
814 References ServerConfig::ServerDesc.
815 .PP
816 .nf
817 544 {
818 545         return Config->ServerDesc;
819 546 }
820 .fi
821 .PP
822 .SS "\fBstd::string\fP Server::GetServerName ()\fC [virtual]\fP"
823 .PP
824 Returns the server name of the server where the module is loaded. 
825 .PP
826 Definition at line 533 of file modules.cpp.
827 .PP
828 References ServerConfig::ServerName.
829 .PP
830 .nf
831 534 {
832 535         return Config->ServerName;
833 536 }
834 .fi
835 .PP
836 .SS "\fBchanuserlist\fP Server::GetUsers (\fBchanrec\fP * chan)\fC [virtual]\fP"
837 .PP
838 Fetches the userlist of a channel. 
839 .PP
840 This function must be here and not a member of userrec or chanrec due to include constraints.
841 .PP
842 Definition at line 373 of file modules.cpp.
843 .PP
844 References chanrec::GetUsers().
845 .PP
846 .nf
847 374 {
848 375         chanuserlist userl;
849 376         userl.clear();
850 377         std::vector<char*> *list = chan->GetUsers();
851 378         for (std::vector<char*>::iterator i = list->begin(); i != list->end(); i++)
852 379         {
853 380                 char* o = *i;
854 381                 userl.push_back((userrec*)o);
855 382         }
856 383         return userl;
857 384 }
858 .fi
859 .PP
860 .SS "\fBstd::string\fP Server::GetVersion ()"
861 .PP
862 Returns the version string of this server. 
863 .PP
864 Definition at line 328 of file modules.cpp.
865 .PP
866 References InspIRCd::GetVersionString().
867 .PP
868 .nf
869 329 {
870 330         return ServerInstance->GetVersionString();
871 331 }
872 .fi
873 .PP
874 .SS "bool Server::IsNick (\fBstd::string\fP nick)\fC [virtual]\fP"
875 .PP
876 Returns true if a nick is valid. 
877 .PP
878 Nicks for unregistered connections will return false.
879 .PP
880 Definition at line 503 of file modules.cpp.
881 .PP
882 References isnick().
883 .PP
884 .nf
885 504 {
886 505         return (isnick(nick.c_str()) != 0);
887 506 }
888 .fi
889 .PP
890 .SS "bool Server::IsOnChannel (\fBuserrec\fP * User, \fBchanrec\fP * Chan)\fC [virtual]\fP"
891 .PP
892 Checks if a user is on a channel. 
893 .PP
894 This function will return true or false to indicate if user 'User' is on channel 'Chan'.
895 .PP
896 Definition at line 528 of file modules.cpp.
897 .PP
898 References has_channel().
899 .PP
900 .nf
901 529 {
902 530         return has_channel(User,Chan);
903 531 }
904 .fi
905 .PP
906 .SS "bool Server::IsUlined (\fBstd::string\fP server)\fC [virtual]\fP"
907 .PP
908 Returns true if the servername you give is ulined. 
909 .PP
910 ULined servers have extra privilages. They are allowed to change nicknames on remote servers, change modes of clients which are on remote servers and set modes of channels where there are no channel operators for that channel on the ulined server, amongst other things. Ulined server data is also broadcast across the mesh at all times as opposed to selectively messaged in the case of normal servers, as many ulined server types (such as services) do not support meshed links and must operate in this manner.
911 .PP
912 Definition at line 395 of file modules.cpp.
913 .PP
914 References is_uline().
915 .PP
916 .nf
917 396 {
918 397         return is_uline(server.c_str());
919 398 }
920 .fi
921 .PP
922 .SS "bool Server::IsValidMask (\fBstd::string\fP mask)\fC [virtual]\fP"
923 .PP
924 Returns true if a nick!ident string is correctly formatted, false if otherwise. 
925 .PP
926 Definition at line 694 of file modules.cpp.
927 .PP
928 .nf
929 695 {
930 696         const char* dest = mask.c_str();
931 697         if (strchr(dest,'!')==0)
932 698                 return false;
933 699         if (strchr(dest,'@')==0)
934 700                 return false;
935 701         for (unsigned int i = 0; i < strlen(dest); i++)
936 702                 if (dest[i] < 32)
937 703                         return false;
938 704         for (unsigned int i = 0; i < strlen(dest); i++)
939 705                 if (dest[i] > 126)
940 706                         return false;
941 707         unsigned int c = 0;
942 708         for (unsigned int i = 0; i < strlen(dest); i++)
943 709                 if (dest[i] == '!')
944 710                         c++;
945 711         if (c>1)
946 712                 return false;
947 713         c = 0;
948 714         for (unsigned int i = 0; i < strlen(dest); i++)
949 715                 if (dest[i] == '@')
950 716                         c++;
951 717         if (c>1)
952 718                 return false;
953 719 
954 720         return true;
955 721 }
956 .fi
957 .PP
958 .SS "bool Server::IsValidModuleCommand (\fBstd::string\fP commandname, int pcnt, \fBuserrec\fP * user)\fC [virtual]\fP"
959 .PP
960 Definition at line 405 of file modules.cpp.
961 .PP
962 References InspIRCd::Parser.
963 .PP
964 .nf
965 406 {
966 407         return ServerInstance->Parser->IsValidCommand(commandname, pcnt, user);
967 408 }
968 .fi
969 .PP
970 .SS "\fBchanrec\fP * Server::JoinUserToChannel (\fBuserrec\fP * user, \fBstd::string\fP cname, \fBstd::string\fP key)\fC [virtual]\fP"
971 .PP
972 Forces a user to join a channel. 
973 .PP
974 This is similar to svsjoin and can be used to implement redirection, etc. On success, the return value is a valid pointer to a chanrec* of the channel the user was joined to. On failure, the result is NULL.
975 .PP
976 Definition at line 363 of file modules.cpp.
977 .PP
978 References add_channel().
979 .PP
980 .nf
981 364 {
982 365         return add_channel(user,cname.c_str(),key.c_str(),false);
983 366 }
984 .fi
985 .PP
986 .SS "void Server::Log (int level, \fBstd::string\fP s)\fC [virtual]\fP"
987 .PP
988 Writes a log string. 
989 .PP
990 This method writes a line of text to the log. If the level given is lower than the level given in the configuration, this command has no effect.
991 .PP
992 Definition at line 410 of file modules.cpp.
993 .PP
994 References log().
995 .PP
996 .nf
997 411 {
998 412         log(level,'%s',s.c_str());
999 413 }
1000 .fi
1001 .PP
1002 .SS "bool Server::MatchText (\fBstd::string\fP sliteral, \fBstd::string\fP spattern)\fC [virtual]\fP"
1003 .PP
1004 Matches text against a glob pattern. 
1005 .PP
1006 Uses the ircd's internal matching function to match string against a globbing pattern, e.g. *!*@*.com Returns true if the literal successfully matches the pattern, false if otherwise.
1007 .PP
1008 Definition at line 350 of file modules.cpp.
1009 .PP
1010 .nf
1011 351 {
1012 352         char literal[MAXBUF],pattern[MAXBUF];
1013 353         strlcpy(literal,sliteral.c_str(),MAXBUF);
1014 354         strlcpy(pattern,spattern.c_str(),MAXBUF);
1015 355         return match(literal,pattern);
1016 356 }
1017 .fi
1018 .PP
1019 .SS "\fBchanrec\fP * Server::PartUserFromChannel (\fBuserrec\fP * user, \fBstd::string\fP cname, \fBstd::string\fP reason)\fC [virtual]\fP"
1020 .PP
1021 Forces a user to part a channel. 
1022 .PP
1023 This is similar to svspart and can be used to implement redirection, etc. Although the return value of this function is a pointer to a channel record, the returned data is undefined and should not be read or written to. This behaviour may be changed in a future version.
1024 .PP
1025 Definition at line 368 of file modules.cpp.
1026 .PP
1027 References del_channel().
1028 .PP
1029 .nf
1030 369 {
1031 370         return del_channel(user,cname.c_str(),reason.c_str(),false);
1032 371 }
1033 .fi
1034 .PP
1035 .SS "bool Server::PseudoToUser (\fBuserrec\fP * alive, \fBuserrec\fP * zombie, \fBstd::string\fP message)\fC [virtual]\fP"
1036 .PP
1037 This user takes one user, and switches their file descriptor with another user, so that one user 'becomes' the other. 
1038 .PP
1039 The user in 'alive' is booted off the server with the given message. The user referred to by 'zombie' should have previously been locked with Server::ZombifyUser, otherwise stale sockets and file descriptor leaks can occur. After this call, the pointer to alive will be invalid, and the pointer to zombie will be equivalent in effect to the old pointer to alive.
1040 .PP
1041 Definition at line 609 of file modules.cpp.
1042 .PP
1043 References userrec::chans, userrec::ClearBuffer(), connection::fd, FD_MAGIC_NUMBER, connection::host, userrec::ident, kill_link(), chanrec::name, userrec::nick, chanrec::setby, chanrec::topic, chanrec::topicset, Write(), WriteFrom(), and WriteServ().
1044 .PP
1045 .nf
1046 610 {
1047 611         zombie->fd = alive->fd;
1048 612         alive->fd = FD_MAGIC_NUMBER;
1049 613         alive->ClearBuffer();
1050 614         Write(zombie->fd,':%s!%s@%s NICK %s',alive->nick,alive->ident,alive->host,zombie->nick);
1051 615         kill_link(alive,message.c_str());
1052 616         fd_ref_table[zombie->fd] = zombie;
1053 617         for (unsigned int i = 0; i < zombie->chans.size(); i++)
1054 618         {
1055 619                 if (zombie->chans[i].channel != NULL)
1056 620                 {
1057 621                         if (zombie->chans[i].channel->name)
1058 622                         {
1059 623                                 chanrec* Ptr = zombie->chans[i].channel;
1060 624                                 WriteFrom(zombie->fd,zombie,'JOIN %s',Ptr->name);
1061 625                                 if (Ptr->topicset)
1062 626                                 {
1063 627                                         WriteServ(zombie->fd,'332 %s %s :%s', zombie->nick, Ptr->name, Ptr->topic);
1064 628                                         WriteServ(zombie->fd,'333 %s %s %s %d', zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset);
1065 629                                 }
1066 630                                 userlist(zombie,Ptr);
1067 631                                 WriteServ(zombie->fd,'366 %s %s :End of /NAMES list.', zombie->nick, Ptr->name);
1068 632 
1069 633                         }
1070 634                 }
1071 635         }
1072 636         return true;
1073 637 }
1074 .fi
1075 .PP
1076 .SS "void Server::QuitUser (\fBuserrec\fP * user, \fBstd::string\fP reason)\fC [virtual]\fP"
1077 .PP
1078 Forces a user to quit with the specified reason. 
1079 .PP
1080 To the user, it will appear as if they typed /QUIT themselves, except for the fact that this function may bypass the quit prefix specified in the config file.
1081 .PP
1082 WARNING!
1083 .PP
1084 Once you call this function, userrec* user will immediately become INVALID. You MUST NOT write to, or read from this pointer after calling the QuitUser method UNDER ANY CIRCUMSTANCES! The best course of action after calling this method is to immediately bail from your handler.
1085 .PP
1086 Definition at line 390 of file modules.cpp.
1087 .PP
1088 References kill_link().
1089 .PP
1090 .nf
1091 391 {
1092 392         kill_link(user,reason.c_str());
1093 393 }
1094 .fi
1095 .PP
1096 .SS "void Server::RehashServer ()\fC [virtual]\fP"
1097 .PP
1098 Definition at line 317 of file modules.cpp.
1099 .PP
1100 References ServerConfig::Read(), and WriteOpers().
1101 .PP
1102 .nf
1103 318 {
1104 319         WriteOpers('*** Rehashing config file');
1105 320         Config->Read(false,NULL);
1106 321 }
1107 .fi
1108 .PP
1109 .SS "void Server::Send (int Socket, \fBstd::string\fP s)\fC [virtual]\fP"
1110 .PP
1111 Sends a line of text down a TCP/IP socket. 
1112 .PP
1113 This method writes a line of text to an established socket, cutting it to 510 characters plus a carriage return and linefeed if required.
1114 .PP
1115 Definition at line 425 of file modules.cpp.
1116 .PP
1117 References Write().
1118 .PP
1119 .nf
1120 426 {
1121 427         Write(Socket,'%s',s.c_str());
1122 428 }
1123 .fi
1124 .PP
1125 .SS "void Server::SendChannel (\fBuserrec\fP * User, \fBchanrec\fP * Channel, \fBstd::string\fP s, bool IncludeSender)\fC [virtual]\fP"
1126 .PP
1127 Sends text from a user to a channel (mulicast). 
1128 .PP
1129 This method writes a line of text to a channel, with the given user's nick/ident /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459). If the IncludeSender flag is set, then the text is also sent back to the user from which it originated, as seen in MODE (see RFC 1459).
1130 .PP
1131 Definition at line 459 of file modules.cpp.
1132 .PP
1133 References ChanExceptSender(), and WriteChannel().
1134 .PP
1135 .nf
1136 460 {
1137 461         if (IncludeSender)
1138 462         {
1139 463                 WriteChannel(Channel,User,'%s',s.c_str());
1140 464         }
1141 465         else
1142 466         {
1143 467                 ChanExceptSender(Channel,User,'%s',s.c_str());
1144 468         }
1145 469 }
1146 .fi
1147 .PP
1148 .SS "void Server::SendChannelServerNotice (\fBstd::string\fP ServName, \fBchanrec\fP * Channel, \fBstd::string\fP text)\fC [virtual]\fP"
1149 .PP
1150 Writes text to a channel, but from a server, including all. 
1151 .PP
1152 This can be used to send server notices to a group of users.
1153 .PP
1154 Definition at line 454 of file modules.cpp.
1155 .PP
1156 .nf
1157 455 {
1158 456         WriteChannelWithServ((char*)ServName.c_str(), Channel, '%s', text.c_str());
1159 457 }
1160 .fi
1161 .PP
1162 .SS "void Server::SendCommon (\fBuserrec\fP * User, \fBstd::string\fP text, bool IncludeSender)\fC [virtual]\fP"
1163 .PP
1164 Sends text from a user to one or more channels (mulicast). 
1165 .PP
1166 This method writes a line of text to all users which share a common channel with a given user, with the user's nick/ident/host combination prepended, as used in PRIVMSG etc commands (see RFC 1459). If the IncludeSender flag is set, then the text is also sent back to the user from which it originated, as seen in NICK (see RFC 1459). Otherwise, it is only sent to the other recipients, as seen in QUIT.
1167 .PP
1168 Definition at line 476 of file modules.cpp.
1169 .PP
1170 References WriteCommon(), and WriteCommonExcept().
1171 .PP
1172 .nf
1173 477 {
1174 478         if (IncludeSender)
1175 479         {
1176 480                 WriteCommon(User,'%s',text.c_str());
1177 481         }
1178 482         else
1179 483         {
1180 484                 WriteCommonExcept(User,'%s',text.c_str());
1181 485         }
1182 486 }
1183 .fi
1184 .PP
1185 .SS "void Server::SendFrom (int Socket, \fBuserrec\fP * User, \fBstd::string\fP s)\fC [virtual]\fP"
1186 .PP
1187 Sends text from a user to a socket. 
1188 .PP
1189 This method writes a line of text to an established socket, with the given user's nick/ident /host combination prepended, as used in PRIVSG etc commands (see RFC 1459)
1190 .PP
1191 Definition at line 435 of file modules.cpp.
1192 .PP
1193 References WriteFrom().
1194 .PP
1195 .nf
1196 436 {
1197 437         WriteFrom(Socket,User,'%s',s.c_str());
1198 438 }
1199 .fi
1200 .PP
1201 .SS "void Server::SendMode (char ** parameters, int pcnt, \fBuserrec\fP * user)\fC [virtual]\fP"
1202 .PP
1203 Sends a servermode. 
1204 .PP
1205 you must format the parameters array with the target, modes and parameters for those modes.
1206 .PP
1207 For example:
1208 .PP
1209 char *modes[3];
1210 .PP
1211 modes[0] = ChannelName;
1212 .PP
1213 modes[1] = '+o';
1214 .PP
1215 modes[2] = user->nick;
1216 .PP
1217 Srv->SendMode(modes,3,user);
1218 .PP
1219 The modes will originate from the server where the command was issued, however responses (e.g. numerics) will be sent to the user you provide as the third parameter. You must be sure to get the number of parameters correct in the pcnt parameter otherwise you could leave your server in an unstable state!
1220 .PP
1221 Definition at line 420 of file modules.cpp.
1222 .PP
1223 References InspIRCd::ModeGrok, and ModeParser::ServerMode().
1224 .PP
1225 .nf
1226 421 {
1227 422         ServerInstance->ModeGrok->ServerMode(parameters,pcnt,user);
1228 423 }
1229 .fi
1230 .PP
1231 .SS "void Server::SendOpers (\fBstd::string\fP s)\fC [virtual]\fP"
1232 .PP
1233 Sends text to all opers. 
1234 .PP
1235 This method sends a server notice to all opers with the usermode +s.
1236 .PP
1237 Definition at line 345 of file modules.cpp.
1238 .PP
1239 References WriteOpers().
1240 .PP
1241 .nf
1242 346 {
1243 347         WriteOpers('%s',s.c_str());
1244 348 }
1245 .fi
1246 .PP
1247 .SS "void Server::SendServ (int Socket, \fBstd::string\fP s)\fC [virtual]\fP"
1248 .PP
1249 Sends text from the server to a socket. 
1250 .PP
1251 This method writes a line of text to an established socket, with the servername prepended as used by numerics (see RFC 1459)
1252 .PP
1253 Definition at line 430 of file modules.cpp.
1254 .PP
1255 References WriteServ().
1256 .PP
1257 .nf
1258 431 {
1259 432         WriteServ(Socket,'%s',s.c_str());
1260 433 }
1261 .fi
1262 .PP
1263 .SS "void Server::SendTo (\fBuserrec\fP * Source, \fBuserrec\fP * Dest, \fBstd::string\fP s)\fC [virtual]\fP"
1264 .PP
1265 Sends text from a user to another user. 
1266 .PP
1267 This method writes a line of text to a user, with a user's nick/ident /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459) If you specify NULL as the source, then the data will originate from the local server, e.g. instead of:
1268 .PP
1269 :user!ident TEXT
1270 .PP
1271 The format will become:
1272 .PP
1273 :localserver TEXT
1274 .PP
1275 Which is useful for numerics and server notices to single users, etc.
1276 .PP
1277 Definition at line 440 of file modules.cpp.
1278 .PP
1279 References connection::fd, Write(), and WriteTo().
1280 .PP
1281 .nf
1282 441 {
1283 442         if (!Source)
1284 443         {
1285 444                 // if source is NULL, then the message originates from the local server
1286 445                 Write(Dest->fd,':%s %s',this->GetServerName().c_str(),s.c_str());
1287 446         }
1288 447         else
1289 448         {
1290 449                 // otherwise it comes from the user specified
1291 450                 WriteTo(Source,Dest,'%s',s.c_str());
1292 451         }
1293 452 }
1294 .fi
1295 .PP
1296 .SS "void Server::SendToModeMask (\fBstd::string\fP modes, int flags, \fBstd::string\fP text)\fC [virtual]\fP"
1297 .PP
1298 Sends to all users matching a mode mask You must specify one or more usermodes as the first parameter. 
1299 .PP
1300 These can be RFC specified modes such as +i, or module provided modes, including ones provided by your own module. In the second parameter you must place a flag value which indicates wether the modes you have given will be logically ANDed or OR'ed. You may use one of either WM_AND or WM_OR. for example, if you were to use:
1301 .PP
1302 Serv->SendToModeMask('xi', WM_OR, 'm00');
1303 .PP
1304 Then the text 'm00' will be sent to all users with EITHER mode x or i. Conversely if you used WM_AND, the user must have both modes set to receive the message.
1305 .PP
1306 Definition at line 358 of file modules.cpp.
1307 .PP
1308 .nf
1309 359 {
1310 360         WriteMode(modes.c_str(),flags,'%s',text.c_str());
1311 361 }
1312 .fi
1313 .PP
1314 .SS "void Server::SendWallops (\fBuserrec\fP * User, \fBstd::string\fP text)\fC [virtual]\fP"
1315 .PP
1316 Sends a WALLOPS message. 
1317 .PP
1318 This method writes a WALLOPS message to all users with the +w flag, originating from the specified user.
1319 .PP
1320 Definition at line 488 of file modules.cpp.
1321 .PP
1322 References WriteWallOps().
1323 .PP
1324 .nf
1325 489 {
1326 490         WriteWallOps(User,false,'%s',text.c_str());
1327 491 }
1328 .fi
1329 .PP
1330 .SS "bool Server::UserToPseudo (\fBuserrec\fP * user, \fBstd::string\fP message)\fC [virtual]\fP"
1331 .PP
1332 Remove a user's connection to the irc server, but leave their client in existence in the user hash. 
1333 .PP
1334 When you call this function, the user's file descriptor will be replaced with the value of FD_MAGIC_NUMBER and their old file descriptor will be closed. This idle client will remain until it is restored with a valid file descriptor, or is removed from IRC by an operator After this call, the pointer to user will be invalid.
1335 .PP
1336 Definition at line 597 of file modules.cpp.
1337 .PP
1338 References userrec::ClearBuffer(), SocketEngine::DelFd(), connection::fd, FD_MAGIC_NUMBER, connection::host, userrec::ident, InspIRCd::SE, and Write().
1339 .PP
1340 .nf
1341 598 {
1342 599         unsigned int old_fd = user->fd;
1343 600         user->fd = FD_MAGIC_NUMBER;
1344 601         user->ClearBuffer();
1345 602         Write(old_fd,'ERROR :Closing link (%s@%s) [%s]',user->ident,user->host,message.c_str());
1346 603         ServerInstance->SE->DelFd(old_fd);
1347 604         shutdown(old_fd,2);
1348 605         close(old_fd);
1349 606         return true;
1350 607 }
1351 .fi
1352 .PP
1353
1354
1355 .SH "Author"
1356 .PP 
1357 Generated automatically by Doxygen for InspIRCd from the source code.