Thomas Bruederli wrote:
OK, then I suggest to use the cached messagecount value when loading the page and only call getunread if in list mode:
Index: program/include/main.inc
--- program/include/main.inc (revision 1296) +++ program/include/main.inc (working copy) @@ -1811,6 +1811,10 @@ } }
- // add unread message count display
- if ($unread = $IMAP->messagecount($folder['id'], 'UNSEEN', false))
$foldername .= sprintf(' (%d)', $unread);
- // make folder name safe for ids and class names $folder_id = preg_replace('/[^A-Za-z0-9-_]/', '', $folder['id']); $class_name = preg_replace('/[^a-z0-9-_]/', '', $folder_class ?
$folder_class : strtolower($folder['id'])); Index: program/js/app.js =================================================================== --- program/js/app.js (revision 1296) +++ program/js/app.js (working copy) @@ -226,7 +226,8 @@ if (this.gui_objects.mailboxlist) { this.gui_objects.folderlist = this.gui_objects.mailboxlist;
this.http_request('getunread', '');
if (!this.env.action)
this.http_request('getunread', ''); } // ask user to send MDN
@@ -355,7 +356,7 @@ // start interval for keep-alive/recent_check signal this.start_keepalive = function() {
- if (this.env.keep_alive && !this.env.framed && this.task=='mail'
&& this.gui_objects.messagelist)
- if (this.env.keep_alive && !this.env.framed && this.task=='mail'
&& this.gui_objects.mailboxlist) this._int = setInterval(function(){ ref.check_for_recent(); }, this.env.keep_alive * 1000); else if (this.env.keep_alive && !this.env.framed && this.task!='login') this._int = setInterval(function(){ ref.send_keep_alive(); }, this.env.keep_alive * 1000);
This can make the page-load slow if one has disabled caching. Then building the folder list will request the unread count from IMAP for each folder. Maybe a if ($IMAP->caching_enabled) could help here.
What do you think? Could this change solve your problems? If yes, I'll commit the above changes to trunk.
That solves keep_alive problem requested by me, but getunread issue is still not solved. Unseen counters are still readed on each message display and that's the performance issue what I'm talking about. But now I see the solution. Messageframe div in message.html should be an iframe. Then we can call getunread on first message display, but when moving to next/prev message (with firstmessage/previousmessage/nextmessage/lastmessage buttons) will be loaded only a message to the iframe. Folders list will be not touched and will waiting for check-recent event changes.