Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-04-26 03:49:43 UTC

Modified files:
     ChangeLog ircd/s_user.c

Log message:

Ignore invalid or nonsensical bits in default usermodes.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.614 ircu2.10/ChangeLog:1.615
--- ircu2.10/ChangeLog:1.614    Sun Apr 24 20:35:46 2005
+++ ircu2.10/ChangeLog  Mon Apr 25 20:49:32 2005
@@ -1,3 +1,9 @@
+2005-04-25  Michael Poole <[EMAIL PROTECTED]>
+
+       * 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 <[EMAIL PROTECTED]>
 
        * doc/example.conf: Document new autoconnect field of Connect.
Index: ircu2.10/ircd/s_user.c
diff -u ircu2.10/ircd/s_user.c:1.92 ircu2.10/ircd/s_user.c:1.93
--- ircu2.10/ircd/s_user.c:1.92 Sun Apr 24 20:35:54 2005
+++ ircu2.10/ircd/s_user.c      Mon Apr 25 20:49:33 2005
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Miscellaneous user-related helper functions.
- * @version $Id: s_user.c,v 1.92 2005/04/25 03:35:54 entrope Exp $
+ * @version $Id: s_user.c,v 1.93 2005/04/26 03:49:33 entrope Exp $
  */
 #include "config.h"
 
@@ -611,12 +611,30 @@
     /*
      * 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 @@
                              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;
 }
 
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to