Просмотр исходного кода

* Moved config settings (bad-cookie, op-time-slack, manop, mdop, mop) to 'chanset'
* Renamed 'op-time-slack' to 'cookie-time-slack'


svn: 1193

Bryan Drewery 22 лет назад
Родитель
Сommit
0193e29f0f
10 измененных файлов с 103 добавлено и 124 удалено
  1. 2 0
      doc/UPDATES
  2. 15 0
      misc/help.txt
  3. 8 116
      src/cfg.c
  4. 2 4
      src/cfg.h
  5. 11 2
      src/chan.h
  6. 2 0
      src/mod/channels.mod/channels.c
  7. 16 1
      src/mod/channels.mod/cmdschan.c
  8. 40 0
      src/mod/channels.mod/tclchan.c
  9. 6 0
      src/mod/channels.mod/userchan.c
  10. 1 1
      src/mod/irc.mod/mode.c

+ 2 - 0
doc/UPDATES

@@ -20,6 +20,8 @@ This is a summary of ChangeLog basically.
 * CLOAK_MIRC now randomly will add a SECOND version reply; some lame mIRC script.
 * CLOAK_MIRC now randomly will add a SECOND version reply; some lame mIRC script.
 * Users are no longer auto-opped on netsplit rejoin.
 * Users are no longer auto-opped on netsplit rejoin.
 * Passwords now require: 2lcase, 2ucase, 8 chars.
 * Passwords now require: 2lcase, 2ucase, 8 chars.
+* Moved config settings (bad-cookie, op-time-slack, manop, mdop, mop) to 'chanset'
+* Renamed 'op-time-slack' to 'cookie-time-slack'
 
 
 1.1.9
 1.1.9
 
 

+ 15 - 0
misc/help.txt

@@ -408,6 +408,21 @@ See also: link
                           channel is set to +i. Once the channel is -i then the
                           channel is set to +i. Once the channel is -i then the
                           invite will be removed the next time the bot checks.
                           invite will be removed the next time the bot checks.
                           Please note that this is an IRCnet feature.
                           Please note that this is an IRCnet feature.
+     The following options chose how to respond to specific events.
+        Each can be set from 0-3.
+        0           Ignore
+        1           Deop (chattr +d)
+        2           Kick (chattr +k)
+        3           Remove user
+      
+      %bbad-cookie%b             Missing or invalid cookie in bot op line.
+
+      %bcookie-time-slack%b      How many seconds off of botnet timesync is allowed
+                                 in cookies.
+      %bmanop%b                  Users who op manually in a -manop chan.
+      %bmdop%b                   Users who mass deop.
+      %bmop%b                    Users who mass op in a -mop chan.
+
      The following can be set + or - (e.g. .chanset #channel -enforcebans)
      The following can be set + or - (e.g. .chanset #channel -enforcebans)
         %bautoop%b         Bots that are +y will auto-op all users with 
         %bautoop%b         Bots that are +y will auto-op all users with 
                        op access to the channel.
                        op access to the channel.

+ 8 - 116
src/cfg.c

@@ -168,105 +168,11 @@ struct cfg_entry CFG_CMDPREFIX = {
 #endif /* LEAF */
 #endif /* LEAF */
 };
 };
 
 
-#ifdef HUB
-static void deflag_describe(struct cfg_entry *cfgent, int idx)
-{
-  if (cfgent == &CFG_BADCOOKIE)
-    dprintf(idx, STR("bad-cookie decides what happens to a bot if it does an illegal op (no/incorrect op cookie)\n"));
-  else if (cfgent == &CFG_MANUALOP)
-    dprintf(idx, STR("manop decides what happens to a user doing a manual op in a -manop channel\n"));
-#ifdef G_MEAN
-  else if (cfgent == &CFG_MEANDEOP)
-    dprintf(idx, STR("mean-deop decides what happens to a user deopping a bot in a +mean channel\n"));
-  else if (cfgent == &CFG_MEANKICK)
-    dprintf(idx, STR("mean-kick decides what happens to a user kicking a bot in a +mean channel\n"));
-  else if (cfgent == &CFG_MEANBAN)
-    dprintf(idx, STR("mean-ban decides what happens to a user banning a bot in a +mean channel\n"));
-#endif /* G_MEAN */
-  else if (cfgent == &CFG_MDOP)
-    dprintf(idx, STR("mdop decides what happens to a user doing a mass deop\n"));
-  else if (cfgent == &CFG_MOP)
-    dprintf(idx, STR("mop decides what happens to a user doing a mass op\n"));
-  dprintf(idx, 
-  STR("Valid settings are: ignore (No flag changes), deop (set flags to +d), kick (set flags to +dk) or delete (remove from userlist)\n"));
-}
-#endif /* HUB */
-
-static void deflag_changed(struct cfg_entry *entry, char *oldval, int *valid) 
-{
-  char *p = NULL;
-
-  if (!(p = (char *) entry->gdata))
-    return;
-
-  if (strcmp(p, "ignore") && strcmp(p, "deop") && strcmp(p, "kick") && strcmp(p, "delete"))
-    *valid = 0;
-}
-
-struct cfg_entry CFG_BADCOOKIE = {
-	"bad-cookie", CFGF_GLOBAL, NULL, NULL,
-	deflag_changed, NULL
-#ifdef HUB
-	, deflag_describe
-#endif /* HUB */
-};
-
-struct cfg_entry CFG_MANUALOP = {
-	"manop", CFGF_GLOBAL, NULL, NULL,
-	deflag_changed, NULL
-#ifdef HUB
-	, deflag_describe
-#endif /* HUB */
-};
-
-#ifdef G_MEAN
-struct cfg_entry CFG_MEANDEOP = {
-	"mean-deop", CFGF_GLOBAL, NULL, NULL,
-	deflag_changed, NULL
-#ifdef HUB
-	, deflag_describe
-#endif /* HUB */
-};
-
-
-struct cfg_entry CFG_MEANKICK = {
-	"mean-kick", CFGF_GLOBAL, NULL, NULL,
-	deflag_changed, NULL
-#ifdef HUB
-	, deflag_describe
-#endif /* HUB */
-};
-
-struct cfg_entry CFG_MEANBAN = {
-	"mean-ban", CFGF_GLOBAL, NULL, NULL,
-	deflag_changed, NULL
-#ifdef HUB
-	, deflag_describe
-#endif /* HUB */
-};
-#endif /* G_MEAN */
-
-struct cfg_entry CFG_MDOP = {
-	"mdop", CFGF_GLOBAL, NULL, NULL,
-	deflag_changed, NULL
-#ifdef HUB
-	, deflag_describe
-#endif /* HUB */
-};
-
-struct cfg_entry CFG_MOP = {
-	"mop", CFGF_GLOBAL, NULL, NULL,
-	deflag_changed, NULL
-#ifdef HUB
-	, deflag_describe
-#endif /* HUB */
-};
-
 void deflag_user(struct userrec *u, int why, char *msg, struct chanset_t *chan)
 void deflag_user(struct userrec *u, int why, char *msg, struct chanset_t *chan)
 {
 {
   char tmp[256] = "", tmp2[1024] = "";
   char tmp[256] = "", tmp2[1024] = "";
-  struct cfg_entry *ent = NULL;
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
+  int which = 0;
 
 
   if (!u)
   if (!u)
     return;
     return;
@@ -274,11 +180,11 @@ void deflag_user(struct userrec *u, int why, char *msg, struct chanset_t *chan)
   switch (why) {
   switch (why) {
   case DEFLAG_BADCOOKIE:
   case DEFLAG_BADCOOKIE:
     strcpy(tmp, "Bad op cookie");
     strcpy(tmp, "Bad op cookie");
-    ent = &CFG_BADCOOKIE;
+    which = chan->bad_cookie;
     break;
     break;
   case DEFLAG_MANUALOP:
   case DEFLAG_MANUALOP:
     strcpy(tmp, STR("Manual op in -manop channel"));
     strcpy(tmp, STR("Manual op in -manop channel"));
-    ent = &CFG_MANUALOP;
+    which = chan->manop;
     break;
     break;
 #ifdef G_MEAN
 #ifdef G_MEAN
   case DEFLAG_MEAN_DEOP:
   case DEFLAG_MEAN_DEOP:
@@ -296,17 +202,16 @@ void deflag_user(struct userrec *u, int why, char *msg, struct chanset_t *chan)
 #endif /* G_MEAN */
 #endif /* G_MEAN */
   case DEFLAG_MDOP:
   case DEFLAG_MDOP:
     strcpy(tmp, "Mass deop");
     strcpy(tmp, "Mass deop");
-    ent = &CFG_MDOP;
+    which = chan->mdop;
     break;
     break;
   case DEFLAG_MOP:
   case DEFLAG_MOP:
     strcpy(tmp, "Mass op");
     strcpy(tmp, "Mass op");
-    ent = &CFG_MOP;
+    which = chan->mop;
     break;
     break;
   default:
   default:
-    ent = NULL;
     sprintf(tmp, "Reason #%i", why);
     sprintf(tmp, "Reason #%i", why);
   }
   }
-  if (ent && ent->gdata && !strcmp(ent->gdata, "deop")) {
+  if (which == P_DEOP) {
     putlog(LOG_WARN, "*",  "Setting %s +d (%s): %s", u->handle, tmp, msg);
     putlog(LOG_WARN, "*",  "Setting %s +d (%s): %s", u->handle, tmp, msg);
     sprintf(tmp2, "+d: %s (%s)", tmp, msg);
     sprintf(tmp2, "+d: %s (%s)", tmp, msg);
     set_user(&USERENTRY_COMMENT, u, tmp2);
     set_user(&USERENTRY_COMMENT, u, tmp2);
@@ -314,7 +219,7 @@ void deflag_user(struct userrec *u, int why, char *msg, struct chanset_t *chan)
     fr.global = USER_DEOP;
     fr.global = USER_DEOP;
     fr.chan = USER_DEOP;
     fr.chan = USER_DEOP;
     set_user_flagrec(u, &fr, chan->dname);
     set_user_flagrec(u, &fr, chan->dname);
-  } else if (ent && ent->gdata && !strcmp(ent->gdata, "kick")) {
+  } else if (which == P_KICK) {
     putlog(LOG_WARN, "*",  "Setting %s +dk (%s): %s", u->handle, tmp, msg);
     putlog(LOG_WARN, "*",  "Setting %s +dk (%s): %s", u->handle, tmp, msg);
     sprintf(tmp2, "+dk: %s (%s)", tmp, msg);
     sprintf(tmp2, "+dk: %s (%s)", tmp, msg);
     set_user(&USERENTRY_COMMENT, u, tmp2);
     set_user(&USERENTRY_COMMENT, u, tmp2);
@@ -322,7 +227,7 @@ void deflag_user(struct userrec *u, int why, char *msg, struct chanset_t *chan)
     fr.global = USER_DEOP | USER_KICK;
     fr.global = USER_DEOP | USER_KICK;
     fr.chan = USER_DEOP | USER_KICK;
     fr.chan = USER_DEOP | USER_KICK;
     set_user_flagrec(u, &fr, chan->dname);
     set_user_flagrec(u, &fr, chan->dname);
-  } else if (ent && ent->gdata && !strcmp(ent->gdata, "delete")) {
+  } else if (which == P_DELETE) {
     putlog(LOG_WARN, "*",  "Deleting %s (%s): %s", u->handle, tmp, msg);
     putlog(LOG_WARN, "*",  "Deleting %s (%s): %s", u->handle, tmp, msg);
     deluser(u->handle);
     deluser(u->handle);
   } else {
   } else {
@@ -711,14 +616,6 @@ struct cfg_entry CFG_OPREQUESTS = {
 #endif /* HUB */
 #endif /* HUB */
 };
 };
 
 
-struct cfg_entry CFG_OPTIMESLACK = {
-	"op-time-slack", CFGF_GLOBAL, NULL, NULL,
-	getin_changed, NULL
-#ifdef HUB
-	, getin_describe
-#endif /* HUB */
-};
-
 void add_cfg(struct cfg_entry *entry)
 void add_cfg(struct cfg_entry *entry)
 {
 {
   cfg = (void *) realloc(cfg, sizeof(void *) * (cfg_count + 1));
   cfg = (void *) realloc(cfg, sizeof(void *) * (cfg_count + 1));
@@ -842,15 +739,11 @@ void init_config()
   add_cfg(&CFG_PROMISC);
   add_cfg(&CFG_PROMISC);
   add_cfg(&CFG_BADPROCESS);
   add_cfg(&CFG_BADPROCESS);
   add_cfg(&CFG_PROCESSLIST);
   add_cfg(&CFG_PROCESSLIST);
-  add_cfg(&CFG_BADCOOKIE);
-  add_cfg(&CFG_MANUALOP);
 #ifdef G_MEAN
 #ifdef G_MEAN
   add_cfg(&CFG_MEANDEOP);
   add_cfg(&CFG_MEANDEOP);
   add_cfg(&CFG_MEANKICK);
   add_cfg(&CFG_MEANKICK);
   add_cfg(&CFG_MEANBAN);
   add_cfg(&CFG_MEANBAN);
 #endif /* G_MEAN */
 #endif /* G_MEAN */
-  add_cfg(&CFG_MDOP);
-  add_cfg(&CFG_MOP);
   add_cfg(&CFG_MSGOP);
   add_cfg(&CFG_MSGOP);
   add_cfg(&CFG_MSGPASS);
   add_cfg(&CFG_MSGPASS);
   add_cfg(&CFG_MSGINVITE);
   add_cfg(&CFG_MSGINVITE);
@@ -864,7 +757,6 @@ void init_config()
   add_cfg(&CFG_INBOTS);
   add_cfg(&CFG_INBOTS);
   add_cfg(&CFG_LAGTHRESHOLD);
   add_cfg(&CFG_LAGTHRESHOLD);
   add_cfg(&CFG_OPREQUESTS);
   add_cfg(&CFG_OPREQUESTS);
-  add_cfg(&CFG_OPTIMESLACK);
   add_cfg(&CFG_FIGHTTHRESHOLD);
   add_cfg(&CFG_FIGHTTHRESHOLD);
   add_cfg(&CFG_CLOSETHRESHOLD);
   add_cfg(&CFG_CLOSETHRESHOLD);
   add_cfg(&CFG_KILLTHRESHOLD);
   add_cfg(&CFG_KILLTHRESHOLD);

+ 2 - 4
src/cfg.h

@@ -20,9 +20,8 @@ typedef struct cfg_entry {
 #endif /* HUB */
 #endif /* HUB */
 } cfg_entry_T;
 } cfg_entry_T;
 
 
-extern struct cfg_entry CFG_MOTD, CFG_CMDPREFIX, CFG_BADCOOKIE, CFG_MANUALOP, CFG_MDOP, 
-                        CFG_MOP, CFG_FORKINTERVAL, CFG_CHANSET, CFG_SERVERS, CFG_SERVERS6, 
-                        CFG_NICK, CFG_REALNAME, CFG_INBOTS, CFG_LAGTHRESHOLD, CFG_OPREQUESTS, CFG_OPTIMESLACK,
+extern struct cfg_entry CFG_MOTD, CFG_CMDPREFIX, CFG_FORKINTERVAL, CFG_CHANSET, CFG_SERVERS, CFG_SERVERS6, 
+                        CFG_NICK, CFG_REALNAME, CFG_INBOTS, CFG_LAGTHRESHOLD, CFG_OPREQUESTS,
                         CFG_OPBOTS, CFG_INBOTS, CFG_SERVPORT, CFG_AUTHKEY, CFG_MSGOP, CFG_MSGPASS, 
                         CFG_OPBOTS, CFG_INBOTS, CFG_SERVPORT, CFG_AUTHKEY, CFG_MSGOP, CFG_MSGPASS, 
 			CFG_MSGINVITE, CFG_MSGIDENT, CFG_LOGIN, CFG_HIJACK, CFG_TRACE, CFG_PROMISC, 
 			CFG_MSGINVITE, CFG_MSGIDENT, CFG_LOGIN, CFG_HIJACK, CFG_TRACE, CFG_PROMISC, 
 			CFG_BADPROCESS, CFG_PROCESSLIST, CFG_FIGHTTHRESHOLD, CFG_CLOSETHRESHOLD, CFG_KILLTHRESHOLD;
 			CFG_BADPROCESS, CFG_PROCESSLIST, CFG_FIGHTTHRESHOLD, CFG_CLOSETHRESHOLD, CFG_KILLTHRESHOLD;
@@ -50,7 +49,6 @@ extern struct cfg_entry		**cfg;
 #define LAG_THRESHOLD (CFG_LAGTHRESHOLD.gdata ? atoi(CFG_LAGTHRESHOLD.gdata) : 15)
 #define LAG_THRESHOLD (CFG_LAGTHRESHOLD.gdata ? atoi(CFG_LAGTHRESHOLD.gdata) : 15)
 #define OPREQ_COUNT (CFG_OPREQUESTS.gdata ? atoi( CFG_OPREQUESTS.gdata ) : 2)
 #define OPREQ_COUNT (CFG_OPREQUESTS.gdata ? atoi( CFG_OPREQUESTS.gdata ) : 2)
 #define OPREQ_SECONDS (CFG_OPREQUESTS.gdata ? atoi( strchr(CFG_OPREQUESTS.gdata, ':') + 1 ) : 5)
 #define OPREQ_SECONDS (CFG_OPREQUESTS.gdata ? atoi( strchr(CFG_OPREQUESTS.gdata, ':') + 1 ) : 5)
-#define OP_TIME_SLACK (CFG_OPTIMESLACK.gdata ? atoi(CFG_OPTIMESLACK.gdata) : 60)
 #define msgop CFG_MSGOP.ldata ? CFG_MSGOP.ldata : CFG_MSGOP.gdata ? CFG_MSGOP.gdata : ""
 #define msgop CFG_MSGOP.ldata ? CFG_MSGOP.ldata : CFG_MSGOP.gdata ? CFG_MSGOP.gdata : ""
 #define msgpass CFG_MSGPASS.ldata ? CFG_MSGPASS.ldata : CFG_MSGPASS.gdata ? CFG_MSGPASS.gdata : ""
 #define msgpass CFG_MSGPASS.ldata ? CFG_MSGPASS.ldata : CFG_MSGPASS.gdata ? CFG_MSGPASS.gdata : ""
 #define msginvite CFG_MSGINVITE.ldata ? CFG_MSGINVITE.ldata : CFG_MSGINVITE.gdata ? CFG_MSGINVITE.gdata : ""
 #define msginvite CFG_MSGINVITE.ldata ? CFG_MSGINVITE.ldata : CFG_MSGINVITE.gdata ? CFG_MSGINVITE.gdata : ""

+ 11 - 2
src/chan.h

@@ -53,6 +53,10 @@ typedef struct memstruct {
 #define chan_wasop(x) (x->flags & WASOP)
 #define chan_wasop(x) (x->flags & WASOP)
 #define chan_stopcheck(x) (x->flags & STOPCHECK)
 #define chan_stopcheck(x) (x->flags & STOPCHECK)
 
 
+#define P_DEOP		1
+#define P_KICK		2
+#define P_DELETE	3
+
 /* Why duplicate this struct for exempts and invites only under another
 /* Why duplicate this struct for exempts and invites only under another
  * name? <cybah>
  * name? <cybah>
  */
  */
@@ -131,6 +135,8 @@ struct chanset_t {
   } cmode[MODES_PER_LINE_MAX];                 /* parameter-type mode changes -        */
   } cmode[MODES_PER_LINE_MAX];                 /* parameter-type mode changes -        */
   /* detect floods */
   /* detect floods */
   time_t floodtime[FLOOD_CHAN_MAX];
   time_t floodtime[FLOOD_CHAN_MAX];
+  uint32_t status;
+  uint32_t ircnet_status;
   int flood_pub_thr;
   int flood_pub_thr;
   int flood_pub_time;
   int flood_pub_time;
   int flood_join_thr;
   int flood_join_thr;
@@ -143,11 +149,14 @@ struct chanset_t {
   int flood_ctcp_time;
   int flood_ctcp_time;
   int flood_nick_thr;
   int flood_nick_thr;
   int flood_nick_time;
   int flood_nick_time;
-  uint32_t status;
-  uint32_t ircnet_status;
   int limitraise;
   int limitraise;
   int closed_ban;
   int closed_ban;
   int closed_private;
   int closed_private;
+  int bad_cookie;
+  int cookie_time_slack;
+  int manop;
+  int mdop;
+  int mop;
 /* Chanint template 
 /* Chanint template 
  *int temp;
  *int temp;
  */
  */

+ 2 - 0
src/mod/channels.mod/channels.c

@@ -429,7 +429,9 @@ channels_timers()
     if ((cnt % 60) == 0) {
     if ((cnt % 60) == 0) {
       /* 60 seconds */
       /* 60 seconds */
       cnt = 0;
       cnt = 0;
+#ifdef LEAF
       check_limitraise(chan);
       check_limitraise(chan);
+#endif /* LEAF */
     }
     }
   }
   }
 }
 }

+ 16 - 1
src/mod/channels.mod/cmdschan.c

@@ -1149,6 +1149,9 @@ void show_int(int idx, char *work, int *cnt, const char *desc, int state, const
     strcat(tmp2, BOLD(idx));
     strcat(tmp2, BOLD(idx));
     if (state && yes) {
     if (state && yes) {
       strcat(tmp2, yes);
       strcat(tmp2, yes);
+      strcat(tmp3, " (");
+      strcat(tmp3, chr_state);
+      strcat(tmp3, ")");
     } else if (!state && no) {
     } else if (!state && no) {
       strcat(tmp2, no);
       strcat(tmp2, no);
       strcat(tmp3, " (");
       strcat(tmp3, " (");
@@ -1167,6 +1170,7 @@ void show_int(int idx, char *work, int *cnt, const char *desc, int state, const
 
 
 #define SHOW_FLAG(name, state) show_flag(idx, work, &cnt, name, state)
 #define SHOW_FLAG(name, state) show_flag(idx, work, &cnt, name, state)
 #define SHOW_INT(desc, state, yes, no) show_int(idx, work, &cnt, desc, state, yes, no)
 #define SHOW_INT(desc, state, yes, no) show_int(idx, work, &cnt, desc, state, yes, no)
+#define P_STR deflag == P_KICK ? "Kick" : (deflag == P_DEOP ? "Deop" : (deflag == P_DELETE ? "Remove" : NULL))
 static void cmd_chaninfo(struct userrec *u, int idx, char *par)
 static void cmd_chaninfo(struct userrec *u, int idx, char *par)
 {
 {
   char *chname = NULL, work[512] = "";
   char *chname = NULL, work[512] = "";
@@ -1191,6 +1195,7 @@ static void cmd_chaninfo(struct userrec *u, int idx, char *par)
     dprintf(idx, "No such channel defined.\n");
     dprintf(idx, "No such channel defined.\n");
   else {
   else {
     char nick[NICKLEN] = "", date[81] = "";
     char nick[NICKLEN] = "", date[81] = "";
+    int deflag = 0;
 
 
     if (chan->added_ts) {
     if (chan->added_ts) {
       egg_strftime(date, sizeof date, "%c %Z", gmtime(&(chan->added_ts)));
       egg_strftime(date, sizeof date, "%c %Z", gmtime(&(chan->added_ts)));
@@ -1250,13 +1255,23 @@ static void cmd_chaninfo(struct userrec *u, int idx, char *par)
  * SHOW_INT("Desc: ", integer, "YES", "NO");
  * SHOW_INT("Desc: ", integer, "YES", "NO");
  */
  */
     dprintf(idx, "Channel settings:\n");
     dprintf(idx, "Channel settings:\n");
+    deflag = chan->bad_cookie;
+    SHOW_INT("Bad-cookie:" , chan->bad_cookie, P_STR, "Ignore");
     SHOW_INT("Ban-time: ", chan->ban_time, NULL, "Forever");
     SHOW_INT("Ban-time: ", chan->ban_time, NULL, "Forever");
     SHOW_INT("Closed-ban: ", chan->closed_ban, NULL, "Don't!");
     SHOW_INT("Closed-ban: ", chan->closed_ban, NULL, "Don't!");
-    SHOW_INT("Closed-Private", chan->closed_private, NULL, "Don't!");
+    SHOW_INT("Closed-Private:", chan->closed_private, NULL, "Don't!");
+    deflag = chan->cookie_time_slack;
+    SHOW_INT("Cookie-time-slack:", chan->cookie_time_slack, P_STR, "Ignore");
     SHOW_INT("Exempt-time: ", chan->exempt_time, NULL, "Forever");
     SHOW_INT("Exempt-time: ", chan->exempt_time, NULL, "Forever");
     SHOW_INT("Idle Kick after (idle-kick): ", chan->idle_kick, "", "Don't!");
     SHOW_INT("Idle Kick after (idle-kick): ", chan->idle_kick, "", "Don't!");
     SHOW_INT("Invite-time: ", chan->invite_time, NULL, "Forever");
     SHOW_INT("Invite-time: ", chan->invite_time, NULL, "Forever");
     SHOW_INT("Limit raise (limit): ", chan->limitraise, NULL, "Disabled");
     SHOW_INT("Limit raise (limit): ", chan->limitraise, NULL, "Disabled");
+    deflag = chan->manop;
+    SHOW_INT("Manop: ", chan->manop, P_STR, "Ignore");
+    deflag = chan->mdop;
+    SHOW_INT("Mdop: ", chan->mdop, P_STR, "Ignore");
+    deflag = chan->mop;
+    SHOW_INT("Mop: ", chan->mop, P_STR, "Ignore");
     SHOW_INT("Revenge-mode: ", chan->revenge_mode, NULL, NULL);
     SHOW_INT("Revenge-mode: ", chan->revenge_mode, NULL, NULL);
     SHOW_INT("Stopnethack-mode: ", chan->stopnethack_mode, "", "Don't!");
     SHOW_INT("Stopnethack-mode: ", chan->stopnethack_mode, "", "Don't!");
 
 

+ 40 - 0
src/mod/channels.mod/tclchan.c

@@ -417,6 +417,46 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
         return ERROR;
         return ERROR;
       }
       }
       chan->closed_private = atoi(item[i]);
       chan->closed_private = atoi(item[i]);
+    } else if (!strcmp(item[i], "bad-cookie")) {
+      i++;
+      if (i >= items) {
+        if (result)
+          sprintf(result, "channel bad-cookie needs argument");
+        return ERROR;
+      }
+      chan->bad_cookie = atoi(item[i]);
+    } else if (!strcmp(item[i], "cookie_time_slack")) {
+      i++;
+      if (i >= items) {
+        if (result)
+          sprintf(result, "channel cookie-time-slack needs argument");
+        return ERROR;
+      }
+      chan->cookie_time_slack = atoi(item[i]);
+    } else if (!strcmp(item[i], "manop")) {
+      i++;
+      if (i >= items) {
+        if (result)
+          sprintf(result, "channel manop needs argument");
+        return ERROR;
+      }
+      chan->manop = atoi(item[i]);
+    } else if (!strcmp(item[i], "mdop")) {
+      i++;
+      if (i >= items) {
+        if (result)
+          sprintf(result, "channel mdop needs argument");
+        return ERROR;
+      }
+      chan->mdop = atoi(item[i]);
+    } else if (!strcmp(item[i], "mop")) {
+      i++;
+      if (i >= items) {
+        if (result)
+          sprintf(result, "channel mop needs argument");
+        return ERROR;
+      }
+      chan->mop = atoi(item[i]);
 /* Chanint template
 /* Chanint template
  *  } else if (!strcmp(item[i], "temp")) {
  *  } else if (!strcmp(item[i], "temp")) {
  *    i++;
  *    i++;

+ 6 - 0
src/mod/channels.mod/userchan.c

@@ -1006,6 +1006,7 @@ int write_chans(FILE *f, int idx)
 
 
     if (lfprintf(f, "\
     if (lfprintf(f, "\
 + channel add %s { chanmode { %s } addedby %s addedts %lu idle-kick %d \
 + channel add %s { chanmode { %s } addedby %s addedts %lu idle-kick %d \
+bad-cookie %d cookie-time-slack %d manop %d mdop %d mop %d \
 limit %d stopnethack-mode %d revenge-mode %d flood-chan %d:%d \
 limit %d stopnethack-mode %d revenge-mode %d flood-chan %d:%d \
 flood-ctcp %d:%d flood-join %d:%d flood-kick %d:%d flood-deop %d:%d \
 flood-ctcp %d:%d flood-join %d:%d flood-kick %d:%d flood-deop %d:%d \
 flood-nick %d:%d closed-ban %d closed-private %d ban-time %d \
 flood-nick %d:%d closed-ban %d closed-private %d ban-time %d \
@@ -1022,6 +1023,11 @@ exempt-time %d invite-time %d %cenforcebans %cdynamicbans %cuserbans \
  * also include temp %s in dprintf.
  * also include temp %s in dprintf.
  */
  */
 	chan->idle_kick, /* idle-kick 0 is same as dont-idle-kick (lcode)*/
 	chan->idle_kick, /* idle-kick 0 is same as dont-idle-kick (lcode)*/
+	chan->bad_cookie,
+	chan->cookie_time_slack,
+	chan->manop,
+	chan->mdop,
+	chan->mop,
         chan->limitraise,
         chan->limitraise,
 	chan->stopnethack_mode,
 	chan->stopnethack_mode,
         chan->revenge_mode,
         chan->revenge_mode,

+ 1 - 1
src/mod/irc.mod/mode.c

@@ -947,7 +947,7 @@ static int gotmode(char *from, char *msg)
             optime = atol(ltmp);
             optime = atol(ltmp);
             off = (now + timesync - optime);
             off = (now + timesync - optime);
 
 
-            if (abs(off) > OP_TIME_SLACK) {
+            if (chan->cookie_time_slack && (abs(off) > chan->cookie_time_slack)) {
               /* isbadop = 4; */
               /* isbadop = 4; */
               putlog(LOG_DEBUG, "*", "%s opped with bad ts (not punishing.): %li was off by %li", nfrom, optime, off);
               putlog(LOG_DEBUG, "*", "%s opped with bad ts (not punishing.): %li was off by %li", nfrom, optime, off);
             }
             }