-static CMD_FUNC(cmd_whois)
-{
- struct userNode *from;
- struct userNode *who;
-
- if (argc < 3)
- return 0;
- if (!(from = GetUserH(origin))) {
- log_module(MAIN_LOG, LOG_ERROR, "Could not find WHOIS origin user %s", origin);
- return 0;
- }
- if(!(who = GetUserH(argv[2]))) {
- irc_numeric(from, ERR_NOSUCHNICK, "%s@%s :No such nick", argv[2], self->name);
- return 1;
- }
- if (IsHiddenHost(who) && !IsOper(from)) {
- /* Just stay quiet. */
- return 1;
- }
- irc_numeric(from, RPL_WHOISUSER, "%s %s %s * :%s", who->nick, who->ident, who->hostname, who->info);
- irc_numeric(from, RPL_WHOISSERVER, "%s %s :%s", who->nick, who->uplink->name, who->uplink->description);
- if (IsOper(who)) {
- irc_numeric(from, RPL_WHOISOPERATOR, "%s :is a megalomaniacal power hungry tyrant", who->nick);
- }
- irc_numeric(from, RPL_ENDOFWHOIS, "%s :End of /WHOIS list", who->nick);
- return 1;
-}
-