/*
- * Copyright (C) 2000-3 Brendan Cully <brendan@kublai.com>
+ * Copyright (C) 2000-5 Brendan Cully <brendan@kublai.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Copyright (C) 1996-9 Brandon Long <blong@fiction.net>
- * Copyright (C) 1999-2002 Brendan Cully <brendan@kublai.com>
+ * Copyright (C) 1999-2005 Brendan Cully <brendan@kublai.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
const char *str, char *flags, size_t flsize)
{
if (mutt_bit_isset (idata->rights, aclbit))
- if (flag)
+ if (flag && imap_has_flag (idata->flags, str))
safe_strcat (flags, flsize, str);
}
+/* imap_has_flag: do a caseless comparison of the flag against a flag list,
+* return 1 if found or flag list has '\*', 0 otherwise */
+int imap_has_flag (LIST* flag_list, const char* flag)
+{
+ if (!flag_list)
+ return 0;
+
+ flag_list = flag_list->next;
+ while (flag_list)
+ {
+ if (!ascii_strncasecmp (flag_list->data, flag, strlen (flag_list->data)))
+ return 1;
+
+ if (!ascii_strncmp (flag_list->data, "\\*", strlen (flag_list->data)))
+ return 1;
+
+ flag_list = flag_list->next;
+ }
+
+ return 0;
+}
+
/* imap_make_msg_set: make an IMAP4rev1 UID message set out of a set of
* headers, given a flag enum to filter on.
* Params: idata: IMAP_DATA containing context containing header set
imap_set_flag (idata, IMAP_ACL_SEEN, hdr->read, "\\Seen ",
flags, sizeof (flags));
+ imap_set_flag (idata, IMAP_ACL_WRITE, hdr->old,
+ "Old ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_WRITE, hdr->flagged,
"\\Flagged ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_WRITE, hdr->replied,
if (!*flags)
{
imap_set_flag (idata, IMAP_ACL_SEEN, 1, "\\Seen ", flags, sizeof (flags));
+ imap_set_flag (idata, IMAP_ACL_WRITE, 1, "Old ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_WRITE, 1, "\\Flagged ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_WRITE, 1, "\\Answered ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_DELETE, 1, "\\Deleted ", flags, sizeof (flags));
void imap_logout (IMAP_DATA* idata);
int imap_sync_message (IMAP_DATA *idata, HEADER *hdr, BUFFER *cmd,
int *err_continue);
+int imap_has_flag (LIST* flag_list, const char* flag);
/* auth.c */
int imap_authenticate (IMAP_DATA* idata);
static void flush_buffer(char* buf, size_t* len, CONNECTION* conn);
static int msg_fetch_header (CONTEXT* ctx, IMAP_HEADER* h, char* buf,
FILE* fp);
-static int msg_has_flag (LIST* flag_list, const char* flag);
static int msg_parse_fetch (IMAP_HEADER* h, char* s);
static char* msg_parse_flags (IMAP_HEADER* h, char* s);
while (keywords)
{
- if (msg_has_flag (mailbox_flags, keywords->data))
+ if (imap_has_flag (mailbox_flags, keywords->data))
{
safe_strcat (s, slen, keywords->data);
safe_strcat (s, slen, " ");
}
#endif /* USE_HCACHE */
-
-/* msg_has_flag: do a caseless comparison of the flag against a flag list,
- * return 1 if found or flag list has '\*', 0 otherwise */
-static int msg_has_flag (LIST* flag_list, const char* flag)
-{
- if (!flag_list)
- return 0;
-
- flag_list = flag_list->next;
- while (flag_list)
- {
- if (!ascii_strncasecmp (flag_list->data, flag, strlen (flag_list->data)))
- return 1;
-
- flag_list = flag_list->next;
- }
-
- return 0;
-}
-
/* msg_parse_fetch: handle headers returned from header fetch */
static int msg_parse_fetch (IMAP_HEADER *h, char *s)
{
s += 7;
recent = 1;
}
+ else if (ascii_strncasecmp ("old", s, 3) == 0)
+ {
+ s += 3;
+ h->old = 1;
+ }
else
{
/* store custom flags as well */
/* wrap up, or note bad flags response */
if (*s == ')')
{
- /* if a message is neither seen nor recent, it is OLD. */
- if (option (OPTMARKOLD) && !recent && !(h->read))
- h->old = 1;
s++;
}
else
/*
* Copyright (C) 1996-8 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1996-9 Brandon Long <blong@fiction.net>
- * Copyright (C) 1999-2002 Brendan Cully <brendan@kublai.com>
+ * Copyright (C) 1999-2005 Brendan Cully <brendan@kublai.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
}
-#ifdef USE_IMAP
- /* IMAP servers manage the OLD flag themselves */
- if (ctx->magic != M_IMAP)
-#endif
if (option (OPTMARKOLD))
{
for (i = 0; i < ctx->msgcount; i++)