Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-05-05 02:15:04 UTC

Modified files:
     ChangeLog ircd/channel.c ircd/m_join.c

Log message:

Give users who join a +AU channel using the user pass level 1 ops.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.622 ircu2.10/ChangeLog:1.623
--- ircu2.10/ChangeLog:1.622    Wed May  4 18:36:14 2005
+++ ircu2.10/ChangeLog  Wed May  4 19:14:41 2005
@@ -1,5 +1,17 @@
 2005-05-04  Michael Poole <[EMAIL PROTECTED]>
 
+       * ircd/channel.c (joinbuf_join): Include channel manager flag in
+       determination of oplevel.  If opping the user for a non-local
+       non-create, include oplevel in message to other servers.  Send
+       "MODE +o <client>" to local users whenever opping the client.
+
+       * ircd/m_join.c (m_join): Remove logic that moved into
+       joinbuf_join().
+       (ms_join): Look for level 0 and 1 joins from remote servers
+       and adjust value of 'flags' appropriately.
+
+2005-05-04  Michael Poole <[EMAIL PROTECTED]>
+
        * include/numeric.h: Remap oplevel numerics to new range.
 
        * ircd/s_err.c: Likewise.
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.128 ircu2.10/ircd/channel.c:1.129
--- ircu2.10/ircd/channel.c:1.128       Mon May  2 20:47:42 2005
+++ ircu2.10/ircd/channel.c     Wed May  4 19:14:53 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.128 2005/05/03 03:47:42 entrope Exp $
+ * @version $Id: channel.c,v 1.129 2005/05/05 02:14:53 entrope Exp $
  */
 #include "config.h"
 
@@ -3388,7 +3388,9 @@
        is_local) /* got to remove user here */
       remove_user_from_channel(jbuf->jb_source, chan);
   } else {
-    int oplevel = chan->mode.apass[0] ? 0 : MAXOPLEVEL;
+    int oplevel = !chan->mode.apass[0] ? MAXOPLEVEL
+        : (flags & CHFL_CHANNEL_MANAGER) ? 0
+        : 1;
     /* Add user to channel */
     if ((chan->mode.mode & MODE_DELJOINS) && !(flags & CHFL_VOICED_OR_OPPED))
       add_user_to_channel(chan, jbuf->jb_source, flags | CHFL_DELAYED, 
oplevel);
@@ -3397,16 +3399,22 @@
 
     /* send notification to all servers */
     if (jbuf->jb_type != JOINBUF_TYPE_CREATE && !is_local)
-      sendcmdto_serv_butone(jbuf->jb_source, CMD_JOIN, jbuf->jb_connect,
-                           "%H %Tu", chan, chan->creationtime);
+    {
+      if (flags & CHFL_CHANOP)
+        sendcmdto_serv_butone(jbuf->jb_source, CMD_JOIN, jbuf->jb_connect,
+                              "%u:%H %Tu", oplevel, chan, chan->creationtime);
+      else
+        sendcmdto_serv_butone(jbuf->jb_source, CMD_JOIN, jbuf->jb_connect,
+                              "%H %Tu", chan, chan->creationtime);
+    }
 
     if (!((chan->mode.mode & MODE_DELJOINS) && !(flags & 
CHFL_VOICED_OR_OPPED))) {
       /* Send the notification to the channel */
       sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_JOIN, chan, NULL, 
0, "%H", chan);
 
       /* send an op, too, if needed */
-      if (!MyUser(jbuf->jb_source) && jbuf->jb_type == JOINBUF_TYPE_CREATE)
-       sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_MODE, chan, NULL, 
0, "%H +o %C",
+      if (flags & CHFL_CHANOP)
+       sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan, NULL, 0, "%H +o 
%C",
                                         chan, jbuf->jb_source);
     } else if (MyUser(jbuf->jb_source))
       sendcmdto_one(jbuf->jb_source, CMD_JOIN, jbuf->jb_source, ":%H", chan);
Index: ircu2.10/ircd/m_join.c
diff -u ircu2.10/ircd/m_join.c:1.25 ircu2.10/ircd/m_join.c:1.26
--- ircu2.10/ircd/m_join.c:1.25 Fri Dec 10 21:13:47 2004
+++ ircu2.10/ircd/m_join.c      Wed May  4 19:14:54 2005
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_join.c,v 1.25 2004/12/11 05:13:47 klmitch Exp $
+ * $Id: m_join.c,v 1.26 2005/05/05 02:14:54 entrope Exp $
  */
 
 /*
@@ -170,7 +170,6 @@
   struct Channel *chptr;
   struct JoinBuf join;
   struct JoinBuf create;
-  struct ModeBuf mbuf;
   struct Gline *gline;
   unsigned int flags = 0;
   int i, j, k = 0;
@@ -247,8 +246,7 @@
     if (chptr) {
       int is_level0_op = 0;
       if (!BadPtr(keys) && *chptr->mode.apass) {
-       /* Don't use compall for the apass, only a single key is allowed.
-          Test Apass first in case someone set Apass and upass equal. */
+        /* Don't use compall for the apass, only a single key is allowed. */
        if (strcmp(chptr->mode.apass, keys) == 0) {
          is_level0_op = 1;
          flags &= ~CHFL_DEOPPED;
@@ -304,16 +302,6 @@
       } /* else if ((i = can_join(sptr, chptr, keys))) */
 
       joinbuf_join(&join, chptr, flags);
-      if (is_level0_op)
-      {
-       joinbuf_flush(&join);
-       modebuf_init(&mbuf, &me, cptr, chptr,
-           MODEBUF_DEST_CHANNEL |              /* Send mode to channel */
-           MODEBUF_DEST_SERVER);               /* And send it to the other 
servers */
-       modebuf_mode_client(&mbuf,
-           MODE_ADD | MODE_CHANOP, sptr);      /* Give ops to the level0 op */
-       modebuf_flush(&mbuf);
-      }
     } else if (!(chptr = get_channel(sptr, name, CGT_CREATE)))
       continue; /* couldn't get channel */
     else if (check_target_limit(sptr, chptr, chptr->chname, 1))
@@ -351,7 +339,7 @@
   struct Membership *member;
   struct Channel *chptr;
   struct JoinBuf join;
-  unsigned int flags = 0;
+  unsigned int flags;
   time_t creation = 0;
   char *p = 0;
   char *chanlist;
@@ -384,6 +372,19 @@
     if (join0(&join, cptr, sptr, name)) /* did client do a JOIN 0? */
       continue;
 
+    if (name[0] == '0' && name[1] == ':')
+    {
+      flags = CHFL_CHANOP | CHFL_CHANNEL_MANAGER;
+      name += 2;
+    }
+    else if (name[0] == '1' && name[1] == ':')
+    {
+      flags = CHFL_CHANOP;
+      name += 2;
+    }
+    else
+      flags = CHFL_DEOPPED;
+
     if (IsLocalChannel(name) || !IsChannelName(name))
     {
       protocol_violation(cptr, "%s tried to join %s", cli_name(sptr), name);
@@ -399,9 +400,9 @@
                           name,cli_name(sptr));
        continue;
       }
-      flags = CHFL_DEOPPED | (HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0);
+      flags |= HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0;
 
-      /* when the network is 2.10.11+ then remove MAGIC_REMOTE_JOIN_TS */ 
+      /* when the network is 2.10.11+ then remove MAGIC_REMOTE_JOIN_TS */
       chptr->creationtime = creation ? creation : MAGIC_REMOTE_JOIN_TS;
     }
     else { /* We have a valid channel? */
@@ -416,12 +417,12 @@
        chptr = FindChannel(name);
       }
       else
-        flags = CHFL_DEOPPED | (HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0);
+        flags |= HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0;
       /* Always copy the timestamp when it is older, that is the only way to
          ensure network-wide synchronization of creation times. */
       if (creation && creation < chptr->creationtime)
        chptr->creationtime = creation;
-    } 
+    }
 
     joinbuf_join(&join, chptr, flags);
   }
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to