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

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