$Log$
+Revision 1.381 1999/10/08 02:55:57 ajc
+* More vCard-related debugging
+
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
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
+
struct MessageFunctionHook *fcn;
int total_retval = 0;
+ /* Other code may elect to protect this message from server-side
+ * handlers; if this is the case, don't do anything.
+ */
+ lprintf(9, "** Event type is %d, flags are %d\n",
+ EventType, msg->cm_flags);
+ if (msg->cm_flags & CM_SKIP_HOOKS) {
+ lprintf(9, "Skipping hooks\n");
+ return(0);
+ }
+
+ /* Otherwise, run all the hooks appropriate to this event type.
+ */
for (fcn = MessageHookTable; fcn != NULL; fcn = fcn->next) {
if (fcn->eventtype == EventType) {
total_retval = total_retval +
}
}
+ /* Return the sum of the return codes from the hook functions. If
+ * this is an EVT_BEFORESAVE event, a nonzero return code will cause
+ * the save operation to abort.
+ */
return total_retval;
}
+
+
int PerformXmsgHooks(char *sender, char *recp, char *msg)
{
struct XmsgFunctionHook *fcn;
char *tempfilename, /* Where to fetch it from */
struct usersupp *is_mailbox, /* Mailbox room? */
int is_binary, /* Is encoding necessary? */
- int is_unique /* Del others of this type? */
+ int is_unique, /* Del others of this type? */
+ unsigned int flags /* Internal save flags */
)
{
MailboxName(roomname, is_mailbox, req_room);
else
safestrncpy(roomname, req_room, sizeof(roomname));
- lprintf(9, "CtdlWriteObject() to <%s>\n", roomname);
+ lprintf(9, "CtdlWriteObject() to <%s> (flags=%d)\n", roomname, flags);
strcpy(filename, tmpnam(NULL));
fp = fopen(filename, "w");
msg->cm_fields['O'] = strdoop(req_room);
msg->cm_fields['N'] = strdoop(config.c_nodename);
msg->cm_fields['H'] = strdoop(config.c_humannode);
+ msg->cm_flags = flags;
lprintf(9, "Loading\n");
fp = fopen(filename, "rb");
char *content_type,
void (*CallBack) (long msgnum) );
int CtdlDeleteMessages(char *, long, char *);
-void CtdlWriteObject(char *, char *, char *, struct usersupp *, int, int);
+void CtdlWriteObject(char *, char *, char *, struct usersupp *,
+ int, int, unsigned int);
struct CtdlMessage *CtdlFetchMessage(long msgnum);
void CtdlFreeMessage(struct CtdlMessage *msg);
void serialize_message(struct ser_ret *, struct CtdlMessage *);
fclose(fp);
/* this handy API function does all the work for us */
- CtdlWriteObject(CONFIGROOM, ICQMIME, temp, &CC->usersupp, 0, 1);
+ CtdlWriteObject(CONFIGROOM, ICQMIME, temp, &CC->usersupp, 0, 1, 0);
unlink(temp);
}
fclose(fp);
/* this handy API function does all the work for us */
- CtdlWriteObject(CONFIGROOM, ICQCLMIME, temp, &CC->usersupp, 0, 1);
+ CtdlWriteObject(CONFIGROOM, ICQCLMIME, temp, &CC->usersupp, 0, 1, 0);
unlink(temp);
}
/* ...and overwrite the records with new format records */
rewind(fp);
while (fread(&usbuf, sizeof(struct pre555usersupp), 1, fp) > 0) {
+ if (strlen(usbuf.fullname) > 0) {
lprintf(9, "Upgrading <%s>\n", usbuf.fullname);
memset(&newus, 0, sizeof(struct usersupp));
fclose(tp);
CtdlWriteObject(CONFIGROOM, "text/x-vcard",
- tempfilename, &newus, 0, 1);
+ tempfilename, &newus, 0, 1, CM_SKIP_HOOKS);
unlink(tempfilename);
-
+ }
}
fclose(fp); /* this file deletes automatically */
char config_rm[ROOMNAMELEN];
char buf[256];
+ lprintf(9, "entering beforesave hook\n");
+
/* If this isn't the configuration room, or if this isn't a MIME
* message, don't bother.
*/
temp, /* temp file */
u, /* which user */
0, /* not binary */
- 0); /* don't delete others of this type */
+ 0, /* don't delete others of this type */
+ 0); /* no flags */
unlink(temp);
}
*/
#define DEBUG_MEMORY_LEAKS
-struct CtdlMessage;
+/*
+ * New format for a message in memory
+ */
+#define CTDLMESSAGE_MAGIC 0x159d
+struct CtdlMessage {
+ int cm_magic; /* Self-check */
+ char cm_anon_type; /* Anonymous or author-visible */
+ char cm_format_type; /* Format type */
+ char *cm_fields[256]; /* Data fields */
+ unsigned int cm_flags; /* How to handle (NOT SAVED TO DISK) */
+};
+
+#define CM_SKIP_HOOKS 0x01 /* Don't run server-side handlers */
+
/*
* Generic per-session variable or data structure storage
};
-/*
- * New format for a message in memory
- */
-#define CTDLMESSAGE_MAGIC 0x159d
-struct CtdlMessage {
- int cm_magic; /* Self-check */
- char cm_anon_type; /* Anonymous or author-visible */
- char cm_format_type; /* Format type */
- char *cm_fields[256]; /* Data fields */
-};
-
/* Preferred field order */
/* ********* Important fields */
/* **************** Semi-important fields */