modules/ldap/serv_ldap.o \
modules/autocompletion/serv_autocompletion.o \
modules/funambol/serv_funambol.o \
+ modules/pager/serv_pager.o \
modules/test/serv_test.o
UTIL_TARGETS=aidepost msgform \
cprintf("%d\n", config.c_rbl_at_greeting);
cprintf("%s\n", config.c_master_user);
cprintf("%s\n", config.c_master_pass);
+ cprintf("%s\n", config.c_pager_program);
cprintf("000\n");
}
case 59:
safestrncpy(config.c_master_pass, buf, sizeof config.c_master_pass);
break;
+ case 60:
+ safestrncpy(config.c_pager_program,
+ buf,
+ sizeof config.c_pager_program);
+ break;
}
++a;
}
CFG_VALUE(CHAR(c_rbl_at_greeting), " Check RBL's at connect instead of after RCPT ");
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)");
#include "control.h"
#include "room_ops.h"
#include "user_ops.h"
-#include "policy.h"
#include "database.h"
#include "msgbase.h"
#include "tools.h"
#include "internet_addressing.h"
#include "domain.h"
#include "clientsocket.h"
-#include "serv_funambol.h"
+#include "serv_funambol.h"
+#include "serv_pager.h"
#include "ctdl_module.h"
+#define FUNAMBOL_CONFIG_TEXT "funambol"
/*
* Create the notify message queue
if ( msg->cm_fields['W'] == NULL) {
goto nuke;
}
+ long configMsgNum = pager_getConfigMessage(msg->cm_fields['W']);
+ int allowed = funambol_isAllowedByPrefs(configMsgNum);
+ if (allowed != 0) {
+ return;
+ }
/* Are we allowed to push? */
if (IsEmptyStr(config.c_funambol_host)) {
- goto nuke;
+ return;
} else {
lprintf(CTDL_INFO, "Push enabled\n");
}
-
+ // Does the user want it?
sprintf(port, "%d", config.c_funambol_port);
lprintf(CTDL_INFO, "Connecting to Funambol at <%s>\n", config.c_funambol_host);
sock = sock_connect(config.c_funambol_host, port, "tcp");
if (sock < 0) {
/* If the service isn't running, pass for now */
- return;
+ goto nuke;
}
/* Build a SOAP message, delicately, by hand */
CtdlDeleteMessages(FNBL_QUEUE_ROOM, todelete, 1, "");
}
-
+int funambol_isAllowedByPrefs(long configMsgNum) {
+ // Do a simple string search to see if 'funambol' is selected as the
+ // type. This string would be at the very top of the message contents.
+ if (configMsgNum == -1) {
+ return -1;
+ }
+ struct CtdlMessage *prefMsg;
+ prefMsg = CtdlFetchMessage(configMsgNum, 1);
+ char *msgContents = prefMsg->cm_fields['M'];
+ return strncasecmp(msgContents, FUNAMBOL_CONFIG_TEXT, strlen(FUNAMBOL_CONFIG_TEXT));
+}
CTDL_MODULE_INIT(funambol)
{
MailboxName(actual_rm, sizeof actual_rm, &userbuf, MAILROOM);
CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 0, msg);
BumpNewMailCounter(userbuf.usernum);
- if (!IsEmptyStr(config.c_funambol_host)) {
+ if (!IsEmptyStr(config.c_funambol_host) || !IsEmptyStr(config.c_pager_program)) {
/* Generate a instruction message for the Funambol notification
* server, in the same style as the SMTP queue
*/
#define SYSCONFIGROOM "Local System Configuration"
#define SMTP_SPOOLOUT_ROOM "__CitadelSMTPspoolout__"
#define FNBL_QUEUE_ROOM "__CitadelFNBLqueue__"
-
+#define PAGER_QUEUE_ROOM "__CitadelPagerQueue__"
/*
* Where we keep messages containing the vCards that source our directory. It
* makes no sense to change this, because you'd have to change it on every