degesch: fix /mode after breaking it

The clean up was a bit thoughtless.
This commit is contained in:
Přemysl Eric Janouch 2015-06-18 21:54:26 +02:00
parent 27ef5c2ea3
commit 088009d16b
1 changed files with 6 additions and 4 deletions

View File

@ -6326,17 +6326,19 @@ handle_command_mode (struct app_context *ctx, char *arguments)
// Channel names prefixed by "+" collide with mode strings, // Channel names prefixed by "+" collide with mode strings,
// so we just disallow specifying these channels // so we just disallow specifying these channels
char *target = NULL; char *target = NULL;
if (strchr ("+-\0", *arguments) if (strchr ("+-\0", *arguments))
|| !(target = maybe_cut_word (&arguments, validate_channel_name, s))
|| !(target = cut_word (&arguments)))
{ {
if (ctx->current_buffer->type == BUFFER_CHANNEL) if (ctx->current_buffer->type == BUFFER_CHANNEL)
target = ctx->current_buffer->channel->name; target = ctx->current_buffer->channel->name;
if (ctx->current_buffer->type == BUFFER_PM) if (ctx->current_buffer->type == BUFFER_PM)
target = ctx->current_buffer->user->nickname; target = ctx->current_buffer->user->nickname;
if (ctx->current_buffer->type == BUFFER_SERVER) 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) if (!target)
buffer_send_error (ctx, ctx->current_buffer, buffer_send_error (ctx, ctx->current_buffer,