1 |
|
/* |
2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
< |
* m_set.c: Sets a server parameter. |
2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
|
* |
4 |
< |
* Copyright (C) 2002 by the past and present ircd coders, and others. |
4 |
> |
* Copyright (c) 1997-2014 ircd-hybrid development team |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
17 |
|
* along with this program; if not, write to the Free Software |
18 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
19 |
|
* USA |
21 |
– |
* |
22 |
– |
* $Id$ |
20 |
|
*/ |
21 |
|
|
22 |
< |
/* rewritten by jdc */ |
22 |
> |
/*! \file m_set.c |
23 |
> |
* \brief Includes required functions for processing the SET command. |
24 |
> |
* \version $Id$ |
25 |
> |
*/ |
26 |
|
|
27 |
|
#include "stdinc.h" |
28 |
|
#include "client.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" |
33 |
|
#include "send.h" |
37 |
– |
#include "channel.h" |
34 |
|
#include "conf.h" |
35 |
|
#include "parse.h" |
36 |
|
#include "modules.h" |
37 |
< |
#include "s_user.h" |
42 |
< |
#include "s_misc.h" |
37 |
> |
#include "misc.h" |
38 |
|
|
39 |
|
|
40 |
|
/* SET AUTOCONN */ |
41 |
|
static void |
42 |
|
quote_autoconn(struct Client *source_p, const char *arg, int newval) |
43 |
|
{ |
44 |
< |
if (arg != NULL) |
44 |
> |
if (!EmptyString(arg)) |
45 |
|
{ |
46 |
|
struct MaskItem *conf = find_exact_name_conf(CONF_SERVER, NULL, arg, NULL, NULL); |
47 |
|
|
48 |
< |
if (conf != NULL) |
48 |
> |
if (conf) |
49 |
|
{ |
50 |
|
if (newval) |
51 |
|
SetConfAllowAutoConn(conf); |
55 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
56 |
|
"%s has changed AUTOCONN for %s to %i", |
57 |
|
get_oper_name(source_p), arg, newval); |
58 |
< |
sendto_one(source_p, |
59 |
< |
":%s NOTICE %s :AUTOCONN for %s is now set to %i", |
65 |
< |
me.name, source_p->name, arg, newval); |
58 |
> |
sendto_one_notice(source_p, &me, ":AUTOCONN for %s is now set to %i", |
59 |
> |
arg, newval); |
60 |
|
} |
61 |
|
else |
62 |
< |
{ |
69 |
< |
sendto_one(source_p, ":%s NOTICE %s :Can't find %s", |
70 |
< |
me.name, source_p->name, arg); |
71 |
< |
} |
62 |
> |
sendto_one_notice(source_p, &me, ":Cannot find %s", arg); |
63 |
|
} |
64 |
|
else |
65 |
< |
{ |
75 |
< |
sendto_one(source_p, ":%s NOTICE %s :Please specify a server name!", |
76 |
< |
me.name, source_p->name); |
77 |
< |
} |
65 |
> |
sendto_one_notice(source_p, &me, ":Please specify a server name!"); |
66 |
|
} |
67 |
|
|
68 |
|
/* SET AUTOCONNALL */ |
69 |
|
static void |
70 |
< |
quote_autoconnall(struct Client *source_p, int newval) |
70 |
> |
quote_autoconnall(struct Client *source_p, const char *arg, int newval) |
71 |
|
{ |
72 |
|
if (newval >= 0) |
73 |
|
{ |
78 |
|
GlobalSetOptions.autoconn = newval; |
79 |
|
} |
80 |
|
else |
81 |
< |
sendto_one(source_p, ":%s NOTICE %s :AUTOCONNALL is currently %i", |
82 |
< |
me.name, source_p->name, GlobalSetOptions.autoconn); |
81 |
> |
sendto_one_notice(source_p, &me, ":AUTOCONNALL is currently %i", |
82 |
> |
GlobalSetOptions.autoconn); |
83 |
|
} |
84 |
|
|
85 |
|
/* SET FLOODCOUNT */ |
86 |
|
static void |
87 |
< |
quote_floodcount(struct Client *source_p, int newval) |
87 |
> |
quote_floodcount(struct Client *source_p, const char *arg, int newval) |
88 |
|
{ |
89 |
|
if (newval >= 0) |
90 |
|
{ |
94 |
|
get_oper_name(source_p), GlobalSetOptions.floodcount); |
95 |
|
} |
96 |
|
else |
97 |
< |
sendto_one(source_p, ":%s NOTICE %s :FLOODCOUNT is currently %i", |
98 |
< |
me.name, source_p->name, GlobalSetOptions.floodcount); |
97 |
> |
sendto_one_notice(source_p, &me, ":FLOODCOUNT is currently %i", |
98 |
> |
GlobalSetOptions.floodcount); |
99 |
|
} |
100 |
|
|
101 |
|
/* SET IDENTTIMEOUT */ |
102 |
|
static void |
103 |
< |
quote_identtimeout(struct Client *source_p, int newval) |
103 |
> |
quote_identtimeout(struct Client *source_p, const char *arg, int newval) |
104 |
|
{ |
105 |
|
if (!HasUMode(source_p, UMODE_ADMIN)) |
106 |
|
{ |
107 |
< |
sendto_one(source_p, form_str(ERR_NOPRIVS), |
120 |
< |
me.name, source_p->name, "set"); |
107 |
> |
sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "set"); |
108 |
|
return; |
109 |
|
} |
110 |
|
|
116 |
|
GlobalSetOptions.ident_timeout = newval; |
117 |
|
} |
118 |
|
else |
119 |
< |
sendto_one(source_p, ":%s NOTICE %s :IDENTTIMEOUT is currently %d", |
120 |
< |
me.name, source_p->name, GlobalSetOptions.ident_timeout); |
119 |
> |
sendto_one_notice(source_p, &me, ":IDENTTIMEOUT is currently %d", |
120 |
> |
GlobalSetOptions.ident_timeout); |
121 |
|
} |
122 |
|
|
123 |
|
/* SET MAX */ |
124 |
|
static void |
125 |
< |
quote_max(struct Client *source_p, int newval) |
125 |
> |
quote_max(struct Client *source_p, const char *arg, int newval) |
126 |
|
{ |
127 |
|
if (newval > 0) |
128 |
|
{ |
129 |
|
if (newval > MAXCLIENTS_MAX) |
130 |
|
{ |
131 |
< |
sendto_one(source_p, |
132 |
< |
":%s NOTICE %s :You cannot set MAXCLIENTS to > %d, restoring to %d", |
146 |
< |
me.name, source_p->name, MAXCLIENTS_MAX, ServerInfo.max_clients); |
131 |
> |
sendto_one_notice(source_p, &me, ":You cannot set MAXCLIENTS to > %d, restoring to %d", |
132 |
> |
MAXCLIENTS_MAX, ServerInfo.max_clients); |
133 |
|
return; |
134 |
|
} |
135 |
|
|
136 |
|
if (newval < MAXCLIENTS_MIN) |
137 |
|
{ |
138 |
< |
sendto_one(source_p, |
139 |
< |
":%s NOTICE %s :You cannot set MAXCLIENTS to < %d, restoring to %d", |
154 |
< |
me.name, source_p->name, MAXCLIENTS_MIN, ServerInfo.max_clients); |
138 |
> |
sendto_one_notice(source_p, &me, ":You cannot set MAXCLIENTS to < %d, restoring to %d", |
139 |
> |
MAXCLIENTS_MIN, ServerInfo.max_clients); |
140 |
|
return; |
141 |
|
} |
142 |
|
|
147 |
|
get_oper_name(source_p), ServerInfo.max_clients, Count.local); |
148 |
|
} |
149 |
|
else |
150 |
< |
sendto_one(source_p, ":%s NOTICE %s :Current MAXCLIENTS = %d (%d)", |
151 |
< |
me.name, source_p->name, ServerInfo.max_clients, Count.local); |
150 |
> |
sendto_one_notice(source_p, &me, ":Current MAXCLIENTS = %d (%d)", |
151 |
> |
ServerInfo.max_clients, Count.local); |
152 |
|
} |
153 |
|
|
154 |
|
/* SET SPAMNUM */ |
155 |
|
static void |
156 |
< |
quote_spamnum(struct Client *source_p, int newval) |
156 |
> |
quote_spamnum(struct Client *source_p, const char *arg, int newval) |
157 |
|
{ |
158 |
|
if (newval >= 0) |
159 |
|
{ |
171 |
|
get_oper_name(source_p), GlobalSetOptions.spam_num); |
172 |
|
} |
173 |
|
else |
174 |
< |
sendto_one(source_p, ":%s NOTICE %s :SPAMNUM is currently %i", |
175 |
< |
me.name, source_p->name, GlobalSetOptions.spam_num); |
174 |
> |
sendto_one_notice(source_p, &me, ":SPAMNUM is currently %i", |
175 |
> |
GlobalSetOptions.spam_num); |
176 |
|
} |
177 |
|
|
178 |
|
/* SET SPAMTIME */ |
179 |
|
static void |
180 |
< |
quote_spamtime(struct Client *source_p, int newval) |
180 |
> |
quote_spamtime(struct Client *source_p, const char *arg, int newval) |
181 |
|
{ |
182 |
|
if (newval > 0) |
183 |
|
{ |
187 |
|
get_oper_name(source_p), GlobalSetOptions.spam_time); |
188 |
|
} |
189 |
|
else |
190 |
< |
sendto_one(source_p, ":%s NOTICE %s :SPAMTIME is currently %i", |
191 |
< |
me.name, source_p->name, GlobalSetOptions.spam_time); |
190 |
> |
sendto_one_notice(source_p, &me, ":SPAMTIME is currently %i", |
191 |
> |
GlobalSetOptions.spam_time); |
192 |
|
} |
193 |
|
|
194 |
|
/* this table is what splitmode may be set to */ |
212 |
|
|
213 |
|
/* SET SPLITMODE */ |
214 |
|
static void |
215 |
< |
quote_splitmode(struct Client *source_p, char *charval) |
215 |
> |
quote_splitmode(struct Client *source_p, const char *charval, int val) |
216 |
|
{ |
217 |
|
if (charval) |
218 |
|
{ |
219 |
|
int newval; |
220 |
|
|
221 |
|
for (newval = 0; splitmode_values[newval]; ++newval) |
222 |
< |
if (irccmp(splitmode_values[newval], charval) == 0) |
222 |
> |
if (!irccmp(splitmode_values[newval], charval)) |
223 |
|
break; |
224 |
|
|
225 |
|
/* OFF */ |
232 |
|
splitmode = 0; |
233 |
|
splitchecking = 0; |
234 |
|
|
235 |
< |
eventDelete(check_splitmode, NULL); |
235 |
> |
event_delete(&splitmode_event); |
236 |
|
} |
237 |
|
/* ON */ |
238 |
|
else if (newval == 1) |
245 |
|
splitchecking = 0; |
246 |
|
|
247 |
|
/* we might be deactivating an automatic splitmode, so pull the event */ |
248 |
< |
eventDelete(check_splitmode, NULL); |
248 |
> |
event_delete(&splitmode_event); |
249 |
|
} |
250 |
|
/* AUTO */ |
251 |
|
else if (newval == 2) |
259 |
|
} |
260 |
|
} |
261 |
|
else |
262 |
< |
/* if we add splitchecking to splitmode*2 we get a unique table to |
262 |
> |
/* if we add splitchecking to splitmode*2 we get a unique table to |
263 |
|
* pull values back out of, splitmode can be four states - but you can |
264 |
|
* only set to three, which means we cant use the same table --fl_ |
265 |
|
*/ |
266 |
< |
sendto_one(source_p, ":%s NOTICE %s :SPLITMODE is currently %s", |
267 |
< |
me.name, source_p->name, |
283 |
< |
splitmode_status[(splitchecking + (splitmode * 2))]); |
266 |
> |
sendto_one_notice(source_p, &me, ":SPLITMODE is currently %s", |
267 |
> |
splitmode_status[(splitchecking + (splitmode * 2))]); |
268 |
|
} |
269 |
|
|
270 |
|
/* SET SPLITNUM */ |
271 |
|
static void |
272 |
< |
quote_splitnum(struct Client *source_p, int newval) |
272 |
> |
quote_splitnum(struct Client *source_p, const char *arg, int newval) |
273 |
|
{ |
274 |
|
if (newval >= 0) |
275 |
|
{ |
276 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
277 |
< |
"%s has changed SPLITNUM to %i", |
277 |
> |
"%s has changed SPLITNUM to %i", |
278 |
|
get_oper_name(source_p), newval); |
279 |
|
split_servers = newval; |
280 |
|
|
282 |
|
check_splitmode(NULL); |
283 |
|
} |
284 |
|
else |
285 |
< |
sendto_one(source_p, ":%s NOTICE %s :SPLITNUM is currently %i", |
286 |
< |
me.name, source_p->name, split_servers); |
285 |
> |
sendto_one_notice(source_p, &me, ":SPLITNUM is currently %i", |
286 |
> |
split_servers); |
287 |
|
} |
288 |
|
|
289 |
|
/* SET SPLITUSERS */ |
290 |
|
static void |
291 |
< |
quote_splitusers(struct Client *source_p, int newval) |
291 |
> |
quote_splitusers(struct Client *source_p, const char *arg, int newval) |
292 |
|
{ |
293 |
|
if (newval >= 0) |
294 |
|
{ |
295 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
296 |
< |
"%s has changed SPLITUSERS to %i", |
296 |
> |
"%s has changed SPLITUSERS to %i", |
297 |
|
get_oper_name(source_p), newval); |
298 |
|
split_users = newval; |
299 |
|
|
301 |
|
check_splitmode(NULL); |
302 |
|
} |
303 |
|
else |
304 |
< |
sendto_one(source_p, ":%s NOTICE %s :SPLITUSERS is currently %i", |
305 |
< |
me.name, source_p->name, split_users); |
304 |
> |
sendto_one_notice(source_p, &me, ":SPLITUSERS is currently %i", |
305 |
> |
split_users); |
306 |
|
} |
307 |
|
|
308 |
|
/* SET JFLOODTIME */ |
309 |
|
static void |
310 |
< |
quote_jfloodtime(struct Client *source_p, int newval) |
310 |
> |
quote_jfloodtime(struct Client *source_p, const char *arg, int newval) |
311 |
|
{ |
312 |
|
if (newval >= 0) |
313 |
|
{ |
314 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
315 |
< |
"%s has changed JFLOODTIME to %i", |
315 |
> |
"%s has changed JFLOODTIME to %i", |
316 |
|
get_oper_name(source_p), newval); |
317 |
|
GlobalSetOptions.joinfloodtime = newval; |
318 |
|
} |
319 |
|
else |
320 |
< |
sendto_one(source_p, ":%s NOTICE %s :JFLOODTIME is currently %i", |
321 |
< |
me.name, source_p->name, GlobalSetOptions.joinfloodtime); |
320 |
> |
sendto_one_notice(source_p, &me, ":JFLOODTIME is currently %i", |
321 |
> |
GlobalSetOptions.joinfloodtime); |
322 |
|
} |
323 |
|
|
324 |
|
/* SET JFLOODCOUNT */ |
325 |
|
static void |
326 |
< |
quote_jfloodcount(struct Client *source_p, int newval) |
326 |
> |
quote_jfloodcount(struct Client *source_p, const char *arg, int newval) |
327 |
|
{ |
328 |
|
if (newval >= 0) |
329 |
|
{ |
330 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
331 |
< |
"%s has changed JFLOODCOUNT to %i", |
331 |
> |
"%s has changed JFLOODCOUNT to %i", |
332 |
|
get_oper_name(source_p), newval); |
333 |
|
GlobalSetOptions.joinfloodcount = newval; |
334 |
|
} |
335 |
|
else |
336 |
< |
sendto_one(source_p, ":%s NOTICE %s :JFLOODCOUNT is currently %i", |
337 |
< |
me.name, source_p->name, GlobalSetOptions.joinfloodcount); |
336 |
> |
sendto_one_notice(source_p, &me, ":JFLOODCOUNT is currently %i", |
337 |
> |
GlobalSetOptions.joinfloodcount); |
338 |
|
} |
339 |
|
|
340 |
|
/* Structure used for the SET table itself */ |
341 |
|
struct SetStruct |
342 |
|
{ |
343 |
|
const char *name; |
344 |
< |
void (*handler)(); |
345 |
< |
const int wants_char; /* 1 if it expects (char *, [int]) */ |
346 |
< |
const int wants_int; /* 1 if it expects ([char *], int) */ |
344 |
> |
void (*handler)(struct Client *, const char *, int); |
345 |
> |
const unsigned int wants_char; /* 1 if it expects (char *, [int]) */ |
346 |
> |
const unsigned int wants_int; /* 1 if it expects ([char *], int) */ |
347 |
|
/* eg: 0, 1 == only an int arg |
348 |
|
* eg: 1, 1 == char and int args */ |
349 |
|
}; |
382 |
|
static void |
383 |
|
list_quote_commands(struct Client *source_p) |
384 |
|
{ |
385 |
< |
int j = 0; |
402 |
< |
const struct SetStruct *tab = set_cmd_table; |
385 |
> |
unsigned int j = 0; |
386 |
|
const char *names[4] = { "", "", "", "" }; |
387 |
|
|
388 |
< |
sendto_one(source_p, ":%s NOTICE %s :Available QUOTE SET commands:", |
406 |
< |
me.name, source_p->name); |
388 |
> |
sendto_one_notice(source_p, &me, ":Available QUOTE SET commands:"); |
389 |
|
|
390 |
< |
for (; tab->handler; ++tab) |
390 |
> |
for (const struct SetStruct *tab = set_cmd_table; tab->handler; ++tab) |
391 |
|
{ |
392 |
|
names[j++] = tab->name; |
393 |
|
|
394 |
|
if (j > 3) |
395 |
|
{ |
396 |
< |
sendto_one(source_p, ":%s NOTICE %s :%s %s %s %s", |
397 |
< |
me.name, source_p->name, |
398 |
< |
names[0], names[1], |
417 |
< |
names[2], names[3]); |
396 |
> |
sendto_one_notice(source_p, &me, ":%s %s %s %s", |
397 |
> |
names[0], names[1], |
398 |
> |
names[2], names[3]); |
399 |
|
j = 0; |
400 |
|
names[0] = names[1] = names[2] = names[3] = ""; |
401 |
|
} |
421 |
– |
|
402 |
|
} |
403 |
|
|
404 |
|
if (j) |
405 |
< |
sendto_one(source_p, ":%s NOTICE %s :%s %s %s %s", |
406 |
< |
me.name, source_p->name, |
407 |
< |
names[0], names[1], |
428 |
< |
names[2], names[3]); |
405 |
> |
sendto_one_notice(source_p, &me, ":%s %s %s %s", |
406 |
> |
names[0], names[1], |
407 |
> |
names[2], names[3]); |
408 |
|
} |
409 |
|
|
410 |
|
/* |
411 |
|
* mo_set - SET command handler |
412 |
|
* set options while running |
413 |
|
*/ |
414 |
< |
static void |
415 |
< |
mo_set(struct Client *client_p, struct Client *source_p, |
437 |
< |
int parc, char *parv[]) |
414 |
> |
static int |
415 |
> |
mo_set(struct Client *source_p, int parc, char *parv[]) |
416 |
|
{ |
417 |
|
int n; |
418 |
|
int newval; |
419 |
< |
const char *arg = NULL; |
419 |
> |
const char *strarg = NULL; |
420 |
|
const char *intarg = NULL; |
443 |
– |
const struct SetStruct *tab = set_cmd_table; |
421 |
|
|
422 |
|
if (!HasOFlag(source_p, OPER_FLAG_SET)) |
423 |
|
{ |
424 |
< |
sendto_one(source_p, form_str(ERR_NOPRIVS), |
425 |
< |
me.name, source_p->name, "set"); |
449 |
< |
return; |
424 |
> |
sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "set"); |
425 |
> |
return 0; |
426 |
|
} |
427 |
|
|
428 |
|
if (parc > 1) |
431 |
|
* Go through all the commands in set_cmd_table, until one is |
432 |
|
* matched. |
433 |
|
*/ |
434 |
< |
for (; tab->handler; ++tab) |
434 |
> |
for (const struct SetStruct *tab = set_cmd_table; tab->handler; ++tab) |
435 |
|
{ |
436 |
< |
if (!irccmp(tab->name, parv[1])) |
437 |
< |
{ |
462 |
< |
/* |
463 |
< |
* Command found; now execute the code |
464 |
< |
*/ |
465 |
< |
n = 2; |
466 |
< |
|
467 |
< |
if (tab->wants_char) |
468 |
< |
arg = parv[n++]; |
469 |
< |
|
470 |
< |
if (tab->wants_int) |
471 |
< |
intarg = parv[n++]; |
472 |
< |
|
473 |
< |
if ((n - 1) > parc) |
474 |
< |
{ |
475 |
< |
if (parc > 2) |
476 |
< |
sendto_one(source_p, |
477 |
< |
":%s NOTICE %s :SET %s expects (\"%s%s\") args", |
478 |
< |
me.name, source_p->name, tab->name, |
479 |
< |
(tab->wants_char ? "string, " : ""), |
480 |
< |
(tab->wants_char ? "int" : "")); |
481 |
< |
} |
436 |
> |
if (irccmp(tab->name, parv[1])) |
437 |
> |
continue; |
438 |
|
|
439 |
< |
if (parc <= 2) |
440 |
< |
{ |
441 |
< |
arg = NULL; |
442 |
< |
intarg = NULL; |
443 |
< |
} |
439 |
> |
/* |
440 |
> |
* Command found; now execute the code |
441 |
> |
*/ |
442 |
> |
n = 2; |
443 |
> |
|
444 |
> |
if (tab->wants_char) |
445 |
> |
strarg = parv[n++]; |
446 |
> |
|
447 |
> |
if (tab->wants_int) |
448 |
> |
intarg = parv[n++]; |
449 |
> |
|
450 |
> |
if ((n - 1) > parc) |
451 |
> |
sendto_one_notice(source_p, &me, ":SET %s expects (\"%s%s\") args", tab->name, |
452 |
> |
(tab->wants_char ? "string, " : ""), |
453 |
> |
(tab->wants_int ? "int" : "")); |
454 |
|
|
455 |
< |
if (!strcmp(tab->name, "AUTOCONN") && (parc < 4)) |
456 |
< |
{ |
457 |
< |
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
458 |
< |
me.name, source_p->name, "SET"); |
459 |
< |
return; |
494 |
< |
} |
455 |
> |
if (parc <= 2) |
456 |
> |
{ |
457 |
> |
strarg = NULL; |
458 |
> |
intarg = NULL; |
459 |
> |
} |
460 |
|
|
461 |
< |
if (tab->wants_int && (parc > 2)) |
461 |
> |
if (tab->wants_int && parc > 2) |
462 |
> |
{ |
463 |
> |
if (intarg) |
464 |
|
{ |
465 |
< |
if (intarg) |
466 |
< |
{ |
467 |
< |
if (irccmp(intarg, "yes") == 0 || irccmp(intarg, "on") == 0) |
468 |
< |
newval = 1; |
502 |
< |
else if (irccmp(intarg, "no") == 0|| irccmp(intarg, "off") == 0) |
503 |
< |
newval = 0; |
504 |
< |
else |
505 |
< |
newval = atoi(intarg); |
506 |
< |
} |
465 |
> |
if (!irccmp(intarg, "yes") || !irccmp(intarg, "on")) |
466 |
> |
newval = 1; |
467 |
> |
else if (!irccmp(intarg, "no") || !irccmp(intarg, "off")) |
468 |
> |
newval = 0; |
469 |
|
else |
470 |
< |
newval = -1; |
509 |
< |
|
510 |
< |
if (newval < 0) |
511 |
< |
{ |
512 |
< |
sendto_one(source_p, |
513 |
< |
":%s NOTICE %s :Value less than 0 illegal for %s", |
514 |
< |
me.name, source_p->name, |
515 |
< |
tab->name); |
516 |
< |
|
517 |
< |
return; |
518 |
< |
} |
470 |
> |
newval = atoi(intarg); |
471 |
|
} |
472 |
|
else |
473 |
|
newval = -1; |
474 |
|
|
475 |
< |
if (tab->wants_char) |
475 |
> |
if (newval < 0) |
476 |
|
{ |
477 |
< |
if (tab->wants_int) |
478 |
< |
tab->handler(source_p, arg, newval); |
479 |
< |
else |
528 |
< |
tab->handler(source_p, arg); |
529 |
< |
return; |
530 |
< |
} |
531 |
< |
else |
532 |
< |
{ |
533 |
< |
if (tab->wants_int) |
534 |
< |
tab->handler(source_p, newval); |
535 |
< |
else |
536 |
< |
/* Just in case someone actually wants a |
537 |
< |
* set function that takes no args.. *shrug* */ |
538 |
< |
tab->handler(source_p); |
539 |
< |
return; |
477 |
> |
sendto_one_notice(source_p, &me, ":Value less than 0 illegal for %s", |
478 |
> |
tab->name); |
479 |
> |
return 0; |
480 |
|
} |
481 |
|
} |
482 |
+ |
else |
483 |
+ |
newval = -1; |
484 |
+ |
|
485 |
+ |
tab->handler(source_p, strarg, newval); |
486 |
+ |
return 0; |
487 |
|
} |
488 |
|
|
489 |
|
/* |
490 |
|
* Code here will be executed when a /QUOTE SET command is not |
491 |
|
* found within set_cmd_table. |
492 |
|
*/ |
493 |
< |
sendto_one(source_p, ":%s NOTICE %s :Variable not found.", |
494 |
< |
me.name, source_p->name); |
550 |
< |
return; |
493 |
> |
sendto_one_notice(source_p, &me, ":Variable not found."); |
494 |
> |
return 0; |
495 |
|
} |
496 |
|
|
497 |
|
list_quote_commands(source_p); |
498 |
+ |
return 0; |
499 |
|
} |
500 |
|
|
501 |
< |
static struct Message set_msgtab = { |
501 |
> |
static struct Message set_msgtab = |
502 |
> |
{ |
503 |
|
"SET", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
504 |
< |
{m_unregistered, m_not_oper, m_ignore, m_ignore, mo_set, m_ignore} |
504 |
> |
{ m_unregistered, m_not_oper, m_ignore, m_ignore, mo_set, m_ignore } |
505 |
|
}; |
506 |
|
|
507 |
|
static void |
516 |
|
mod_del_cmd(&set_msgtab); |
517 |
|
} |
518 |
|
|
519 |
< |
struct module module_entry = { |
519 |
> |
struct module module_entry = |
520 |
> |
{ |
521 |
|
.node = { NULL, NULL, NULL }, |
522 |
|
.name = NULL, |
523 |
|
.version = "$Revision$", |