* if we fail to open the template, bail out with an error.
authorWilfried Göesgens <willi@citadel.org>
Fri, 20 Mar 2009 22:30:00 +0000 (22:30 +0000)
committerWilfried Göesgens <willi@citadel.org>
Fri, 20 Mar 2009 22:30:00 +0000 (22:30 +0000)
* actualy _install_ the template.

citadel/Makefile.in
citadel/citadel_dirs.c
citadel/citadel_dirs.h
citadel/debian/citadel-server.install
citadel/funambol_newmail_soap.xml [new file with mode: 0644]
citadel/modules/extnotify/funambol65.c
citadel/network/funambol_newmail_soap.xml [deleted file]

index a7a3f049d9f0485befa68cee5ffbed71cdc4d28f..792432b0f01472f73f5d21d51dca65309b4be115 100644 (file)
@@ -206,7 +206,7 @@ install-data:
                 network/systems; do \
                $(srcdir)/mkinstalldirs $(DESTDIR)$(prefix)/$$i; \
        done
-       @for i in citadel.rc public_clients \
+       @for i in funambol_newmail_soap.xml citadel.rc public_clients \
                 `find $(srcdir)/help $(srcdir)/messages $(srcdir)/network -type f | grep -v .svn`; do \
                echo $(INSTALL_DATA) $$i $(DESTDIR)$(prefix)/$$i; \
                $(INSTALL_DATA) $$i $(DESTDIR)$(prefix)/$$i; \
@@ -233,7 +233,7 @@ install-data-new:
        done
 
        $(srcdir)/mkinstalldirs $(DESTDIR)$(HELP_DIR)/help
-       @for i in  \
+       @for i in  funambol_newmail_soap.xml \
                 `find $(srcdir)/help -type f | grep -v .svn`; do \
                echo $(INSTALL_DATA) $$i $(DESTDIR)$(HELP_DIR)/$$i; \
                $(INSTALL_DATA) $$i $(DESTDIR)$(HELP_DIR)/$$i; \
index 9d7085bb711ad3b6a0b0c263836968a20a7b1b1f..770ee0d5bcaae1212fa742d32c4ac9d8d52b5fbd 100644 (file)
@@ -33,6 +33,7 @@ char ctdl_data_dir[PATH_MAX]="data";
 char ctdl_dspam_dir[PATH_MAX]="dspam";
 char ctdl_file_dir[PATH_MAX]="files";
 char ctdl_hlp_dir[PATH_MAX]="help";
+char ctdl_shared_dir[PATH_MAX]="";
 char ctdl_image_dir[PATH_MAX]="images";
 char ctdl_info_dir[PATH_MAX]="info";
 char ctdl_key_dir[PATH_MAX]=SSL_DIR;
@@ -184,6 +185,8 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
 #endif
        COMPUTE_DIRECTORY(ctdl_hlp_dir);
        StripSlashes(ctdl_hlp_dir, 1);
+       COMPUTE_DIRECTORY(ctdl_shared_dir);
+       StripSlashes(ctdl_shared_dir, 1);
 
 #ifndef HAVE_DATA_DIR
        basedir=ctdldir;
@@ -328,7 +331,7 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
         snprintf(file_funambol_msg,
                 sizeof file_funambol_msg,
                 "%sfunambol_newmail_soap.xml",
-                ctdl_spool_dir);
+                ctdl_shared_dir);
        StripSlashes(file_funambol_msg, 0);
 
        DBG_PRINT(ctdl_bio_dir);
index 897986d6d5a330c752682df42e790913ea5d271f..1586ba6ecd0af95a6399a399f111a3a8346e42e3 100644 (file)
@@ -14,6 +14,7 @@ extern char ctdl_data_dir[PATH_MAX];
 extern char ctdl_dspam_dir[PATH_MAX];
 extern char ctdl_file_dir[PATH_MAX];
 extern char ctdl_hlp_dir[PATH_MAX];
+extern char ctdl_shared_dir[PATH_MAX];
 extern char ctdl_image_dir[PATH_MAX];
 extern char ctdl_info_dir[PATH_MAX];
 extern char ctdl_key_dir[PATH_MAX];
index b99000cd53737c897e4505a7b1bda5612cfd1c86..b36649f17a15f51a06f7c709cde3984dc79d9691 100644 (file)
@@ -1,6 +1,7 @@
 etc/citadel/mail.aliases
 etc/citadel/public_clients
 usr/share/citadel-server/help
+usr/share/citadel-server/funambol_newmail_soap.xml
 etc/citadel/messages 
 usr/lib/citadel-server/setup
 usr/lib/citadel-server/base64
diff --git a/citadel/funambol_newmail_soap.xml b/citadel/funambol_newmail_soap.xml
new file mode 100644 (file)
index 0000000..1656c38
--- /dev/null
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><sendNotificationMessages soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
+<arg0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">^notifyuser</arg0><arg1 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
+&lt;java version=&quot;1.5.0_13&quot; class=&quot;java.beans.XMLDecoder&quot;&gt; 
+ &lt;array class=&quot;com.funambol.framework.core.Alert&quot; length=&quot;1&quot;&gt; 
+  &lt;void index=&quot;0&quot;&gt; 
+   &lt;object class=&quot;com.funambol.framework.core.Alert&quot;&gt; 
+    &lt;void property=&quot;cmdID&quot;&gt; 
+     &lt;object class=&quot;com.funambol.framework.core.CmdID&quot;/&gt; 
+    &lt;/void&gt; 
+    &lt;void property=&quot;data&quot;&gt; 
+     &lt;int&gt;206&lt;/int&gt; 
+    &lt;/void&gt; 
+    &lt;void property=&quot;items&quot;&gt; 
+     &lt;void method=&quot;add&quot;&gt; 
+      &lt;object class=&quot;com.funambol.framework.core.Item&quot;&gt; 
+       &lt;void property=&quot;meta&quot;&gt; 
+        &lt;object class=&quot;com.funambol.framework.core.Meta&quot;&gt; 
+         &lt;void property=&quot;metInf&quot;&gt; 
+          &lt;void property=&quot;type&quot;&gt; 
+           &lt;string&gt;application/vnd.omads-email+xml&lt;/string&gt; 
+          &lt;/void&gt; 
+         &lt;/void&gt; 
+        &lt;/object&gt; 
+       &lt;/void&gt; 
+       &lt;void property=&quot;target&quot;&gt; 
+        &lt;object class=&quot;com.funambol.framework.core.Target&quot;&gt; 
+         &lt;void property=&quot;locURI&quot;&gt; 
+          &lt;string&gt;^syncsource&lt;/string&gt; 
+         &lt;/void&gt; 
+        &lt;/object&gt; 
+       &lt;/void&gt; 
+      &lt;/object&gt; 
+     &lt;/void&gt; 
+    &lt;/void&gt; 
+   &lt;/object&gt; 
+  &lt;/void&gt; 
+ &lt;/array&gt; 
+&lt;/java&gt; 
+</arg1><arg2 href="#id0"/></sendNotificationMessages>
+<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef></soapenv:Body></soapenv:Envelope>
index 96b9008db241d5bbb54096d4bc11e4ab1f4edc7e..90fe4eb0ced41745c1b23eba1ed003a2b3fb10bd 100644 (file)
@@ -16,6 +16,7 @@
 #include <sys/socket.h>
 #include <time.h>
 #include <libcitadel.h>
+#include <errno.h>
 
 #include "citadel.h"
 #include "citadel_dirs.h"
 int notify_funambol_server(char *user) {
        char port[1024];
        int sock = -1;
-       char *buf;
-       char *SOAPMessage;
-       char *SOAPHeader;
-       char *funambolCreds;
-       FILE *template;
+       char *buf = NULL;
+       char *SOAPMessage = NULL;
+       char *SOAPHeader = NULL;
+       char *funambolCreds = NULL;
+       FILE *template = NULL;
        
        sprintf(port, "%d", config.c_funambol_port);
        sock = sock_connect(config.c_funambol_host, port, "tcp");
        if (sock >= 0) 
                CtdlLogPrintf(CTDL_DEBUG, "Connected to Funambol!\n");
-       else 
+       else {
+               char buf[SIZ];
+
+               snprintf(buf, SIZ, 
+                        "Unable to connect to %s:%d [%s]; won't send notification\r\n", 
+                        config.c_funambol_host, 
+                        config.c_funambol_port, 
+                        strerror(errno));
+               CtdlLogPrintf(CTDL_ERR, buf);
+
+               aide_message(buf, "External notifier unable to connect remote host!");
                goto bail;
+       }
        // Load the template SOAP message. Get mallocs done too
        template = fopen(file_funambol_msg, "r");
+
+       if (template == NULL) {
+               char buf[SIZ];
+
+               snprintf(buf, SIZ, 
+                        "Cannot load template file %s [%s]won't send notification\r\n", 
+                        file_funambol_msg, strerror(errno));
+               CtdlLogPrintf(CTDL_ERR, buf);
+
+               aide_message(buf, "External notifier unable to find message template!");
+               goto free;
+       }
+
+
        buf = malloc(SIZ);
        memset(buf, 0, SIZ);
        SOAPMessage = malloc(3072);
@@ -65,7 +91,14 @@ int notify_funambol_server(char *user) {
        fclose(template);
        
        if (strlen(SOAPMessage) < 0) {
-               printf("Cannot load template file\r\n");
+               char buf[SIZ];
+
+               snprintf(buf, SIZ, 
+                        "Cannot load template file %s; won't send notification\r\n", 
+                        file_funambol_msg);
+               CtdlLogPrintf(CTDL_ERR, buf);
+
+               aide_message(buf, "External notifier unable to load message template!");
                goto free;
        }
        // Do substitutions
diff --git a/citadel/network/funambol_newmail_soap.xml b/citadel/network/funambol_newmail_soap.xml
deleted file mode 100644 (file)
index 1656c38..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><sendNotificationMessages soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
-<arg0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">^notifyuser</arg0><arg1 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
-&lt;java version=&quot;1.5.0_13&quot; class=&quot;java.beans.XMLDecoder&quot;&gt; 
- &lt;array class=&quot;com.funambol.framework.core.Alert&quot; length=&quot;1&quot;&gt; 
-  &lt;void index=&quot;0&quot;&gt; 
-   &lt;object class=&quot;com.funambol.framework.core.Alert&quot;&gt; 
-    &lt;void property=&quot;cmdID&quot;&gt; 
-     &lt;object class=&quot;com.funambol.framework.core.CmdID&quot;/&gt; 
-    &lt;/void&gt; 
-    &lt;void property=&quot;data&quot;&gt; 
-     &lt;int&gt;206&lt;/int&gt; 
-    &lt;/void&gt; 
-    &lt;void property=&quot;items&quot;&gt; 
-     &lt;void method=&quot;add&quot;&gt; 
-      &lt;object class=&quot;com.funambol.framework.core.Item&quot;&gt; 
-       &lt;void property=&quot;meta&quot;&gt; 
-        &lt;object class=&quot;com.funambol.framework.core.Meta&quot;&gt; 
-         &lt;void property=&quot;metInf&quot;&gt; 
-          &lt;void property=&quot;type&quot;&gt; 
-           &lt;string&gt;application/vnd.omads-email+xml&lt;/string&gt; 
-          &lt;/void&gt; 
-         &lt;/void&gt; 
-        &lt;/object&gt; 
-       &lt;/void&gt; 
-       &lt;void property=&quot;target&quot;&gt; 
-        &lt;object class=&quot;com.funambol.framework.core.Target&quot;&gt; 
-         &lt;void property=&quot;locURI&quot;&gt; 
-          &lt;string&gt;^syncsource&lt;/string&gt; 
-         &lt;/void&gt; 
-        &lt;/object&gt; 
-       &lt;/void&gt; 
-      &lt;/object&gt; 
-     &lt;/void&gt; 
-    &lt;/void&gt; 
-   &lt;/object&gt; 
-  &lt;/void&gt; 
- &lt;/array&gt; 
-&lt;/java&gt; 
-</arg1><arg2 href="#id0"/></sendNotificationMessages>
-<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef></soapenv:Body></soapenv:Envelope>