aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-18 22:05:32 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-18 22:05:32 +0200
commitbdad7bd7c205bd8d2e1b067d89be88b68b9da34f (patch)
tree0809661d8427affddf525830c3ded9de3ac6d72a
parent088009d16ba824e35dd6187a5ba790a6c4ee766a (diff)
downloadxK-bdad7bd7c205bd8d2e1b067d89be88b68b9da34f.tar.gz
xK-bdad7bd7c205bd8d2e1b067d89be88b68b9da34f.tar.xz
xK-bdad7bd7c205bd8d2e1b067d89be88b68b9da34f.zip
degesch: fix /whois, /whowas
-rw-r--r--degesch.c18
1 files 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[] =
"[<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",