From 7563f1d401f9f2860f7db84c7ea038075671d2e4 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sun, 26 Oct 2014 13:08:43 +0000 Subject: [PATCH] Cache the bitmask of the channel log level in the cset structure instead of the channel structure. This fixes a bug where the cached channel log level bitmask was not correctly set unless you did a /cset CHANNEL_LOG_LEVEL after the channel had been joined, which resulted in most things not being logged. It makes most sense to cache the bitmask within the cset structure, and there was even an (ununsed) field already there for it. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@512 13b04d17-f746-0410-82c6-800466cd88b0 --- Changelog | 2 ++ include/struct.h | 7 ------- source/cset.c | 10 +++------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Changelog b/Changelog index 8352203..425cf94 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2c01] +* Fixes and improvements for channel logging. (caf) + * Use correct (MODECHAN and MODEUSER) display level for channel and user modes. (caf) diff --git a/include/struct.h b/include/struct.h index 9a5cfd8..7370066 100644 --- a/include/struct.h +++ b/include/struct.h @@ -946,12 +946,10 @@ typedef struct channel_stru char *chanpass; /* if TS4 then this has the channel pass */ char connected; /* true if this channel is actually connected */ - HashEntry NickListTable[NICKLIST_HASHSIZE]; chan_flags flags; - time_t max_idle; /* max idle time for this channel */ int tog_limit; int check_idle; /* toggle idle check */ @@ -959,7 +957,6 @@ typedef struct channel_stru struct timeval channel_create; /* time for channel creation */ struct timeval join_time; /* time of last join */ - int stats_ops; /* total ops I have seen in channel */ int stats_dops; /* total dops I have seen in channel */ int stats_bans; /* total bans I have seen in channel */ @@ -988,12 +985,9 @@ typedef struct channel_stru CSetList *csets; /* All Channel sets */ - - int msglog_on; FILE *msglog_fp; char *logfile; - unsigned long log_level; int totalnicks; /* total number of users in channel */ int maxnicks; /* max number of users I have seen */ @@ -1001,7 +995,6 @@ typedef struct channel_stru int totalbans; /* total numbers of bans on channel */ - BanList *bans; /* pointer to list of bans on channel */ BanList *exemptbans; /* pointer to list of bans on channel */ int maxbans; /* max number of bans I have seen */ diff --git a/source/cset.c b/source/cset.c index 999111e..6921251 100644 --- a/source/cset.c +++ b/source/cset.c @@ -1200,19 +1200,15 @@ void log_channel(CSetArray *var, CSetList *cs) void set_msglog_channel_level(CSetArray *var, CSetList *cs) { - ChannelList *chan; - if ((chan = lookup_channel(cs->channel, from_server, 0))) - { - chan->log_level = parse_lastlog_level(cs->log_level, 1); - set_cset_str_var(cs, CHANNEL_LOG_LEVEL_CSET, bits_to_lastlog_level(chan->log_level)); - } + cs->channel_log_level = parse_lastlog_level(cs->log_level, 1); + set_cset_str_var(cs, CHANNEL_LOG_LEVEL_CSET, bits_to_lastlog_level(cs->channel_log_level)); } void do_logchannel(unsigned long level, ChannelList *chan, char *format, ...) { if (!chan || !get_cset_int_var(chan->csets, CHANNEL_LOG_CSET)) return; - if ((chan->log_level & level) && format) + if ((chan->csets->channel_log_level & level) && format) { char s[BIG_BUFFER_SIZE+1]; va_list args;