text client <.A>ide <S>ysconfig <I>nternet , when encountering a "directory" domain...
[citadel.git] / textclient / src / tuiconfig.c
index 8f6e4d56305fd83ec6e2292cc68d64113613d958..d89ab9ccf3c31baee83dd5ba24186d3550527032 100644 (file)
@@ -306,22 +306,11 @@ void do_system_configuration(CtdlIPC *ipc)
                        &sc[48][0], 127);
        }
 
-       /* Funambol push stuff */
-       int yes_funambol = 0;
-       if (strlen(sc[53]) > 0) yes_funambol = 1;
-       yes_funambol = boolprompt("Connect to an external Funambol sync server", yes_funambol);
-       if (yes_funambol) {
-               strprompt("Funambol server (blank to disable)", &sc[53][0], 63);
-               strprompt("Funambol server port", &sc[54][0], 5);
-               strprompt("Funambol sync source", &sc[55][0], 63);
-               strprompt("Funambol authentication details (user:pass in Base64)", &sc[56][0],63);
-       }
-       else {
-               sc[53][0] = 0;
-               sc[54][0] = 0;
-               sc[55][0] = 0;
-               sc[56][0] = 0;
-       }
+       /* No more Funambol */
+       sc[53][0] = 0;
+       sc[54][0] = 0;
+       sc[55][0] = 0;
+       sc[56][0] = 0;
 
        /* External pager stuff */
        int yes_pager = 0;
@@ -394,11 +383,10 @@ void get_inet_rec_type(CtdlIPC *ipc, char *buf) {
        keyopt(" <1> localhost      (Alias for this computer)\n");
        keyopt(" <2> smart host     (Forward all outbound mail to this host)\n");
        keyopt(" <3> fallback host  (Send mail to this host only if direct delivery fails)\n");
-       keyopt(" <4> directory      (Consult the Global Address Book)\n");
-       keyopt(" <5> SpamAssassin   (Address of SpamAssassin server)\n");
-       keyopt(" <6> RBL            (domain suffix of spam hunting RBL)\n");
-       keyopt(" <7> masq domains   (Domains as which users are allowed to masquerade)\n");
-       keyopt(" <8> ClamAV         (Address of ClamAV clamd server)\n");
+       keyopt(" <4> SpamAssassin   (Address of SpamAssassin server)\n");
+       keyopt(" <5> RBL            (domain suffix of spam hunting RBL)\n");
+       keyopt(" <6> masq domains   (Domains as which users are allowed to masquerade)\n");
+       keyopt(" <7> ClamAV         (Address of ClamAV clamd server)\n");
        sel = intprompt("Which one", 1, 1, 8);
        switch(sel) {
                case 1: strcpy(buf, "localhost");
@@ -407,15 +395,13 @@ void get_inet_rec_type(CtdlIPC *ipc, char *buf) {
                        return;
                case 3: strcpy(buf, "fallbackhost");
                        return;
-               case 4: strcpy(buf, "directory");
-                       return;
-               case 5: strcpy(buf, "spamassassin");
+               case 4: strcpy(buf, "spamassassin");
                        return;
-               case 6: strcpy(buf, "rbl");
+               case 5: strcpy(buf, "rbl");
                        return;
-               case 7: strcpy(buf, "masqdomain");
+               case 6: strcpy(buf, "masqdomain");
                        return;
-               case 8: strcpy(buf, "clamav");
+               case 7: strcpy(buf, "clamav");
                        return;
        }
 }
@@ -441,6 +427,13 @@ void do_internet_configuration(CtdlIPC *ipc)
                while (!IsEmptyStr(resp)) {
                        extract_token(buf, resp, 0, '\n', sizeof buf);
                        remove_token(resp, 0, '\n');
+
+                       // VILE SLEAZY HACK: replace obsolete "directory" domains with "localhost"
+                       char *d = strstr(buf, "|directory");
+                       if (d != NULL) {
+                               strcpy(d, "|localhost");
+                       }
+
                        ++num_recs;
                        if (num_recs == 1) recs = malloc(sizeof(char *));
                        else recs = realloc(recs, (sizeof(char *)) * num_recs);
@@ -471,29 +464,29 @@ void do_internet_configuration(CtdlIPC *ipc)
                ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
                switch(ch) {
                        case 'a':
-                               newprompt("Enter host name: ",
-                                       buf, 50);
+                               newprompt("Enter host name: ", buf, 50);
                                striplt(buf);
                                if (!IsEmptyStr(buf)) {
                                        ++num_recs;
-                                       if (num_recs == 1)
+                                       if (num_recs == 1) {
                                                recs = malloc(sizeof(char *));
-                                       else recs = realloc(recs,
-                                               (sizeof(char *)) * num_recs);
+                                       }
+                                       else {
+                                               recs = realloc(recs, (sizeof(char *)) * num_recs);
+                                       }
                                        strcat(buf, "|");
-                                       get_inet_rec_type(ipc,
-                                                       &buf[strlen(buf)]);
+                                       get_inet_rec_type(ipc, &buf[strlen(buf)]);
                                        recs[num_recs-1] = strdup(buf);
                                }
                                modified = 1;
                                break;
                        case 'd':
-                               i = intprompt("Delete which one",
-                                       1, 1, num_recs) - 1;
+                               i = intprompt("Delete which one", 1, 1, num_recs) - 1;
                                free(recs[i]);
                                --num_recs;
-                               for (j=i; j<num_recs; ++j)
+                               for (j=i; j<num_recs; ++j) {
                                        recs[j] = recs[j+1];
+                               }
                                modified = 1;
                                break;
                        case 's':
@@ -555,8 +548,7 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment)
        int r;
 
        if (IsEmptyStr(editor_path)) {
-               scr_printf("You must have an external editor configured in"
-                       " order to use this function.\n");
+               scr_printf("You must have an external editor configured in order to use this function.\n");
                return;
        }