]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/vcard/serv_vcard.c
Put our known stringlength into the mime parser so it doesn't need to strlen again.
[citadel.git] / citadel / modules / vcard / serv_vcard.c
index 9f493a65d8f1ad63c7762ad9b586203ccd7f2a4e..2722b3bca3a6da1ac6d854a1d743eab0819a7fc4 100644 (file)
@@ -63,6 +63,7 @@
 #include "user_ops.h"
 #include "database.h"
 #include "msgbase.h"
+#include "room_ops.h"
 #include "internet_addressing.h"
 #include "serv_vcard.h"
 #include "citadel_ldap.h"
@@ -189,7 +190,7 @@ void vcard_add_to_directory(long msgnum, void *data) {
                vcard_extract_internet_addresses(msg, vcard_directory_add_user);
        }
 
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
@@ -328,7 +329,7 @@ void vcard_extract_vcard(char *name, char *filename, char *partnum, char *disp,
  * function accordingly (delete the user's existing vCard in the config room
  * and in the global address book).
  */
-int vcard_upload_beforesave(struct CtdlMessage *msg) {
+int vcard_upload_beforesave(struct CtdlMessage *msg, recptypes *recp) {
        struct CitContext *CCC = CC;
        char *s;
        char buf[SIZ];
@@ -374,12 +375,11 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) {
 
        if (CM_IsEmpty(msg, eMesageText)) return(0);
 
-       mime_parser(msg->cm_fields[eMesageText],
-               NULL,
-               *vcard_extract_vcard,
-               NULL, NULL,
-               &v,             /* user data ptr - put the vcard here */
-               0
+       mime_parser(CM_RANGE(msg, eMesageText),
+                   *vcard_extract_vcard,
+                   NULL, NULL,
+                   &v,         /* user data ptr - put the vcard here */
+                   0
        );
 
        if (v == NULL) return(0);       /* no vCards were found in this message */
@@ -503,7 +503,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) {
  * function accordingly (copy the vCard from the config room to the global
  * address book).
  */
-int vcard_upload_aftersave(struct CtdlMessage *msg) {
+int vcard_upload_aftersave(struct CtdlMessage *msg, recptypes *recp) {
        struct CitContext *CCC = CC;
        char *ptr;
        int linelen;
@@ -650,7 +650,7 @@ struct vCard *vcard_get_user(struct ctdluser *u) {
        if (msg == NULL) return vcard_new();
 
        v = vcard_load(msg->cm_fields[eMesageText]);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        return v;
 }
 
@@ -915,7 +915,7 @@ void vcard_purge(struct ctdluser *usbuf) {
        CM_SetField(msg, eSpecialField, HKEY("CANCEL"));
 
        CtdlSubmitMsg(msg, NULL, ADDRESS_BOOK_ROOM, QP_EADDR);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
@@ -998,7 +998,7 @@ void vcard_delete_remove(char *room, long msgnum) {
                if (ptr != NULL) ++ptr;
        }
 
-EOH:   CtdlFreeMessage(msg);
+EOH:   CM_Free(msg);
 }
 
 
@@ -1106,14 +1106,13 @@ void dvca_callback(long msgnum, void *userdata) {
 
        msg = CtdlFetchMessage(msgnum, 1);
        if (msg == NULL) return;
-       mime_parser(msg->cm_fields[eMesageText],
-               NULL,
-               *dvca_mime_callback,    /* callback function */
-               NULL, NULL,
-               NULL,                   /* user data */
-               0
-       );
-       CtdlFreeMessage(msg);
+       mime_parser(CM_RANGE(msg, eMesageText),
+                   *dvca_mime_callback,        /* callback function */
+                   NULL, NULL,
+                   NULL,                       /* user data */
+                   0
+               );
+       CM_Free(msg);
 }
 
 
@@ -1171,7 +1170,7 @@ void check_get(void) {
        
        if (strncasecmp(cmdbuf, "GET ", 4)==0)
        {
-               struct recptypes *rcpt;
+               recptypes *rcpt;
                char *argbuf = &cmdbuf[4];
                
                extract_token(internet_addr, argbuf, 0, '|', sizeof internet_addr);
@@ -1330,7 +1329,7 @@ void strip_addresses_already_have(long msgnum, void *userdata) {
        msg = CtdlFetchMessage(msgnum, 1);
        if (msg == NULL) return;
        v = vcard_load(msg->cm_fields[eMesageText]);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        i = 0;
        while (value = vcard_get_prop(v, "email", 1, i++, 0), value != NULL) {
@@ -1403,7 +1402,7 @@ void store_this_ha(struct addresses_to_be_filed *aptr) {
 
                        syslog(LOG_DEBUG, "Adding contact: %s", recipient);
                        CtdlSubmitMsg(vmsg, NULL, aptr->roomname, QP_EADDR);
-                       CtdlFreeMessage(vmsg);
+                       CM_Free(vmsg);
                }
        }