Amended the MSGP command to provide a way for the client to
authorArt Cancro <ajc@citadel.org>
Sun, 11 Nov 2007 05:35:30 +0000 (05:35 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 11 Nov 2007 05:35:30 +0000 (05:35 +0000)
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.

citadel/citadel.c
citadel/msgbase.c
citadel/server.h

index 560bd55a4b11dc397440fd3c4e74269b381d2c0b..8fe6b3a476bcceebe5c80fb9dd1b1599b2afe5c8 100644 (file)
@@ -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);
index d5f04195a8af75c0c331a31fb7b7c430cbc54eb1..ac2e54d2d2ad33ccc10ae33dbbaf02db34659429 100644 (file)
@@ -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);
+       }
 }
 
 
index 49f2c73f42761824c72977df9d4b8540328a340e..bcc38014b104ba2622b92e9f9c80dd0fbfed93a6 100644 (file)
@@ -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;