aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--degesch.c10
1 files 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,