Changeset 5052:b0014913dd74
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r5010
|
r5052
|
|
| 427 | 427 | char buffer[LONG_STRING]; |
| 428 | 428 | BUFFY *tmp = Incoming; |
| | 429 | #ifdef USE_IMAP |
| | 430 | struct mailbox_state mbox; |
| | 431 | #endif |
| 429 | 432 | |
| 430 | 433 | if (!Incoming) |
| … |
… |
|
| 439 | 442 | if (mx_is_imap (tmp->path)) |
| 440 | 443 | { |
| 441 | | add_folder (menu, state, tmp->path, NULL, tmp->new); |
| | 444 | imap_mailbox_state (tmp->path, &mbox); |
| | 445 | add_folder (menu, state, tmp->path, NULL, mbox.new); |
| 442 | 446 | continue; |
| 443 | 447 | } |
-
|
r4343
|
r5052
|
|
| 56 | 56 | }; |
| 57 | 57 | |
| | 58 | struct mailbox_state |
| | 59 | { |
| | 60 | unsigned int new; |
| | 61 | unsigned int old; |
| | 62 | unsigned int messages; |
| | 63 | }; |
| 58 | 64 | #endif /* _BROWSER_H */ |
-
|
r5018
|
r5052
|
|
| 252 | 252 | FREE (&mx.mbox); |
| 253 | 253 | return -1; |
| | 254 | } |
| | 255 | |
| | 256 | int 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; |
| 254 | 283 | } |
| 255 | 284 | |
-
|
r5028
|
r5052
|
|
| 51 | 51 | /* browse.c */ |
| 52 | 52 | int imap_browse (char* path, struct browser_state* state); |
| | 53 | int imap_mailbox_state (const char* path, struct mailbox_state* state); |
| 53 | 54 | int imap_mailbox_create (const char* folder); |
| 54 | 55 | int imap_mailbox_rename (const char* mailbox); |