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)
52 fp = fopen(TABLEFILE, "r");
53 while (fgets(buf, 128, fp) != NULL) {
54 buf[strlen(buf) - 1] = 0;
55 for (a = 0; a < strlen(buf); ++a) {
56 if ((buf[a] == ',') && (!strcasecmp(&buf[a + 1], room))) {
57 strcpy(listaddr, buf);
68 * The main loop. We don't need any command-line parameters to this program.
74 char fields[32][1024];
86 strcpy(tempfile, tmpnam(NULL));
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)));
114 /**********************************************************/
115 /* Only send messages which originated on the Citadel net */
116 /* (In other words, from node names with no dots in them) */
118 if (fields[num_fields][0] == 'N') {
120 for (i = 1; i < strlen(&fields[num_fields][1]); ++i) {
121 if (fields[num_fields][i] == '.') {
126 /**********************************************************/
128 if (fields[num_fields][0] == 'O') {
129 xref(&fields[num_fields][1], listaddr);
131 if (fields[num_fields][0] != 'R')
134 /* flush the message out to the next program */
136 nm = fopen(tempfile, "wb");
137 fprintf(nm, "%c%c%c",
138 header[0], header[1], header[2]);
139 for (a = 0; a < num_fields; ++a) {
140 fprintf(nm, "%s%c", &fields[a][0], 0);
142 fprintf(nm, "R%s%c", listaddr, 0);
148 } while ((ch != 0) && (!feof(stdin)));
152 sprintf(mailcmd, "exec ./netmailer %s mlist", tempfile);