Changeset 5044:aa6f191cfa10 for imap
Legend:
- Unmodified
- Added
- Removed
-
imap/command.c
r5043 r5044 820 820 IMAP_MBOX mx; 821 821 int count; 822 IMAP_STATUS *status , sb;823 int olduv, oldun;822 IMAP_STATUS *status; 823 unsigned int olduv, oldun; 824 824 825 825 mailbox = imap_next_word (s); … … 828 828 imap_unmunge_mbox_name (mailbox); 829 829 830 if (!(status = imap_mboxcache_get (idata, mailbox))) 831 { 832 /* ugly interface - why should I look up what I just added? */ 833 memset (&sb, 0, sizeof (IMAP_STATUS)); 834 sb.name = mailbox; 835 idata->mboxcache = mutt_add_list_n (idata->mboxcache, &sb, sizeof (IMAP_STATUS)); 836 status = imap_mboxcache_get (idata, mailbox); 837 status->name = safe_strdup (mailbox); 838 } 830 status = imap_mboxcache_get (idata, mailbox, 1); 839 831 olduv = status->uidvalidity; 840 832 oldun = status->uidnext; -
imap/imap.c
r5043 r5044 86 86 FREE (&mx.mbox); 87 87 88 if (imap_mboxcache_get (idata, mailbox ))88 if (imap_mboxcache_get (idata, mailbox, 0)) 89 89 { 90 90 dprint (3, (debugfile, "imap_access: found %s in cache\n", mailbox)); … … 557 557 CONNECTION *conn; 558 558 IMAP_DATA *idata; 559 IMAP_STATUS* status , sb;559 IMAP_STATUS* status; 560 560 char buf[LONG_STRING]; 561 561 char bufout[LONG_STRING]; … … 633 633 imap_cmd_start (idata, bufout); 634 634 635 if (!(status = imap_mboxcache_get (idata, idata->mailbox))) 636 { 637 memset (&sb, 0, sizeof (IMAP_STATUS)); 638 sb.name = idata->mailbox; 639 idata->mboxcache = mutt_add_list_n (idata->mboxcache, &sb, sizeof (IMAP_STATUS)); 640 status = imap_mboxcache_get (idata, idata->mailbox); 641 status->name = safe_strdup (idata->mailbox); 642 } 635 status = imap_mboxcache_get (idata, idata->mailbox, 1); 636 643 637 do 644 638 { … … 1571 1565 1572 1566 queued = 0; 1573 if ((status = imap_mboxcache_get (idata, mbox )))1567 if ((status = imap_mboxcache_get (idata, mbox, 0))) 1574 1568 return status->messages; 1575 1569 … … 1577 1571 } 1578 1572 1579 /* return cached mailbox stats or NULL */1580 IMAP_STATUS* imap_mboxcache_get (IMAP_DATA* idata, const char* mbox )1573 /* return cached mailbox stats or NULL if create is 0 */ 1574 IMAP_STATUS* imap_mboxcache_get (IMAP_DATA* idata, const char* mbox, int create) 1581 1575 { 1582 1576 LIST* cur; … … 1601 1595 status = NULL; 1602 1596 1597 /* lame */ 1598 if (create) 1599 { 1600 memset (&scache, 0, sizeof (scache)); 1601 scache.name = (char*)mbox; 1602 idata->mboxcache = mutt_add_list_n (idata->mboxcache, &scache, 1603 sizeof (scache)); 1604 status = imap_mboxcache_get (idata, mbox, 0); 1605 status->name = safe_strdup (mbox); 1606 } 1607 1603 1608 #ifdef USE_HCACHE 1604 1609 path = safe_strdup (idata->ctx->path); … … 1614 1619 if (uidvalidity) 1615 1620 { 1616 /* lame */1617 memset (&scache, 0, sizeof (scache));1618 scache.name = (char*)mbox;1619 idata->mboxcache = mutt_add_list_n (idata->mboxcache, &scache,1620 sizeof (scache));1621 status = imap_mboxcache_get (idata, mbox);1622 status->name = safe_strdup (mbox);1623 1621 status->uidvalidity = *uidvalidity; 1624 1622 status->uidnext = uidnext ? *uidnext: 0; -
imap/imap_private.h
r4938 r5044 231 231 int imap_create_mailbox (IMAP_DATA* idata, char* mailbox); 232 232 int imap_rename_mailbox (IMAP_DATA* idata, IMAP_MBOX* mx, const char* newname); 233 IMAP_STATUS* imap_mboxcache_get (IMAP_DATA* idata, const char* mbox); 233 IMAP_STATUS* imap_mboxcache_get (IMAP_DATA* idata, const char* mbox, 234 int create); 234 235 void imap_mboxcache_free (IMAP_DATA* idata); 235 236 int imap_make_msg_set (IMAP_DATA* idata, BUFFER* buf, int flag, int changed, -
imap/message.c
r5041 r5044 328 328 } 329 329 330 if (maxuid && (status = imap_mboxcache_get (idata, idata->mailbox )))330 if (maxuid && (status = imap_mboxcache_get (idata, idata->mailbox, 0))) 331 331 status->uidnext = maxuid + 1; 332 332
