Re: IMAP with Domino
- From: Pawel Salek <pawsa0 gmail com>
- To: balsa-list gnome org
- Subject: Re: IMAP with Domino
- Date: Wed, 26 Aug 2009 21:35:30 +0200
On 08/24/2009 01:41:12 PM, Ildar Mulyukov wrote:
Hi!
I'm playing with Balsa against Lotus Domino version 8 (IMAP).
So I have some feedback.
1. Balsa doesn't treat well "\\" as a folder separator. For example:
IMAP C: 6 LIST "public\\info\\" "%"
IMAP S: * LIST (\HasNoChildren) "\\" {15}
public\info\ALT
* LIST (\Noinferiors \HasNoChildren) "\\" {17}
public\info\Inbox
* LIST (\Noinferiors \HasNoChildren) "\\" {17}
public\info\Trash
6 OK LIST completed
IMAP C: 7 SELECT "public\info\ALT"
This could easily be the Domino's fault. I am not sure as I didn't
check an RFC for that.
Can you please check whether the attached patch fixes the problem?
Pawel
diff --git a/libbalsa/imap/imap_tst.c b/libbalsa/imap/imap_tst.c
index 1a96dd7..e59193b 100644
--- a/libbalsa/imap/imap_tst.c
+++ b/libbalsa/imap/imap_tst.c
@@ -6,6 +6,7 @@
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
@@ -16,6 +17,7 @@
#include "libimap.h"
#include "imap-handle.h"
#include "imap-commands.h"
+#include "util.h"
struct {
char *user;
@@ -556,6 +558,40 @@ test_mbox_delete(int argc, char *argv[])
return rc == IMR_OK ? 0 : 1;
}
+/** test mailbox name quoting. */
+static int
+test_mailbox_name_quoting()
+{
+ static const struct {
+ const char *test, *reference;
+ } test_mailbox_names[] = {
+ { "INBOX", "INBOX" },
+ { "ehlo", "ehlo" },
+ { "ångström", "&AOU-ngstr&APY-m" },
+ { "quot\"ed\"", "quot\\\"ed\\\"" },
+ { "dirty & ugly", "dirty &- ugly" },
+ { "dir\\mbox", "dir\\\\mbox" }
+ };
+ int failure_count = 0;
+ unsigned i;
+ for(i=0;
+ i<sizeof(test_mailbox_names)/sizeof(test_mailbox_names[0]);
+ ++i) {
+ char *mbx7 = imap_utf8_to_mailbox(test_mailbox_names[i].test);
+ if (!mbx7)
+ continue;
+ if (strcmp(mbx7, test_mailbox_names[i].reference) != 0) {
+ printf("Encoded name for '%s' expected '%s' found '%s'\n",
+ test_mailbox_names[i].test,
+ test_mailbox_names[i].reference,
+ mbx7);
+ ++failure_count;
+ }
+ free(mbx7);
+ }
+ return failure_count;
+}
+
static unsigned
process_options(int argc, char *argv[])
{
@@ -591,6 +627,7 @@ main(int argc, char *argv[]) {
if(argc<=1) {
test_envelope_strings();
test_body_strings();
+ test_mailbox_name_quoting();
} else {
static const struct {
int (*func)(int argc, char *argv[]);
diff --git a/libbalsa/imap/util.c b/libbalsa/imap/util.c
index 4486271..fa05811 100644
--- a/libbalsa/imap/util.c
+++ b/libbalsa/imap/util.c
@@ -385,6 +385,10 @@ imap_utf8_to_mailbox(const char *src)
bitstogo = 0;
utf8total= 0;
}
+ /* encode '\' as '\\', and '"' as '\"' */
+ if (c == '\\' || c == '"') {
+ *dst++ = '\\';
+ }
*dst++ = c;
/* encode '&' as '&-' */
if (c == '&') {
@@ -464,6 +468,8 @@ int main(int argc, char *argv[])
for(i=1; i<argc; i++) {
char *mbx = imap_utf8_to_mailbox(argv[i]);
char *utf8 = imap_mailbox_to_utf8(mbx);
+ if (!mbx || !utf8)
+ continue;
printf("orig='%s' mbx='%s' back='%s'\n", argv[i], mbx, utf8);
free(mbx); free(utf8);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]