1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 16:23:14 +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
+2 -1
View File
@@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2006-03-03
ChangeLog - 2006-03-04
Version 0.1.8 (under dev!):
* added inactivity time, available for plugins via get_info("inactivity")
* keys alt-{home|end} to scroll top/bottom, alt-{f11-f12} to scroll
nicklist top/bottom
* added special names for plugin message handlers: weechat_pv,
+16
View File
@@ -2339,6 +2339,12 @@ plugin->exec_command (plugin, "freenode", "#weechat", "hello");
<entry><literal>away</literal></entry>
<entry>"away" flag</entry>
</row>
<row>
<entry><literal>inactivity</literal></entry>
<entry>
number of seconds since last key was pressed
</entry>
</row>
<row>
<entry><literal>weechat_dir</literal></entry>
<entry>
@@ -2379,6 +2385,16 @@ plugin->exec_command (plugin, "freenode", "#weechat", "hello");
<screen>
char *version = plugin->get_info (plugin, "version", NULL);
char *nick = plugin->get_info (plugin, "nick", "freenode");
char *inactivity = plugin->get_info (plugin, "inactivity", NULL);
plugin->print (plugin, NULL, NULL,
"WeeChat version %s, you are %s on freenode "
"(inactive for %s seconds)",
version, nick, inactivity);
free (version);
free (nick);
free (inactivity);
</screen>
</para>
</section>
+17
View File
@@ -2387,6 +2387,13 @@ plugin->exec_command (plugin, "freenode", "#weechat", "bonjour");
<entry><literal>away</literal></entry>
<entry>drapeau "away"</entry>
</row>
<row>
<entry><literal>inactivity</literal></entry>
<entry>
nombre de secondes écoulées depuis que la dernière
touche a été appuyée
</entry>
</row>
<row>
<entry><literal>weechat_dir</literal></entry>
<entry>
@@ -2427,6 +2434,16 @@ plugin->exec_command (plugin, "freenode", "#weechat", "bonjour");
<screen>
char *version = plugin->get_info (plugin, "version", NULL);
char *nick = plugin->get_info (plugin, "nick", "freenode");
char *inactivity = plugin->get_info (plugin, "inactivity", NULL);
plugin->print (plugin, NULL, NULL,
"WeeChat version %s, vous êtes %s sur freenode "
"(inactif depuis %s secondes)",
version, nick, inactivity);
free (version);
free (nick);
free (inactivity);
</screen>
</para>
</section>
+3
View File
@@ -209,6 +209,8 @@ gui_input_read ()
gui_refresh_screen ();
continue;
}
gui_last_activity_time = time (NULL);
if (key < 32)
{
@@ -319,6 +321,7 @@ gui_main_loop ()
quit_weechat = 0;
new_time = time (NULL);
gui_last_activity_time = new_time;
local_time = localtime (&new_time);
old_day = local_time->tm_mday;
+3
View File
@@ -65,6 +65,9 @@ t_gui_infobar *gui_infobar; /* pointer to infobar content */
char *gui_input_clipboard = NULL; /* clipboard content */
time_t gui_last_activity_time = 0; /* last activity time */
/* (key pressed) */
/*
* gui_window_tree_init: create first entry in windows tree
+1
View File
@@ -400,6 +400,7 @@ extern char gui_key_buffer[128];
extern int gui_key_grab;
extern int gui_key_grab_count;
extern char *gui_input_clipboard;
extern time_t gui_last_activity_time;
extern t_gui_color *gui_color[NUM_COLORS];
+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 */
+2 -1
View File
@@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2006-03-03
ChangeLog - 2006-03-04
Version 0.1.8 (under dev!):
* added inactivity time, available for plugins via get_info("inactivity")
* keys alt-{home|end} to scroll top/bottom, alt-{f11-f12} to scroll
nicklist top/bottom
* added special names for plugin message handlers: weechat_pv,
+16
View File
@@ -2339,6 +2339,12 @@ plugin->exec_command (plugin, "freenode", "#weechat", "hello");
<entry><literal>away</literal></entry>
<entry>"away" flag</entry>
</row>
<row>
<entry><literal>inactivity</literal></entry>
<entry>
number of seconds since last key was pressed
</entry>
</row>
<row>
<entry><literal>weechat_dir</literal></entry>
<entry>
@@ -2379,6 +2385,16 @@ plugin->exec_command (plugin, "freenode", "#weechat", "hello");
<screen>
char *version = plugin->get_info (plugin, "version", NULL);
char *nick = plugin->get_info (plugin, "nick", "freenode");
char *inactivity = plugin->get_info (plugin, "inactivity", NULL);
plugin->print (plugin, NULL, NULL,
"WeeChat version %s, you are %s on freenode "
"(inactive for %s seconds)",
version, nick, inactivity);
free (version);
free (nick);
free (inactivity);
</screen>
</para>
</section>
+17
View File
@@ -2387,6 +2387,13 @@ plugin->exec_command (plugin, "freenode", "#weechat", "bonjour");
<entry><literal>away</literal></entry>
<entry>drapeau "away"</entry>
</row>
<row>
<entry><literal>inactivity</literal></entry>
<entry>
nombre de secondes écoulées depuis que la dernière
touche a été appuyée
</entry>
</row>
<row>
<entry><literal>weechat_dir</literal></entry>
<entry>
@@ -2427,6 +2434,16 @@ plugin->exec_command (plugin, "freenode", "#weechat", "bonjour");
<screen>
char *version = plugin->get_info (plugin, "version", NULL);
char *nick = plugin->get_info (plugin, "nick", "freenode");
char *inactivity = plugin->get_info (plugin, "inactivity", NULL);
plugin->print (plugin, NULL, NULL,
"WeeChat version %s, vous êtes %s sur freenode "
"(inactif depuis %s secondes)",
version, nick, inactivity);
free (version);
free (nick);
free (inactivity);
</screen>
</para>
</section>
+3
View File
@@ -209,6 +209,8 @@ gui_input_read ()
gui_refresh_screen ();
continue;
}
gui_last_activity_time = time (NULL);
if (key < 32)
{
@@ -319,6 +321,7 @@ gui_main_loop ()
quit_weechat = 0;
new_time = time (NULL);
gui_last_activity_time = new_time;
local_time = localtime (&new_time);
old_day = local_time->tm_mday;
+3
View File
@@ -65,6 +65,9 @@ t_gui_infobar *gui_infobar; /* pointer to infobar content */
char *gui_input_clipboard = NULL; /* clipboard content */
time_t gui_last_activity_time = 0; /* last activity time */
/* (key pressed) */
/*
* gui_window_tree_init: create first entry in windows tree
+1
View File
@@ -400,6 +400,7 @@ extern char gui_key_buffer[128];
extern int gui_key_grab;
extern int gui_key_grab_count;
extern char *gui_input_clipboard;
extern time_t gui_last_activity_time;
extern t_gui_color *gui_color[NUM_COLORS];
+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 */