From 72c0fd3889c8ffd2fd209806954d03338191147c Mon Sep 17 00:00:00 2001 From: Egor Date: Mon, 2 May 2022 22:22:17 +0300 Subject: [PATCH] add basic USERHOST and WHO --- irc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/irc.c b/irc.c index 7da1c1d..586926f 100644 --- a/irc.c +++ b/irc.c @@ -198,6 +198,21 @@ int processPacket(struct client_data *client) { } copy_strf(&databuf, ":%s 366 %s :End of /NAMES list\n", hostname, client->nick); send_log(client->FD, databuf.buf, databuf.len, 0); + } else if(strcmp(command, "USERHOST") == 0) { + if (argc == 0) // FIXME: error message + return 0; + // TODO: actual host + copy_strf(&databuf, ":%s 302 %s :%s=+user@~localhost\n", hostname, client->nick, args[0]); + send_log(client->FD, databuf.buf, databuf.len, 0); + } else if(strcmp(command, "WHO") == 0) { + if (argc == 0) // FIXME: error message + return 0; + // TODO: actual host info + struct client_data *cl = findClient(args[0]); + if (cl) + copy_strf(&databuf, ":%s 352 %s * user ~localhost %s %s H :1 Patchouli Knowledge\n", hostname, client->nick, hostname, args[0]); + copy_strf(&databuf, ":%s 315 %s %s :End of WHO list\n", hostname, client->nick, args[0]); + send_log(client->FD, databuf.buf, databuf.len, 0); } else { unknown: // Inform user of error -- 2.56.0