| 1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11-strict.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Style-Type" content="text/css"/> |
| 6 |
<style type="text/css">@import "style.css";</style> |
| 7 |
<title>IRC Services Technical Reference Manual - Appendix C. List of callbacks</title> |
| 8 |
</head> |
| 9 |
|
| 10 |
<body> |
| 11 |
<h1 class="title" id="top">IRC Services Technical Reference Manual</h1> |
| 12 |
|
| 13 |
<h2 class="section-title">Appendix C. List of callbacks</h2> |
| 14 |
|
| 15 |
<p class="section-toc"> |
| 16 |
C-1. <a href="#s1">General notes</a> |
| 17 |
<br/>C-2. <a href="#s2">Services core callbacks</a> |
| 18 |
<br/>C-3. <a href="#s3">OperServ callbacks</a> |
| 19 |
<br/>C-4. <a href="#s4">NickServ callbacks</a> |
| 20 |
<br/>C-5. <a href="#s5">ChanServ callbacks</a> |
| 21 |
<br/>C-6. <a href="#s6">MemoServ callbacks</a> |
| 22 |
<br/>C-7. <a href="#s7">StatServ callbacks</a> |
| 23 |
<br/>C-8. <a href="#s8">HTTP server callbacks</a> |
| 24 |
</p> |
| 25 |
|
| 26 |
<p class="backlink"><a href="index.html">Table of Contents</a></p> |
| 27 |
|
| 28 |
<!------------------------------------------------------------------------> |
| 29 |
<hr/> |
| 30 |
|
| 31 |
<h3 class="subsection-title" id="s1">C-1. General notes</h3> |
| 32 |
|
| 33 |
<p>The callbacks provided by Services are listed in this appendix under the |
| 34 |
names used to access them (<i>e.g.,</i> with <tt>add_callback()</tt>). |
| 35 |
When using Services core callbacks, use a <tt><i>module</i></tt> parameter |
| 36 |
of <tt>NULL</tt>.</p> |
| 37 |
|
| 38 |
<p>Where the descriptions below refer to "processing" a message, they refer |
| 39 |
to a message that is meant specifically for the callback in question and |
| 40 |
which is not to be passed on to other modules or the Services core.</p> |
| 41 |
|
| 42 |
<p>Except as otherwise specified, callbacks which return zero must leave |
| 43 |
all arguments unchanged, and callbacks which return nonzero may modify any |
| 44 |
arguments which are not specified as <tt>const</tt>.</p> |
| 45 |
|
| 46 |
<p class="backlink"><a href="#top">Back to top</a></p> |
| 47 |
|
| 48 |
<!------------------------------------------------------------------------> |
| 49 |
<hr/> |
| 50 |
|
| 51 |
<h3 class="subsection-title" id="s2">C-2. Services core callbacks</h3> |
| 52 |
|
| 53 |
<dl> |
| 54 |
<dt><tt><b>channel create</b></tt> |
| 55 |
<br/>Parameters: <tt>Channel *<i>channel</i></tt>, <tt>User *<i>user</i></tt>, |
| 56 |
<tt>int32 <i>mode</i></tt></dt> |
| 57 |
<dd>Called when a channel is created (<i>i.e.</i>, when a client joins |
| 58 |
a nonexistent channel). The client that created the channel and |
| 59 |
that client's modes (<tt>CUMODE_*</tt>) are also passed to the |
| 60 |
callback (note that the client is not yet in the channel's client |
| 61 |
list). The callback routine should always return 0.</dd> |
| 62 |
|
| 63 |
<dt><tt><b>channel delete</b></tt> |
| 64 |
<br/>Parameters: <tt>Channel *<i>channel</i></tt></dt> |
| 65 |
<dd>Called when a channel is about to be deleted (<i>i.e.</i>, when the |
| 66 |
last client has left the channel). The callback routine should |
| 67 |
always return 0.</dd> |
| 68 |
|
| 69 |
<dt><tt><b>channel JOIN</b></tt> |
| 70 |
<br/>Parameters: <tt>Channel *<i>channel</i></tt>, |
| 71 |
<tt>struct c_userlist *<i>u</i></tt></dt> |
| 72 |
<dd>Called when a client has joined a channel. The callback routine |
| 73 |
should always return 0.</dd> |
| 74 |
|
| 75 |
<dt><tt><b>channel JOIN check</b></tt> |
| 76 |
<br/>Parameters: <tt>const char *<i>channel</i></tt>, <tt>User *<i>user</i></tt></dt> |
| 77 |
<dd>Called when a client is about to join a channel. The callback |
| 78 |
routine should return 1 to refuse the client access to the channel |
| 79 |
or 0 to allow the <tt>JOIN</tt> to proceed normally.</dd> |
| 80 |
|
| 81 |
<dt><tt><b>channel KICK</b></tt> |
| 82 |
<br/>Parameters: <tt>Channel *<i>channel</i></tt>, <tt>User *<i>user</i></tt>, |
| 83 |
<tt>const char *<i>reason</i></tt>, <tt>const char *<i>source</i></tt></dt> |
| 84 |
<dd>Called when a client has been kicked from a channel. The callback |
| 85 |
routine should always return 0.</dd> |
| 86 |
|
| 87 |
<dt><tt><b>channel MODE</b></tt> |
| 88 |
<br/>Parameters: <tt>const char *<i>source</i></tt>, |
| 89 |
<tt>Channel *<i>channel</i></tt>, <tt>int <i>modechar</i></tt>, |
| 90 |
<tt>int <i>add</i></tt>, <tt>char **<i>av</i></tt></dt> |
| 91 |
<dd>Called for each valid mode character in a <tt>MODE</tt> message, |
| 92 |
except for channel user modes (<tt>+o</tt>, <tt>+v</tt>, etc.). |
| 93 |
<tt><i>add</i></tt> is nonzero if adding modes, zero if removing |
| 94 |
them. <tt><i>av</i></tt> points to the first argument for the |
| 95 |
mode; there are guaranteed to be enough arguments for the mode |
| 96 |
character (provided the number of parameters in the mode definition |
| 97 |
is set correctly). The callback routine should return 1 if it |
| 98 |
processes the mode, 0 otherwise.</dd> |
| 99 |
|
| 100 |
<dt><tt><b>channel mode change</b></tt> |
| 101 |
<br/>Parameters: <tt>Channel *<i>channel</i></tt></dt> |
| 102 |
<dd>Called when a channel's modes have changed. The callback routine |
| 103 |
should always return 0.</dd> |
| 104 |
|
| 105 |
<dt><tt><b>channel umode change</b></tt> |
| 106 |
<br/>Parameters: <tt>Channel *<i>channel</i></tt>, |
| 107 |
<tt>struct c_userlist *<i>user</i></tt></dt> |
| 108 |
<dd>Called when a client's modes on a channel have changed. The |
| 109 |
callback routine should always return 0.</dd> |
| 110 |
|
| 111 |
<dt><tt><b>channel PART</b></tt> |
| 112 |
<br/>Parameters: <tt>Channel *<i>channel</i></tt>, <tt>User *<i>user</i></tt>, |
| 113 |
<tt>const char *<i>reason</i></tt></dt> |
| 114 |
<dd>Called when a client parts from a channel. The callback routine |
| 115 |
should always return 0.</dd> |
| 116 |
|
| 117 |
<dt><tt><b>channel TOPIC</b></tt> |
| 118 |
<br/>Parameters: <tt>Channel *channel</tt>, <tt>const char *topic</tt>, |
| 119 |
<tt>const char *setter</tt> |
| 120 |
<tt>time_t topic_time</tt></dt> |
| 121 |
<dd>Called when a <tt>TOPIC</tt> command is received. The callback |
| 122 |
routine should return 0 to permit the topic change or 1 to refuse |
| 123 |
it. Note that <tt><i>setter</i></tt> may be in the form |
| 124 |
"<tt><i>nick</i>!<i>user</i>@<i>host</i></tt>" instead of just a |
| 125 |
nickname, depending on the remote server type; however, Services |
| 126 |
currently stores only the nickname, and discards the username and |
| 127 |
hostname if present.</dd> |
| 128 |
|
| 129 |
<dt><tt><b>clear channel</b></tt> |
| 130 |
<br/>Parameters: <tt>const char *<i>source</i></tt>, |
| 131 |
<tt>Channel *<i>channel</i></tt>, <tt>int <i>what</i></tt>, |
| 132 |
<tt>const void *<i>param</i></tt></dt> |
| 133 |
<dd>Called whenever the <tt>clear_channel()</tt> function (in |
| 134 |
<tt>actions.c</tt>) is called, before any other action is taken. |
| 135 |
The callback routine should return 1 to terminate |
| 136 |
<tt>clear_channel()</tt> processing or 0 to continue. Note that |
| 137 |
even if the callback routine returns 1, <tt>clear_channel()</tt> |
| 138 |
will still flush out any channel mode changes, so the routine does |
| 139 |
not need to do this itself. See the comments above |
| 140 |
<tt>clear_channel()</tt> in <tt>actions.c</tt> for the meaning of |
| 141 |
the parameters.</dd> |
| 142 |
|
| 143 |
<dt><tt><b>command line</b></tt> |
| 144 |
<br/>Parameters: <tt>char *<i>option</i></tt>, <tt>char *<i>value</i></tt></dt> |
| 145 |
<dd>Called at program startup for each command-line option. |
| 146 |
<tt><i>option</i></tt> is the name of the option (the part of the |
| 147 |
option string after the initial "<tt>-</tt>", up to and not |
| 148 |
including any "<tt>=</tt>"), and <tt><i>value</i></tt>" is the text |
| 149 |
after the "<tt>=</tt>" (<tt>NULL</tt> if no "<tt>=</tt>" is present). |
| 150 |
<tt><i>option</i></tt> is guaranteed to be non-<tt>NULL</tt>. The |
| 151 |
callback routine should return 0 if it does not recognize the |
| 152 |
option, 1 if it successfully processes the option, 2 if there is an |
| 153 |
error processing the option, or 3 if no error occurred but Services |
| 154 |
should terminate successfully.</dd> |
| 155 |
|
| 156 |
<dt><tt><b>connect</b></tt> |
| 157 |
<br/>Parameters: none</dt> |
| 158 |
<dd>Called when a connection to the remote server is established. |
| 159 |
Modules that want to send data to the remote server on startup |
| 160 |
should use this callback; attempting to send data to the server |
| 161 |
before the connection is established will cause the data to be |
| 162 |
lost. The callback routine should always return 0.</dd> |
| 163 |
|
| 164 |
<dt><tt><b>introduce_user</b></tt> |
| 165 |
<br/>Parameters: <tt>char *<i>nick</i></tt></dt> |
| 166 |
<dd>Called whenever Services may need to introduce a pseudoclient (at |
| 167 |
startup and when receiving a <tt>KILL</tt> message). The |
| 168 |
<tt><i>nick</i></tt> parameter is the nickname of the pseudoclient |
| 169 |
which should be introduced (if it exists), or <tt>NULL</tt> when |
| 170 |
introducing all pseudoclients. The callback routine should return |
| 171 |
1 if <tt>nick</tt> is not <tt>NULL</tt> <i>and</i> the routine |
| 172 |
introduces a pseudoclient, 0 otherwise. (If <tt>nick</tt> is |
| 173 |
<tt>NULL</tt>, the routine should introduce any pseudoclients |
| 174 |
necessary and return 0.)</dd> |
| 175 |
|
| 176 |
<dt><tt><b>load module</b></tt> |
| 177 |
<br/>Parameters: <tt>Module *<i>module</i></tt>, |
| 178 |
<tt>const char *<i>modname</i></tt></dt> |
| 179 |
<dd>Called when a module is loaded, after its <tt>init_module()</tt> |
| 180 |
routine has been called. <tt><i>modname</i></tt> is the name of |
| 181 |
the module, either specified by the module (<tt>char |
| 182 |
module_name[]</tt>) or copied from the module's path. The callback |
| 183 |
routine should always return 0. This callback may be used, for |
| 184 |
example, to add callback routines to a new module's callbacks when |
| 185 |
the module is loaded.</dd> |
| 186 |
|
| 187 |
<dt><tt><b>m_privmsg</b></tt> |
| 188 |
<br/>Parameters: <tt>char *<i>source</i></tt>, <tt>char *<i>target</i></tt>, |
| 189 |
<tt>char *<i>message</i></tt></dt> |
| 190 |
<dd>Called for every <tt>PRIVMSG</tt> which is not ignored by Services. |
| 191 |
The callback routine should return 1 if it processes the message, |
| 192 |
0 otherwise.</dd> |
| 193 |
|
| 194 |
<dt><tt><b>m_whois</b></tt> |
| 195 |
<br/>Parameters: <tt>char *<i>source</i></tt>, <tt>char *<i>target</i></tt>, |
| 196 |
<tt>char *<i>target_server</i></tt></dt> |
| 197 |
<dd>Called for every <tt>WHOIS</tt> command. The callback routine |
| 198 |
should return 1 if it processes the message, 0 otherwise.</dd> |
| 199 |
|
| 200 |
<dt><tt><b>receive message</b></tt> |
| 201 |
<br/>Parameters: <tt>char *<i>source</i></tt>, <tt>char *<i>cmd</i></tt>, |
| 202 |
<tt>int <i>ac</i></tt>, <tt>char **<i>av</i></tt></dt> |
| 203 |
<dd>Called for every message received from the uplink server. The |
| 204 |
callback routine should return 1 if it processes the message, 0 |
| 205 |
otherwise. Note that it is acceptable for a callback routine to |
| 206 |
modify the parameters passed and return 0 to allow the next routine |
| 207 |
to continue, subject to the following constraints: |
| 208 |
<ul> |
| 209 |
<li>The number of message parameters (<tt><i>ac</i></tt>) is not |
| 210 |
changed.</li> |
| 211 |
<li>None of the strings (<tt><i>source</i></tt>, <tt><i>cmd</i></tt>, |
| 212 |
or any element of <tt><i>av</i></tt>) are lengthened. |
| 213 |
(Shortening strings is allowed.)</li> |
| 214 |
</ul></dd> |
| 215 |
|
| 216 |
<dt><tt><b>reconfigure</b></tt> |
| 217 |
<br/>Parameters: <tt>int <i>after_configure</i></tt></dt> |
| 218 |
<dd>Called twice when Services is signalled to re-read its |
| 219 |
configuration files. The first call is made before any module |
| 220 |
configuration data is changed (but after the main Services |
| 221 |
configuration settings have been updated), with |
| 222 |
<tt>after_configure</tt> set to 0; the second call is made after |
| 223 |
all configuration data has been successfully read and configuration |
| 224 |
variables have been updated, with <tt>after_configure</tt> set to |
| 225 |
1. Callback routines should always return 0.</dd> |
| 226 |
|
| 227 |
<dt><tt><b>save data</b></tt> |
| 228 |
<br/>Parameters: none</dt> |
| 229 |
<dd>Called whenever the save-data timeout runs out, or another action, |
| 230 |
such as OperServ <tt>UPDATE</tt>, explicitly causes data saving to |
| 231 |
occur. The callback routine should always return 0.</dd> |
| 232 |
|
| 233 |
<dt><tt><b>save data complete</b></tt> |
| 234 |
<br/>Parameters: <tt>int <i>successful</i></tt></dt> |
| 235 |
<dd>Called when a save-data operation completes. The |
| 236 |
<tt><i>successful</i></tt> parameter indicates whether the |
| 237 |
operation succeeded or not. The callback routine should always |
| 238 |
return 0.</dd> |
| 239 |
|
| 240 |
<dt><tt><b>server create</b></tt> |
| 241 |
<br/>Parameters: <tt>Server *<i>server</i></tt></dt> |
| 242 |
<dd>Called whenever a new server joins the network, after the server |
| 243 |
record is created. The callback routine should always return 0.</dd> |
| 244 |
|
| 245 |
<dt><tt><b>server delete</b></tt> |
| 246 |
<br/>Parameters: <tt>Server *<i>server</i></tt>, |
| 247 |
<tt>const char *<i>reason</i></tt></dt> |
| 248 |
<dd>Called whenever a server splits from the network, before the server |
| 249 |
record is deleted. The callback routine should always return 0.</dd> |
| 250 |
|
| 251 |
<dt><tt><b>set topic</b></tt> |
| 252 |
<br/>Parameters: <tt>const char *<i>source</i></tt>, <tt>Channel *<i>c</i></tt>, |
| 253 |
<tt>const char *<i>topic</i></tt>, <tt>const char *<i>setter</i></tt>, |
| 254 |
<tt>time_t <i>t</i></tt></dt> |
| 255 |
<dd>Called twice whenever <tt>set_topic()</tt> (in <tt>actions.c</tt>) |
| 256 |
is called to set the topic of a channel from Services. Parameters |
| 257 |
are as for <tt>set_topic()</tt> (in <tt>actions.c</tt>), except as |
| 258 |
noted below; <tt><i>source</i></tt> will always be non-<tt>NULL</tt>. |
| 259 |
The first call is done before the channel structure is modified, |
| 260 |
and all callback routines must return 0 in this case. The second |
| 261 |
call is done after the channel structure is modified, but before |
| 262 |
<tt>c->topic_time</tt> is changed; in this call, |
| 263 |
<tt><i>topic</i></tt> and <tt><i>setter</i></tt> are both |
| 264 |
<tt>NULL</tt>. If the callback routine returns 1, no further |
| 265 |
processing is done. This is currently used to ensure that the |
| 266 |
topic time is set so that the IRC servers will acknowledge the |
| 267 |
change under certain protocols.</dd> |
| 268 |
|
| 269 |
<dt><tt><b>unload module</b></tt> |
| 270 |
<br/>Parameters: <tt>Module *<i>module</i></tt></dt> |
| 271 |
<dd>Called when a module is unloaded, after its <tt>exit_module()</tt> |
| 272 |
routine has been called. The module handle <tt><i>module</i></tt> |
| 273 |
is the same value as was passed to the "<tt>load module</tt>" |
| 274 |
callback for this module, but the handle may not be used with any |
| 275 |
module functions except <tt>get_module_name()</tt>. The callback |
| 276 |
routine should always return 0. Note that it is not necessary (and |
| 277 |
in fact not possible, as mentioned above) to use this callback to |
| 278 |
remove callback functions from a module which is being unloaded; |
| 279 |
those callback entries will be removed automatically.</dd> |
| 280 |
|
| 281 |
<dt><tt><b>user check</b></tt> |
| 282 |
<br/>Parameters: <tt>int <i>ac</i></tt>, <tt>char **<i>av</i></tt></dt> |
| 283 |
<dd>Called whenever a client joins the network, before the |
| 284 |
<tt>User</tt> record is created. <tt><i>ac</i></tt> and |
| 285 |
<tt><i>av</i></tt> are the argument list to the <tt>NICK</tt> (or |
| 286 |
<tt>USER</tt>) message, as passed to <tt>users.c/do_nick()</tt>. |
| 287 |
The callback routine should return 0 to allow the client to connect |
| 288 |
or 1 to disallow (in this case the routine should take action to |
| 289 |
remove the client from the network, such as sending a <tt>KILL</tt> |
| 290 |
message). |
| 291 |
|
| 292 |
<p><i>Notice:</i> When using <tt>add_callback_pri()</tt> with this |
| 293 |
callback, never add a routine with priority less than -9, or the |
| 294 |
<tt>operserv/sessions</tt> module will malfunction!</p></dd> |
| 295 |
|
| 296 |
<dt><tt><b>user create</b></tt> |
| 297 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>int <i>ac</i></tt>, |
| 298 |
<tt>char **<i>av</i></tt>, <tt>int <i>reconnect</i></tt></dt> |
| 299 |
<dd>Called whenever a client joins the network, after the <tt>User</tt> |
| 300 |
record is created. <tt><i>ac</i></tt> and <tt><i>av</i></tt> are |
| 301 |
the argument list to the <tt>NICK</tt> (or <tt>USER</tt>) message, |
| 302 |
as passed to <tt>users.c/do_nick()</tt>. <tt><i>reconnect</i></tt> |
| 303 |
is nonzero for clients that are reconnecting after a network split. |
| 304 |
The callback routine should always return 0.</dd> |
| 305 |
|
| 306 |
<dt><tt><b>user delete</b></tt> |
| 307 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>reason</i></tt>, |
| 308 |
<tt>int <i>is_kill</i></tt></dt> |
| 309 |
<dd>Called whenever a client leaves the network (whether by |
| 310 |
<tt>QUIT</tt> or <tt>KILL</tt>), before the <tt>User</tt> record is |
| 311 |
deleted. <tt><i>is_kill</i></tt> is 1 if the client is |
| 312 |
disconnecting because of a <tt>KILL</tt>, 0 if because of a |
| 313 |
<tt>QUIT</tt>. The callback routine should always return 0.</dd> |
| 314 |
|
| 315 |
<dt><tt><b>user MODE</b></tt> |
| 316 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>int <i>modechar</i></tt>, |
| 317 |
<tt>int <i>add</i></tt>, <tt>char **<i>av</i></tt></dt> |
| 318 |
<dd>Called for every mode character given in a client <tt>MODE</tt> |
| 319 |
message. <tt><i>add</i></tt> is nonzero when adding modes and zero |
| 320 |
when subtracting. <tt><i>av</i></tt> points to the first argument |
| 321 |
for the mode; there are guaranteed to be enough arguments for the |
| 322 |
mode character (provided the number of parameters in the mode |
| 323 |
definition is set correctly). The callback routine should return 1 |
| 324 |
if it processes the mode, 0 otherwise.</dd> |
| 325 |
|
| 326 |
<dt><tt><b>user nickchange (after)</b></tt> |
| 327 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>const char *<i>oldnick</i></tt></dt> |
| 328 |
<dd>Called whenever a client changes nicknames, after the nickname is |
| 329 |
actually changed. The callback routine should return 1 if it |
| 330 |
kills the client, 0 otherwise.</dd> |
| 331 |
|
| 332 |
<dt><tt><b>user nickchange (before)</b></tt> |
| 333 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>const char *<i>newnick</i></tt></dt> |
| 334 |
<dd>Called whenever a client changes nicknames, before the nickname is |
| 335 |
actually changed. The callback routine should always return 0. |
| 336 |
Note that clients should never be killed within this callback; use |
| 337 |
the "<tt>user nickchange (after)</tt>" callback for that.</dd> |
| 338 |
|
| 339 |
<dt><tt><b>user servicestamp change</b></tt> |
| 340 |
<br/>Parameters: <tt>User *<i>user</i></tt></dt> |
| 341 |
<dd>Called when a client's Services timestamp (the <tt>servicestamp</tt> |
| 342 |
field) is altered and the network should be informed of it. The |
| 343 |
callback routine should always return 0.</dd> |
| 344 |
</dl> |
| 345 |
|
| 346 |
<p class="backlink"><a href="#top">Back to top</a></p> |
| 347 |
|
| 348 |
<!------------------------------------------------------------------------> |
| 349 |
<hr/> |
| 350 |
|
| 351 |
<h3 class="subsection-title" id="s3">C-3. OperServ callbacks</h3> |
| 352 |
|
| 353 |
<dl> |
| 354 |
<dt><tt><b>command</b></tt> |
| 355 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>command</i></tt></dt> |
| 356 |
<dd>Called for every message (other than a CTCP <tt>PING</tt> or empty |
| 357 |
message) received by OperServ. <tt><i>command</i></tt> is the |
| 358 |
first word in the message (where words are separated by spaces); |
| 359 |
the remaining text can be obtained through repeated calls to |
| 360 |
<tt>strtok()</tt> with a <tt>NULL</tt> first parameter. The |
| 361 |
callback routine should return 1 if it processes the message, 0 |
| 362 |
otherwise. If the routine does not process the message, it |
| 363 |
<i>must not</i> call <tt>strtok()</tt>.</dd> |
| 364 |
|
| 365 |
<dt><tt><b>expire maskdata</b></tt> |
| 366 |
<br/>Parameters: <tt>uint32 <i>type</i></tt>, <tt>MaskData *<i>md</i></tt></dt> |
| 367 |
<dd>Called when a <tt>MaskData</tt> entry is about to be expired, just |
| 368 |
before it is actually deleted. The callback routine should always |
| 369 |
return 0.</dd> |
| 370 |
|
| 371 |
<dt><tt><b>HELP</b></tt> |
| 372 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>param</i></tt></dt> |
| 373 |
<dd>Called when the <tt>HELP</tt> command is used with a parameter. |
| 374 |
The callback should return 1 if it processes the message, 0 |
| 375 |
otherwise.</dd> |
| 376 |
|
| 377 |
<dt><tt><b>HELP COMMANDS</b></tt> |
| 378 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>int <i>which</i></tt></dt> |
| 379 |
<dd>Called when the <tt>HELP COMMANDS</tt> command is used. The |
| 380 |
<tt><i>which</i></tt> parameter is 0 when called after the list of |
| 381 |
unprivileged (IRC operator) commands, 1 after the Services operator |
| 382 |
commands, 2 after the Services administrator commands, and 3 after |
| 383 |
the Services root commands. The callback routine should always |
| 384 |
return 0.</dd> |
| 385 |
|
| 386 |
<dt><tt><b>SET</b></tt> |
| 387 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>char *<i>option</i></tt>, |
| 388 |
<tt>char *<i>param</i></tt></dt> |
| 389 |
<dd>Called when the <tt>SET</tt> command is used. All parameters are |
| 390 |
guaranteed to be valid (non-<tt>NULL</tt>); <tt><i>param</i></tt> |
| 391 |
may contain multiple words. The callback routine should return 1 |
| 392 |
if it processes the given option, 0 otherwise.</dd> |
| 393 |
|
| 394 |
<dt><tt><b>STATS</b></tt> |
| 395 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>extra</i></tt></dt> |
| 396 |
<dd>Called for every <tt>STATS</tt> command that is not plain |
| 397 |
"<tt>STATS</tt>", "<tt>STATS ALL</tt>", "<tt>STATS NETWORK</tt>", |
| 398 |
or "<tt>STATS RESET</tt>". "<tt>extra</tt>" contains the remainder |
| 399 |
of the message (after <tt>STATS</tt> and any following whitespace). |
| 400 |
The callback routine should return 1 if it processes the command, 0 |
| 401 |
otherwise.</dd> |
| 402 |
|
| 403 |
<dt><tt><b>STATS ALL</b></tt> |
| 404 |
<br/>Parameters: <tt>User *<i>user</i></tt>, |
| 405 |
<tt>const char *<i>s_OperServ</i></tt></dt> |
| 406 |
<dd>Called for every <tt>STATS ALL</tt> command. |
| 407 |
<tt><i>s_OperServ</i></tt> is the OperServ pseudoclient nickname; |
| 408 |
the callback routine should send messages using this nickname. The |
| 409 |
callback routine should always return 0.</dd> |
| 410 |
|
| 411 |
<dt><tt><b>cancel_akill</b></tt> (<tt>operserv/akill</tt> module) |
| 412 |
<br/>Parameters: <tt>const char *<i>username</i></tt>, |
| 413 |
<tt>const char *<i>host</i></tt></dt> |
| 414 |
<dd>Called when an autokill is to be removed from the uplink server. |
| 415 |
The callback routine should return 1 if it removes the autokill, 0 |
| 416 |
otherwise.</dd> |
| 417 |
|
| 418 |
<dt><tt><b>cancel_exclude</b></tt> (<tt>operserv/akill</tt> module) |
| 419 |
<br/>Parameters: <tt>const char *<i>username</i></tt>, |
| 420 |
<tt>const char *<i>host</i></tt></dt> |
| 421 |
<dd>Called when an autokill exclusion is to be removed from the uplink |
| 422 |
server. The callback routine should return 1 if it removes the |
| 423 |
autokill exclusion, 0 otherwise.</dd> |
| 424 |
|
| 425 |
<dt><tt><b>send_akill</b></tt> (<tt>operserv/akill</tt> module) |
| 426 |
<br/>Parameters: <tt>const char *username</tt>, <tt>const char *host</tt>, |
| 427 |
<tt>time_t expires</tt>, <tt>const char *who</tt>, |
| 428 |
<tt>const char *reason</tt></dt> |
| 429 |
<dd>Called when an autokill is to be sent to the uplink server. The |
| 430 |
callback routine should return 1 if it sends the autokill, 0 |
| 431 |
otherwise.</dd> |
| 432 |
|
| 433 |
<dt><tt><b>send_exclude</b></tt> (<tt>operserv/akill</tt> module) |
| 434 |
<br/>Parameters: <tt>const char *username</tt>, <tt>const char *host</tt>, |
| 435 |
<tt>time_t expires</tt>, <tt>const char *who</tt>, |
| 436 |
<tt>const char *reason</tt></dt> |
| 437 |
<dd>Called when an autokill exclusion is to be sent to the uplink |
| 438 |
server. The callback routine should return 1 if it sends the |
| 439 |
autokill exclusion, 0 otherwise.</dd> |
| 440 |
|
| 441 |
<dt><tt><b>cancel_sgline</b></tt> (<tt>operserv/sline</tt> module) |
| 442 |
<br/>Parameters: <tt>const char *<i>mask</i></tt></dt> |
| 443 |
<dd>Called when an SGline is to be removed from the uplink server. |
| 444 |
The callback routine should return 1 if it removes the SGline, 0 |
| 445 |
otherwise.</dd> |
| 446 |
|
| 447 |
<dt><tt><b>cancel_sqline</b></tt> (<tt>operserv/sline</tt> module) |
| 448 |
<br/>Parameters: <tt>const char *<i>mask</i></tt></dt> |
| 449 |
<dd>Called when an SQline is to be removed from the uplink server. |
| 450 |
The callback routine should return 1 if it removes the SQline, 0 |
| 451 |
otherwise.</dd> |
| 452 |
|
| 453 |
<dt><tt><b>cancel_szline</b></tt> (<tt>operserv/sline</tt> module) |
| 454 |
<br/>Parameters: <tt>const char *<i>mask</i></tt></dt> |
| 455 |
<dd>Called when an SZline is to be removed from the uplink server. |
| 456 |
The callback routine should return 1 if it removes the SZline, 0 |
| 457 |
otherwise.</dd> |
| 458 |
|
| 459 |
<dt><tt><b>send_sgline</b></tt> (<tt>operserv/sline</tt> module) |
| 460 |
<br/>Parameters: <tt>const char *<i>mask</i></tt>, <tt>time_t expires</tt>, |
| 461 |
<tt>const char *who</tt>, <tt>const char *reason</tt></dt> |
| 462 |
<dd>Called when an SGline is to be sent to the uplink server. The |
| 463 |
callback routine should return 1 if it sends the SGline, 0 |
| 464 |
otherwise.</dd> |
| 465 |
|
| 466 |
<dt><tt><b>send_sqline</b></tt> (<tt>operserv/sline</tt> module) |
| 467 |
<br/>Parameters: <tt>const char *<i>mask</i></tt>, <tt>time_t expires</tt>, |
| 468 |
<tt>const char *who</tt>, <tt>const char *reason</tt></dt> |
| 469 |
<dd>Called when an SQline is to be sent to the uplink server. The |
| 470 |
callback routine should return 1 if it sends the SQline, 0 |
| 471 |
otherwise.</dd> |
| 472 |
|
| 473 |
<dt><tt><b>send_szline</b></tt> (<tt>operserv/sline</tt> module) |
| 474 |
<br/>Parameters: <tt>const char *<i>mask</i></tt>, <tt>time_t expires</tt>, |
| 475 |
<tt>const char *who</tt>, <tt>const char *reason</tt></dt> |
| 476 |
<dd>Called when an SZline is to be sent to the uplink server. The |
| 477 |
callback routine should return 1 if it sends the SZline, 0 |
| 478 |
otherwise.</dd> |
| 479 |
</dl> |
| 480 |
|
| 481 |
<p class="backlink"><a href="#top">Back to top</a></p> |
| 482 |
|
| 483 |
<!------------------------------------------------------------------------> |
| 484 |
<hr/> |
| 485 |
|
| 486 |
<h3 class="subsection-title" id="s4">C-4. NickServ callbacks</h3> |
| 487 |
|
| 488 |
<dl> |
| 489 |
<dt><tt><b>authed</b></tt> (module <tt>nickserv/mail-auth</tt>) |
| 490 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>NickInfo *<i>ni</i></tt>, |
| 491 |
<tt>NickGroupInfo *<i>ngi</i></tt>, <tt>int <i>authreason</i></tt></dt> |
| 492 |
<dd>Called when a client successfully authenticates its nickname with |
| 493 |
the <tt>AUTH</tt> command, after all normal processing has been |
| 494 |
performed. <tt><i>authreason</i></tt> is the value that the |
| 495 |
<tt>ngi->authreason</tt> field had before being cleared (one of |
| 496 |
the <tt>NICKAUTH_*</tt> constants). The callback routine should |
| 497 |
always return 0.</dd> |
| 498 |
|
| 499 |
<dt><tt><b>cancel user</b></tt> |
| 500 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>int <i>old_status</i></tt>, |
| 501 |
<tt>int <i>old_authstat</i></tt></dt> |
| 502 |
<dd>Called whenever the <tt>cancel_user()</tt> routine is called for a |
| 503 |
client with a registered nickname. <tt><i>old_status</i></tt> is |
| 504 |
the value of the client's nickname's <tt>status</tt> field while |
| 505 |
the nickname was in use (when the callback is called, all temporary |
| 506 |
flags will have been cleared); <tt><i>old_authstat</i></tt> is |
| 507 |
likewise the value before clearing of the nickname group's |
| 508 |
<tt>authstat</tt> field. The callback routine should always |
| 509 |
return 0.</dd> |
| 510 |
|
| 511 |
<dt><tt><b>check_expire</b></tt> |
| 512 |
<br/>Parameters: <tt>NickInfo *ni, NickGroupInfo *<i>ngi</i></tt></dt> |
| 513 |
<dd>Called when a nickname is being checked for expiration, after the |
| 514 |
nickname's last-used time has been updated (if appropriate). The |
| 515 |
callback routine should return 1 if the nickname should be expired, |
| 516 |
0 otherwise. If returning 1, the callback routine should log an |
| 517 |
appropriate message.</dd> |
| 518 |
|
| 519 |
<dt><tt><b>check recognized</b></tt> |
| 520 |
<br/>Parameters: <tt>const User *<i>u</i></tt></dt> |
| 521 |
<dd>Called whenever Services needs to check whether a client is |
| 522 |
recognized as being the owner of the nickname it is using |
| 523 |
(<i>e.g.,</i> when the client connects to the network). The |
| 524 |
<tt>User</tt> structure is guaranteed to have valid |
| 525 |
<tt><i>ni</i></tt> and <tt><i>ngi</i></tt> pointers. The callback |
| 526 |
routine should return: |
| 527 |
<ul> |
| 528 |
<li>0, to indicate that the client was not recognized;</li> |
| 529 |
<li>1, to indicate that the client was recognized as the owner of |
| 530 |
the nickname; or</li> |
| 531 |
<li>2, to indicate that the client should <i>not</i> be recognized |
| 532 |
as the owner of the nickname, regardless of any subsequent |
| 533 |
checks.</li> |
| 534 |
</ul></dd> |
| 535 |
|
| 536 |
<dt><tt><b>collide</b></tt> |
| 537 |
<br/>Parameters: <tt>User *<i>u</i></tt></dt> |
| 538 |
<dd>Called whenever NickServ determines that a client should be |
| 539 |
"collided". The callback should return 1 if it handles colliding |
| 540 |
the client (for example, by forcibly changing the client's |
| 541 |
nickname), or 0 to allow normal collide processing to continue.</dd> |
| 542 |
|
| 543 |
<dt><tt><b>command</b></tt> |
| 544 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>command</i></tt></dt> |
| 545 |
<dd>Called for every message (other than a CTCP <tt>PING</tt> or empty |
| 546 |
message) received by NickServ. See the OperServ "<tt>command</tt>" |
| 547 |
callback for details.</dd> |
| 548 |
|
| 549 |
<dt><tt><b>HELP</b></tt> |
| 550 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>param</i></tt></dt> |
| 551 |
<dd>Called when the <tt>HELP</tt> command is used with a parameter. |
| 552 |
The callback should return 1 if it processes the messages, 0 |
| 553 |
otherwise.</dd> |
| 554 |
|
| 555 |
<dt><tt><b>HELP COMMANDS</b></tt> |
| 556 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>int <i>which</i></tt></dt> |
| 557 |
<dd>Called when the <tt>HELP COMMANDS</tt> command is used. The |
| 558 |
<tt><i>which</i></tt> parameter is 0 when called after the list of |
| 559 |
unprivileged commands and 1 after the list of privileged commands |
| 560 |
(those shown to IRC operators). The callback routine should always |
| 561 |
return 0.</dd> |
| 562 |
|
| 563 |
<dt><tt><b>identified</b></tt> |
| 564 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>int <i>old_authstat</i></tt></dt> |
| 565 |
<dd>Called when a client identifies for its nickname via the IDENTIFY |
| 566 |
command. <tt><i>old_authstat</i></tt> is the authorization status |
| 567 |
of the nickname before the identify took place. The callback |
| 568 |
routine should always return 0.</dd> |
| 569 |
|
| 570 |
<dt><tt><b>IDENTIFY check</b></tt> |
| 571 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>char *<i>pass</i></tt></dt> |
| 572 |
<dd>Called when a client attempts to identify for its nickname, after the |
| 573 |
standard checks (whether the nickname exists, etc.) are done but before |
| 574 |
the password itself is checked. The callback routine should return |
| 575 |
1 to disallow identification or 0 to allow processing to continue |
| 576 |
normally.</dd> |
| 577 |
|
| 578 |
<dt><tt><b>nick delete</b></tt> |
| 579 |
<br/>Parameters: <tt>NickInfo *<i>ni</i></tt></dt> |
| 580 |
<dd>Called when a nickname's registration is deleted. The callback routine |
| 581 |
should always return 0.</dd> |
| 582 |
|
| 583 |
<dt><tt><b>nickgroup delete</b></tt> |
| 584 |
<br/>Parameters: <tt>NickGroupInfo *<i>ngi</i></tt>, |
| 585 |
<tt>const char *<i>oldnick</i></tt></dt> |
| 586 |
<dd>Called when a nickname group is deleted (<i>i.e.</i>, when the last |
| 587 |
nickname for the group is deleted), after the "<tt>nick delete</tt>" |
| 588 |
callback is called. <tt><i>oldnick</i></tt> is the nickname whose |
| 589 |
deletion caused this nickname group to be deleted. The callback |
| 590 |
routine should always return 0.</dd> |
| 591 |
|
| 592 |
<dt><tt><b>REGISTER/LINK check</b></tt> |
| 593 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>const char *<i>nick</i></tt>, |
| 594 |
<tt>char *<i>password</i></tt>, <tt>char *<i>email</i></tt></dt> |
| 595 |
<dd>Called when a client attempts to register its nickname, after the |
| 596 |
validity of the parameters has been checked but before checking |
| 597 |
whether the nickname exists or the password is strong enough. |
| 598 |
<tt><i>u</i></tt> is the client that sent the <tt>REGISTER</tt> |
| 599 |
command, and <tt><i>nick</i></tt> is their nickname (the same as |
| 600 |
<tt><i>u</i>->nick</tt>). <tt><i>email</i></tt> may be |
| 601 |
<tt>NULL</tt> (if the client did not provide an E-mail address), |
| 602 |
but <tt><i>password</i></tt> will always be non-<tt>NULL</tt>. |
| 603 |
The callback routine should return 0 to allow the registration to |
| 604 |
continue or 1 to disallow it. |
| 605 |
|
| 606 |
<p>Also called by the <tt>nickserv/link</tt> module when a client |
| 607 |
attempts to link a new nickname to its own. In this case |
| 608 |
<tt><i>nick</i></tt> is the requested target nickname (different |
| 609 |
from <tt><i>u</i>->nick</tt>), and <tt><i>password</i></tt> and |
| 610 |
<tt><i>email</i></tt> are both <tt>NULL</tt>. The callback is |
| 611 |
called after the nickname is checked for validity (length and |
| 612 |
invalid characters), but before checking whether the client has |
| 613 |
registered their current nickname. The callback routine should |
| 614 |
return 0 to allow the link to be made or 1 to disallow it.</p></dd> |
| 615 |
|
| 616 |
<dt><tt><b>registered</b></tt> |
| 617 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>NickInfo *<i>ni</i></tt>, |
| 618 |
<tt>NickGroupInfo *<i>ngi</i></tt>, |
| 619 |
<tt>int *<i>replied</i></tt></dt> |
| 620 |
<dd>Called when a client registers its nickname, after the data |
| 621 |
structures have been set up. The integer pointed to by |
| 622 |
<tt><i>replied</i></tt> can be set to 1 to disable the standard |
| 623 |
"your nickname has been registered" reply. The callback need not call |
| 624 |
<tt>put_<i>xxx</i>()</tt> even if it modifies <tt><i>ni</i></tt> or |
| 625 |
<tt><i>ngi</i></tt>, as the caller will do so afterwards. The |
| 626 |
callback routine should always return 0.</dd> |
| 627 |
|
| 628 |
<dt><tt><b>SET</b></tt> |
| 629 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>NickInfo *<i>ni</i></tt>, |
| 630 |
<tt>NickGroupInfo *<i>ngi</i></tt>, |
| 631 |
<tt>char *<i>option</i></tt>, <tt>char *<i>param</i></tt></dt> |
| 632 |
<dd>Called when the <tt>SET</tt> command is used. All parameters are |
| 633 |
guaranteed to be valid (non-<tt>NULL</tt>), and standard permission |
| 634 |
checks will have been performed (so <tt><i>u</i></tt> either is |
| 635 |
identified for <tt><i>ni</i></tt>/<tt><i>ngi</i></tt> or is a |
| 636 |
Services administrator). The callback routine should return 1 if |
| 637 |
it processes the given option, 0 otherwise.</dd> |
| 638 |
|
| 639 |
<dt><tt><b>SET EMAIL</b></tt> |
| 640 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>NickGroupInfo *<i>ngi</i></tt>, |
| 641 |
<tt>char *<i>last_email</i></tt></dt> |
| 642 |
<dd>Called when the E-mail address associated with a nickname group is set, |
| 643 |
changed, or unset. <tt><i>u</i></tt> is the client making the |
| 644 |
change; this may not necessarily be the owner of the nickname if, for |
| 645 |
example, a Services administrator is making the change. The new |
| 646 |
address is stored in <tt><i>ngi</i>->email</tt>, while the |
| 647 |
previous address is passed in <tt><i>last_email</i></tt> (this will |
| 648 |
be <tt>NULL</tt> if no address was previously set). The callback |
| 649 |
routine should always return 0.</dd> |
| 650 |
|
| 651 |
<dt><tt><b>set identified</b></tt> |
| 652 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>int <i>old_authstat</i></tt></dt> |
| 653 |
<dd>Called whenever the <tt>set_identified()</tt> routine is called for |
| 654 |
a client, after the nickname structure has been updated. |
| 655 |
<tt><i>old_authstat</i></tt> is the previous value of the client |
| 656 |
nickname's <tt>authstat</tt> field. The callback routine should |
| 657 |
always return 0.</dd> |
| 658 |
|
| 659 |
<dt><tt><b>UNSET</b></tt> |
| 660 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>NickInfo *<i>ni</i></tt>, |
| 661 |
<tt>NickGroupInfo *<i>ngi</i></tt>, |
| 662 |
<tt>char *<i>option</i></tt></dt> |
| 663 |
<dd>Called when the <tt>UNSET</tt> command is used. All parameters are |
| 664 |
guaranteed to be valid (non-<tt>NULL</tt>), and standard permission |
| 665 |
checks will have been performed (so <tt><i>u</i></tt> either is |
| 666 |
identified for <tt><i>ni</i></tt>/<tt><i>ngi</i></tt> or is a |
| 667 |
Services administrator). The callback routine should return 1 if |
| 668 |
it processes the given option, 0 otherwise.</dd> |
| 669 |
|
| 670 |
<dt><tt><b>send_svsjoin</b></tt> (<tt>nickserv/autojoin</tt> module) |
| 671 |
<br/>Parameters: <tt>const char *nick</tt>, <tt>const char *channel</tt></dt> |
| 672 |
<dd>Called when a client should be forced to join a channel. The |
| 673 |
callback routine should return 1 if it forces the client into the |
| 674 |
channel, 0 otherwise.</dd> |
| 675 |
</dl> |
| 676 |
|
| 677 |
<p class="backlink"><a href="#top">Back to top</a></p> |
| 678 |
|
| 679 |
<!------------------------------------------------------------------------> |
| 680 |
<hr/> |
| 681 |
|
| 682 |
<h3 class="subsection-title" id="s5">C-5. ChanServ callbacks</h3> |
| 683 |
|
| 684 |
<dl> |
| 685 |
<dt><tt><b>check_chan_user_modes</b></tt> |
| 686 |
<br/>Parameters: <tt>const char *<i>source</i></tt>, <tt>User *<i>user</i></tt>, |
| 687 |
<tt>Channel *<i>c</i></tt>, <tt>int32 <i>modes</i></tt></dt> |
| 688 |
<dd>Called when checking a client's modes on a channel, before any |
| 689 |
standard checks are performed. The mode change is being performed |
| 690 |
by <tt><i>source</i></tt> (<tt>NULL</tt> for a channel join) on |
| 691 |
<tt><i>user</i></tt> on channel <tt><i>c</i></tt>, and the client's |
| 692 |
current modes on the channel are <tt><i>modes</i></tt>. The |
| 693 |
callback routine should return 0 to allow normal checking to |
| 694 |
continue or 1 to abort further checks. |
| 695 |
|
| 696 |
<p><b>Note:</b> <tt><i>source</i></tt> may be the empty string; this |
| 697 |
indicates an internal call to verify a client's current modes. In |
| 698 |
this case callback routines should not make any decisions about |
| 699 |
modes based on the value of <tt><i>source</i></tt>.</p></dd> |
| 700 |
|
| 701 |
<dt><tt><b>check_kick</b></tt> |
| 702 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>const char *<i>chan</i></tt>, |
| 703 |
<tt>ChannelInfo *<i>ci</i></tt>, <tt>char **<i>mask_ret</i></tt>, |
| 704 |
<tt>const char **<i>reason_ret</i></tt></dt> |
| 705 |
<dd>Called when checking whether a client should be kicked from a |
| 706 |
channel, before any standard checks are performed. All parameters |
| 707 |
are guaranteed to be non-<tt>NULL</tt>, except for |
| 708 |
<tt><i>ci</i></tt>, which will be <tt>NULL</tt> when the channel is |
| 709 |
not registered. The callback routine may return: |
| 710 |
<ul> |
| 711 |
<li>0, to allow normal processing to continue.</li> |
| 712 |
<li>1, to cause the client to be kicked from the channel. In this |
| 713 |
case, the callback routine must set <tt>*<i>mask_ret</i></tt> |
| 714 |
to a newly <tt>malloc()</tt>/<tt>smalloc()</tt>'d memory |
| 715 |
area containing the mask to be banned (<tt>create_mask()</tt> |
| 716 |
or <tt>sstrdup()</tt> may also be used) and |
| 717 |
<tt>*<i>reason_ret</i></tt> to a string for use as the |
| 718 |
reason in the kick.</li> |
| 719 |
<li>2, to abort further processing and allow the client to enter the |
| 720 |
channel.</li> |
| 721 |
</ul></dd> |
| 722 |
|
| 723 |
<dt><tt><b>check_modes</b></tt> |
| 724 |
<br/>Parameters: <tt>Channel *<i>channel</i></tt>, |
| 725 |
<tt>ChannelInfo *<i>ci</i></tt>, <tt>int <i>add</i></tt>, |
| 726 |
<tt>int32 <i>flag</i></tt></dt> |
| 727 |
<dd>Called when checking a channel's modes against its mode lock for |
| 728 |
every mode locked either on (<tt>add</tt> nonzero) or off |
| 729 |
(<tt>add</tt> zero). The callback routine should return 1 if it |
| 730 |
processes the mode, 0 if not. If a mode is not processed by any |
| 731 |
callback and is further not specially handled by Services |
| 732 |
(<tt>+k</tt> and <tt>+l</tt> modes), the default action is to |
| 733 |
simply modify the channel's current modes to match the mode lock |
| 734 |
(by calling <tt>set_cmode(...,"+<i>X</i>")</tt> or |
| 735 |
<tt>set_cmode(...,"-<i>X</i>")</tt> for mode <tt><i>X</i></tt>), so |
| 736 |
it is not necessary to add a callback for modes for which this |
| 737 |
behavior is sufficient.</dd> |
| 738 |
|
| 739 |
<dt><tt><b>CLEAR</b></tt> |
| 740 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>Channel *<i>channel</i></tt>, |
| 741 |
<tt>char *<i>what</i></tt></dt> |
| 742 |
<dd>Called when a valid <tt>CLEAR</tt> command is received (<i>i.e.</i>, |
| 743 |
from a client with permission to use the command on the given |
| 744 |
channel). The callback routine should return 1 if it processes the |
| 745 |
command, 0 if not.</dd> |
| 746 |
|
| 747 |
<dt><tt><b>command</b></tt> |
| 748 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>command</i></tt></dt> |
| 749 |
<dd>Called for every message (other than a CTCP <tt>PING</tt> or empty |
| 750 |
message) received by ChanServ. See the OperServ "<tt>command</tt>" |
| 751 |
callback for details.</dd> |
| 752 |
|
| 753 |
<dt><tt><b>HELP</b></tt> |
| 754 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>param</i></tt></dt> |
| 755 |
<dd>Called when the <tt>HELP</tt> command is used with a parameter. |
| 756 |
The callback should return 1 if it processes the message, 0 |
| 757 |
otherwise.</dd> |
| 758 |
|
| 759 |
<dt><tt><b>HELP COMMANDS</b></tt> |
| 760 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>int <i>which</i></tt></dt> |
| 761 |
<dd>Called when the <tt>HELP COMMANDS</tt> command is used. The |
| 762 |
<tt><i>which</i></tt> parameter is 0 when called after the list of |
| 763 |
unprivileged commands and 1 after the list of privileged commands |
| 764 |
(those shown to IRC operators). The callback routine should always |
| 765 |
return 0.</dd> |
| 766 |
|
| 767 |
<dt><tt><b>INVITE</b></tt> |
| 768 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>Channel *<i>c</i></tt>, |
| 769 |
<tt>ChannelInfo *<i>ci</i></tt></dt> |
| 770 |
<dd>Called whenever a valid <tt>INVITE</tt> command is received |
| 771 |
(<i>i.e.</i>, the client has permission to use <tt>INVITE</tt> for |
| 772 |
the channel). The callback should return 0 to allow normal |
| 773 |
processing to continue or 1 to abort further processing.</dd> |
| 774 |
|
| 775 |
<dt><tt><b>SET</b></tt> |
| 776 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>ChannelInfo *<i>ci</i></tt>, |
| 777 |
<tt>char *<i>option</i></tt>, <tt>char *<i>param</i></tt></dt> |
| 778 |
<dd>Called when the <tt>SET</tt> command is used. All parameters are |
| 779 |
guaranteed to be valid (non-<tt>NULL</tt>), and standard permission |
| 780 |
checks will have been performed (so `<tt>u</tt>' either is |
| 781 |
identified for <tt><i>ci</i></tt> or is a Services administrator). |
| 782 |
The callback routine should return 1 if it processes the given |
| 783 |
option, 0 otherwise.</dd> |
| 784 |
|
| 785 |
<dt><tt><b>SET MLOCK</b></tt> |
| 786 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>ChannelInfo *<i>ci</i></tt>, |
| 787 |
<tt>int <i>modechar</i></tt>, <tt>int <i>add</i></tt>, |
| 788 |
<tt>char **<i>av</i></tt></dt> |
| 789 |
<dd>Called for each valid mode character in a <tt>SET MLOCK</tt> |
| 790 |
command. <tt><i>add</i></tt> is nonzero if adding modes, zero if |
| 791 |
removing them. <tt><i>av</i></tt> points to the first argument for |
| 792 |
the mode; there are guaranteed to be enough arguments for the mode |
| 793 |
character (provided the number of arguments in the mode definition |
| 794 |
is set correctly. The new mode lock (currently being constructed) |
| 795 |
is stored in the <tt>ci->mlock</tt> structure. The callback |
| 796 |
routine should return 1 if it encounters an invalid parameter for a |
| 797 |
mode, 0 otherwise. |
| 798 |
|
| 799 |
<p>Also called with <tt><i>modechar</i></tt> set to zero when all |
| 800 |
modes have been processed. In this case, <tt><i>add</i></tt> and |
| 801 |
<tt><i>av</i></tt> are undefined, and the callback routine should |
| 802 |
return 1 if there is a problem with the mode lock, 0 otherwise.</p></dd> |
| 803 |
|
| 804 |
<dt><tt><b>UNBAN</b></tt> |
| 805 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>Channel *<i>c</i></tt>, |
| 806 |
<tt>ChannelInfo *<i>ci</i></tt></dt> |
| 807 |
<dd>Called whenever a valid <tt>UNBAN</tt> command is received |
| 808 |
(<i>i.e.</i>, the client has permission to use <tt>UNBAN</tt> for the |
| 809 |
channel). The callback should return 0 to allow normal processing |
| 810 |
to continue or 1 to abort further processing.</dd> |
| 811 |
|
| 812 |
<dt><tt><b>UNSET</b></tt> |
| 813 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>ChannelInfo *<i>ci</i></tt>, |
| 814 |
<tt>char *<i>option</i></tt></dt> |
| 815 |
<dd>Called when the <tt>UNSET</tt> command is used. All parameters are |
| 816 |
guaranteed to be valid (non-<tt>NULL</tt>), and standard permission |
| 817 |
checks will have been performed (so `<tt>u</tt>' either is |
| 818 |
identified for <tt><i>ci</i></tt> or is a Services administrator). |
| 819 |
The callback routine should return 1 if it processes the given |
| 820 |
option, 0 otherwise.</dd> |
| 821 |
</dl> |
| 822 |
|
| 823 |
<p class="backlink"><a href="#top">Back to top</a></p> |
| 824 |
|
| 825 |
<!------------------------------------------------------------------------> |
| 826 |
<hr/> |
| 827 |
|
| 828 |
<h3 class="subsection-title" id="s6">C-6. MemoServ callbacks</h3> |
| 829 |
|
| 830 |
<dl> |
| 831 |
<dt><tt><b>command</b></tt> |
| 832 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>command</i></tt></dt> |
| 833 |
<dd>Called for every message (other than a CTCP <tt>PING</tt> or empty |
| 834 |
message) received by MemoServ. See the OperServ "<tt>command</tt>" |
| 835 |
callback for details.</dd> |
| 836 |
|
| 837 |
<dt><tt><b>HELP</b></tt> |
| 838 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>param</i></tt></dt> |
| 839 |
<dd>Called when the <tt>HELP</tt> command is used with a parameter. |
| 840 |
The callback should return 1 if it processes the message, 0 |
| 841 |
otherwise.</dd> |
| 842 |
|
| 843 |
<dt><tt><b>HELP COMMANDS</b></tt> |
| 844 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>int <i>which</i></tt></dt> |
| 845 |
<dd>Called when the <tt>HELP COMMANDS</tt> command is used. The |
| 846 |
<tt><i>which</i></tt> parameter is 0 when called after the list of |
| 847 |
unprivileged commands and 1 after the list of privileged commands |
| 848 |
(those shown to IRC operators). The callback routine should always |
| 849 |
return 0.</dd> |
| 850 |
|
| 851 |
<dt><tt><b>receive memo</b></tt> |
| 852 |
<br/>Parameters: <tt>const User *<i>sender</i></tt>, |
| 853 |
<tt>const char *<i>target</i></tt>, |
| 854 |
<tt>NickGroupInfo *<i>target_ngi</i></tt>, |
| 855 |
<tt>const char *<i>channel</i></tt>, <tt>const char *<i>text</i></tt></dt> |
| 856 |
<dd>Called when a nickname receives a memo. <tt><i>sender</i></tt> is |
| 857 |
the client sending the memo; <tt><i>target</i></tt> is the recipient's |
| 858 |
nickname, and <tt><i>target_ngi</i></tt> is the corresponding |
| 859 |
<tt>NickGroupInfo</tt> structure. <tt><i>channel</i></tt> is the |
| 860 |
name of the channel the memo was addressed to if a channel memo, |
| 861 |
<tt>NULL</tt> if an ordinary memo. The callback should return |
| 862 |
0 to cause the memo to be received by the target nickname normally, |
| 863 |
1 if it successfully delivered the memo, or an error message number |
| 864 |
(from the language string list) if the memo could/should not be |
| 865 |
delivered. |
| 866 |
|
| 867 |
<p>Callback routines for this callback should use one of the |
| 868 |
following two priorities (defined in <tt>memoserv.h</tt>): |
| 869 |
<tt>MS_RECEIVE_PRI_CHECK</tt> for routines which check whether the |
| 870 |
memo is allowed to be sent, or <tt>MS_RECEIVE_PRI_DELIVER</tt> for |
| 871 |
actually sending the memo.</p></dd> |
| 872 |
|
| 873 |
<dt><tt><b>SET</b></tt> |
| 874 |
<br/>Parameters: <tt>User *<i>u</i></tt>, <tt>MemoInfo *<i>mi</i></tt>, |
| 875 |
<tt>char *<i>option</i></tt>, <tt>char *<i>param</i></tt></dt> |
| 876 |
<dd>Called when the <tt>SET</tt> command is used. All parameters are |
| 877 |
guaranteed to be valid (non-<tt>NULL</tt>), and standard permission |
| 878 |
checks will have been performed. <tt><i>mi</i></tt> points to the |
| 879 |
MemoInfo for the client's nickname. The callback routine should |
| 880 |
return 1 if it handles the given option, 0 otherwise.</dd> |
| 881 |
</dl> |
| 882 |
|
| 883 |
<p class="backlink"><a href="#top">Back to top</a></p> |
| 884 |
|
| 885 |
<!------------------------------------------------------------------------> |
| 886 |
<hr/> |
| 887 |
|
| 888 |
<h3 class="subsection-title" id="s7">C-7. StatServ callbacks</h3> |
| 889 |
|
| 890 |
<dl> |
| 891 |
<dt><tt><b>command</b></tt> |
| 892 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>command</i></tt></dt> |
| 893 |
<dd>Called for every message (other than a CTCP <tt>PING</tt> or empty |
| 894 |
message) received by StatServ. See the OperServ "<tt>command</tt>" |
| 895 |
callback for details.</dd> |
| 896 |
|
| 897 |
<dt><tt><b>HELP</b></tt> |
| 898 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>char *<i>param</i></tt></dt> |
| 899 |
<dd>Called when the <tt>HELP</tt> command is used with a parameter. |
| 900 |
The callback should return 1 if it processes the message, 0 |
| 901 |
otherwise.</dd> |
| 902 |
|
| 903 |
<dt><tt><b>HELP COMMANDS</b></tt> |
| 904 |
<br/>Parameters: <tt>User *<i>user</i></tt>, <tt>int <i>which</i></tt></dt> |
| 905 |
<dd>Called when the <tt>HELP COMMANDS</tt> command is used. The |
| 906 |
<tt><i>which</i></tt> parameter is currently always 0. The |
| 907 |
callback routine should always return 0.</dd> |
| 908 |
</dl> |
| 909 |
|
| 910 |
<p class="backlink"><a href="#top">Back to top</a></p> |
| 911 |
|
| 912 |
<!------------------------------------------------------------------------> |
| 913 |
<hr/> |
| 914 |
|
| 915 |
<h3 class="subsection-title" id="s8">C-8. HTTP server callbacks</h3> |
| 916 |
|
| 917 |
<dl> |
| 918 |
<dt><tt><b>auth</b></tt> |
| 919 |
<br/>Parameters: <tt>Client *<i>c</i></tt>, <tt>int *<i>close_ptr</i></tt></dt> |
| 920 |
<dd>Called for each valid request received by the server. |
| 921 |
<tt><i>c</i></tt> is the client from which the request was |
| 922 |
received; the request data is stored in the client structure |
| 923 |
(see <tt>http.h</tt>), and at a minimum the <tt>method</tt>, |
| 924 |
<tt>url</tt>, <tt>version_major</tt>, and <tt>version_minor</tt> |
| 925 |
fields will be set appropriately. If the request is denied and the |
| 926 |
connection should be closed after the reply is sent, the callback |
| 927 |
routine should set <tt>*<i>close_ptr</i></tt> to a nonzero value |
| 928 |
(<tt>*<i>close_ptr</i></tt> should not be modified if the request |
| 929 |
is not denied). The callback routine should return |
| 930 |
<tt>HTTP_AUTH_ALLOW</tt> to explicitly allow the request to |
| 931 |
proceed, <tt>HTTP_AUTH_DENY</tt> to deny the request (in which case |
| 932 |
the module must send an appropriate error message), or |
| 933 |
<tt>HTTP_AUTH_UNDECIDED</tt> to pass the request through to the |
| 934 |
next callback; if all authorization callbacks pass the request |
| 935 |
through, it is treated as allowed.</dd> |
| 936 |
|
| 937 |
<dt><tt><b>request</b></tt> |
| 938 |
<br/>Parameters: <tt>Client *<i>c</i></tt>, <tt>int *<i>close_ptr</i></tt></dt> |
| 939 |
<dd>Called for each valid request received by the server and either |
| 940 |
explicitly allowed or passed through by all authorization |
| 941 |
callbacks. <tt><i>c</i></tt> is the client from which the request |
| 942 |
was received; the request data is stored in the client structure |
| 943 |
(see <tt>http.h</tt>), and at a minimum the <tt>method</tt>, |
| 944 |
<tt>url</tt>, <tt>version_major</tt>, and <tt>version_minor</tt> |
| 945 |
fields will be set appropriately. If the connection should be |
| 946 |
closed after the reply is sent, the callback routine should set |
| 947 |
<tt>*<i>close_ptr</i></tt> to a nonzero value. The callback |
| 948 |
routine should return 1 if it processes the request, 0 otherwise.</dd> |
| 949 |
</dl> |
| 950 |
|
| 951 |
<p class="backlink"><a href="#top">Back to top</a></p> |
| 952 |
|
| 953 |
<!------------------------------------------------------------------------> |
| 954 |
<hr/> |
| 955 |
|
| 956 |
<p class="backlink"><a href="index.html">Table of Contents</a></p> |
| 957 |
|
| 958 |
</body> |
| 959 |
</html> |