1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>Server class Reference</title>
4 <link href="inspircd.css" rel="stylesheet" type="text/css">
6 <!-- Generated by Doxygen 1.3-rc3 -->
8 <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>
9 <hr><h1>Server Class Reference</h1>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.
10 <a href="#_details">More...</a>
12 <code>#include <<a class="el" href="modules_8h-source.html">modules.h</a>></code>
14 Inheritance diagram for Server:<p><center><img src="classServer__inherit__graph.gif" border="0" usemap="#Server__inherit__map" alt="Inheritance graph"></center>
15 <map name="Server__inherit__map">
16 <area href="classclassbase.html" shape="rect" coords="7,16,73,37" alt="">
18 <center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for Server:<p><center><img src="classServer__coll__graph.gif" border="0" usemap="#Server__coll__map" alt="Collaboration graph"></center>
19 <map name="Server__coll__map">
20 <area href="classclassbase.html" shape="rect" coords="7,106,73,128" alt="">
22 <center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center><a href="classServer-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
24 <tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
25 <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classServer.html#a0">Server</a> ()</td></tr>
26 <tr><td> </td><td><font size=-1><em>Default constructor.</em> <a href="#a0"></a><em></em></font><br><br></td></tr>
27 <tr><td nowrap align=right valign=top>virtual </td><td valign=bottom><a class="el" href="classServer.html#a1">~Server</a> ()</td></tr>
28 <tr><td> </td><td><font size=-1><em>Default destructor.</em> <a href="#a1"></a><em></em></font><br><br></td></tr>
29 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a2">SendOpers</a> (std::string s)</td></tr>
30 <tr><td> </td><td><font size=-1><em>Sends text to all opers.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
31 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a3">Log</a> (int level, std::string s)</td></tr>
32 <tr><td> </td><td><font size=-1><em>Writes a log string.</em> <a href="#a3"></a><em></em></font><br><br></td></tr>
33 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a4">Send</a> (int Socket, std::string s)</td></tr>
34 <tr><td> </td><td><font size=-1><em>Sends a line of text down a TCP/IP socket.</em> <a href="#a4"></a><em></em></font><br><br></td></tr>
35 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a5">SendServ</a> (int Socket, std::string s)</td></tr>
36 <tr><td> </td><td><font size=-1><em>Sends text from the server to a socket.</em> <a href="#a5"></a><em></em></font><br><br></td></tr>
37 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a6">SendFrom</a> (int Socket, <a class="el" href="classuserrec.html">userrec</a> *User, std::string s)</td></tr>
38 <tr><td> </td><td><font size=-1><em>Sends text from a user to a socket.</em> <a href="#a6"></a><em></em></font><br><br></td></tr>
39 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a7">SendTo</a> (<a class="el" href="classuserrec.html">userrec</a> *Source, <a class="el" href="classuserrec.html">userrec</a> *Dest, std::string s)</td></tr>
40 <tr><td> </td><td><font size=-1><em>Sends text from a user to another user.</em> <a href="#a7"></a><em></em></font><br><br></td></tr>
41 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a8">SendChannel</a> (<a class="el" href="classuserrec.html">userrec</a> *User, <a class="el" href="classchanrec.html">chanrec</a> *Channel, std::string s, bool IncludeSender)</td></tr>
42 <tr><td> </td><td><font size=-1><em>Sends text from a user to a channel (mulicast).</em> <a href="#a8"></a><em></em></font><br><br></td></tr>
43 <tr><td nowrap align=right valign=top>virtual bool </td><td valign=bottom><a class="el" href="classServer.html#a9">CommonChannels</a> (<a class="el" href="classuserrec.html">userrec</a> *u1, <a class="el" href="classuserrec.html">userrec</a> *u2)</td></tr>
44 <tr><td> </td><td><font size=-1><em>Returns true if two users share a common channel.</em> <a href="#a9"></a><em></em></font><br><br></td></tr>
45 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a10">SendCommon</a> (<a class="el" href="classuserrec.html">userrec</a> *User, std::string text, bool IncludeSender)</td></tr>
46 <tr><td> </td><td><font size=-1><em>Sends text from a user to one or more channels (mulicast).</em> <a href="#a10"></a><em></em></font><br><br></td></tr>
47 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a11">SendWallops</a> (<a class="el" href="classuserrec.html">userrec</a> *User, std::string text)</td></tr>
48 <tr><td> </td><td><font size=-1><em>Sends a WALLOPS message.</em> <a href="#a11"></a><em></em></font><br><br></td></tr>
49 <tr><td nowrap align=right valign=top>virtual bool </td><td valign=bottom><a class="el" href="classServer.html#a12">IsNick</a> (std::string nick)</td></tr>
50 <tr><td> </td><td><font size=-1><em>Returns true if a nick is valid.</em> <a href="#a12"></a><em></em></font><br><br></td></tr>
51 <tr><td nowrap align=right valign=top>virtual int </td><td valign=bottom><a class="el" href="classServer.html#a13">CountUsers</a> (<a class="el" href="classchanrec.html">chanrec</a> *c)</td></tr>
52 <tr><td> </td><td><font size=-1><em>Returns a count of the number of users on a channel.</em> <a href="#a13"></a><em></em></font><br><br></td></tr>
53 <tr><td nowrap align=right valign=top>virtual <a class="el" href="classuserrec.html">userrec</a> * </td><td valign=bottom><a class="el" href="classServer.html#a14">FindNick</a> (std::string nick)</td></tr>
54 <tr><td> </td><td><font size=-1><em>Attempts to look up a nick and return a pointer to it.</em> <a href="#a14"></a><em></em></font><br><br></td></tr>
55 <tr><td nowrap align=right valign=top>virtual <a class="el" href="classchanrec.html">chanrec</a> * </td><td valign=bottom><a class="el" href="classServer.html#a15">FindChannel</a> (std::string channel)</td></tr>
56 <tr><td> </td><td><font size=-1><em>Attempts to look up a channel and return a pointer to it.</em> <a href="#a15"></a><em></em></font><br><br></td></tr>
57 <tr><td nowrap align=right valign=top>virtual std::string </td><td valign=bottom><a class="el" href="classServer.html#a16">ChanMode</a> (<a class="el" href="classuserrec.html">userrec</a> *User, <a class="el" href="classchanrec.html">chanrec</a> *Chan)</td></tr>
58 <tr><td> </td><td><font size=-1><em>Attempts to look up a user's privilages on a channel.</em> <a href="#a16"></a><em></em></font><br><br></td></tr>
59 <tr><td nowrap align=right valign=top>virtual bool </td><td valign=bottom><a class="el" href="classServer.html#a17">IsOnChannel</a> (<a class="el" href="classuserrec.html">userrec</a> *User, <a class="el" href="classchanrec.html">chanrec</a> *Chan)</td></tr>
60 <tr><td> </td><td><font size=-1><em>Checks if a user is on a channel.</em> <a href="#a17"></a><em></em></font><br><br></td></tr>
61 <tr><td nowrap align=right valign=top>virtual std::string </td><td valign=bottom><a class="el" href="classServer.html#a18">GetServerName</a> ()</td></tr>
62 <tr><td> </td><td><font size=-1><em>Returns the server name of the server where the module is loaded.</em> <a href="#a18"></a><em></em></font><br><br></td></tr>
63 <tr><td nowrap align=right valign=top>virtual std::string </td><td valign=bottom><a class="el" href="classServer.html#a19">GetNetworkName</a> ()</td></tr>
64 <tr><td> </td><td><font size=-1><em>Returns the network name, global to all linked servers.</em> <a href="#a19"></a><em></em></font><br><br></td></tr>
65 <tr><td nowrap align=right valign=top>virtual <a class="el" href="classAdmin.html">Admin</a> </td><td valign=bottom><a class="el" href="classServer.html#a20">GetAdmin</a> ()</td></tr>
66 <tr><td> </td><td><font size=-1><em>Returns the information of the server as returned by the /ADMIN command.</em> <a href="#a20"></a><em></em></font><br><br></td></tr>
67 <tr><td nowrap align=right valign=top>virtual bool </td><td valign=bottom><a class="el" href="classServer.html#a21">AddExtendedMode</a> (char modechar, int type, bool requires_oper, int params_when_on, int params_when_off)</td></tr>
68 <tr><td> </td><td><font size=-1><em>Adds an extended mode letter which is parsed by a module.</em> <a href="#a21"></a><em></em></font><br><br></td></tr>
69 <tr><td nowrap align=right valign=top>virtual bool </td><td valign=bottom><a class="el" href="classServer.html#a22">AddExtendedListMode</a> (char modechar)</td></tr>
70 <tr><td> </td><td><font size=-1><em>Adds an extended mode letter which is parsed by a module and handled in a list fashion.</em> <a href="#a22"></a><em></em></font><br><br></td></tr>
71 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a23">AddCommand</a> (char *cmd, handlerfunc f, char flags, int minparams)</td></tr>
72 <tr><td> </td><td><font size=-1><em>Adds a command to the command table.</em> <a href="#a23"></a><em></em></font><br><br></td></tr>
73 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a24">SendMode</a> (char **parameters, int pcnt, <a class="el" href="classuserrec.html">userrec</a> *user)</td></tr>
74 <tr><td> </td><td><font size=-1><em>Sends a servermode.</em> <a href="#a24"></a><em></em></font><br><br></td></tr>
75 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a25">SendToModeMask</a> (std::string modes, int flags, std::string text)</td></tr>
76 <tr><td> </td><td><font size=-1><em>Sends to all users matching a mode mask You must specify one or more usermodes as the first parameter.</em> <a href="#a25"></a><em></em></font><br><br></td></tr>
77 <tr><td nowrap align=right valign=top>virtual <a class="el" href="classchanrec.html">chanrec</a> * </td><td valign=bottom><a class="el" href="classServer.html#a26">JoinUserToChannel</a> (<a class="el" href="classuserrec.html">userrec</a> *user, std::string cname, std::string key)</td></tr>
78 <tr><td> </td><td><font size=-1><em>Forces a user to join a channel.</em> <a href="#a26"></a><em></em></font><br><br></td></tr>
79 <tr><td nowrap align=right valign=top>virtual <a class="el" href="classchanrec.html">chanrec</a> * </td><td valign=bottom><a class="el" href="classServer.html#a27">PartUserFromChannel</a> (<a class="el" href="classuserrec.html">userrec</a> *user, std::string cname, std::string reason)</td></tr>
80 <tr><td> </td><td><font size=-1><em>Forces a user to part a channel.</em> <a href="#a27"></a><em></em></font><br><br></td></tr>
81 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a28">ChangeUserNick</a> (<a class="el" href="classuserrec.html">userrec</a> *user, std::string nickname)</td></tr>
82 <tr><td> </td><td><font size=-1><em>Forces a user nickchange.</em> <a href="#a28"></a><em></em></font><br><br></td></tr>
83 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a29">QuitUser</a> (<a class="el" href="classuserrec.html">userrec</a> *user, std::string reason)</td></tr>
84 <tr><td> </td><td><font size=-1><em>Forces a user to quit with the specified reason.</em> <a href="#a29"></a><em></em></font><br><br></td></tr>
85 <tr><td nowrap align=right valign=top>virtual bool </td><td valign=bottom><a class="el" href="classServer.html#a30">MatchText</a> (std::string sliteral, std::string spattern)</td></tr>
86 <tr><td> </td><td><font size=-1><em>Matches text against a glob pattern.</em> <a href="#a30"></a><em></em></font><br><br></td></tr>
87 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a31">CallCommandHandler</a> (std::string commandname, char **parameters, int pcnt, <a class="el" href="classuserrec.html">userrec</a> *user)</td></tr>
88 <tr><td> </td><td><font size=-1><em>Calls the handler for a command, either implemented by the core or by another module.</em> <a href="#a31"></a><em></em></font><br><br></td></tr>
89 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a32">ChangeHost</a> (<a class="el" href="classuserrec.html">userrec</a> *user, std::string host)</td></tr>
90 <tr><td> </td><td><font size=-1><em>Change displayed hostname of a user.</em> <a href="#a32"></a><em></em></font><br><br></td></tr>
91 <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classServer.html#a33">ChangeGECOS</a> (<a class="el" href="classuserrec.html">userrec</a> *user, std::string gecos)</td></tr>
92 <tr><td> </td><td><font size=-1><em>Change GECOS (fullname) of a user.</em> <a href="#a33"></a><em></em></font><br><br></td></tr>
93 <tr><td nowrap align=right valign=top>virtual bool </td><td valign=bottom><a class="el" href="classServer.html#a34">IsUlined</a> (std::string server)</td></tr>
94 <tr><td> </td><td><font size=-1><em>Returns true if the servername you give is ulined.</em> <a href="#a34"></a><em></em></font><br><br></td></tr>
96 <hr><a name="_details"></a><h2>Detailed Description</h2>
97 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.
99 All modules should instantiate at least one copy of this class, and use its member functions to perform their tasks.
103 Definition at line <a class="el" href="modules_8h-source.html#l00295">295</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor & Destructor Documentation</h2>
104 <a name="a0" doxytag="Server::Server"></a><p>
105 <table width="100%" cellpadding="2" cellspacing="0" border="0">
108 <table cellpadding="0" cellspacing="0" border="0">
110 <td class="md" nowrap valign="top"> Server::Server </td>
111 <td class="md" valign="top">( </td>
112 <td class="mdname1" valign="top" nowrap> </td>
113 <td class="md" valign="top">) </td>
114 <td class="md" nowrap></td>
121 <table cellspacing=5 cellpadding=0 border=0>
131 Creates a Server object.
133 Definition at line <a class="el" href="modules_8cpp-source.html#l00164">164</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
135 <div class="fragment"><pre>00165 {
140 <a name="a1" doxytag="Server::~Server"></a><p>
141 <table width="100%" cellpadding="2" cellspacing="0" border="0">
144 <table cellpadding="0" cellspacing="0" border="0">
146 <td class="md" nowrap valign="top"> Server::~Server </td>
147 <td class="md" valign="top">( </td>
148 <td class="mdname1" valign="top" nowrap> </td>
149 <td class="md" valign="top">) </td>
150 <td class="md" nowrap><code> [virtual]</code></td>
157 <table cellspacing=5 cellpadding=0 border=0>
167 Destroys a Server object.
169 Definition at line <a class="el" href="modules_8cpp-source.html#l00168">168</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
171 <div class="fragment"><pre>00169 {
176 <hr><h2>Member Function Documentation</h2>
177 <a name="a23" doxytag="Server::AddCommand"></a><p>
178 <table width="100%" cellpadding="2" cellspacing="0" border="0">
181 <table cellpadding="0" cellspacing="0" border="0">
183 <td class="md" nowrap valign="top"> void Server::AddCommand </td>
184 <td class="md" valign="top">( </td>
185 <td class="md" nowrap valign="top">char * </td>
186 <td class="mdname" nowrap> <em>cmd</em>, </td>
191 <td class="md" nowrap>handlerfunc </td>
192 <td class="mdname" nowrap> <em>f</em>, </td>
197 <td class="md" nowrap>char </td>
198 <td class="mdname" nowrap> <em>flags</em>, </td>
203 <td class="md" nowrap>int </td>
204 <td class="mdname" nowrap> <em>minparams</em></td>
208 <td class="md">) </td>
209 <td class="md" colspan="2"><code> [virtual]</code></td>
216 <table cellspacing=5 cellpadding=0 border=0>
224 Adds a command to the command table.
226 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:<p>
227 typedef void (handlerfunc) (char**, int, userrec*); ... void <a class="el" href="commands_8h.html#a5">handle_kill(char **parameters, int pcnt, userrec *user)</a><p>
228 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'.
230 Definition at line <a class="el" href="modules_8cpp-source.html#l00226">226</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
232 References <a class="el" href="modules_8h.html#a25">createcommand()</a>.
234 <div class="fragment"><pre>00227 {
235 00228 <a class="code" href="modules_8h.html#a25">createcommand</a>(cmd,f,flags,minparams);
240 <a name="a22" doxytag="Server::AddExtendedListMode"></a><p>
241 <table width="100%" cellpadding="2" cellspacing="0" border="0">
244 <table cellpadding="0" cellspacing="0" border="0">
246 <td class="md" nowrap valign="top"> bool Server::AddExtendedListMode </td>
247 <td class="md" valign="top">( </td>
248 <td class="md" nowrap valign="top">char </td>
249 <td class="mdname1" valign="top" nowrap> <em>modechar</em> </td>
250 <td class="md" valign="top">) </td>
251 <td class="md" nowrap><code> [virtual]</code></td>
258 <table cellspacing=5 cellpadding=0 border=0>
266 Adds an extended mode letter which is parsed by a module and handled in a list fashion.
268 This call is used to implement modes like +q and +a. The characteristics of these modes are as follows:<p>
269 (1) They are ALWAYS on channels, not on users, therefore their type is MT_CHANNEL<p>
270 (2) They always take exactly one parameter when being added or removed<p>
271 (3) They can be set multiple times, usually on users in channels<p>
272 (4) The mode and its parameter are NOT stored in the channels modes structure<p>
273 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 Server::Find 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.
275 Definition at line <a class="el" href="modules_8cpp-source.html#l00371">371</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
277 References <a class="el" href="modules_8cpp-source.html#l00108">DoAddExtendedMode()</a>, and <a class="el" href="modules_8cpp-source.html#l00118">ModeMakeList()</a>.
279 <div class="fragment"><pre>00372 {
280 00373 <span class="keywordtype">bool</span> res = <a class="code" href="modules_8cpp.html#a9">DoAddExtendedMode</a>(modechar,MT_CHANNEL,<span class="keyword">false</span>,1,1);
281 00374 <span class="keywordflow">if</span> (res)
282 00375 <a class="code" href="modules_8cpp.html#a10">ModeMakeList</a>(modechar);
283 00376 <span class="keywordflow">return</span> res;
288 <a name="a21" doxytag="Server::AddExtendedMode"></a><p>
289 <table width="100%" cellpadding="2" cellspacing="0" border="0">
292 <table cellpadding="0" cellspacing="0" border="0">
294 <td class="md" nowrap valign="top"> bool Server::AddExtendedMode </td>
295 <td class="md" valign="top">( </td>
296 <td class="md" nowrap valign="top">char </td>
297 <td class="mdname" nowrap> <em>modechar</em>, </td>
302 <td class="md" nowrap>int </td>
303 <td class="mdname" nowrap> <em>type</em>, </td>
308 <td class="md" nowrap>bool </td>
309 <td class="mdname" nowrap> <em>requires_oper</em>, </td>
314 <td class="md" nowrap>int </td>
315 <td class="mdname" nowrap> <em>params_when_on</em>, </td>
320 <td class="md" nowrap>int </td>
321 <td class="mdname" nowrap> <em>params_when_off</em></td>
325 <td class="md">) </td>
326 <td class="md" colspan="2"><code> [virtual]</code></td>
333 <table cellspacing=5 cellpadding=0 border=0>
341 Adds an extended mode letter which is parsed by a module.
343 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.
345 Definition at line <a class="el" href="modules_8cpp-source.html#l00351">351</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
347 References <a class="el" href="modules_8cpp-source.html#l00108">DoAddExtendedMode()</a>, <a class="el" href="modules_8h-source.html#l00022">MT_CLIENT</a>, and <a class="el" href="modules_8h-source.html#l00023">MT_SERVER</a>.
349 <div class="fragment"><pre>00352 {
350 00353 <span class="keywordflow">if</span> (type == <a class="code" href="modules_8h.html#a7">MT_SERVER</a>)
352 00355 log(DEBUG,<span class="stringliteral">"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"</span>);
353 00356 <span class="keywordflow">return</span> <span class="keyword">false</span>;
355 00358 <span class="keywordflow">if</span> (((params_when_on>0) || (params_when_off>0)) && (type == <a class="code" href="modules_8h.html#a6">MT_CLIENT</a>))
357 00360 log(DEBUG,<span class="stringliteral">"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"</span>);
358 00361 <span class="keywordflow">return</span> <span class="keyword">false</span>;
360 00363 <span class="keywordflow">if</span> ((params_when_on>1) || (params_when_off>1))
362 00365 log(DEBUG,<span class="stringliteral">"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"</span>);
363 00366 <span class="keywordflow">return</span> <span class="keyword">false</span>;
365 00368 <span class="keywordflow">return</span> <a class="code" href="modules_8cpp.html#a9">DoAddExtendedMode</a>(modechar,type,requires_oper,params_when_on,params_when_off);
370 <a name="a31" doxytag="Server::CallCommandHandler"></a><p>
371 <table width="100%" cellpadding="2" cellspacing="0" border="0">
374 <table cellpadding="0" cellspacing="0" border="0">
376 <td class="md" nowrap valign="top"> void Server::CallCommandHandler </td>
377 <td class="md" valign="top">( </td>
378 <td class="md" nowrap valign="top">std::string </td>
379 <td class="mdname" nowrap> <em>commandname</em>, </td>
384 <td class="md" nowrap>char ** </td>
385 <td class="mdname" nowrap> <em>parameters</em>, </td>
390 <td class="md" nowrap>int </td>
391 <td class="mdname" nowrap> <em>pcnt</em>, </td>
396 <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> * </td>
397 <td class="mdname" nowrap> <em>user</em></td>
401 <td class="md">) </td>
402 <td class="md" colspan="2"><code> [virtual]</code></td>
409 <table cellspacing=5 cellpadding=0 border=0>
417 Calls the handler for a command, either implemented by the core or by another module.
419 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 <br>
420 ) 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 <a class="el" href="classServer.html#a23">AddCommand()</a>. 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.
422 Definition at line <a class="el" href="modules_8cpp-source.html#l00216">216</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
424 <div class="fragment"><pre>00217 {
425 00218 call_handler(commandname.c_str(),parameters,pcnt,user);
430 <a name="a33" doxytag="Server::ChangeGECOS"></a><p>
431 <table width="100%" cellpadding="2" cellspacing="0" border="0">
434 <table cellpadding="0" cellspacing="0" border="0">
436 <td class="md" nowrap valign="top"> void Server::ChangeGECOS </td>
437 <td class="md" valign="top">( </td>
438 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
439 <td class="mdname" nowrap> <em>user</em>, </td>
444 <td class="md" nowrap>std::string </td>
445 <td class="mdname" nowrap> <em>gecos</em></td>
449 <td class="md">) </td>
450 <td class="md" colspan="2"><code> [virtual]</code></td>
457 <table cellspacing=5 cellpadding=0 border=0>
465 Change GECOS (fullname) of a user.
467 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.
469 Definition at line <a class="el" href="modules_8cpp-source.html#l00304">304</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
471 References <a class="el" href="message_8h.html#a10">ChangeName()</a>.
473 <div class="fragment"><pre>00305 {
474 00306 <a class="code" href="message_8h.html#a10">ChangeName</a>(user,gecos.c_str());
479 <a name="a32" doxytag="Server::ChangeHost"></a><p>
480 <table width="100%" cellpadding="2" cellspacing="0" border="0">
483 <table cellpadding="0" cellspacing="0" border="0">
485 <td class="md" nowrap valign="top"> void Server::ChangeHost </td>
486 <td class="md" valign="top">( </td>
487 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
488 <td class="mdname" nowrap> <em>user</em>, </td>
493 <td class="md" nowrap>std::string </td>
494 <td class="mdname" nowrap> <em>host</em></td>
498 <td class="md">) </td>
499 <td class="md" colspan="2"><code> [virtual]</code></td>
506 <table cellspacing=5 cellpadding=0 border=0>
514 Change displayed hostname of a user.
516 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.
518 Definition at line <a class="el" href="modules_8cpp-source.html#l00299">299</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
520 References <a class="el" href="message_8h.html#a11">ChangeDisplayedHost()</a>.
522 <div class="fragment"><pre>00300 {
523 00301 <a class="code" href="message_8h.html#a11">ChangeDisplayedHost</a>(user,host.c_str());
528 <a name="a28" doxytag="Server::ChangeUserNick"></a><p>
529 <table width="100%" cellpadding="2" cellspacing="0" border="0">
532 <table cellpadding="0" cellspacing="0" border="0">
534 <td class="md" nowrap valign="top"> void Server::ChangeUserNick </td>
535 <td class="md" valign="top">( </td>
536 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
537 <td class="mdname" nowrap> <em>user</em>, </td>
542 <td class="md" nowrap>std::string </td>
543 <td class="mdname" nowrap> <em>nickname</em></td>
547 <td class="md">) </td>
548 <td class="md" colspan="2"><code> [virtual]</code></td>
555 <table cellspacing=5 cellpadding=0 border=0>
563 Forces a user nickchange.
565 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.
567 Definition at line <a class="el" href="modules_8cpp-source.html#l00200">200</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
569 <div class="fragment"><pre>00201 {
570 00202 force_nickchange(user,nickname.c_str());
575 <a name="a16" doxytag="Server::ChanMode"></a><p>
576 <table width="100%" cellpadding="2" cellspacing="0" border="0">
579 <table cellpadding="0" cellspacing="0" border="0">
581 <td class="md" nowrap valign="top"> std::string Server::ChanMode </td>
582 <td class="md" valign="top">( </td>
583 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
584 <td class="mdname" nowrap> <em>User</em>, </td>
589 <td class="md" nowrap><a class="el" href="classchanrec.html">chanrec</a> * </td>
590 <td class="mdname" nowrap> <em>Chan</em></td>
594 <td class="md">) </td>
595 <td class="md" colspan="2"><code> [virtual]</code></td>
602 <table cellspacing=5 cellpadding=0 border=0>
610 Attempts to look up a user's privilages on a channel.
612 This function will return a string containing either @, , +, or an empty string, representing the user's privilages upon the channel you specify.
614 Definition at line <a class="el" href="modules_8cpp-source.html#l00324">324</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
616 References <a class="el" href="message_8h.html#a14">cmode()</a>.
618 <div class="fragment"><pre>00325 {
619 00326 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a14">cmode</a>(User,Chan);
624 <a name="a9" doxytag="Server::CommonChannels"></a><p>
625 <table width="100%" cellpadding="2" cellspacing="0" border="0">
628 <table cellpadding="0" cellspacing="0" border="0">
630 <td class="md" nowrap valign="top"> bool Server::CommonChannels </td>
631 <td class="md" valign="top">( </td>
632 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
633 <td class="mdname" nowrap> <em>u1</em>, </td>
638 <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> * </td>
639 <td class="mdname" nowrap> <em>u2</em></td>
643 <td class="md">) </td>
644 <td class="md" colspan="2"><code> [virtual]</code></td>
651 <table cellspacing=5 cellpadding=0 border=0>
659 Returns true if two users share a common channel.
661 This method is used internally by the NICK and QUIT commands, and the <a class="el" href="classServer.html#a10">Server::SendCommon</a> method.
663 Definition at line <a class="el" href="modules_8cpp-source.html#l00277">277</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
665 References <a class="el" href="message_8h.html#a0">common_channels()</a>.
667 <div class="fragment"><pre>00278 {
668 00279 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a0">common_channels</a>(u1,u2) != 0);
673 <a name="a13" doxytag="Server::CountUsers"></a><p>
674 <table width="100%" cellpadding="2" cellspacing="0" border="0">
677 <table cellpadding="0" cellspacing="0" border="0">
679 <td class="md" nowrap valign="top"> int Server::CountUsers </td>
680 <td class="md" valign="top">( </td>
681 <td class="md" nowrap valign="top"><a class="el" href="classchanrec.html">chanrec</a> * </td>
682 <td class="mdname1" valign="top" nowrap> <em>c</em> </td>
683 <td class="md" valign="top">) </td>
684 <td class="md" nowrap><code> [virtual]</code></td>
691 <table cellspacing=5 cellpadding=0 border=0>
699 Returns a count of the number of users on a channel.
701 This will NEVER be 0, as if the chanrec exists, it will have at least one user in the channel.
703 Definition at line <a class="el" href="modules_8cpp-source.html#l00379">379</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
705 <div class="fragment"><pre>00380 {
706 00381 <span class="keywordflow">return</span> usercount(c);
711 <a name="a15" doxytag="Server::FindChannel"></a><p>
712 <table width="100%" cellpadding="2" cellspacing="0" border="0">
715 <table cellpadding="0" cellspacing="0" border="0">
717 <td class="md" nowrap valign="top"> <a class="el" href="classchanrec.html">chanrec</a> * Server::FindChannel </td>
718 <td class="md" valign="top">( </td>
719 <td class="md" nowrap valign="top">std::string </td>
720 <td class="mdname1" valign="top" nowrap> <em>channel</em> </td>
721 <td class="md" valign="top">) </td>
722 <td class="md" nowrap><code> [virtual]</code></td>
729 <table cellspacing=5 cellpadding=0 border=0>
737 Attempts to look up a channel and return a pointer to it.
739 This function will return NULL if the channel does not exist.
741 Definition at line <a class="el" href="modules_8cpp-source.html#l00319">319</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
743 <div class="fragment"><pre>00320 {
744 00321 <span class="keywordflow">return</span> FindChan(channel.c_str());
749 <a name="a14" doxytag="Server::FindNick"></a><p>
750 <table width="100%" cellpadding="2" cellspacing="0" border="0">
753 <table cellpadding="0" cellspacing="0" border="0">
755 <td class="md" nowrap valign="top"> <a class="el" href="classuserrec.html">userrec</a> * Server::FindNick </td>
756 <td class="md" valign="top">( </td>
757 <td class="md" nowrap valign="top">std::string </td>
758 <td class="mdname1" valign="top" nowrap> <em>nick</em> </td>
759 <td class="md" valign="top">) </td>
760 <td class="md" nowrap><code> [virtual]</code></td>
767 <table cellspacing=5 cellpadding=0 border=0>
775 Attempts to look up a nick and return a pointer to it.
777 This function will return NULL if the nick does not exist.
779 Definition at line <a class="el" href="modules_8cpp-source.html#l00314">314</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
781 <div class="fragment"><pre>00315 {
782 00316 <span class="keywordflow">return</span> Find(nick);
787 <a name="a20" doxytag="Server::GetAdmin"></a><p>
788 <table width="100%" cellpadding="2" cellspacing="0" border="0">
791 <table cellpadding="0" cellspacing="0" border="0">
793 <td class="md" nowrap valign="top"> <a class="el" href="classAdmin.html">Admin</a> Server::GetAdmin </td>
794 <td class="md" valign="top">( </td>
795 <td class="mdname1" valign="top" nowrap> </td>
796 <td class="md" valign="top">) </td>
797 <td class="md" nowrap><code> [virtual]</code></td>
804 <table cellspacing=5 cellpadding=0 border=0>
812 Returns the information of the server as returned by the /ADMIN command.
814 See the <a class="el" href="classAdmin.html">Admin</a> class for further information of the return value. The members <a class="el" href="classAdmin.html#m2">Admin::Nick</a>, <a class="el" href="classAdmin.html#m1">Admin::Email</a> and <a class="el" href="classAdmin.html#m0">Admin::Name</a> contain the information for the server where the module is loaded.
816 Definition at line <a class="el" href="modules_8cpp-source.html#l00344">344</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
818 <div class="fragment"><pre>00345 {
819 00346 <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick());
824 <a name="a19" doxytag="Server::GetNetworkName"></a><p>
825 <table width="100%" cellpadding="2" cellspacing="0" border="0">
828 <table cellpadding="0" cellspacing="0" border="0">
830 <td class="md" nowrap valign="top"> std::string Server::GetNetworkName </td>
831 <td class="md" valign="top">( </td>
832 <td class="mdname1" valign="top" nowrap> </td>
833 <td class="md" valign="top">) </td>
834 <td class="md" nowrap><code> [virtual]</code></td>
841 <table cellspacing=5 cellpadding=0 border=0>
849 Returns the network name, global to all linked servers.
853 Definition at line <a class="el" href="modules_8cpp-source.html#l00339">339</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
855 <div class="fragment"><pre>00340 {
856 00341 <span class="keywordflow">return</span> getnetworkname();
861 <a name="a18" doxytag="Server::GetServerName"></a><p>
862 <table width="100%" cellpadding="2" cellspacing="0" border="0">
865 <table cellpadding="0" cellspacing="0" border="0">
867 <td class="md" nowrap valign="top"> std::string Server::GetServerName </td>
868 <td class="md" valign="top">( </td>
869 <td class="mdname1" valign="top" nowrap> </td>
870 <td class="md" valign="top">) </td>
871 <td class="md" nowrap><code> [virtual]</code></td>
878 <table cellspacing=5 cellpadding=0 border=0>
886 Returns the server name of the server where the module is loaded.
890 Definition at line <a class="el" href="modules_8cpp-source.html#l00334">334</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
892 <div class="fragment"><pre>00335 {
893 00336 <span class="keywordflow">return</span> getservername();
898 <a name="a12" doxytag="Server::IsNick"></a><p>
899 <table width="100%" cellpadding="2" cellspacing="0" border="0">
902 <table cellpadding="0" cellspacing="0" border="0">
904 <td class="md" nowrap valign="top"> bool Server::IsNick </td>
905 <td class="md" valign="top">( </td>
906 <td class="md" nowrap valign="top">std::string </td>
907 <td class="mdname1" valign="top" nowrap> <em>nick</em> </td>
908 <td class="md" valign="top">) </td>
909 <td class="md" nowrap><code> [virtual]</code></td>
916 <table cellspacing=5 cellpadding=0 border=0>
924 Returns true if a nick is valid.
926 Nicks for unregistered connections will return false.
928 Definition at line <a class="el" href="modules_8cpp-source.html#l00309">309</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
930 References <a class="el" href="message_8h.html#a13">isnick()</a>.
932 <div class="fragment"><pre>00310 {
933 00311 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a13">isnick</a>(nick.c_str()) != 0);
938 <a name="a17" doxytag="Server::IsOnChannel"></a><p>
939 <table width="100%" cellpadding="2" cellspacing="0" border="0">
942 <table cellpadding="0" cellspacing="0" border="0">
944 <td class="md" nowrap valign="top"> bool Server::IsOnChannel </td>
945 <td class="md" valign="top">( </td>
946 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
947 <td class="mdname" nowrap> <em>User</em>, </td>
952 <td class="md" nowrap><a class="el" href="classchanrec.html">chanrec</a> * </td>
953 <td class="mdname" nowrap> <em>Chan</em></td>
957 <td class="md">) </td>
958 <td class="md" colspan="2"><code> [virtual]</code></td>
965 <table cellspacing=5 cellpadding=0 border=0>
973 Checks if a user is on a channel.
975 This function will return true or false to indicate if user 'User' is on channel 'Chan'.
977 Definition at line <a class="el" href="modules_8cpp-source.html#l00329">329</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
979 References <a class="el" href="message_8h.html#a16">has_channel()</a>.
981 <div class="fragment"><pre>00330 {
982 00331 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a16">has_channel</a>(User,Chan);
987 <a name="a34" doxytag="Server::IsUlined"></a><p>
988 <table width="100%" cellpadding="2" cellspacing="0" border="0">
991 <table cellpadding="0" cellspacing="0" border="0">
993 <td class="md" nowrap valign="top"> bool Server::IsUlined </td>
994 <td class="md" valign="top">( </td>
995 <td class="md" nowrap valign="top">std::string </td>
996 <td class="mdname1" valign="top" nowrap> <em>server</em> </td>
997 <td class="md" valign="top">) </td>
998 <td class="md" nowrap><code> [virtual]</code></td>
1005 <table cellspacing=5 cellpadding=0 border=0>
1013 Returns true if the servername you give is ulined.
1015 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.
1017 Definition at line <a class="el" href="modules_8cpp-source.html#l00211">211</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1019 References <a class="el" href="commands_8h.html#a70">is_uline()</a>.
1021 <div class="fragment"><pre>00212 {
1022 00213 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a70">is_uline</a>(server.c_str());
1027 <a name="a26" doxytag="Server::JoinUserToChannel"></a><p>
1028 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1031 <table cellpadding="0" cellspacing="0" border="0">
1033 <td class="md" nowrap valign="top"> <a class="el" href="classchanrec.html">chanrec</a> * Server::JoinUserToChannel </td>
1034 <td class="md" valign="top">( </td>
1035 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1036 <td class="mdname" nowrap> <em>user</em>, </td>
1041 <td class="md" nowrap>std::string </td>
1042 <td class="mdname" nowrap> <em>cname</em>, </td>
1047 <td class="md" nowrap>std::string </td>
1048 <td class="mdname" nowrap> <em>key</em></td>
1052 <td class="md">) </td>
1053 <td class="md" colspan="2"><code> [virtual]</code></td>
1060 <table cellspacing=5 cellpadding=0 border=0>
1068 Forces a user to join a channel.
1070 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.
1072 Definition at line <a class="el" href="modules_8cpp-source.html#l00190">190</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1074 <div class="fragment"><pre>00191 {
1075 00192 <span class="keywordflow">return</span> add_channel(user,cname.c_str(),key.c_str(),<span class="keyword">true</span>);
1080 <a name="a3" doxytag="Server::Log"></a><p>
1081 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1084 <table cellpadding="0" cellspacing="0" border="0">
1086 <td class="md" nowrap valign="top"> void Server::Log </td>
1087 <td class="md" valign="top">( </td>
1088 <td class="md" nowrap valign="top">int </td>
1089 <td class="mdname" nowrap> <em>level</em>, </td>
1094 <td class="md" nowrap>std::string </td>
1095 <td class="mdname" nowrap> <em>s</em></td>
1099 <td class="md">) </td>
1100 <td class="md" colspan="2"><code> [virtual]</code></td>
1107 <table cellspacing=5 cellpadding=0 border=0>
1115 Writes a log string.
1117 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.
1119 Definition at line <a class="el" href="modules_8cpp-source.html#l00221">221</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1121 <div class="fragment"><pre>00222 {
1122 00223 log(level,<span class="stringliteral">"%s"</span>,s.c_str());
1127 <a name="a30" doxytag="Server::MatchText"></a><p>
1128 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1131 <table cellpadding="0" cellspacing="0" border="0">
1133 <td class="md" nowrap valign="top"> bool Server::MatchText </td>
1134 <td class="md" valign="top">( </td>
1135 <td class="md" nowrap valign="top">std::string </td>
1136 <td class="mdname" nowrap> <em>sliteral</em>, </td>
1141 <td class="md" nowrap>std::string </td>
1142 <td class="mdname" nowrap> <em>spattern</em></td>
1146 <td class="md">) </td>
1147 <td class="md" colspan="2"><code> [virtual]</code></td>
1154 <table cellspacing=5 cellpadding=0 border=0>
1162 Matches text against a glob pattern.
1164 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.
1166 Definition at line <a class="el" href="modules_8cpp-source.html#l00177">177</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1168 <div class="fragment"><pre>00178 {
1169 00179 <span class="keywordtype">char</span> literal[MAXBUF],pattern[MAXBUF];
1170 00180 strncpy(literal,sliteral.c_str(),MAXBUF);
1171 00181 strncpy(pattern,spattern.c_str(),MAXBUF);
1172 00182 <span class="keywordflow">return</span> match(literal,pattern);
1177 <a name="a27" doxytag="Server::PartUserFromChannel"></a><p>
1178 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1181 <table cellpadding="0" cellspacing="0" border="0">
1183 <td class="md" nowrap valign="top"> <a class="el" href="classchanrec.html">chanrec</a> * Server::PartUserFromChannel </td>
1184 <td class="md" valign="top">( </td>
1185 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1186 <td class="mdname" nowrap> <em>user</em>, </td>
1191 <td class="md" nowrap>std::string </td>
1192 <td class="mdname" nowrap> <em>cname</em>, </td>
1197 <td class="md" nowrap>std::string </td>
1198 <td class="mdname" nowrap> <em>reason</em></td>
1202 <td class="md">) </td>
1203 <td class="md" colspan="2"><code> [virtual]</code></td>
1210 <table cellspacing=5 cellpadding=0 border=0>
1218 Forces a user to part a channel.
1220 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.
1222 Definition at line <a class="el" href="modules_8cpp-source.html#l00195">195</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1224 <div class="fragment"><pre>00196 {
1225 00197 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>);
1230 <a name="a29" doxytag="Server::QuitUser"></a><p>
1231 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1234 <table cellpadding="0" cellspacing="0" border="0">
1236 <td class="md" nowrap valign="top"> void Server::QuitUser </td>
1237 <td class="md" valign="top">( </td>
1238 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1239 <td class="mdname" nowrap> <em>user</em>, </td>
1244 <td class="md" nowrap>std::string </td>
1245 <td class="mdname" nowrap> <em>reason</em></td>
1249 <td class="md">) </td>
1250 <td class="md" colspan="2"><code> [virtual]</code></td>
1257 <table cellspacing=5 cellpadding=0 border=0>
1265 Forces a user to quit with the specified reason.
1267 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.<p>
1269 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.
1271 Definition at line <a class="el" href="modules_8cpp-source.html#l00205">205</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1273 References <a class="el" href="users_8h-source.html#l00091">userrec::nick</a>, and <a class="el" href="message_8h.html#a19">send_network_quit()</a>.
1275 <div class="fragment"><pre>00206 {
1276 00207 <a class="code" href="message_8h.html#a19">send_network_quit</a>(user-><a class="code" href="classuserrec.html#m0">nick</a>,reason.c_str());
1277 00208 kill_link(user,reason.c_str());
1282 <a name="a4" doxytag="Server::Send"></a><p>
1283 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1286 <table cellpadding="0" cellspacing="0" border="0">
1288 <td class="md" nowrap valign="top"> void Server::Send </td>
1289 <td class="md" valign="top">( </td>
1290 <td class="md" nowrap valign="top">int </td>
1291 <td class="mdname" nowrap> <em>Socket</em>, </td>
1296 <td class="md" nowrap>std::string </td>
1297 <td class="mdname" nowrap> <em>s</em></td>
1301 <td class="md">) </td>
1302 <td class="md" colspan="2"><code> [virtual]</code></td>
1309 <table cellspacing=5 cellpadding=0 border=0>
1317 Sends a line of text down a TCP/IP socket.
1319 This method writes a line of text to an established socket, cutting it to 510 characters plus a carriage return and linefeed if required.
1321 Definition at line <a class="el" href="modules_8cpp-source.html#l00236">236</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1323 <div class="fragment"><pre>00237 {
1324 00238 Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str());
1329 <a name="a8" doxytag="Server::SendChannel"></a><p>
1330 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1333 <table cellpadding="0" cellspacing="0" border="0">
1335 <td class="md" nowrap valign="top"> void Server::SendChannel </td>
1336 <td class="md" valign="top">( </td>
1337 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1338 <td class="mdname" nowrap> <em>User</em>, </td>
1343 <td class="md" nowrap><a class="el" href="classchanrec.html">chanrec</a> * </td>
1344 <td class="mdname" nowrap> <em>Channel</em>, </td>
1349 <td class="md" nowrap>std::string </td>
1350 <td class="mdname" nowrap> <em>s</em>, </td>
1355 <td class="md" nowrap>bool </td>
1356 <td class="mdname" nowrap> <em>IncludeSender</em></td>
1360 <td class="md">) </td>
1361 <td class="md" colspan="2"><code> [virtual]</code></td>
1368 <table cellspacing=5 cellpadding=0 border=0>
1376 Sends text from a user to a channel (mulicast).
1378 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).
1380 Definition at line <a class="el" href="modules_8cpp-source.html#l00265">265</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1382 <div class="fragment"><pre>00266 {
1383 00267 <span class="keywordflow">if</span> (IncludeSender)
1385 00269 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str());
1387 00271 <span class="keywordflow">else</span>
1389 00273 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str());
1395 <a name="a10" doxytag="Server::SendCommon"></a><p>
1396 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1399 <table cellpadding="0" cellspacing="0" border="0">
1401 <td class="md" nowrap valign="top"> void Server::SendCommon </td>
1402 <td class="md" valign="top">( </td>
1403 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1404 <td class="mdname" nowrap> <em>User</em>, </td>
1409 <td class="md" nowrap>std::string </td>
1410 <td class="mdname" nowrap> <em>text</em>, </td>
1415 <td class="md" nowrap>bool </td>
1416 <td class="mdname" nowrap> <em>IncludeSender</em></td>
1420 <td class="md">) </td>
1421 <td class="md" colspan="2"><code> [virtual]</code></td>
1428 <table cellspacing=5 cellpadding=0 border=0>
1436 Sends text from a user to one or more channels (mulicast).
1438 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.
1440 Definition at line <a class="el" href="modules_8cpp-source.html#l00282">282</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1442 <div class="fragment"><pre>00283 {
1443 00284 <span class="keywordflow">if</span> (IncludeSender)
1445 00286 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str());
1447 00288 <span class="keywordflow">else</span>
1449 00290 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str());
1455 <a name="a6" doxytag="Server::SendFrom"></a><p>
1456 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1459 <table cellpadding="0" cellspacing="0" border="0">
1461 <td class="md" nowrap valign="top"> void Server::SendFrom </td>
1462 <td class="md" valign="top">( </td>
1463 <td class="md" nowrap valign="top">int </td>
1464 <td class="mdname" nowrap> <em>Socket</em>, </td>
1469 <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> * </td>
1470 <td class="mdname" nowrap> <em>User</em>, </td>
1475 <td class="md" nowrap>std::string </td>
1476 <td class="mdname" nowrap> <em>s</em></td>
1480 <td class="md">) </td>
1481 <td class="md" colspan="2"><code> [virtual]</code></td>
1488 <table cellspacing=5 cellpadding=0 border=0>
1496 Sends text from a user to a socket.
1498 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)
1500 Definition at line <a class="el" href="modules_8cpp-source.html#l00246">246</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1502 <div class="fragment"><pre>00247 {
1503 00248 WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str());
1508 <a name="a24" doxytag="Server::SendMode"></a><p>
1509 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1512 <table cellpadding="0" cellspacing="0" border="0">
1514 <td class="md" nowrap valign="top"> void Server::SendMode </td>
1515 <td class="md" valign="top">( </td>
1516 <td class="md" nowrap valign="top">char ** </td>
1517 <td class="mdname" nowrap> <em>parameters</em>, </td>
1522 <td class="md" nowrap>int </td>
1523 <td class="mdname" nowrap> <em>pcnt</em>, </td>
1528 <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> * </td>
1529 <td class="mdname" nowrap> <em>user</em></td>
1533 <td class="md">) </td>
1534 <td class="md" colspan="2"><code> [virtual]</code></td>
1541 <table cellspacing=5 cellpadding=0 border=0>
1551 you must format the parameters array with the target, modes and parameters for those modes.<p>
1554 modes[0] = ChannelName;<p>
1556 modes[2] = user->nick;<p>
1557 Srv->SendMode(modes,3,user);<p>
1558 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!
1560 Definition at line <a class="el" href="modules_8cpp-source.html#l00231">231</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1562 References <a class="el" href="modules_8h.html#a26">server_mode()</a>.
1564 <div class="fragment"><pre>00232 {
1565 00233 <a class="code" href="modules_8h.html#a26">server_mode</a>(parameters,pcnt,user);
1570 <a name="a2" doxytag="Server::SendOpers"></a><p>
1571 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1574 <table cellpadding="0" cellspacing="0" border="0">
1576 <td class="md" nowrap valign="top"> void Server::SendOpers </td>
1577 <td class="md" valign="top">( </td>
1578 <td class="md" nowrap valign="top">std::string </td>
1579 <td class="mdname1" valign="top" nowrap> <em>s</em> </td>
1580 <td class="md" valign="top">) </td>
1581 <td class="md" nowrap><code> [virtual]</code></td>
1588 <table cellspacing=5 cellpadding=0 border=0>
1596 Sends text to all opers.
1598 This method sends a server notice to all opers with the usermode +s.
1600 Definition at line <a class="el" href="modules_8cpp-source.html#l00172">172</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1602 <div class="fragment"><pre>00173 {
1603 00174 WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str());
1608 <a name="a5" doxytag="Server::SendServ"></a><p>
1609 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1612 <table cellpadding="0" cellspacing="0" border="0">
1614 <td class="md" nowrap valign="top"> void Server::SendServ </td>
1615 <td class="md" valign="top">( </td>
1616 <td class="md" nowrap valign="top">int </td>
1617 <td class="mdname" nowrap> <em>Socket</em>, </td>
1622 <td class="md" nowrap>std::string </td>
1623 <td class="mdname" nowrap> <em>s</em></td>
1627 <td class="md">) </td>
1628 <td class="md" colspan="2"><code> [virtual]</code></td>
1635 <table cellspacing=5 cellpadding=0 border=0>
1643 Sends text from the server to a socket.
1645 This method writes a line of text to an established socket, with the servername prepended as used by numerics (see RFC 1459)
1647 Definition at line <a class="el" href="modules_8cpp-source.html#l00241">241</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1649 <div class="fragment"><pre>00242 {
1650 00243 WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str());
1655 <a name="a7" doxytag="Server::SendTo"></a><p>
1656 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1659 <table cellpadding="0" cellspacing="0" border="0">
1661 <td class="md" nowrap valign="top"> void Server::SendTo </td>
1662 <td class="md" valign="top">( </td>
1663 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1664 <td class="mdname" nowrap> <em>Source</em>, </td>
1669 <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> * </td>
1670 <td class="mdname" nowrap> <em>Dest</em>, </td>
1675 <td class="md" nowrap>std::string </td>
1676 <td class="mdname" nowrap> <em>s</em></td>
1680 <td class="md">) </td>
1681 <td class="md" colspan="2"><code> [virtual]</code></td>
1688 <table cellspacing=5 cellpadding=0 border=0>
1696 Sends text from a user to another user.
1698 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:<p>
1700 The format will become:<p>
1701 :localserver TEXT<p>
1702 Which is useful for numerics and server notices to single users, etc.
1704 Definition at line <a class="el" href="modules_8cpp-source.html#l00251">251</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1706 References <a class="el" href="connection_8h-source.html#l00166">connection::fd</a>.
1708 <div class="fragment"><pre>00252 {
1709 00253 <span class="keywordflow">if</span> (!Source)
1711 00255 <span class="comment">// if source is NULL, then the message originates from the local server</span>
1712 00256 Write(Dest-><a class="code" href="classconnection.html#m0">fd</a>,<span class="stringliteral">":%s %s"</span>,this->GetServerName().c_str(),s.c_str());
1714 00258 <span class="keywordflow">else</span>
1716 00260 <span class="comment">// otherwise it comes from the user specified</span>
1717 00261 WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str());
1723 <a name="a25" doxytag="Server::SendToModeMask"></a><p>
1724 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1727 <table cellpadding="0" cellspacing="0" border="0">
1729 <td class="md" nowrap valign="top"> void Server::SendToModeMask </td>
1730 <td class="md" valign="top">( </td>
1731 <td class="md" nowrap valign="top">std::string </td>
1732 <td class="mdname" nowrap> <em>modes</em>, </td>
1737 <td class="md" nowrap>int </td>
1738 <td class="mdname" nowrap> <em>flags</em>, </td>
1743 <td class="md" nowrap>std::string </td>
1744 <td class="mdname" nowrap> <em>text</em></td>
1748 <td class="md">) </td>
1749 <td class="md" colspan="2"><code> [virtual]</code></td>
1756 <table cellspacing=5 cellpadding=0 border=0>
1764 Sends to all users matching a mode mask You must specify one or more usermodes as the first parameter.
1766 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:<p>
1767 Serv->SendToModeMask("xi", WM_OR, "m00");<p>
1768 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.
1770 Definition at line <a class="el" href="modules_8cpp-source.html#l00185">185</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1772 <div class="fragment"><pre>00186 {
1773 00187 WriteMode(modes.c_str(),flags,<span class="stringliteral">"%s"</span>,text.c_str());
1778 <a name="a11" doxytag="Server::SendWallops"></a><p>
1779 <table width="100%" cellpadding="2" cellspacing="0" border="0">
1782 <table cellpadding="0" cellspacing="0" border="0">
1784 <td class="md" nowrap valign="top"> void Server::SendWallops </td>
1785 <td class="md" valign="top">( </td>
1786 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1787 <td class="mdname" nowrap> <em>User</em>, </td>
1792 <td class="md" nowrap>std::string </td>
1793 <td class="mdname" nowrap> <em>text</em></td>
1797 <td class="md">) </td>
1798 <td class="md" colspan="2"><code> [virtual]</code></td>
1805 <table cellspacing=5 cellpadding=0 border=0>
1813 Sends a WALLOPS message.
1815 This method writes a WALLOPS message to all users with the +w flag, originating from the specified user.
1817 Definition at line <a class="el" href="modules_8cpp-source.html#l00294">294</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1819 <div class="fragment"><pre>00295 {
1820 00296 WriteWallOps(User,<span class="keyword">false</span>,<span class="stringliteral">"%s"</span>,text.c_str());
1825 <hr>The documentation for this class was generated from the following files:<ul>
1826 <li><a class="el" href="modules_8h-source.html">modules.h</a><li><a class="el" href="modules_8cpp-source.html">modules.cpp</a></ul>
1827 <hr><address style="align: right;"><small>Generated on Sat May 1 13:39:24 2004 for InspIRCd by
1828 <a href="http://www.doxygen.org/index.html">
1829 <img src="doxygen.png" alt="doxygen" align="middle" border=0
1830 width=110 height=53></a>1.3-rc3 </small></address>