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];
40 int struncmp(lstr,rstr,len)
46 lc=tolower(lstr[pos]);
47 rc=tolower(rstr[pos]);
48 if ((lc==0)&&(rc==0)) return(0);
49 if (lc<rc) return(-1);
57 * Consult the mailinglists table to find out where we should send the
58 * mailing list postings to.
60 void xref(room,listaddr) /* xref table */
68 fp=fopen(TABLEFILE, "r");
69 while (fgets(buf,128,fp)!=NULL) {
71 for (a=0; a<strlen(buf); ++a) {
72 if ( (buf[a]==',') && (!strucmp(&buf[a+1],room)) ) {
84 * The main loop. We don't need any command-line parameters to this program.
89 char fields[32][1024];
100 LoadInternetConfig();
101 sprintf(tempfile, "/tmp/mlist.%d", getpid() );
105 /* seek to the next message */
112 } while (getc(stdin) != 255);
115 header[1] = getc(stdin);
116 header[2] = getc(stdin);
121 fields[num_fields][0] = getc(stdin);
122 if (fields[num_fields][0] != 'M') {
126 fields[num_fields][p++] = ch;
127 } while ((ch!=0) && (!feof(stdin)));
128 if (fields[num_fields][0] == 'N') {
129 if (!strcmp(&fields[num_fields][1],
134 if (fields[num_fields][0] == 'O') {
135 xref(&fields[num_fields][1], listaddr);
137 if (fields[num_fields][0]!='R') ++num_fields;
140 /* flush the message out to the next program */
142 nm = fopen(tempfile, "wb");
143 fprintf(nm, "%c%c%c",
144 header[0], header[1], header[2]);
145 for (a=0; a<num_fields; ++a) {
146 fprintf(nm, "%s%c", &fields[a][0], 0);
148 fprintf(nm, "R%s%c", listaddr, 0);
154 } while ((ch!=0) && (!feof(stdin)));
158 sprintf(mailcmd, "exec netmailer %s mlist", tempfile);