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));
/* Clean up path and replace the one in the ctx */
imap_fix_path (idata, mx.mbox, buf, sizeof (buf));
p_delete(&(idata->mailbox));
/* Clean up path and replace the one in the ctx */
imap_fix_path (idata, mx.mbox, buf, sizeof (buf));
p_delete(&(idata->mailbox));
imap_qualify_path (buf, sizeof (buf), &mx, idata->mailbox);
p_delete(&(ctx->path));
imap_qualify_path (buf, sizeof (buf), &mx, idata->mailbox);
p_delete(&(ctx->path));
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)
-static void imap_set_flag (IMAP_DATA * idata, int aclbit, int flag,
- const char *str, char *flags, size_t flsize)
+static void imap_set_flag(IMAP_DATA *idata, int aclbit, int flag,
+ const char *str, char *flags, size_t flsize)
- if (mutt_bit_isset (idata->rights, aclbit))
- if (flag)
- str_cat (flags, flsize, str);
+ if (mutt_bit_isset(idata->rights, aclbit)) {
+ if (flag)
+ m_strcat(flags, flsize, str);
+ }
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));
/* if we are expunging anyway, we can do deleted messages very quickly... */
if (expunge && mutt_bit_isset (idata->rights, ACL_DELETE)) {
/* if we are expunging anyway, we can do deleted messages very quickly... */
if (expunge && mutt_bit_isset (idata->rights, ACL_DELETE)) {
/* 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
*/
- && str_casecmp (mbox_unquoted, idata->mailbox) == 0)) {
- strfcpy (buf, "NOOP", sizeof (buf));
+ && m_strcasecmp(mbox_unquoted, idata->mailbox) == 0)) {
+ m_strcpy(buf, sizeof(buf), "NOOP");
}
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)) {
/* The mailbox name may or may not be quoted here. We could try to
* munge the server response and compare with quoted (or vise versa)
* but it is probably more efficient to just strncmp against both. */
/* The mailbox name may or may not be quoted here. We could try to
* munge the server response and compare with quoted (or vise versa)
* but it is probably more efficient to just strncmp against both. */
- if (str_ncmp (mbox_unquoted, s, str_len (mbox_unquoted)) == 0
- || str_ncmp (mbox, s, str_len (mbox)) == 0) {
+ if (m_strncmp(mbox_unquoted, s, m_strlen(mbox_unquoted)) == 0
+ || m_strncmp(mbox, s, m_strlen(mbox)) == 0) {
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;
mutt_buffer_addstr (&buf, "UID SEARCH ");
if (imap_compile_search (pat, &buf) < 0) {
p_delete(&buf.data);
mutt_buffer_addstr (&buf, "UID SEARCH ");
if (imap_compile_search (pat, &buf) < 0) {
p_delete(&buf.data);
/* 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)
imap_fix_path (idata, mx.mbox, buf, sizeof (buf));
if (option (OPTIMAPCHECKSUBSCRIBED)) {
imap_fix_path (idata, mx.mbox, buf, sizeof (buf));
if (option (OPTIMAPCHECKSUBSCRIBED)) {
err.data = errstr;
err.dsize = sizeof (errstr);
snprintf (mbox, sizeof (mbox), "%smailboxes \"%s\"",
err.data = errstr;
err.dsize = sizeof (errstr);
snprintf (mbox, sizeof (mbox), "%smailboxes \"%s\"",
/* trim dest to the length of the longest prefix it shares with src,
* returning the length of the trimmed string */
static int longest_common_prefix (char *dest, const char* src,
/* trim dest to the length of the longest prefix it shares with src,
* returning the length of the trimmed string */
static int longest_common_prefix (char *dest, const char* src,
/* look for IMAP URLs to complete from defined mailboxes. Could be extended
* to complete over open connections and account/folder hooks too. */
/* look for IMAP URLs to complete from defined mailboxes. Could be extended
* to complete over open connections and account/folder hooks too. */
if (list_empty (Incoming))
return (-1);
for (i = 0; i < Incoming->length; i++) {
mailbox = (BUFFY*) Incoming->data[i];
if (list_empty (Incoming))
return (-1);
for (i = 0; i < Incoming->length; i++) {
mailbox = (BUFFY*) Incoming->data[i];
rc = 0;
} else
longest_common_prefix (dest, mailbox->path, matchlen, len);
rc = 0;
} else
longest_common_prefix (dest, mailbox->path, matchlen, len);
url.user = NULL;
url.path = NULL;
url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0);
url.user = NULL;
url.path = NULL;
url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0);
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))
/* if the folder isn't selectable, append delimiter to force browse
* to enter it on second tab. */
if (noselect) {
/* if the folder isn't selectable, append delimiter to force browse
* to enter it on second tab. */
if (noselect) {
- strfcpy (completion, list_word, sizeof (completion));
- matchlen = str_len (completion);
+ m_strcpy(completion, sizeof(completion), list_word);
+ matchlen = m_strlen(completion);