aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-18 21:54:26 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-18 22:02:51 +0200
commit088009d16ba824e35dd6187a5ba790a6c4ee766a (patch)
tree0425d7fe63091471874e07c1d1464c0f7f33a075
parent27ef5c2ea38231a5997039f7aa197366af902bae (diff)
downloadxK-088009d16ba824e35dd6187a5ba790a6c4ee766a.tar.gz
xK-088009d16ba824e35dd6187a5ba790a6c4ee766a.tar.xz
xK-088009d16ba824e35dd6187a5ba790a6c4ee766a.zip
degesch: fix /mode after breaking it
The clean up was a bit thoughtless.
-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,