From d0a96c3a6ca89197c51d652f24ae2f1c8476f458 Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Fri, 31 Mar 2000 19:42:03 +0000 Subject: [PATCH] Author: Kev 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 | 16 +++++++++++++++- config/config-sh.in | 6 +++++- doc/Configure.help | 12 ++++++++++++ include/channel.h | 1 + ircd/Makefile.in | 6 +++--- ircd/channel.c | 19 ++++++++++++++++++- ircd/m_clearmode.c | 24 +++++++++++++++++++----- ircd/m_opmode.c | 6 ++++-- 8 files changed, 77 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae10229..e9688c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2000-03-31 Kevin L. Mitchell + * 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 @@ -239,7 +253,7 @@ # # 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. # diff --git a/config/config-sh.in b/config/config-sh.in index afad93e..52d40bd 100644 --- a/config/config-sh.in +++ b/config/config-sh.in @@ -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 diff --git a/doc/Configure.help b/doc/Configure.help index c96533f..b9e675a 100644 --- a/doc/Configure.help +++ b/doc/Configure.help @@ -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. diff --git a/include/channel.h b/include/channel.h index 3c748e0..8bd0d02 100644 --- a/include/channel.h +++ b/include/channel.h @@ -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 */ diff --git a/ircd/Makefile.in b/ircd/Makefile.in index 1348e71..42e159f 100644 --- a/ircd/Makefile.in +++ b/ircd/Makefile.in @@ -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 \ diff --git a/ircd/channel.c b/ircd/channel.c index 25b310c..05fc2d9 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -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, diff --git a/ircd/m_clearmode.c b/ircd/m_clearmode.c index c99d46e..8153e28 100644 --- a/ircd/m_clearmode.c +++ b/ircd/m_clearmode.c @@ -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; } diff --git a/ircd/m_opmode.c b/ircd/m_opmode.c index a90f2d6..9bb4608 100644 --- a/ircd/m_opmode.c +++ b/ircd/m_opmode.c @@ -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 */ -- 2.20.1