* 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 <bryant@cs.usm.maine.edu>
* setup.c: create citadel.config with mode 0600
# 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
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);
}
-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");
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;
{ /* */
char buf[300];
char cmd[256];
- char boundary[256];
int a,b;
int need_recp = 0;
int mode;
}
/* 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') {
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;
time_t xtime = 0L;
/* */
- strcpy(boundary, "");
msg_num = atol(msgid);
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);
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 {
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;
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);
int anon_flag = 0;
int format_type = 0;
char newusername[256]; /* <bc> */
- char boundary[256];
int a,b;
int e = 0;
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. */
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;
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);
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
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