+wc_mime_attachment *load_vcard(message_summary *Msg)
+{
+ HashPos *it;
+ StrBuf *FoundCharset = NewStrBuf();
+ StrBuf *Error;
+ void *vMime;
+ const char *Key;
+ long len;
+ wc_mime_attachment *Mime;
+ wc_mime_attachment *VCMime = NULL;
+
+ Msg->MsgBody = (wc_mime_attachment*) malloc(sizeof(wc_mime_attachment));
+ memset(Msg->MsgBody, 0, sizeof(wc_mime_attachment));
+ Msg->MsgBody->msgnum = Msg->msgnum;
+
+ load_message(Msg, FoundCharset, &Error);
+
+ FreeStrBuf(&FoundCharset);
+ /* look up the vcard... */
+ it = GetNewHashPos(Msg->AllAttach, 0);
+ while (GetNextHashPos(Msg->AllAttach, it, &len, &Key, &vMime) &&
+ (vMime != NULL))
+ {
+ Mime = (wc_mime_attachment*) vMime;
+ if ((strcmp(ChrPtr(Mime->ContentType),
+ "text/x-vcard") == 0) ||
+ (strcmp(ChrPtr(Mime->ContentType),
+ "text/vcard") == 0))
+ {
+ VCMime = Mime;
+ break;
+ }
+ }
+ DeleteHashPos(&it);
+ if (VCMime == NULL)
+ return NULL;
+
+ if (VCMime->Data == NULL)
+ MimeLoadData(VCMime);
+ return VCMime;
+}
+