refactor naming of core message manipulation funcions
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 1 Sep 2013 12:58:06 +0000 (14:58 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 1 Sep 2013 12:58:06 +0000 (14:58 +0200)
29 files changed:
citadel/euidindex.c
citadel/internet_addressing.c
citadel/journaling.c
citadel/modules/autocompletion/serv_autocompletion.c
citadel/modules/calendar/serv_calendar.c
citadel/modules/expire/serv_expire.c
citadel/modules/extnotify/extnotify_main.c
citadel/modules/fulltext/serv_fulltext.c
citadel/modules/imap/imap_fetch.c
citadel/modules/imap/imap_misc.c
citadel/modules/imap/imap_search.c
citadel/modules/inetcfg/serv_inetcfg.c
citadel/modules/instmsg/serv_instmsg.c
citadel/modules/migrate/serv_migrate.c
citadel/modules/network/serv_netmail.c
citadel/modules/network/serv_netspool.c
citadel/modules/network/serv_network.c
citadel/modules/pop3client/serv_pop3client.c
citadel/modules/rssclient/rss_atom_parser.c
citadel/modules/sieve/serv_sieve.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/smtp/serv_smtpeventclient.c
citadel/modules/smtp/serv_smtpqueue.c
citadel/modules/smtp/smtp_util.c
citadel/modules/vcard/serv_vcard.c
citadel/modules/wiki/serv_wiki.c
citadel/modules/xmpp/xmpp_presence.c
citadel/msgbase.c
citadel/msgbase.h

index 8a40cce..f103de2 100644 (file)
@@ -165,7 +165,7 @@ void rebuild_euid_index_for_msg(long msgnum, void *userdata) {
        if (!CM_IsEmpty(msg, eExclusiveID)) {
                index_message_by_euid(msg->cm_fields[eExclusiveID], &CC->room, msgnum);
        }
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
index 32e70af..8d751d8 100644 (file)
@@ -731,7 +731,7 @@ void convert_references_to_wefewences(char *str) {
 /*
  * Convert an RFC822 message (headers + body) to a CtdlMessage structure.
  * NOTE: the supplied buffer becomes part of the CtdlMessage structure, and
- * will be deallocated when CtdlFreeMessage() is called.  Therefore, the
+ * will be deallocated when CM_Free() is called.  Therefore, the
  * supplied buffer should be DEREFERENCED.  It should not be freed or used
  * again.
  */
index 9ea593b..27cf058 100644 (file)
@@ -287,7 +287,7 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
                        
                        /* Submit journal message */
                        CtdlSubmitMsg(journal_msg, journal_recps, "", 0);
-                       CtdlFreeMessage(journal_msg);
+                       CM_Free(journal_msg);
                }
 
                free_recipients(journal_recps);
index 8bb5da0..00e1908 100644 (file)
@@ -63,7 +63,7 @@ void hunt_for_autocomplete(long msgnum, char *search_string) {
        if (msg == NULL) return;
 
        v = vcard_load(msg->cm_fields[eMesageText]);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        /*
         * Try to match from a friendly name (the "fn" field).  If there is
index e6b4fb4..adf3600 100644 (file)
@@ -159,7 +159,7 @@ void ical_write_to_cal(struct ctdluser *u, icalcomponent *cal) {
        
                /* Now write the data */
                CtdlSubmitMsg(msg, NULL, "", QP_EADDR);
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
        }
 
        /* In either case, now we can free the serialized calendar object */
@@ -311,7 +311,7 @@ void ical_send_a_reply(icalcomponent *request, char *action) {
                if (msg != NULL) {
                        valid = validate_recipients(organizer_string, NULL, 0);
                        CtdlSubmitMsg(msg, valid, "", QP_EADDR);
-                       CtdlFreeMessage(msg);
+                       CM_Free(msg);
                        free_recipients(valid);
                }
        }
@@ -396,7 +396,7 @@ void ical_respond(long msgnum, char *partnum, char *action) {
        /* We're done with the incoming message, because we now have a
         * calendar object in memory.
         */
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        /*
         * Here is the real meat of this function.  Handle the event.
@@ -648,7 +648,7 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) {
                &oec,                           /* user data */
                0
        );
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        original_event = oec.c;
        if (original_event == NULL) {
@@ -688,7 +688,7 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) {
                if (msg != NULL) {
                        CIT_ICAL->avoid_sending_invitations = 1;
                        CtdlSubmitMsg(msg, NULL, roomname, QP_EADDR);
-                       CtdlFreeMessage(msg);
+                       CM_Free(msg);
                        CIT_ICAL->avoid_sending_invitations = 0;
                }
        }
@@ -739,7 +739,7 @@ void ical_handle_rsvp(long msgnum, char *partnum, char *action) {
        /* We're done with the incoming message, because we now have a
         * calendar object in memory.
         */
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        /*
         * Here is the real meat of this function.  Handle the event.
@@ -1167,7 +1167,7 @@ void ical_hunt_for_conflicts_backend(long msgnum, void *data) {
                (void *) &ird,                  /* user data */
                0
        );
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        if (ird.cal == NULL) return;
 
@@ -1237,7 +1237,7 @@ void ical_conflicts(long msgnum, char *partnum) {
                0
        );
 
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        if (ird.cal != NULL) {
                ical_hunt_for_conflicts(ird.cal);
@@ -1417,7 +1417,7 @@ void ical_freebusy_backend(long msgnum, void *data) {
                (void *) &ird,                  /* user data */
                0
        );
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        if (ird.cal) {
                ical_add_to_freebusy(fb, ird.cal);              /* Add VEVENT times to VFREEBUSY */
@@ -1618,7 +1618,7 @@ void ical_getics_backend(long msgnum, void *data) {
                (void *) &ird,                  /* user data */
                0
        );
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        if (ird.cal == NULL) return;
 
@@ -2210,7 +2210,7 @@ void ical_send_out_invitations(icalcomponent *top_level_cal, icalcomponent *cal)
                if (msg != NULL) {
                        valid = validate_recipients(attendees_string, NULL, 0);
                        CtdlSubmitMsg(msg, valid, "", QP_EADDR);
-                       CtdlFreeMessage(msg);
+                       CM_Free(msg);
                        free_recipients(valid);
                }
        }
index 93ad7e3..583b86d 100644 (file)
@@ -200,7 +200,7 @@ void GatherPurgeMessages(struct ctdlroom *qrbuf, void *data) {
                        msg = CtdlFetchMessage(delnum, 0); /* dont need body */
                        if (msg != NULL) {
                                xtime = atol(msg->cm_fields[eTimestamp]);
-                               CtdlFreeMessage(msg);
+                               CM_Free(msg);
                        } else {
                                xtime = 0L;
                        }
@@ -773,7 +773,7 @@ int PurgeEuidIndexTable(void) {
 
                msg = CtdlFetchMessage(msgnum, 0);
                if (msg != NULL) {
-                       CtdlFreeMessage(msg);   /* it still exists, so do nothing */
+                       CM_Free(msg);   /* it still exists, so do nothing */
                }
                else {
                        eptr = (struct EPurgeList *) malloc(sizeof(struct EPurgeList));
index 3eced5a..ef253c8 100644 (file)
@@ -193,7 +193,7 @@ eNotifyType extNotify_getConfigMessage(char *username,
                        {
                                break;
                        }
-                       CtdlFreeMessage(msg);
+                       CM_Free(msg);
                        msg = NULL;
                }
        }
@@ -206,7 +206,7 @@ eNotifyType extNotify_getConfigMessage(char *username,
        // type. This string would be at the very top of the message contents.
 
        CM_GetAsField(msg, eMesageText, &configMsg, &clen);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        /* here we would find the pager number... */
        pch = strchr(configMsg, '\n');
@@ -372,7 +372,7 @@ void process_notify(long NotifyMsgnum, void *usrdata)
        }
        if (FreeMe != NULL)
                free(FreeMe);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        todelete[0] = NotifyMsgnum;
        CtdlDeleteMessages(FNBL_QUEUE_ROOM, todelete, 1, "");
 }
index 7943e34..6288bfc 100644 (file)
@@ -128,7 +128,7 @@ void ft_index_message(long msgnum, int op) {
 
        if (!CM_IsEmpty(msg, eSuppressIdx)) {
                syslog(LOG_DEBUG, "ft_index_message() excluded msg %ld", msgnum);
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
                return;
        }
 
@@ -139,7 +139,7 @@ void ft_index_message(long msgnum, int op) {
         */
        CC->redirect_buffer = NewStrBufPlain(NULL, SIZ);
        CtdlOutputPreLoadedMsg(msg, MT_CITADEL, HEADERS_ALL, 0, 1, 0);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        msgtext = CC->redirect_buffer;
        CC->redirect_buffer = NULL;
        if (msgtext != NULL) {
index eb36ff9..ed7f271 100644 (file)
@@ -790,7 +790,7 @@ void imap_fetch_body(long msgnum, ConstStr item, int is_peek) {
        iaputs(&Imap->cached_body[pstart], pbytes);
 
        if (msg != NULL) {
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
        }
 
        /* Mark this message as "seen" *unless* this is a "peek" operation */
@@ -1084,7 +1084,7 @@ void imap_do_fetch_msg(int seq, citimap_command *Cmd) {
                 */
                else if (!strcasecmp(Cmd->Params[i].Key, "BODYSTRUCTURE")) {
                        if ((msg != NULL) && (!body_loaded)) {
-                               CtdlFreeMessage(msg);   /* need the whole thing */
+                               CM_Free(msg);   /* need the whole thing */
                                msg = NULL;
                        }
                        if (msg == NULL) {
@@ -1115,7 +1115,7 @@ void imap_do_fetch_msg(int seq, citimap_command *Cmd) {
        IAPuts(")\r\n");
        unbuffer_output();
        if (msg != NULL) {
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
        }
 }
 
index be0fa51..14d2396 100644 (file)
@@ -427,7 +427,7 @@ void imap_append(int num_parms, ConstStr *Params) {
        }
 
        /* We don't need this buffer anymore */
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        if (new_message_flags != NULL) {
                imap_do_append_flags(new_msgnum, new_message_flags);
index aaa02db..0697441 100644 (file)
@@ -531,7 +531,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
        }
 
        if (need_to_free_msg) {
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
        }
        return(match);
 }
index 44e1a4c..7c0beda 100644 (file)
@@ -122,7 +122,7 @@ void inetcfg_init_backend(long msgnum, void *userdata) {
                msg = CtdlFetchMessage(msgnum, 1);
                if (msg != NULL) {
                inetcfg_setTo(msg);
-                       CtdlFreeMessage(msg);
+                       CM_Free(msg);
        }
 }
 
index 9a75e28..72f3256 100644 (file)
@@ -483,7 +483,7 @@ void flush_individual_conversation(struct imlog *im) {
        snprintf(roomname, sizeof roomname, "%010ld.%s", im->usernums[1], PAGELOGROOM);
        CtdlCreateRoom(roomname, 5, "", 0, 1, 1, VIEW_BBS);
        msgnum = CtdlSubmitMsg(msg, NULL, roomname, 0);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        /* If there is a valid user number in usernums[0], save a copy for them too. */
        if (im->usernums[0] > 0) {
index 41a2fdf..91815fa 100644 (file)
@@ -298,7 +298,7 @@ void migr_export_message(long msgnum) {
 
        client_write("<msg_text>", 10);
        serialize_message(&smr, msg);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        /* Predict the buffer size we need.  Expand the buffer if necessary. */
        int encoded_len = smr.len * 15 / 10 ;
index 287436b..f0ca8d9 100644 (file)
@@ -239,7 +239,7 @@ void network_deliver_digest(SpoolControl *sc)
                valid->envelope_from = strdup(bounce_to);
                CtdlSubmitMsg(msg, valid, NULL, 0);
        }
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        free_recipients(valid);
 }
 
@@ -256,7 +256,7 @@ void network_process_digest(SpoolControl *sc, struct CtdlMessage *omsg, long *de
            (sc->digestfp == NULL))
                return;
 
-       msg = CtdlDuplicateMessage(omsg);
+       msg = CM_Duplicate(omsg);
        if (msg != NULL) {
                fprintf(sc->digestfp,
                        " -----------------------------------"
@@ -304,7 +304,7 @@ void network_process_digest(SpoolControl *sc, struct CtdlMessage *omsg, long *de
                FreeStrBuf(&CC->redirect_buffer);
 
                sc->num_msgs_spooled += 1;
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
        }
 }
 
@@ -324,7 +324,7 @@ void network_process_list(SpoolControl *sc, struct CtdlMessage *omsg, long *dele
         * in order to insert the [list name] in it, etc.
         */
 
-       msg = CtdlDuplicateMessage(omsg);
+       msg = CM_Duplicate(omsg);
 
 
        CM_SetField(msg, eListID, SKEY(sc->Users[roommailalias]));
@@ -347,7 +347,7 @@ void network_process_list(SpoolControl *sc, struct CtdlMessage *omsg, long *dele
 
        /* Handle delivery */
        network_deliver_list(msg, sc, CC->room.QRname);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 /*
@@ -377,7 +377,7 @@ void network_deliver_list(struct CtdlMessage *msg, SpoolControl *sc, const char
                CtdlSubmitMsg(msg, valid, NULL, 0);
                free_recipients(valid);
        }
-       /* Do not call CtdlFreeMessage(msg) here; the caller will free it. */
+       /* Do not call CM_Free(msg) here; the caller will free it. */
 }
 
 
@@ -394,7 +394,7 @@ void network_process_participate(SpoolControl *sc, struct CtdlMessage *omsg, lon
        if (sc->Users[participate] == NULL)
                return;
 
-       msg = CtdlDuplicateMessage(omsg);
+       msg = CM_Duplicate(omsg);
 
        /* Only send messages which originated on our own
         * Citadel network, otherwise we'll end up sending the
@@ -434,7 +434,7 @@ void network_process_participate(SpoolControl *sc, struct CtdlMessage *omsg, lon
                free_recipients(valid);
        }
        FreeStrBuf(&Buf);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 void network_process_ignetpush(SpoolControl *sc, struct CtdlMessage *omsg, long *delete_after_send)
@@ -459,7 +459,7 @@ void network_process_ignetpush(SpoolControl *sc, struct CtdlMessage *omsg, long
        /*
         * Process IGnet push shares
         */
-       msg = CtdlDuplicateMessage(omsg);
+       msg = CM_Duplicate(omsg);
 
        /* Prepend our node name to the Path field whenever
         * sending a message to another IGnet node
@@ -578,7 +578,7 @@ void network_process_ignetpush(SpoolControl *sc, struct CtdlMessage *omsg, long
        FreeStrBuf(&Buf);
        FreeStrBuf(&Recipient);
        FreeStrBuf(&RemoteRoom);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
@@ -609,7 +609,7 @@ void network_spool_msg(long msgnum,
        network_process_participate(sc, msg, &delete_after_send);
        network_process_ignetpush(sc, msg, &delete_after_send);
        
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        /* update lastsent */
        sc->lastsent = msgnum;
index 586b945..a309a0b 100644 (file)
@@ -497,7 +497,7 @@ void network_process_buffer(char *buffer, long size, HashList *working_ignetcfg,
                                        QN_syslog(LOG_ERR, "%s: %s\n", filename, strerror(errno));
                                }
                                free(sermsg.ser);
-                               CtdlFreeMessage(msg);
+                               CM_Free(msg);
                                FreeStrBuf(&Buf);
                                return;
                        }
@@ -522,7 +522,7 @@ void network_process_buffer(char *buffer, long size, HashList *working_ignetcfg,
         * connected that it's inevitable.)
         */
        if (network_usetable(msg) != 0) {
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
                return;
        }
 
@@ -572,7 +572,7 @@ void network_process_buffer(char *buffer, long size, HashList *working_ignetcfg,
                msg->cm_flags = CM_SKIP_HOOKS;
                CtdlSubmitMsg(msg, recp, target_room, 0);
        }
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        free_recipients(recp);
 }
 
index 8533d84..c0baa5f 100644 (file)
@@ -416,7 +416,7 @@ void network_bounce(struct CtdlMessage *msg, char *reason)
 
        /* Clean up */
        if (valid != NULL) free_recipients(valid);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        QNM_syslog(LOG_DEBUG, "leaving network_bounce()\n");
 }
 
index 8a12d15..9fe2cd6 100644 (file)
@@ -613,7 +613,7 @@ eNextState POP3C_SaveMsg(AsyncIO *IO)
                 * so we don't fetch this message again
                 */
        }
-       CtdlFreeMessage(RecvMsg->CurrMsg->Msg);
+       CM_Free(RecvMsg->CurrMsg->Msg);
 
        RecvMsg->count ++;
        return NextDBOperation(&RecvMsg->IO, POP3C_StoreMsgRead);
index 254b6e5..982869d 100644 (file)
@@ -602,7 +602,7 @@ void FreeNetworkSaveMessage (void *vMsg)
 {
        networker_save_message *Msg = (networker_save_message *) vMsg;
 
-       CtdlFreeMessageContents(&Msg->Msg);
+       CM_FreeContents(&Msg->Msg);
        FreeStrBuf(&Msg->Message);
        FreeStrBuf(&Msg->MsgGUID);
 
index a1b6f40..ecdaafd 100644 (file)
@@ -134,7 +134,7 @@ int ctdl_redirect(sieve2_context_t *s, void *my)
        CtdlSubmitMsg(msg, valid, NULL, 0);
        cs->cancel_implicit_keep = 1;
        free_recipients(valid);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        return SIEVE2_OK;
 }
 
@@ -655,7 +655,7 @@ void sieve_do_msg(long msgnum, void *userdata) {
                strcat(my.envelope_to, config.c_fqdn);
        }
 
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        
        SVM_syslog(LOG_DEBUG, "Calling sieve2_execute()");
        res = sieve2_execute(sieve2_context, &my);
@@ -757,7 +757,7 @@ void get_sieve_config_backend(long msgnum, void *userdata) {
 
        CM_GetAsField(msg, eMesageText, &conf, &conflen);
 
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        if (conf != NULL) {
                parse_sieve_config(conf, u);
index 44fa788..f21e9d1 100644 (file)
@@ -327,7 +327,7 @@ void smtp_webcit_preferences_hack_backend(long msgnum, void *userdata) {
                *webcit_conf = (char *)msg->cm_fields[eMesageText];
                msg->cm_fields[eMesageText] = NULL;
        }
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
@@ -923,7 +923,7 @@ void smtp_data(long offset, long flags)
        );
 
        /* Clean up */
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        free_recipients(valid);
        smtp_data_clear(0, 0);  /* clear out the buffers now */
 }
index de7aafb..47c1d60 100644 (file)
@@ -227,7 +227,7 @@ eNextState FinalizeMessageSend_DB(AsyncIO *IO)
                Msg->MyQItem->QueMsgID =
                        CtdlSubmitMsg(msg, NULL, SMTP_SPOOLOUT_ROOM, QP_EADDR);
                EVS_syslog(LOG_DEBUG, "%ld", Msg->MyQItem->QueMsgID);
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
        }
        else {
                CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM,
index 685e2ca..1a5761b 100644 (file)
@@ -730,7 +730,7 @@ void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt, ParsedURL *Relay)
        /* Free up the memory we used */
        free_recipients(valid);
        FreeStrBuf(&boundary);
-       CtdlFreeMessage(bmsg);
+       CM_Free(bmsg);
        SMTPCM_syslog(LOG_DEBUG, "Done processing bounces\n");
 }
 
@@ -859,7 +859,7 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
                }
        }
        PlainQItem = NewStrBufPlain(instr, -1);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        MyQItem = DeserializeQueueItem(PlainQItem, msgnum);
        FreeStrBuf(&PlainQItem);
 
index 6dcf95f..d6633fb 100644 (file)
@@ -318,6 +318,6 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt)
                }
        }
        FreeStrBuf(&boundary);
-       CtdlFreeMessage(bmsg);
+       CM_Free(bmsg);
        syslog(LOG_DEBUG, "Done processing bounces\n");
 }
index 9f493a6..9b49782 100644 (file)
@@ -189,7 +189,7 @@ void vcard_add_to_directory(long msgnum, void *data) {
                vcard_extract_internet_addresses(msg, vcard_directory_add_user);
        }
 
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
@@ -650,7 +650,7 @@ struct vCard *vcard_get_user(struct ctdluser *u) {
        if (msg == NULL) return vcard_new();
 
        v = vcard_load(msg->cm_fields[eMesageText]);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        return v;
 }
 
@@ -915,7 +915,7 @@ void vcard_purge(struct ctdluser *usbuf) {
        CM_SetField(msg, eSpecialField, HKEY("CANCEL"));
 
        CtdlSubmitMsg(msg, NULL, ADDRESS_BOOK_ROOM, QP_EADDR);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
@@ -998,7 +998,7 @@ void vcard_delete_remove(char *room, long msgnum) {
                if (ptr != NULL) ++ptr;
        }
 
-EOH:   CtdlFreeMessage(msg);
+EOH:   CM_Free(msg);
 }
 
 
@@ -1113,7 +1113,7 @@ void dvca_callback(long msgnum, void *userdata) {
                NULL,                   /* user data */
                0
        );
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
@@ -1330,7 +1330,7 @@ void strip_addresses_already_have(long msgnum, void *userdata) {
        msg = CtdlFetchMessage(msgnum, 1);
        if (msg == NULL) return;
        v = vcard_load(msg->cm_fields[eMesageText]);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        i = 0;
        while (value = vcard_get_prop(v, "email", 1, i++, 0), value != NULL) {
@@ -1403,7 +1403,7 @@ void store_this_ha(struct addresses_to_be_filed *aptr) {
 
                        syslog(LOG_DEBUG, "Adding contact: %s", recipient);
                        CtdlSubmitMsg(vmsg, NULL, aptr->roomname, QP_EADDR);
-                       CtdlFreeMessage(vmsg);
+                       CM_Free(vmsg);
                }
        }
 
index 052ab2f..e9db409 100644 (file)
@@ -132,13 +132,13 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) {
        }
 
        if ((old_msg != NULL) && (CM_IsEmpty(old_msg, eMesageText))) {  /* old version is corrupt? */
-               CtdlFreeMessage(old_msg);
+               CM_Free(old_msg);
                old_msg = NULL;
        }
        
        /* If no changes were made, don't bother saving it again */
        if ((old_msg != NULL) && (!strcmp(msg->cm_fields[eMesageText], old_msg->cm_fields[eMesageText]))) {
-               CtdlFreeMessage(old_msg);
+               CM_Free(old_msg);
                return(1);
        }
 
@@ -153,7 +153,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) {
                fp = fopen(diff_old_filename, "w");
                rv = fwrite(old_msg->cm_fields[eMesageText], strlen(old_msg->cm_fields[eMesageText]), 1, fp);
                fclose(fp);
-               CtdlFreeMessage(old_msg);
+               CM_Free(old_msg);
        }
 
        fp = fopen(diff_new_filename, "w");
@@ -342,7 +342,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) {
        }
 
        free(diffbuf);
-       CtdlFreeMessage(history_msg);
+       CM_Free(history_msg);
        return(0);
 }
 
@@ -395,7 +395,7 @@ void wiki_history(char *pagename) {
        }
 
        if ((msg != NULL) && CM_IsEmpty(msg, eMesageText)) {
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
                msg = NULL;
        }
 
@@ -409,7 +409,7 @@ void wiki_history(char *pagename) {
        mime_parser(msg->cm_fields[eMesageText], NULL, *wiki_history_callback, NULL, NULL, NULL, 0);
        cprintf("000\n");
 
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        return;
 }
 
@@ -527,7 +527,7 @@ void wiki_rev(char *pagename, char *rev, char *operation)
        }
 
        if ((msg != NULL) && CM_IsEmpty(msg, eMesageText)) {
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
                msg = NULL;
        }
 
@@ -547,7 +547,7 @@ void wiki_rev(char *pagename, char *rev, char *operation)
        else {
                syslog(LOG_ALERT, "Cannot open %s: %s\n", temp, strerror(errno));
        }
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        /* Get the revision history */
 
@@ -561,7 +561,7 @@ void wiki_rev(char *pagename, char *rev, char *operation)
        }
 
        if ((msg != NULL) && CM_IsEmpty(msg, eMesageText)) {
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
                msg = NULL;
        }
 
@@ -580,7 +580,7 @@ void wiki_rev(char *pagename, char *rev, char *operation)
        striplt(hecbd.stop_when);
 
        mime_parser(msg->cm_fields[eMesageText], NULL, *wiki_rev_callback, NULL, NULL, (void *)&hecbd, 0);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        /* Were we successful? */
        if (hecbd.done == 0) {
@@ -649,7 +649,7 @@ void wiki_rev(char *pagename, char *rev, char *operation)
                        /* Theoretically it is impossible to get here, but throw an error anyway */
                        msgnum = (-1L);
                }
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
                if (msgnum >= 0L) {
                        cprintf("%d %ld\n", CIT_OK, msgnum);            /* Give the client a msgnum */
                }
index 1fa5b1d..ca8a959 100644 (file)
@@ -259,7 +259,7 @@ void xmpp_fetch_mortuary_backend(long msgnum, void *userdata) {
                }
        }
 
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
index 30d8336..81c5231 100644 (file)
@@ -272,18 +272,18 @@ void CM_GetAsField(struct CtdlMessage *Msg, eMsgField which, char **ret, long *r
  * Returns 1 if the supplied pointer points to a valid Citadel message.
  * If the pointer is NULL or the magic number check fails, returns 0.
  */
-int is_valid_message(struct CtdlMessage *msg) {
+int CM_IsValidMsg(struct CtdlMessage *msg) {
        if (msg == NULL)
                return 0;
        if ((msg->cm_magic) != CTDLMESSAGE_MAGIC) {
                struct CitContext *CCC = CC;
-               MSGM_syslog(LOG_WARNING, "is_valid_message() -- self-check failed\n");
+               MSGM_syslog(LOG_WARNING, "CM_IsValidMsg() -- self-check failed\n");
                return 0;
        }
        return 1;
 }
 
-void CtdlFreeMessageContents(struct CtdlMessage *msg)
+void CM_FreeContents(struct CtdlMessage *msg)
 {
        int i;
 
@@ -297,18 +297,18 @@ void CtdlFreeMessageContents(struct CtdlMessage *msg)
 /*
  * 'Destructor' for struct CtdlMessage
  */
-void CtdlFreeMessage(struct CtdlMessage *msg)
+void CM_Free(struct CtdlMessage *msg)
 {
-       if (is_valid_message(msg) == 0) 
+       if (CM_IsValidMsg(msg) == 0) 
        {
                if (msg != NULL) free (msg);
                return;
        }
-       CtdlFreeMessageContents(msg);
+       CM_FreeContents(msg);
        free(msg);
 }
 
-int DupCMField(eMsgField i, struct CtdlMessage *OrgMsg, struct CtdlMessage *NewMsg)
+int CM_DupField(eMsgField i, struct CtdlMessage *OrgMsg, struct CtdlMessage *NewMsg)
 {
        long len;
        len = strlen(OrgMsg->cm_fields[i]);
@@ -320,12 +320,12 @@ int DupCMField(eMsgField i, struct CtdlMessage *OrgMsg, struct CtdlMessage *NewM
        return 1;
 }
 
-struct CtdlMessage * CtdlDuplicateMessage(struct CtdlMessage *OrgMsg)
+struct CtdlMessage * CM_Duplicate(struct CtdlMessage *OrgMsg)
 {
        int i;
        struct CtdlMessage *NewMsg;
 
-       if (is_valid_message(OrgMsg) == 0) 
+       if (CM_IsValidMsg(OrgMsg) == 0) 
                return NULL;
        NewMsg = (struct CtdlMessage *)malloc(sizeof(struct CtdlMessage));
        if (NewMsg == NULL)
@@ -339,9 +339,9 @@ struct CtdlMessage * CtdlDuplicateMessage(struct CtdlMessage *OrgMsg)
        {
                if (OrgMsg->cm_fields[i] != NULL)
                {
-                       if (!DupCMField(i, OrgMsg, NewMsg))
+                       if (!CM_DupField(i, OrgMsg, NewMsg))
                        {
-                               CtdlFreeMessage(NewMsg);
+                               CM_Free(NewMsg);
                                return NULL;
                        }
                }
@@ -522,7 +522,7 @@ void headers_listing(long msgnum, void *userdata)
                (!CM_IsEmpty(msg, erFc822Addr) ? msg->cm_fields[erFc822Addr] : ""),
                (!CM_IsEmpty(msg, eMsgSubject) ? msg->cm_fields[eMsgSubject] : "")
        );
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 /*
@@ -542,7 +542,7 @@ void headers_euid(long msgnum, void *userdata)
                msgnum, 
                (!CM_IsEmpty(msg, eExclusiveID) ? msg->cm_fields[eExclusiveID] : ""),
                (!CM_IsEmpty(msg, eTimestamp) ? msg->cm_fields[eTimestamp] : "0"));
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
@@ -942,7 +942,7 @@ int CtdlForEachMessage(int mode, long ref, char *search_string,
                                        if (CtdlMsgCmp(msg, compare)) {
                                                msglist[a] = 0L;
                                        }
-                                       CtdlFreeMessage(msg);
+                                       CM_Free(msg);
                                }
                        }
                }
@@ -1152,7 +1152,7 @@ void cmd_msgs(char *cmdbuf)
                           template,
                           CallBack,
                           NULL);
-       if (template != NULL) CtdlFreeMessage(template);
+       if (template != NULL) CM_Free(template);
        cprintf("000\n");
 }
 
@@ -1502,7 +1502,7 @@ struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body)
 
        /* Perform "before read" hooks (aborting if any return nonzero) */
        if (PerformMessageHooks(ret, EVT_BEFOREREAD) > 0) {
-               CtdlFreeMessage(ret);
+               CM_Free(ret);
                return NULL;
        }
 
@@ -1948,7 +1948,7 @@ int CtdlOutputMsg(long msg_num,           /* message number (local) to fetch */
                        *Address = TheMessage->cm_fields[erFc822Addr];
                        TheMessage->cm_fields[erFc822Addr] = NULL;
                }
-               CtdlFreeMessage(TheMessage);
+               CM_Free(TheMessage);
                TheMessage = NULL;
 
                if (encap.msg) {
@@ -1988,7 +1988,7 @@ int CtdlOutputMsg(long msg_num,           /* message number (local) to fetch */
                TheMessage->cm_fields[erFc822Addr] = NULL;
        }
 
-       CtdlFreeMessage(TheMessage);
+       CM_Free(TheMessage);
 
        return(retcode);
 }
@@ -2523,7 +2523,7 @@ int CtdlOutputPreLoadedMsg(
        strcpy(mid, "unknown");
        nl = (crlf ? "\r\n" : "\n");
 
-       if (!is_valid_message(TheMessage)) {
+       if (!CM_IsValidMsg(TheMessage)) {
                MSGM_syslog(LOG_ERR,
                            "ERROR: invalid preloaded message for output\n");
                cit_backtrace ();
@@ -2813,7 +2813,7 @@ void cmd_msg3(char *cmdbuf)
        }
 
        serialize_message(&smr, msg);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        if (smr.len == 0) {
                cprintf("%d Unable to serialize message\n",
@@ -3027,7 +3027,7 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms
 
                                /* Free up the memory we may have allocated */
                                if (msg != supplied_msg) {
-                                       CtdlFreeMessage(msg);
+                                       CM_Free(msg);
                                }
                        }
        
@@ -3173,7 +3173,7 @@ void serialize_message(struct ser_ret *ret,               /* return values */
        /*
         * Check for valid message format
         */
-       if (is_valid_message(msg) == 0) {
+       if (CM_IsValidMsg(msg) == 0) {
                MSGM_syslog(LOG_ERR, "serialize_message() aborting due to invalid message\n");
                ret->len = 0;
                ret->ser = NULL;
@@ -3290,7 +3290,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        int rv = 0;
 
        MSGM_syslog(LOG_DEBUG, "CtdlSubmitMsg() called\n");
-       if (is_valid_message(msg) == 0) return(-1);     /* self check */
+       if (CM_IsValidMsg(msg) == 0) return(-1);        /* self check */
 
        /* If this message has no timestamp, we take the liberty of
         * giving it one, right now.
@@ -3529,7 +3529,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
                                        CM_SetAsField(imsg, eMesageText, &instr, instrlen);
                                        CM_SetField(imsg, eExtnotify, recipient, recipientlen);
                                        CtdlSubmitMsg(imsg, NULL, FNBL_QUEUE_ROOM, 0);
-                                       CtdlFreeMessage(imsg);
+                                       CM_Free(imsg);
                                }
                        }
                        else {
@@ -3647,7 +3647,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
                imsg->cm_fields[eJournal] = strdup("do not journal");
                imsg->cm_fields[eMesageText] = SmashStrBuf(&SpoolMsg);  /* imsg owns this memory now */
                CtdlSubmitMsg(imsg, NULL, SMTP_SPOOLOUT_ROOM, QP_EADDR);
-               CtdlFreeMessage(imsg);
+               CM_Free(imsg);
        }
 
        /*
@@ -3753,7 +3753,7 @@ void quickie_message(const char *from,
        msg->cm_fields[eMesageText] = strdup(text);
 
        CtdlSubmitMsg(msg, recp, room, 0);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
        if (recp != NULL) free_recipients(recp);
 }
 
@@ -4090,7 +4090,7 @@ char *CtdlReadMessageBody(char *terminator,       /* token signalling EOT */
  * (NOTE: if you supply 'preformatted_text', the buffer you give it
  * will become part of the message.  This means you are no longer
  * responsible for managing that memory -- it will be freed along with
- * the rest of the fields when CtdlFreeMessage() is called.)
+ * the rest of the fields when CM_Free() is called.)
  */
 
 struct CtdlMessage *CtdlMakeMessage(
@@ -4926,7 +4926,7 @@ void cmd_ent0(char *entargs)
                        cprintf("000\n");
                }
 
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
        }
        if (valid != NULL) {
                free_recipients(valid);
@@ -5611,7 +5611,7 @@ void CtdlWriteObject(char *req_room,                      /* Room to stuff it in */
        }
        /* Now write the data */
        CtdlSubmitMsg(msg, NULL, roomname, 0);
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 }
 
 
@@ -5653,7 +5653,7 @@ char *CtdlGetSysConfig(char *sysconfname) {
                msg = CtdlFetchMessage(msgnum, 1);
                if (msg != NULL) {
                        conf = strdup(msg->cm_fields[eMesageText]);
-                       CtdlFreeMessage(msg);
+                       CM_Free(msg);
                }
                else {
                        conf = NULL;
index e94b46d..b1df41b 100644 (file)
@@ -163,7 +163,8 @@ void CtdlWriteObject(char *req_room,                        /* Room to stuff it in */
                        unsigned int flags              /* Internal save flags */
 );
 struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body);
-struct CtdlMessage * CtdlDuplicateMessage(struct CtdlMessage *OrgMsg);
+struct CtdlMessage * CM_Duplicate
+                       (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);
@@ -175,10 +176,11 @@ void CM_SetAsFieldSB   (struct CtdlMessage *Msg, eMsgField which, StrBuf **buf);
 void CM_GetAsField     (struct CtdlMessage *Msg, eMsgField which, char **ret, long *retlen);
 void CM_PrependToField (struct CtdlMessage *Msg, eMsgField which, const char *buf, long length);
 
-void CtdlFreeMessage(struct CtdlMessage *msg);
-void CtdlFreeMessageContents(struct CtdlMessage *msg);
+void CM_Free           (struct CtdlMessage *msg);
+void CM_FreeContents   (struct CtdlMessage *msg);
+int  CM_IsValidMsg     (struct CtdlMessage *msg);
+
 void serialize_message(struct ser_ret *, struct CtdlMessage *);
-int is_valid_message(struct CtdlMessage *);
 void ReplicationChecks(struct CtdlMessage *);
 int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newmsgs,
                        int do_repl_check, struct CtdlMessage *supplied_msg, int suppress_refcount_adj);