]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_vcard.c
* Renamed "dynloader" to "serv_extensions" globally. We don't want people
[citadel.git] / citadel / serv_vcard.c
index 8fa14ffc81248b01a2358c1bb7761a6df01f873a..6350dbfc57f364fa60813c95784ae7c70c6220c3 100644 (file)
@@ -54,7 +54,7 @@
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "dynloader.h"
+#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
@@ -197,21 +197,13 @@ void cmd_igab(char *argbuf) {
 
 /*
  * See if there is a valid Internet address in a vCard to use for outbound
- * Interet messages.  If there is, stick it in CC->cs_inet_email.
+ * Internet messages.  If there is, stick it in CC->cs_inet_email.
  */
 void vcard_populate_cs_inet_email(struct vCard *v) {
        char *s, *addr;
        int continue_searching = 1;
        int instance = 0;
 
-       /* 
-        * Clear whatever was in there previously.
-        */
-       if (CC->cs_inet_email != NULL) {
-               phree(CC->cs_inet_email);
-               CC->cs_inet_email = NULL;
-       }
-
        /* Go through the vCard searching for *all* instances of
         * the "email;internet" key
         */
@@ -224,7 +216,10 @@ void vcard_populate_cs_inet_email(struct vCard *v) {
                        if (strlen(addr) > 0) {
                                if (IsDirectory(addr)) {
                                        continue_searching = 0;
-                                       CC->cs_inet_email = strdoop(addr);
+                                       safestrncpy(CC->cs_inet_email,
+                                               addr,
+                                               sizeof(CC->cs_inet_email)
+                                       );
                                }
                        }
                        phree(addr);
@@ -643,7 +638,8 @@ void vcard_purge(char *username, long usernum) {
         msg->cm_fields['N'] = strdoop(NODENAME);
         msg->cm_fields['M'] = strdoop("Purge this vCard\n");
 
-        snprintf(buf, sizeof buf, VCARD_EXT_FORMAT, msg->cm_fields['A'], NODENAME);
+        snprintf(buf, sizeof buf, VCARD_EXT_FORMAT,
+                       msg->cm_fields['A'], NODENAME);
         msg->cm_fields['E'] = strdoop(buf);
 
        msg->cm_fields['S'] = strdoop("CANCEL");
@@ -718,7 +714,8 @@ void vcard_delete_remove(char *room, long msgnum) {
                if (!strncasecmp(ptr, "Content-type: text/x-vcard", 26)) {
                        /* Bingo!  A vCard is being deleted.
                        */
-                       vcard_extract_internet_addresses(msg, CtdlDirectoryDelUser);
+                       vcard_extract_internet_addresses(msg,
+                                                       CtdlDirectoryDelUser);
                }
                ptr = strchr((char *)ptr, '\n');
                if (ptr != NULL) ++ptr;
@@ -773,23 +770,12 @@ void vcard_session_login_hook(void) {
 }
 
 
-/*
- * When a user logs out...
- */
-void vcard_session_logout_hook(void) {
-       if (CC->cs_inet_email != NULL) {
-               phree(CC->cs_inet_email);
-               CC->cs_inet_email = NULL;
-       }
-}
-
 
-char *Dynamic_Module_Init(void)
+char *serv_vcard_init(void)
 {
        SYM_VCARD = CtdlGetDynamicSymbol();
        CtdlRegisterSessionHook(vcard_session_startup_hook, EVT_START);
        CtdlRegisterSessionHook(vcard_session_login_hook, EVT_LOGIN);
-       CtdlRegisterSessionHook(vcard_session_logout_hook, EVT_LOGOUT);
        CtdlRegisterMessageHook(vcard_upload_beforesave, EVT_BEFORESAVE);
        CtdlRegisterMessageHook(vcard_upload_aftersave, EVT_AFTERSAVE);
        CtdlRegisterDeleteHook(vcard_delete_remove);