4 * This program is designed to be a filter which allows two-way interaction
5 * between a traditional e-mail mailing list and a Citadel room.
7 * It only handles the outbound side. The inbound side is handled by the
8 * Citadel e-mail gateway. You should subscribe rooms to lists using the
9 * "room_roomname@node.dom" type address.
11 * Since some listprocs only accept postings from subscribed addresses, the
12 * messages which this program converts will all appear to be from the room
13 * address; however, the full name of the sender is set to the Citadel user
14 * name of the real message author.
16 * To prevent loops, this program only sends messages originating on the local
17 * system. Therefore it is not possible to carry a two-way mailing list room
18 * on a Citadel network.
28 void LoadInternetConfig(void);
29 void get_config(void);
38 char OUTGOING_FQDN[128];
42 * Consult the mailinglists table to find out where we should send the
43 * mailing list postings to.
45 void xref(char *room, char *listaddr) /* xref table */
53 fp=fopen(TABLEFILE, "r");
54 while (fgets(buf,128,fp)!=NULL) {
56 for (a=0; a<strlen(buf); ++a) {
57 if ( (buf[a]==',') && (!strcasecmp(&buf[a+1],room)) ) {
69 * The main loop. We don't need any command-line parameters to this program.
74 char fields[32][1024];
86 sprintf(tempfile, "/tmp/mlist.%d", getpid() );
90 /* seek to the next message */
97 } while (getc(stdin) != 255);
100 header[1] = getc(stdin);
101 header[2] = getc(stdin);
106 fields[num_fields][0] = getc(stdin);
107 if (fields[num_fields][0] != 'M') {
111 fields[num_fields][p++] = ch;
112 } while ((ch!=0) && (!feof(stdin)));
113 if (fields[num_fields][0] == 'N') {
114 if (!strcmp(&fields[num_fields][1],
119 if (fields[num_fields][0] == 'O') {
120 xref(&fields[num_fields][1], listaddr);
122 if (fields[num_fields][0]!='R') ++num_fields;
125 /* flush the message out to the next program */
127 nm = fopen(tempfile, "wb");
128 fprintf(nm, "%c%c%c",
129 header[0], header[1], header[2]);
130 for (a=0; a<num_fields; ++a) {
131 fprintf(nm, "%s%c", &fields[a][0], 0);
133 fprintf(nm, "R%s%c", listaddr, 0);
139 } while ((ch!=0) && (!feof(stdin)));
143 sprintf(mailcmd, "exec netmailer %s mlist", tempfile);