From e48dd53dfa3db71f308ae734e3a3e88dfa92abaa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Mon, 11 May 2009 23:01:04 +0000 Subject: [PATCH] * add message ID to the notification template; not used for funnambol, but for possible other applications. --- citadel/modules/extnotify/extnotify.h | 2 +- citadel/modules/extnotify/extnotify_main.c | 17 +++++++++-------- citadel/modules/extnotify/funambol65.c | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/citadel/modules/extnotify/extnotify.h b/citadel/modules/extnotify/extnotify.h index 5cecb46e2..eab3e343a 100644 --- a/citadel/modules/extnotify/extnotify.h +++ b/citadel/modules/extnotify/extnotify.h @@ -15,7 +15,7 @@ extern "C" { #define FUNAMBOL_WS "/funambol/services/admin" -int notify_funambol_server(char *user); +int notify_funambol_server(char *user, char *msgid); void extNotify_getPrefs(long configMsgNum, char *configMsg); long extNotify_getConfigMessage(char *username); diff --git a/citadel/modules/extnotify/extnotify_main.c b/citadel/modules/extnotify/extnotify_main.c index 1da02aac3..51a0f6feb 100644 --- a/citadel/modules/extnotify/extnotify_main.c +++ b/citadel/modules/extnotify/extnotify_main.c @@ -134,16 +134,17 @@ void process_notify(long msgnum, void *usrdata) { int fnblAllowed = strncasecmp(configMsg, FUNAMBOL_CONFIG_TEXT, strlen(FUNAMBOL_CONFIG_TEXT)); int extPagerAllowed = strncasecmp(configMsg, PAGER_CONFIG_TEXT, strlen(PAGER_CONFIG_TEXT)); if (fnblAllowed == 0) { - notify_funambol_server(msg->cm_fields['W']); + notify_funambol_server(msg->cm_fields['W'], + msg->cm_fields['I']); } else if (extPagerAllowed == 0) { - char *number = strtok(configMsg, "textmessage\n"); - int commandSiz = sizeof(config.c_pager_program) + strlen(number) + strlen(msg->cm_fields['W']) + 5; - char *command = malloc(commandSiz); - snprintf(command, commandSiz, "%s %s -u %s", config.c_pager_program, number, msg->cm_fields['W']); - system(command); - free(command); + char *number = strtok(configMsg, "textmessage\n"); + int commandSiz = sizeof(config.c_pager_program) + strlen(number) + strlen(msg->cm_fields['W']) + 5; + char *command = malloc(commandSiz); + snprintf(command, commandSiz, "%s %s -u %s", config.c_pager_program, number, msg->cm_fields['W']); + system(command); + free(command); } - nuke: +nuke: CtdlFreeMessage(msg); memset(configMsg, 0, sizeof(configMsg)); long todelete[1]; diff --git a/citadel/modules/extnotify/funambol65.c b/citadel/modules/extnotify/funambol65.c index cebed9a05..53a0487bb 100644 --- a/citadel/modules/extnotify/funambol65.c +++ b/citadel/modules/extnotify/funambol65.c @@ -33,7 +33,7 @@ * of new mail for a user * Returns 0 if unsuccessful */ -int notify_funambol_server(char *user) { +int notify_funambol_server(char *user, char *msgid) { char port[1024]; int sock = -1; char *buf = NULL; @@ -105,6 +105,7 @@ int notify_funambol_server(char *user) { // Do substitutions help_subst(SOAPMessage, "^notifyuser", user); help_subst(SOAPMessage, "^syncsource", config.c_funambol_source); + help_subst(SOAPMessage, "^msgid", msgid); /* Build the HTTP request header */ -- 2.30.2