diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-10-28 13:14:51 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-10-28 13:32:29 +0200 |
commit | 0995da3900a270387b9098f28505edec4c202955 (patch) | |
tree | af082118645b3cadf78c0ca8d8e7c007bc5d3b58 | |
parent | c8a826f016dcb91b108420600795358c74c05148 (diff) | |
download | xK-0995da3900a270387b9098f28505edec4c202955.tar.gz xK-0995da3900a270387b9098f28505edec4c202955.tar.xz xK-0995da3900a270387b9098f28505edec4c202955.zip |
degesch: don't consider all mode changes important
-rw-r--r-- | degesch.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -6145,6 +6145,8 @@ struct mode_processor struct server *s; ///< Server struct channel *channel; ///< The channel being modified + unsigned changes; ///< Count of all changes + unsigned usermode_changes; ///< Count of all usermode changes }; /// Process a single mode character @@ -6268,8 +6270,12 @@ mode_processor_do_param_when_set (struct mode_processor *self) static bool mode_processor_apply_channel (struct mode_processor *self) { + self->changes++; if (strchr (self->s->irc_chanuser_modes, self->mode_char)) + { + self->usermode_changes++; mode_processor_do_user (self); + } else if (strchr (self->s->irc_chanmodes_list, self->mode_char)) // Nothing to do here, just skip the next argument if there's any (void) mode_processor_next_param (self); @@ -6285,12 +6291,14 @@ mode_processor_apply_channel (struct mode_processor *self) return true; } -static void +/// Returns whether the change has only affected channel user modes +static bool irc_handle_mode_channel (struct server *s, struct channel *channel, char **params) { struct mode_processor p = { .s = s, .channel = channel }; mode_processor_run (&p, params, mode_processor_apply_channel); + return p.changes == p.usermode_changes; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -6668,12 +6676,16 @@ irc_handle_mode (struct server *s, const struct irc_message *msg) hard_assert ((channel && buffer) || (channel && !buffer) || (!channel && !buffer)); - if (channel) - irc_handle_mode_channel (s, channel, msg->params.vector + 1); + int flags = 0; + if (channel + && irc_handle_mode_channel (s, channel, msg->params.vector + 1)) + // This is 90% automode spam, let's not let it steal attention, + // maybe this behaviour should be configurable though + flags = BUFFER_LINE_UNIMPORTANT; if (buffer) { - log_server_status (s, buffer, + log_server (s, buffer, BUFFER_LINE_STATUS | flags, "Mode #S [#S] by #n", context, modes, msg->prefix); } } |