From: Art Cancro Date: Sat, 19 Jan 2008 05:35:02 +0000 (+0000) Subject: Applied matt's latest patch set X-Git-Tag: v7.86~2578 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=8c08e5f3647bc08572e1f67d4649a4aafeda05df Applied matt's latest patch set --- diff --git a/citadel/citadel_dirs.c b/citadel/citadel_dirs.c index 54da76ff3..bade7734a 100644 --- a/citadel/citadel_dirs.c +++ b/citadel/citadel_dirs.c @@ -66,6 +66,7 @@ char file_crpt_file_csr[PATH_MAX]=""; char file_crpt_file_cer[PATH_MAX]=""; char file_chkpwd[PATH_MAX]=""; char file_base64[PATH_MAX]=""; +char file_funambol_msg[PATH_MAX] = ""; int home_specified = 0; @@ -245,7 +246,12 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, const char *ctd ctdl_spool_dir #endif ); - + + snprintf(file_funambol_msg, + sizeof file_funambol_msg, + "%sfunambol_newmail_soap.xml", + ctdl_spool_dir); + DBG_PRINT(ctdl_bio_dir); DBG_PRINT(ctdl_bb_dir); DBG_PRINT(ctdl_data_dir); @@ -282,6 +288,7 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, const char *ctd DBG_PRINT(file_crpt_file_cer); DBG_PRINT(file_chkpwd); DBG_PRINT(file_base64); + DBG_PRINT(file_funambol_msg); } diff --git a/citadel/citadel_dirs.h b/citadel/citadel_dirs.h index 8a9e280f9..490884efb 100644 --- a/citadel/citadel_dirs.h +++ b/citadel/citadel_dirs.h @@ -50,6 +50,8 @@ extern char file_crpt_file_cer[PATH_MAX]; extern char file_chkpwd[PATH_MAX]; extern char file_base64[PATH_MAX]; +extern char file_funambol_msg[PATH_MAX]; + extern void calc_dirs_n_files(int relh, int home, const char *relhome,const char *ctdldir, int dbg); diff --git a/citadel/modules/funambol/serv_funambol.h b/citadel/modules/funambol/serv_funambol.h index 209fb9b39..e69de29bb 100644 --- a/citadel/modules/funambol/serv_funambol.h +++ b/citadel/modules/funambol/serv_funambol.h @@ -1 +0,0 @@ -void notify_funambol(long msgnum, void *userdata); diff --git a/citadel/modules/pager/serv_pager.c b/citadel/modules/pager/serv_pager.c index 3570856e4..e69de29bb 100644 --- a/citadel/modules/pager/serv_pager.c +++ b/citadel/modules/pager/serv_pager.c @@ -1,239 +0,0 @@ -/* - * \file serv_pager.c - * @author Mathew McBride - * - * This module implements an external pager hook for when notifcation - * of a new email is wanted. - * Based on bits of serv_funambol - * Contact: / - */ - -#include "sysdep.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#include -#include -#include -#include -#include -#include "citadel.h" -#include "server.h" -#include "citserver.h" -#include "support.h" -#include "config.h" -#include "control.h" -#include "room_ops.h" -#include "user_ops.h" -#include "policy.h" -#include "database.h" -#include "msgbase.h" -#include "internet_addressing.h" -#include "domain.h" -#include "clientsocket.h" -#include "serv_pager.h" - -#include "ctdl_module.h" - -#define PAGER_CONFIG_MESSAGE "__ Push email settings __" -#define PAGER_CONFIG_TEXT "textmessage" - -/*! \brief Create the notify message queue. We use the exact same room - * as the Funambol module. - * - * Run at server startup, creates FNBL_QUEUE_ROOM if it doesn't exist - * and sets as system room. - */ -void create_pager_queue(void) { - struct ctdlroom qrbuf; - - create_room(FNBL_QUEUE_ROOM, 3, "", 0, 1, 0, VIEW_MAILBOX); - - /* - * Make sure it's set to be a "system room" so it doesn't show up - * in the nown rooms list for Aides. - */ - if (lgetroom(&qrbuf, FNBL_QUEUE_ROOM) == 0) { - qrbuf.QRflags2 |= QR2_SYSTEM; - lputroom(&qrbuf); - } -} -/*! - * \brief Run through the pager room queue - */ -void do_pager_queue(void) { - static int doing_queue = 0; - - /* - * This is a simple concurrency check to make sure only one queue run - * is done at a time. We could do this with a mutex, but since we - * don't really require extremely fine granularity here, we'll do it - * with a static variable instead. - */ - if (doing_queue) return; - doing_queue = 1; - - /* - * Go ahead and run the queue - */ - lprintf(CTDL_DEBUG, "serv_pager: processing notify queue\n"); - - if (getroom(&CC->room, FNBL_QUEUE_ROOM) != 0) { - lprintf(CTDL_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM); - return; - } - CtdlForEachMessage(MSGS_ALL, 0L, NULL, - SPOOLMIME, NULL, notify_pager, NULL); - - lprintf(CTDL_DEBUG, "serv_pager: queue run completed\n"); - doing_queue = 0; -} - -/*! - * \brief Call the external pager tool as set by the administrator - * @param msgnum The message number of the 'hint' message passed from do_pager_queue - * @param userdata userdata struct as passed by CtdlForEachMessage - * - */ -void notify_pager(long msgnum, void *userdata) { - struct CtdlMessage *msg; - - /* W means 'wireless', which contains the unix name */ - msg = CtdlFetchMessage(msgnum, 1); - if ( msg->cm_fields['W'] == NULL) { - goto nuke; - } - /* Are we allowed to push? */ - if (IsEmptyStr(config.c_pager_program)) { - return; - } else if (IsEmptyStr(config.c_pager_program) && IsEmptyStr(config.c_funambol_host)) { - goto nuke; - } else { - lprintf(CTDL_INFO, "Pager alerter enabled\n"); - } - - /* Get the configuration. We might be allowed system wide but the user - may have configured otherwise */ - long configMsgNum = pager_getConfigMessage(msg->cm_fields['W']); - int allowed = pager_isPagerAllowedByPrefs(configMsgNum); - if (allowed != 0 && pager_doesUserWant(configMsgNum) == 0) { - goto nuke; - } else if (allowed != 0) { - return; - } - char *num = pager_getUserPhoneNumber(configMsgNum); - char command[SIZ]; - snprintf(command, sizeof command, "%s %s -u %s", config.c_pager_program, num, msg->cm_fields['W']); - system(command); - - nuke: - CtdlFreeMessage(msg); - long todelete[1]; - todelete[0] = msgnum; - CtdlDeleteMessages(FNBL_QUEUE_ROOM, todelete, 1, ""); -} -/*! \brief Get configuration message for pager/funambol system from the - * users "My Citadel Config" room - */ -long pager_getConfigMessage(char *username) { - struct ctdlroom qrbuf; // scratch for room - struct ctdluser user; // ctdl user instance - char configRoomName[ROOMNAMELEN]; - struct CtdlMessage *msg; - struct cdbdata *cdbfr; - long *msglist = NULL; - int num_msgs = 0; - long confMsgNum = -1; - // Get the user - getuser(&user, username); - - MailboxName(configRoomName, sizeof configRoomName, &user, USERCONFIGROOM); - // Fill qrbuf - getroom(&qrbuf, configRoomName); - /* Do something really, really stoopid here. Raid the room on ourselves, - loop through the messages manually and find it. I don't want - to use a CtdlForEachMessage callback here, as we would be - already in one */ - cdbfr = cdb_fetch(CDB_MSGLISTS, &qrbuf.QRnumber, sizeof(long)); - if (cdbfr != NULL) { - msglist = (long *) cdbfr->ptr; - cdbfr->ptr = NULL; /* CtdlForEachMessage() now owns this memory */ - num_msgs = cdbfr->len / sizeof(long); - cdb_free(cdbfr); - } else { - lprintf(CTDL_DEBUG, "pager_getConfigMessage: No config messages found\n"); - return -1; /* No messages at all? No further action. */ - } - int a; - for (a = 0; a < num_msgs; ++a) { - msg = CtdlFetchMessage(msglist[a], 1); - if (msg != NULL) { - if (msg->cm_fields['U'] != NULL && strncasecmp(msg->cm_fields['U'], PAGER_CONFIG_MESSAGE, - strlen(PAGER_CONFIG_MESSAGE)) == 0) { - confMsgNum = msglist[a]; - } - CtdlFreeMessage(msg); - } - } - return confMsgNum; - -} -int pager_isPagerAllowedByPrefs(long configMsgNum) { - // Do a simple string search to see if 'textmessage' 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, PAGER_CONFIG_TEXT, strlen(PAGER_CONFIG_TEXT)); -} -int pager_doesUserWant(long configMsgNum) { - if (configMsgNum == -1) { - return -1; - } - struct CtdlMessage *prefMsg; - prefMsg = CtdlFetchMessage(configMsgNum, 1); - char *msgContents = prefMsg->cm_fields['M']; - return strncasecmp(msgContents, "none", 4); -} - /* warning: fetching twice gravely inefficient, will fix some time */ -char *pager_getUserPhoneNumber(long configMsgNum) { - if (configMsgNum == -1) { - return NULL; - } - struct CtdlMessage *prefMsg; - prefMsg = CtdlFetchMessage(configMsgNum, 1); - char *msgContents = prefMsg->cm_fields['M']; - char *lines = strtok(msgContents, "textmessage\n"); - return lines; -} -CTDL_MODULE_INIT(pager) -{ - if (!threading) - { - create_pager_queue(); - CtdlRegisterSessionHook(do_pager_queue, EVT_TIMER); - } - - /* return our Subversion id for the Log */ - return "$Id: serv_pager.c $"; -} diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index 2646009c3..2158897ae 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -184,8 +184,10 @@ void update_config(void) { if (CitControl.version < 725) { config.c_xmpp_c2s_port = 5222; config.c_xmpp_s2s_port = 5269; + /* Wipe config.c_funambol_auth as support for previous + * module is deprecated */ + strcpy(config.c_funambol_auth, " "); } - put_config(); } diff --git a/webcit/configure.ac b/webcit/configure.ac index 4c3902984..80ff049fe 100644 --- a/webcit/configure.ac +++ b/webcit/configure.ac @@ -336,7 +336,8 @@ if test "$ok_iconv" = "no"; then ok_iconv=no ) if test "$ok_iconv" != "no"; then - LDFLAGS=$LD_FLAGS_BEFORE + LDFLAGS=$LD_FLAGS_BEFORE + LIBS="$LIBS -liconv" fi fi