When using status window and query windows, /whois to some queried nick

displyed all replies in query window except idle line in status window.
Also added "x days" to idle line.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@490 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-07-18 23:35:04 +00:00 committed by cras
commit d7e017a819
2 changed files with 35 additions and 30 deletions

View file

@ -369,37 +369,42 @@ static void event_whois(const char *data, IRC_SERVER_REC *server)
g_free(params); g_free(params);
} }
static void event_whois_idle(gchar *data, IRC_SERVER_REC *server) static void event_whois_idle(const char *data, IRC_SERVER_REC *server)
{ {
gchar *params, *nick, *secstr, *signon, *rest; char *params, *nick, *secstr, *signonstr, *rest;
glong secs, lsignon; long days, hours, mins, secs;
gint h, m, s; time_t signon;
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
params = event_get_params(data, 5 | PARAM_FLAG_GETREST, NULL, &nick, &secstr, &signon, &rest); params = event_get_params(data, 5 | PARAM_FLAG_GETREST, NULL,
if (sscanf(secstr, "%ld", &secs) == 0) secs = 0; &nick, &secstr, &signonstr, &rest);
lsignon = 0;
if (strstr(rest, ", signon time") != NULL)
sscanf(signon, "%ld", &lsignon);
h = secs/3600; m = (secs%3600)/60; s = secs%60; secs = atol(secstr);
if (lsignon == 0) signon = strstr(rest, "signon time") == NULL ? 0 :
printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_WHOIS_IDLE, nick, h, m, s); (time_t) atol(signonstr);
else
{
gchar *timestr;
struct tm *tim;
time_t t;
t = (time_t) lsignon; days = secs/3600/24;
tim = localtime(&t); hours = (secs%(3600*24))/3600;
timestr = g_strdup(asctime(tim)); mins = (secs%3600)/60;
if (timestr[strlen(timestr)-1] == '\n') timestr[strlen(timestr)-1] = '\0'; secs %= 60;
printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_IDLE_SIGNON, nick, h, m, s, timestr);
g_free(timestr); if (signonstr == 0)
} printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_IDLE,
g_free(params); nick, days, hours, mins, secs);
else {
char *timestr;
struct tm *tim;
tim = localtime(&signon);
timestr = g_strdup(asctime(tim));
if (timestr[strlen(timestr)-1] == '\n')
timestr[strlen(timestr)-1] = '\0';
printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_IDLE_SIGNON,
nick, days, hours, mins, secs, timestr);
g_free(timestr);
}
g_free(params);
} }
static void event_whois_server(const char *data, IRC_SERVER_REC *server) static void event_whois_server(const char *data, IRC_SERVER_REC *server)

View file

@ -125,8 +125,8 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "whois", "%_$0%_ %K[%n$1@$2%K]%n%: ircname : $3", 4, { 0, 0, 0, 0 } }, { "whois", "%_$0%_ %K[%n$1@$2%K]%n%: ircname : $3", 4, { 0, 0, 0, 0 } },
{ "whowas", "%_$0%_ %K[%n$1@$2%K]%n%: ircname : $3", 4, { 0, 0, 0, 0 } }, { "whowas", "%_$0%_ %K[%n$1@$2%K]%n%: ircname : $3", 4, { 0, 0, 0, 0 } },
{ "whois_idle", " idle : $1 hours $2 mins $3 secs", 4, { 0, 1, 1, 1 } }, { "whois_idle", " idle : $1 days $2 hours $3 mins $4 secs", 5, { 0, 1, 1, 1, 1 } },
{ "whois_idle_signon", " idle : $1 hours $2 mins $3 secs %K[%nsignon: $4%K]", 5, { 0, 1, 1, 1, 0 } }, { "whois_idle_signon", " idle : $1 days $2 hours $3 mins $4 secs %K[%nsignon: $5%K]", 6, { 0, 1, 1, 1, 1, 0 } },
{ "whois_server", " server : $1 %K[%n$2%K]", 3, { 0, 0, 0 } }, { "whois_server", " server : $1 %K[%n$2%K]", 3, { 0, 0, 0 } },
{ "whois_oper", " : %_IRC operator%_", 1, { 0 } }, { "whois_oper", " : %_IRC operator%_", 1, { 0 } },
{ "whois_channels", " channels : $1", 2, { 0, 0 } }, { "whois_channels", " channels : $1", 2, { 0, 0 } },