]> jfr.im git - irc/quakenet/newserv.git/blobdiff - helpmod2/hcommands.c
fix bug in G stats
[irc/quakenet/newserv.git] / helpmod2 / hcommands.c
index 3f44409c2769d84e049ee99115dbc51934206cbf..050bed425268b3f2055d54fdb3b31016e57ecfa1 100644 (file)
@@ -5,6 +5,8 @@
 #include <sys/types.h>
 #include <dirent.h>
 
+#include "../lib/strlfunc.h"
+
 #include "hcommands.h"
 #include "hcommand.h"
 
@@ -766,7 +768,7 @@ static void helpmod_cmd_welcome (huser *sender, channel* returntype, char* ostr,
     }
     else
     {
-        strcpy(hchan->welcome, ostr);
+        strlcpy(hchan->welcome, ostr, HCHANNEL_WELCOME_LEN);
         helpmod_reply(sender, returntype, "Welcome message for channel %s (%s) is now: %s", hchan->real_channel->index->name->content, hchannel_get_state(hchan, H_WELCOME), hchan->welcome);
     }
 }
@@ -1683,7 +1685,7 @@ static void helpmod_cmd_everyoneout (huser *sender, channel* returntype, char* o
        if (huser_get_level((*hchanuser)->husr) < H_TRIAL)
            if (kickmode == HELPMOD_KICKMODE_ALL || (kickmode == HELPMOD_KICKMODE_UNAUTHED && !IsAccount((*hchanuser)->husr->real_user)))
            {
-               helpmod_kick(hchan, (*hchanuser)->husr, reason);
+               helpmod_kick(hchan, (*hchanuser)->husr, "%s", reason);
                continue;
            }
        hchanuser = &(*hchanuser)->next;
@@ -1756,7 +1758,7 @@ static void helpmod_cmd_kick (huser *sender, channel* returntype, char* ostr, in
     }
 
     for (i=0;i<ntargets;i++)
-        helpmod_kick(hchan, targets[i], reason);
+        helpmod_kick(hchan, targets[i], "%s", reason);
 }
 
 static void helpmod_cmd_stats (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
@@ -2035,12 +2037,14 @@ static void helpmod_cmd_activestaff (huser *sender, channel* returntype, char* o
     switch (listtype)
     {
     case 0:
-        for (i=0;i < arr.arrlen && arr.array[i].prime_time_spent > H_ACTIVE_LIMIT;i++)
-            helpmod_reply(sender, returntype, "#%-2d %-20s %-20s %-20s", i+1,((haccount*)(arr.array[i].owner))->name->content, helpmod_strtime(arr.array[i].prime_time_spent), helpmod_strtime(arr.array[i].time_spent));
+        for (i=0;i < arr.arrlen;i++)
+            if (arr.array[i].prime_time_spent > H_ACTIVE_LIMIT)
+                helpmod_reply(sender, returntype, "#%-2d %-20s %-20s %-20s", i+1,((haccount*)(arr.array[i].owner))->name->content, helpmod_strtime(arr.array[i].prime_time_spent), helpmod_strtime(arr.array[i].time_spent));
         break;
     case 1:
-        for (i=arr.arrlen-1;i >= 0 && arr.array[i].prime_time_spent < H_ACTIVE_LIMIT;i--)
-            helpmod_reply(sender, returntype, "#%-2d %-20s %-20s %-20s", (arr.arrlen - i),((haccount*)(arr.array[i].owner))->name->content, helpmod_strtime(arr.array[i].prime_time_spent), helpmod_strtime(arr.array[i].time_spent));
+        for (i=arr.arrlen-1;i >= 0;i--)
+            if (arr.array[i].prime_time_spent < H_ACTIVE_LIMIT)
+                helpmod_reply(sender, returntype, "#%-2d %-20s %-20s %-20s", (arr.arrlen - i),((haccount*)(arr.array[i].owner))->name->content, helpmod_strtime(arr.array[i].prime_time_spent), helpmod_strtime(arr.array[i].time_spent));
         break;
     }
 
@@ -3232,13 +3236,13 @@ static void helpmod_cmd_text (huser *sender, channel* returntype, char* ostr, in
 
            if (bufpos > (384 - (HED_FILENAME_LENGTH+1)))
            {
-               helpmod_reply(sender, returntype, buffer);
+               helpmod_reply(sender, returntype, "%s", buffer);
                bufpos = 0;
            }
        }
 
        if (bufpos)
-           helpmod_reply(sender, returntype, buffer);
+           helpmod_reply(sender, returntype, "%s", buffer);
 
        free(start);
         free(lines);
@@ -3508,7 +3512,8 @@ static void helpmod_cmd_weekstats (huser *sender, channel* returntype, char* ost
 
     helpmod_reply(sender, returntype, "Weekly statistics for %ss on channel %s", hlevel_name(lvl), hchannel_get_name(hchan));
 
-    for (i=0;i < arr.arrlen && arr.array[i].time_spent > HDEF_m;i++)
+    for (i=0;i < arr.arrlen;i++)
+      if (arr.array[i].time_spent > HDEF_m)
        helpmod_reply(sender, returntype, "%-20s %-20s %-20s",((haccount*)(arr.array[i].owner))->name->content, helpmod_strtime(arr.array[i].prime_time_spent), helpmod_strtime(arr.array[i].time_spent));
 
     free(arr.array);