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>InspIRCd: Server class Reference</title>
4 <link href="inspircd.css" rel="stylesheet" type="text/css">
6 <!-- Generated by Doxygen 1.3.3 -->
7 <div class="qindex"><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></div>
8 <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.
9 <a href="#_details">More...</a>
11 <code>#include <<a class="el" href="modules_8h-source.html">modules.h</a>></code>
13 Inherits <a class="el" href="classclassbase.html">classbase</a>.
15 <a href="classServer-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
17 <tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
18 <tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a0">Server</a> ()</td></tr>
20 <tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. </em> <a href="#a0"></a><em><br><br></td></tr>
21 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a1">~Server</a> ()</td></tr>
23 <tr><td class="mdescLeft"> </td><td class="mdescRight">Default destructor. </em> <a href="#a1"></a><em><br><br></td></tr>
24 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a2">SendOpers</a> (std::string s)</td></tr>
26 <tr><td class="mdescLeft"> </td><td class="mdescRight">Sends text to all opers. </em> <a href="#a2"></a><em><br><br></td></tr>
27 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a3">Log</a> (int level, std::string s)</td></tr>
29 <tr><td class="mdescLeft"> </td><td class="mdescRight">Writes a log string. </em> <a href="#a3"></a><em><br><br></td></tr>
30 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a4">Send</a> (int Socket, std::string s)</td></tr>
32 <tr><td class="mdescLeft"> </td><td class="mdescRight">Sends a line of text down a TCP/IP socket. </em> <a href="#a4"></a><em><br><br></td></tr>
33 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a5">SendServ</a> (int Socket, std::string s)</td></tr>
35 <tr><td class="mdescLeft"> </td><td class="mdescRight">Sends text from the server to a socket. </em> <a href="#a5"></a><em><br><br></td></tr>
36 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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 class="mdescLeft"> </td><td class="mdescRight">Sends text from a user to a socket. </em> <a href="#a6"></a><em><br><br></td></tr>
39 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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>
41 <tr><td class="mdescLeft"> </td><td class="mdescRight">Sends text from a user to another user. </em> <a href="#a7"></a><em><br><br></td></tr>
42 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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>
44 <tr><td class="mdescLeft"> </td><td class="mdescRight">Sends text from a user to a channel (mulicast). </em> <a href="#a8"></a><em><br><br></td></tr>
45 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool </td><td class="memItemRight" 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>
47 <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true if two users share a common channel. </em> <a href="#a9"></a><em><br><br></td></tr>
48 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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>
50 <tr><td class="mdescLeft"> </td><td class="mdescRight">Sends text from a user to one or more channels (mulicast). </em> <a href="#a10"></a><em><br><br></td></tr>
51 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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>
53 <tr><td class="mdescLeft"> </td><td class="mdescRight">Sends a WALLOPS message. </em> <a href="#a11"></a><em><br><br></td></tr>
54 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a12">IsNick</a> (std::string nick)</td></tr>
56 <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true if a nick is valid. </em> <a href="#a12"></a><em><br><br></td></tr>
57 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual int </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a13">CountUsers</a> (<a class="el" href="classchanrec.html">chanrec</a> *c)</td></tr>
59 <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a count of the number of users on a channel. </em> <a href="#a13"></a><em><br><br></td></tr>
60 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="classuserrec.html">userrec</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a14">FindNick</a> (std::string nick)</td></tr>
62 <tr><td class="mdescLeft"> </td><td class="mdescRight">Attempts to look up a nick and return a pointer to it. </em> <a href="#a14"></a><em><br><br></td></tr>
63 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="classchanrec.html">chanrec</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a15">FindChannel</a> (std::string channel)</td></tr>
65 <tr><td class="mdescLeft"> </td><td class="mdescRight">Attempts to look up a channel and return a pointer to it. </em> <a href="#a15"></a><em><br><br></td></tr>
66 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual std::string </td><td class="memItemRight" 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>
68 <tr><td class="mdescLeft"> </td><td class="mdescRight">Attempts to look up a user's privilages on a channel. </em> <a href="#a16"></a><em><br><br></td></tr>
69 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool </td><td class="memItemRight" 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>
71 <tr><td class="mdescLeft"> </td><td class="mdescRight">Checks if a user is on a channel. </em> <a href="#a17"></a><em><br><br></td></tr>
72 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual std::string </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a18">GetServerName</a> ()</td></tr>
74 <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the server name of the server where the module is loaded. </em> <a href="#a18"></a><em><br><br></td></tr>
75 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual std::string </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a19">GetNetworkName</a> ()</td></tr>
77 <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the network name, global to all linked servers. </em> <a href="#a19"></a><em><br><br></td></tr>
78 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="classAdmin.html">Admin</a> </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a20">GetAdmin</a> ()</td></tr>
80 <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the information of the server as returned by the /ADMIN command. </em> <a href="#a20"></a><em><br><br></td></tr>
81 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool </td><td class="memItemRight" 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>
83 <tr><td class="mdescLeft"> </td><td class="mdescRight">Adds an extended mode letter which is parsed by a module. </em> <a href="#a21"></a><em><br><br></td></tr>
84 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a22">AddExtendedListMode</a> (char modechar)</td></tr>
86 <tr><td class="mdescLeft"> </td><td class="mdescRight">Adds an extended mode letter which is parsed by a module and handled in a list fashion. </em> <a href="#a22"></a><em><br><br></td></tr>
87 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a23">AddCommand</a> (char *cmd, handlerfunc f, char flags, int minparams)</td></tr>
89 <tr><td class="mdescLeft"> </td><td class="mdescRight">Adds a command to the command table. </em> <a href="#a23"></a><em><br><br></td></tr>
90 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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>
92 <tr><td class="mdescLeft"> </td><td class="mdescRight">Sends a servermode. </em> <a href="#a24"></a><em><br><br></td></tr>
93 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a25">SendToModeMask</a> (std::string modes, int flags, std::string text)</td></tr>
95 <tr><td class="mdescLeft"> </td><td class="mdescRight">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><br><br></td></tr>
96 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="classchanrec.html">chanrec</a> * </td><td class="memItemRight" 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>
98 <tr><td class="mdescLeft"> </td><td class="mdescRight">Forces a user to join a channel. </em> <a href="#a26"></a><em><br><br></td></tr>
99 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="classchanrec.html">chanrec</a> * </td><td class="memItemRight" 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>
101 <tr><td class="mdescLeft"> </td><td class="mdescRight">Forces a user to part a channel. </em> <a href="#a27"></a><em><br><br></td></tr>
102 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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>
104 <tr><td class="mdescLeft"> </td><td class="mdescRight">Forces a user nickchange. </em> <a href="#a28"></a><em><br><br></td></tr>
105 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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>
107 <tr><td class="mdescLeft"> </td><td class="mdescRight">Forces a user to quit with the specified reason. </em> <a href="#a29"></a><em><br><br></td></tr>
108 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a30">MatchText</a> (std::string sliteral, std::string spattern)</td></tr>
110 <tr><td class="mdescLeft"> </td><td class="mdescRight">Matches text against a glob pattern. </em> <a href="#a30"></a><em><br><br></td></tr>
111 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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>
113 <tr><td class="mdescLeft"> </td><td class="mdescRight">Calls the handler for a command, either implemented by the core or by another module. </em> <a href="#a31"></a><em><br><br></td></tr>
114 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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>
116 <tr><td class="mdescLeft"> </td><td class="mdescRight">Change displayed hostname of a user. </em> <a href="#a32"></a><em><br><br></td></tr>
117 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" 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>
119 <tr><td class="mdescLeft"> </td><td class="mdescRight">Change GECOS (fullname) of a user. </em> <a href="#a33"></a><em><br><br></td></tr>
120 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a34">IsUlined</a> (std::string server)</td></tr>
122 <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true if the servername you give is ulined. </em> <a href="#a34"></a><em><br><br></td></tr>
123 <tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="modules_8h.html#a28">chanuserlist</a> </td><td class="memItemRight" valign=bottom><a class="el" href="classServer.html#a35">GetUsers</a> (<a class="el" href="classchanrec.html">chanrec</a> *chan)</td></tr>
125 <tr><td class="mdescLeft"> </td><td class="mdescRight">Fetches the userlist of a channel. </em> <a href="#a35"></a><em><br><br></td></tr>
127 <hr><a name="_details"></a><h2>Detailed Description</h2>
128 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.
130 All modules should instantiate at least one copy of this class, and use its member functions to perform their tasks.
134 Definition at line <a class="el" href="modules_8h-source.html#l00371">371</a> of file <a class="el" href="modules_8h-source.html">modules.h</a>.<hr><h2>Constructor & Destructor Documentation</h2>
135 <a name="a0" doxytag="Server::Server"></a><p>
136 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
139 <table cellpadding="0" cellspacing="0" border="0">
141 <td class="md" nowrap valign="top"> Server::Server </td>
142 <td class="md" valign="top">( </td>
143 <td class="mdname1" valign="top" nowrap> </td>
144 <td class="md" valign="top"> ) </td>
145 <td class="md" nowrap></td>
152 <table cellspacing=5 cellpadding=0 border=0>
162 Creates a Server object.
164 Definition at line <a class="el" href="modules_8cpp-source.html#l00337">337</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
166 <div class="fragment"><pre>00338 {
171 <a name="a1" doxytag="Server::~Server"></a><p>
172 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
175 <table cellpadding="0" cellspacing="0" border="0">
177 <td class="md" nowrap valign="top"> Server::~<a class="el" href="classServer.html">Server</a> </td>
178 <td class="md" valign="top">( </td>
179 <td class="mdname1" valign="top" nowrap> </td>
180 <td class="md" valign="top"> ) </td>
181 <td class="md" nowrap><code> [virtual]</code></td>
188 <table cellspacing=5 cellpadding=0 border=0>
198 Destroys a Server object.
200 Definition at line <a class="el" href="modules_8cpp-source.html#l00341">341</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
202 <div class="fragment"><pre>00342 {
207 <hr><h2>Member Function Documentation</h2>
208 <a name="a23" doxytag="Server::AddCommand"></a><p>
209 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
212 <table cellpadding="0" cellspacing="0" border="0">
214 <td class="md" nowrap valign="top"> void Server::AddCommand </td>
215 <td class="md" valign="top">( </td>
216 <td class="md" nowrap valign="top">char * </td>
217 <td class="mdname" nowrap> <em>cmd</em>, </td>
222 <td class="md" nowrap>handlerfunc </td>
223 <td class="mdname" nowrap> <em>f</em>, </td>
228 <td class="md" nowrap>char </td>
229 <td class="mdname" nowrap> <em>flags</em>, </td>
234 <td class="md" nowrap>int </td>
235 <td class="mdname" nowrap> <em>minparams</em></td>
239 <td class="md">) </td>
240 <td class="md" colspan="2"><code> [virtual]</code></td>
247 <table cellspacing=5 cellpadding=0 border=0>
255 Adds a command to the command table.
257 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>
258 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>
259 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'.
261 Definition at line <a class="el" href="modules_8cpp-source.html#l00418">418</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
263 References <a class="el" href="modules_8h.html#a30">createcommand()</a>.
265 <div class="fragment"><pre>00419 {
266 00420 <a class="code" href="modules_8h.html#a30">createcommand</a>(cmd,f,flags,minparams);
271 <a name="a22" doxytag="Server::AddExtendedListMode"></a><p>
272 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
275 <table cellpadding="0" cellspacing="0" border="0">
277 <td class="md" nowrap valign="top"> bool Server::AddExtendedListMode </td>
278 <td class="md" valign="top">( </td>
279 <td class="md" nowrap valign="top">char </td>
280 <td class="mdname1" valign="top" nowrap> <em>modechar</em> </td>
281 <td class="md" valign="top"> ) </td>
282 <td class="md" nowrap><code> [virtual]</code></td>
289 <table cellspacing=5 cellpadding=0 border=0>
297 Adds an extended mode letter which is parsed by a module and handled in a list fashion.
299 This call is used to implement modes like +q and +a. The characteristics of these modes are as follows:<p>
300 (1) They are ALWAYS on channels, not on users, therefore their type is MT_CHANNEL<p>
301 (2) They always take exactly one parameter when being added or removed<p>
302 (3) They can be set multiple times, usually on users in channels<p>
303 (4) The mode and its parameter are NOT stored in the channels modes structure<p>
304 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.
306 Definition at line <a class="el" href="modules_8cpp-source.html#l00563">563</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
308 References <a class="el" href="modules_8cpp-source.html#l00273">DoAddExtendedMode()</a>, <a class="el" href="modules_8cpp-source.html#l00283">ModeMakeList()</a>, and <a class="el" href="modules_8h-source.html#l00031">MT_CHANNEL</a>.
310 <div class="fragment"><pre>00564 {
311 00565 <span class="keywordtype">bool</span> res = <a class="code" href="modules_8cpp.html#a56">DoAddExtendedMode</a>(modechar,MT_CHANNEL,<span class="keyword">false</span>,1,1);
312 00566 <span class="keywordflow">if</span> (res)
313 00567 <a class="code" href="modules_8cpp.html#a57">ModeMakeList</a>(modechar);
314 00568 <span class="keywordflow">return</span> res;
319 <a name="a21" doxytag="Server::AddExtendedMode"></a><p>
320 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
323 <table cellpadding="0" cellspacing="0" border="0">
325 <td class="md" nowrap valign="top"> bool Server::AddExtendedMode </td>
326 <td class="md" valign="top">( </td>
327 <td class="md" nowrap valign="top">char </td>
328 <td class="mdname" nowrap> <em>modechar</em>, </td>
333 <td class="md" nowrap>int </td>
334 <td class="mdname" nowrap> <em>type</em>, </td>
339 <td class="md" nowrap>bool </td>
340 <td class="mdname" nowrap> <em>requires_oper</em>, </td>
345 <td class="md" nowrap>int </td>
346 <td class="mdname" nowrap> <em>params_when_on</em>, </td>
351 <td class="md" nowrap>int </td>
352 <td class="mdname" nowrap> <em>params_when_off</em></td>
356 <td class="md">) </td>
357 <td class="md" colspan="2"><code> [virtual]</code></td>
364 <table cellspacing=5 cellpadding=0 border=0>
372 Adds an extended mode letter which is parsed by a module.
374 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.
376 Definition at line <a class="el" href="modules_8cpp-source.html#l00543">543</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
378 References <a class="el" href="modules_8h-source.html#l00023">DEBUG</a>, <a class="el" href="modules_8cpp-source.html#l00273">DoAddExtendedMode()</a>, <a class="el" href="modules_8h-source.html#l00032">MT_CLIENT</a>, and <a class="el" href="modules_8h-source.html#l00033">MT_SERVER</a>.
380 <div class="fragment"><pre>00544 {
381 00545 <span class="keywordflow">if</span> (type == <a class="code" href="modules_8h.html#a7">MT_SERVER</a>)
383 00547 log(DEBUG,<span class="stringliteral">"*** API ERROR *** Modes of type MT_SERVER are reserved for future expansion"</span>);
384 00548 <span class="keywordflow">return</span> <span class="keyword">false</span>;
386 00550 <span class="keywordflow">if</span> (((params_when_on>0) || (params_when_off>0)) && (type == <a class="code" href="modules_8h.html#a6">MT_CLIENT</a>))
388 00552 log(DEBUG,<span class="stringliteral">"*** API ERROR *** Parameters on MT_CLIENT modes are not supported"</span>);
389 00553 <span class="keywordflow">return</span> <span class="keyword">false</span>;
391 00555 <span class="keywordflow">if</span> ((params_when_on>1) || (params_when_off>1))
393 00557 log(DEBUG,<span class="stringliteral">"*** API ERROR *** More than one parameter for an MT_CHANNEL mode is not yet supported"</span>);
394 00558 <span class="keywordflow">return</span> <span class="keyword">false</span>;
396 00560 <span class="keywordflow">return</span> <a class="code" href="modules_8cpp.html#a56">DoAddExtendedMode</a>(modechar,type,requires_oper,params_when_on,params_when_off);
401 <a name="a31" doxytag="Server::CallCommandHandler"></a><p>
402 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
405 <table cellpadding="0" cellspacing="0" border="0">
407 <td class="md" nowrap valign="top"> void Server::CallCommandHandler </td>
408 <td class="md" valign="top">( </td>
409 <td class="md" nowrap valign="top">std::string </td>
410 <td class="mdname" nowrap> <em>commandname</em>, </td>
415 <td class="md" nowrap>char ** </td>
416 <td class="mdname" nowrap> <em>parameters</em>, </td>
421 <td class="md" nowrap>int </td>
422 <td class="mdname" nowrap> <em>pcnt</em>, </td>
427 <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> * </td>
428 <td class="mdname" nowrap> <em>user</em></td>
432 <td class="md">) </td>
433 <td class="md" colspan="2"><code> [virtual]</code></td>
440 <table cellspacing=5 cellpadding=0 border=0>
448 Calls the handler for a command, either implemented by the core or by another module.
450 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>
451 ) 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.
453 Definition at line <a class="el" href="modules_8cpp-source.html#l00408">408</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
455 <div class="fragment"><pre>00409 {
456 00410 call_handler(commandname.c_str(),parameters,pcnt,user);
461 <a name="a33" doxytag="Server::ChangeGECOS"></a><p>
462 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
465 <table cellpadding="0" cellspacing="0" border="0">
467 <td class="md" nowrap valign="top"> void Server::ChangeGECOS </td>
468 <td class="md" valign="top">( </td>
469 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
470 <td class="mdname" nowrap> <em>user</em>, </td>
475 <td class="md" nowrap>std::string </td>
476 <td class="mdname" nowrap> <em>gecos</em></td>
480 <td class="md">) </td>
481 <td class="md" colspan="2"><code> [virtual]</code></td>
488 <table cellspacing=5 cellpadding=0 border=0>
496 Change GECOS (fullname) of a user.
498 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.
500 Definition at line <a class="el" href="modules_8cpp-source.html#l00496">496</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
502 References <a class="el" href="message_8h.html#a10">ChangeName()</a>.
504 <div class="fragment"><pre>00497 {
505 00498 <a class="code" href="message_8h.html#a10">ChangeName</a>(user,gecos.c_str());
510 <a name="a32" doxytag="Server::ChangeHost"></a><p>
511 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
514 <table cellpadding="0" cellspacing="0" border="0">
516 <td class="md" nowrap valign="top"> void Server::ChangeHost </td>
517 <td class="md" valign="top">( </td>
518 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
519 <td class="mdname" nowrap> <em>user</em>, </td>
524 <td class="md" nowrap>std::string </td>
525 <td class="mdname" nowrap> <em>host</em></td>
529 <td class="md">) </td>
530 <td class="md" colspan="2"><code> [virtual]</code></td>
537 <table cellspacing=5 cellpadding=0 border=0>
545 Change displayed hostname of a user.
547 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.
549 Definition at line <a class="el" href="modules_8cpp-source.html#l00491">491</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
551 References <a class="el" href="message_8h.html#a11">ChangeDisplayedHost()</a>.
553 <div class="fragment"><pre>00492 {
554 00493 <a class="code" href="message_8h.html#a11">ChangeDisplayedHost</a>(user,host.c_str());
559 <a name="a28" doxytag="Server::ChangeUserNick"></a><p>
560 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
563 <table cellpadding="0" cellspacing="0" border="0">
565 <td class="md" nowrap valign="top"> void Server::ChangeUserNick </td>
566 <td class="md" valign="top">( </td>
567 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
568 <td class="mdname" nowrap> <em>user</em>, </td>
573 <td class="md" nowrap>std::string </td>
574 <td class="mdname" nowrap> <em>nickname</em></td>
578 <td class="md">) </td>
579 <td class="md" colspan="2"><code> [virtual]</code></td>
586 <table cellspacing=5 cellpadding=0 border=0>
594 Forces a user nickchange.
596 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.
598 Definition at line <a class="el" href="modules_8cpp-source.html#l00392">392</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
600 <div class="fragment"><pre>00393 {
601 00394 force_nickchange(user,nickname.c_str());
606 <a name="a16" doxytag="Server::ChanMode"></a><p>
607 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
610 <table cellpadding="0" cellspacing="0" border="0">
612 <td class="md" nowrap valign="top"> std::string Server::ChanMode </td>
613 <td class="md" valign="top">( </td>
614 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
615 <td class="mdname" nowrap> <em>User</em>, </td>
620 <td class="md" nowrap><a class="el" href="classchanrec.html">chanrec</a> * </td>
621 <td class="mdname" nowrap> <em>Chan</em></td>
625 <td class="md">) </td>
626 <td class="md" colspan="2"><code> [virtual]</code></td>
633 <table cellspacing=5 cellpadding=0 border=0>
641 Attempts to look up a user's privilages on a channel.
643 This function will return a string containing either @, , +, or an empty string, representing the user's privilages upon the channel you specify.
645 Definition at line <a class="el" href="modules_8cpp-source.html#l00516">516</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
647 References <a class="el" href="message_8h.html#a14">cmode()</a>.
649 <div class="fragment"><pre>00517 {
650 00518 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a14">cmode</a>(User,Chan);
655 <a name="a9" doxytag="Server::CommonChannels"></a><p>
656 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
659 <table cellpadding="0" cellspacing="0" border="0">
661 <td class="md" nowrap valign="top"> bool Server::CommonChannels </td>
662 <td class="md" valign="top">( </td>
663 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
664 <td class="mdname" nowrap> <em>u1</em>, </td>
669 <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> * </td>
670 <td class="mdname" nowrap> <em>u2</em></td>
674 <td class="md">) </td>
675 <td class="md" colspan="2"><code> [virtual]</code></td>
682 <table cellspacing=5 cellpadding=0 border=0>
690 Returns true if two users share a common channel.
692 This method is used internally by the NICK and QUIT commands, and the <a class="el" href="classServer.html#a10">Server::SendCommon</a> method.
694 Definition at line <a class="el" href="modules_8cpp-source.html#l00469">469</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
696 References <a class="el" href="message_8h.html#a0">common_channels()</a>.
698 <div class="fragment"><pre>00470 {
699 00471 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a0">common_channels</a>(u1,u2) != 0);
704 <a name="a13" doxytag="Server::CountUsers"></a><p>
705 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
708 <table cellpadding="0" cellspacing="0" border="0">
710 <td class="md" nowrap valign="top"> int Server::CountUsers </td>
711 <td class="md" valign="top">( </td>
712 <td class="md" nowrap valign="top"><a class="el" href="classchanrec.html">chanrec</a> * </td>
713 <td class="mdname1" valign="top" nowrap> <em>c</em> </td>
714 <td class="md" valign="top"> ) </td>
715 <td class="md" nowrap><code> [virtual]</code></td>
722 <table cellspacing=5 cellpadding=0 border=0>
730 Returns a count of the number of users on a channel.
732 This will NEVER be 0, as if the chanrec exists, it will have at least one user in the channel.
734 Definition at line <a class="el" href="modules_8cpp-source.html#l00571">571</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
736 <div class="fragment"><pre>00572 {
737 00573 <span class="keywordflow">return</span> usercount(c);
742 <a name="a15" doxytag="Server::FindChannel"></a><p>
743 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
746 <table cellpadding="0" cellspacing="0" border="0">
748 <td class="md" nowrap valign="top"> <a class="el" href="classchanrec.html">chanrec</a> * Server::FindChannel </td>
749 <td class="md" valign="top">( </td>
750 <td class="md" nowrap valign="top">std::string </td>
751 <td class="mdname1" valign="top" nowrap> <em>channel</em> </td>
752 <td class="md" valign="top"> ) </td>
753 <td class="md" nowrap><code> [virtual]</code></td>
760 <table cellspacing=5 cellpadding=0 border=0>
768 Attempts to look up a channel and return a pointer to it.
770 This function will return NULL if the channel does not exist.
772 Definition at line <a class="el" href="modules_8cpp-source.html#l00511">511</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
774 <div class="fragment"><pre>00512 {
775 00513 <span class="keywordflow">return</span> FindChan(channel.c_str());
780 <a name="a14" doxytag="Server::FindNick"></a><p>
781 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
784 <table cellpadding="0" cellspacing="0" border="0">
786 <td class="md" nowrap valign="top"> <a class="el" href="classuserrec.html">userrec</a> * Server::FindNick </td>
787 <td class="md" valign="top">( </td>
788 <td class="md" nowrap valign="top">std::string </td>
789 <td class="mdname1" valign="top" nowrap> <em>nick</em> </td>
790 <td class="md" valign="top"> ) </td>
791 <td class="md" nowrap><code> [virtual]</code></td>
798 <table cellspacing=5 cellpadding=0 border=0>
806 Attempts to look up a nick and return a pointer to it.
808 This function will return NULL if the nick does not exist.
810 Definition at line <a class="el" href="modules_8cpp-source.html#l00506">506</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
812 <div class="fragment"><pre>00507 {
813 00508 <span class="keywordflow">return</span> Find(nick);
818 <a name="a20" doxytag="Server::GetAdmin"></a><p>
819 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
822 <table cellpadding="0" cellspacing="0" border="0">
824 <td class="md" nowrap valign="top"> <a class="el" href="classAdmin.html">Admin</a> Server::GetAdmin </td>
825 <td class="md" valign="top">( </td>
826 <td class="mdname1" valign="top" nowrap> </td>
827 <td class="md" valign="top"> ) </td>
828 <td class="md" nowrap><code> [virtual]</code></td>
835 <table cellspacing=5 cellpadding=0 border=0>
843 Returns the information of the server as returned by the /ADMIN command.
845 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#o2">Admin::Nick</a>, <a class="el" href="classAdmin.html#o1">Admin::Email</a> and <a class="el" href="classAdmin.html#o0">Admin::Name</a> contain the information for the server where the module is loaded.
847 Definition at line <a class="el" href="modules_8cpp-source.html#l00536">536</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
849 <div class="fragment"><pre>00537 {
850 00538 <span class="keywordflow">return</span> <a class="code" href="classAdmin.html">Admin</a>(getadminname(),getadminemail(),getadminnick());
855 <a name="a19" doxytag="Server::GetNetworkName"></a><p>
856 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
859 <table cellpadding="0" cellspacing="0" border="0">
861 <td class="md" nowrap valign="top"> std::string Server::GetNetworkName </td>
862 <td class="md" valign="top">( </td>
863 <td class="mdname1" valign="top" nowrap> </td>
864 <td class="md" valign="top"> ) </td>
865 <td class="md" nowrap><code> [virtual]</code></td>
872 <table cellspacing=5 cellpadding=0 border=0>
880 Returns the network name, global to all linked servers.
884 Definition at line <a class="el" href="modules_8cpp-source.html#l00531">531</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
886 <div class="fragment"><pre>00532 {
887 00533 <span class="keywordflow">return</span> getnetworkname();
892 <a name="a18" doxytag="Server::GetServerName"></a><p>
893 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
896 <table cellpadding="0" cellspacing="0" border="0">
898 <td class="md" nowrap valign="top"> std::string Server::GetServerName </td>
899 <td class="md" valign="top">( </td>
900 <td class="mdname1" valign="top" nowrap> </td>
901 <td class="md" valign="top"> ) </td>
902 <td class="md" nowrap><code> [virtual]</code></td>
909 <table cellspacing=5 cellpadding=0 border=0>
917 Returns the server name of the server where the module is loaded.
921 Definition at line <a class="el" href="modules_8cpp-source.html#l00526">526</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
923 <div class="fragment"><pre>00527 {
924 00528 <span class="keywordflow">return</span> getservername();
929 <a name="a35" doxytag="Server::GetUsers"></a><p>
930 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
933 <table cellpadding="0" cellspacing="0" border="0">
935 <td class="md" nowrap valign="top"> <a class="el" href="modules_8h.html#a28">chanuserlist</a> Server::GetUsers </td>
936 <td class="md" valign="top">( </td>
937 <td class="md" nowrap valign="top"><a class="el" href="classchanrec.html">chanrec</a> * </td>
938 <td class="mdname1" valign="top" nowrap> <em>chan</em> </td>
939 <td class="md" valign="top"> ) </td>
940 <td class="md" nowrap><code> [virtual]</code></td>
947 <table cellspacing=5 cellpadding=0 border=0>
955 Fetches the userlist of a channel.
957 This function must be here and not a member of userrec or chanrec due to include constraints.
959 Definition at line <a class="el" href="modules_8cpp-source.html#l00373">373</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
961 References <a class="el" href="modules_8h-source.html#l00065">chanuserlist</a>, <a class="el" href="modules_8cpp-source.html#l00177">clientlist</a>, <a class="el" href="message_8h.html#a16">has_channel()</a>, and <a class="el" href="message_8h.html#a13">isnick()</a>.
963 <div class="fragment"><pre>00374 {
964 00375 <a class="code" href="modules_8h.html#a28">chanuserlist</a> userl;
966 00377 <span class="keywordflow">for</span> (user_hash::const_iterator i = <a class="code" href="modules_8cpp.html#a41">clientlist</a>.begin(); i != <a class="code" href="modules_8cpp.html#a41">clientlist</a>.end(); i++)
968 00379 <span class="keywordflow">if</span> (i->second)
970 00381 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a16">has_channel</a>(i->second,chan))
972 00383 <span class="keywordflow">if</span> (<a class="code" href="message_8h.html#a13">isnick</a>(i->second->nick))
974 00385 userl.push_back(i->second);
979 00390 <span class="keywordflow">return</span> userl;
984 <a name="a12" doxytag="Server::IsNick"></a><p>
985 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
988 <table cellpadding="0" cellspacing="0" border="0">
990 <td class="md" nowrap valign="top"> bool Server::IsNick </td>
991 <td class="md" valign="top">( </td>
992 <td class="md" nowrap valign="top">std::string </td>
993 <td class="mdname1" valign="top" nowrap> <em>nick</em> </td>
994 <td class="md" valign="top"> ) </td>
995 <td class="md" nowrap><code> [virtual]</code></td>
1002 <table cellspacing=5 cellpadding=0 border=0>
1010 Returns true if a nick is valid.
1012 Nicks for unregistered connections will return false.
1014 Definition at line <a class="el" href="modules_8cpp-source.html#l00501">501</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1016 References <a class="el" href="message_8h.html#a13">isnick()</a>.
1018 <div class="fragment"><pre>00502 {
1019 00503 <span class="keywordflow">return</span> (<a class="code" href="message_8h.html#a13">isnick</a>(nick.c_str()) != 0);
1024 <a name="a17" doxytag="Server::IsOnChannel"></a><p>
1025 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1028 <table cellpadding="0" cellspacing="0" border="0">
1030 <td class="md" nowrap valign="top"> bool Server::IsOnChannel </td>
1031 <td class="md" valign="top">( </td>
1032 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1033 <td class="mdname" nowrap> <em>User</em>, </td>
1038 <td class="md" nowrap><a class="el" href="classchanrec.html">chanrec</a> * </td>
1039 <td class="mdname" nowrap> <em>Chan</em></td>
1043 <td class="md">) </td>
1044 <td class="md" colspan="2"><code> [virtual]</code></td>
1051 <table cellspacing=5 cellpadding=0 border=0>
1059 Checks if a user is on a channel.
1061 This function will return true or false to indicate if user 'User' is on channel 'Chan'.
1063 Definition at line <a class="el" href="modules_8cpp-source.html#l00521">521</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1065 References <a class="el" href="message_8h.html#a16">has_channel()</a>.
1067 <div class="fragment"><pre>00522 {
1068 00523 <span class="keywordflow">return</span> <a class="code" href="message_8h.html#a16">has_channel</a>(User,Chan);
1073 <a name="a34" doxytag="Server::IsUlined"></a><p>
1074 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1077 <table cellpadding="0" cellspacing="0" border="0">
1079 <td class="md" nowrap valign="top"> bool Server::IsUlined </td>
1080 <td class="md" valign="top">( </td>
1081 <td class="md" nowrap valign="top">std::string </td>
1082 <td class="mdname1" valign="top" nowrap> <em>server</em> </td>
1083 <td class="md" valign="top"> ) </td>
1084 <td class="md" nowrap><code> [virtual]</code></td>
1091 <table cellspacing=5 cellpadding=0 border=0>
1099 Returns true if the servername you give is ulined.
1101 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.
1103 Definition at line <a class="el" href="modules_8cpp-source.html#l00403">403</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1105 References <a class="el" href="commands_8h.html#a72">is_uline()</a>.
1107 <div class="fragment"><pre>00404 {
1108 00405 <span class="keywordflow">return</span> <a class="code" href="commands_8h.html#a72">is_uline</a>(server.c_str());
1113 <a name="a26" doxytag="Server::JoinUserToChannel"></a><p>
1114 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1117 <table cellpadding="0" cellspacing="0" border="0">
1119 <td class="md" nowrap valign="top"> <a class="el" href="classchanrec.html">chanrec</a> * Server::JoinUserToChannel </td>
1120 <td class="md" valign="top">( </td>
1121 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1122 <td class="mdname" nowrap> <em>user</em>, </td>
1127 <td class="md" nowrap>std::string </td>
1128 <td class="mdname" nowrap> <em>cname</em>, </td>
1133 <td class="md" nowrap>std::string </td>
1134 <td class="mdname" nowrap> <em>key</em></td>
1138 <td class="md">) </td>
1139 <td class="md" colspan="2"><code> [virtual]</code></td>
1146 <table cellspacing=5 cellpadding=0 border=0>
1154 Forces a user to join a channel.
1156 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.
1158 Definition at line <a class="el" href="modules_8cpp-source.html#l00363">363</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1160 <div class="fragment"><pre>00364 {
1161 00365 <span class="keywordflow">return</span> add_channel(user,cname.c_str(),key.c_str(),<span class="keyword">true</span>);
1166 <a name="a3" doxytag="Server::Log"></a><p>
1167 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1170 <table cellpadding="0" cellspacing="0" border="0">
1172 <td class="md" nowrap valign="top"> void Server::Log </td>
1173 <td class="md" valign="top">( </td>
1174 <td class="md" nowrap valign="top">int </td>
1175 <td class="mdname" nowrap> <em>level</em>, </td>
1180 <td class="md" nowrap>std::string </td>
1181 <td class="mdname" nowrap> <em>s</em></td>
1185 <td class="md">) </td>
1186 <td class="md" colspan="2"><code> [virtual]</code></td>
1193 <table cellspacing=5 cellpadding=0 border=0>
1201 Writes a log string.
1203 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.
1205 Definition at line <a class="el" href="modules_8cpp-source.html#l00413">413</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1207 <div class="fragment"><pre>00414 {
1208 00415 log(level,<span class="stringliteral">"%s"</span>,s.c_str());
1213 <a name="a30" doxytag="Server::MatchText"></a><p>
1214 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1217 <table cellpadding="0" cellspacing="0" border="0">
1219 <td class="md" nowrap valign="top"> bool Server::MatchText </td>
1220 <td class="md" valign="top">( </td>
1221 <td class="md" nowrap valign="top">std::string </td>
1222 <td class="mdname" nowrap> <em>sliteral</em>, </td>
1227 <td class="md" nowrap>std::string </td>
1228 <td class="mdname" nowrap> <em>spattern</em></td>
1232 <td class="md">) </td>
1233 <td class="md" colspan="2"><code> [virtual]</code></td>
1240 <table cellspacing=5 cellpadding=0 border=0>
1248 Matches text against a glob pattern.
1250 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.
1252 Definition at line <a class="el" href="modules_8cpp-source.html#l00350">350</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1254 <div class="fragment"><pre>00351 {
1255 00352 <span class="keywordtype">char</span> literal[MAXBUF],pattern[MAXBUF];
1256 00353 strlcpy(literal,sliteral.c_str(),MAXBUF);
1257 00354 strlcpy(pattern,spattern.c_str(),MAXBUF);
1258 00355 <span class="keywordflow">return</span> match(literal,pattern);
1263 <a name="a27" doxytag="Server::PartUserFromChannel"></a><p>
1264 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1267 <table cellpadding="0" cellspacing="0" border="0">
1269 <td class="md" nowrap valign="top"> <a class="el" href="classchanrec.html">chanrec</a> * Server::PartUserFromChannel </td>
1270 <td class="md" valign="top">( </td>
1271 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1272 <td class="mdname" nowrap> <em>user</em>, </td>
1277 <td class="md" nowrap>std::string </td>
1278 <td class="mdname" nowrap> <em>cname</em>, </td>
1283 <td class="md" nowrap>std::string </td>
1284 <td class="mdname" nowrap> <em>reason</em></td>
1288 <td class="md">) </td>
1289 <td class="md" colspan="2"><code> [virtual]</code></td>
1296 <table cellspacing=5 cellpadding=0 border=0>
1304 Forces a user to part a channel.
1306 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.
1308 Definition at line <a class="el" href="modules_8cpp-source.html#l00368">368</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1310 <div class="fragment"><pre>00369 {
1311 00370 <span class="keywordflow">return</span> del_channel(user,cname.c_str(),reason.c_str(),<span class="keyword">false</span>);
1316 <a name="a29" doxytag="Server::QuitUser"></a><p>
1317 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1320 <table cellpadding="0" cellspacing="0" border="0">
1322 <td class="md" nowrap valign="top"> void Server::QuitUser </td>
1323 <td class="md" valign="top">( </td>
1324 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1325 <td class="mdname" nowrap> <em>user</em>, </td>
1330 <td class="md" nowrap>std::string </td>
1331 <td class="mdname" nowrap> <em>reason</em></td>
1335 <td class="md">) </td>
1336 <td class="md" colspan="2"><code> [virtual]</code></td>
1343 <table cellspacing=5 cellpadding=0 border=0>
1351 Forces a user to quit with the specified reason.
1353 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>
1355 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.
1357 Definition at line <a class="el" href="modules_8cpp-source.html#l00397">397</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1359 References <a class="el" href="users_8h-source.html#l00102">userrec::nick</a>, and <a class="el" href="message_8h.html#a19">send_network_quit()</a>.
1361 <div class="fragment"><pre>00398 {
1362 00399 <a class="code" href="message_8h.html#a19">send_network_quit</a>(user-><a class="code" href="classuserrec.html#o0">nick</a>,reason.c_str());
1363 00400 kill_link(user,reason.c_str());
1368 <a name="a4" doxytag="Server::Send"></a><p>
1369 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1372 <table cellpadding="0" cellspacing="0" border="0">
1374 <td class="md" nowrap valign="top"> void Server::Send </td>
1375 <td class="md" valign="top">( </td>
1376 <td class="md" nowrap valign="top">int </td>
1377 <td class="mdname" nowrap> <em>Socket</em>, </td>
1382 <td class="md" nowrap>std::string </td>
1383 <td class="mdname" nowrap> <em>s</em></td>
1387 <td class="md">) </td>
1388 <td class="md" colspan="2"><code> [virtual]</code></td>
1395 <table cellspacing=5 cellpadding=0 border=0>
1403 Sends a line of text down a TCP/IP socket.
1405 This method writes a line of text to an established socket, cutting it to 510 characters plus a carriage return and linefeed if required.
1407 Definition at line <a class="el" href="modules_8cpp-source.html#l00428">428</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1409 <div class="fragment"><pre>00429 {
1410 00430 Write(Socket,<span class="stringliteral">"%s"</span>,s.c_str());
1415 <a name="a8" doxytag="Server::SendChannel"></a><p>
1416 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1419 <table cellpadding="0" cellspacing="0" border="0">
1421 <td class="md" nowrap valign="top"> void Server::SendChannel </td>
1422 <td class="md" valign="top">( </td>
1423 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1424 <td class="mdname" nowrap> <em>User</em>, </td>
1429 <td class="md" nowrap><a class="el" href="classchanrec.html">chanrec</a> * </td>
1430 <td class="mdname" nowrap> <em>Channel</em>, </td>
1435 <td class="md" nowrap>std::string </td>
1436 <td class="mdname" nowrap> <em>s</em>, </td>
1441 <td class="md" nowrap>bool </td>
1442 <td class="mdname" nowrap> <em>IncludeSender</em></td>
1446 <td class="md">) </td>
1447 <td class="md" colspan="2"><code> [virtual]</code></td>
1454 <table cellspacing=5 cellpadding=0 border=0>
1462 Sends text from a user to a channel (mulicast).
1464 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).
1466 Definition at line <a class="el" href="modules_8cpp-source.html#l00457">457</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1468 <div class="fragment"><pre>00458 {
1469 00459 <span class="keywordflow">if</span> (IncludeSender)
1471 00461 WriteChannel(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str());
1473 00463 <span class="keywordflow">else</span>
1475 00465 ChanExceptSender(Channel,User,<span class="stringliteral">"%s"</span>,s.c_str());
1481 <a name="a10" doxytag="Server::SendCommon"></a><p>
1482 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1485 <table cellpadding="0" cellspacing="0" border="0">
1487 <td class="md" nowrap valign="top"> void Server::SendCommon </td>
1488 <td class="md" valign="top">( </td>
1489 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1490 <td class="mdname" nowrap> <em>User</em>, </td>
1495 <td class="md" nowrap>std::string </td>
1496 <td class="mdname" nowrap> <em>text</em>, </td>
1501 <td class="md" nowrap>bool </td>
1502 <td class="mdname" nowrap> <em>IncludeSender</em></td>
1506 <td class="md">) </td>
1507 <td class="md" colspan="2"><code> [virtual]</code></td>
1514 <table cellspacing=5 cellpadding=0 border=0>
1522 Sends text from a user to one or more channels (mulicast).
1524 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.
1526 Definition at line <a class="el" href="modules_8cpp-source.html#l00474">474</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1528 <div class="fragment"><pre>00475 {
1529 00476 <span class="keywordflow">if</span> (IncludeSender)
1531 00478 WriteCommon(User,<span class="stringliteral">"%s"</span>,text.c_str());
1533 00480 <span class="keywordflow">else</span>
1535 00482 WriteCommonExcept(User,<span class="stringliteral">"%s"</span>,text.c_str());
1541 <a name="a6" doxytag="Server::SendFrom"></a><p>
1542 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1545 <table cellpadding="0" cellspacing="0" border="0">
1547 <td class="md" nowrap valign="top"> void Server::SendFrom </td>
1548 <td class="md" valign="top">( </td>
1549 <td class="md" nowrap valign="top">int </td>
1550 <td class="mdname" nowrap> <em>Socket</em>, </td>
1555 <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> * </td>
1556 <td class="mdname" nowrap> <em>User</em>, </td>
1561 <td class="md" nowrap>std::string </td>
1562 <td class="mdname" nowrap> <em>s</em></td>
1566 <td class="md">) </td>
1567 <td class="md" colspan="2"><code> [virtual]</code></td>
1574 <table cellspacing=5 cellpadding=0 border=0>
1582 Sends text from a user to a socket.
1584 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)
1586 Definition at line <a class="el" href="modules_8cpp-source.html#l00438">438</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1588 <div class="fragment"><pre>00439 {
1589 00440 WriteFrom(Socket,User,<span class="stringliteral">"%s"</span>,s.c_str());
1594 <a name="a24" doxytag="Server::SendMode"></a><p>
1595 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1598 <table cellpadding="0" cellspacing="0" border="0">
1600 <td class="md" nowrap valign="top"> void Server::SendMode </td>
1601 <td class="md" valign="top">( </td>
1602 <td class="md" nowrap valign="top">char ** </td>
1603 <td class="mdname" nowrap> <em>parameters</em>, </td>
1608 <td class="md" nowrap>int </td>
1609 <td class="mdname" nowrap> <em>pcnt</em>, </td>
1614 <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> * </td>
1615 <td class="mdname" nowrap> <em>user</em></td>
1619 <td class="md">) </td>
1620 <td class="md" colspan="2"><code> [virtual]</code></td>
1627 <table cellspacing=5 cellpadding=0 border=0>
1637 you must format the parameters array with the target, modes and parameters for those modes.<p>
1640 modes[0] = ChannelName;<p>
1642 modes[2] = user->nick;<p>
1643 Srv->SendMode(modes,3,user);<p>
1644 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!
1646 Definition at line <a class="el" href="modules_8cpp-source.html#l00423">423</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1648 References <a class="el" href="modules_8h.html#a31">server_mode()</a>.
1650 <div class="fragment"><pre>00424 {
1651 00425 <a class="code" href="modules_8h.html#a31">server_mode</a>(parameters,pcnt,user);
1656 <a name="a2" doxytag="Server::SendOpers"></a><p>
1657 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1660 <table cellpadding="0" cellspacing="0" border="0">
1662 <td class="md" nowrap valign="top"> void Server::SendOpers </td>
1663 <td class="md" valign="top">( </td>
1664 <td class="md" nowrap valign="top">std::string </td>
1665 <td class="mdname1" valign="top" nowrap> <em>s</em> </td>
1666 <td class="md" valign="top"> ) </td>
1667 <td class="md" nowrap><code> [virtual]</code></td>
1674 <table cellspacing=5 cellpadding=0 border=0>
1682 Sends text to all opers.
1684 This method sends a server notice to all opers with the usermode +s.
1686 Definition at line <a class="el" href="modules_8cpp-source.html#l00345">345</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1688 <div class="fragment"><pre>00346 {
1689 00347 WriteOpers(<span class="stringliteral">"%s"</span>,s.c_str());
1694 <a name="a5" doxytag="Server::SendServ"></a><p>
1695 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1698 <table cellpadding="0" cellspacing="0" border="0">
1700 <td class="md" nowrap valign="top"> void Server::SendServ </td>
1701 <td class="md" valign="top">( </td>
1702 <td class="md" nowrap valign="top">int </td>
1703 <td class="mdname" nowrap> <em>Socket</em>, </td>
1708 <td class="md" nowrap>std::string </td>
1709 <td class="mdname" nowrap> <em>s</em></td>
1713 <td class="md">) </td>
1714 <td class="md" colspan="2"><code> [virtual]</code></td>
1721 <table cellspacing=5 cellpadding=0 border=0>
1729 Sends text from the server to a socket.
1731 This method writes a line of text to an established socket, with the servername prepended as used by numerics (see RFC 1459)
1733 Definition at line <a class="el" href="modules_8cpp-source.html#l00433">433</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1735 <div class="fragment"><pre>00434 {
1736 00435 WriteServ(Socket,<span class="stringliteral">"%s"</span>,s.c_str());
1741 <a name="a7" doxytag="Server::SendTo"></a><p>
1742 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1745 <table cellpadding="0" cellspacing="0" border="0">
1747 <td class="md" nowrap valign="top"> void Server::SendTo </td>
1748 <td class="md" valign="top">( </td>
1749 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1750 <td class="mdname" nowrap> <em>Source</em>, </td>
1755 <td class="md" nowrap><a class="el" href="classuserrec.html">userrec</a> * </td>
1756 <td class="mdname" nowrap> <em>Dest</em>, </td>
1761 <td class="md" nowrap>std::string </td>
1762 <td class="mdname" nowrap> <em>s</em></td>
1766 <td class="md">) </td>
1767 <td class="md" colspan="2"><code> [virtual]</code></td>
1774 <table cellspacing=5 cellpadding=0 border=0>
1782 Sends text from a user to another user.
1784 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>
1786 The format will become:<p>
1787 :localserver TEXT<p>
1788 Which is useful for numerics and server notices to single users, etc.
1790 Definition at line <a class="el" href="modules_8cpp-source.html#l00443">443</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1792 References <a class="el" href="connection_8h-source.html#l00178">connection::fd</a>.
1794 <div class="fragment"><pre>00444 {
1795 00445 <span class="keywordflow">if</span> (!Source)
1797 00447 <span class="comment">// if source is NULL, then the message originates from the local server</span>
1798 00448 Write(Dest-><a class="code" href="classconnection.html#o0">fd</a>,<span class="stringliteral">":%s %s"</span>,this->GetServerName().c_str(),s.c_str());
1800 00450 <span class="keywordflow">else</span>
1802 00452 <span class="comment">// otherwise it comes from the user specified</span>
1803 00453 WriteTo(Source,Dest,<span class="stringliteral">"%s"</span>,s.c_str());
1809 <a name="a25" doxytag="Server::SendToModeMask"></a><p>
1810 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1813 <table cellpadding="0" cellspacing="0" border="0">
1815 <td class="md" nowrap valign="top"> void Server::SendToModeMask </td>
1816 <td class="md" valign="top">( </td>
1817 <td class="md" nowrap valign="top">std::string </td>
1818 <td class="mdname" nowrap> <em>modes</em>, </td>
1823 <td class="md" nowrap>int </td>
1824 <td class="mdname" nowrap> <em>flags</em>, </td>
1829 <td class="md" nowrap>std::string </td>
1830 <td class="mdname" nowrap> <em>text</em></td>
1834 <td class="md">) </td>
1835 <td class="md" colspan="2"><code> [virtual]</code></td>
1842 <table cellspacing=5 cellpadding=0 border=0>
1850 Sends to all users matching a mode mask You must specify one or more usermodes as the first parameter.
1852 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>
1853 Serv->SendToModeMask("xi", WM_OR, "m00");<p>
1854 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.
1856 Definition at line <a class="el" href="modules_8cpp-source.html#l00358">358</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1858 <div class="fragment"><pre>00359 {
1859 00360 WriteMode(modes.c_str(),flags,<span class="stringliteral">"%s"</span>,text.c_str());
1864 <a name="a11" doxytag="Server::SendWallops"></a><p>
1865 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
1868 <table cellpadding="0" cellspacing="0" border="0">
1870 <td class="md" nowrap valign="top"> void Server::SendWallops </td>
1871 <td class="md" valign="top">( </td>
1872 <td class="md" nowrap valign="top"><a class="el" href="classuserrec.html">userrec</a> * </td>
1873 <td class="mdname" nowrap> <em>User</em>, </td>
1878 <td class="md" nowrap>std::string </td>
1879 <td class="mdname" nowrap> <em>text</em></td>
1883 <td class="md">) </td>
1884 <td class="md" colspan="2"><code> [virtual]</code></td>
1891 <table cellspacing=5 cellpadding=0 border=0>
1899 Sends a WALLOPS message.
1901 This method writes a WALLOPS message to all users with the +w flag, originating from the specified user.
1903 Definition at line <a class="el" href="modules_8cpp-source.html#l00486">486</a> of file <a class="el" href="modules_8cpp-source.html">modules.cpp</a>.
1905 <div class="fragment"><pre>00487 {
1906 00488 WriteWallOps(User,<span class="keyword">false</span>,<span class="stringliteral">"%s"</span>,text.c_str());
1911 <hr>The documentation for this class was generated from the following files:<ul>
1912 <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>
1913 <hr size="1"><address style="align: right;"><small>Generated on Mon Apr 4 18:12:54 2005 for InspIRCd by
1914 <a href="http://www.doxygen.org/index.html">
1915 <img src="doxygen.png" alt="doxygen" align="middle" border=0 >
1916 </a>1.3.3 </small></address>