static int imap_check_acl (IMAP_DATA * idata);
static int imap_check_capabilities (IMAP_DATA * idata);
static void imap_set_flag (IMAP_DATA * idata, int aclbit, int flag,
static int imap_check_acl (IMAP_DATA * idata);
static int imap_check_capabilities (IMAP_DATA * idata);
static void imap_set_flag (IMAP_DATA * idata, int aclbit, int flag,
/* imap_get_flags: Make a simple list out of a FLAGS response.
* return stream following FLAGS response */
/* imap_get_flags: Make a simple list out of a FLAGS response.
* return stream following FLAGS response */
if (*s != '(') {
debug_print (1, ("bogus FLAGS response: %s\n", s));
return NULL;
}
/* create list, update caller's flags handle */
if (*s != '(') {
debug_print (1, ("bogus FLAGS response: %s\n", s));
return NULL;
}
/* create list, update caller's flags handle */
/* note bad flags response */
if (*s != ')') {
debug_print (1, ("Unterminated FLAGS response: %s\n", s));
/* note bad flags response */
if (*s != ')') {
debug_print (1, ("Unterminated FLAGS response: %s\n", s));
else if (ascii_strncasecmp ("OK [PERMANENTFLAGS", pc, 18) == 0) {
debug_print (2, ("Getting mailbox PERMANENTFLAGS\n"));
/* safe to call on NULL */
else if (ascii_strncasecmp ("OK [PERMANENTFLAGS", pc, 18) == 0) {
debug_print (2, ("Getting mailbox PERMANENTFLAGS\n"));
/* safe to call on NULL */
/* skip "OK [PERMANENT" so syntax is the same as FLAGS */
pc += 13;
if ((pc = imap_get_flags (&(idata->flags), pc)) == NULL)
/* skip "OK [PERMANENT" so syntax is the same as FLAGS */
pc += 13;
if ((pc = imap_get_flags (&(idata->flags), pc)) == NULL)
if (mutt_bit_isset (idata->rights, ACL_WRITE))
imap_add_keywords (flags, hdr, idata->flags, sizeof (flags));
if (mutt_bit_isset (idata->rights, ACL_WRITE))
imap_add_keywords (flags, hdr, idata->flags, sizeof (flags));
/* UW-IMAP is OK with null flags, Cyrus isn't. The only solution is to
* explicitly revoke all system flags (if we have permission) */
/* UW-IMAP is OK with null flags, Cyrus isn't. The only solution is to
* explicitly revoke all system flags (if we have permission) */
imap_set_flag (idata, ACL_WRITE, 1, "\\Answered ", flags, sizeof (flags));
imap_set_flag (idata, ACL_DELETE, 1, "\\Deleted ", flags, sizeof (flags));
imap_set_flag (idata, ACL_WRITE, 1, "\\Answered ", flags, sizeof (flags));
imap_set_flag (idata, ACL_DELETE, 1, "\\Deleted ", flags, sizeof (flags));
/* The draft IMAP implementor's guide warns againts using the STATUS
* command on a mailbox that you have selected
/* The draft IMAP implementor's guide warns againts using the STATUS
* command on a mailbox that you have selected
if (m_strcmp(mbox_unquoted, idata->mailbox) == 0
|| (ascii_strcasecmp (mbox_unquoted, "INBOX") == 0
&& m_strcasecmp(mbox_unquoted, idata->mailbox) == 0)) {
if (m_strcmp(mbox_unquoted, idata->mailbox) == 0
|| (ascii_strcasecmp (mbox_unquoted, "INBOX") == 0
&& m_strcasecmp(mbox_unquoted, idata->mailbox) == 0)) {
}
else if (mutt_bit_isset (idata->capabilities, IMAP4REV1) ||
mutt_bit_isset (idata->capabilities, STATUS)) {
}
else if (mutt_bit_isset (idata->capabilities, IMAP4REV1) ||
mutt_bit_isset (idata->capabilities, STATUS)) {
imap_quote_string (term, sizeof (term), delim);
mutt_buffer_addstr (buf, term);
break;
imap_quote_string (term, sizeof (term), delim);
mutt_buffer_addstr (buf, term);
break;
/* all this listing/browsing is a mess. I don't like that name is a pointer
* into idata->buf (used to be a pointer into the passed in buffer, just
* as bad), nor do I like the fact that the fetch is done here. This
/* all this listing/browsing is a mess. I don't like that name is a pointer
* into idata->buf (used to be a pointer into the passed in buffer, just
* as bad), nor do I like the fact that the fetch is done here. This
* FIXME. ?! */
int imap_parse_list_response (IMAP_DATA * idata, char **name, int *noselect,
int *noinferiors, char *delim)
* FIXME. ?! */
int imap_parse_list_response (IMAP_DATA * idata, char **name, int *noselect,
int *noinferiors, char *delim)
mailbox = (BUFFY*) Incoming->data[i];
if (!m_strncmp(dest, mailbox->path, matchlen)) {
if (rc) {
mailbox = (BUFFY*) Incoming->data[i];
if (!m_strncmp(dest, mailbox->path, matchlen)) {
if (rc) {
rc = 0;
} else
longest_common_prefix (dest, mailbox->path, matchlen, len);
rc = 0;
} else
longest_common_prefix (dest, mailbox->path, matchlen, len);
url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0);
if (!m_strncmp(dest, urlstr, matchlen)) {
if (rc) {
url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0);
if (!m_strncmp(dest, urlstr, matchlen)) {
if (rc) {
rc = 0;
} else
longest_common_prefix (dest, urlstr, matchlen, len);
rc = 0;
} else
longest_common_prefix (dest, urlstr, matchlen, len);
* known mailboxes/hooks/etc */
if (!(idata = imap_conn_find (&(mx.account), M_IMAP_CONN_NONEW))) {
p_delete(&mx.mbox);
* known mailboxes/hooks/etc */
if (!(idata = imap_conn_find (&(mx.account), M_IMAP_CONN_NONEW))) {
p_delete(&mx.mbox);
/* fire off command */
snprintf (buf, sizeof (buf), "%s \"\" \"%s%%\"",
/* fire off command */
snprintf (buf, sizeof (buf), "%s \"\" \"%s%%\"",
imap_cmd_start (idata, buf);
/* and see what the results are */
imap_cmd_start (idata, buf);
/* and see what the results are */
do {
if (imap_parse_list_response (idata, &list_word, &noselect, &noinferiors,
&delim))
do {
if (imap_parse_list_response (idata, &list_word, &noselect, &noinferiors,
&delim))