Merge branch 'master' into KeepConn
[ircu2.10.12-pk.git] / ircd / s_user.c
index 53cebf2602df7e646dd136b4238b39635972a014..2c9a9bce35be8aeaa46866eab9ef0925ba10f38e 100644 (file)
@@ -589,7 +589,8 @@ static const struct UserMode {
   { FLAG_WEBIRC,      'W' },
   { FLAG_SEE_IDLETIME,'t' },
   { FLAG_SECURITY_SERV,'D' },
-  { FLAG_HIDDENHOST,  'x' }
+  { FLAG_HIDDENHOST,  'x' },
+  { FLAG_NOTCONN,     'Z' }
 };
 
 /** Length of #userModeList. */
@@ -1069,6 +1070,25 @@ hide_hostmask(struct Client *cptr, unsigned int flag)
     else {
         SetDelayedJoin(chan);
     }
+    
+    /*
+    * Check if the client is actually overriding a ban with the
+    * mask change, if so, kick him out of the channel.
+    * We have to proceed that way to ensure data consistency (join + kick)
+    */
+    if (find_ban(cptr, chan->channel->banlist)) {
+      /* Silentely kick in case of delayed join */
+      if (chan->channel->mode.mode & MODE_DELJOINS) {
+        sendcmdto_one(&his, CMD_KICK, cptr, "%H %C :Ban override", chan->channel, cptr);
+        CheckDelayedJoins(chan->channel);
+        
+      } else {
+        /* Otherwise publicly kick */
+        sendcmdto_serv_butone(&me, CMD_KICK, NULL, "%H %C :Ban override", chan->channel, cptr);
+        sendcmdto_channel_butserv_butone(&his, CMD_KICK, chan->channel, NULL, 0, "%H %C :Ban override", chan->channel, cptr);
+        make_zombie(chan, cptr, &me, &me, chan->channel);
+      }
+    }
   }
   return 0;
 }
@@ -1299,6 +1319,12 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc,
       case 'z': /* Formerly SSL mode; we ignore it. */
         break;
 #endif
+      case 'Z':
+        if (what == MODE_ADD)
+          SetNotConn(sptr);
+        else
+          ClearNotConn(sptr);
+        break;
       default:
         send_reply(sptr, ERR_UMODEUNKNOWNFLAG, *m);
         break;
@@ -1321,6 +1347,8 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc,
       ClrFlag(sptr, FLAG_FAKEHOST);
     if (!FlagHas(&setflags, FLAG_SEE_IDLETIME) && IsSeeIdletime(sptr))
       ClrFlag(sptr, FLAG_SEE_IDLETIME);
+    if (!FlagHas(&setflags, FLAG_NOTCONN) && IsNotConn(sptr))
+      ClrFlag(sptr, FLAG_NOTCONN);
     /*
      * new umode; servers and privileged opers can set it, local users cannot;
      * prevents users from /kick'ing or /mode -o'ing