* Added "Z" (Zap, supersede) field to message format
-Revision 1.379 1999/10/06 23:17:44 ajc
-* vCard upload now copies the user's card to the global address book (but it
- hangs the server if the target room doesn't exist)
-
-Revision 1.378 1999/10/06 03:51:01 ajc
-* Figured out a way to get the user's vCard to automatically delete in the
- global address book when it's replaced. Now to find a way to add the new
- one...
+Revision 1.380 1999/10/07 02:58:46 ajc
+* Semi-broken vCard replacement implementation in place.
+* Added "Z" (Zap, supersede) field to message format
Revision 1.377 1999/10/04 03:19:52 ajc
* We now have a housekeeping thread and a housekeeping queue.
Revision 1.377 1999/10/04 03:19:52 ajc
* We now have a housekeeping thread and a housekeeping queue.
if (TheMessage->cm_fields['U']) {
cprintf("subj=%s\n", TheMessage->cm_fields['U']);
}
if (TheMessage->cm_fields['U']) {
cprintf("subj=%s\n", TheMessage->cm_fields['U']);
}
+ if (TheMessage->cm_fields['Z']) {
+ cprintf("zaps=%s\n", TheMessage->cm_fields['Z']);
+ }
}
/* begin header processing loop for RFC822 transfer format */
}
/* begin header processing loop for RFC822 transfer format */
ret->ser[1] = msg->cm_anon_type;
ret->ser[2] = msg->cm_format_type;
wlen = 3;
ret->ser[1] = msg->cm_anon_type;
ret->ser[2] = msg->cm_format_type;
wlen = 3;
for (i=0; i<26; ++i) if (msg->cm_fields[(int)forder[i]] != NULL) {
ret->ser[wlen++] = (char)forder[i];
strcpy(&ret->ser[wlen], msg->cm_fields[(int)forder[i]]);
for (i=0; i<26; ++i) if (msg->cm_fields[(int)forder[i]] != NULL) {
ret->ser[wlen++] = (char)forder[i];
strcpy(&ret->ser[wlen], msg->cm_fields[(int)forder[i]]);
}
if (ret->len != wlen) lprintf(3, "ERROR: len=%d wlen=%d\n",
ret->len, wlen);
}
if (ret->len != wlen) lprintf(3, "ERROR: len=%d wlen=%d\n",
ret->len, wlen);
+ lprintf(9, "done serializing\n");
- * back end function used by vcard_upload_beforesave()
+ * back end function used for callbacks
-void vcard_replace_backend(long msgnum) {
- lprintf(9, "doing the replace thing for <%ld>\n", msgnum);
- CtdlDeleteMessages(CONFIGROOM, msgnum, NULL);
- CtdlDeleteMessages(ADDRESS_BOOK_ROOM, msgnum, NULL);
+void vcard_gm_backend(long msgnum) {
+ VC->msgnum = msgnum;
int linelen;
char hold_rm[ROOMNAMELEN];
char config_rm[ROOMNAMELEN];
int linelen;
char hold_rm[ROOMNAMELEN];
char config_rm[ROOMNAMELEN];
/* If this isn't the configuration room, or if this isn't a MIME
* message, don't bother.
/* If this isn't the configuration room, or if this isn't a MIME
* message, don't bother.
getroom(&CC->quickroom, hold_rm);
return(1); /* abort */
}
getroom(&CC->quickroom, hold_rm);
return(1); /* abort */
}
CtdlForEachMessage(MSGS_ALL, 0,
CtdlForEachMessage(MSGS_ALL, 0,
- "text/x-vcard", vcard_replace_backend);
+ "text/x-vcard", vcard_gm_backend);
+
+ if (VC->msgnum >= 0) {
+ if (msg->cm_fields['Z'] != NULL)
+ phree(msg->cm_fields['Z']);
+ sprintf(buf, "%ld@%s", VC->msgnum, NODENAME);
+ msg->cm_fields['Z'] = strdoop(buf);
+ lprintf(9, "replacing <%s>\n", buf);
+ }
+
+ CtdlDeleteMessages(config_rm, 0L, "text/x-vcard");
+
getroom(&CC->quickroom, hold_rm); /* return rm */
return(0);
}
getroom(&CC->quickroom, hold_rm); /* return rm */
return(0);
}
int vcard_upload_aftersave(struct CtdlMessage *msg) {
char *ptr;
int linelen;
int vcard_upload_aftersave(struct CtdlMessage *msg) {
char *ptr;
int linelen;
+ char buf[256];
+
+ lprintf(9, "entering aftersave hook\n");
/* If this isn't the configuration room, or if this isn't a MIME
* message, don't bother.
/* If this isn't the configuration room, or if this isn't a MIME
* message, don't bother.
if (!strncasecmp(ptr, "Content-type: text/x-vcard", 26)) {
/* Bingo! The user is uploading a new vCard, so
if (!strncasecmp(ptr, "Content-type: text/x-vcard", 26)) {
/* Bingo! The user is uploading a new vCard, so
+ * copy it to the Global Address Book room.
+ lprintf(9, "activated aftersave hook\n");
+
+ I = atol(msg->cm_fields['I']);
+ if (I < 0L) return(0);
+
+ Z = (-1L);
+ if (msg->cm_fields['Z'] != NULL) {
+ extract_token(buf, msg->cm_fields['Z'], 1, '@');
+ if (!strcasecmp(buf, NODENAME)) {
+ extract_token(buf, msg->cm_fields['Z'],
+ 0, '@');
+ Z = atol(buf);
+ }
+ }
- msgid = atol(msg->cm_fields['I']);
- if (msgid < 0L) return(0);
-
+ lprintf(9, "calling getroom\n");
if (getroom(&qrbuf, ADDRESS_BOOK_ROOM) != 0) return(0);
if (getroom(&qrbuf, ADDRESS_BOOK_ROOM) != 0) return(0);
- AddMessageToRoom(&qrbuf, msgid);
- AdjRefCount(msgid, +1);
+ lprintf(9, "calling AddMessageToRoom\n");
+ AddMessageToRoom(&qrbuf, I);
+ lprintf(9, "calling AdjRefCount\n");
+ AdjRefCount(I, +1);
+
+ if (Z > 0L) {
+ lprintf(9, "Deleting the old one\n");
+ CtdlDeleteMessages(ADDRESS_BOOK_ROOM, Z, NULL);
+ }
+ lprintf(9, "finishing aftersave hook\n");
if (ptr != NULL) ++ptr;
}
if (ptr != NULL) ++ptr;
}
+ lprintf(9, "didn't do anything in hook\n");
-/*
- * back end function used by vcard_get_user()
- */
-void vcard_gm_backend(long msgnum) {
- VC->msgnum = msgnum;
-}
-
-
/*
* If this user has a vcard on disk, read it into memory, otherwise allocate
* and return an empty vCard.
/*
* If this user has a vcard on disk, read it into memory, otherwise allocate
* and return an empty vCard.
CtdlRegisterMessageHook(vcard_upload_aftersave, EVT_AFTERSAVE);
CtdlRegisterProtoHook(cmd_regi, "REGI", "Enter registration info");
CtdlRegisterProtoHook(cmd_greg, "GREG", "Get registration info");
CtdlRegisterMessageHook(vcard_upload_aftersave, EVT_AFTERSAVE);
CtdlRegisterProtoHook(cmd_regi, "REGI", "Enter registration info");
CtdlRegisterProtoHook(cmd_greg, "GREG", "Get registration info");
+ create_room(ADDRESS_BOOK_ROOM, 0, "", 0);
U Subject Optional. Developers may choose whether they wish to
generate or display subject fields. Citadel/UX does
not generate them, but it does print them when found.
U Subject Optional. Developers may choose whether they wish to
generate or display subject fields. Citadel/UX does
not generate them, but it does print them when found.
+Z Zap (supersede) Indicates a message which this message supersedes.
+ The format is "user@node" and if the specified message
+ is found, it should be deleted.