else {
TheMessage = CtdlFetchMessage(msg_num);
if (CC->cached_msg != NULL) {
- phree(CC->cached_msg);
+ phree(CC->cached_msg); /* FIXME efence? */
}
CC->cached_msg = TheMessage;
CC->cached_msgnum = msg_num;
}
}
- strcpy(force_room, force);
+ if (force == NULL) {
+ strcpy(force_room, "");
+ }
+ else {
+ strcpy(force_room, force);
+ }
/* Learn about what's inside, because it's what's inside that counts */
lprintf(9, "Learning what's inside\n");
/*
* Convenience function for generating small administrative messages.
*/
-void quickie_message(char *from, char *to, char *room, char *text)
+void quickie_message(char *from, char *to, char *room, char *text,
+ int format_type, char *subject)
{
struct CtdlMessage *msg;
struct recptypes *recp = NULL;
memset(msg, 0, sizeof(struct CtdlMessage));
msg->cm_magic = CTDLMESSAGE_MAGIC;
msg->cm_anon_type = MES_NORMAL;
- msg->cm_format_type = 0;
+ msg->cm_format_type = format_type;
msg->cm_fields['A'] = strdoop(from);
- msg->cm_fields['O'] = strdoop(room);
+ if (room != NULL) msg->cm_fields['O'] = strdoop(room);
msg->cm_fields['N'] = strdoop(NODENAME);
if (to != NULL) {
msg->cm_fields['R'] = strdoop(to);
recp = validate_recipients(to);
}
+ if (subject != NULL) {
+ msg->cm_fields['U'] = strdoop(subject);
+ }
msg->cm_fields['M'] = strdoop(text);
CtdlSubmitMsg(msg, recp, room);