]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_vcard.c
mk_module_init.sh now tests to see if echo supports -e and -E
[citadel.git] / citadel / serv_vcard.c
index f9f92c68bfa3bdc52595896017100e7a08e66823..ba292dfebbfff248efae9d45c2ee31f8767401b9 100644 (file)
  */
 #define VCARD_EXT_FORMAT       "Citadel vCard: personal card for %s at %s"
 
+/*
+ * Citadel will accept either text/vcard or text/x-vcard as the MIME type
+ * for a vCard.  The following definition determines which one it *generates*
+ * when serializing.
+ */
+#define VCARD_MIME_TYPE                "text/x-vcard"
 
 #include "sysdep.h"
 #include <stdlib.h>
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
 #include "serv_ldap.h"
 #include "serv_vcard.h"
 
+
+#include "ctdl_module.h"
+
+
+
 /*
  * set global flag calling for an aide to validate new users
  */
@@ -446,7 +455,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) {
        if (ser != NULL) {
                msg->cm_fields['M'] = realloc(msg->cm_fields['M'], strlen(ser) + 1024);
                sprintf(msg->cm_fields['M'],
-                       "Content-type: text/vcard"
+                       "Content-type: " VCARD_MIME_TYPE
                        "\r\n\r\n%s\r\n", ser);
                free(ser);
        }
@@ -610,7 +619,7 @@ void vcard_write_user(struct ctdluser *u, struct vCard *v) {
         * is going to notice what we're trying to do, and delete the old vCard.
         */
        CtdlWriteObject(USERCONFIGROOM, /* which room */
-                       "text/vcard",   /* MIME type */
+                       VCARD_MIME_TYPE,/* MIME type */
                        temp,           /* temp file */
                        u,              /* which user */
                        0,              /* not binary */
@@ -760,6 +769,7 @@ void cmd_greg(char *argbuf)
        extract_token(buf, adr, 6, ';', sizeof buf);
        cprintf("%s\n", buf);                           /* country */
        cprintf("000\n");
+       vcard_free(v);
 }
 
 
@@ -1253,7 +1263,7 @@ void store_this_ha(struct addresses_to_be_filed *aptr) {
                        if (ser != NULL) {
                                vmsg->cm_fields['M'] = malloc(strlen(ser) + 1024);
                                sprintf(vmsg->cm_fields['M'],
-                                       "Content-type: text/vcard"
+                                       "Content-type: " VCARD_MIME_TYPE
                                        "\r\n\r\n%s\r\n", ser);
                                free(ser);
                        }
@@ -1319,19 +1329,9 @@ void vcard_fixed_output(char *ptr, int len) {
 }
 
 
-char *serv_postfix_tcpdict(void)
-{
-       CtdlRegisterServiceHook(config.c_pftcpdict_port,        /* Postfix */
-                               NULL,
-                               check_get_greeting,
-                               check_get,
-                               NULL);
-       return "$Id$";
-}
-
 
 
-char *serv_vcard_init(void)
+CTDL_MODULE_INIT(vcard)
 {
        struct ctdlroom qr;
        char filename[256];
@@ -1377,5 +1377,13 @@ char *serv_vcard_init(void)
                chown(filename, CTDLUID, (-1));
        }
 
+       /* for postfix tcpdict */
+       CtdlRegisterServiceHook(config.c_pftcpdict_port,        /* Postfix */
+                               NULL,
+                               check_get_greeting,
+                               check_get,
+                               NULL);
+       
+       /* return our Subversion id for the Log */
        return "$Id$";
 }