Fix some signed/unsigned misbehaviors; add FAQ
[srvx.git] / src / chanserv.c
index 9fdec6c577a3d6fe4117ec83601915511a448f61..5b5f247db6225ff8d44cfa788f83006c42355a80 100644 (file)
@@ -396,6 +396,7 @@ static const struct message_entry msgtab[] = {
     { "CSMSG_NETWORK_SERVERS", "$bServers:             $b%i" },
     { "CSMSG_NETWORK_USERS",   "$bTotal Users:         $b%i" },
     { "CSMSG_NETWORK_BANS",    "$bTotal Ban Count:     $b%i" },
+    { "CSMSG_NETWORK_CHANUSERS", "$bTotal User Count:    $b%i" },
     { "CSMSG_NETWORK_OPERS",   "$bIRC Operators:       $b%i" },
     { "CSMSG_NETWORK_CHANNELS","$bRegistered Channels: $b%i" },
     { "CSMSG_SERVICES_UPTIME", "$bServices Uptime:     $b%s" },
@@ -427,9 +428,9 @@ static const struct message_entry msgtab[] = {
     { "CSMSG_WUT_RESPONSE", "wut" },
     { "CSMSG_BAD_NUMBER", "$b%s$b is an invalid number.  Please use a number greater than 1 with this command." },
     { "CSMSG_BAD_DIE_FORMAT", "I do not understand $b%s$b.  Please use either a single number or standard 4d6+3 format." },
-    { "CSMSG_BAD_DICE_COUNT", "%d is too many dice.  Please use at most %d." },
-    { "CSMSG_DICE_ROLL", "The total is $b%d$b from rolling %dd%d+%d." },
-    { "CSMSG_DIE_ROLL", "A $b%d$b shows on the %d-sided die." },
+    { "CSMSG_BAD_DICE_COUNT", "%lu is too many dice.  Please use at most %lu." },
+    { "CSMSG_DICE_ROLL", "The total is $b%lu$b from rolling %lud%lu+%lu." },
+    { "CSMSG_DIE_ROLL", "A $b%lu$b shows on the %lu-sided die." },
     { "CSMSG_HUGGLES_HIM", "\001ACTION huggles %s\001" },
     { "CSMSG_HUGGLES_YOU", "\001ACTION huggles you\001" },
 
@@ -642,7 +643,7 @@ user_level_from_name(const char *name, unsigned short clamp_level)
 {
     unsigned int level = 0, ii;
     if(isdigit(name[0]))
-        level = atoi(name);
+        level = strtoul(name, NULL, 10);
     else for(ii = 0; (ii < ArrayLength(accessLevels)) && !level; ++ii)
         if(!irccasecmp(name, accessLevels[ii].name))
             level = accessLevels[ii].level;
@@ -3907,7 +3908,7 @@ static CHANSERV_FUNC(cmd_netinfo)
     reply("CSMSG_NETWORK_OPERS", curr_opers.used);
     reply("CSMSG_NETWORK_CHANNELS", registered_channels);
     reply("CSMSG_NETWORK_BANS", banCount);
-    reply("CSMSG_CHANNEL_USERS", userCount);
+    reply("CSMSG_NETWORK_CHANUSERS", userCount);
     reply("CSMSG_SERVICES_UPTIME", intervalString(interval, time(NULL) - boot_time, user->handle_info));
     reply("CSMSG_BURST_LENGTH", intervalString(interval, burst_length, user->handle_info));
     return 1;
@@ -4297,12 +4298,14 @@ static CHANSERV_FUNC(cmd_events)
     unsigned int matches, limit;
 
     limit = (argc > 1) ? atoi(argv[1]) : 10;
-    if(limit < 1 || limit > 200) limit = 10;
+    if(limit < 1 || limit > 200)
+        limit = 10;
 
     memset(&discrim, 0, sizeof(discrim));
     discrim.masks.bot = chanserv;
     discrim.masks.channel_name = channel->name;
-    if(argc > 2) discrim.masks.command = argv[2];
+    if(argc > 2)
+        discrim.masks.command = argv[2];
     discrim.limit = limit;
     discrim.max_time = INT_MAX;
     discrim.severities = 1 << LOG_COMMAND;
@@ -6081,7 +6084,7 @@ handle_mode(struct chanNode *channel, struct userNode *user, const struct mod_ch
             bounce->args[bnc].member = change->args[ii].member;
             bnc++;
         }
-        else if(change->args[ii].mode & MODE_BAN)
+        else if((change->args[ii].mode & (MODE_REMOVE | MODE_BAN)) == MODE_BAN)
         {
             const char *ban = change->args[ii].hostmask;
             if(!bad_channel_ban(channel, user, ban, NULL, NULL))