From 088009d16ba824e35dd6187a5ba790a6c4ee766a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Thu, 18 Jun 2015 21:54:26 +0200 Subject: [PATCH] degesch: fix /mode after breaking it The clean up was a bit thoughtless. --- degesch.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/degesch.c b/degesch.c index 0f5eb5c..897f1c1 100644 --- a/degesch.c +++ b/degesch.c @@ -6326,17 +6326,19 @@ handle_command_mode (struct app_context *ctx, char *arguments) // Channel names prefixed by "+" collide with mode strings, // so we just disallow specifying these channels char *target = NULL; - if (strchr ("+-\0", *arguments) - || !(target = maybe_cut_word (&arguments, validate_channel_name, s)) - || !(target = cut_word (&arguments))) + if (strchr ("+-\0", *arguments)) { if (ctx->current_buffer->type == BUFFER_CHANNEL) target = ctx->current_buffer->channel->name; if (ctx->current_buffer->type == BUFFER_PM) target = ctx->current_buffer->user->nickname; if (ctx->current_buffer->type == BUFFER_SERVER) - target = ctx->current_buffer->server->irc_user->nickname; + target = s->irc_user->nickname; } + else + // If there arguments and they don't begin with a mode string, + // they're either a user name or a channel name + target = cut_word (&arguments); if (!target) buffer_send_error (ctx, ctx->current_buffer,