Ignore invalid or nonsensical bits in default usermodes.
authorMichael Poole <mdpoole@troilus.org>
Tue, 26 Apr 2005 03:49:33 +0000 (03:49 +0000)
committerMichael Poole <mdpoole@troilus.org>
Tue, 26 Apr 2005 03:49:33 +0000 (03:49 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1387 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/s_user.c

index 189441fb7f7358474c21a373eca898af8493c954..edc8d4916a624c16c35cc40162f1e7be845a6f13 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-25  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/s_user.c (register_user): Replace call with set_user_mode()
+       with a direct parsing of user modes.  To match this, revert the
+       initial display of usermode to how it was done before.
+
 2005-04-24  Michael Poole <mdpoole@troilus.org>
 
        * doc/example.conf: Document new autoconnect field of Connect.
index f69acdf2b0e35741589035f2cdc140e1d55c00fd..67cfe3dfda4c5bad5ae64439ee3841d213e7f8a4 100644 (file)
@@ -611,12 +611,30 @@ int register_user(struct Client *cptr, struct Client *sptr,
     /*
      * Set user's initial modes
      */
-    parv[0] = (char*)nick;
-    parv[1] = (char*)nick;
-    parv[2] = (char*)client_get_default_umode(sptr);
-    parv[3] = NULL; /* needed in case of +s */
-    set_user_mode(sptr, sptr, 3, parv);
-    ClearHiddenHost(sptr); /* just in case somebody stuck +x in there */
+    for (tmpstr = (char*)client_get_default_umode(sptr); *tmpstr; ++tmpstr) {
+      switch (*tmpstr) {
+      case 's':
+        if (!feature_bool(FEAT_HIS_SNOTICES_OPER_ONLY)) {
+          SetServNotice(sptr);
+          set_snomask(sptr, SNO_DEFAULT, SNO_SET);
+        }
+        break;
+      case 'w':
+        if (!feature_bool(FEAT_WALLOPS_OPER_ONLY))
+          SetWallops(sptr);
+        break;
+      case 'i':
+        SetInvisible(sptr);
+        break;
+      case 'd':
+        SetDeaf(sptr);
+        break;
+      case 'g':
+        if (!feature_bool(FEAT_HIS_DEBUG_OPER_ONLY))
+          SetDebug(sptr);
+        break;
+      }
+    }
   }
   else
     /* if (IsServer(cptr)) */
@@ -676,10 +694,14 @@ int register_user(struct Client *cptr, struct Client *sptr,
                              iptobase64(ip_base64, &cli_ip(sptr), sizeof(ip_base64), 0),
                              NumNick(sptr), cli_info(sptr));
 
-  /* Send server notice mask to client */
-  if (MyUser(sptr) && (cli_snomask(sptr) != SNO_DEFAULT) && HasFlag(sptr, FLAG_SERVNOTICE))
-    send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
-
+  /* Send user mode to client */
+  if (MyUser(sptr))
+  {
+    static struct Flags flags; /* automatically initialized to zeros */
+    send_umode(cptr, sptr, &flags, ALL_UMODES);
+    if ((cli_snomask(sptr) != SNO_DEFAULT) && HasFlag(sptr, FLAG_SERVNOTICE))
+      send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
+  }
   return 0;
 }