summaryrefslogtreecommitdiffstats
path: root/imap
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2001-05-15 20:41:54 +0000
committerThomas Roessler <roessler@does-not-exist.org>2001-05-15 20:41:54 +0000
commit5549e9cc2aefedcecabb3483e6af07521811d826 (patch)
tree83690d2e141a40a1fb3011e95e1172897922e57f /imap
parentffbbdd321813dea82ee2ac031d2aeb4b4ddd8a1a (diff)
patch-bac.notes-20010515.1
Diffstat (limited to 'imap')
-rw-r--r--imap/browse.c13
-rw-r--r--imap/util.c13
2 files changed, 15 insertions, 11 deletions
diff --git a/imap/browse.c b/imap/browse.c
index 284ba2dd..daf02a2f 100644
--- a/imap/browse.c
+++ b/imap/browse.c
@@ -42,6 +42,7 @@ int imap_browse (char* path, struct browser_state* state)
{
IMAP_DATA* idata;
char buf[LONG_STRING];
+ char buf2[LONG_STRING];
char nsbuf[LONG_STRING];
char mbox[LONG_STRING];
char list_cmd[5];
@@ -154,7 +155,7 @@ int imap_browse (char* path, struct browser_state* state)
if (showparents)
{
- dprint (2, (debugfile, "imap_init_browse: adding parent %s\n", mbox));
+ dprint (3, (debugfile, "imap_init_browse: adding parent %s\n", mbox));
imap_add_folder (idata->delim, mbox, 1, 0, state, 1);
}
@@ -198,14 +199,18 @@ int imap_browse (char* path, struct browser_state* state)
/* Listing the home namespace, so INBOX should be included. Home
* namespace is not "", so we have to list it explicitly. We ask the
* server to see if it has descendants. */
- dprint (4, (debugfile, "imap_init_browse: adding INBOX\n"));
+ dprint (3, (debugfile, "imap_browse: adding INBOX\n"));
if (browse_add_list_result (idata, "LIST \"\" \"INBOX\"", state, 0))
goto fail;
}
nsup = state->entrylen;
- snprintf (buf, sizeof (buf), "%s \"\" \"%s%%\"", list_cmd, mbox);
+ dprint (3, (debugfile, "imap_browse: Quoting mailbox scan: %s -> ", mbox));
+ snprintf (buf, sizeof (buf), "%s%%", mbox);
+ imap_quote_string (buf2, sizeof (buf2), buf);
+ dprint (3, (debugfile, "%s\n", buf2));
+ snprintf (buf, sizeof (buf), "%s \"\" %s", list_cmd, buf2);
if (browse_add_list_result (idata, buf, state, 0))
goto fail;
@@ -219,7 +224,7 @@ int imap_browse (char* path, struct browser_state* state)
if (nsi[i].listable && !nsi[i].home_namespace) {
imap_add_folder(nsi[i].delim, nsi[i].prefix, nsi[i].noselect,
nsi[i].noinferiors, state, 0);
- dprint (4, (debugfile, "imap_init_browse: adding namespace: %s\n",
+ dprint (3, (debugfile, "imap_browse: adding namespace: %s\n",
nsi[i].prefix));
}
}
diff --git a/imap/util.c b/imap/util.c
index 97a0bce3..46a4c6e7 100644
--- a/imap/util.c
+++ b/imap/util.c
@@ -391,25 +391,24 @@ void imap_qualify_path (char *dest, size_t len, IMAP_MBOX *mx, char* path)
/* imap_quote_string: quote string according to IMAP rules:
* surround string with quotes, escape " and \ with \ */
-void imap_quote_string (char *dest, size_t slen, const char *src)
+void imap_quote_string (char *dest, size_t dlen, const char *src)
{
char quote[] = "\"\\", *pt;
const char *s;
- size_t len = slen;
pt = dest;
s = src;
*pt++ = '"';
/* save room for trailing quote-char */
- len -= 2;
+ dlen -= 2;
- for (; *s && len; s++)
+ for (; *s && dlen; s++)
{
if (strchr (quote, *s))
{
- len -= 2;
- if (!len)
+ dlen -= 2;
+ if (!dlen)
break;
*pt++ = '\\';
*pt++ = *s;
@@ -417,7 +416,7 @@ void imap_quote_string (char *dest, size_t slen, const char *src)
else
{
*pt++ = *s;
- len--;
+ dlen--;
}
}
*pt++ = '"';