- for (i=0; i<num_tokens(collected_addresses, ','); ++i) {
-
- /* Make a vCard out of each address */
- extract_token(recipient, collected_addresses, i, ',', sizeof recipient);
- striplt(recipient);
- v = vcard_new_from_rfc822_addr(recipient);
- if (v != NULL) {
- vmsg = malloc(sizeof(struct CtdlMessage));
- memset(vmsg, 0, sizeof(struct CtdlMessage));
- vmsg->cm_magic = CTDLMESSAGE_MAGIC;
- vmsg->cm_anon_type = MES_NORMAL;
- vmsg->cm_format_type = FMT_RFC822;
- vmsg->cm_fields['A'] = strdup("Citadel");
- vmsg->cm_fields['E'] = strdup(vcard_get_prop(v, "UID", 0, 0, 0));
- ser = vcard_serialize(v);
- if (ser != NULL) {
- vmsg->cm_fields['M'] = malloc(strlen(ser) + 1024);
- sprintf(vmsg->cm_fields['M'],
- "Content-type: text/x-vcard"
- "\r\n\r\n%s\r\n", ser);
- free(ser);
- }
- vcard_free(v);
-
- if (recps->num_local > 0) {
- for (j=0; j<num_tokens(recps->recp_local, '|'); ++j) {
- extract_token(recipient, recps->recp_local, j,
- '|', sizeof recipient);
- lprintf(CTDL_DEBUG, "Adding contact for <%s>\n", recipient);
- if (getuser(&userbuf, recipient) == 0) {
- MailboxName(actual_rm, sizeof actual_rm,
- &userbuf, USERCONTACTSROOM);
-
- if (vmsgnum < 0L) {
- vmsgnum = CtdlSubmitMsg(vmsg,
- NULL, actual_rm);
- }
- else {
- CtdlSaveMsgPointerInRoom(actual_rm,
- vmsgnum, 0);
- }
+ begin_critical_section(S_ATBF);
+ aptr = (struct addresses_to_be_filed *)
+ malloc(sizeof(struct addresses_to_be_filed));
+ aptr->next = atbf;
+ MailboxName(actual_rm, sizeof actual_rm,
+ &CC->user, USERCONTACTSROOM);
+ aptr->roomname = strdup(actual_rm);
+ aptr->collected_addresses = collected_addresses;
+ atbf = aptr;
+ end_critical_section(S_ATBF);
+ }