From 104a4e1d569154afc9ff6a218d76d42dd3870b7b Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 3 Dec 2007 07:57:09 +0000 Subject: [PATCH] Site config protocol and UI for XMPP port numbers --- citadel/citadel.h | 4 ++-- citadel/control.c | 8 ++++++++ citadel/include/dtds/config-defs.h | 2 ++ citadel/modules/jabber/serv_xmpp.c | 2 +- citadel/modules/upgrade/serv_upgrade.c | 5 +++++ citadel/setup.c | 2 ++ citadel/tuiconfig.c | 17 ++++++++++++++++- webcit/siteconfig.c | 16 ++++++++++++++++ 8 files changed, 52 insertions(+), 4 deletions(-) diff --git a/citadel/citadel.h b/citadel/citadel.h index e7381e077..5963a6a19 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -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 */ diff --git a/citadel/control.c b/citadel/control.c index e142504c6..f03aea7b3 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -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; } diff --git a/citadel/include/dtds/config-defs.h b/citadel/include/dtds/config-defs.h index cfdea8cc9..6deaa90c2 100644 --- a/citadel/include/dtds/config-defs.h +++ b/citadel/include/dtds/config-defs.h @@ -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)"); diff --git a/citadel/modules/jabber/serv_xmpp.c b/citadel/modules/jabber/serv_xmpp.c index b73579257..8de7350fe 100644 --- a/citadel/modules/jabber/serv_xmpp.c +++ b/citadel/modules/jabber/serv_xmpp.c @@ -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, diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index 718836556..5d52b29d5 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -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(); } diff --git a/citadel/setup.c b/citadel/setup.c index f0ad438a3..e21bdcce0 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -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) { diff --git a/citadel/tuiconfig.c b/citadel/tuiconfig.c index 9cacb68b0..314704894 100644 --- a/citadel/tuiconfig.c +++ b/citadel/tuiconfig.c @@ -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])))); diff --git a/webcit/siteconfig.c b/webcit/siteconfig.c index b3344e820..ecc63972a 100644 --- a/webcit/siteconfig.c +++ b/webcit/siteconfig.c @@ -599,6 +599,20 @@ void display_siteconfig(void) ((atoi(buf) != 0) ? "CHECKED" : "")); sprintf(&network[strlen(network)], "\n"); break; + case 62: + sprintf(&network[strlen(network)], ""); + sprintf(&network[strlen(network)], _("XMPP (Jabber) client to server port (-1 to disable)")); + sprintf(&network[strlen(network)], ""); + sprintf(&network[strlen(network)], "", buf); + sprintf(&network[strlen(network)], "\n"); + break; + case 63: + sprintf(&network[strlen(network)], ""); + sprintf(&network[strlen(network)], _("XMPP (Jabber) server to server port (-1 to disable)")); + sprintf(&network[strlen(network)], "-1"); + sprintf(&network[strlen(network)], "\n", buf); + sprintf(&network[strlen(network)], "\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"))); -- 2.30.2