]> jfr.im git - solanum.git/commitdiff
[svn] Change handling of modularized umodes:
authorjilles <redacted>
Sun, 4 Feb 2007 15:08:04 +0000 (07:08 -0800)
committerjilles <redacted>
Sun, 4 Feb 2007 15:08:04 +0000 (07:08 -0800)
- keep the bitmask reserved forever to the letter, fixing
  the problems when loading multiple umode modules,
  unloading them and then loading them in a different order
- don't allow local users to change umodes which have
  been unloaded and don't set them on new users via
  default_umodes

ChangeLog
include/serno.h
src/s_user.c

index ba3cd941f649286d16830100b404d0823d1c0364..e49746ea6c1c2ea20389bfdf0bb9b06b6b79b08d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+jilles      2007/02/04 01:59:38 UTC    (20070204-3201)
+  Log:
+  Move find_umode_slot() from libcharybdis/tools.c to src/s_user.c.
+  
+
+  Changes:     Modified:
+  +1 -0                trunk/include/s_user.h (File Modified) 
+  +0 -22       trunk/libcharybdis/tools.c (File Modified) 
+  +0 -1                trunk/libcharybdis/tools.h (File Modified) 
+  +22 -0       trunk/src/s_user.c (File Modified) 
+
+
 jilles      2007/02/01 01:44:31 UTC    (20070201-3195)
   Log:
   DNSBL keyword substitution is available as of 2.1.3.
index 0b0a3e395dcd82e5ff23a836c5fd737d83bd167b..f52372adb3db9ddde018b1f07dd0fef05e316fa0 100644 (file)
@@ -1 +1 @@
-#define SERNO "20070201-3195"
+#define SERNO "20070204-3201"
index 1cc6d4c7c7252a5120caed2fa5b55e1862d51dc9..3dfd2706b787f3b1d9b781e5e276bbec04f1214c 100644 (file)
@@ -21,7 +21,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: s_user.c 3201 2007-02-04 01:59:38Z jilles $
+ *  $Id: s_user.c 3203 2007-02-04 15:08:04Z jilles $
  */
 
 #include "stdinc.h"
@@ -65,6 +65,7 @@ extern char *crypt();
 
 char umodebuf[128];
 
+static int orphaned_umodes = 0;
 int user_modes[256] = {
        /* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0F */
        /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x1F */
@@ -520,7 +521,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
                add_to_id_hash(source_p->id, source_p);
        }
 
-       source_p->umodes |= ConfigFileEntry.default_umodes & ~ConfigFileEntry.oper_only_umodes;
+       source_p->umodes |= ConfigFileEntry.default_umodes & ~ConfigFileEntry.oper_only_umodes & ~orphaned_umodes;
 
        if (source_p->umodes & UMODE_INVISIBLE)
                Count.invisi++;
@@ -1055,8 +1056,9 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
                        if((flag = user_modes[(unsigned char) *pm]))
                        {
                                if(MyConnect(source_p)
-                                  && !IsOper(source_p)
-                                  && (ConfigFileEntry.oper_only_umodes & flag))
+                                               && ((!IsOper(source_p)
+                                                       && (ConfigFileEntry.oper_only_umodes & flag))
+                                               || (orphaned_umodes & flag)))
                                {
                                        if (what == MODE_ADD || source_p->umodes & flag)
                                                badflag = YES;
@@ -1342,12 +1344,31 @@ construct_umodebuf(void)
 {
        int i;
        char *ptr = umodebuf;
+       static int prev_user_modes[128];
 
        *ptr = '\0';
 
        for (i = 0; i < 128; i++)
+       {
+               if (prev_user_modes[i] != 0 && prev_user_modes[i] != user_modes[i])
+               {
+                       if (user_modes[i] == 0)
+                       {
+                               orphaned_umodes |= prev_user_modes[i];
+                               sendto_realops_snomask(SNO_DEBUG, L_ALL, "Umode +%c is now orphaned", i);
+                       }
+                       else
+                       {
+                               orphaned_umodes &= ~prev_user_modes[i];
+                               sendto_realops_snomask(SNO_DEBUG, L_ALL, "Orphaned umode +%c is picked up by module", i);
+                       }
+                       user_modes[i] = prev_user_modes[i];
+               }
+               else
+                       prev_user_modes[i] = user_modes[i];
                if (user_modes[i])
                        *ptr++ = (char) i;
+       }
 
        *ptr++ = '\0';
 }