From 7b4403648004fc355e97541ea24cb384d79334e0 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Sun, 26 Jul 2009 06:30:48 +0200 Subject: [PATCH] print ip address when using whoip. --- src/core/commands.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/commands.c b/src/core/commands.c index ead45b1..6c2a7b7 100644 --- a/src/core/commands.c +++ b/src/core/commands.c @@ -332,7 +332,7 @@ static int command_whoip(struct hub_info* hub, struct hub_user* user, struct hub char tmp[128]; snprintf(tmp, 128, "Found %d match%s:", (int) ret, ((ret != 1) ? "es" : "")); - char* buffer = hub_malloc(((MAX_NICK_LEN + 1) * ret) + strlen(tmp) + 3); + char* buffer = hub_malloc(((MAX_NICK_LEN + INET6_ADDRSTRLEN + 5) * ret) + strlen(tmp) + 3); buffer[0] = 0; strcat(buffer, tmp); strcat(buffer, "\n"); @@ -341,7 +341,9 @@ static int command_whoip(struct hub_info* hub, struct hub_user* user, struct hub while (u) { strcat(buffer, u->id.nick); - strcat(buffer, "\n"); + strcat(buffer, "("); + strcat(buffer, ip_convert_to_string(&u->net.ipaddr)); + strcat(buffer, ")\n"); u = (struct hub_user*) list_get_next(users); } strcat(buffer, "\n");