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 if(strcmp(command, "WHOIS") == 0) {
+ if (!client->nick) // FIXME: error message
+ return 0;
+ if (argc == 0) // FIXME: error message
+ return 0;
+ char *nick = args[1] ? args[1] : args[0];
+ struct client_data *cl = findClient(nick);
+ if (cl) {
+ copy_strf(&databuf, ":%s 311 %s %s %s %s * :%s\n", hostname, client->nick, cl->nick, cl->username, cl->hostname, cl->realname);
+ send_log(client->FD, databuf.buf, databuf.len, 0);
+ copy_strf(&databuf, ":%s 312 %s %s %s :Patchy server\n", hostname, client->nick, cl->nick, hostname);
+ send_log(client->FD, databuf.buf, databuf.len, 0);
+ if (cl->umode & UMODE_OPER) {
+ copy_strf(&databuf, ":%s 313 %s %s :is an IRC operator\n", hostname, client->nick, cl->nick);
+ send_log(client->FD, databuf.buf, databuf.len, 0);
+ }
+ copy_strf(&databuf, ":%s 318 %s %s :End of /WHOIS list\n", hostname, client->nick, cl->nick);
+ send_log(client->FD, databuf.buf, databuf.len, 0);
+ } else {
+ copy_strf(&databuf, ":%s 401 %s %s :No such nick/channel\n", hostname, client->nick, cl->nick);
+ send_log(client->FD, databuf.buf, databuf.len, 0);
+ }
} else {
unknown:
// Inform user of error