From: Art Cancro Date: Mon, 7 Dec 1998 05:27:44 +0000 (+0000) Subject: * Ripped most of the "attachments" stuff out of both the client and X-Git-Tag: v7.86~8048 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=40c4b3289f73f6c7561dd27c282e81147dc384c2 * Ripped most of the "attachments" stuff out of both the client and server. (Thought of a better way to handle it ... LATER.) --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index db16c0b00..1b7e01a45 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -3,6 +3,8 @@ Sat Dec 5 01:24:03 EST 1998 Art Cancro * Removed whitespace to left and right of '@' in netmail recipients * sysdep.c: read citadel.config _before_ initializing loadable modules * stats.c: fixed segfault resulting from extracting log lines + * Ripped most of the "attachments" stuff out of both the client and + server. (Thought of a better way to handle it ... LATER.) 1998-12-03 Nathan Bryant * setup.c: create citadel.config with mode 0600 diff --git a/citadel/citadel.rc b/citadel/citadel.rc index 4fc8457ff..de5fe55bf 100644 --- a/citadel/citadel.rc +++ b/citadel/citadel.rc @@ -62,6 +62,9 @@ beep=1 # ALLOW_ATTACHMENTS should be set to 1 if you wish the user to be able to # attach files to messages. (Do not enable this for 'safe' public clients.) +# +# NOTE: this option does not (yet) do anything, because multipart messages +# are not yet supported. allow_attachments=1 # If you set the USERNAME variable, the value you set here will automatically diff --git a/citadel/messages.c b/citadel/messages.c index e2902e6d3..4fcde0812 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -28,11 +28,6 @@ struct cittext { char text[MAXWORDBUF]; }; -struct AttachedFile { - struct AttachedFile *next; - char filename[256]; - }; - void sttybbs(int cmd); int struncmp(char *lstr, char *rstr, int len); int fmout(int width, FILE *fp, char pagin, int height, int starting_lp, char subst); @@ -539,22 +534,19 @@ void replace_string(char *filename, long int startpos) } -int make_message(char *filename, char *recipient, int anon_type, int format_type, int mode, char *boundary) +int make_message(char *filename, char *recipient, int anon_type, int format_type, int mode) /* temporary file name */ /* NULL if it's not mail */ /* see MES_ types in header file */ { - FILE *fp, *atpipe; + FILE *fp; int a,b,e_ex_code; time_t now; long beg; char datestr[64]; int cksum = 0; - struct AttachedFile *AttachList = NULL; - struct AttachedFile *Aptr; - char buf[256]; if (mode==2) if (strlen(editor_path)==0) { printf("*** No editor available, using built-in editor\n"); @@ -677,64 +669,9 @@ MECR2: b=inkey(); printf("Hold message\n"); return(2); } - if ((b=='f')&&(rc_allow_attachments==1)) { - printf("attach File\n"); - if (strlen(boundary)==0) { - sprintf(boundary, "Citadel-Attachment-%ld.%d", - (long)time(NULL), getpid() ); - } - newprompt("Filename: ", buf, 68); - if (access(buf, R_OK)==0) { - Aptr = (struct AttachedFile *) - malloc(sizeof(struct AttachedFile)); - strcpy(Aptr->filename, buf); - Aptr->next = AttachList; - AttachList = Aptr; - } - else { - printf("*** Cannot open %s: %s\n", - buf, strerror(errno)); - } - goto MECR; - } goto MECR2; -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); +MEFIN: return(0); MEABT: printf("Are you sure? "); if (yesno()==0) goto ME1; @@ -788,7 +725,6 @@ int entmsg(int is_reply, int c) { /* */ char buf[300]; char cmd[256]; - char boundary[256]; int a,b; int need_recp = 0; int mode; @@ -859,11 +795,10 @@ int entmsg(int is_reply, int c) } /* now put together the message */ - strcpy(boundary, ""); - if ( make_message(temp,buf,b,0,c,boundary) != 0 ) return(2); + if ( make_message(temp,buf,b,0,c) != 0 ) return(2); /* and send it to the server */ - sprintf(cmd,"ENT0 1|%s|%d|%d||%s|",buf,b,mode,boundary); + sprintf(cmd,"ENT0 1|%s|%d|%d||",buf,b,mode); serv_puts(cmd); serv_gets(cmd); if (cmd[0]!='4') { diff --git a/citadel/msgbase.c b/citadel/msgbase.c index b08fa07a1..ab3de0e3a 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -346,9 +346,6 @@ time_t output_message(char *msgid, int mode, char buf[1024]; long msg_len; int msg_ok = 0; - char boundary[256]; /* attachment boundary */ - char current_section = 0; /* section currently being parsed */ - int has_attachments = 0; struct cdbdata *dmsgtext; char *mptr; @@ -362,7 +359,6 @@ time_t output_message(char *msgid, int mode, time_t xtime = 0L; /* */ - strcpy(boundary, ""); msg_num = atol(msgid); @@ -472,10 +468,6 @@ time_t output_message(char *msgid, int mode, cprintf(" [%s]",buf); cprintf("\n"); } - else if (ch=='Z') { - has_attachments = 1; - sprintf(boundary, "--%s", buf); - } else if (ch=='P') cprintf("path=%s\n",buf); else if (ch=='U') cprintf("subj=%s\n",buf); else if (ch=='I') cprintf("msgn=%s\n",buf); @@ -568,14 +560,7 @@ time_t output_message(char *msgid, int mode, while(ch = *mptr++, ch>0) { if (ch == 13) ch = 10; if ( (ch == 10) || (strlen(buf)>250) ) { - if (has_attachments) if (!strncmp(buf, boundary, strlen(boundary))) { - ++current_section; - } - if (current_section == desired_section) { - if ( (has_attachments == 0) || (strncmp(buf, boundary, strlen(boundary)))) { - cprintf("%s\n", buf); - } - } + cprintf("%s\n", buf); strcpy(buf, ""); } else { @@ -867,8 +852,7 @@ void make_message( int type, /* see MES_ types in header file */ int net_type, /* see MES_ types in header file */ int format_type, /* local or remote (see citadel.h) */ - char *fake_name, /* who we're masquerading as */ - char *boundary) { /* boundary (if exist attachments) */ + char *fake_name) { /* who we're masquerading as */ FILE *fp; int a; @@ -923,7 +907,6 @@ void make_message( if (recipient[0]!=0) fprintf(fp, "R%s%c", recipient, 0); if (dest_node[0]!=0) fprintf(fp, "D%s%c", dest_node, 0); - if (boundary[0]!=0) fprintf(fp, "Z%s%c", boundary, 0); putc('M',fp); @@ -950,7 +933,6 @@ void cmd_ent0(char *entargs) int anon_flag = 0; int format_type = 0; char newusername[256]; /* */ - char boundary[256]; int a,b; int e = 0; @@ -962,7 +944,6 @@ void cmd_ent0(char *entargs) extract(recipient,entargs,1); anon_flag = extract_int(entargs,2); format_type = extract_int(entargs,3); - extract(boundary, entargs, 5); /* first check to make sure the request is valid. */ @@ -1069,12 +1050,12 @@ SKFALL: b=MES_NORMAL; cprintf("%d send message\n",SEND_LISTING); if (CC->fake_postname[0]) - make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_postname, boundary); + make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_postname); else if (CC->fake_username[0]) - make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_username, boundary); + make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_username); else - make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, "", boundary); + make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, ""); save_message(CC->temp,buf,mtsflag,e,1); CC->fake_postname[0]='\0'; return; diff --git a/citadel/msgbase.h b/citadel/msgbase.h index 294e8c33f..550d27f24 100644 --- a/citadel/msgbase.h +++ b/citadel/msgbase.h @@ -19,7 +19,7 @@ void save_message (char *mtmp, char *rec, char mtsflag, int mailtype, void aide_message (char *text); void make_message (char *filename, struct usersupp *author, char *recipient, char *room, int type, int net_type, int format_type, - char *fake_name, char *separator); + char *fake_name); void cmd_ent0 (char *entargs); void cmd_ent3 (char *entargs); void cmd_dele (char *delstr); diff --git a/citadel/techdoc/session.txt b/citadel/techdoc/session.txt index ea78f28da..16f2a7f49 100644 --- a/citadel/techdoc/session.txt +++ b/citadel/techdoc/session.txt @@ -424,9 +424,7 @@ other MSG commands (MSG1, MSG2, etc.) will probably be added later on to read messages in more robust formats. This command should be passed two arguments. The first is the message number of the message being requested. In server version 4.04 and above, the second argument may be set to either 0 to read the -entire message, or 1 to read the headers only. In server version 6.00 and -above, the third argument may be set to the desired section of the message (if -there are attachments). +entire message, or 1 to read the headers only. The server should, of course, make sure that the client actually has access to the message being requested before honoring this request. Citadel/UX does @@ -670,8 +668,6 @@ message as anonymous, otherwise 0 for a normal message. typically be 0; see the MSG0 command above). 4 - Post name. When postflag is 2, this is the name you are posting as. This is an Aide only command. - 5 - Boundary string to be used when there are MIME attachments following -the normal message text. Possible result codes: OK - The request is valid. (Client did not set the "post" flag, so the