struct ImapMboxData *imap_mdata_new(struct ImapAccountData *adata, const char* name);
void imap_mdata_free(void **ptr);
void imap_mdata_cache_reset(struct ImapMboxData *mdata);
-char *imap_fix_path(struct ImapAccountData *adata, const char *mailbox, char *path, size_t plen);
-void imap_cachepath(struct ImapAccountData *adata, const char *mailbox, char *dest, size_t dlen);
+char *imap_fix_path(char delim, const char *mailbox, char *path, size_t plen);
+void imap_cachepath(char delim, const char *mailbox, char *dest, size_t dlen);
int imap_get_literal_count(const char *buf, unsigned int *bytes);
char *imap_get_qualifier(char *buf);
int imap_mxcmp(const char *mx1, const char *mx2);
if (mdata->bcache)
return mdata->bcache;
- imap_cachepath(adata, mdata->name, mailbox, sizeof(mailbox));
+ imap_cachepath(adata->delim, mdata->name, mailbox, sizeof(mailbox));
return mutt_bcache_open(&adata->conn->account, mailbox);
}
return 1;
}
- imap_fix_path(adata, buf, mbox, sizeof(mbox));
+ imap_fix_path(adata->delim, buf, mbox, sizeof(mbox));
if (!*mbox)
mutt_str_strfcpy(mbox, "INBOX", sizeof(mbox));
imap_munge_mbox_name(adata->unicode, mmbox, sizeof(mmbox), mbox);
mdata->real_name = mutt_str_strdup(name);
- imap_fix_path(adata, name, buf, sizeof(buf));
+ imap_fix_path(adata->delim, name, buf, sizeof(buf));
if (buf[0] == '\0')
mutt_str_strfcpy(buf, "INBOX", sizeof(buf));
mdata->name = mutt_str_strdup(buf);
char cachepath[PATH_MAX];
char mbox[PATH_MAX];
- imap_cachepath(adata, mdata->name, mbox, sizeof(mbox));
+ imap_cachepath(adata->delim, mdata->name, mbox, sizeof(mbox));
if (strstr(mbox, "/../") || (strcmp(mbox, "..") == 0) || (strncmp(mbox, "../", 3) == 0))
return NULL;
b1 = mutt_mem_malloc(strlen(mx1) + 1);
b2 = mutt_mem_malloc(strlen(mx2) + 1);
- imap_fix_path(NULL, mx1, b1, strlen(mx1) + 1);
- imap_fix_path(NULL, mx2, b2, strlen(mx2) + 1);
+ imap_fix_path('\0', mx1, b1, strlen(mx1) + 1);
+ imap_fix_path('\0', mx2, b2, strlen(mx2) + 1);
rc = mutt_str_strcmp(b1, b2);
FREE(&b1);
/**
* imap_fix_path - Fix up the imap path
- * @param adata Imap Account data
- * @param mailbox Mailbox path
- * @param path Buffer for the result
- * @param plen Length of buffer
- * @retval ptr Fixed-up path
+ * @param server_delim Imap Server Delim
+ * @param mailbox Mailbox path
+ * @param path Buffer for the result
+ * @param plen Length of buffer
+ * @retval ptr Fixed-up path
*
* This is necessary because the rest of neomutt assumes a hierarchy delimiter of
* '/', which is not necessarily true in IMAP. Additionally, the filesystem
* to "/". IMAP servers are not required to do this.
* Moreover, IMAP servers may dislike the path ending with the delimiter.
*/
-char *imap_fix_path(struct ImapAccountData *adata, const char *mailbox, char *path, size_t plen)
+char *imap_fix_path(char server_delim, const char *mailbox, char *path, size_t plen)
{
int i = 0;
- char delim = '\0';
-
- if (adata)
- delim = adata->delim;
+ char delim = server_delim;
while (mailbox && *mailbox && i < plen - 1)
{
if ((ImapDelimChars && strchr(ImapDelimChars, *mailbox)) || (delim && *mailbox == delim))
{
/* use connection delimiter if known. Otherwise use user delimiter */
- if (!adata)
+ if (server_delim == '\0')
delim = *mailbox;
while (*mailbox && ((ImapDelimChars && strchr(ImapDelimChars, *mailbox)) ||
/**
* imap_cachepath - Generate a cache path for a mailbox
- * @param adata Imap Account data
+ * @param delim Imap server delimiter
* @param mailbox Mailbox name
* @param dest Buffer to store cache path
* @param dlen Length of buffer
*/
-void imap_cachepath(struct ImapAccountData *adata, const char *mailbox, char *dest, size_t dlen)
+void imap_cachepath(char delim, const char *mailbox, char *dest, size_t dlen)
{
char *s = NULL;
const char *p = mailbox;
for (s = dest; p && *p && dlen; dlen--)
{
- if (*p == adata->delim)
+ if (*p == delim)
{
*s = '/';
/* simple way to avoid collisions with UIDs */