From e6219cc9b27e56e3b41170f864da30fa7b13ee01 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Sun, 1 Sep 2013 14:33:21 +0200 Subject: [PATCH] Replace all discrete checks for empty message fields by CM_IsEmpty() --- citadel/euidindex.c | 2 +- citadel/internet_addressing.c | 32 ++++----- citadel/journaling.c | 18 +++--- citadel/modules/blog/serv_blog.c | 2 +- citadel/modules/calendar/serv_calendar.c | 4 +- citadel/modules/extnotify/extnotify_main.c | 4 +- citadel/modules/fulltext/serv_fulltext.c | 2 +- citadel/modules/imap/imap_fetch.c | 6 +- citadel/modules/imap/imap_search.c | 12 ++-- citadel/modules/inetcfg/serv_inetcfg.c | 2 +- citadel/modules/network/serv_netfilter.c | 8 +-- citadel/modules/network/serv_netmail.c | 17 +++-- citadel/modules/network/serv_netspool.c | 12 ++-- citadel/modules/network/serv_network.c | 4 +- citadel/modules/sieve/serv_sieve.c | 18 +++--- citadel/modules/smtp/serv_smtp.c | 8 ++- citadel/modules/spam/serv_spam.c | 3 - citadel/modules/vcard/serv_vcard.c | 24 ++++--- citadel/modules/wiki/serv_wiki.c | 12 ++-- citadel/msgbase.c | 75 ++++++++++++---------- citadel/msgbase.h | 1 + 21 files changed, 138 insertions(+), 128 deletions(-) diff --git a/citadel/euidindex.c b/citadel/euidindex.c index bcf0606ed..8a40cce13 100644 --- a/citadel/euidindex.c +++ b/citadel/euidindex.c @@ -162,7 +162,7 @@ void rebuild_euid_index_for_msg(long msgnum, void *userdata) { msg = CtdlFetchMessage(msgnum, 0); if (msg == NULL) return; - if (msg->cm_fields[eExclusiveID] != NULL) { + if (!CM_IsEmpty(msg, eExclusiveID)) { index_message_by_euid(msg->cm_fields[eExclusiveID], &CC->room, msgnum); } CtdlFreeMessage(msg); diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index 14c9900df..32e70af1a 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -589,7 +589,7 @@ int convert_field(struct CtdlMessage *msg, const char *beg, const char *end) { parsed_date = parsedate(value); if (parsed_date < 0L) parsed_date = time(NULL); - if (msg->cm_fields[eTimestamp] == NULL) + if (CM_IsEmpty(msg, eTimestamp)) CM_SetFieldLONG(msg, eTimestamp, parsed_date); processed = 1; } @@ -598,39 +598,39 @@ int convert_field(struct CtdlMessage *msg, const char *beg, const char *end) { process_rfc822_addr(value, user, node, name); syslog(LOG_DEBUG, "Converted to <%s@%s> (%s)\n", user, node, name); snprintf(addr, sizeof(addr), "%s@%s", user, node); - if (msg->cm_fields[eAuthor] == NULL) + if (CM_IsEmpty(msg, eAuthor)) CM_SetField(msg, eAuthor, name, strlen(name)); - if (msg->cm_fields[erFc822Addr] == NULL) + if (CM_IsEmpty(msg, erFc822Addr)) CM_SetField(msg, erFc822Addr, addr, strlen(addr)); processed = 1; } else if (!strcasecmp(key, "Subject")) { - if (msg->cm_fields[eMsgSubject] == NULL) + if (CM_IsEmpty(msg, eMsgSubject)) CM_SetField(msg, eMsgSubject, value, valuelen); processed = 1; } else if (!strcasecmp(key, "List-ID")) { - if (msg->cm_fields[eListID] == NULL) + if (CM_IsEmpty(msg, eListID)) CM_SetField(msg, eListID, value, valuelen); processed = 1; } else if (!strcasecmp(key, "To")) { - if (msg->cm_fields[eRecipient] == NULL) + if (CM_IsEmpty(msg, eRecipient)) CM_SetField(msg, eRecipient, value, valuelen); processed = 1; } else if (!strcasecmp(key, "CC")) { - if (msg->cm_fields[eCarbonCopY] == NULL) + if (CM_IsEmpty(msg, eCarbonCopY)) CM_SetField(msg, eCarbonCopY, value, valuelen); processed = 1; } else if (!strcasecmp(key, "Message-ID")) { - if (msg->cm_fields[emessageId] != NULL) { + if (!CM_IsEmpty(msg, emessageId)) { syslog(LOG_WARNING, "duplicate message id\n"); } else { @@ -658,13 +658,13 @@ int convert_field(struct CtdlMessage *msg, const char *beg, const char *end) { } else if (!strcasecmp(key, "Return-Path")) { - if (msg->cm_fields[eMessagePath] == NULL) + if (CM_IsEmpty(msg, eMessagePath)) CM_SetField(msg, eMessagePath, value, valuelen); processed = 1; } else if (!strcasecmp(key, "Envelope-To")) { - if (msg->cm_fields[eenVelopeTo] == NULL) + if (CM_IsEmpty(msg, eenVelopeTo)) CM_SetField(msg, eenVelopeTo, value, valuelen); processed = 1; } @@ -680,7 +680,7 @@ int convert_field(struct CtdlMessage *msg, const char *beg, const char *end) { } else if (!strcasecmp(key, "In-reply-to")) { - if (msg->cm_fields[eWeferences] == NULL) /* References: supersedes In-reply-to: */ + if (CM_IsEmpty(msg, eWeferences)) /* References: supersedes In-reply-to: */ CM_SetField(msg, eWeferences, value, valuelen); processed = 1; } @@ -821,14 +821,14 @@ struct CtdlMessage *convert_internet_message_buf(StrBuf **rfc822) /* Follow-up sanity checks... */ /* If there's no timestamp on this message, set it to now. */ - if (msg->cm_fields[eTimestamp] == NULL) { + if (CM_IsEmpty(msg, eTimestamp)) { CM_SetFieldLONG(msg, eTimestamp, time(NULL)); } /* If a W (references, or rather, Wefewences) field is present, we * have to convert it from RFC822 format to Citadel format. */ - if (msg->cm_fields[eWeferences] != NULL) { + if (!CM_IsEmpty(msg, eWeferences)) { /// todo: API! convert_references_to_wefewences(msg->cm_fields[eWeferences]); } @@ -1022,10 +1022,10 @@ char *harvest_collected_addresses(struct CtdlMessage *msg) { is_harvestable = 1; strcpy(addr, ""); - if (msg->cm_fields[eAuthor] != NULL) { + if (!CM_IsEmpty(msg, eAuthor)) { strcat(addr, msg->cm_fields[eAuthor]); } - if (msg->cm_fields[erFc822Addr] != NULL) { + if (!CM_IsEmpty(msg, erFc822Addr)) { strcat(addr, " <"); strcat(addr, msg->cm_fields[erFc822Addr]); strcat(addr, ">"); @@ -1048,7 +1048,7 @@ char *harvest_collected_addresses(struct CtdlMessage *msg) { if (i == 0) field = eRecipient; if (i == 1) field = eCarbonCopY; - if (msg->cm_fields[field] != NULL) { + if (!CM_IsEmpty(msg, field)) { for (j=0; jcm_fields[field], ','); ++j) { extract_token(addr, msg->cm_fields[field], j, ',', sizeof addr); if (strstr(addr, "=?") != NULL) diff --git a/citadel/journaling.c b/citadel/journaling.c index d1daf5a7a..9ea593bd8 100644 --- a/citadel/journaling.c +++ b/citadel/journaling.c @@ -59,7 +59,7 @@ void JournalBackgroundSubmit(struct CtdlMessage *msg, struct jnlq *jptr = NULL; /* Avoid double journaling! */ - if (msg->cm_fields[eJournal] != NULL) { + if (!CM_IsEmpty(msg, eJournal)) { FreeStrBuf(&saved_rfc822_version); return; } @@ -71,11 +71,11 @@ void JournalBackgroundSubmit(struct CtdlMessage *msg, } memset(jptr, 0, sizeof(struct jnlq)); if (recps != NULL) memcpy(&jptr->recps, recps, sizeof(struct recptypes)); - if (msg->cm_fields[eAuthor] != NULL) jptr->from = strdup(msg->cm_fields[eAuthor]); - if (msg->cm_fields[eNodeName] != NULL) jptr->node = strdup(msg->cm_fields[eNodeName]); - if (msg->cm_fields[erFc822Addr] != NULL) jptr->rfca = strdup(msg->cm_fields[erFc822Addr]); - if (msg->cm_fields[eMsgSubject] != NULL) jptr->subj = strdup(msg->cm_fields[eMsgSubject]); - if (msg->cm_fields[emessageId] != NULL) jptr->msgn = strdup(msg->cm_fields[emessageId]); + if (!CM_IsEmpty(msg, eAuthor)) jptr->from = strdup(msg->cm_fields[eAuthor]); + if (!CM_IsEmpty(msg, eNodeName)) jptr->node = strdup(msg->cm_fields[eNodeName]); + if (!CM_IsEmpty(msg, erFc822Addr)) jptr->rfca = strdup(msg->cm_fields[erFc822Addr]); + if (!CM_IsEmpty(msg, eMsgSubject)) jptr->subj = strdup(msg->cm_fields[eMsgSubject]); + if (!CM_IsEmpty(msg, emessageId)) jptr->msgn = strdup(msg->cm_fields[emessageId]); jptr->rfc822 = SmashStrBuf(&saved_rfc822_version); /* Add to the queue */ @@ -193,7 +193,7 @@ void JournalRunQueueMsg(struct jnlq *jmsg) { "\r\n" "Sender: "), 0); - if (journal_msg->cm_fields[eAuthor]) + if (CM_IsEmpty(journal_msg, eAuthor)) StrBufAppendBufPlain( message_text, journal_msg->cm_fields[eAuthor], -1, 0); @@ -202,11 +202,11 @@ void JournalRunQueueMsg(struct jnlq *jmsg) { message_text, HKEY("(null)"), 0); - if (journal_msg->cm_fields[erFc822Addr]) { + if (!CM_IsEmpty(journal_msg, erFc822Addr)) { StrBufAppendPrintf(message_text, " <%s>", journal_msg->cm_fields[erFc822Addr]); } - else if (journal_msg->cm_fields[eNodeName]) { + else if (!CM_IsEmpty(journal_msg, eNodeName)) { StrBufAppendPrintf(message_text, " @ %s", journal_msg->cm_fields[eNodeName]); } diff --git a/citadel/modules/blog/serv_blog.c b/citadel/modules/blog/serv_blog.c index a6513e775..891c2cccf 100644 --- a/citadel/modules/blog/serv_blog.c +++ b/citadel/modules/blog/serv_blog.c @@ -72,7 +72,7 @@ int blog_upload_beforesave(struct CtdlMessage *msg) { /* * If the message doesn't have an EUID, give it one. */ - if (msg->cm_fields[eExclusiveID] == NULL) + if (CM_IsEmpty(msg, eExclusiveID)) { char uuid[SIZ]; generate_uuid(uuid); diff --git a/citadel/modules/calendar/serv_calendar.c b/citadel/modules/calendar/serv_calendar.c index a70baada4..e6b4fb4b0 100644 --- a/citadel/modules/calendar/serv_calendar.c +++ b/citadel/modules/calendar/serv_calendar.c @@ -2407,7 +2407,7 @@ int ical_obj_beforesave(struct CtdlMessage *msg) return(1); /* You tried to save a non-RFC822 message! */ } - if (msg->cm_fields[eMesageText] == NULL) { + if (CM_IsEmpty(msg, eMesageText)) { return(1); /* You tried to save a null message! */ } @@ -2478,7 +2478,7 @@ int ical_obj_aftersave(struct CtdlMessage *msg) if (msg->cm_format_type != 4) return(1); /* Reject null messages */ - if (msg->cm_fields[eMesageText] == NULL) return(1); + if (CM_IsEmpty(msg, eMesageText)) return(1); /* Now recurse through it looking for our icalendar data */ mime_parser(msg->cm_fields[eMesageText], diff --git a/citadel/modules/extnotify/extnotify_main.c b/citadel/modules/extnotify/extnotify_main.c index 6d865082c..3eced5a59 100644 --- a/citadel/modules/extnotify/extnotify_main.c +++ b/citadel/modules/extnotify/extnotify_main.c @@ -186,7 +186,7 @@ eNotifyType extNotify_getConfigMessage(char *username, for (a = 0; a < num_msgs; ++a) { msg = CtdlFetchMessage(msglist[a], 1); if (msg != NULL) { - if ((msg->cm_fields[eMsgSubject] != NULL) && + if (!CM_IsEmpty(msg, eMsgSubject) && (strncasecmp(msg->cm_fields[eMsgSubject], PAGER_CONFIG_MESSAGE, strlen(PAGER_CONFIG_MESSAGE)) == 0)) @@ -280,7 +280,7 @@ void process_notify(long NotifyMsgnum, void *usrdata) Ctx = (NotifyContext*) usrdata; msg = CtdlFetchMessage(NotifyMsgnum, 1); - if ( msg->cm_fields[eExtnotify] != NULL) + if (!CM_IsEmpty(msg, eExtnotify)) { Type = extNotify_getConfigMessage( msg->cm_fields[eExtnotify], diff --git a/citadel/modules/fulltext/serv_fulltext.c b/citadel/modules/fulltext/serv_fulltext.c index 547caaefd..7943e344c 100644 --- a/citadel/modules/fulltext/serv_fulltext.c +++ b/citadel/modules/fulltext/serv_fulltext.c @@ -126,7 +126,7 @@ void ft_index_message(long msgnum, int op) { return; } - if (msg->cm_fields[eSuppressIdx] != NULL) { + if (!CM_IsEmpty(msg, eSuppressIdx)) { syslog(LOG_DEBUG, "ft_index_message() excluded msg %ld", msgnum); CtdlFreeMessage(msg); return; diff --git a/citadel/modules/imap/imap_fetch.c b/citadel/modules/imap/imap_fetch.c index b9319610c..eb36ff9b3 100644 --- a/citadel/modules/imap/imap_fetch.c +++ b/citadel/modules/imap/imap_fetch.c @@ -110,7 +110,7 @@ void imap_fetch_internaldate(struct CtdlMessage *msg) { time_t msgdate; if (!msg) return; - if (msg->cm_fields[eTimestamp] != NULL) { + if (!CM_IsEmpty(msg, eTimestamp)) { msgdate = atol(msg->cm_fields[eTimestamp]); } else { @@ -359,7 +359,7 @@ void imap_output_envelope_from(struct CtdlMessage *msg) { IAPuts(" NIL "); /* source route (not used) */ - if (msg->cm_fields[erFc822Addr] != NULL) { + if (!CM_IsEmpty(msg, erFc822Addr)) { process_rfc822_addr(msg->cm_fields[erFc822Addr], user, node, name); plain_imap_strout(user); /* mailbox name (user id) */ IAPuts(" "); @@ -445,7 +445,7 @@ void imap_fetch_envelope(struct CtdlMessage *msg) { if (!msg) return; /* Parse the message date into an IMAP-format date string */ - if (msg->cm_fields[eTimestamp] != NULL) { + if (!CM_IsEmpty(msg, eTimestamp)) { msgdate = atol(msg->cm_fields[eTimestamp]); } else { diff --git a/citadel/modules/imap/imap_search.c b/citadel/modules/imap/imap_search.c index 387e747c9..aaa02dbe2 100644 --- a/citadel/modules/imap/imap_search.c +++ b/citadel/modules/imap/imap_search.c @@ -142,7 +142,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg, need_to_free_msg = 1; } if (msg != NULL) { - if (msg->cm_fields[eTimestamp] != NULL) { + if (!CM_IsEmpty(msg, eTimestamp)) { if (imap_datecmp(itemlist[pos+1].Key, atol(msg->cm_fields[eTimestamp])) < 0) { match = 1; @@ -308,7 +308,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg, need_to_free_msg = 1; } if (msg != NULL) { - if (msg->cm_fields[eTimestamp] != NULL) { + if (!CM_IsEmpty(msg, eTimestamp)) { if (imap_datecmp(itemlist[pos+1].Key, atol(msg->cm_fields[eTimestamp])) == 0) { match = 1; @@ -338,7 +338,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg, need_to_free_msg = 1; } if (msg != NULL) { - if (msg->cm_fields[eTimestamp] != NULL) { + if (!CM_IsEmpty(msg, eTimestamp)) { if (imap_datecmp(itemlist[pos+1].Key, atol(msg->cm_fields[eTimestamp])) < 0) { match = 1; @@ -354,7 +354,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg, need_to_free_msg = 1; } if (msg != NULL) { - if (msg->cm_fields[eTimestamp] != NULL) { + if (!CM_IsEmpty(msg, eTimestamp)) { if (imap_datecmp(itemlist[pos+1].Key, atol(msg->cm_fields[eTimestamp])) == 0) { match = 1; @@ -370,7 +370,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg, need_to_free_msg = 1; } if (msg != NULL) { - if (msg->cm_fields[eTimestamp] != NULL) { + if (!CM_IsEmpty(msg, eTimestamp)) { if (imap_datecmp(itemlist[pos+1].Key, atol(msg->cm_fields[eTimestamp])) >= 0) { match = 1; @@ -386,7 +386,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg, need_to_free_msg = 1; } if (msg != NULL) { - if (msg->cm_fields[eTimestamp] != NULL) { + if (!CM_IsEmpty(msg, eTimestamp)) { if (imap_datecmp(itemlist[pos+1].Key, atol(msg->cm_fields[eTimestamp])) >= 0) { match = 1; diff --git a/citadel/modules/inetcfg/serv_inetcfg.c b/citadel/modules/inetcfg/serv_inetcfg.c index 8aa98b2d1..44e1a4c01 100644 --- a/citadel/modules/inetcfg/serv_inetcfg.c +++ b/citadel/modules/inetcfg/serv_inetcfg.c @@ -66,7 +66,7 @@ void inetcfg_setTo(struct CtdlMessage *msg) { char *conf; char buf[SIZ]; - if (msg->cm_fields[eMesageText]==NULL) return; + if (CM_IsEmpty(msg, eMesageText)) return; conf = strdup(msg->cm_fields[eMesageText]); if (conf != NULL) { diff --git a/citadel/modules/network/serv_netfilter.c b/citadel/modules/network/serv_netfilter.c index 0c2ca0e58..588cced6a 100644 --- a/citadel/modules/network/serv_netfilter.c +++ b/citadel/modules/network/serv_netfilter.c @@ -149,28 +149,28 @@ int filter_the_idiots(struct CtdlMessage *msg, char *target_room) { zap_room = 0; zap_node = 0; - if (msg->cm_fields[eAuthor] != NULL) { + if (!CM_IsEmpty(msg, eAuthor)) { if ( (!strcasecmp(msg->cm_fields[eAuthor], fptr->fl_user)) || (fptr->fl_user[0] == 0) ) { zap_user = 1; } } - if (msg->cm_fields[eRemoteRoom] != NULL) { + if (!CM_IsEmpty(msg, eRemoteRoom)) { if ( (!strcasecmp(msg->cm_fields[eRemoteRoom], fptr->fl_room)) || (fptr->fl_room[0] == 0) ) { zap_room = 1; } } - if (msg->cm_fields[eOriginalRoom] != NULL) { + if (!CM_IsEmpty(msg, eOriginalRoom)) { if ( (!strcasecmp(msg->cm_fields[eOriginalRoom], fptr->fl_room)) || (fptr->fl_room[0] == 0) ) { zap_room = 1; } } - if (msg->cm_fields[eNodeName] != NULL) { + if (!CM_IsEmpty(msg, eNodeName)) { if ( (!strcasecmp(msg->cm_fields[eNodeName], fptr->fl_node)) || (fptr->fl_node[0] == 0) ) { zap_node = 1; diff --git a/citadel/modules/network/serv_netmail.c b/citadel/modules/network/serv_netmail.c index dd47f2592..287436bbf 100644 --- a/citadel/modules/network/serv_netmail.c +++ b/citadel/modules/network/serv_netmail.c @@ -133,7 +133,7 @@ static void ListCalculateSubject(struct CtdlMessage *msg) int rlen; char *pCh; - if (msg->cm_fields[eMsgSubject] == NULL) { + if (CM_IsEmpty(msg, eMsgSubject)) { Subject = NewStrBufPlain(HKEY("(no subject)")); } else { @@ -263,23 +263,23 @@ void network_process_digest(SpoolControl *sc, struct CtdlMessage *omsg, long *de "------------------------------------" "-------\n"); fprintf(sc->digestfp, "From: "); - if (msg->cm_fields[eAuthor] != NULL) { + if (!CM_IsEmpty(msg, eAuthor)) { fprintf(sc->digestfp, "%s ", msg->cm_fields[eAuthor]); } - if (msg->cm_fields[erFc822Addr] != NULL) { + if (!CM_IsEmpty(msg, erFc822Addr)) { fprintf(sc->digestfp, "<%s> ", msg->cm_fields[erFc822Addr]); } - else if (msg->cm_fields[eNodeName] != NULL) { + else if (!CM_IsEmpty(msg, eNodeName)) { fprintf(sc->digestfp, "@%s ", msg->cm_fields[eNodeName]); } fprintf(sc->digestfp, "\n"); - if (msg->cm_fields[eMsgSubject] != NULL) { + if (!CM_IsEmpty(msg, eMsgSubject)) { fprintf(sc->digestfp, "Subject: %s\n", msg->cm_fields[eMsgSubject]); @@ -333,8 +333,7 @@ void network_process_list(SpoolControl *sc, struct CtdlMessage *omsg, long *dele * of the list message to the email address of the * room itself. */ - if ((msg->cm_fields[eRecipient] == NULL) || - IsEmptyStr(msg->cm_fields[eRecipient])) + if (CM_IsEmpty(msg, eRecipient)) { CM_SetField(msg, eRecipient, SKEY(sc->Users[roommailalias])); } @@ -403,7 +402,7 @@ void network_process_participate(SpoolControl *sc, struct CtdlMessage *omsg, lon * is rude... */ ok_to_participate = 0; - if (msg->cm_fields[eNodeName] != NULL) { + if (!CM_IsEmpty(msg, eNodeName)) { if (!strcasecmp(msg->cm_fields[eNodeName], config.c_nodename)) { ok_to_participate = 1; @@ -471,7 +470,7 @@ void network_process_ignetpush(SpoolControl *sc, struct CtdlMessage *omsg, long * Determine if this message is set to be deleted * after sending out on the network */ - if (msg->cm_fields[eSpecialField] != NULL) { + if (!CM_IsEmpty(msg, eSpecialField)) { if (!strcasecmp(msg->cm_fields[eSpecialField], "CANCEL")) { *delete_after_send = 1; } diff --git a/citadel/modules/network/serv_netspool.c b/citadel/modules/network/serv_netspool.c index dac6db41c..586b945da 100644 --- a/citadel/modules/network/serv_netspool.c +++ b/citadel/modules/network/serv_netspool.c @@ -166,7 +166,7 @@ void Netmap_AddMe(struct CtdlMessage *msg, const char *defl, long defllen) char buf[SIZ]; /* prepend our node to the path */ - if (msg->cm_fields[eMessagePath] == NULL) { + if (CM_IsEmpty(msg, eMessagePath)) { CM_SetField(msg, eMessagePath, defl, defllen); } node_len = strlen(config.c_nodename); @@ -459,7 +459,7 @@ void network_process_buffer(char *buffer, long size, HashList *working_ignetcfg, } /* Check for message routing */ - if (msg->cm_fields[eDestination] != NULL) { + if (!CM_IsEmpty(msg, eDestination)) { if (strcasecmp(msg->cm_fields[eDestination], config.c_nodename)) { /* route the message */ @@ -527,7 +527,7 @@ void network_process_buffer(char *buffer, long size, HashList *working_ignetcfg, } /* Learn network topology from the path */ - if ((msg->cm_fields[eNodeName] != NULL) && (msg->cm_fields[eMessagePath] != NULL)) { + if (!CM_IsEmpty(msg, eNodeName) && !CM_IsEmpty(msg, eMessagePath)) { NetworkLearnTopology(msg->cm_fields[eNodeName], msg->cm_fields[eMessagePath], the_netmap, @@ -537,12 +537,12 @@ void network_process_buffer(char *buffer, long size, HashList *working_ignetcfg, /* Is the sending node giving us a very persuasive suggestion about * which room this message should be saved in? If so, go with that. */ - if (msg->cm_fields[eRemoteRoom] != NULL) { + if (!CM_IsEmpty(msg, eRemoteRoom)) { safestrncpy(target_room, msg->cm_fields[eRemoteRoom], sizeof target_room); } /* Otherwise, does it have a recipient? If so, validate it... */ - else if (msg->cm_fields[eRecipient] != NULL) { + else if (!CM_IsEmpty(msg, eRecipient)) { recp = validate_recipients(msg->cm_fields[eRecipient], NULL, 0); if (recp != NULL) if (recp->num_error != 0) { network_bounce(msg, @@ -559,7 +559,7 @@ void network_process_buffer(char *buffer, long size, HashList *working_ignetcfg, /* Our last shot at finding a home for this message is to see if * it has the eOriginalRoom (O) field (Originating room) set. */ - else if (msg->cm_fields[eOriginalRoom] != NULL) { + else if (!CM_IsEmpty(msg, eOriginalRoom)) { safestrncpy(target_room, msg->cm_fields[eOriginalRoom], sizeof target_room); } diff --git a/citadel/modules/network/serv_network.c b/citadel/modules/network/serv_network.c index b2b296ef8..8533d8410 100644 --- a/citadel/modules/network/serv_network.c +++ b/citadel/modules/network/serv_network.c @@ -111,7 +111,7 @@ int network_usetable(struct CtdlMessage *msg) time_t now; /* Bail out if we can't generate a message ID */ - if ((msg == NULL) || (msg->cm_fields[emessageId] == NULL) || (IsEmptyStr(msg->cm_fields[emessageId]))) + if ((msg == NULL) || CM_IsEmpty(msg, emessageId)) { return(0); } @@ -120,7 +120,7 @@ int network_usetable(struct CtdlMessage *msg) msgid = NewStrBufPlain(msg->cm_fields[emessageId], -1); if (haschar(ChrPtr(msgid), '@') == 0) { StrBufAppendBufPlain(msgid, HKEY("@"), 0); - if (msg->cm_fields[eNodeName] != NULL) { + if (!CM_IsEmpty(msg, eNodeName)) { StrBufAppendBufPlain(msgid, msg->cm_fields[eNodeName], -1, 0); } else { diff --git a/citadel/modules/sieve/serv_sieve.c b/citadel/modules/sieve/serv_sieve.c index 4a9fcbf0f..a1b6f4008 100644 --- a/citadel/modules/sieve/serv_sieve.c +++ b/citadel/modules/sieve/serv_sieve.c @@ -586,13 +586,13 @@ void sieve_do_msg(long msgnum, void *userdata) { process_rfc822_addr(msg->cm_fields[eRecipient], my.recp_user, my.recp_node, my.recp_name); /* Keep track of the sender so we can use it for REJECT and VACATION responses */ - if (msg->cm_fields[erFc822Addr] != NULL) { + if (!CM_IsEmpty(msg, erFc822Addr)) { safestrncpy(my.sender, msg->cm_fields[erFc822Addr], sizeof my.sender); } - else if ( (msg->cm_fields[eAuthor] != NULL) && (msg->cm_fields[eNodeName] != NULL) ) { + else if ( (!CM_IsEmpty(msg, eAuthor)) && (!CM_IsEmpty(msg, eNodeName)) ) { snprintf(my.sender, sizeof my.sender, "%s@%s", msg->cm_fields[eAuthor], msg->cm_fields[eNodeName]); } - else if (msg->cm_fields[eAuthor] != NULL) { + else if (!CM_IsEmpty(msg, eAuthor)) { safestrncpy(my.sender, msg->cm_fields[eAuthor], sizeof my.sender); } else { @@ -600,7 +600,7 @@ void sieve_do_msg(long msgnum, void *userdata) { } /* Keep track of the subject so we can use it for VACATION responses */ - if (msg->cm_fields[eMsgSubject] != NULL) { + if (!CM_IsEmpty(msg, eMsgSubject)) { safestrncpy(my.subject, msg->cm_fields[eMsgSubject], sizeof my.subject); } else { @@ -608,11 +608,11 @@ void sieve_do_msg(long msgnum, void *userdata) { } /* Keep track of the envelope-from address (use body-from if not found) */ - if (msg->cm_fields[eMessagePath] != NULL) { + if (!CM_IsEmpty(msg, eMessagePath)) { safestrncpy(my.envelope_from, msg->cm_fields[eMessagePath], sizeof my.envelope_from); stripallbut(my.envelope_from, '<', '>'); } - else if (msg->cm_fields[erFc822Addr] != NULL) { + else if (!CM_IsEmpty(msg, erFc822Addr)) { safestrncpy(my.envelope_from, msg->cm_fields[erFc822Addr], sizeof my.envelope_from); stripallbut(my.envelope_from, '<', '>'); } @@ -630,13 +630,13 @@ void sieve_do_msg(long msgnum, void *userdata) { } /* Keep track of the envelope-to address (use body-to if not found) */ - if (msg->cm_fields[eenVelopeTo] != NULL) { + if (!CM_IsEmpty(msg, eenVelopeTo)) { safestrncpy(my.envelope_to, msg->cm_fields[eenVelopeTo], sizeof my.envelope_to); stripallbut(my.envelope_to, '<', '>'); } - else if (msg->cm_fields[eRecipient] != NULL) { + else if (!CM_IsEmpty(msg, eRecipient)) { safestrncpy(my.envelope_to, msg->cm_fields[eRecipient], sizeof my.envelope_to); - if (msg->cm_fields[eDestination] != NULL) { + if (!CM_IsEmpty(msg, eDestination)) { strcat(my.envelope_to, "@"); strcat(my.envelope_to, msg->cm_fields[eDestination]); } diff --git a/citadel/modules/smtp/serv_smtp.c b/citadel/modules/smtp/serv_smtp.c index 9559d1c5a..44fa78804 100644 --- a/citadel/modules/smtp/serv_smtp.c +++ b/citadel/modules/smtp/serv_smtp.c @@ -320,7 +320,9 @@ void smtp_webcit_preferences_hack_backend(long msgnum, void *userdata) { return; } - if ( (msg->cm_fields[eMsgSubject]) && (!strcasecmp(msg->cm_fields[eMsgSubject], "__ WebCit Preferences __")) ) { + if ( !CM_IsEmpty(msg, eMsgSubject) && + (!strcasecmp(msg->cm_fields[eMsgSubject], "__ WebCit Preferences __"))) + { /* This is it! Change ownership of the message text so it doesn't get freed. */ *webcit_conf = (char *)msg->cm_fields[eMesageText]; msg->cm_fields[eMesageText] = NULL; @@ -813,7 +815,7 @@ void smtp_data(long offset, long flags) if ( (CCC->logged_in) && (config.c_rfc822_strict_from != CFG_SMTP_FROM_NOFILTER) ) { int validemail = 0; - if (!IsEmptyStr(msg->cm_fields[erFc822Addr]) && + if (!CM_IsEmpty(msg, erFc822Addr) && ((config.c_rfc822_strict_from == CFG_SMTP_FROM_CORRECT) || (config.c_rfc822_strict_from == CFG_SMTP_FROM_REJECT) ) ) { @@ -875,7 +877,7 @@ void smtp_data(long offset, long flags) if (scan_errors > 0) { /* We don't want this message! */ - if (msg->cm_fields[eErrorMsg] == NULL) { + if (CM_IsEmpty(msg, eErrorMsg)) { CM_SetField(msg, eErrorMsg, HKEY("Message rejected by filter")); } diff --git a/citadel/modules/spam/serv_spam.c b/citadel/modules/spam/serv_spam.c index c0ced7eeb..77365b16c 100644 --- a/citadel/modules/spam/serv_spam.c +++ b/citadel/modules/spam/serv_spam.c @@ -176,9 +176,6 @@ int spam_assassin(struct CtdlMessage *msg) { } if (is_spam) { - if (msg->cm_fields[eErrorMsg] != NULL) { - free(msg->cm_fields[eErrorMsg]); - } CM_SetField(msg, eErrorMsg, HKEY("message rejected by spam filter")); } } diff --git a/citadel/modules/vcard/serv_vcard.c b/citadel/modules/vcard/serv_vcard.c index 36fdb257d..9f493a65d 100644 --- a/citadel/modules/vcard/serv_vcard.c +++ b/citadel/modules/vcard/serv_vcard.c @@ -94,8 +94,8 @@ void vcard_extract_internet_addresses(struct CtdlMessage *msg, int (*callback)(c int instance = 0; int found_something = 0; - if (msg->cm_fields[eAuthor] == NULL) return; - if (msg->cm_fields[eNodeName] == NULL) return; + if (CM_IsEmpty(msg, eAuthor)) return; + if (CM_IsEmpty(msg, eNodeName)) return; snprintf(citadel_address, sizeof citadel_address, "%s @ %s", msg->cm_fields[eAuthor], msg->cm_fields[eNodeName]); @@ -330,7 +330,6 @@ void vcard_extract_vcard(char *name, char *filename, char *partnum, char *disp, */ int vcard_upload_beforesave(struct CtdlMessage *msg) { struct CitContext *CCC = CC; - char *ptr; char *s; char buf[SIZ]; struct ctdluser usbuf; @@ -373,8 +372,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) { /* Ok, if we got this far, look into the situation further... */ - ptr = msg->cm_fields[eMesageText]; - if (ptr == NULL) return(0); + if (CM_IsEmpty(msg, eMesageText)) return(0); mime_parser(msg->cm_fields[eMesageText], NULL, @@ -460,7 +458,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) { s = vcard_get_prop(v, "UID", 1, 0, 0); if (s != NULL) { CM_SetField(msg, eExclusiveID, s, strlen(s)); - if (msg->cm_fields[eMsgSubject] == NULL) { + if (CM_IsEmpty(msg, eMsgSubject)) { CM_CopyField(msg, eMsgSubject, eExclusiveID); } } @@ -535,8 +533,10 @@ int vcard_upload_aftersave(struct CtdlMessage *msg) { if (!is_UserConf && !is_GAB) return(0); + if (CM_IsEmpty(msg, eMesageText)) + return 0; + ptr = msg->cm_fields[eMesageText]; - if (ptr == NULL) return(0); NewStrBufDupAppendFlush(&CCC->StatusMessage, NULL, NULL, 0); @@ -934,8 +934,11 @@ int vcard_extract_from_network(struct CtdlMessage *msg, char *target_room) { if (msg->cm_format_type != 4) return(0); + if (CM_IsEmpty(msg, eMesageText)) + return 0; + ptr = msg->cm_fields[eMesageText]; - if (ptr == NULL) return(0); + while (ptr != NULL) { linelen = strcspn(ptr, "\n"); @@ -977,8 +980,11 @@ void vcard_delete_remove(char *room, long msgnum) { msg = CtdlFetchMessage(msgnum, 1); if (msg == NULL) return; + if (CM_IsEmpty(msg, eMesageText)) + goto EOH; + ptr = msg->cm_fields[eMesageText]; - if (ptr == NULL) goto EOH; + while (ptr != NULL) { linelen = strcspn(ptr, "\n"); if (linelen == 0) goto EOH; diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index 33d856310..052ab2ff3 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -101,7 +101,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) { if (msg->cm_format_type != 4) return(0); /* If there's no EUID we can't do this. Reject the post. */ - if (msg->cm_fields[eExclusiveID] == NULL) return(1); + if (CM_IsEmpty(msg, eExclusiveID)) return(1); history_page_len = snprintf(history_page, sizeof history_page, "%s_HISTORY_", msg->cm_fields[eExclusiveID]); @@ -117,7 +117,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) { } /* If there's no message text, obviously this is all b0rken and shouldn't happen at all */ - if (msg->cm_fields[eMesageText] == NULL) return(0); + if (CM_IsEmpty(msg, eMesageText)) return(0); /* Set the message subject identical to the page name */ CM_CopyField(msg, eMsgSubject, eExclusiveID); @@ -131,7 +131,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) { old_msg = NULL; } - if ((old_msg != NULL) && (old_msg->cm_fields[eMesageText] == NULL)) { /* old version is corrupt? */ + if ((old_msg != NULL) && (CM_IsEmpty(old_msg, eMesageText))) { /* old version is corrupt? */ CtdlFreeMessage(old_msg); old_msg = NULL; } @@ -394,7 +394,7 @@ void wiki_history(char *pagename) { msg = NULL; } - if ((msg != NULL) && (msg->cm_fields[eMesageText] == NULL)) { + if ((msg != NULL) && CM_IsEmpty(msg, eMesageText)) { CtdlFreeMessage(msg); msg = NULL; } @@ -526,7 +526,7 @@ void wiki_rev(char *pagename, char *rev, char *operation) msg = NULL; } - if ((msg != NULL) && (msg->cm_fields[eMesageText] == NULL)) { + if ((msg != NULL) && CM_IsEmpty(msg, eMesageText)) { CtdlFreeMessage(msg); msg = NULL; } @@ -560,7 +560,7 @@ void wiki_rev(char *pagename, char *rev, char *operation) msg = NULL; } - if ((msg != NULL) && (msg->cm_fields[eMesageText] == NULL)) { + if ((msg != NULL) && CM_IsEmpty(msg, eMesageText)) { CtdlFreeMessage(msg); msg = NULL; } diff --git a/citadel/msgbase.c b/citadel/msgbase.c index cc52aec73..73d6bfe19 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -156,6 +156,13 @@ eMsgField FieldOrder[] = { }; static const long NDiskFields = sizeof(FieldOrder) / sizeof(eMsgField); + +int CM_IsEmpty(struct CtdlMessage *Msg, eMsgField which) +{ + return !((Msg->cm_fields[which] != NULL) && + (Msg->cm_fields[which][0] != '\0')); +} + void CM_SetField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length) { if (Msg->cm_fields[which] != NULL) @@ -425,11 +432,11 @@ void headers_listing(long msgnum, void *userdata) cprintf("%ld|%s|%s|%s|%s|%s|\n", msgnum, - (msg->cm_fields[eTimestamp] ? msg->cm_fields[eTimestamp] : "0"), - (msg->cm_fields[eAuthor] ? msg->cm_fields[eAuthor] : ""), - (msg->cm_fields[eNodeName] ? msg->cm_fields[eNodeName] : ""), - (msg->cm_fields[erFc822Addr] ? msg->cm_fields[erFc822Addr] : ""), - (msg->cm_fields[eMsgSubject] ? msg->cm_fields[eMsgSubject] : "") + (!CM_IsEmpty(msg, eTimestamp) ? msg->cm_fields[eTimestamp] : "0"), + (!CM_IsEmpty(msg, eAuthor) ? msg->cm_fields[eAuthor] : ""), + (!CM_IsEmpty(msg, eNodeName) ? msg->cm_fields[eNodeName] : ""), + (!CM_IsEmpty(msg, erFc822Addr) ? msg->cm_fields[erFc822Addr] : ""), + (!CM_IsEmpty(msg, eMsgSubject) ? msg->cm_fields[eMsgSubject] : "") ); CtdlFreeMessage(msg); } @@ -449,8 +456,8 @@ void headers_euid(long msgnum, void *userdata) cprintf("%ld|%s|%s\n", msgnum, - (msg->cm_fields[eExclusiveID] ? msg->cm_fields[eExclusiveID] : ""), - (msg->cm_fields[eTimestamp] ? msg->cm_fields[eTimestamp] : "0")); + (!CM_IsEmpty(msg, eExclusiveID) ? msg->cm_fields[eExclusiveID] : ""), + (!CM_IsEmpty(msg, eTimestamp) ? msg->cm_fields[eTimestamp] : "0")); CtdlFreeMessage(msg); } @@ -1398,14 +1405,14 @@ struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body) * so go ahead and fetch that. Failing that, just set a dummy * body so other code doesn't barf. */ - if ( (ret->cm_fields[eMesageText] == NULL) && (with_body) ) { + if ( (CM_IsEmpty(ret, eMesageText)) && (with_body) ) { dmsgtext = cdb_fetch(CDB_BIGMSGS, &msgnum, sizeof(long)); if (dmsgtext != NULL) { CM_SetAsField(ret, eMesageText, &dmsgtext->ptr, dmsgtext->len); cdb_free(dmsgtext); } } - if (ret->cm_fields[eMesageText] == NULL) { + if (CM_IsEmpty(ret, eMesageText)) { CM_SetField(ret, eMesageText, HKEY("\r\n\r\n (no text)\r\n")); } @@ -2148,7 +2155,7 @@ void OutputCtdlMsgHeaders( /* begin header processing loop for Citadel message format */ safestrncpy(display_name, "", sizeof display_name); - if (TheMessage->cm_fields[eAuthor]) { + if (!CM_IsEmpty(TheMessage, eAuthor)) { strcpy(buf, TheMessage->cm_fields[eAuthor]); if (TheMessage->cm_anon_type == MES_ANONONLY) { safestrncpy(display_name, "****", sizeof display_name); @@ -2173,18 +2180,18 @@ void OutputCtdlMsgHeaders( * local Citadel network. */ suppress_f = 0; - if (TheMessage->cm_fields[eNodeName] != NULL) - if (!IsEmptyStr(TheMessage->cm_fields[eNodeName])) - if (haschar(TheMessage->cm_fields[eNodeName], '.') == 0) { - suppress_f = 1; - } + if (!CM_IsEmpty(TheMessage, eNodeName) && + (haschar(TheMessage->cm_fields[eNodeName], '.') == 0)) + { + suppress_f = 1; + } /* Now spew the header fields in the order we like them. */ for (i=0; i< NDiskFields; ++i) { eMsgField Field; Field = FieldOrder[i]; if (Field != eMesageText) { - if ( (TheMessage->cm_fields[Field] != NULL) + if ( (!CM_IsEmpty(TheMessage, Field)) && (msgkeys[Field] != NULL) ) { if ((Field == eenVelopeTo) || (Field == eRecipient) || @@ -2525,7 +2532,7 @@ int CtdlOutputPreLoadedMsg( /* Suppress envelope recipients if required to avoid disclosing BCC addresses. * Pad it with spaces in order to avoid changing the RFC822 length of the message. */ - if ( (flags & SUPPRESS_ENV_TO) && (TheMessage->cm_fields[eenVelopeTo] != NULL) ) { + if ( (flags & SUPPRESS_ENV_TO) && (!CM_IsEmpty(TheMessage, eenVelopeTo)) ) { memset(TheMessage->cm_fields[eenVelopeTo], ' ', strlen(TheMessage->cm_fields[eenVelopeTo])); } @@ -3013,7 +3020,7 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms ReplicationChecks(msg); /* If the message has an Exclusive ID, index that... */ - if (msg->cm_fields[eExclusiveID] != NULL) { + if (!CM_IsEmpty(msg, eExclusiveID)) { index_message_by_euid(msg->cm_fields[eExclusiveID], &CCC->room, msgid); } @@ -3091,12 +3098,12 @@ long send_message(struct CtdlMessage *msg) { ); /* Generate an ID if we don't have one already */ - if (msg->cm_fields[emessageId]==NULL) { + if (CM_IsEmpty(msg, emessageId)) { CM_SetField(msg, emessageId, msgidbuf, msgidbuflen); } /* If the message is big, set its body aside for storage elsewhere */ - if (msg->cm_fields[eMesageText] != NULL) { + if (!CM_IsEmpty(msg, eMesageText)) { if (strlen(msg->cm_fields[eMesageText]) > BIGMSG) { is_bigmsg = 1; holdM = msg->cm_fields[eMesageText]; @@ -3231,8 +3238,8 @@ void ReplicationChecks(struct CtdlMessage *msg) { /* No exclusive id? Don't do anything. */ if (msg == NULL) return; - if (msg->cm_fields[eExclusiveID] == NULL) return; - if (IsEmptyStr(msg->cm_fields[eExclusiveID])) return; + if (CM_IsEmpty(msg, eExclusiveID)) return; + /*MSG_syslog(LOG_DEBUG, "Exclusive ID: <%s> for room <%s>\n", msg->cm_fields[eExclusiveID], CCC->room.QRname);*/ @@ -3287,14 +3294,14 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ /* If this message has no timestamp, we take the liberty of * giving it one, right now. */ - if (msg->cm_fields[eTimestamp] == NULL) { + if (CM_IsEmpty(msg, eTimestamp)) { CM_SetFieldLONG(msg, eTimestamp, time(NULL)); } /* If this message has no path, we generate one. */ - if (msg->cm_fields[eMessagePath] == NULL) { - if (msg->cm_fields[eAuthor] != NULL) { + if (CM_IsEmpty(msg, eMessagePath)) { + if (!CM_IsEmpty(msg, eAuthor)) { CM_CopyField(msg, eMessagePath, eAuthor); for (a=0; !IsEmptyStr(&msg->cm_fields[eMessagePath][a]); ++a) { if (isspace(msg->cm_fields[eMessagePath][a])) { @@ -3303,7 +3310,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ } } else { - CM_SetField(msg,eMessagePath, HKEY("unknown")); + CM_SetField(msg, eMessagePath, HKEY("unknown")); } } @@ -3315,7 +3322,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ } /* Learn about what's inside, because it's what's inside that counts */ - if (msg->cm_fields[eMesageText] == NULL) { + if (CM_IsEmpty(msg, eMesageText)) { MSGM_syslog(LOG_ERR, "ERROR: attempt to save message with NULL body\n"); return(-2); } @@ -3379,7 +3386,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ /* * If this message has no O (room) field, generate one. */ - if (msg->cm_fields[eOriginalRoom] == NULL) { + if (CM_IsEmpty(msg, eOriginalRoom)) { CM_SetField(msg, eOriginalRoom, CCC->room.QRname, strlen(CCC->room.QRname)); } @@ -3532,12 +3539,10 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ /* Perform "after save" hooks */ MSGM_syslog(LOG_DEBUG, "Performing after-save hooks\n"); - if (msg->cm_fields[eVltMsgNum] != NULL) free(msg->cm_fields[eVltMsgNum]); - msg->cm_fields[eVltMsgNum] = malloc(20); - snprintf(msg->cm_fields[eVltMsgNum], 20, "%ld", newmsgid); + + CM_SetFieldLONG(msg, eVltMsgNum, newmsgid); PerformMessageHooks(msg, EVT_AFTERSAVE); - free(msg->cm_fields[eVltMsgNum]); - msg->cm_fields[eVltMsgNum] = NULL; + CM_FlushField(msg, eVltMsgNum); /* For IGnet mail, we have to save a new copy into the spooler for * each recipient, with the R and D fields set to the recipient and @@ -3667,7 +3672,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ /* * Determine whether this message qualifies for journaling. */ - if (msg->cm_fields[eJournal] != NULL) { + if (!CM_IsEmpty(msg, eJournal)) { qualified_for_journaling = 0; } else { @@ -4912,7 +4917,7 @@ void cmd_ent0(char *entargs) client_write(HKEY("Internal error.\n")); } - if (msg->cm_fields[eExclusiveID] != NULL) { + if (!CM_IsEmpty(msg, eExclusiveID)) { cprintf("%s\n", msg->cm_fields[eExclusiveID]); } else { cprintf("\n"); diff --git a/citadel/msgbase.h b/citadel/msgbase.h index 06c426174..e94b46ded 100644 --- a/citadel/msgbase.h +++ b/citadel/msgbase.h @@ -164,6 +164,7 @@ void CtdlWriteObject(char *req_room, /* Room to stuff it in */ ); struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body); struct CtdlMessage * CtdlDuplicateMessage(struct CtdlMessage *OrgMsg); +int CM_IsEmpty (struct CtdlMessage *Msg, eMsgField which); void CM_SetField (struct CtdlMessage *Msg, eMsgField which, const char *buf, long length); void CM_SetFieldLONG (struct CtdlMessage *Msg, eMsgField which, long lvalue); void CM_CopyField (struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy); -- 2.30.2