From 50b6b479450f3f139850588dc4fa00165ec907bc Mon Sep 17 00:00:00 2001 From: Melvin Hadasht Date: Tue, 14 Jan 2003 15:34:44 +0000 Subject: [PATCH] * src/folderview.c folderview_check_new(): return the number of new messages since last check. * src/inc.c inc_account_mail(): Disable counting of new messages for IMAP and NNTP until bug [19] and [14] are fixed. --- ChangeLog.claws | 9 +++++++++ configure.in | 2 +- src/folderview.c | 15 +++++++++++++++ src/inc.c | 9 +++++++-- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index 7ac1618d2..6ed44291d 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,12 @@ +2003-01-14 [melvin] 0.8.8claws97 + + * src/folderview.c + folderview_check_new(): return the number of new messages + since last check. + * src/inc.c + inc_account_mail(): Disable counting of new messages for IMAP + and NNTP until bug [19] and [14] are fixed. + 2003-01-14 [paul] 0.8.8claws96 * sync with 0.8.8cvs6 diff --git a/configure.in b/configure.in index c73ac7e9f..cf7fe4e4e 100644 --- a/configure.in +++ b/configure.in @@ -11,7 +11,7 @@ MINOR_VERSION=8 MICRO_VERSION=8 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws96 +EXTRA_VERSION=claws97 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/folderview.c b/src/folderview.c index 2eb832e35..634e39c3d 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -874,6 +874,11 @@ void folderview_rescan_all(void) } #endif +/** folderview_check_new() + * Count the number of new messages since last check. + * \param folder the folder to check for new messages + * \return the number of new messages since last check + */ gint folderview_check_new(Folder *folder) { GList *list; @@ -882,6 +887,8 @@ gint folderview_check_new(Folder *folder) GtkCTree *ctree; GtkCTreeNode *node; gint new_msgs = 0; + gint former_new_msgs = 0; + gint former_new = 0; for (list = folderview_list; list != NULL; list = list->next) { folderview = (FolderView *)list->data; @@ -900,12 +907,14 @@ gint folderview_check_new(Folder *folder) if (!folder && !FOLDER_IS_LOCAL(item->folder)) continue; folderview_scan_tree_func(item->folder, item, NULL); + former_new = item->new; if (folder_item_scan(item) < 0) { if (folder && !FOLDER_IS_LOCAL(folder)) break; } folderview_update_node(folderview, node); new_msgs += item->new; + former_new_msgs += former_new; } gtk_widget_set_sensitive(folderview->ctree, TRUE); @@ -914,6 +923,12 @@ gint folderview_check_new(Folder *folder) } folder_write_list(); + /* Number of new messages since last check is the just the difference + * between former_new_msgs and new_msgs. If new_msgs is less than + * former_new_msgs, that would mean another session accessed the folder + * and the result is not well defined. + */ + new_msgs = (former_new_msgs < new_msgs ? new_msgs - former_new_msgs : 0); return new_msgs; } diff --git a/src/inc.c b/src/inc.c index 69bb65456..8c62a1e21 100644 --- a/src/inc.c +++ b/src/inc.c @@ -246,8 +246,13 @@ static gint inc_account_mail(PrefsAccount *account, MainWindow *mainwin) switch (account->protocol) { case A_IMAP4: case A_NNTP: - return folderview_check_new(FOLDER(account->folder)); - + /* Melvin: bug [14] + * FIXME: it should return foldeview_check_new() value. + * TODO: do it when bug [19] is fixed (IMAP folder sets + * an incorrect new message count) + */ + folderview_check_new(FOLDER(account->folder)); + return 0; case A_POP3: case A_APOP: session = inc_session_new(account); -- 2.25.1