- } while ( (strcmp(buf, ".")) && (strcmp(buf, "")) );
-
- process_rfc822_addr(from, userbuf, nodebuf, frombuf);
-
- if (!strncasecmp(content_type, "text/plain", 10))
- format_type = 1; /* plain ASCII message */
- else
- format_type = 4; /* MIME message */
-
- /* now convert it to Citadel format */
-
- /* Header bytes */
- putc(255, temp); /* 0xFF = start-of-message byte */
- putc(MES_NORMAL, temp); /* Non-anonymous message */
- putc(format_type, temp); /* Format type */
-
- /* Origination */
- fprintf(temp,"P%s@%s%c", userbuf, nodebuf, 0);
- fprintf(temp,"T%ld%c", now, 0);
- fprintf(temp,"A%s%c", userbuf, 0);
-
- /* Destination */
- if (strlen(targetroom) > 0) {
- fprintf(temp, "O%s%c", targetroom, 0);
- }
- else {
- fprintf(temp, "O%s%c", MAILROOM, 0);
- }
-
- fprintf(temp,"N%s%c", nodebuf, 0);
- fprintf(temp,"H%s%c", frombuf, 0);
- if (dtype==REMOTE) {
- fprintf(temp,"D%s%c", destsys, 0);
- }
-
- if (strlen(recp) > 0) {
- fprintf(temp,"R%s%c", recp, 0);
- }
-
- /* Subject and text */
- if (strlen(subject)>0) {
- fprintf(temp,"U%s%c", subject, 0);
- }
- putc('M',temp);
- if (format_type == 4) {
- fprintf(temp, "Content-type: %s\n", content_type);
- if (extra_headers != NULL)
- fprintf(temp, "%s", extra_headers);
- fprintf(temp, "\n");
- }
- if (extra_headers != NULL) free(extra_headers);
- if (strcmp(buf, ".")) loopcopy(temp, stdin);
- putc(0,temp);
- fclose(temp);
- }
-
-
-void do_uudecode(char *target)
-{
- static char buf[1024];
- FILE *fp;
-
- snprintf(buf,sizeof buf,"cd %s; uudecode",target);
-
- fp=popen(buf,"w");
- if (fp==NULL) return;
- while (fgets(buf,1024,stdin)!=NULL) {
- fprintf(fp,"%s",buf);
- }
- pclose(fp);
-
- }
-
-int alias(char *name)
-{
- FILE *fp;
- int a;
- char abuf[256];
-
- fp=fopen(ALIASES,"r");
- if (fp==NULL) {
- syslog(LOG_ERR,"cannot open %s: %s",ALIASES,strerror(errno));
- return(2);
- }