1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 05:46:38 +02:00

Added inactivity time, available for plugins via get_info("inactivity")

This commit is contained in:
Sebastien Helleu
2006-03-04 14:27:14 +00:00
parent 92db79989e
commit 919800c37c
14 changed files with 112 additions and 2 deletions
+14
View File
@@ -384,6 +384,8 @@ weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server)
{
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
time_t inactivity;
char *inactivity_str;
if (!plugin || !info)
return NULL;
@@ -412,6 +414,18 @@ weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server)
{
return strdup (WEECHAT_SHAREDIR);
}
else if (ascii_strcasecmp (info, "inactivity") == 0)
{
if (gui_last_activity_time == 0)
inactivity = 0;
else
inactivity = time (NULL) - gui_last_activity_time;
inactivity_str = (char *) malloc (128);
if (!inactivity_str)
return NULL;
snprintf (inactivity_str, 128, "%ld", inactivity);
return inactivity_str;
}
/* below are infos that need server to return value */