From c2d6a184a333f6653697217be0e6ad5c810370be Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Tue, 18 Oct 2016 23:32:23 +1100 Subject: [PATCH] Act on channel mode lock as half-op There's no reason you shouldn't be able to use modelock as a half-op. Also a few other minor cleanups in this function - eg. use my_send_to_server() with the passed server number instead of implicitly using from_server. --- Changelog | 2 ++ source/commands2.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Changelog b/Changelog index 5677740..91923e8 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2.2] +* Act on channel mode lock as half-op. (caf) + * Fix crash and memory leak in $aliasctl(COMMAND MATCH). (caf) * Fix memory leaks in /CDCC PLIST and /CDCC NOTICE. (caf) diff --git a/source/commands2.c b/source/commands2.c index 6be737a..6215208 100644 --- a/source/commands2.c +++ b/source/commands2.c @@ -291,11 +291,11 @@ char *s; int check_mode_lock(char *channel, char *mode_list, int server) { - ChannelList *chan; - char buffer[BIG_BUFFER_SIZE]; + ChannelList *chan = lookup_channel(channel, server, CHAN_NOUNLINK); - if ((chan = lookup_channel(channel, server, 0)) && chan->modelock_key) + if (chan && chan->modelock_key && (chan->have_op || chan->hop)) { + char buffer[BIG_BUFFER_SIZE]; char *modelock, *new_mode_list, *newmode, *save, *save1; char *args = NULL, *args1 = NULL; int add = 0; @@ -389,8 +389,8 @@ int check_mode_lock(char *channel, char *mode_list, int server) } modelock++; } - if (chan && chan->have_op && *buffer) - send_to_server("MODE %s %s", chan->channel, buffer); + if (*buffer) + my_send_to_server(server, "MODE %s %s", chan->channel, buffer); new_free(&save); new_free(&save1); return 1;