2012-08-27 [wwp] 3.8.1cvs36
[claws.git] / src / inc.c
index 9f14c9b074933768783a04fc3bae9fe59137979f..c6327565890ac1984b38b1115b1bde777d137a81 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 
 #include "defs.h"
@@ -78,6 +79,8 @@ static gboolean maemo_warned_offline = FALSE;
 #endif
 #endif
 
+extern SessionStats session_stats;
+
 static GList *inc_dialog_list = NULL;
 
 guint inc_lock_count = 0;
@@ -88,6 +91,7 @@ static GdkPixbuf *okpix;
 
 #define MSGBUFSIZE     8192
 
+static void inc_update_stats(gint new_msgs);
 static void inc_finished               (MainWindow             *mainwin,
                                         gboolean                new_messages,
                                         gboolean                autocheck);
@@ -153,7 +157,13 @@ static gint inc_autocheck_func                     (gpointer        data);
 
 static void inc_notify_cmd             (gint new_msgs, 
                                         gboolean notify);
-       
+
+static void inc_update_stats(gint new_msgs)
+{
+       /* update session statistics */
+       session_stats.received += new_msgs;
+}
+
 /**
  * inc_finished:
  * @mainwin: Main window.
@@ -214,6 +224,7 @@ void inc_mail(MainWindow *mainwin, gboolean notify)
                        new_msgs += account_new_msgs;
        }
 
+       inc_update_stats(new_msgs);
        inc_finished(mainwin, new_msgs > 0, FALSE);
        main_window_unlock(mainwin);
        inc_notify_cmd(new_msgs, notify);
@@ -307,6 +318,7 @@ gint inc_account_mail(MainWindow *mainwin, PrefsAccount *account)
 
        new_msgs = inc_account_mail_real(mainwin, account);
 
+       inc_update_stats(new_msgs);
        inc_finished(mainwin, new_msgs > 0, FALSE);
        main_window_unlock(mainwin);
        inc_autocheck_timer_set();
@@ -335,6 +347,7 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
 
        list = account_get_list();
        if (!list) {
+               inc_update_stats(new_msgs);
                inc_finished(mainwin, new_msgs > 0, autocheck);
                main_window_unlock(mainwin);
                inc_notify_cmd(new_msgs, notify);
@@ -390,6 +403,7 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
                new_msgs += inc_start(inc_dialog);
        }
 
+       inc_update_stats(new_msgs);
        inc_finished(mainwin, new_msgs > 0, autocheck);
        main_window_unlock(mainwin);
        inc_notify_cmd(new_msgs, notify);
@@ -1407,7 +1421,6 @@ osso_context_t *get_osso_context(void);
 
 static void inc_notify_cmd(gint new_msgs, gboolean notify)
 {
-
 #ifndef MAEMO
        gchar *buf, *numpos, *ret_str;
        gssize by_read = 0, by_written = 0;