]> code.citadel.org Git - citadel.git/commitdiff
Multipart attachments stuff. arrgh
authorArt Cancro <ajc@citadel.org>
Wed, 23 Sep 1998 02:55:08 +0000 (02:55 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 23 Sep 1998 02:55:08 +0000 (02:55 +0000)
citadel/commands.c
citadel/messages.c
citadel/msgbase.c

index 5ca24d2db79e2ed1d58a0187e530c507950e8c11..984355c2d67f778c41a3dd972ecd9c96d3d29864 100644 (file)
@@ -49,6 +49,7 @@ struct citcmd {
 
 int rc_exp_beep;
 char rc_exp_cmd[256];
+int rc_allow_attachments;
 
 char *gl_string;
 
index 8a5d31ddec79eb8201bfabed2f660995919d7a41..7fe9a01127853ab6b1b6c88440c743837f044cd6 100644 (file)
@@ -530,7 +530,7 @@ int make_message(char *filename, char *recipient, int anon_type, int format_type
                 
          
 { 
-       FILE *fp;
+       FILE *fp, *atpipe;
        int a,b,e_ex_code;
        long now,beg;
        char datestr[64];
@@ -683,7 +683,42 @@ MECR2:     b=inkey();
                }
        goto MECR2;
 
-MEFIN: return(0);
+MEFIN: /* Now we're done typing the message.  Before returning, append any
+        * attachments the user has selected
+        */
+       if (strlen(boundary)==0) goto SKIPAT;
+       fp = fopen(filename, "a");
+       while (AttachList != NULL) {
+               sprintf(buf, "uuencode %s <%s",
+                       AttachList->filename, AttachList->filename);
+               atpipe = popen(buf, "r");
+               if (atpipe != NULL) {
+                       fprintf(fp,"--%s\n", boundary);
+                       fprintf(fp,"Content-type: application/octet-stream;\n");
+                       fprintf(fp,"%cname=%c%s%c\n",
+                               9, 34, AttachList->filename, 34);
+                       fprintf(fp,"Content-Transfer-Encoding: x-uudecode\n");
+                       fprintf(fp,"Content-Disposition: attachment;\n");
+                       fprintf(fp,"%cfilename=%c%s%c\n\n",
+                               9, 34, AttachList->filename, 34);
+                       while (fgets(buf, 256, atpipe)!=NULL) {
+                               buf[strlen(buf)-1]=0;
+                               fprintf(fp, "%s\n", buf);
+                               }
+                       pclose(atpipe);
+                       }
+               else {
+                       printf("*** Cannot open %s: %s\n",
+                               AttachList->filename, strerror(errno));
+                       }
+               Aptr = AttachList->next;
+               free(AttachList);
+               AttachList = Aptr;
+               }
+       fprintf(fp, "--%s--\n", boundary);      /* end of attachments */
+       fclose(fp);
+
+SKIPAT:        return(0);
 
 MEABT: printf("Are you sure? ");
        if (yesno()==0) goto ME1;
index af13aeadf29921b31704993569c1de7eb29e50b5..db5bd7d938bac83a788c198f9b215d253f588354 100644 (file)
@@ -973,7 +973,7 @@ void cmd_ent0(char *entargs)
        extract(recipient,entargs,1);
        anon_flag = extract_int(entargs,2);
        format_type = extract_int(entargs,3);
-       extract(boundary, entargs, 4);
+       extract(boundary, entargs, 5);
 
        /* first check to make sure the request is valid. */