diff options
Diffstat (limited to 'degesch.c')
-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); } } |