Opened 6 years ago
Closed 6 years ago
#1484310 closed Feature Patches (fixed)
New messages not shown in the message list
| Reported by: | r@… | Owned by: | |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.1-rc1 |
| Component: | PHP backend | Version: | git-master |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I think everyone is familiar with this one - you check for new mail, the folder pane gets updated with e.g. "INBOX (2)" but the message list doesn't show the new messages until you switch to another folder and then back to the INBOX. Disabling message caching is the usual suggestion for fixing this. New message checking is handled in program/steps/mail/check_recent.inc by calling the messagecount function. The third argument to the function determines whether to force bypassing of the message cache or not. I notice that when checking for recent messages the cache is bypassed (line 30). When getting the number of unread messages, the cache is bypassed (line 33). When getting the count of total messages, the cache is not bypassed (line 32). This count of total messages is used later to load the new headers into the message list (lines 42-47) - using the non-updated count from the cache prevents any new headers from being loaded. Forcing the cache to be bypassed for getting the total count fixes the problem of new message headers not showing up when new messages arrive.
There is then the problem of the message count in the lower right corner not getting updated (e.g. "Messages 1 to 40 of 77"). This is a similar problem, but this time of the rcmail_get_messagecount_text function in program/steps/mail/func.inc not supporting forcing a bypass of the cache. This can be accommodated by adding a parameter to the function, and making sure the cache in bypassed when calling rcmail_get_messagecount_text from check_recent.inc
check_recent.inc:
--- program/steps/mail/check_recent.inc Wed Aug 2 18:05:42 2006
+++ program/steps/mail/check_recent.inc.new Thu Mar 29 09:54:00 2007
@@ -28,14 +28,14 @@
if ($mbox_name == $IMAP->get_mailbox_name())
{
if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE))
{
- $count = $IMAP->messagecount();
+ $count = $IMAP->messagecount(NULL, NULL, TRUE);
$unread_count = $IMAP->messagecount(NULL, 'UNSEEN', TRUE);
$commands .= sprintf("this.set_unread_count('%s', %d);\n", addslashes($mbox_name), $unread_count);
$commands .= sprintf("this.set_env('messagecount', %d);\n", $count);
- $commands .= sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text());
+ $commands .= sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text(NULL, NULL, TRUE));
$commands .= sprintf("this.set_quota('%s');\n", $IMAP->get_quota());
// add new message headers to list
$a_headers = array();
func.inc:
--- func.inc Sun Mar 18 14:46:03 2007
+++ /usr/local/apache2/htdocs/program/steps/mail/func.inc Thu Mar 29 01:13:52 2007
@@ -691,24 +691,24 @@
return $quota_text;
}
-function rcmail_get_messagecount_text($count=NULL, $page=NULL)
+function rcmail_get_messagecount_text($count=NULL, $page=NULL, $force=FALSE)
{
global $IMAP, $MESSAGE;
if (isset($MESSAGE['index']))
{
return rcube_label(array('name' => 'messagenrof',
'vars' => array('nr' => $MESSAGE['index']+1,
- 'count' => $count!==NULL ? $count : $IMAP->messagecount())));
+ 'count' => $count!==NULL ? $count : $IMAP->messagecount(NULL, NULL, $force))));
}
if ($page===NULL)
$page = $IMAP->list_page;
$start_msg = ($page-1) * $IMAP->page_size + 1;
- $max = $count!==NULL ? $count : $IMAP->messagecount();
+ $max = $count!==NULL ? $count : $IMAP->messagecount(NULL, NULL, $force);
if ($max==0)
$out = rcube_label('mailboxempty');
else
I haven't noticed that these changes break anything else, hopefully they will prove useful.
Change History (3)
comment:1 Changed 6 years ago by seansan
comment:2 Changed 6 years ago by r@…
Please bear with me, I'm new at this :-\
It seems the idea of "forcing" is not only to bypass the cache but to update it as well. Because I didn't specify a mode in my suggested change
$count = $IMAP->messagecount(NULL, NULL, TRUE);
the cache was bypassed to get a count but not updated with the new count. The solution is to specify a mode so that the cache is updated and rcmail_get_messagecount_text can get the message count from the cache. So really only that one line needs to be changed, ignore everything else I said about rcmail_get_messagecount_text and func.inc:
--- program/steps/mail/check_recent.inc Wed Aug 2 18:05:42 2006
+++ program/steps/mail/check_recent.inc.new Sat Mar 31 07:37:43 2007
@@ -29,7 +29,7 @@
{
if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE))
{
- $count = $IMAP->messagecount();
+ $count = $IMAP->messagecount(NULL, 'ALL', TRUE);
$unread_count = $IMAP->messagecount(NULL, 'UNSEEN', TRUE);
$commands .= sprintf("this.set_unread_count('%s', %d);\n", addslashes($mbox_name), $unread_count);
comment:3 Changed 6 years ago by thomasb
- Resolution set to fixed
- Status changed from new to closed
Fixed in Trunk ([d70ddea0])

Also see : #1483808