From 6b2ff16f93b64450da95b0ee64c48ba75852d5a0 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 14 Mar 2007 03:25:41 +0000 Subject: [PATCH] Fixed a bug introduced by the previous commit. We weren't picking up the Citadel EUID from the vCard UID. --- citadel/serv_vcard.c | 76 ++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/citadel/serv_vcard.c b/citadel/serv_vcard.c index 1f4e5ef44..d2c0de74c 100644 --- a/citadel/serv_vcard.c +++ b/citadel/serv_vcard.c @@ -391,15 +391,11 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) { vcard_set_prop(v, "FBURL;PREF", buf, 0); } - /* If this is an address book room, and the vCard has - * no UID, then give it one. - */ - if (yes_any_vcard_room) { - s = vcard_get_prop(v, "UID", 0, 0, 0); - if (s == NULL) { - generate_uuid(buf); - vcard_set_prop(v, "UID", buf, 0); - } + /* If the vCard has no UID, then give it one. */ + s = vcard_get_prop(v, "UID", 0, 0, 0); + if (s == NULL) { + generate_uuid(buf); + vcard_set_prop(v, "UID", buf, 0); } /* Enforce local UID policy if applicable */ @@ -408,42 +404,40 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) { vcard_set_prop(v, "UID", buf, 0); } - if (yes_any_vcard_room) { - /* - * Set the EUID of the message to the UID of the vCard. - */ - if (msg->cm_fields['E'] != NULL) free(msg->cm_fields['E']); - s = vcard_get_prop(v, "UID", 0, 0, 0); - if (s != NULL) { - msg->cm_fields['E'] = strdup(s); - if (msg->cm_fields['U'] == NULL) { - msg->cm_fields['U'] = strdup(s); - } - } - - /* - * Set the Subject to the name in the vCard. - */ - s = vcard_get_prop(v, "FN", 0, 0, 0); - if (s == NULL) { - s = vcard_get_prop(v, "N", 0, 0, 0); - } - if (s != NULL) { - if (msg->cm_fields['U'] != NULL) { - free(msg->cm_fields['U']); - } + /* + * Set the EUID of the message to the UID of the vCard. + */ + if (msg->cm_fields['E'] != NULL) free(msg->cm_fields['E']); + s = vcard_get_prop(v, "UID", 0, 0, 0); + if (s != NULL) { + msg->cm_fields['E'] = strdup(s); + if (msg->cm_fields['U'] == NULL) { msg->cm_fields['U'] = strdup(s); } + } - /* Re-serialize it back into the msg body */ - ser = vcard_serialize(v); - if (ser != NULL) { - msg->cm_fields['M'] = realloc(msg->cm_fields['M'], strlen(ser) + 1024); - sprintf(msg->cm_fields['M'], - "Content-type: text/x-vcard" - "\r\n\r\n%s\r\n", ser); - free(ser); + /* + * Set the Subject to the name in the vCard. + */ + s = vcard_get_prop(v, "FN", 0, 0, 0); + if (s == NULL) { + s = vcard_get_prop(v, "N", 0, 0, 0); + } + if (s != NULL) { + if (msg->cm_fields['U'] != NULL) { + free(msg->cm_fields['U']); } + msg->cm_fields['U'] = strdup(s); + } + + /* Re-serialize it back into the msg body */ + ser = vcard_serialize(v); + if (ser != NULL) { + msg->cm_fields['M'] = realloc(msg->cm_fields['M'], strlen(ser) + 1024); + sprintf(msg->cm_fields['M'], + "Content-type: text/x-vcard" + "\r\n\r\n%s\r\n", ser); + free(ser); } /* Now allow the save to complete. */ -- 2.39.2