$Log$
+ Revision 590.108 2002/02/11 15:52:10 ajc
+ * Don't crash when deleting "purge this vCard" messages
+
Revision 590.107 2002/02/10 22:36:41 nbryant
- replace cdb_trunc with a complete version of the code i had been
working on; fallback code for db < 3.3.x needed
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
*/
void vcard_delete_remove(char *room, long msgnum) {
struct CtdlMessage *msg;
+ char *ptr;
+ int linelen;
if (msgnum <= 0L) return;
}
msg = CtdlFetchMessage(msgnum);
- if (msg != NULL) {
- vcard_extract_internet_addresses(msg, CtdlDirectoryDelUser);
+ if (msg == NULL) return;
+
+ ptr = msg->cm_fields['M'];
+ if (ptr == NULL) goto EOH;
+ while (ptr != NULL) {
+ linelen = strcspn(ptr, "\n");
+ if (linelen == 0) goto EOH;
+
+ if (!strncasecmp(ptr, "Content-type: text/x-vcard", 26)) {
+ /* Bingo! A vCard is being deleted.
+ */
+ vcard_extract_internet_addresses(msg, CtdlDirectoryDelUser);
+ }
+ ptr = strchr((char *)ptr, '\n');
+ if (ptr != NULL) ++ptr;
}
- CtdlFreeMessage(msg);
+EOH: CtdlFreeMessage(msg);
}
+
/*
* Query Directory
*/