From bdad7bd7c205bd8d2e1b067d89be88b68b9da34f Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Thu, 18 Jun 2015 22:05:32 +0200 Subject: degesch: fix /whois, /whowas --- degesch.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/degesch.c b/degesch.c index 897f1c1..4bdaaba 100644 --- a/degesch.c +++ b/degesch.c @@ -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[] = "[]", handle_command_who }, { "whois", "Get user information", - "", + "[] ", handle_command_whois }, { "whowas", "Get user information", - "", + " [ []]", handle_command_whowas }, { "motd", "Get the Message of The Day", -- cgit v1.2.3-70-g09d2