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.
27 void LoadInternetConfig();
37 char OUTGOING_FQDN[128];
41 * Consult the mailinglists table to find out where we should send the
42 * mailing list postings to.
44 void xref(room,listaddr) /* xref table */
52 fp=fopen(TABLEFILE, "r");
53 while (fgets(buf,128,fp)!=NULL) {
55 for (a=0; a<strlen(buf); ++a) {
56 if ( (buf[a]==',') && (!strcasecmp(&buf[a+1],room)) ) {
68 * The main loop. We don't need any command-line parameters to this program.
73 char fields[32][1024];
85 sprintf(tempfile, "/tmp/mlist.%d", getpid() );
89 /* seek to the next message */
96 } while (getc(stdin) != 255);
99 header[1] = getc(stdin);
100 header[2] = getc(stdin);
105 fields[num_fields][0] = getc(stdin);
106 if (fields[num_fields][0] != 'M') {
110 fields[num_fields][p++] = ch;
111 } while ((ch!=0) && (!feof(stdin)));
112 if (fields[num_fields][0] == 'N') {
113 if (!strcmp(&fields[num_fields][1],
118 if (fields[num_fields][0] == 'O') {
119 xref(&fields[num_fields][1], listaddr);
121 if (fields[num_fields][0]!='R') ++num_fields;
124 /* flush the message out to the next program */
126 nm = fopen(tempfile, "wb");
127 fprintf(nm, "%c%c%c",
128 header[0], header[1], header[2]);
129 for (a=0; a<num_fields; ++a) {
130 fprintf(nm, "%s%c", &fields[a][0], 0);
132 fprintf(nm, "R%s%c", listaddr, 0);
138 } while ((ch!=0) && (!feof(stdin)));
142 sprintf(mailcmd, "exec netmailer %s mlist", tempfile);