Site config protocol and UI for XMPP port numbers
authorArt Cancro <ajc@citadel.org>
Mon, 3 Dec 2007 07:57:09 +0000 (07:57 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 3 Dec 2007 07:57:09 +0000 (07:57 +0000)
citadel/citadel.h
citadel/control.c
citadel/include/dtds/config-defs.h
citadel/modules/jabber/serv_xmpp.c
citadel/modules/upgrade/serv_upgrade.c
citadel/setup.c
citadel/tuiconfig.c
webcit/siteconfig.c

index e7381e077b46fc548067f12b3d266be6dfcc3649..5963a6a19aa215f69c5746854b4415127cfa255b 100644 (file)
@@ -47,9 +47,9 @@ extern "C" {
  * usually more strict because you're not really supposed to dump/load and
  * upgrade at the same time.
  */
-#define REV_LEVEL      724             /* This version */
+#define REV_LEVEL      725             /* This version */
 #define REV_MIN                591             /* Oldest compatible database */
-#define EXPORT_REV_MIN 722             /* Oldest compatible export files */
+#define EXPORT_REV_MIN 725             /* Oldest compatible export files */
 
 #define SERVER_TYPE 0                  /* zero for stock Citadel; other developers please
                                           obtain SERVER_TYPE codes for your implementations */
index e142504c661d847784be09ae1f616149aa4dea01..f03aea7b35d4662a8f7eafc324525c4a4582383c 100644 (file)
@@ -330,6 +330,8 @@ void cmd_conf(char *argbuf)
                cprintf("%s\n", config.c_master_pass);
                cprintf("%s\n", config.c_pager_program);
                cprintf("%d\n", config.c_imap_keep_from);
+               cprintf("%d\n", config.c_xmpp_c2s_port);
+               cprintf("%d\n", config.c_xmpp_s2s_port);
                cprintf("000\n");
        }
 
@@ -571,6 +573,12 @@ void cmd_conf(char *argbuf)
                        case 61:
                                config.c_imap_keep_from = atoi(buf);
                                break;
+                       case 62:
+                               config.c_xmpp_c2s_port = atoi(buf);
+                               break;
+                       case 63:
+                               config.c_xmpp_s2s_port = atoi(buf);
+                               break;
                        }
                        ++a;
                }
index cfdea8cc9583174238127ccedb426484b2c2078a..6deaa90c21fcfa82db8d159403ea7686c623b601 100644 (file)
@@ -84,3 +84,5 @@ CFG_VALUE(STRING_BUF(c_master_user, 32),      " Master user name ");
 CFG_VALUE(STRING_BUF(c_master_pass, 32),       " Master user password ");
 CFG_VALUE(STRING_BUF(c_pager_program, 256),    " External pager program (blank to disable)");
 CFG_VALUE(CHAR(c_imap_keep_from),              " IMAP keep original from header in msgs");
+CFG_VALUE(INTEGER(c_xmpp_c2s_port),            " XMPP client-to-server port (usually 5222)");
+CFG_VALUE(INTEGER(c_xmpp_s2s_port),            " XMPP server-to-server port (usually 5269)");
index b7357925707b7051f4d15bdef7358ebeb5cdc060..8de7350fe0b3129f7c187097f22bb6ea9e7ad5bf 100644 (file)
@@ -437,7 +437,7 @@ CTDL_MODULE_INIT(jabber)
 {
 #ifdef HAVE_EXPAT
        if (!threading) {
-               CtdlRegisterServiceHook(5222,                   /* FIXME change to config.c_xmpp_port */
+               CtdlRegisterServiceHook(config.c_xmpp_c2s_port,
                                        NULL,
                                        xmpp_greeting,
                                        xmpp_command_loop,
index 7188365563bbdaa095180af15dff312ba519c90f..5d52b29d5afaca1ab9540a6a14a9c83d0e346a79 100644 (file)
@@ -181,6 +181,11 @@ void update_config(void) {
                config.c_auto_cull = 1;
        }
 
+       if (CitControl.version < 725) {
+               config.c_xmpp_c2s_port = 5222;
+               config.c_xmpp_s2s_port = 5269;
+       }
+
        put_config();
 }
 
index f0ad438a376009f5248b489c1c49a28966bb19d0..e21bdcce082423866acb098c3a1017c2f971a643 100644 (file)
@@ -1158,6 +1158,8 @@ int main(int argc, char *argv[])
        if (config.c_imaps_port == 0) config.c_imaps_port = 993;
        if (config.c_pftcpdict_port == 0) config.c_pftcpdict_port = -1;
        if (config.c_managesieve_port == 0) config.c_managesieve_port = 2020;
+       if (config.c_xmpp_c2s_port == 0) config.c_xmpp_c2s_port = 5222;
+       if (config.c_xmpp_s2s_port == 0) config.c_xmpp_s2s_port = 5269;
 
        /* Go through a series of dialogs prompting for config info */
        for (curr = 1; curr <= MAXSETUP; ++curr) {
index 9cacb68b05e8567703003f361e38d1a019d9d76a..314704894d0b5cb041fd0583c8168f3d575950cd 100644 (file)
@@ -63,7 +63,7 @@ extern int screenwidth;
 void do_system_configuration(CtdlIPC *ipc)
 {
 
-#define NUM_CONFIGS 61
+#define NUM_CONFIGS 63
 
        char buf[256];
        char sc[NUM_CONFIGS][256];
@@ -171,6 +171,11 @@ void do_system_configuration(CtdlIPC *ipc)
        strprompt("SMTPS server port (-1 to disable)", &sc[41][0], 5);
        strprompt("Postfix TCP Dictionary Port server port (-1 to disable)", &sc[50][0], 5);
        strprompt("ManageSieve server port (-1 to disable)", &sc[51][0], 5);
+       strprompt("XMPP (Jabber) client to server port (-1 to disable)", &sc[62][0], 5);
+
+       /* No prompt because we don't implement this service yet, it's just a placeholder */
+       /* strprompt("XMPP (Jabber) server to server port (-1 to disable)", &sc[63][0], 5); */
+
        /* This logic flips the question around, because it's one of those
         * situations where 0=yes and 1=no
         */
@@ -180,6 +185,16 @@ void do_system_configuration(CtdlIPC *ipc)
                a);
        a = (a ? 0 : 1);
        snprintf(sc[25], sizeof sc[25], "%d", a);
+
+       /* This logic flips the question around, because it's one of those
+        * situations where 0=yes and 1=no
+        */
+       a = atoi(sc[61]);
+       a = (a ? 0 : 1);
+       a = boolprompt("Force IMAP posts in public rooms to be from the user who submitted them", a);
+       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]))));
index b3344e82083cacb14dd756e96144bd0000033a45..ecc63972a51c8b0c9d7b6191a43991363536d147 100644 (file)
@@ -599,6 +599,20 @@ void display_siteconfig(void)
                                ((atoi(buf) != 0) ? "CHECKED" : ""));
                        sprintf(&network[strlen(network)], "</TD></TR>\n");
                        break;
+               case 62:
+                       sprintf(&network[strlen(network)], "<tr><td>");
+                       sprintf(&network[strlen(network)], _("XMPP (Jabber) client to server port (-1 to disable)"));
+                       sprintf(&network[strlen(network)], "</td><td>");
+                       sprintf(&network[strlen(network)], "<input type=\"text\" name=\"c_xmpp_c2s_port\" maxlength=\"5\" value=\"%s\">", buf);
+                       sprintf(&network[strlen(network)], "</TD></TR>\n");
+                       break;
+               case 63:
+                       sprintf(&network[strlen(network)], "<tr><td>");
+                       sprintf(&network[strlen(network)], _("XMPP (Jabber) server to server port (-1 to disable)"));
+                       sprintf(&network[strlen(network)], "</td><td>-1");
+                       sprintf(&network[strlen(network)], "<input type=\"hidden\" name=\"c_xmpp_s2s_port\" value=\"%s\">\n", buf);
+                       sprintf(&network[strlen(network)], "</TD></TR>\n");
+                       break;
                }
        
        }
@@ -775,6 +789,8 @@ void siteconfig(void)
        serv_printf("%s", bstr("c_master_pass"));
        serv_printf("%s", bstr("c_pager_program"));
        serv_printf("%s", ((!strcasecmp(bstr("c_imap_keep_from"), "yes") ? "1" : "0")));
+       serv_printf("%s", bstr("c_xmpp_c2s_port"));
+       serv_printf("%s", bstr("c_xmpp_s2s_port"));
        serv_printf("000");
 
        serv_printf("SPEX site|%d|%d", atoi(bstr("sitepolicy")), atoi(bstr("sitevalue")));