4 * Functions which handle Internet domain configuration etc.
12 void display_inetconf(void)
29 char *ic_spec[ic_max];
32 char *ic_keyword[] = {
41 char *ic_boxtitle[] = {
51 "(domains for which this host receives mail)",
52 "(domains mapped with the Global Address Book)",
53 "(domains whose subdomains match Citadel hosts)",
54 "(if present, forward all outbound mail to one of these hosts)",
55 "(hosts running a Realtime Blackhole List)",
56 "(hosts running the SpamAssassin service)",
59 for (i=0; i<ic_max; ++i) {
60 ic_spec[i] = strdup("");
64 serv_printf("CONF GETSYS|application/x-citadel-internet-config");
65 serv_getln(buf, sizeof buf);
66 if (buf[0] == '1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
68 extract_token(ename, buf, 0, '|', sizeof ename);
69 extract_token(etype, buf, 1, '|', sizeof etype);
71 for (i=0; i<ic_max; ++i) {
72 if (!strcasecmp(etype, ic_keyword[i])) {
78 ic_spec[which] = realloc(ic_spec[which], strlen(ic_spec[which]) + strlen(ename) + 2);
79 if (strlen(ic_spec[which]) > 0) strcat(ic_spec[which], "\n");
80 strcat(ic_spec[which], ename);
83 ic_misc = realloc(ic_misc, strlen(ic_misc) + strlen(buf) + 2);
84 if (strlen(ic_misc) > 0) strcat(ic_misc, "\n");
90 output_headers(1, 1, 2, 0, 0, 0, 0);
91 wprintf("<div id=\"banner\">\n");
92 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
93 wprintf("<SPAN CLASS=\"titlebar\">Internet configuration</SPAN>\n");
94 wprintf("</TD></TR></TABLE>\n");
95 wprintf("</div>\n<div id=\"content\">\n");
97 wprintf("<div id=\"fix_scrollbar_bug\">"
98 "<table border=0 width=100%%><tr><td valign=top>\n");
99 for (which=0; which<ic_max; ++which) {
100 if (which == (ic_max / 2)) {
101 wprintf("</TD><TD VALIGN=TOP>");
103 svprintf("BOXTITLE", WCS_STRING, ic_boxtitle[which]);
104 do_template("beginbox");
105 wprintf("<span class=\"menudesc\">");
106 escputs(ic_desc[which]);
107 wprintf("</span><br />");
108 wprintf("<TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>\n");
109 if (strlen(ic_spec[which]) > 0) {
110 for (i=0; i<num_tokens(ic_spec[which], '\n'); ++i) {
111 wprintf("<TR><TD ALIGN=LEFT>");
112 extract_token(buf, ic_spec[which], i, '\n', sizeof buf);
114 wprintf("</TD><TD ALIGN=RIGHT>"
115 "<A HREF=\"/save_inetconf?oper=delete&ename=");
117 wprintf("&etype=%s\" ", ic_keyword[which]);
118 wprintf("onClick=\"return confirm('Delete ");
121 wprintf("<font size=-1>(Delete)</font></a></TD></TR>\n");
124 wprintf("<FORM METHOD=\"POST\" ACTION=\"/save_inetconf\">\n"
126 "<INPUT TYPE=\"text\" NAME=\"ename\" MAXLENGTH=\"64\">"
127 "<INPUT TYPE=\"hidden\" NAME=\"etype\" VALUE=\"%s\">", ic_keyword[which]);
128 wprintf("</TD><TD ALIGN=RIGHT>"
129 "<INPUT TYPE=\"submit\" NAME=\"oper\" VALUE=\"Add\">"
130 "</TD></TR></TABLE></FORM>\n");
131 do_template("endbox");
133 wprintf("</td></tr></table></div>\n");
136 for (i=0; i<ic_max; ++i) {
143 void save_inetconf(void) {
152 newconfig = malloc(65536);
154 strcpy(newconfig, "");
155 serv_printf("CONF GETSYS|application/x-citadel-internet-config");
156 serv_getln(buf, SIZ);
157 if (buf[0] == '1') while (serv_getln(buf, SIZ), strcmp(buf, "000")) {
158 extract_token(ename, buf, 0, '|', SIZ);
159 extract_token(etype, buf, 1, '|', SIZ);
160 if (strlen(buf) == 0) {
161 /* skip blank lines */
163 else if ((!strcasecmp(ename, bstr("ename")))
164 && (!strcasecmp(etype, bstr("etype")))
165 && (!strcasecmp(bstr("oper"), "delete"))
167 sprintf(WC->ImportantMessage, "%s deleted.", ename);
170 if (strlen(newconfig) > 0) strcat(newconfig, "\n");
171 strcat(newconfig, buf);
175 serv_printf("CONF PUTSYS|application/x-citadel-internet-config");
176 serv_getln(buf, SIZ);
178 serv_puts(newconfig);
179 if (!strcasecmp(bstr("oper"), "add")) {
180 serv_printf("%s|%s", bstr("ename"), bstr("etype") );
181 sprintf(WC->ImportantMessage, "%s added.", bstr("ename"));