]> jfr.im git - solanum.git/blobdiff - modules/m_set.c
Merge pull request #279 from edk0/operhide
[solanum.git] / modules / m_set.c
index 766f195628aa05a5027ccf39d62dbfd1fc0e127a..34bdea2e5b66ef7ba74e06aa57e9c9cf444aeb5a 100644 (file)
@@ -31,7 +31,6 @@
 #include "numeric.h"
 #include "s_serv.h"
 #include "send.h"
-#include "common.h"
 #include "channel.h"
 #include "s_conf.h"
 #include "s_newconf.h"
@@ -41,7 +40,7 @@
 
 static const char set_desc[] = "Provides the SET command to change server parameters";
 
-static int mo_set(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void mo_set(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 
 struct Message set_msgtab = {
        "SET", 0, 0, 0, 0,
@@ -56,11 +55,11 @@ struct SetStruct
 {
        const char *name;
        void (*handler)(struct Client *source_p, const char *chararg, int intarg);
-       int wants_char;         /* 1 if it expects (char *, [int]) */
-       int wants_int;          /* 1 if it expects ([char *], int) */
+       bool wants_char;        /* true if it expects (char *, [int]) */
+       bool wants_int;         /* true if it expects ([char *], int) */
 
-       /* eg:  0, 1 == only an int arg
-        * eg:  1, 1 == char and int args */
+       /* eg:  false, true == only an int arg
+        * eg:  true, true  == char and int args */
 };
 
 
@@ -89,23 +88,23 @@ static void list_quote_commands(struct Client *);
  */
 
 static struct SetStruct set_cmd_table[] = {
-       /* name               function      string arg  int arg */
+       /* name               function      string arg  bool arg */
        /* -------------------------------------------------------- */
-       {"ADMINSTRING", quote_adminstring,      1,      0       },
-       {"AUTOCONN",    quote_autoconn,         1,      1       },
-       {"AUTOCONNALL", quote_autoconnall,      0,      1       },
-       {"FLOODCOUNT",  quote_floodcount,       0,      1       },
-       {"IDENTTIMEOUT", quote_identtimeout,    0,      1       },
-       {"MAX",         quote_max,              0,      1       },
-       {"MAXCLIENTS",  quote_max,              0,      1       },
-       {"OPERSTRING",  quote_operstring,       1,      0       },
-       {"SPAMNUM",     quote_spamnum,          0,      1       },
-       {"SPAMTIME",    quote_spamtime,         0,      1       },
-       {"SPLITMODE",   quote_splitmode,        1,      0       },
-       {"SPLITNUM",    quote_splitnum,         0,      1       },
-       {"SPLITUSERS",  quote_splitusers,       0,      1       },
+       {"ADMINSTRING", quote_adminstring,      true,   false   },
+       {"AUTOCONN",    quote_autoconn,         true,   true    },
+       {"AUTOCONNALL", quote_autoconnall,      false,  true    },
+       {"FLOODCOUNT",  quote_floodcount,       false,  true    },
+       {"IDENTTIMEOUT", quote_identtimeout,    false,  true    },
+       {"MAX",         quote_max,              false,  true    },
+       {"MAXCLIENTS",  quote_max,              false,  true    },
+       {"OPERSTRING",  quote_operstring,       true,   false   },
+       {"SPAMNUM",     quote_spamnum,          false,  true    },
+       {"SPAMTIME",    quote_spamtime,         false,  true    },
+       {"SPLITMODE",   quote_splitmode,        true,   false   },
+       {"SPLITNUM",    quote_splitnum,         false,  true    },
+       {"SPLITUSERS",  quote_splitusers,       false,  true    },
        /* -------------------------------------------------------- */
-       {(char *) 0, (void (*)(struct Client *, const char *, int)) 0, 0, 0}
+       {NULL,          NULL,                   false,  false   },
 };
 
 
@@ -203,6 +202,7 @@ quote_identtimeout(struct Client *source_p, const char *arg, int newval)
                                     "%s has changed IDENTTIMEOUT to %d",
                                     get_oper_name(source_p), newval);
                GlobalSetOptions.ident_timeout = newval;
+               set_authd_timeout("ident_timeout", newval);
        }
        else
                sendto_one_notice(source_p, ":IDENTTIMEOUT is currently %d",
@@ -375,8 +375,8 @@ quote_splitmode(struct Client *source_p, const char *charval, int intval)
                        sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                             "%s is disabling splitmode", get_oper_name(source_p));
 
-                       splitmode = 0;
-                       splitchecking = 0;
+                       splitmode = false;
+                       splitchecking = false;
 
                        rb_event_delete(check_splitmode_ev);
                        check_splitmode_ev = NULL;
@@ -388,8 +388,8 @@ quote_splitmode(struct Client *source_p, const char *charval, int intval)
                                             "%s is enabling and activating splitmode",
                                             get_oper_name(source_p));
 
-                       splitmode = 1;
-                       splitchecking = 0;
+                       splitmode = true;
+                       splitchecking = false;
 
                        /* we might be deactivating an automatic splitmode, so pull the event */
                        rb_event_delete(check_splitmode_ev);
@@ -402,7 +402,7 @@ quote_splitmode(struct Client *source_p, const char *charval, int intval)
                                             "%s is enabling automatic splitmode",
                                             get_oper_name(source_p));
 
-                       splitchecking = 1;
+                       splitchecking = true;
                        check_splitmode(NULL);
                }
        }
@@ -453,7 +453,7 @@ quote_splitusers(struct Client *source_p, const char *arg, int newval)
  * mo_set - SET command handler
  * set options while running
  */
-static int
+static void
 mo_set(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        int newval;
@@ -497,7 +497,7 @@ mo_set(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
                                                    wants_char ? "string, " : ""),
                                                   (set_cmd_table[i].
                                                    wants_char ? "int" : ""));
-                                       return 0;
+                                       return;
                                }
 
                                if(parc <= 2)
@@ -529,14 +529,14 @@ mo_set(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
                                                           ":Value less than 0 illegal for %s",
                                                           set_cmd_table[i].name);
 
-                                               return 0;
+                                               return;
                                        }
                                }
                                else
                                        newval = -1;
 
                                set_cmd_table[i].handler(source_p, arg, newval);
-                               return 0;
+                               return;
                        }
                }
 
@@ -545,10 +545,8 @@ mo_set(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
                 * found within set_cmd_table.
                 */
                sendto_one_notice(source_p, ":Variable not found.");
-               return 0;
+               return;
        }
 
        list_quote_commands(source_p);
-
-       return 0;
 }