Преглед изворни кода

* Fixed limit, wasn't correclty checking *each chan* every *2* minutes.

svn: 1742
Bryan Drewery пре 21 година
родитељ
комит
196dc691b1
3 измењених фајлова са 7 додато и 7 уклоњено
  1. 1 0
      doc/UPDATES
  2. 1 0
      src/chan.h
  3. 5 7
      src/mod/channels.mod/channels.c

+ 1 - 0
doc/UPDATES

@@ -6,6 +6,7 @@ Lines prefixxed with '-' were disabled before release and are not finishsed.
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.
 * help for cmd_unlink was missing [reason] parameter
 * Updated binary -h
+* Fixed limit, wasn't correclty checking *each chan* every *2* minutes.
 
 1.2.1
 

+ 1 - 0
src/chan.h

@@ -152,6 +152,7 @@ struct chanset_t {
   int flood_nick_thr;
   time_t flood_nick_time;
   int limitraise;
+  int checklimit;
   int closed_ban;
   int closed_private;
   int closed_invite;

+ 5 - 7
src/mod/channels.mod/channels.c

@@ -392,11 +392,9 @@ check_slowjoinpart(struct chanset_t *chan)
 static void 
 check_limitraise(struct chanset_t *chan) {
   /* only check every other time for now */
-  static int checklimit = 0;
-
-  checklimit++;
-  if (checklimit == 2) {
-    checklimit = 0;
+  chan->checklimit++;
+  if (chan->checklimit == 2) {
+    chan->checklimit = 0;
     if (chan->limitraise && dolimit(chan))
       raise_limit(chan);
   }
@@ -407,12 +405,12 @@ static void
 channels_timers()
 {
   static int cnt = 0;
-  struct chanset_t *chan_n = NULL;
+  struct chanset_t *chan_n = NULL, *chan = NULL;
   bool reset = 0;
 
   cnt += 10;		/* function is called every 10 seconds */
   
-  for (struct chanset_t *chan = chanset; chan; chan = chan_n) {
+  for (chan = chanset; chan; chan = chan_n) {
     chan_n = chan->next;
 
     if ((cnt % 10) == 0) {