Show
Ignore:
Timestamp:
2007-04-02 19:19:55 (22 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

Add hook for proper IMAP unseen count in mailbox browser

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • imap/browse.c

    r5018 r5052  
    252252  FREE (&mx.mbox); 
    253253  return -1; 
     254} 
     255 
     256int imap_mailbox_state (const char* path, struct mailbox_state* state) 
     257{ 
     258  IMAP_DATA* idata; 
     259  IMAP_MBOX mx; 
     260  IMAP_STATUS* status; 
     261 
     262  memset (state, 0, sizeof (*state)); 
     263  if (imap_parse_path (path, &mx) < 0) 
     264  { 
     265    dprint (1, (debugfile, "imap_mailbox_state: bad path %s\n", path)); 
     266    return -1; 
     267  } 
     268  if (!(idata = imap_conn_find (&mx.account, M_IMAP_CONN_NONEW))) 
     269  { 
     270    dprint (2, (debugfile, "imap_mailbox_state: no open connection for %s\n", 
     271                path)); 
     272    FREE (&mx.mbox); 
     273    return -1; 
     274  } 
     275 
     276  if ((status = imap_mboxcache_get (idata, mx.mbox, 0))) 
     277  { 
     278    state->new = status->unseen; 
     279    state->messages = status->messages; 
     280  } 
     281 
     282  return 0; 
    254283} 
    255284