X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/212380e3f42f585dc1ea927402252eb943f91f7b..8a78afe43d8c11af9e1d50ef438f0f193dcd12b3:/modules/m_set.c diff --git a/modules/m_set.c b/modules/m_set.c index d045b36..3f336c1 100644 --- a/modules/m_set.c +++ b/modules/m_set.c @@ -21,19 +21,17 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_set.c 494 2006-01-15 16:08:28Z jilles $ + * $Id: m_set.c 3406 2007-04-13 19:06:53Z jilles $ */ /* rewritten by jdc */ #include "stdinc.h" #include "client.h" -#include "event.h" #include "irc_string.h" #include "sprintf_irc.h" #include "ircd.h" #include "numeric.h" -#include "commio.h" #include "s_serv.h" #include "send.h" #include "common.h" @@ -52,7 +50,7 @@ struct Message set_msgtab = { }; mapi_clist_av1 set_clist[] = { &set_msgtab, NULL }; -DECLARE_MODULE_AV1(set, NULL, NULL, set_clist, NULL, NULL, "$Revision: 494 $"); +DECLARE_MODULE_AV1(set, NULL, NULL, set_clist, NULL, NULL, "$Revision: 3406 $"); /* Structure used for the SET table itself */ struct SetStruct @@ -72,7 +70,6 @@ static void quote_autoconn(struct Client *, char *, int); static void quote_autoconnall(struct Client *, int); static void quote_floodcount(struct Client *, int); static void quote_identtimeout(struct Client *, int); -static void quote_idletime(struct Client *, int); static void quote_max(struct Client *, int); static void quote_operstring(struct Client *, const char *); static void quote_spamnum(struct Client *, int); @@ -99,7 +96,6 @@ static struct SetStruct set_cmd_table[] = { {"AUTOCONNALL", quote_autoconnall, 0, 1 }, {"FLOODCOUNT", quote_floodcount, 0, 1 }, {"IDENTTIMEOUT", quote_identtimeout, 0, 1 }, - {"IDLETIME", quote_idletime, 0, 1 }, {"MAX", quote_max, 0, 1 }, {"MAXCLIENTS", quote_max, 0, 1 }, {"OPERSTRING", quote_operstring, 1, 0 }, @@ -124,8 +120,7 @@ list_quote_commands(struct Client *source_p) int j = 0; const char *names[4]; - sendto_one(source_p, ":%s NOTICE %s :Available QUOTE SET commands:", - me.name, source_p->name); + sendto_one_notice(source_p, ":Available QUOTE SET commands:"); names[0] = names[1] = names[2] = names[3] = ""; @@ -135,16 +130,16 @@ list_quote_commands(struct Client *source_p) if(j > 3) { - sendto_one(source_p, ":%s NOTICE %s :%s %s %s %s", - me.name, source_p->name, names[0], names[1], names[2], names[3]); + sendto_one_notice(source_p, ":%s %s %s %s", + names[0], names[1], names[2], names[3]); j = 0; names[0] = names[1] = names[2] = names[3] = ""; } } if(j) - sendto_one(source_p, ":%s NOTICE %s :%s %s %s %s", - me.name, source_p->name, names[0], names[1], names[2], names[3]); + sendto_one_notice(source_p, ":%s %s %s %s", + names[0], names[1], names[2], names[3]); } /* SET AUTOCONN */ @@ -167,8 +162,8 @@ quote_autoconnall(struct Client *source_p, int newval) } else { - sendto_one(source_p, ":%s NOTICE %s :AUTOCONNALL is currently %i", - me.name, source_p->name, GlobalSetOptions.autoconn); + sendto_one_notice(source_p, ":AUTOCONNALL is currently %i", + GlobalSetOptions.autoconn); } } @@ -186,8 +181,8 @@ quote_floodcount(struct Client *source_p, int newval) } else { - sendto_one(source_p, ":%s NOTICE %s :FLOODCOUNT is currently %i", - me.name, source_p->name, GlobalSetOptions.floodcount); + sendto_one_notice(source_p, ":FLOODCOUNT is currently %i", + GlobalSetOptions.floodcount); } } @@ -210,35 +205,8 @@ quote_identtimeout(struct Client *source_p, int newval) GlobalSetOptions.ident_timeout = newval; } else - sendto_one(source_p, ":%s NOTICE %s :IDENTTIMEOUT is currently %d", - me.name, source_p->name, GlobalSetOptions.ident_timeout); -} - -/* SET IDLETIME */ -static void -quote_idletime(struct Client *source_p, int newval) -{ - if(newval >= 0) - { - if(newval == 0) - { - sendto_realops_snomask(SNO_GENERAL, L_ALL, - "%s has disabled idletime checking", source_p->name); - GlobalSetOptions.idletime = 0; - } - else - { - sendto_realops_snomask(SNO_GENERAL, L_ALL, - "%s has changed IDLETIME to %i", - source_p->name, newval); - GlobalSetOptions.idletime = (newval * 60); - } - } - else - { - sendto_one(source_p, ":%s NOTICE %s :IDLETIME is currently %i", - me.name, source_p->name, GlobalSetOptions.idletime / 60); - } + sendto_one_notice(source_p, ":IDENTTIMEOUT is currently %d", + GlobalSetOptions.ident_timeout); } /* SET MAX */ @@ -247,20 +215,18 @@ quote_max(struct Client *source_p, int newval) { if(newval > 0) { - if(newval > MASTER_MAX) - { - sendto_one(source_p, - ":%s NOTICE %s :You cannot set MAXCLIENTS to > MASTER_MAX (%d)", - me.name, source_p->name, MASTER_MAX); - return; + if(newval > maxconnections - MAX_BUFFER) + { + sendto_one_notice(source_p, + ":You cannot set MAXCLIENTS to > %d", + maxconnections - MAX_BUFFER); + return; } if(newval < 32) { - sendto_one(source_p, - ":%s NOTICE %s :You cannot set MAXCLIENTS to < 32 (%d:%d)", - me.name, source_p->name, GlobalSetOptions.maxclients, - highest_fd); + sendto_one_notice(source_p, ":You cannot set MAXCLIENTS to < 32 (%d:%d)", + GlobalSetOptions.maxclients, rb_getmaxconnect()); return; } @@ -270,15 +236,14 @@ quote_max(struct Client *source_p, int newval) "%s!%s@%s set new MAXCLIENTS to %d (%lu current)", source_p->name, source_p->username, source_p->host, GlobalSetOptions.maxclients, - dlink_list_length(&lclient_list)); + rb_dlink_list_length(&lclient_list)); return; } else { - sendto_one(source_p, ":%s NOTICE %s :Current Maxclients = %d (%lu)", - me.name, source_p->name, GlobalSetOptions.maxclients, - dlink_list_length(&lclient_list)); + sendto_one_notice(source_p, ":Current Maxclients = %d (%lu)", + GlobalSetOptions.maxclients, rb_dlink_list_length(&lclient_list)); } } @@ -288,8 +253,7 @@ quote_operstring(struct Client *source_p, const char *arg) { if(EmptyString(arg)) { - sendto_one(source_p, ":%s NOTICE %s :OPERSTRING is currently '%s'", - me.name, source_p->name, GlobalSetOptions.operstring); + sendto_one_notice(source_p, ":OPERSTRING is currently '%s'", GlobalSetOptions.operstring); } else { @@ -308,8 +272,7 @@ quote_adminstring(struct Client *source_p, const char *arg) { if(EmptyString(arg)) { - sendto_one(source_p, ":%s NOTICE %s :ADMINSTRING is currently '%s'", - me.name, source_p->name, GlobalSetOptions.adminstring); + sendto_one_notice(source_p, ":ADMINSTRING is currently '%s'", GlobalSetOptions.adminstring); } else { @@ -348,8 +311,7 @@ quote_spamnum(struct Client *source_p, int newval) } else { - sendto_one(source_p, ":%s NOTICE %s :SPAMNUM is currently %i", - me.name, source_p->name, GlobalSetOptions.spam_num); + sendto_one_notice(source_p, ":SPAMNUM is currently %i", GlobalSetOptions.spam_num); } } @@ -372,8 +334,7 @@ quote_spamtime(struct Client *source_p, int newval) } else { - sendto_one(source_p, ":%s NOTICE %s :SPAMTIME is currently %i", - me.name, source_p->name, GlobalSetOptions.spam_time); + sendto_one_notice(source_p, ":SPAMTIME is currently %i", GlobalSetOptions.spam_time); } } @@ -417,7 +378,8 @@ quote_splitmode(struct Client *source_p, char *charval) splitmode = 0; splitchecking = 0; - eventDelete(check_splitmode, NULL); + rb_event_delete(check_splitmode_ev); + check_splitmode_ev = NULL; } /* ON */ else if(newval == 1) @@ -430,7 +392,8 @@ quote_splitmode(struct Client *source_p, char *charval) splitchecking = 0; /* we might be deactivating an automatic splitmode, so pull the event */ - eventDelete(check_splitmode, NULL); + rb_event_delete(check_splitmode_ev); + check_splitmode_ev = NULL; } /* AUTO */ else if(newval == 2) @@ -448,8 +411,7 @@ quote_splitmode(struct Client *source_p, char *charval) * pull values back out of, splitmode can be four states - but you can * only set to three, which means we cant use the same table --fl_ */ - sendto_one(source_p, ":%s NOTICE %s :SPLITMODE is currently %s", - me.name, source_p->name, + sendto_one_notice(source_p, ":SPLITMODE is currently %s", splitmode_status[(splitchecking + (splitmode * 2))]); } @@ -467,8 +429,7 @@ quote_splitnum(struct Client *source_p, int newval) check_splitmode(NULL); } else - sendto_one(source_p, ":%s NOTICE %s :SPLITNUM is currently %i", - me.name, source_p->name, split_servers); + sendto_one_notice(source_p, ":SPLITNUM is currently %i", split_servers); } /* SET SPLITUSERS */ @@ -485,8 +446,7 @@ quote_splitusers(struct Client *source_p, int newval) check_splitmode(NULL); } else - sendto_one(source_p, ":%s NOTICE %s :SPLITUSERS is currently %i", - me.name, source_p->name, split_users); + sendto_one_notice(source_p, ":SPLITUSERS is currently %i", split_users); } /* @@ -530,9 +490,8 @@ mo_set(struct Client *client_p, struct Client *source_p, int parc, const char *p if((n - 1) > parc) { - sendto_one(source_p, - ":%s NOTICE %s :SET %s expects (\"%s%s\") args", - me.name, source_p->name, + sendto_one_notice(source_p, + ":SET %s expects (\"%s%s\") args", set_cmd_table[i].name, (set_cmd_table[i]. wants_char ? "string, " : ""), @@ -566,9 +525,8 @@ mo_set(struct Client *client_p, struct Client *source_p, int parc, const char *p if(newval < 0) { - sendto_one(source_p, - ":%s NOTICE %s :Value less than 0 illegal for %s", - me.name, source_p->name, + sendto_one_notice(source_p, + ":Value less than 0 illegal for %s", set_cmd_table[i].name); return 0; @@ -602,7 +560,7 @@ mo_set(struct Client *client_p, struct Client *source_p, int parc, const char *p * Code here will be executed when a /QUOTE SET command is not * found within set_cmd_table. */ - sendto_one(source_p, ":%s NOTICE %s :Variable not found.", me.name, parv[0]); + sendto_one_notice(source_p, ":Variable not found."); return 0; }