Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2007-08-21 01:13:26 UTC

Modified files:
  Tag: u2_10_12_branch
     ircd/s_user.c ChangeLog

Log message:

Do not include unregistered +i clients in /lusers's invisible count.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.203 ircu2.10/ChangeLog:1.710.2.204
--- ircu2.10/ChangeLog:1.710.2.203      Tue Aug 14 19:49:54 2007
+++ ircu2.10/ChangeLog  Mon Aug 20 18:13:15 2007
@@ -1,3 +1,11 @@
+2007-08-20  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/s_user.c (register_user): Update inv_clients and opers
+       counts.  Call client_set_privs() for local users.
+       (set_nick_name): Do not call client_set_privs() for remote users.
+       (set_user_mode): Move oper and invisible client checks inside the
+       IsRegistered() section.
+
 2007-08-14  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/channel.c (DONE_*): Split key changes into _ADD and _DEL.
Index: ircu2.10/ircd/s_user.c
diff -u ircu2.10/ircd/s_user.c:1.99.2.10 ircu2.10/ircd/s_user.c:1.99.2.11
--- ircu2.10/ircd/s_user.c:1.99.2.10    Mon Aug 13 20:56:46 2007
+++ ircu2.10/ircd/s_user.c      Mon Aug 20 18:13:15 2007
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Miscellaneous user-related helper functions.
- * @version $Id: s_user.c,v 1.99.2.10 2007/08/14 03:56:46 entrope Exp $
+ * @version $Id: s_user.c,v 1.99.2.11 2007/08/21 01:13:15 entrope Exp $
  */
 #include "config.h"
 
@@ -439,6 +439,10 @@
    */
   if (HasHiddenHost(sptr))
     hide_hostmask(sptr, FLAG_HIDDENHOST);
+  if (IsInvisible(sptr))
+    ++UserStats.inv_clients;
+  if (IsOper(sptr))
+    ++UserStats.opers;
 
   tmpstr = umode_str(sptr);
   /* Send full IP address to IPv6-grokking servers. */
@@ -473,6 +477,7 @@
       FlagSet(&flags, FLAG_ACCOUNT);
     else
       FlagClr(&flags, FLAG_ACCOUNT);
+    client_set_privs(sptr, NULL);
     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));
@@ -529,7 +534,6 @@
     cli_hopcount(new_client) = atoi(parv[2]);
     cli_lastnick(new_client) = atoi(parv[3]);
 
-    client_set_privs(new_client, NULL); /* set privs on user */
     /*
      * Set new nick name.
      */
@@ -1140,28 +1144,6 @@
    * Compare new flags with old flags and send string which
    * will cause servers to update correctly.
    */
-  if (!FlagHas(&setflags, FLAG_OPER) && IsOper(sptr))
-  {
-    /* user now oper */
-    ++UserStats.opers;
-    client_set_privs(sptr, NULL); /* may set propagate privilege */
-  }
-  /* remember propagate privilege setting */
-  if (HasPriv(sptr, PRIV_PROPAGATE))
-    prop = 1;
-  if (FlagHas(&setflags, FLAG_OPER) && !IsOper(sptr))
-  {
-    /* user no longer oper */
-    assert(UserStats.opers > 0);
-    --UserStats.opers;
-    client_set_privs(sptr, NULL); /* will clear propagate privilege */
-  }
-  if (FlagHas(&setflags, FLAG_INVISIBLE) && !IsInvisible(sptr)) {
-    assert(UserStats.inv_clients > 0);
-    --UserStats.inv_clients;
-  }
-  if (!FlagHas(&setflags, FLAG_INVISIBLE) && IsInvisible(sptr))
-    ++UserStats.inv_clients;
   if (!FlagHas(&setflags, FLAG_ACCOUNT) && IsAccount(sptr)) {
       int len = ACCOUNTLEN;
       char *ts;
@@ -1176,11 +1158,35 @@
   }
   if (!FlagHas(&setflags, FLAG_HIDDENHOST) && do_host_hiding && allow_modes != 
ALLOWMODES_DEFAULT)
     hide_hostmask(sptr, FLAG_HIDDENHOST);
-  if (IsRegistered(sptr))
+
+  if (IsRegistered(sptr)) {
+    if (!FlagHas(&setflags, FLAG_OPER) && IsOper(sptr)) {
+      /* user now oper */
+      ++UserStats.opers;
+      client_set_privs(sptr, NULL); /* may set propagate privilege */
+    }
+    /* remember propagate privilege setting */
+    if (HasPriv(sptr, PRIV_PROPAGATE)) {
+      prop = 1;
+    }
+    if (FlagHas(&setflags, FLAG_OPER) && !IsOper(sptr)) {
+      /* user no longer oper */
+      assert(UserStats.opers > 0);
+      --UserStats.opers;
+      client_set_privs(sptr, NULL); /* will clear propagate privilege */
+    }
+    if (FlagHas(&setflags, FLAG_INVISIBLE) && !IsInvisible(sptr)) {
+      assert(UserStats.inv_clients > 0);
+      --UserStats.inv_clients;
+    }
+    if (!FlagHas(&setflags, FLAG_INVISIBLE) && IsInvisible(sptr)) {
+      ++UserStats.inv_clients;
+    }
+    assert(UserStats.opers <= UserStats.clients + UserStats.unknowns);
+    assert(UserStats.inv_clients <= UserStats.clients + UserStats.unknowns);
     send_umode_out(cptr, sptr, &setflags, prop);
+  }
 
-  assert(UserStats.opers <= UserStats.clients + UserStats.unknowns);
-  assert(UserStats.inv_clients <= UserStats.clients + UserStats.unknowns);
   return 0;
 }
 
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to