mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
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:
parent
8828b8cedd
commit
d7e017a819
@ -369,37 +369,42 @@ static void event_whois(const char *data, IRC_SERVER_REC *server)
|
||||
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;
|
||||
glong secs, lsignon;
|
||||
gint h, m, s;
|
||||
char *params, *nick, *secstr, *signonstr, *rest;
|
||||
long days, hours, mins, secs;
|
||||
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);
|
||||
if (sscanf(secstr, "%ld", &secs) == 0) secs = 0;
|
||||
lsignon = 0;
|
||||
if (strstr(rest, ", signon time") != NULL)
|
||||
sscanf(signon, "%ld", &lsignon);
|
||||
params = event_get_params(data, 5 | PARAM_FLAG_GETREST, NULL,
|
||||
&nick, &secstr, &signonstr, &rest);
|
||||
|
||||
h = secs/3600; m = (secs%3600)/60; s = secs%60;
|
||||
if (lsignon == 0)
|
||||
printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_WHOIS_IDLE, nick, h, m, s);
|
||||
else
|
||||
{
|
||||
gchar *timestr;
|
||||
struct tm *tim;
|
||||
time_t t;
|
||||
secs = atol(secstr);
|
||||
signon = strstr(rest, "signon time") == NULL ? 0 :
|
||||
(time_t) atol(signonstr);
|
||||
|
||||
t = (time_t) lsignon;
|
||||
tim = localtime(&t);
|
||||
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, h, m, s, timestr);
|
||||
g_free(timestr);
|
||||
}
|
||||
g_free(params);
|
||||
days = secs/3600/24;
|
||||
hours = (secs%(3600*24))/3600;
|
||||
mins = (secs%3600)/60;
|
||||
secs %= 60;
|
||||
|
||||
if (signonstr == 0)
|
||||
printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_IDLE,
|
||||
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)
|
||||
|
@ -125,8 +125,8 @@ FORMAT_REC fecommon_irc_formats[] = {
|
||||
|
||||
{ "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 } },
|
||||
{ "whois_idle", " idle : $1 hours $2 mins $3 secs", 4, { 0, 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", " idle : $1 days $2 hours $3 mins $4 secs", 5, { 0, 1, 1, 1, 1 } },
|
||||
{ "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_oper", " : %_IRC operator%_", 1, { 0 } },
|
||||
{ "whois_channels", " channels : $1", 2, { 0, 0 } },
|
||||
|
Loading…
Reference in New Issue
Block a user