/* * Reply to a series of messages by simply mailing to the senders * and not messing around with the To: and Cc: lists as in normal * reply. */ int doRespond(int *msgvec) { struct header head; struct message *mp; int *ap; char *cp, *mid; head.h_to = NULL; for (ap = msgvec; *ap != 0; ap++) { mp = &message[*ap - 1]; touch(mp); dot = mp; if ((cp = skin(hfield("from", mp))) == NULL) cp = skin(nameof(mp, 2)); head.h_to = cat(head.h_to, extract(cp, GTO)); mid = skin(hfield("message-id", mp)); } if (head.h_to == NULL) return (0); mp = &message[msgvec[0] - 1]; if ((head.h_subject = hfield("subject", mp)) == NULL) head.h_subject = hfield("subj", mp); head.h_subject = reedit(head.h_subject); head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; head.h_replyto = value("REPLYTO"); head.h_inreplyto = mid; mail1(&head, 1); return (0); }
/* * Reply to a list of messages. Extract each name from the * message header and send them off to mail1() */ int dorespond(int *msgvec) { struct message *mp; char *cp, *rcv, *replyto; char **ap; struct name *np; struct header head; if (msgvec[1] != 0) { printf("Sorry, can't reply to multiple messages at once\n"); return (1); } mp = &message[msgvec[0] - 1]; touch(mp); dot = mp; if ((rcv = skin(hfield("from", mp))) == NULL) rcv = skin(nameof(mp, 1)); if ((replyto = skin(hfield("reply-to", mp))) != NULL) np = extract(replyto, GTO); else if ((cp = skin(hfield("to", mp))) != NULL) np = extract(cp, GTO); else np = NULL; np = elide(np); /* * Delete my name from the reply list, * and with it, all my alternate names. */ np = delname(np, myname); if (altnames) for (ap = altnames; *ap != NULL; ap++) np = delname(np, *ap); if (np != NULL && replyto == NULL) np = cat(np, extract(rcv, GTO)); else if (np == NULL) { if (replyto != NULL) printf("Empty reply-to field -- replying to author\n"); np = extract(rcv, GTO); } head.h_to = np; if ((head.h_subject = hfield("subject", mp)) == NULL) head.h_subject = hfield("subj", mp); head.h_subject = reedit(head.h_subject); if (replyto == NULL && (cp = skin(hfield("cc", mp))) != NULL) { np = elide(extract(cp, GCC)); np = delname(np, myname); if (altnames != 0) for (ap = altnames; *ap != NULL; ap++) np = delname(np, *ap); head.h_cc = np; } else head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; head.h_replyto = value("REPLYTO"); head.h_inreplyto = skin(hfield("message-id", mp)); mail1(&head, 1); return (0); }
int mail(char **people) { register char *cp2, *cp3; register int s; char *buf, **ap; struct header head; for (s = 0, ap = people; *ap; ap++) s += strlen(*ap) + 2; buf = (char *)salloc((unsigned)(s+1)); cp2 = buf; for (ap = people; *ap; ap++) { for (cp3 = *ap; *cp3; ) { if (*cp3 == ' ' || *cp3 == '\t') { *cp3++ = ','; while (*cp3 == ' ' || *cp3 == '\t') cp3++; } else cp3++; } cp2 = copy(*ap, cp2); *cp2++ = ','; *cp2++ = ' '; } *cp2 = '\0'; head.h_to = buf; head.h_subject = head.h_cc = head.h_bcc = head.h_defopt = NOSTR; head.h_others = NOSTRPTR; head.h_seq = 0; mail1(&head, Fflag, NOSTR); return(0); }
/* * Interface to the mail1 routine for the -t flag * (read headers from text). */ int tmail(void) { struct header head; head.h_to = NOSTR; head.h_subject = head.h_cc = head.h_bcc = head.h_defopt = NOSTR; head.h_others = NOSTRPTR; head.h_seq = 0; mail1(&head, Fflag, NOSTR); return(0); }
/* * Send mail to a bunch of user names. The interface is through * the mail routine below. */ int sendmail(void *v) { char *str = v; struct header head; head.h_to = extract(str, GTO); head.h_subject = NULL; head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; mail1(&head, 0); return(0); }
/* * Interface between the argument list and the mail1 routine * which does all the dirty work. */ int mail(struct name *to, struct name *cc, struct name *bcc, struct name *smopts, char *subject) { struct header head; head.h_to = to; head.h_subject = subject; head.h_cc = cc; head.h_bcc = bcc; head.h_smopts = smopts; mail1(&head, 0); return(0); }
/* * Send mail to a bunch of user names. The interface is through * the mail routine below. */ int sendmail(char *str) { struct header head; head.h_to = extract(str, GTO); head.h_subject = NULL; head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; head.h_replyto = value("REPLYTO"); head.h_inreplyto = NULL; mail1(&head, 0); return (0); }
/* * Send mail to a bunch of user names. The interface is through * the mail routine below. * save a copy of the letter */ static int Sendmail(char *str) { struct header head; if (blankline(str)) head.h_to = NOSTR; else head.h_to = addto(NOSTR, str); head.h_subject = head.h_cc = head.h_bcc = head.h_defopt = NOSTR; head.h_others = NOSTRPTR; head.h_seq = 0; mail1(&head, 1, NOSTR); return(0); }
/* * Interface between the argument list and the mail1 routine * which does all the dirty work. */ int mail(struct name *to, struct name *cc, struct name *bcc, struct name *smopts, char *subject, char *replyto) { struct header head; head.h_to = to; head.h_subject = subject; head.h_cc = cc; head.h_bcc = bcc; head.h_smopts = smopts; head.h_replyto = replyto; head.h_inreplyto = NULL; mail1(&head, 0); return (0); }