if (strcasecmp(name,aaa)) goto GNA;
fclose(fp);
strcpy(name,bbb);
- /* cprintf("*** Mail is being forwarded to %s\n",name); */
+ lprintf(7, "Mail is being forwarded to %s\n", name);
DETYPE: /* determine local or remote type, see citadel.h */
for (a=0; a<strlen(name); ++a) if (name[a]=='!') return(M_INTERNET);
if (name[b]=='.') return(M_INTERNET);
b=0; for (a=0; a<strlen(name); ++a) if (name[a]=='@') ++b;
if (b>1) {
- /* cprintf("Too many @'s in address\n"); */
+ lprintf(7, "Too many @'s in address\n");
return(M_ERROR);
}
if (b==1) {
char buf[1024];
long msg_len;
int msg_ok = 0;
+ char boundary[256]; /* attachment boundary */
+ char current_section = 0; /* section currently being parsed */
+ char desired_section = 0; /* section desired for printing */
+ int has_attachments = 0;
struct cdbdata *dmsgtext;
char *mptr;
long xtime;
/* */
+ 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) ) {
- cprintf("%s\n", buf);
+ 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);
+ }
+ }
strcpy(buf, "");
}
else {
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 *separator) { /* separator (if exist attachments) */
+ char *boundary) { /* boundary (if exist attachments) */
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 (separator[0]!=0) fprintf(fp, "Z%s%c", separator, 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 separator[256];
+ char boundary[256];
int a,b,e;
int mtsflag = 0;
extract(recipient,entargs,1);
anon_flag = extract_int(entargs,2);
format_type = extract_int(entargs,3);
- extract(separator, entargs, 4);
+ extract(boundary, entargs, 4);
/* 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, separator);
+ make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_postname, boundary);
else
if (CC->fake_username[0])
- make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_username, separator);
+ make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_username, boundary);
else
- make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, "", separator);
+ make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, "", boundary);
save_message(CC->temp,buf,mtsflag,e,1);
CC->fake_postname[0]='\0';
return;