1 |
/* |
2 |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
* m_set.c: Sets a server parameter. |
4 |
* |
5 |
* Copyright (C) 2002 by the past and present ircd coders, and others. |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License as published by |
9 |
* the Free Software Foundation; either version 2 of the License, or |
10 |
* (at your option) any later version. |
11 |
* |
12 |
* This program is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with this program; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
* USA |
21 |
* |
22 |
* $Id$ |
23 |
*/ |
24 |
|
25 |
/* rewritten by jdc */ |
26 |
|
27 |
#include "stdinc.h" |
28 |
#include "client.h" |
29 |
#include "event.h" |
30 |
#include "irc_string.h" |
31 |
#include "ircd.h" |
32 |
#include "numeric.h" |
33 |
#include "fdlist.h" |
34 |
#include "s_bsd.h" |
35 |
#include "s_serv.h" |
36 |
#include "send.h" |
37 |
#include "channel.h" |
38 |
#include "s_log.h" |
39 |
#include "s_conf.h" |
40 |
#include "parse.h" |
41 |
#include "modules.h" |
42 |
#include "s_user.h" |
43 |
#include "s_misc.h" |
44 |
|
45 |
|
46 |
/* Structure used for the SET table itself */ |
47 |
struct SetStruct |
48 |
{ |
49 |
const char *name; |
50 |
void (*handler)(); |
51 |
const int wants_char; /* 1 if it expects (char *, [int]) */ |
52 |
const int wants_int; /* 1 if it expects ([char *], int) */ |
53 |
/* eg: 0, 1 == only an int arg |
54 |
* eg: 1, 1 == char and int args */ |
55 |
}; |
56 |
|
57 |
static void quote_autoconn(struct Client *, const char *, int); |
58 |
static void quote_autoconnall(struct Client *, int); |
59 |
static void quote_floodcount(struct Client *, int); |
60 |
static void quote_identtimeout(struct Client *, int); |
61 |
static void quote_log(struct Client *, int); |
62 |
static void quote_max(struct Client *, int); |
63 |
static void quote_msglocale(struct Client *, char *); |
64 |
static void quote_spamnum(struct Client *, int); |
65 |
static void quote_spamtime(struct Client *, int); |
66 |
static void quote_splitmode(struct Client *, char *); |
67 |
static void quote_splitnum(struct Client *, int); |
68 |
static void quote_splitusers(struct Client *, int); |
69 |
static void list_quote_commands(struct Client *); |
70 |
static void quote_jfloodtime(struct Client *, int); |
71 |
static void quote_jfloodcount(struct Client *, int); |
72 |
static void quote_rejecttime(struct Client *, int); |
73 |
|
74 |
/* |
75 |
* If this ever needs to be expanded to more than one arg of each |
76 |
* type, want_char/want_int could be the count of the arguments, |
77 |
* instead of just a boolean flag... |
78 |
* |
79 |
* -davidt |
80 |
*/ |
81 |
|
82 |
static const struct SetStruct set_cmd_table[] = |
83 |
{ |
84 |
/* name function string arg int arg */ |
85 |
/* -------------------------------------------------------- */ |
86 |
{ "AUTOCONN", quote_autoconn, 1, 1 }, |
87 |
{ "AUTOCONNALL", quote_autoconnall, 0, 1 }, |
88 |
{ "FLOODCOUNT", quote_floodcount, 0, 1 }, |
89 |
{ "IDENTTIMEOUT", quote_identtimeout, 0, 1 }, |
90 |
{ "LOG", quote_log, 0, 1 }, |
91 |
{ "MAX", quote_max, 0, 1 }, |
92 |
{ "MSGLOCALE", quote_msglocale, 1, 0 }, |
93 |
{ "SPAMNUM", quote_spamnum, 0, 1 }, |
94 |
{ "SPAMTIME", quote_spamtime, 0, 1 }, |
95 |
{ "SPLITMODE", quote_splitmode, 1, 0 }, |
96 |
{ "SPLITNUM", quote_splitnum, 0, 1 }, |
97 |
{ "SPLITUSERS", quote_splitusers, 0, 1 }, |
98 |
{ "JFLOODTIME", quote_jfloodtime, 0, 1 }, |
99 |
{ "JFLOODCOUNT", quote_jfloodcount, 0, 1 }, |
100 |
{ "REJECTTIME", quote_rejecttime, 0, 1 }, |
101 |
/* -------------------------------------------------------- */ |
102 |
{ NULL, NULL, 0, 0 } |
103 |
}; |
104 |
|
105 |
/* |
106 |
* list_quote_commands() sends the client all the available commands. |
107 |
* Four to a line for now. |
108 |
*/ |
109 |
static void |
110 |
list_quote_commands(struct Client *source_p) |
111 |
{ |
112 |
int j = 0; |
113 |
const struct SetStruct *tab = set_cmd_table; |
114 |
const char *names[4] = { "", "", "", "" }; |
115 |
|
116 |
sendto_one(source_p, ":%s NOTICE %s :Available QUOTE SET commands:", |
117 |
me.name, source_p->name); |
118 |
|
119 |
for (; tab->handler; ++tab) |
120 |
{ |
121 |
names[j++] = tab->name; |
122 |
|
123 |
if (j > 3) |
124 |
{ |
125 |
sendto_one(source_p, ":%s NOTICE %s :%s %s %s %s", |
126 |
me.name, source_p->name, |
127 |
names[0], names[1], |
128 |
names[2], names[3]); |
129 |
j = 0; |
130 |
names[0] = names[1] = names[2] = names[3] = ""; |
131 |
} |
132 |
|
133 |
} |
134 |
|
135 |
if (j) |
136 |
sendto_one(source_p, ":%s NOTICE %s :%s %s %s %s", |
137 |
me.name, source_p->name, |
138 |
names[0], names[1], |
139 |
names[2], names[3]); |
140 |
} |
141 |
|
142 |
/* SET AUTOCONN */ |
143 |
static void |
144 |
quote_autoconn(struct Client *source_p, const char *arg, int newval) |
145 |
{ |
146 |
struct AccessItem *aconf; |
147 |
|
148 |
if (arg != NULL) |
149 |
{ |
150 |
struct ConfItem *conf = find_exact_name_conf(SERVER_TYPE, arg, NULL, NULL); |
151 |
|
152 |
if (conf != NULL) |
153 |
{ |
154 |
aconf = map_to_conf(conf); |
155 |
if (newval) |
156 |
SetConfAllowAutoConn(aconf); |
157 |
else |
158 |
ClearConfAllowAutoConn(aconf); |
159 |
|
160 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
161 |
"%s has changed AUTOCONN for %s to %i", |
162 |
get_oper_name(source_p), arg, newval); |
163 |
sendto_one(source_p, |
164 |
":%s NOTICE %s :AUTOCONN for %s is now set to %i", |
165 |
me.name, source_p->name, arg, newval); |
166 |
} |
167 |
else |
168 |
{ |
169 |
sendto_one(source_p, ":%s NOTICE %s :Can't find %s", |
170 |
me.name, source_p->name, arg); |
171 |
} |
172 |
} |
173 |
else |
174 |
{ |
175 |
sendto_one(source_p, ":%s NOTICE %s :Please specify a server name!", |
176 |
me.name, source_p->name); |
177 |
} |
178 |
} |
179 |
|
180 |
/* SET AUTOCONNALL */ |
181 |
static void |
182 |
quote_autoconnall(struct Client *source_p, int newval) |
183 |
{ |
184 |
if (newval >= 0) |
185 |
{ |
186 |
sendto_realops_flags(UMODE_ALL, L_ALL, "%s has changed AUTOCONNALL to %i", |
187 |
get_oper_name(source_p), newval); |
188 |
|
189 |
GlobalSetOptions.autoconn = newval; |
190 |
} |
191 |
else |
192 |
sendto_one(source_p, ":%s NOTICE %s :AUTOCONNALL is currently %i", |
193 |
me.name, source_p->name, GlobalSetOptions.autoconn); |
194 |
} |
195 |
|
196 |
/* SET FLOODCOUNT */ |
197 |
static void |
198 |
quote_floodcount(struct Client *source_p, int newval) |
199 |
{ |
200 |
if (newval >= 0) |
201 |
{ |
202 |
GlobalSetOptions.floodcount = newval; |
203 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
204 |
"%s has changed FLOODCOUNT to %i", |
205 |
get_oper_name(source_p), GlobalSetOptions.floodcount); |
206 |
} |
207 |
else |
208 |
sendto_one(source_p, ":%s NOTICE %s :FLOODCOUNT is currently %i", |
209 |
me.name, source_p->name, GlobalSetOptions.floodcount); |
210 |
} |
211 |
|
212 |
/* SET IDENTTIMEOUT */ |
213 |
static void |
214 |
quote_identtimeout(struct Client *source_p, int newval) |
215 |
{ |
216 |
if (!HasUMode(source_p, UMODE_ADMIN)) |
217 |
{ |
218 |
sendto_one(source_p, form_str(ERR_NOPRIVS), |
219 |
me.name, source_p->name, "set"); |
220 |
return; |
221 |
} |
222 |
|
223 |
if (newval > 0) |
224 |
{ |
225 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
226 |
"%s has changed IDENTTIMEOUT to %d", |
227 |
get_oper_name(source_p), newval); |
228 |
GlobalSetOptions.ident_timeout = newval; |
229 |
} |
230 |
else |
231 |
sendto_one(source_p, ":%s NOTICE %s :IDENTTIMEOUT is currently %d", |
232 |
me.name, source_p->name, GlobalSetOptions.ident_timeout); |
233 |
} |
234 |
|
235 |
/* SET LOG */ |
236 |
static void |
237 |
quote_log(struct Client *source_p, int newval) |
238 |
{ |
239 |
if (newval >= 0) |
240 |
{ |
241 |
if (newval < L_WARN) |
242 |
{ |
243 |
sendto_one(source_p, ":%s NOTICE %s :LOG must be > %d (L_WARN)", |
244 |
me.name, source_p->name, L_WARN); |
245 |
return; |
246 |
} |
247 |
|
248 |
if (newval > L_DEBUG) |
249 |
newval = L_DEBUG; |
250 |
|
251 |
set_log_level(newval); |
252 |
sendto_realops_flags(UMODE_ALL, L_ALL, "%s has changed LOG level to %i (%s)", |
253 |
get_oper_name(source_p), get_log_level(), |
254 |
get_log_level_as_string(get_log_level())); |
255 |
} |
256 |
else |
257 |
sendto_one(source_p, ":%s NOTICE %s :LOG level is currently %i (%s)", |
258 |
me.name, source_p->name, get_log_level(), |
259 |
get_log_level_as_string(get_log_level())); |
260 |
} |
261 |
|
262 |
/* SET MAX */ |
263 |
static void |
264 |
quote_max(struct Client *source_p, int newval) |
265 |
{ |
266 |
if (newval > 0) |
267 |
{ |
268 |
recalc_fdlimit(NULL); |
269 |
|
270 |
if (newval > MAXCLIENTS_MAX) |
271 |
{ |
272 |
sendto_one(source_p, |
273 |
":%s NOTICE %s :You cannot set MAXCLIENTS to > %d, restoring to %d", |
274 |
me.name, source_p->name, MAXCLIENTS_MAX, ServerInfo.max_clients); |
275 |
return; |
276 |
} |
277 |
|
278 |
if (newval < MAXCLIENTS_MIN) |
279 |
{ |
280 |
sendto_one(source_p, |
281 |
":%s NOTICE %s :You cannot set MAXCLIENTS to < %d, restoring to %d", |
282 |
me.name, source_p->name, MAXCLIENTS_MIN, ServerInfo.max_clients); |
283 |
return; |
284 |
} |
285 |
|
286 |
ServerInfo.max_clients = newval; |
287 |
|
288 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
289 |
"%s set new MAXCLIENTS to %d (%d current)", |
290 |
get_oper_name(source_p), ServerInfo.max_clients, Count.local); |
291 |
} |
292 |
else |
293 |
sendto_one(source_p, ":%s NOTICE %s :Current MAXCLIENTS = %d (%d)", |
294 |
me.name, source_p->name, ServerInfo.max_clients, Count.local); |
295 |
} |
296 |
|
297 |
/* SET MSGLOCALE */ |
298 |
static void |
299 |
quote_msglocale(struct Client *source_p, char *locale) |
300 |
{ |
301 |
if (locale != NULL) |
302 |
{ |
303 |
set_locale(locale); |
304 |
rebuild_isupport_message_line(); |
305 |
sendto_one(source_p, ":%s NOTICE %s :Set MSGLOCALE to '%s'", |
306 |
me.name, source_p->name, get_locale()); |
307 |
} |
308 |
else |
309 |
sendto_one(source_p, ":%s NOTICE %s :MSGLOCALE is currently '%s'", |
310 |
me.name, source_p->name, get_locale()); |
311 |
} |
312 |
|
313 |
/* SET SPAMNUM */ |
314 |
static void |
315 |
quote_spamnum(struct Client *source_p, int newval) |
316 |
{ |
317 |
if (newval >= 0) |
318 |
{ |
319 |
if (newval == 0) |
320 |
{ |
321 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
322 |
"%s has disabled ANTI_SPAMBOT", source_p->name); |
323 |
GlobalSetOptions.spam_num = newval; |
324 |
return; |
325 |
} |
326 |
|
327 |
GlobalSetOptions.spam_num = IRCD_MAX(newval, MIN_SPAM_NUM); |
328 |
sendto_realops_flags(UMODE_ALL, L_ALL, "%s has changed SPAMNUM to %i", |
329 |
get_oper_name(source_p), GlobalSetOptions.spam_num); |
330 |
} |
331 |
else |
332 |
sendto_one(source_p, ":%s NOTICE %s :SPAMNUM is currently %i", |
333 |
me.name, source_p->name, GlobalSetOptions.spam_num); |
334 |
} |
335 |
|
336 |
/* SET SPAMTIME */ |
337 |
static void |
338 |
quote_spamtime(struct Client *source_p, int newval) |
339 |
{ |
340 |
if (newval > 0) |
341 |
{ |
342 |
GlobalSetOptions.spam_time = IRCD_MAX(newval, MIN_SPAM_TIME); |
343 |
sendto_realops_flags(UMODE_ALL, L_ALL, "%s has changed SPAMTIME to %i", |
344 |
get_oper_name(source_p), GlobalSetOptions.spam_time); |
345 |
} |
346 |
else |
347 |
sendto_one(source_p, ":%s NOTICE %s :SPAMTIME is currently %i", |
348 |
me.name, source_p->name, GlobalSetOptions.spam_time); |
349 |
} |
350 |
|
351 |
/* this table is what splitmode may be set to */ |
352 |
static const char *splitmode_values[] = |
353 |
{ |
354 |
"OFF", |
355 |
"ON", |
356 |
"AUTO", |
357 |
NULL |
358 |
}; |
359 |
|
360 |
/* this table is what splitmode may be */ |
361 |
static const char *splitmode_status[] = |
362 |
{ |
363 |
"OFF", |
364 |
"AUTO (OFF)", |
365 |
"ON", |
366 |
"AUTO (ON)", |
367 |
NULL |
368 |
}; |
369 |
|
370 |
/* SET SPLITMODE */ |
371 |
static void |
372 |
quote_splitmode(struct Client *source_p, char *charval) |
373 |
{ |
374 |
if (charval) |
375 |
{ |
376 |
int newval; |
377 |
|
378 |
for (newval = 0; splitmode_values[newval]; ++newval) |
379 |
if (irccmp(splitmode_values[newval], charval) == 0) |
380 |
break; |
381 |
|
382 |
/* OFF */ |
383 |
if (newval == 0) |
384 |
{ |
385 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
386 |
"%s is disabling splitmode", |
387 |
get_oper_name(source_p)); |
388 |
|
389 |
splitmode = 0; |
390 |
splitchecking = 0; |
391 |
|
392 |
eventDelete(check_splitmode, NULL); |
393 |
} |
394 |
/* ON */ |
395 |
else if (newval == 1) |
396 |
{ |
397 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
398 |
"%s is enabling and activating splitmode", |
399 |
get_oper_name(source_p)); |
400 |
|
401 |
splitmode = 1; |
402 |
splitchecking = 0; |
403 |
|
404 |
/* we might be deactivating an automatic splitmode, so pull the event */ |
405 |
eventDelete(check_splitmode, NULL); |
406 |
} |
407 |
/* AUTO */ |
408 |
else if (newval == 2) |
409 |
{ |
410 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
411 |
"%s is enabling automatic splitmode", |
412 |
get_oper_name(source_p)); |
413 |
|
414 |
splitchecking = 1; |
415 |
check_splitmode(NULL); |
416 |
} |
417 |
} |
418 |
else |
419 |
/* if we add splitchecking to splitmode*2 we get a unique table to |
420 |
* pull values back out of, splitmode can be four states - but you can |
421 |
* only set to three, which means we cant use the same table --fl_ |
422 |
*/ |
423 |
sendto_one(source_p, ":%s NOTICE %s :SPLITMODE is currently %s", |
424 |
me.name, source_p->name, |
425 |
splitmode_status[(splitchecking + (splitmode * 2))]); |
426 |
} |
427 |
|
428 |
/* SET SPLITNUM */ |
429 |
static void |
430 |
quote_splitnum(struct Client *source_p, int newval) |
431 |
{ |
432 |
if (newval >= 0) |
433 |
{ |
434 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
435 |
"%s has changed SPLITNUM to %i", |
436 |
get_oper_name(source_p), newval); |
437 |
split_servers = newval; |
438 |
|
439 |
if (splitchecking) |
440 |
check_splitmode(NULL); |
441 |
} |
442 |
else |
443 |
sendto_one(source_p, ":%s NOTICE %s :SPLITNUM is currently %i", |
444 |
me.name, source_p->name, split_servers); |
445 |
} |
446 |
|
447 |
/* SET SPLITUSERS */ |
448 |
static void |
449 |
quote_splitusers(struct Client *source_p, int newval) |
450 |
{ |
451 |
if (newval >= 0) |
452 |
{ |
453 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
454 |
"%s has changed SPLITUSERS to %i", |
455 |
get_oper_name(source_p), newval); |
456 |
split_users = newval; |
457 |
|
458 |
if (splitchecking) |
459 |
check_splitmode(NULL); |
460 |
} |
461 |
else |
462 |
sendto_one(source_p, ":%s NOTICE %s :SPLITUSERS is currently %i", |
463 |
me.name, source_p->name, split_users); |
464 |
} |
465 |
|
466 |
/* SET JFLOODTIME */ |
467 |
static void |
468 |
quote_jfloodtime(struct Client *source_p, int newval) |
469 |
{ |
470 |
if (newval >= 0) |
471 |
{ |
472 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
473 |
"%s has changed JFLOODTIME to %i", |
474 |
get_oper_name(source_p), newval); |
475 |
GlobalSetOptions.joinfloodtime = newval; |
476 |
} |
477 |
else |
478 |
sendto_one(source_p, ":%s NOTICE %s :JFLOODTIME is currently %i", |
479 |
me.name, source_p->name, GlobalSetOptions.joinfloodtime); |
480 |
} |
481 |
|
482 |
/* SET JFLOODCOUNT */ |
483 |
static void |
484 |
quote_jfloodcount(struct Client *source_p, int newval) |
485 |
{ |
486 |
if (newval >= 0) |
487 |
{ |
488 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
489 |
"%s has changed JFLOODCOUNT to %i", |
490 |
get_oper_name(source_p), newval); |
491 |
GlobalSetOptions.joinfloodcount = newval; |
492 |
} |
493 |
else |
494 |
sendto_one(source_p, ":%s NOTICE %s :JFLOODCOUNT is currently %i", |
495 |
me.name, source_p->name, GlobalSetOptions.joinfloodcount); |
496 |
} |
497 |
|
498 |
/* SET REJECTTIME */ |
499 |
static void |
500 |
quote_rejecttime(struct Client *source_p, int newval) |
501 |
{ |
502 |
if (newval >= 0) |
503 |
{ |
504 |
sendto_realops_flags(UMODE_ALL, L_ALL, |
505 |
"%s has changed REJECTTIME to %i seconds", |
506 |
get_oper_name(source_p), newval); |
507 |
GlobalSetOptions.rejecttime = newval; |
508 |
} |
509 |
else |
510 |
sendto_one(source_p, ":%s NOTICE %s :REJECTTIME is currently %i seconds", |
511 |
me.name, source_p->name, GlobalSetOptions.rejecttime); |
512 |
} |
513 |
|
514 |
/* |
515 |
* mo_set - SET command handler |
516 |
* set options while running |
517 |
*/ |
518 |
static void |
519 |
mo_set(struct Client *client_p, struct Client *source_p, |
520 |
int parc, char *parv[]) |
521 |
{ |
522 |
int n; |
523 |
int newval; |
524 |
const char *arg = NULL; |
525 |
const char *intarg = NULL; |
526 |
const struct SetStruct *tab = set_cmd_table; |
527 |
|
528 |
if (parc > 1) |
529 |
{ |
530 |
/* |
531 |
* Go through all the commands in set_cmd_table, until one is |
532 |
* matched. |
533 |
*/ |
534 |
for (; tab->handler; ++tab) |
535 |
{ |
536 |
if (!irccmp(tab->name, parv[1])) |
537 |
{ |
538 |
/* |
539 |
* Command found; now execute the code |
540 |
*/ |
541 |
n = 2; |
542 |
|
543 |
if (tab->wants_char) |
544 |
arg = parv[n++]; |
545 |
|
546 |
if (tab->wants_int) |
547 |
intarg = parv[n++]; |
548 |
|
549 |
if ((n - 1) > parc) |
550 |
{ |
551 |
if (parc > 2) |
552 |
sendto_one(source_p, |
553 |
":%s NOTICE %s :SET %s expects (\"%s%s\") args", |
554 |
me.name, source_p->name, tab->name, |
555 |
(tab->wants_char ? "string, " : ""), |
556 |
(tab->wants_char ? "int" : "")); |
557 |
} |
558 |
|
559 |
if (parc <= 2) |
560 |
{ |
561 |
arg = NULL; |
562 |
intarg = NULL; |
563 |
} |
564 |
|
565 |
if (!strcmp(tab->name, "AUTOCONN") && (parc < 4)) |
566 |
{ |
567 |
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
568 |
me.name, source_p->name, "SET"); |
569 |
return; |
570 |
} |
571 |
|
572 |
if (tab->wants_int && (parc > 2)) |
573 |
{ |
574 |
if (intarg) |
575 |
{ |
576 |
if (irccmp(intarg, "yes") == 0 || irccmp(intarg, "on") == 0) |
577 |
newval = 1; |
578 |
else if (irccmp(intarg, "no") == 0|| irccmp(intarg, "off") == 0) |
579 |
newval = 0; |
580 |
else |
581 |
newval = atoi(intarg); |
582 |
} |
583 |
else |
584 |
{ |
585 |
newval = -1; |
586 |
} |
587 |
|
588 |
if (newval < 0) |
589 |
{ |
590 |
sendto_one(source_p, |
591 |
":%s NOTICE %s :Value less than 0 illegal for %s", |
592 |
me.name, source_p->name, |
593 |
tab->name); |
594 |
|
595 |
return; |
596 |
} |
597 |
} |
598 |
else |
599 |
newval = -1; |
600 |
|
601 |
if (tab->wants_char) |
602 |
{ |
603 |
if (tab->wants_int) |
604 |
tab->handler(source_p, arg, newval); |
605 |
else |
606 |
tab->handler(source_p, arg); |
607 |
return; |
608 |
} |
609 |
else |
610 |
{ |
611 |
if (tab->wants_int) |
612 |
tab->handler(source_p, newval); |
613 |
else |
614 |
/* Just in case someone actually wants a |
615 |
* set function that takes no args.. *shrug* */ |
616 |
tab->handler(source_p); |
617 |
return; |
618 |
} |
619 |
} |
620 |
} |
621 |
|
622 |
/* |
623 |
* Code here will be executed when a /QUOTE SET command is not |
624 |
* found within set_cmd_table. |
625 |
*/ |
626 |
sendto_one(source_p, ":%s NOTICE %s :Variable not found.", |
627 |
me.name, source_p->name); |
628 |
return; |
629 |
} |
630 |
|
631 |
list_quote_commands(source_p); |
632 |
} |
633 |
|
634 |
static struct Message set_msgtab = { |
635 |
"SET", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
636 |
{m_unregistered, m_not_oper, rfc1459_command_send_error, m_ignore, mo_set, m_ignore} |
637 |
}; |
638 |
|
639 |
static void |
640 |
module_init(void) |
641 |
{ |
642 |
mod_add_cmd(&set_msgtab); |
643 |
} |
644 |
|
645 |
static void |
646 |
module_exit(void) |
647 |
{ |
648 |
mod_del_cmd(&set_msgtab); |
649 |
} |
650 |
|
651 |
struct module module_entry = { |
652 |
.node = { NULL, NULL, NULL }, |
653 |
.name = NULL, |
654 |
.version = "$Revision$", |
655 |
.handle = NULL, |
656 |
.modinit = module_init, |
657 |
.modexit = module_exit, |
658 |
.flags = 0 |
659 |
}; |