diff options
author | James Booth <boothj5@gmail.com> | 2012-09-23 20:30:32 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-09-23 20:30:32 +0100 |
commit | 78e4524de04930f6f12982d88048872cea2f0cd7 (patch) | |
tree | 4a4573f50f1b97cf43e1e585b13b21ca1c0f8420 /src | |
parent | 4662f21cb4f4c16936a29ac6e9c194b9751475f5 (diff) | |
download | profani-tty-78e4524de04930f6f12982d88048872cea2f0cd7.tar.gz |
Added logging of unread messages to test
Diffstat (limited to 'src')
-rw-r--r-- | src/profanity.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/profanity.c b/src/profanity.c index 0c4bc49e..b047e364 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -25,6 +25,8 @@ #include <stdlib.h> #include <string.h> +#include <glib.h> + #include "chat_log.h" #include "command.h" #include "common.h" @@ -39,6 +41,8 @@ static log_level_t _get_log_level(char *log_level); gboolean _process_input(char *inp); static void _create_config_directory(); +static gdouble unread_period = 5; + void profanity_run(void) { @@ -47,12 +51,23 @@ profanity_run(void) log_info("Starting main event loop"); inp_non_block(); + + GTimer *timer = g_timer_new(); + while(cmd_result == TRUE) { int ch = ERR; char inp[INP_WIN_MAX]; int size = 0; while(ch != '\n') { + + gdouble elapsed = g_timer_elapsed(timer, NULL); + + if (elapsed >= unread_period) { + log_info("Unread : %d", win_get_unread()); + g_timer_start(timer); + } + win_handle_special_keys(&ch); if (ch == KEY_RESIZE) { |