4 * Functions which handle Internet domain configuration etc.
12 void display_inetconf(void)
29 char *ic_spec[ic_max];
31 char *ic_keyword[ic_max];
32 char *ic_boxtitle[ic_max];
33 char *ic_desc[ic_max];
35 ic_keyword[0] = _("localhost");
36 ic_keyword[1] = _("directory");
37 ic_keyword[2] = _("gatewaydomain");
38 ic_keyword[3] = _("smarthost");
39 ic_keyword[4] = _("rbl");
40 ic_keyword[5] = _("spamassassin");
42 ic_boxtitle[0] = _("Local host aliases");
43 ic_boxtitle[1] = _("Directory domains");
44 ic_boxtitle[2] = _("Gateway domains");
45 ic_boxtitle[3] = _("Smart hosts");
46 ic_boxtitle[4] = _("RBL hosts");
47 ic_boxtitle[5] = _("SpamAssassin hosts");
49 ic_desc[0] = _("(domains for which this host receives mail)");
50 ic_desc[1] = _("(domains mapped with the Global Address Book)");
51 ic_desc[2] = _("(domains whose subdomains match Citadel hosts)");
52 ic_desc[3] = _("(if present, forward all outbound mail to one of these hosts)");
53 ic_desc[4] = _("(hosts running a Realtime Blackhole List)");
54 ic_desc[5] = _("(hosts running the SpamAssassin service)");
56 for (i=0; i<ic_max; ++i) {
57 ic_spec[i] = strdup("");
61 serv_printf("CONF GETSYS|application/x-citadel-internet-config");
62 serv_getln(buf, sizeof buf);
63 if (buf[0] == '1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
65 extract_token(ename, buf, 0, '|', sizeof ename);
66 extract_token(etype, buf, 1, '|', sizeof etype);
68 for (i=0; i<ic_max; ++i) {
69 if (!strcasecmp(etype, ic_keyword[i])) {
75 ic_spec[which] = realloc(ic_spec[which], strlen(ic_spec[which]) + strlen(ename) + 2);
76 if (strlen(ic_spec[which]) > 0) strcat(ic_spec[which], "\n");
77 strcat(ic_spec[which], ename);
80 ic_misc = realloc(ic_misc, strlen(ic_misc) + strlen(buf) + 2);
81 if (strlen(ic_misc) > 0) strcat(ic_misc, "\n");
87 output_headers(1, 1, 2, 0, 0, 0);
88 wprintf("<div id=\"banner\">\n");
89 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
90 wprintf("<SPAN CLASS=\"titlebar\">");
91 wprintf(_("Internet configuration"));
93 wprintf("</TD></TR></TABLE>\n");
94 wprintf("</div>\n<div id=\"content\">\n");
96 wprintf("<div class=\"fix_scrollbar_bug\">"
97 "<table border=0 width=100%%><tr><td valign=top>\n");
98 for (which=0; which<ic_max; ++which) {
99 if (which == (ic_max / 2)) {
100 wprintf("</TD><TD VALIGN=TOP>");
102 svprintf("BOXTITLE", WCS_STRING, ic_boxtitle[which]);
103 do_template("beginbox");
104 wprintf("<span class=\"menudesc\">");
105 escputs(ic_desc[which]);
106 wprintf("</span><br />");
107 wprintf("<TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>\n");
108 if (strlen(ic_spec[which]) > 0) {
109 for (i=0; i<num_tokens(ic_spec[which], '\n'); ++i) {
110 wprintf("<TR><TD ALIGN=LEFT>");
111 extract_token(buf, ic_spec[which], i, '\n', sizeof buf);
113 wprintf("</TD><TD ALIGN=RIGHT>"
114 "<a href=\"save_inetconf?oper=delete&ename=");
116 wprintf("&etype=%s\" ", ic_keyword[which]);
117 wprintf("onClick=\"return confirm('%s');\">",
118 _("Delete this entry?"));
119 wprintf("<font size=-1>");
120 wprintf(_("(Delete)"));
121 wprintf("</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 has been 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"));