From: Art Cancro Date: Sun, 11 Nov 2007 05:35:30 +0000 (+0000) Subject: Amended the MSGP command to provide a way for the client to X-Git-Tag: v7.86~2796 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=abd886f65a25c12b160d30d7e7328a05bd2da18a Amended the MSGP command to provide a way for the client to indicate to the server that it prefers to decode Base64 and quoted-printable on the client side when reading MIME parts with the MSG4 command. Resolves bug 289. --- diff --git a/citadel/citadel.c b/citadel/citadel.c index 560bd55a4..8fe6b3a47 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -1153,7 +1153,14 @@ void get_serv_info(CtdlIPC *ipc, char *supplied_hostname) * it to the reader's screen width, but since our HTML-to-text parser * isn't really all that great, it's probably better to just go with * the plain text when we have it available. + * + * We also indicate to the server that we prefer to decode Base64 and + * quoted-printable on the client side. */ + if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "dont_decode") / 100 ) != 2) { + scr_printf("ERROR: Extremely old server; MSG4 framework not supported.\n"); + logoff(ipc, 0); + } if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "text/plain|text/html") / 100 ) != 2) { scr_printf("ERROR: Extremely old server; MSG4 framework not supported.\n"); logoff(ipc, 0); diff --git a/citadel/msgbase.c b/citadel/msgbase.c index d5f04195a..ac2e54d2d 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -1865,7 +1865,7 @@ START_TEXT: *choose_preferred, *fixed_output_pre, *fixed_output_post, (void *)&ma, 0); mime_parser(mptr, NULL, - *output_preferred, NULL, NULL, (void *)&ma, 0); + *output_preferred, NULL, NULL, (void *)&ma, CC->msg4_dont_decode); } else { ma.use_fo_hooks = 1; @@ -1974,9 +1974,14 @@ void cmd_msg4(char *cmdbuf) */ void cmd_msgp(char *cmdbuf) { - safestrncpy(CC->preferred_formats, cmdbuf, - sizeof(CC->preferred_formats)); - cprintf("%d ok\n", CIT_OK); + if (!strcasecmp(cmdbuf, "dont_decode")) { + CC->msg4_dont_decode = 1; + cprintf("%d MSG4 will not pre-decode messages.\n", CIT_OK); + } + else { + safestrncpy(CC->preferred_formats, cmdbuf, sizeof(CC->preferred_formats)); + cprintf("%d Preferred MIME formats have been set.\n", CIT_OK); + } } diff --git a/citadel/server.h b/citadel/server.h index 49f2c73f4..bcc38014b 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -134,16 +134,18 @@ struct CitContext { char fake_hostname[64]; char fake_roomname[ROOMNAMELEN]; - char preferred_formats[256]; /* Preferred MIME formats */ + /* Preferred MIME formats */ + char preferred_formats[256]; + int msg4_dont_decode; /* Dynamically allocated session data */ struct citimap *IMAP; struct citpop3 *POP3; struct citsmtp *SMTP; - struct citmgsve *MGSVE; /**< Managesieve Session struct */ + struct citmgsve *MGSVE; /**< Managesieve Session struct */ struct cit_ical *CIT_ICAL; /* calendaring data */ struct ma_info *ma; /* multipart/alternative data */ - const char* ServiceName; /**< whats our actual purpose? */ + const char* ServiceName; /**< whats our actual purpose? */ }; typedef struct CitContext t_context;