From b8f723fc676890a84e2b56957c2588dac0de8a23 Mon Sep 17 00:00:00 2001 From: ThiefMaster Date: Wed, 2 May 2007 17:52:28 +0200 Subject: [PATCH] Added idletime to remote whois. --- src/hash.h | 1 + src/proto-p10.c | 3 +++ src/proto.h | 1 + 3 files changed, 5 insertions(+) diff --git a/src/hash.h b/src/hash.h index 4147aae..a87956c 100644 --- a/src/hash.h +++ b/src/hash.h @@ -116,6 +116,7 @@ struct userNode { long modes; /* user flags +isw etc... */ time_t timestamp; /* Time of last nick change */ + time_t idle_since; struct server *uplink; /* Server that user is connected to */ struct modeList channels; /* Vector of channels user is in */ diff --git a/src/proto-p10.c b/src/proto-p10.c index 49705cf..85bb122 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -965,6 +965,8 @@ static CMD_FUNC(cmd_whois) irc_numeric(from, RPL_WHOISACCOUNT, "%s %s :is logged in as", who->nick, who->handle_info->handle); if (IsHiddenHost(who) && who->handle_info && (IsOper(from) || from == who)) irc_numeric(from, RPL_WHOISACTUALLY, "%s %s@%s %s :Actual user@host, Actual IP", who->nick, who->ident, who->hostname, irc_ntoa(&who->ip)); + if (IsLocal(who) && !IsService(who) && (!IsNoIdle(who) || IsOper(from) || from == who)) + irc_numeric(from, RPL_WHOISIDLE, "%s %ld %ld :seconds idle, signon time", who->nick, now - who->idle_since, who->timestamp); irc_numeric(from, RPL_ENDOFWHOIS, "%s :End of /WHOIS list", who->nick); return 1; @@ -2107,6 +2109,7 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char * safestrncpy(uNode->numeric, numeric, sizeof(uNode->numeric)); irc_p10_pton(&uNode->ip, realip); uNode->timestamp = timestamp; + uNode->idle_since = timestamp; modeList_init(&uNode->channels); uNode->uplink = uplink; if (++uNode->uplink->clients > uNode->uplink->max_clients) { diff --git a/src/proto.h b/src/proto.h index e595522..451c181 100644 --- a/src/proto.h +++ b/src/proto.h @@ -158,6 +158,7 @@ void irc_numeric(struct userNode *user, unsigned int num, const char *format, .. #define RPL_WHOISUSER 311 #define RPL_WHOISSERVER 312 #define RPL_WHOISOPERATOR 313 +#define RPL_WHOISIDLE 317 #define RPL_ENDOFWHOIS 318 #define RPL_WHOISCHANNELS 319 #define RPL_WHOISACCOUNT 330 -- 2.20.1