fix dlen
[citadel.git] / textclient / tuiconfig.c
index 12038ba91276a62c7ba96417fb230640f6b5cedd..28a10ed15748772d5808a44bde2da45c30949b42 100644 (file)
@@ -2,13 +2,7 @@
 //
 // Copyright (c) 1987-2022 by the citadel.org team
 //
-// This program is open source software.  Use, duplication, and/or
-// disclosure are subject to the GNU General Purpose License version 3.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
+// This program is open source software.  Use, duplication, or disclosure is subject to the GNU General Public License version 3.
 
 #include "textclient.h"
 
@@ -71,10 +65,12 @@ void do_system_configuration(CtdlIPC * ipc) {
        strprompt("Initial access level for new users", &sc[6][0], 1);
        strprompt("Access level required to create rooms", &sc[19][0], 1);
        snprintf(sc[67], sizeof sc[67], "%d", (boolprompt("Allow anonymous guest logins", atoi(&sc[67][0]))));
-       snprintf(sc[4], sizeof sc[4], "%d", (boolprompt("Automatically give room admin privs to a user who creates a private room", atoi(&sc[4][0]))));
+       snprintf(sc[4], sizeof sc[4], "%d",
+                (boolprompt("Automatically give room admin privs to a user who creates a private room", atoi(&sc[4][0]))));
        snprintf(sc[8], sizeof sc[8], "%d", (boolprompt("Automatically move problem user messages to twit room", atoi(&sc[8][0]))));
        strprompt("Name of twit room", &sc[9][0], ROOMNAMELEN);
-       snprintf(sc[11], sizeof sc[11], "%d", (boolprompt("Restrict Internet mail to only those with that privilege", atoi(&sc[11][0]))));
+       snprintf(sc[11], sizeof sc[11], "%d",
+                (boolprompt("Restrict Internet mail to only those with that privilege", atoi(&sc[11][0]))));
        snprintf(sc[26], sizeof sc[26], "%d", (boolprompt("Allow admins to Zap (forget) rooms", atoi(&sc[26][0]))));
 
        if (!IsEmptyStr(&sc[18][0])) {
@@ -106,6 +102,7 @@ void do_system_configuration(CtdlIPC * ipc) {
        strprompt("SMTP MTA server port (-1 to disable)", &sc[24][0], 5);
        strprompt("SMTP MSA server port (-1 to disable)", &sc[38][0], 5);
        strprompt("SMTPS server port (-1 to disable)", &sc[41][0], 5);
+       snprintf(sc[72], sizeof sc[72], "%d", (boolprompt("Advertise STARTTLS on the SMTP port", atoi(&sc[72][0]))));
        strprompt("NNTP server port (-1 to disable)", &sc[70][0], 5);
        strprompt("NNTPS server port (-1 to disable)", &sc[71][0], 5);
        strprompt("Postfix TCP Dictionary Port server port (-1 to disable)", &sc[50][0], 5);
@@ -129,8 +126,10 @@ void do_system_configuration(CtdlIPC * ipc) {
        a = (a ? 0 : 1);
        snprintf(sc[61], sizeof sc[61], "%d", a);
 
-       snprintf(sc[45], sizeof sc[45], "%d", (boolprompt("Allow unauthenticated SMTP clients to spoof my domains", atoi(&sc[45][0]))));
-       snprintf(sc[57], sizeof sc[57], "%d", (boolprompt("Perform RBL checks at greeting instead of after RCPT", atoi(&sc[57][0]))));
+       snprintf(sc[45], sizeof sc[45], "%d",
+                (boolprompt("Allow unauthenticated SMTP clients to spoof my domains", atoi(&sc[45][0]))));
+       snprintf(sc[57], sizeof sc[57], "%d",
+                (boolprompt("Perform RBL checks at greeting instead of after RCPT", atoi(&sc[57][0]))));
 
        // LDAP settings
        if (ipc->ServInfo.supports_ldap) {
@@ -206,7 +205,8 @@ void do_system_configuration(CtdlIPC * ipc) {
        strprompt("Default frequency to run POP3 collection (in seconds)", &sc[64][0], 5);
        strprompt("Fastest frequency to run POP3 collection (in seconds)", &sc[65][0], 5);
        strprompt("Hour to run purges (0-23)", &sc[31][0], 2);
-       snprintf(sc[42], sizeof sc[42], "%d", (boolprompt("Enable full text search index (warning: resource intensive)", atoi(&sc[42][0]))));
+       snprintf(sc[42], sizeof sc[42], "%d",
+                (boolprompt("Enable full text search index (warning: resource intensive)", atoi(&sc[42][0]))));
        snprintf(sc[46], sizeof sc[46], "%d", (boolprompt("Perform journaling of email messages", atoi(&sc[46][0]))));
        snprintf(sc[47], sizeof sc[47], "%d", (boolprompt("Perform journaling of non-email messages", atoi(&sc[47][0]))));
        if ((atoi(&sc[46][0])) || (atoi(&sc[47][0]))) {
@@ -369,7 +369,7 @@ void do_internet_configuration(CtdlIPC * ipc) {
                switch (ch) {
                case 'a':
                        newprompt("Enter host name: ", buf, 50);
-                       striplt(buf);
+                       string_trim(buf);
                        if (!IsEmptyStr(buf)) {
                                ++num_recs;
                                if (num_recs == 1) {
@@ -544,7 +544,7 @@ void network_config_management(CtdlIPC * ipc, char *entrytype, char *comment) {
                                if (buf[i] == '#')
                                        buf[i] = 0;
                        }
-                       striplt(buf);
+                       string_trim(buf);
                        if (!IsEmptyStr(buf)) {
                                fprintf(changefp, "%s|%s\n", entrytype, buf);
                        }
@@ -637,7 +637,8 @@ void do_pop3client_configuration(CtdlIPC * ipc) {
                        ++num_recs;
                        if (num_recs == 1) {
                                recs = malloc(sizeof(char *));
-                       } else {
+                       }
+                       else {
                                recs = realloc(recs, (sizeof(char *)) * num_recs);
                        }
                        strcpy(buf, "pop3client|");