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
This commit is contained in:
Kevin Easton
2014-10-26 13:08:43 +00:00
parent 34c34b9a43
commit 7563f1d401
3 changed files with 5 additions and 14 deletions

View File

@@ -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)

View File

@@ -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 */

View File

@@ -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;