Multipart/alternative (possibly nested inside multipart/mixed)
authorArt Cancro <ajc@citadel.org>
Wed, 27 Feb 2008 21:38:05 +0000 (21:38 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 27 Feb 2008 21:38:05 +0000 (21:38 +0000)
webcit/Makefile.in
webcit/html.c
webcit/html.h [deleted file]
webcit/messages.c
webcit/webcit.h

index abb8efbb620d2c68ef381487593e16f4bbb5a76d..59bf665c46f1c4ff98639baf2f2dbe95e89aff9a 100644 (file)
@@ -51,7 +51,7 @@ webserver: webserver.o context_loop.o ical_dezonify.o \
        groupdav_main.o groupdav_get.o groupdav_propfind.o fmt_date.o \
        groupdav_options.o autocompletion.o gettext.o tabs.o sieve.o \
        groupdav_delete.o groupdav_put.o http_datestring.o setup_wizard.o \
-       downloads.o  addressbook_popup.o pushemail.o sysdep.o html.o\
+       downloads.o  addressbook_popup.o pushemail.o sysdep.o html.o \
        $(LIBOBJS)
        $(CC) webserver.o context_loop.o cookie_conversion.o \
        webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o listsub.o \
index 19cd38d89b509a9a13318dd7eb5e1746a83cc8b1..034e08017b88dd0a8ea6e063eb82a473f5bef484 100644 (file)
@@ -6,38 +6,7 @@
  * released under the terms of the GNU General Public License.
  */
 
-#include "sysdep.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <libcitadel.h>
-#include "citadel.h"
-#include "server.h"
-#include "control.h"
-#include "sysdep_decls.h"
-#include "support.h"
-#include "config.h"
-#include "msgbase.h"
-#include "room_ops.h"
-#include "html.h"
+#include "webcit.h"
  
 
 /*
diff --git a/webcit/html.h b/webcit/html.h
deleted file mode 100644 (file)
index 10f714d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/*
- * $Id: html.h 5148 2007-05-08 15:40:16Z ajc $
- * 
- */
-
-char *html_to_ascii(char *inputmsg, int msglen, int screenwidth, int do_citaformat);
index 2bf9619c1fca4ff5a9cd74444ca17534959f9537..f22d0f16d9ab0b99a317de6bc42a08d72b526eee 100644 (file)
@@ -10,7 +10,6 @@
 #include "webcit.h"
 #include "webserver.h"
 #include "groupdav.h"
-#include "html.h"
 
 #define SUBJ_COL_WIDTH_PCT             50      /**< Mailbox view column width */
 #define SENDER_COL_WIDTH_PCT           30      /**< Mailbox view column width */
@@ -2851,14 +2850,26 @@ DONE:
  * ... this is where the actual message gets transmitted to the server.
  */
 void post_mime_to_server(void) {
-       char boundary[SIZ];
+       char top_boundary[SIZ];
+       char alt_boundary[SIZ];
        int is_multipart = 0;
        static int seq = 0;
        struct wc_attachment *att;
        char *encoded;
-       char *txtmail;
        size_t encoded_length;
        size_t encoded_strlen;
+       char *txtmail = NULL;
+
+       sprintf(top_boundary, "Citadel--Multipart--%s--%04x--%04x",
+               serv_info.serv_fqdn,
+               getpid(),
+               ++seq
+       );
+       sprintf(alt_boundary, "Citadel--Multipart--%s--%04x--%04x",
+               serv_info.serv_fqdn,
+               getpid(),
+               ++seq
+       );
 
        /** RFC2045 requires this, and some clients look for it... */
        serv_puts("MIME-Version: 1.0");
@@ -2869,23 +2880,30 @@ void post_mime_to_server(void) {
                is_multipart = 1;
        }
 
-//     if (is_multipart) {
-               sprintf(boundary, "Citadel--Multipart--%s--%04x--%04x",
-                       serv_info.serv_fqdn,
-                       getpid(),
-                       ++seq
-               );
-
+       if (is_multipart) {
                /** Remember, serv_printf() appends an extra newline */
-               if (is_multipart)
-                       serv_printf("Content-type: multipart/mixed; "
-                                   "boundary=\"%s\"\n", boundary);
-               else
-                       serv_printf("Content-type: multipart/alternative; "
-                                   "boundary=\"%s\"\n", boundary);
+               serv_printf("Content-type: multipart/mixed; "
+                       "boundary=\"%s\"\n", top_boundary);
                serv_printf("This is a multipart message in MIME format.\n");
-               serv_printf("--%s", boundary);
-//     }
+               serv_printf("--%s", top_boundary);
+       }
+
+
+
+       /* Remember, serv_printf() appends an extra newline */
+       serv_printf("Content-type: multipart/alternative; "
+               "boundary=\"%s\"\n", alt_boundary);
+       serv_printf("This is a multipart message in MIME format.\n");
+       serv_printf("--%s", alt_boundary);
+
+       serv_puts("Content-type: text/plain; charset=utf-8");
+       serv_puts("Content-Transfer-Encoding: quoted-printable");
+       serv_puts("");
+       txtmail = html_to_ascii(bstr("msgtext"), 0, 80, 0);
+        text_to_server_qp(txtmail);     /** Transmit message in quoted-printable encoding */
+        free(txtmail);
+
+       serv_printf("--%s", alt_boundary);
 
        serv_puts("Content-type: text/html; charset=utf-8");
        serv_puts("Content-Transfer-Encoding: quoted-printable");
@@ -2894,15 +2912,12 @@ void post_mime_to_server(void) {
        text_to_server_qp(bstr("msgtext"));     /** Transmit message in quoted-printable encoding */
        serv_puts("</body></html>\r\n");
 
-       serv_puts("Content-type: text/plain; charset=utf-8");
-       serv_puts("Content-Transfer-Encoding: quoted-printable");
-       serv_puts("");
 
-       txtmail = html_to_ascii(bstr("msgtext"), 0, 80, 0);
-       text_to_server_qp(txtmail);     /** Transmit message in quoted-printable encoding */
-       free(txtmail);
-       if (!is_multipart)
-           serv_printf("--%s", boundary);
+       serv_printf("--%s--", alt_boundary);
+
+
+
+
        
        if (is_multipart) {
 
@@ -2914,7 +2929,7 @@ void post_mime_to_server(void) {
                        if (encoded == NULL) break;
                        encoded_strlen = CtdlEncodeBase64(encoded, att->data, att->length, 1);
 
-                       serv_printf("--%s", boundary);
+                       serv_printf("--%s", top_boundary);
                        serv_printf("Content-type: %s", att->content_type);
                        serv_printf("Content-disposition: attachment; "
                                "filename=\"%s\"", att->filename);
@@ -2925,7 +2940,7 @@ void post_mime_to_server(void) {
                        serv_puts("");
                        free(encoded);
                }
-               serv_printf("--%s--", boundary);
+               serv_printf("--%s--", top_boundary);
        }
 
        serv_puts("000");
index d47d6a830f572e14be365b743a78f93ad7fc25f2..890e432dde7c8c45b389f4d8025f1b4d1e3a3a23 100644 (file)
@@ -760,6 +760,8 @@ void display_wiki_page(void);
 int get_time_format_cached (void);
 int xtoi(char *in, size_t len);
 void webcit_fmt_date(char *buf, time_t thetime, int brief);
+char *html_to_ascii(char *inputmsg, int msglen, int screenwidth, int do_citaformat);
+
 
 #ifdef HAVE_ICONV
 iconv_t ctdl_iconv_open(const char *tocode, const char *fromcode);