degesch: fix /whois, /whowas

This commit is contained in:
Přemysl Eric Janouch 2015-06-18 22:05:32 +02:00
parent 088009d16b
commit bdad7bd7c2
1 changed files with 14 additions and 4 deletions

View File

@ -6629,8 +6629,14 @@ handle_command_whois (struct app_context *ctx, char *arguments)
struct server *s = ctx->current_buffer->server;
if (*arguments)
irc_send (s, "WHOIS %s", arguments);
else if (ctx->current_buffer->type == BUFFER_PM)
irc_send (s, "WHOIS %s", ctx->current_buffer->user->nickname);
else if (ctx->current_buffer->type == BUFFER_SERVER)
irc_send (s, "WHOIS %s", s->irc_user->nickname);
else
irc_send (s, "WHOIS");
buffer_send_error (ctx, ctx->current_buffer,
"%s: %s", "Can't request info",
"no target given and this buffer is not a PM nor a server");
return true;
}
@ -6643,8 +6649,12 @@ handle_command_whowas (struct app_context *ctx, char *arguments)
struct server *s = ctx->current_buffer->server;
if (*arguments)
irc_send (s, "WHOWAS %s", arguments);
else if (ctx->current_buffer->type == BUFFER_PM)
irc_send (s, "WHOWAS %s", ctx->current_buffer->user->nickname);
else
irc_send (s, "WHOWAS");
buffer_send_error (ctx, ctx->current_buffer,
"%s: %s", "Can't request info",
"no target given and this buffer is not a PM");
return true;
}
@ -6816,10 +6826,10 @@ g_command_handlers[] =
"[<mask>]",
handle_command_who },
{ "whois", "Get user information",
"<mask>",
"[<target>] <mask>",
handle_command_whois },
{ "whowas", "Get user information",
"<mask>",
"<user> [<count> [<target>]]",
handle_command_whowas },
{ "motd", "Get the Message of The Day",