Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Fri, 31 Mar 2000 19:42:03 +0000 (19:42 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Fri, 31 Mar 2000 19:42:03 +0000 (19:42 +0000)
Log message:

Added logging of OPMODEs and CLEARMODEs; it's time to ask for testers...

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@112 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
config/config-sh.in
doc/Configure.help
include/channel.h
ircd/Makefile.in
ircd/channel.c
ircd/m_clearmode.c
ircd/m_opmode.c

index ae1022999c1dd9401d10e01433988768ad1cb3e2..e9688c6bba405357547204bc364fa1df0768bbf2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2000-03-31  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/m_clearmode.c (do_clearmode): Log the CLEARMODE to OPATH
+
+       * ircd/m_opmode.c: Log the mode changes to OPATH
+
+       * ircd/channel.c (modebuf_flush_int): Log the mode changes to
+       OPATH
+
+       * include/channel.h (MODEBUF_DEST_LOG): Log the mode changes to
+       OPATH
+
+       * doc/Configure.help: help text for CONFIG_LOG_OPMODE / OPATH
+
+       * config/config-sh.in: added OPATH for opmode log file
+
        * ircd/m_clearmode.c (do_clearmode): updated uses of
        modebuf_mode_string() for the new usage
 
 #
 # ChangeLog for ircu2.10.11
 #
-# $Id: ChangeLog,v 1.48 2000-03-31 18:19:09 kev Exp $
+# $Id: ChangeLog,v 1.49 2000-03-31 19:42:03 kev Exp $
 #
 # Insert new changes at beginning of the change list.
 #
index afad93eadc739ea9299b1431db553905bfe37924..52d40bdd0022986f71283bec35fa416f8dbfd72c 100644 (file)
@@ -235,6 +235,10 @@ comment 'Bad Channel G-Lines allow operators to add channel masks to a list whic
     if [ "$CONFIG_LOG_JUPES" = "y" ]; then
       string '   Give the path and(or) filename of this log file' JPATH 'jupe.log'
     fi
+  bool 'Do you want to log OPMODEs and CLEARMODEs to a separate file' CONFIG_LOG_OPMODES y
+    if [ "$CONFIG_LOG_OPMODES" = "y" ]; then
+      string '   Give the path and(or) filename of this log file' OPATH 'opmode.log'
+    fi
   bool 'Do you want to log connecting users to a separate file' CONFIG_LOG_USERS
     if [ "$CONFIG_LOG_USERS" = "y" ]; then
       string '   Give the path and(or) filename of this log file' FNAME_USERLOG $DPATH/users
@@ -385,6 +389,6 @@ comment 'Mandatory defines (you should leave these untouched)'
 endmenu
 
 mainmenu_option next_comment
-comment 'Experimental options (Do you know what you'\''re doing?'
+comment 'Experimental options (Do you know what you'\''re doing?)'
   bool 'Use new MODE implementation' CONFIG_NEW_MODE
 endmenu
index c96533f3c0cf18a9df16b2d58776df5cfcd535c7..b9e675a1799bbacb9796e39d92bab6e771ee184c 100644 (file)
@@ -540,6 +540,18 @@ JPATH
   log file where the logs of JUPEs will be stored; it is usually called
   "jupe.log".  Note that you should not include quotes here.
 
+Do you want to log OPMODEs and CLEARMODEs to a separate file
+CONFIG_LOG_OPMODES
+  Specify 'y' here if you want to log OPMODEs and CLEARMODEs to a local
+  file.
+
+Give the path and(or) filename of this log file
+OPATH
+  OPATH is the filename, relative to DPATH, or the full path, of the
+  log file where the logs of OPMODEs and CLEARMODEs will be stored; it
+  is usually called "opmode.log".  Note that you should not include
+  quote here.
+
 Do you want to log connecting users to a separate file
 CONFIG_LOG_USERS
   Specify 'y' here if you want to log who is connecting to your server.
index 3c748e027ab3657fbc80a446fc60868b810e36f1..8bd0d0287db39cbc2cbcd747e9f7f89b1db0d967 100644 (file)
@@ -258,6 +258,7 @@ struct ModeBuf {
 #define MODEBUF_DEST_OPMODE    0x0100  /* Send server mode as OPMODE */
 #define MODEBUF_DEST_DEOP      0x0200  /* Deop the offender */
 #define MODEBUF_DEST_BOUNCE    0x0400  /* Bounce the modes */
+#define MODEBUF_DEST_LOG       0x0800  /* Log the mode changes to OPATH */
 
 #define MODEBUF_DEST_HACK2     0x2000  /* Send a HACK(2) notice, reverse */
 #define MODEBUF_DEST_HACK3     0x4000  /* Send a HACK(3) notice, TS == 0 */
index 1348e71f51a1b1e4c03f8f154d98c4b34dda50b8..42e159f942ff161f259faf6c406498f158b11815 100644 (file)
@@ -295,7 +295,7 @@ channel.o: channel.c ../include/channel.h ../config/config.h \
  ../include/numnicks.h ../include/querycmds.h ../include/s_bsd.h \
  ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \
  ../include/s_user.h ../include/send.h ../include/sprintf_irc.h \
- ../include/support.h ../include/whowas.h
+ ../include/support.h ../include/sys.h ../include/whowas.h
 class.o: class.c ../include/class.h ../include/client.h \
  ../include/dbuf.h ../include/ircd_defs.h ../include/ircd_handler.h \
  ../include/ircd.h ../config/config.h ../config/setup.h \
@@ -572,8 +572,8 @@ m_mode.o: m_mode.c ../include/handlers.h ../include/channel.h \
  ../include/hash.h ../include/ircd.h ../include/struct.h \
  ../include/ircd_reply.h ../include/ircd_string.h \
  ../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \
- ../include/numnicks.h ../include/s_debug.h ../include/s_user.h \
- ../include/send.h
+ ../include/numnicks.h ../include/s_conf.h ../include/s_debug.h \
+ ../include/s_user.h ../include/send.h
 m_motd.o: m_motd.c ../include/client.h ../include/dbuf.h \
  ../include/ircd_defs.h ../include/ircd_handler.h ../include/ircd.h \
  ../config/config.h ../config/setup.h ../include/struct.h \
index 25b310c6f328f989407c4cda4df0286135e2e4db..05fc2d90cfb2a7bd8fb4c2b3de63d69ab58d2986 100644 (file)
@@ -2804,7 +2804,8 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
 
   /* If we're building a user visible MODE or HACK... */
   if (mbuf->mb_dest & (MODEBUF_DEST_CHANNEL | MODEBUF_DEST_HACK2 |
-                      MODEBUF_DEST_HACK3   | MODEBUF_DEST_HACK4)) {
+                      MODEBUF_DEST_HACK3   | MODEBUF_DEST_HACK4 |
+                      MODEBUF_DEST_LOG)) {
     /* Set up the parameter strings */
     addstr[0] = '\0';
     addstr_i = 0;
@@ -2867,6 +2868,22 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
                     rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "", addbuf,
                     remstr, addstr, mbuf->mb_channel->creationtime);
 
+#ifdef OPATH
+    if (mbuf->mb_dest & MODEBUF_DEST_LOG) {
+      if (IsServer(mbuf->mb_source))
+       write_log(OPATH, TIME_T_FMT " %s OPMODE %s %s%s%s%s%s%s\n", TStime(),
+                 mbuf->mb_source->name, mbuf->mb_channel->chname,
+                 rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "", addbuf,
+                 remstr, addstr);
+      else
+       write_log(OPATH, TIME_T_FMT " %s!%s@%s OPMODE %s %s%s%s%s%s%s\n",
+                 TStime(), mbuf->mb_source->name,
+                 mbuf->mb_source->user->username, mbuf->mb_source->user->host,
+                 mbuf->mb_channel->chname, rembuf_i ? "-" : "", rembuf,
+                 addbuf_i ? "+" : "", addbuf, remstr, addstr);
+    }
+#endif
+
     if (mbuf->mb_dest & MODEBUF_DEST_CHANNEL)
       sendto_channel_butserv(mbuf->mb_channel, app_source,
                             ":%s MODE %s %s%s%s%s%s%s", app_source->name,
index c99d46ec0591a69f4f81f26bdb4b84255b50e16d..8153e28898ecbda391753b84f26295f117285651 100644 (file)
@@ -223,9 +223,11 @@ do_clearmode(struct Client *cptr, struct Client *sptr, struct Channel *chptr,
   if (del_mode & MODE_KEY)
     chptr->mode.key[0] = '\0';
 
+#ifndef OPATH
   /* Don't propagate CLEARMODE if it's a local channel */
   if (IsLocalChannel(chptr->chname))
     return 0;
+#endif
 
   /* Ok, build control string again */
   for (flag_p = flags; flag_p[0]; flag_p += 2)
@@ -234,13 +236,25 @@ do_clearmode(struct Client *cptr, struct Client *sptr, struct Channel *chptr,
 
   control_buf[control_buf_i] = '\0';
 
-  /* Then send it */
+#ifdef OPATH
   if (IsServer(sptr))
-    sendto_serv_butone(cptr, "%s " TOK_CLEARMODE " %s %s", NumServ(sptr),
-                      chptr->chname, control_buf);
+    write_log(OPATH, TIME_T_FMT " %s CLEARMODE %s %s\n", TStime(), sptr->name,
+             chptr->chname, control_buf);
   else
-    sendto_serv_butone(cptr, "%s%s " TOK_CLEARMODE " %s %s", NumNick(sptr),
-                      chptr->chname, control_buf);
+    write_log(OPATH, TIME_T_FMT " %s!%s@%s CLEARMODE %s %s\n", TStime(),
+             sptr->name, sptr->user->username, sptr->user->host,
+             chptr->chname, control_buf);
+#endif
+
+  /* Then send it */
+  if (!IsLocalChannel(chptr->chname)) {
+    if (IsServer(sptr))
+      sendto_serv_butone(cptr, "%s " TOK_CLEARMODE " %s %s", NumServ(sptr),
+                        chptr->chname, control_buf);
+    else
+      sendto_serv_butone(cptr, "%s%s " TOK_CLEARMODE " %s %s", NumNick(sptr),
+                        chptr->chname, control_buf);
+  }
 
   return 0;
 }
index a90f2d6c930b26846a248d224f82f818e5036d07..9bb460891992114c7da0094ba0b2915f69c4cc91 100644 (file)
@@ -122,7 +122,8 @@ int ms_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
               (MODEBUF_DEST_CHANNEL | /* Send MODE to channel */
                MODEBUF_DEST_SERVER  | /* And to server */
                MODEBUF_DEST_OPMODE  | /* Use OPMODE */
-               MODEBUF_DEST_HACK4));  /* Generate a HACK(4) notice */
+               MODEBUF_DEST_HACK4   | /* Generate a HACK(4) notice */
+               MODEBUF_DEST_LOG));    /* Log the mode changes to OPATH */
 
   mode_parse(&mbuf, cptr, sptr, chptr, parc - 2, parv + 2,
             (MODE_PARSE_SET    | /* Set the modes on the channel */
@@ -158,7 +159,8 @@ int mo_opmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
               (MODEBUF_DEST_CHANNEL | /* Send MODE to channel */
                MODEBUF_DEST_SERVER  | /* And to server */
                MODEBUF_DEST_OPMODE  | /* Use OPMODE */
-               MODEBUF_DEST_HACK4));  /* Generate a HACK(4) notice */
+               MODEBUF_DEST_HACK4   | /* Generate a HACK(4) notice */
+               MODEBUF_DEST_LOG));    /* Log the mode changes to OPATH */
 
   mode_parse(&mbuf, cptr, sptr, chptr, parc - 2, parv + 2,
             (MODE_PARSE_SET |    /* set the modes on the channel */