Author: beware (by Spike)
authorJochen Meesters <spike@undernet.org>
Tue, 12 Aug 2003 09:41:17 +0000 (09:41 +0000)
committerJochen Meesters <spike@undernet.org>
Tue, 12 Aug 2003 09:41:17 +0000 (09:41 +0000)
Log message: A bunch of patches done by beware, check ChangeLog for more info.

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@966 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

13 files changed:
ChangeLog
include/channel.h
include/client.h
ircd/channel.c
ircd/m_burst.c
ircd/m_names.c
ircd/m_userhost.c
ircd/m_userip.c
ircd/m_who.c
ircd/m_whois.c
ircd/s_err.c
ircd/s_user.c
ircd/whocmds.c

index 567301d0fd35024f9897d64d3b4cb2e85f0a6ce3..a2d82f9f0db035b36a1ce6036dca1f08daeecdf7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2003-07-07  Bas Steendijk <steendijk@xs4all.nl>
+
+        * ircd/s_user.c: invalidate ban cache for user on host hiding/account
+
+2003-07-04  Bas Steendijk <steendijk@xs4all.nl>
+
+        * include/client.h, ircd/m_userhost.c, ircd/m_userip.c, ircd/m_who.c,
+        ircd/m_whois.c, ircd/whocmds.c: the same code, for "can user A see user
+        B is an oper", appeared in a lot of places. made it a define SeeOper.
+
+2003-07-04  Bas Steendijk  <steendijk@xs4all.nl>
+        * ircd/s_user.c: umode_str (user modes in N token) internal flags var
+       was not initialized to the user's flags, returned a string with
+       random modes set.
+
+2003-07-01  Bas Steendijk  <steendijk@xs4all.nl>
+
+        * ircd/m_names.c: length counter being incremented one too many
+        for each nick, resulting names reply messages are about 50 chars
+        shorter than possible. fixed.
+
+2003-06-29  Bas Steendijk  <steendijk@xs4all.nl>
+
+        * ircd/channel.c: don't ever send mode changes for local channels to
+       servers.
+
+2003-06-27  Bas Steendijk  <steendijk@xs4all.nl>
+
+        * include/channel.h, include/client.h, ircd/s_user.c, ircd/s_err.c:
+        moved the supported channel/user mode strings of the 004 reply from
+        s_err.c to the header files where the channels/user modes are
+        defined, and show or hide +Au based on OPLEVELS setting.
+
+2003-06-25  Bas Steendijk  <steendijk@xs4all.nl>
+
+        * ircd/m_burst.c: Clear topic set by netrider on burst.
+
 2003-08-05 Diane Bruce  <db@db.net>
 
         * ircd/parse.c: Fixed the typo the fix of the typo created
index a3ae4e8a233e330912ca573fc9757d2199635bf3..aafcb3c560aac82815cefd2086ba769a8d8d78fb 100644 (file)
@@ -100,6 +100,9 @@ struct Client;
  */
 #define MODE_WPARAS     (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_APASS|MODE_UPASS)
 
+#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "Abiklmnopstuvr" : "biklmnopstvr"
+#define infochanmodeswithparams feature_bool(FEAT_OPLEVELS) ? "Abklouv" : "bklov"
+
 #define HoldChannel(x)          (!(x))
 /* name invisible */
 #define SecretChannel(x)        ((x) && ((x)->mode.mode & MODE_SECRET))
index ec918b007d08d24acc9fd831909b33d8368722f9..18e03a2f8cedf5f6c4b33b1cfbc4c6d3e67a280a 100644 (file)
@@ -81,6 +81,8 @@ typedef unsigned long flagpage_t;
 #define FLAGSET_SET(set, flag) (set).bits[FLAGSET_INDEX(flag)] |= FLAGSET_MASK(flag)
 #define FLAGSET_CLEAR(set, flag) (set).bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag)
 
+#define infousermodes "dioswkgx"
+
 enum Priv
   {
     PRIV_CHAN_LIMIT, /* no channel limit on oper */
@@ -453,6 +455,9 @@ struct Client {
 #define SetHiddenHost(x)        SetFlag(x, FLAG_HIDDENHOST)
 #define SetPingSent(x)          SetFlag(x, FLAG_PINGSENT)
 
+#define SeeOper(sptr,acptr) (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) \
+                            || HasPriv(sptr, PRIV_SEE_OPERS)))
+
 #define ClearAccess(x)          ClrFlag(x, FLAG_CHKACCESS)
 #define ClearBurst(x)           ClrFlag(x, FLAG_BURST)
 #define ClearBurstAck(x)        ClrFlag(x, FLAG_BURST_ACK)
index fbbf5358b614c3ddd826c936d02b840866e166da..b477c6c08ed6bc4c14a07725453edc2541cd2944 100644 (file)
@@ -1856,6 +1856,8 @@ modebuf_init(struct ModeBuf *mbuf, struct Client *source,
   assert(0 != chan);
   assert(0 != dest);
 
+  if (IsLocalChannel(chan->chname)) dest &= ~MODEBUF_DEST_SERVER;
+
   mbuf->mb_add = 0;
   mbuf->mb_rem = 0;
   mbuf->mb_source = source;
index 7726e7dc371f525d359253fc8bb22f97aaf1e700..289c93efb390414a3b05bb033bb8c9648ec470ca 100644 (file)
@@ -245,6 +245,15 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     /* mark bans for wipeout */
     for (lp = chptr->banlist; lp; lp = lp->next)
       lp->flags |= CHFL_BURST_BAN_WIPEOUT;
+
+    /* clear topic set by netrider (if set) */
+    if (*chptr->topic) {
+      *chptr->topic = '\0';
+      *chptr->topic_nick = '\0';
+      chptr->topic_time = 0;
+      sendcmdto_channel_butserv_butone(&me, CMD_TOPIC, chptr, NULL,
+                                       "%H :%s", chptr, chptr->topic);
+    }
   } else if (chptr->creationtime == timestamp) {
     modebuf_init(mbuf = &modebuf, &me, cptr, chptr,
                 MODEBUF_DEST_CHANNEL | MODEBUF_DEST_NOKEY);
index b15f10559cea2f0f2c3f1482b9be7a33ade649eb..02e80d2282789716c0268f46a7d0ff7d419b5687 100644 (file)
@@ -176,7 +176,7 @@ void do_names(struct Client* sptr, struct Channel* chptr, int filter)
       idx++;
     }
     strcat(buf, cli_name(c2ptr));
-    idx += strlen(cli_name(c2ptr)) + 1;
+    idx += strlen(cli_name(c2ptr));
     flag = 1;
     if (mlen + idx + NICKLEN + 5 > BUFSIZE)
       /* space, modifier, nick, \r \n \0 */
index 07f9ca649efc76284e4955c4dbb37d58dd5e8f9c..04055d3df5594d4542846e201765b8616e8b47d2 100644 (file)
@@ -95,7 +95,7 @@ static void userhost_formatter(struct Client* cptr, struct Client *sptr, struct
 {
   assert(IsUser(cptr));
   msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr),
-             HasPriv(cptr, PRIV_DISPLAY) ? "*" : "",
+              SeeOper(sptr,cptr) ? "*" : "",
              cli_user(cptr)->away ? '-' : '+', cli_user(cptr)->username,
              HasHiddenHost(cptr) && !IsAnOper(sptr) ?
              cli_user(cptr)->host : cli_user(cptr)->realhost);
index 27be218c77b9cd9dfc4686ed306fea504260a391..52a9db7c7fb63ff303162f243c36fafc600dfc45 100644 (file)
@@ -96,7 +96,7 @@ static void userip_formatter(struct Client* cptr, struct Client *sptr, struct Ms
 {
   assert(IsUser(cptr));
   msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr),
-             HasPriv(cptr, PRIV_DISPLAY) ? "*" : "",
+             SeeOper(sptr,cptr) ? "*" : "",
              cli_user(cptr)->away ? '-' : '+', cli_user(cptr)->username,
              HasHiddenHost(cptr) && !IsAnOper(sptr) ?
              feature_str(FEAT_HIDDEN_IP) :
index a9e68e2c3cd43a24a81f28314d23343d11b4d63a..473509e861117cccef746770d77352da7f010912 100644 (file)
@@ -321,9 +321,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
           for (member = chptr->members; member; member = member->next_member)
           {
             acptr = member->user;
-            if ((bitsel & WHOSELECT_OPER) &&
-               !(IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) ||
-                                     HasPriv(sptr, PRIV_SEE_OPERS))))
+            if ((bitsel & WHOSELECT_OPER) && !SeeOper(sptr,acptr))
               continue;
             if ((acptr != sptr) && (member->status & CHFL_ZOMBIE))
               continue;
@@ -340,9 +338,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       else
       {
         if ((acptr = FindUser(nick)) &&
-            ((!(bitsel & WHOSELECT_OPER)) ||
-            (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) ||
-                                 HasPriv(sptr, PRIV_SEE_OPERS)))) &&
+            ((!(bitsel & WHOSELECT_OPER)) || SeeOper(sptr,acptr)) &&
             Process(acptr) && SHOW_MORE(sptr, counter))
         {
           do_who(sptr, acptr, 0, fields, qrt);
@@ -386,9 +382,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
           if (!(IsUser(acptr) && Process(acptr)))
             continue;           /* Now Process() is at the beginning, if we fail
                                    we'll never have to show this acptr in this query */
-         if ((bitsel & WHOSELECT_OPER) &&
-             !(IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) ||
-                                   HasPriv(sptr, PRIV_SEE_OPERS))))
+         if ((bitsel & WHOSELECT_OPER) && !SeeOper(sptr,acptr))
            continue;
           if ((mask) &&
               ((!(matchsel & WHO_FIELD_NIC))
@@ -424,9 +418,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       {
         if (!(IsUser(acptr) && Process(acptr)))
           continue;
-       if ((bitsel & WHOSELECT_OPER) &&
-           !(IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) ||
-                                 HasPriv(sptr, PRIV_SEE_OPERS))))
+       if ((bitsel & WHOSELECT_OPER) && !SeeOper(sptr,acptr))
          continue;
         if (!(SEE_USER(sptr, acptr, bitsel)))
           continue;
index b817e3a26a6c79b48aedb2747ce64a35c37ede22..319ea1dc0f7f79d3980c0521a1a0b57bdb455e36 100644 (file)
@@ -196,8 +196,7 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc)
     if (user->away)
        send_reply(sptr, RPL_AWAY, name, user->away);
 
-    if (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) ||
-                           HasPriv(sptr, PRIV_SEE_OPERS)))
+    if (SeeOper(sptr,acptr))
        send_reply(sptr, RPL_WHOISOPERATOR, name);
 
     if (IsAccount(acptr))
index 66a2cd70df8088e0d5b7d15e8a84aa0c9ff7f463..20f5bf11b8306ddc8a9dc639225720b30c1db007 100644 (file)
@@ -36,7 +36,7 @@ static Numeric replyTable[] = {
 /* 003 */
   { RPL_CREATED, ":This server was created %s", "003" },
 /* 004 */
-  { RPL_MYINFO, "%s %s dioswkgx Abiklmnopstuvr Abklouv", "004" },
+  { RPL_MYINFO, "%s %s %s %s %s", "004" },
 /* 005 */
   { RPL_ISUPPORT, "%s :are supported by this server", "005" },
 /* 006 */
index ce5ea555e1a5c71b1f8887e9e601db3427d7d0f8..f922eb976af21051bc0cfa8fab5f1cb8a5cabd4c 100644 (file)
@@ -551,7 +551,8 @@ int register_user(struct Client *cptr, struct Client *sptr,
      */
     send_reply(sptr, RPL_YOURHOST, cli_name(&me), version);
     send_reply(sptr, RPL_CREATED, creation);
-    send_reply(sptr, RPL_MYINFO, cli_name(&me), version);
+    send_reply(sptr, RPL_MYINFO, cli_name(&me), infousermodes, infochanmodes,
+               infochanmodeswithparams, version);
     send_supported(sptr);
     m_lusers(sptr, sptr, 1, parv);
     update_load();
@@ -1057,6 +1058,11 @@ hide_hostmask(struct Client *cptr, unsigned int flag)
       flag == FLAG_HIDDENHOST)
     return 0;
 
+/* Invalidate all bans against the user so we check them again */
+      for (chan = (cli_user(cptr))->channel; chan;
+           chan = chan->next_channel)
+        ClearBanValid(chan);
+
   SetFlag(cptr, flag);
   if (!HasFlag(cptr, FLAG_HIDDENHOST) || !HasFlag(cptr, FLAG_ACCOUNT))
     return 0;
@@ -1339,7 +1345,7 @@ char *umode_str(struct Client *cptr)
   /* Maximum string size: "owidgrx\0" */
   char *m = umodeBuf;
   int i;
-  struct Flags c_flags;
+  struct Flags c_flags = cli_flags(cptr);
 
   if (HasPriv(cptr, PRIV_PROPAGATE))
     FlagSet(&c_flags, FLAG_OPER);
index 87f762672df239efbd3a26698647dac2631b4ece..8a2f963e036f18065ce30a98bcc10b80802166cb 100644 (file)
@@ -159,8 +159,7 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
       *(p1++) = 'G';
     else
       *(p1++) = 'H';
-    if (IsAnOper(acptr) &&
-       (HasPriv(acptr, PRIV_DISPLAY) || HasPriv(sptr, PRIV_SEE_OPERS)))
+    if SeeOper(sptr,acptr)
       *(p1++) = '*';
     if (fields) {
       /* If you specified flags then we assume you know how to parse