On Sun, Apr 13, 2008 at 8:02 PM, Thomas Bruederli <[EMAIL PROTECTED]> wrote:
> A.L.E.C wrote:
>  >
>  > But current behaviour is inconsistent. When you have a message opened
>  > (show action) you will be not informed when new mail will arrive,
>  > because  keep-alive is not update counters on folders list. You must go
>  > back to messages list. When working with preview pane counters are
>  > updated, so I don't see problem to do this also in non-messages-list mode.
>
>  I agree. We should call check-recent whenever this.gui_objects.mailboxlist
>  is available. Currently it's only done when this.gui_objects.messagelist is
>  there.
>
>
>  > Thomas, the point is that getunread is called too often when working
>  > without preview pane. It's called after each show action and that's
>  > performance issue what I'm talking about. When messages list is open
>  > only check-recent is called. So I think we can remove getunread calls
>  > also from show action. It's not problem for me, I use preview mode, but
>  > something is not right here.
>
>  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.
>
>  ~Thomas

What about only periodically checking for the "unread count" from the
server - for example, only during "check new mail" and besides we just
decrement the number "on read" (for example with the previewpane). I
think Google Mail does it like that.

Till
_______________________________________________
List info: http://lists.roundcube.net/dev/

Reply via email to