]> PatchyGit - patchyircd.git/commitdiff
add basic USERHOST and WHO
authorEgor <egor@patchysicp.xyz>
Mon, 2 May 2022 19:22:17 +0000 (22:22 +0300)
committerEgor <egor@patchysicp.xyz>
Mon, 2 May 2022 19:22:17 +0000 (22:22 +0300)
irc.c

diff --git a/irc.c b/irc.c
index 7da1c1d..586926f 100644 (file)
--- 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