Przeglądaj źródła

* Ported [2845] to 1.2.10
* Removed stop-nethack and associated flags. (fixes #219)
* +bitch is now properly enforced on a netsplit return. (fixes #219)


svn: 2846

Bryan Drewery 20 lat temu
rodzic
commit
b42e4ba676

+ 2 - 0
doc/UPDATES

@@ -26,6 +26,8 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Hubs will now boot removed users/bots upon userfile reload. (addresses #243)
 * Fix typo in help file for 'botpart' (fixes #259)
 * Now supressing "port taken" error on hub startup.
+* Removed stop-nethack and associated flags. (fixes #219)
+* +bitch is now properly enforced on a netsplit return. (fixes #219)
 
 1.2.9 - http://tracker.shatow.net/milestone/1.2.9
 * Fixed cmd_[un]stick not properly using numbers for channel masks. (#160)

+ 2 - 18
misc/help.txt

@@ -355,19 +355,6 @@ See also: link
         $blimit$b             If this is set, the +l bot will raise the limit 
                           to the users in the channel + this ammount. Set to 
                           0 to disable.
-        $bstopnethack-mode$b  This setting will make the bot de-op anyone who
-                          enters the channel with serverops. There are seven
-                          different modes for this settings:
-                            0 turn off
-                            1 isoptest (allow serverop if registered op)
-                            2 wasoptest (allow serverop if user had op before
-                              split)
-                            3 allow serverop if isop or wasop
-                            4 allow serverop if isop and wasop
-                            5 If the channel is -bitch, see stopnethack-mode 3
-                              If the channel is +bitch, see stopnethack-mode 1
-                            6 If the channel is -bitch, see stopnethack-mode 2
-                              If the channel is +bitch, see stopnethack-mode 4
         $bclosed-ban$b        Set this to 1 to ban users who join +closed 
                           channels. This is probably not needed though, as
                           +closed maintains +i.
@@ -1825,7 +1812,6 @@ See also: whom
               Be careful who you give this to, only the perm-owner of the net should even have it.
       $bc$b - chat-bot (bot accepts DCC chat on irc)
       $bd$b - deop (user cannot gain ops in any channel)
-      $be$b - nethack-exempt (user is exempted from stopnethack protection)
       $bi$b - hub access (user has hub DCC access)
       $bj$b - leaf access (user has leaf DCC access)
       $bk$b - autokick (user is kicked and banned automatically)
@@ -1839,14 +1825,13 @@ See also: whom
       $br$b - resolve (bot resolves clients in to match against userlist) [$bCPU INTENSIVE+$b]
       $bu$b - update-bot (see doc/UPGRADING)
       $bv$b - voice (user gets +v automatically from +y bots)
-      $bw$b - wasop-test (needs wasop test for +stopnethack procedure)
+      $bw$b - wasop-test (INTERNAL)
       $bx$b - flood-exempt (user is exempt from flood kicks)
       $by$b - voice-bot (bot gives out voices/auto-ops in chans) [$bCPU INTENSIVE$b]
  
    Users can also have flags specific to a channel:
  
       $bd$b - deop (user cannot gain ops on the channel)
-      $be$b - nethack-exempt (user is exempted from stopnethack protection)
       $bk$b - autokick (user is kicked and banned automatically)
       $bl$b - limit-bot (bot sets limit in the channel) [$bCPU INTENSIVE$b]
       $bm$b - master (user is a channel master)
@@ -1856,9 +1841,8 @@ See also: whom
       $bq$b - quiet (user cannot gain voice on the channel)
       $br$b - resolve (bot resolves clients in channel to match against userlist) [$bCPU INTENSIVE+$b]
       $bv$b - voice (user gets +v automatically)
-      $bw$b - wasop-test (needs wasop test for +stopnethack procedure)
+      $bw$b - wasop-test (INTERNAL)
       $by$b - voice-bot (bot gives out voices/auto-ops in the channel) [$bCPU INTENSIVE$b]
-      $bz$b - washalfop-test (needs washalfop test for +stopnethack procedure)
  
    Hostmasks for the user are displayed on the following lines. If the user is
    a bot, there will be a line below which says "ADDRESS:" and gives the bot's

+ 0 - 1
src/chan.h

@@ -167,7 +167,6 @@ struct chanset_t {
  *int temp;
  */
   int idle_kick;
-  int stopnethack_mode;
 #ifdef REVENGE
   int revenge_mode;
 #endif

+ 0 - 3
src/flags.h

@@ -63,7 +63,6 @@ struct flag_record {
 #define USER_ADMIN	FLAG[(int) 'a']
 #define USER_CHANHUB	FLAG[(int) 'c']
 #define USER_DEOP	FLAG[(int) 'd']
-#define USER_EXEMPT	FLAG[(int) 'e']
 #define USER_HUBA	FLAG[(int) 'i']
 #define USER_CHUBA	FLAG[(int) 'j']
 #define USER_KICK	FLAG[(int) 'k']
@@ -111,8 +110,6 @@ struct flag_record {
 #define glob_quiet(x)                  ((x).global & USER_QUIET)
 #define glob_party(x)                  ((x).global & USER_PARTY)
 #define glob_hilite(x)                         ((x).global & USER_HIGHLITE)
-#define chan_exempt(x)                 ((x).chan & USER_EXEMPT)
-#define glob_exempt(x)                 ((x).global & USER_EXEMPT)
 #define glob_admin(x)                  ((x).global & USER_ADMIN)
 #define glob_huba(x)                   ((x).global & USER_HUBA)
 #define glob_chuba(x)                  ((x).global & USER_CHUBA)

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

@@ -33,7 +33,6 @@
 
 static bool 			use_info = 1;
 static char 			glob_chanmode[64] = "nt";		/* Default chanmode (drummer,990731) */
-static int 			global_stopnethack_mode;
 //static int 			global_revenge_mode = 3;
 static int 			global_idle_kick;		/* Default idle-kick setting. */
 static time_t 			global_ban_time;
@@ -876,9 +875,6 @@ void channels_report(int idx, int details)
 		  chan->idle_kick);
         if (chan->limitraise)
           dprintf(idx, "      Raising limit +%d every 2 minutes\n", chan->limitraise);
-	if (chan->stopnethack_mode)
-	  dprintf(idx, "      stopnethack-mode %d\n",
-		  chan->stopnethack_mode);
 /*
         if (chan->revenge_mode)
           dprintf(idx, "      revenge-mode %d\n",

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

@@ -1248,7 +1248,6 @@ static void cmd_chaninfo(int idx, char *par)
     deflag = chan->mop;
     SHOW_INT("Mop: ", chan->mop, P_STR, "Ignore");
 //    SHOW_INT("Revenge-mode: ", chan->revenge_mode, NULL, NULL);
-    SHOW_INT("Stopnethack-mode: ", chan->stopnethack_mode, "", "Don't!");
     SHOW_INT("Voice-non-ident: ", chan->voice_non_ident, "Do!", "Don't!");
 
     dprintf(idx, "Flood settings:   chan ctcp join kick deop nick\n");

+ 2 - 10
src/mod/channels.mod/tclchan.c

@@ -358,16 +358,8 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
       }
       chan->limitraise = atoi(item[i]);
       chan->limit_prot = 0;
-    } else if (!strcmp(item[i], "dont-idle-kick"))
+    } else if (!strcmp(item[i], "dont-idle-kick")) {
       chan->idle_kick = 0;
-    else if (!strcmp(item[i], "stopnethack-mode")) {
-      i++;
-      if (i >= items) {
-	if (result)
-	  simple_snprintf(result, RESULT_LEN, "channel stopnethack-mode needs argument");
-	return ERROR;
-      }
-      chan->stopnethack_mode = atoi(item[i]);
 /*
     } else if (!strcmp(item[i], "revenge-mode")) {
       i++;
@@ -582,6 +574,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
        this later */
     else if (!have_take && !strcmp(item[i], "+take")) ;
     else if (!have_take && !strcmp(item[i], "-take")) ;
+    else if (!strcmp(item[i], "stopnethack-mode")) ;
     else if (!strcmp(item[i], "revenge-mode")) ;
     else if (!strcmp(item[i], "+revenge")) ;
     else if (!strcmp(item[i], "-revenge")) ;
@@ -866,7 +859,6 @@ int channel_add(char *result, char *newname, char *options)
     chan->flood_kick_time = gfld_kick_time;
     chan->flood_nick_thr = gfld_nick_thr;
     chan->flood_nick_time = gfld_nick_time;
-    chan->stopnethack_mode = global_stopnethack_mode;
 //    chan->revenge_mode = global_revenge_mode;
     chan->idle_kick = global_idle_kick;
     chan->limitraise = 20;

+ 1 - 2
src/mod/channels.mod/userchan.c

@@ -710,7 +710,7 @@ bool write_chans(FILE *f, int idx)
     if (lfprintf(f, "\
 + channel add %s { chanmode { %s } addedby %s addedts %lu idle-kick %d \
 bad-cookie %d manop %d mdop %d mop %d \
-limit %d stopnethack-mode %d flood-chan %d:%lu \
+limit %d flood-chan %d:%lu \
 flood-ctcp %d:%lu flood-join %d:%lu flood-kick %d:%lu flood-deop %d:%lu \
 flood-nick %d:%lu closed-ban %d closed-invite %d closed-private %d ban-time %lu \
 exempt-time %lu invite-time %lu voice-non-ident %d \
@@ -732,7 +732,6 @@ exempt-time %lu invite-time %lu voice-non-ident %d \
 	chan->mdop,
 	chan->mop,
         chan->limitraise,
-	chan->stopnethack_mode,
 	chan->flood_pub_thr, chan->flood_pub_time,
         chan->flood_ctcp_thr, chan->flood_ctcp_time,
         chan->flood_join_thr, chan->flood_join_time,

+ 0 - 4
src/mod/irc.mod/cmdsirc.c

@@ -1378,10 +1378,6 @@ static void cmd_channel(int idx, char *par)
         atrflag = 'W';
       else if (chan_wasoptest(user))
         atrflag = 'w';
-      else if (glob_exempt(user))
-        atrflag = 'E';
-      else if (chan_exempt(user))
-        atrflag = 'e';
       else
 	atrflag = ' ';
 

+ 37 - 33
src/mod/irc.mod/mode.c

@@ -572,15 +572,15 @@ got_op(struct chanset_t *chan, memberlist *m, memberlist *mv)
 
   /* server op */
   if (!m && me_op(chan) && !match_my_nick(mv->nick)) {
-    int snm = chan->stopnethack_mode;
-
-    if (chk_deop(victim, chan)) {
+    if (chk_deop(victim, chan) || (chan_bitch(chan) && !chk_op(victim, chan))) {
       mv->flags |= FAKEOP;
       add_mode(chan, '-', 'o', mv->nick);
+    } 
+#ifdef no
     } else if (snm > 0 && snm < 7 && !((channel_autoop(chan) ||
-             glob_autoop(victim) || chan_autoop(victim)) && (chan_op(victim) ||
-             (glob_op(victim) && !chan_deop(victim)))) &&
-             !glob_exempt(victim) && !chan_exempt(victim)) {
+         glob_autoop(victim) || chan_autoop(victim)) && (chan_op(victim) ||
+         (glob_op(victim) && !chan_deop(victim)))) &&
+         !glob_exempt(victim) && !chan_exempt(victim)) {
 
       if (snm == 5)
         snm = chan_bitch(chan) ? 1 : 3;
@@ -600,7 +600,7 @@ got_op(struct chanset_t *chan, memberlist *m, memberlist *mv)
         add_mode(chan, '-', 'o', mv->nick);
         mv->flags |= FAKEOP;
       }
-    }
+#endif
   }
   mv->flags |= WASOP;
   if (check_chan) {
@@ -1054,15 +1054,14 @@ gotmode(char *from, char *msg)
       if (me_opped && !me_op(chan) && channel_take(chan))
         do_take(chan);
 
-      if (!isserver) {
         /* Now we got modes[], chan, u, nick, and count of each relevant mode */
 
         /* check for mdop */
         if (me_op(chan)) {
           char tmp[1024] = "";
 
-          if (role && (!u || (u && !u->bot)) && m && !chan_sentkick(m)) {
-            if (deops >= 3 && chan->mdop) {
+          if (role && (!u || (u && !u->bot))) {
+            if (m && !chan_sentkick(m) && deops >= 3 && chan->mdop) {
               if (role < 5) {
                 m->flags |= SENTKICK;
                 simple_sprintf(tmp, "KICK %s %s :%s%s\r\n", chan->name, m->nick, kickprefix, response(RES_MASSDEOP));
@@ -1081,27 +1080,30 @@ gotmode(char *from, char *msg)
             /* check for mop */
             if (ops >= 3) {
               if (chan->mop) {
-                if (role < 5) {
-                  m->flags |= SENTKICK;
-                  simple_sprintf(tmp, "KICK %s %s :%s%s\r\n", chan->name, m->nick, kickprefix, response(RES_MANUALOP));
-                  if (role <= 2)
-                    tputs(serv, tmp, strlen(tmp));
-                  else
-                    dprintf(DP_SERVER, "%s", tmp);
-                } else { 
-                  if (u) {
-                    simple_sprintf(tmp, "Mass op on %s by %s", chan->dname, m->nick);
-                    deflag_user(u, DEFLAG_MOP, tmp, chan);
+                if (m && !chan_sentkick(m)) {
+                  if (role < 5) {
+                    m->flags |= SENTKICK;
+                    simple_snprintf(tmp, sizeof(tmp), "KICK %s %s :%s%s\r\n", chan->name, m->nick, kickprefix, response(RES_MANUALOP));
+                    if (role <= 2)
+                      tputs(serv, tmp, strlen(tmp));
+                    else
+                      dprintf(DP_SERVER, "%s", tmp);
+                  } else { 
+                    if (u) {
+                      simple_snprintf(tmp, sizeof(tmp), "Mass op on %s by %s", chan->dname, m->nick);
+                      deflag_user(u, DEFLAG_MOP, tmp, chan);
+                    }
                   }
                 }
                 enforce_bitch(chan);        /* deop quick! */
               }
             }
           }
-          if (ops && u) {
+          if (ops) {
             int n = 0;
 
-            if (u->bot && !channel_fastop(chan) && !channel_take(chan)) {
+            /* Check cookies */
+            if (u && m && u->bot && !channel_fastop(chan) && !channel_take(chan)) {
               int isbadop = 0;
 
               /* If no unbans or the -b is not the LAST mode, it's bad. */
@@ -1161,24 +1163,27 @@ gotmode(char *from, char *msg)
                 putlog(LOG_DEBUG, "@", "Good op: %s", modes[modecnt - 1]);
             }
 
-            if (chan->manop && !u->bot) {
+            /* manop */
+            if (chan->manop && (!u || (u && !u->bot))) {
               n = i = 0;
 
               switch (role) {
                 case 0:
                   break;
                 case 1:
-                  /* Kick opper */
-                  if (!m || !chan_sentkick(m)) {
-                    simple_sprintf(tmp, "KICK %s %s :%s%s\r\n", chan->name, m->nick, kickprefix, response(RES_MANUALOP));
-                    tputs(serv, tmp, strlen(tmp));
-                    if (m)
+                  if (m) {
+                    /* Kick opper */
+                    if (!chan_sentkick(m)) {
+                      simple_snprintf(tmp, sizeof(tmp), "KICK %s %s :%s%s\r\n", chan->name, m->nick, kickprefix, response(RES_MANUALOP));
+                      tputs(serv, tmp, strlen(tmp));
                       m->flags |= SENTKICK;
+                    }
+                    simple_snprintf(tmp, sizeof(tmp), "%s!%s MODE %s %s", m->nick, m->userhost, chan->dname, modes[modecnt - 1]);
+                    deflag_user(u, DEFLAG_MANUALOP, tmp, chan);
                   }
-                  simple_sprintf(tmp, "%s!%s MODE %s %s", m->nick, m->userhost, chan->dname, modes[modecnt - 1]);
-                  deflag_user(u, DEFLAG_MANUALOP, tmp, chan);
                   break;
                 default:
+                  /* KICK the opped */
                   n = role - 1;
                   i = 0;
                   while ((i < modecnt) && (n > 0)) {
@@ -1199,13 +1204,12 @@ gotmode(char *from, char *msg)
                         }
                       }
                     }
-                  }
               }
             }
           }
         }
       }
-      /* Now do the modes again, this time throughly... */
+      /* Now do the modes again, this time thoroughly... */
 
       if (m && channel_active(chan) && me_op(chan)) {
         if (chan_fakeop(m)) {