*/
static void cmd_parse_fetch(struct ImapData *idata, char *s)
{
- unsigned int msn;
+ unsigned int msn, uid;
struct Header *h = NULL;
mutt_debug(3, "Handling FETCH\n");
}
s++;
- if (mutt_strncasecmp("FLAGS", s, 5) != 0)
+ while (*s)
{
- mutt_debug(2, "Only handle FLAGS updates\n");
- return;
- }
+ SKIPWS(s);
- /* If server flags could conflict with neomutt's flags, reopen the mailbox. */
- if (h->changed)
- idata->reopen |= IMAP_EXPUNGE_PENDING;
- else
- {
- imap_set_flags(idata, h, s);
- idata->check_status = IMAP_FLAGS_PENDING;
+ if (mutt_strncasecmp("FLAGS", s, 5) == 0)
+ {
+ /* If server flags could conflict with mutt's flags, reopen the mailbox. */
+ if (h->changed)
+ idata->reopen |= IMAP_EXPUNGE_PENDING;
+ else
+ {
+ imap_set_flags(idata, h, s);
+ idata->check_status = IMAP_FLAGS_PENDING;
+ }
+ return;
+ }
+ else if (mutt_strncasecmp("UID", s, 3) == 0)
+ {
+ s += 3;
+ SKIPWS(s);
+ uid = (unsigned int) atoi(s);
+ if (uid != HEADER_DATA(h)->uid)
+ {
+ mutt_debug(2, "FETCH UID vs MSN mismatch. Skipping update.\n");
+ return;
+ }
+ s = imap_next_word(s);
+ }
+ else if (*s == ')')
+ s++; /* end of request */
+ else if (*s)
+ {
+ mutt_debug(2, "Only handle FLAGS updates\n");
+ return;
+ }
}
}
hd = h->data;
newh.data = hd;
- mutt_debug(2, "imap_fetch_message: parsing FLAGS\n");
+ mutt_debug(2, "imap_set_flags: parsing FLAGS\n");
if ((s = msg_parse_flags(&newh, s)) == NULL)
return NULL;