#include "euidindex.h"
#include "msgbase.h"
#include "journaling.h"
+#include "modules/fulltext/serv_fulltext.h"
struct addresses_to_be_filed *atbf = NULL;
}
-void CM_SetField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length) {
+void CM_SetField(struct CtdlMessage *Msg, eMsgField which, const char *buf) {
if (Msg->cm_fields[which] != NULL) {
- free (Msg->cm_fields[which]);
- }
- if (length < 0) { // You can set the length to -1 to have CM_SetField measure it for you
- length = strlen(buf);
+ free(Msg->cm_fields[which]);
}
- Msg->cm_fields[which] = malloc(length + 1);
- memcpy(Msg->cm_fields[which], buf, length);
- Msg->cm_fields[which][length] = '\0';
- Msg->cm_lengths[which] = length;
+ Msg->cm_fields[which] = strdup(buf);
+ Msg->cm_lengths[which] = strlen(buf);
}
char buf[128];
long len;
len = snprintf(buf, sizeof(buf), "%ld", lvalue);
- CM_SetField(Msg, which, buf, len);
+ CM_SetField(Msg, which, buf);
}
}
+// This is like CM_SetField() except the caller is transferring ownership of the supplied memory to the message
void CM_SetAsField(struct CtdlMessage *Msg, eMsgField which, char **buf, long length) {
if (Msg->cm_fields[which] != NULL) {
free (Msg->cm_fields[which]);
int is_seen = 0;
long lastold = 0L;
int printed_lastold = 0;
- int num_search_msgs = 0;
- long *search_msgs = NULL;
regex_t re;
int need_to_free_re = 0;
regmatch_t pm;
+ Array *search = NULL;
if ((content_type) && (!IsEmptyStr(content_type))) {
regcomp(&re, content_type, 0);
}
// Now begin the traversal.
- if (num_msgs > 0) for (a = 0; a < num_msgs; ++a) {
+ if (num_msgs > 0) for (a = 0; a < num_msgs; ++a) if (msglist[a] > 0) {
// If the caller is looking for a specific MIME type, filter
// out all messages which are not of the type requested.
* NULL means use any search function available.
* otherwise replace with a char * to name of search routine
*/
- CtdlModuleDoSearch(&num_search_msgs, &search_msgs, search_string, "fulltext");
+ search = CtdlFullTextSearch(search_string);
- if (num_search_msgs > 0) {
+ if (array_len(search) > 0) {
int orig_num_msgs;
orig_num_msgs = num_msgs;
num_msgs = 0;
for (i=0; i<orig_num_msgs; ++i) {
- for (j=0; j<num_search_msgs; ++j) {
- if (msglist[i] == search_msgs[j]) {
+ for (j=0; j<array_len(search); ++j) {
+ long smsgnum;
+ memcpy(&smsgnum, array_get_element_at(search, j), sizeof(long));
+ if (msglist[i] == smsgnum) {
msglist[num_msgs++] = msglist[i];
}
}
else {
num_msgs = 0; /* No messages qualify */
}
- if (search_msgs != NULL) free(search_msgs);
+ if (search != NULL) array_free(search);
/* Now that we've purged messages which don't contain the search
* string, treat a MSGS_SEARCH just like a MSGS_ALL from this
which = field_header;
len = strlen(mptr);
- CM_SetField(ret, which, mptr, len);
+ CM_SetField(ret, which, mptr);
mptr += len + 1; // advance to next field
if ( (CM_IsEmpty(ret, eMesageText)) && (with_body) ) {
dmsgtext = cdb_fetch(CDB_BIGMSGS, &msgnum, sizeof(long));
if (dmsgtext.ptr != NULL) {
- CM_SetAsField(ret, eMesageText, &dmsgtext.ptr, dmsgtext.len - 1);
+ CM_SetField(ret, eMesageText, dmsgtext.ptr);
}
}
if (CM_IsEmpty(ret, eMesageText)) {
- CM_SetField(ret, eMesageText, HKEY("\r\n\r\n (no text)\r\n"));
+ CM_SetField(ret, eMesageText, "\r\n\r\n (no text)\r\n");
}
return (ret);
return(r);
}
- /*
- * Check to make sure the message is actually IN this room
- */
+ // Check to make sure the message is actually IN this room
r = check_cached_msglist(msg_num);
if (r == om_access_denied) {
- /* Not in the cache? We get ONE shot to check it again. */
+ // Not in the cache? We get ONE shot to check it again.
CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL, NULL, NULL);
r = check_cached_msglist(msg_num);
}
return(r);
}
- /*
- * Fetch the message from disk. If we're in HEADERS_FAST mode,
- * request that we don't even bother loading the body into memory.
- */
+ // Fetch the message from disk. If we're in HEADERS_FAST mode, request that we don't even bother loading the body into memory.
if (headers_only == HEADERS_FAST) {
TheMessage = CtdlFetchMessage(msg_num, 0);
}
return(om_no_such_msg);
}
- /* Here is the weird form of this command, to process only an
- * encapsulated message/rfc822 section.
- */
+ // Here is the weird form of this command, to process only an encapsulated message/rfc822 section.
if (section) if (!IsEmptyStr(section)) if (strcmp(section, "0")) {
memset(&encap, 0, sizeof encap);
safestrncpy(encap.desired_section, section, sizeof encap.desired_section);
NULL, NULL, (void *)&encap, 0
);
- if ((Author != NULL) && (*Author == NULL))
- {
+ if ((Author != NULL) && (*Author == NULL)) {
long len;
CM_GetAsField(TheMessage, eAuthor, Author, &len);
}
- if ((Address != NULL) && (*Address == NULL))
- {
+ if ((Address != NULL) && (*Address == NULL)) {
long len;
CM_GetAsField(TheMessage, erFc822Addr, Address, &len);
}
- if ((MessageID != NULL) && (*MessageID == NULL))
- {
+ if ((MessageID != NULL) && (*MessageID == NULL)) {
long len;
CM_GetAsField(TheMessage, emessageId, MessageID, &len);
}
if (encap.msg) {
encap.msg[encap.msglen] = 0;
TheMessage = convert_internet_message(encap.msg);
- encap.msg = NULL; /* no free() here, TheMessage owns it now */
+ encap.msg = NULL; // no free() here, TheMessage owns it now
- /* Now we let it fall through to the bottom of this
- * function, because TheMessage now contains the
- * encapsulated message instead of the top-level
- * message. Isn't that neat?
- */
+ // Now we let it fall through to the bottom of this function, because TheMessage now contains the
+ // encapsulated message instead of the top-level message. Isn't that neat?
}
else {
if (do_proto) {
- cprintf("%d msg %ld has no part %s\n",
- ERROR + MESSAGE_NOT_FOUND,
- msg_num,
- section);
+ cprintf("%d msg %ld has no part %s\n", ERROR + MESSAGE_NOT_FOUND, msg_num, section);
}
retcode = om_no_such_msg;
}
}
- /* Ok, output the message now */
- if (retcode == CIT_OK)
+ // Ok, output the message now
+ if (retcode == CIT_OK) {
retcode = CtdlOutputPreLoadedMsg(TheMessage, mode, headers_only, do_proto, crlf, flags);
- if ((Author != NULL) && (*Author == NULL))
- {
+ }
+ if ((Author != NULL) && (*Author == NULL)) {
long len;
CM_GetAsField(TheMessage, eAuthor, Author, &len);
}
- if ((Address != NULL) && (*Address == NULL))
- {
+ if ((Address != NULL) && (*Address == NULL)) {
long len;
CM_GetAsField(TheMessage, erFc822Addr, Address, &len);
}
- if ((MessageID != NULL) && (*MessageID == NULL))
- {
+ if ((MessageID != NULL) && (*MessageID == NULL)) {
long len;
CM_GetAsField(TheMessage, emessageId, MessageID, &len);
}
}
-/*
- * Get a message off disk. (returns om_* values found in msgbase.h)
- */
+// Get a message off disk. (returns om_* values found in msgbase.h)
int CtdlOutputPreLoadedMsg(
struct CtdlMessage *TheMessage,
- int mode, /* how would you like that message? */
- int headers_only, /* eschew the message body? */
- int do_proto, /* do Citadel protocol responses? */
- int crlf, /* Use CRLF newlines instead of LF? */
- int flags /* should the bessage be exported clean? */
+ int mode, // how would you like that message?
+ int headers_only, // eschew the message body?
+ int do_proto, // do Citadel protocol responses?
+ int crlf, // Use CRLF newlines instead of LF?
+ int flags // should the bessage be exported clean?
) {
int i;
- const char *nl; /* newline string */
+ const char *nl; // newline string
int nlen;
struct ma_info ma;
- /* Buffers needed for RFC822 translation. These are all filled
- * using functions that are bounds-checked, and therefore we can
- * make them substantially smaller than SIZ.
- */
+ // Buffers needed for RFC822 translation. These are all filled
+ // using functions that are bounds-checked, and therefore we can
+ // make them substantially smaller than SIZ.
char suser[1024];
char luser[1024];
char fuser[1024];
return(om_no_such_msg);
}
- /* 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.
- */
+ // 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) && (!CM_IsEmpty(TheMessage, eenVelopeTo)) ) {
memset(TheMessage->cm_fields[eenVelopeTo], ' ', TheMessage->cm_lengths[eenVelopeTo]);
}
- /* Are we downloading a MIME component? */
+ // Are we downloading a MIME component?
if (mode == MT_DOWNLOAD) {
if (TheMessage->cm_format_type != FMT_RFC822) {
- if (do_proto)
- cprintf("%d This is not a MIME message.\n",
- ERROR + ILLEGAL_VALUE);
- } else if (CC->download_fp != NULL) {
- if (do_proto) cprintf(
- "%d You already have a download open.\n",
- ERROR + RESOURCE_BUSY);
- } else {
- /* Parse the message text component */
- mime_parser(CM_RANGE(TheMessage, eMesageText),
- *mime_download, NULL, NULL, NULL, 0);
- /* If there's no file open by this time, the requested
- * section wasn't found, so print an error
- */
+ if (do_proto) {
+ cprintf("%d This is not a MIME message.\n", ERROR + ILLEGAL_VALUE);
+ }
+ }
+ else if (CC->download_fp != NULL) {
+ if (do_proto) {
+ cprintf( "%d You already have a download open.\n", ERROR + RESOURCE_BUSY);
+ }
+ }
+ else {
+ // Parse the message text component
+ mime_parser(CM_RANGE(TheMessage, eMesageText), *mime_download, NULL, NULL, NULL, 0);
+
+ // If there's no file open by this time, the requested * section wasn't found, so print an error
if (CC->download_fp == NULL) {
- if (do_proto) cprintf(
- "%d Section %s not found.\n",
- ERROR + FILE_NOT_FOUND,
- CC->download_desired_section);
+ if (do_proto) {
+ cprintf( "%d Section %s not found.\n", ERROR + FILE_NOT_FOUND, CC->download_desired_section);
+ }
}
}
return((CC->download_fp != NULL) ? om_ok : om_mime_error);
strcpy(luser, "");
strcpy(fuser, "");
strcpy(snode, "");
- if (mode == MT_RFC822)
+ if (mode == MT_RFC822) {
OutputRFC822MsgHeaders(
TheMessage,
flags,
luser, sizeof(luser),
fuser, sizeof(fuser),
snode, sizeof(snode)
- );
-
+ );
+ }
for (i=0; !IsEmptyStr(&suser[i]); ++i) {
suser[i] = tolower(suser[i]);
}
if (mode == MT_RFC822) {
- /* Construct a fun message id */
+ // Construct a fun message id
cprintf("Message-ID: <%s", mid);
if (strchr(mid, '@')==NULL) {
cprintf("@%s", snode);
cprintf("From: \"%s\" <%s@%s>%s", luser, suser, snode, nl);
}
- /* Blank line signifying RFC822 end-of-headers */
+ // Blank line signifying RFC822 end-of-headers
if (TheMessage->cm_format_type != FMT_RFC822) {
cprintf("%s", nl);
}
}
-DONE: /* now we're done */
+DONE: // now we're done
if (do_proto) cprintf("000\n");
return(om_ok);
}
strcpy(hold_rm, CC->room.QRname);
- /* Sanity checks */
+ // Sanity checks
if (newmsgidlist == NULL) return(ERROR + INTERNAL_ERROR);
if (num_newmsgs < 1) return(ERROR + INTERNAL_ERROR);
if (num_newmsgs > 1) supplied_msg = NULL;
- /* Now the regular stuff */
- if (CtdlGetRoomLock(&CC->room,
- ((roomname != NULL) ? roomname : CC->room.QRname) )
- != 0) {
+ // Now the regular stuff
+ if (CtdlGetRoomLock(&CC->room, ((roomname != NULL) ? roomname : CC->room.QRname) ) != 0) {
syslog(LOG_ERR, "msgbase: no such room <%s>", roomname);
return(ERROR + ROOM_NOT_FOUND);
}
num_msgs_to_be_merged = 0;
num_msgs = CtdlFetchMsgList(CC->room.QRnumber, &msglist);
- /* Create a list of msgid's which were supplied by the caller, but do
- * not already exist in the target room. It is absolutely taboo to
- * have more than one reference to the same message in a room.
- */
+ // Create a list of msgid's which were supplied by the caller, but do
+ // not already exist in the target room. It is absolutely taboo to
+ // have more than one reference to the same message in a room.
for (i=0; i<num_newmsgs; ++i) {
unique = 1;
if (num_msgs > 0) for (j=0; j<num_msgs; ++j) {
syslog(LOG_DEBUG, "msgbase: %d unique messages to be merged", num_msgs_to_be_merged);
- /*
- * Now merge the new messages
- */
+ // Now merge the new messages
msglist = realloc(msglist, (sizeof(long) * (num_msgs + num_msgs_to_be_merged)) );
if (msglist == NULL) {
syslog(LOG_ALERT, "msgbase: ERROR; can't realloc message list!");
free(msgs_to_be_merged);
+ abort(); // FIXME
return (ERROR + INTERNAL_ERROR);
}
memcpy(&msglist[num_msgs], msgs_to_be_merged, (sizeof(long) * num_msgs_to_be_merged) );
num_msgs += num_msgs_to_be_merged;
- /* Sort the message list, so all the msgid's are in order */
+ // Sort the message list, so all the msgid's are in order
num_msgs = sort_msglist(msglist, num_msgs);
- /* Determine the highest message number */
+ // Determine the highest message number
highest_msg = msglist[num_msgs - 1];
- /* Write it back to disk. */
+ // Write it back to disk.
cdb_store(CDB_MSGLISTS, &CC->room.QRnumber, (int)sizeof(long), msglist, (int)(num_msgs * sizeof(long)));
- /* Free up the memory we used. */
+ // Free up the memory we used.
free(msglist);
- /* Update the highest-message pointer and unlock the room. */
+ // Update the highest-message pointer and unlock the room.
CC->room.QRhighest = highest_msg;
CtdlPutRoomLock(&CC->room);
- /* Perform replication checks if necessary */
+ // Perform replication checks if necessary
if ( (DoesThisRoomNeedEuidIndexing(&CC->room)) && (do_repl_check) ) {
syslog(LOG_DEBUG, "msgbase: CtdlSaveMsgPointerInRoom() doing repl checks");
if (msg != NULL) {
ReplicationChecks(msg);
- /* If the message has an Exclusive ID, index that... */
+ // If the message has an Exclusive ID, index that...
if (!CM_IsEmpty(msg, eExclusiveID)) {
index_message_by_euid(msg->cm_fields[eExclusiveID], &CC->room, msgid);
}
- /* Free up the memory we may have allocated */
+ // Free up the memory we may have allocated
if (msg != supplied_msg) {
CM_Free(msg);
}
syslog(LOG_DEBUG, "msgbase: CtdlSaveMsgPointerInRoom() skips repl checks");
}
- /* Submit this room for processing by hooks */
+ // Submit this room for processing by hooks
int total_roomhook_errors = PerformRoomHooks(&CC->room);
if (total_roomhook_errors) {
syslog(LOG_WARNING, "msgbase: room hooks returned %d errors", total_roomhook_errors);
}
- /* Go back to the room we were in before we wandered here... */
+ // Go back to the room we were in before we wandered here...
CtdlGetRoom(&CC->room, hold_rm);
- /* Bump the reference count for all messages which were merged */
+ // Bump the reference count for all messages which were merged
if (!suppress_refcount_adj) {
AdjRefCountList(msgs_to_be_merged, num_msgs_to_be_merged, +1);
}
- /* Free up memory... */
+ // Free up memory...
if (msgs_to_be_merged != NULL) {
free(msgs_to_be_merged);
}
- /* Return success. */
+ // Return success.
return (0);
}
-/*
- * This is the same as CtdlSaveMsgPointersInRoom() but it only accepts
- * a single message.
- */
+// This is the same as CtdlSaveMsgPointersInRoom() but it only accepts a single message.
int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *supplied_msg) {
return CtdlSaveMsgPointersInRoom(roomname, &msgid, 1, do_repl_check, supplied_msg, 0);
}
-/*
- * Message base operation to save a new message to the message store
- * (returns new message number)
- *
- * This is the back end for CtdlSubmitMsg() and should not be directly
- * called by server-side modules.
- *
- */
+// Message base operation to save a new message to the message store
+// (returns new message number)
+//
+// This is the back end for CtdlSubmitMsg() and should not be directly
+// called by server-side modules.
long CtdlSaveThisMessage(struct CtdlMessage *msg, long msgid, int Reply) {
long retval;
struct ser_ret smr;
char *holdM = NULL;
long holdMLen = 0;
- /*
- * If the message is big, set its body aside for storage elsewhere
- * and we hide the message body from the serializer
- */
+ // If the message is big, set its body aside for storage elsewhere and we hide the message body from the serializer
if (!CM_IsEmpty(msg, eMesageText) && msg->cm_lengths[eMesageText] > BIGMSG) {
is_bigmsg = 1;
holdM = msg->cm_fields[eMesageText];
msg->cm_lengths[eMesageText] = 0;
}
- /* Serialize our data structure for storage in the database */
+ // Serialize our data structure for storage in the database
CtdlSerializeMessage(&smr, msg);
if (is_bigmsg) {
- /* put the message body back into the message */
+ // put the message body back into the message
msg->cm_fields[eMesageText] = holdM;
msg->cm_lengths[eMesageText] = holdMLen;
}
if (smr.len == 0) {
if (Reply) {
- cprintf("%d Unable to serialize message\n",
- ERROR + INTERNAL_ERROR);
+ cprintf("%d Unable to serialize message\n", ERROR + INTERNAL_ERROR);
}
else {
syslog(LOG_ERR, "msgbase: CtdlSaveMessage() unable to serialize message");
-
}
return (-1L);
}
- /* Write our little bundle of joy into the message base */
+ // Write our little bundle of joy into the message base
retval = cdb_store(CDB_MSGMAIN, &msgid, (int)sizeof(long), smr.ser, smr.len);
if (retval < 0) {
syslog(LOG_ERR, "msgbase: can't store message %ld: %ld", msgid, retval);
}
}
- /* Free the memory we used for the serialized message */
+ // Free the memory we used for the serialized message
free(smr.ser);
return(retval);
}
char msgidbuf[256];
long msgidbuflen;
- /* Get a new message number */
+ // Get a new message number
newmsgid = get_new_message_number();
- /* Generate an ID if we don't have one already */
+ // Generate an ID if we don't have one already
if (CM_IsEmpty(msg, emessageId)) {
msgidbuflen = snprintf(msgidbuf, sizeof msgidbuf, "%08lX-%08lX@%s",
- (long unsigned int) time(NULL),
- (long unsigned int) newmsgid,
- CtdlGetConfigStr("c_fqdn")
- );
-
- CM_SetField(msg, emessageId, msgidbuf, msgidbuflen);
+ (long unsigned int) time(NULL),
+ (long unsigned int) newmsgid,
+ CtdlGetConfigStr("c_fqdn")
+ );
+ CM_SetField(msg, emessageId, msgidbuf);
}
retval = CtdlSaveThisMessage(msg, newmsgid, 1);
retval = newmsgid;
}
- /* Return the *local* message ID to the caller
- * (even if we're storing an incoming network message)
- */
+ // Return the *local* message ID to the caller (even if we're storing a remotely originated message)
return(retval);
}
-/*
- * Serialize a struct CtdlMessage into the format used on disk.
- *
- * This function loads up a "struct ser_ret" (defined in server.h) which
- * contains the length of the serialized message and a pointer to the
- * serialized message in memory. THE LATTER MUST BE FREED BY THE CALLER.
- */
-void CtdlSerializeMessage(struct ser_ret *ret, /* return values */
- struct CtdlMessage *msg) /* unserialized msg */
+// Serialize a struct CtdlMessage into the format used on disk.
+//
+// This function loads up a "struct ser_ret" (defined in server.h) which
+// contains the length of the serialized message and a pointer to the
+// serialized message in memory. THE LATTER MUST BE FREED BY THE CALLER.
+void CtdlSerializeMessage(struct ser_ret *ret, // return values
+ struct CtdlMessage *msg) // unserialized msg
{
size_t wlen;
int i;
- /*
- * Check for valid message format
- */
+ // Check for valid message format
if (CM_IsValidMsg(msg) == 0) {
syslog(LOG_ERR, "msgbase: CtdlSerializeMessage() aborting due to invalid message");
ret->len = 0;
}
}
else {
- CM_SetField(msg, eMessagePath, HKEY("unknown"));
+ CM_SetField(msg, eMessagePath, "unknown");
}
}
* If this message has no O (room) field, generate one.
*/
if (CM_IsEmpty(msg, eOriginalRoom) && !IsEmptyStr(CC->room.QRname)) {
- CM_SetField(msg, eOriginalRoom, CC->room.QRname, -1);
+ CM_SetField(msg, eOriginalRoom, CC->room.QRname);
}
/* Perform "before save" hooks (aborting if any return nonzero) */
msg->cm_format_type = format_type;
if (!IsEmptyStr(from)) {
- CM_SetField(msg, eAuthor, from, -1);
+ CM_SetField(msg, eAuthor, from);
}
else if (!IsEmptyStr(fromaddr)) {
char *pAt;
- CM_SetField(msg, eAuthor, fromaddr, -1);
+ CM_SetField(msg, eAuthor, fromaddr);
pAt = strchr(msg->cm_fields[eAuthor], '@');
if (pAt != NULL) {
CM_CutFieldAt(msg, eAuthor, pAt - msg->cm_fields[eAuthor]);
msg->cm_fields[eAuthor] = strdup("Citadel");
}
- if (!IsEmptyStr(fromaddr)) CM_SetField(msg, erFc822Addr, fromaddr, -1);
- if (!IsEmptyStr(room)) CM_SetField(msg, eOriginalRoom, room, -1);
+ if (!IsEmptyStr(fromaddr)) CM_SetField(msg, erFc822Addr, fromaddr);
+ if (!IsEmptyStr(room)) CM_SetField(msg, eOriginalRoom, room);
if (!IsEmptyStr(to)) {
- CM_SetField(msg, eRecipient, to, -1);
+ CM_SetField(msg, eRecipient, to);
recp = validate_recipients(to, NULL, 0);
}
if (!IsEmptyStr(subject)) {
- CM_SetField(msg, eMsgSubject, subject, -1);
+ CM_SetField(msg, eMsgSubject, subject);
}
if (!IsEmptyStr(text)) {
- CM_SetField(msg, eMesageText, text, -1);
+ CM_SetField(msg, eMesageText, text);
}
long msgnum = CtdlSubmitMsg(msg, recp, room);
/* Path or Return-Path */
if (myelen > 0) {
- CM_SetField(msg, eMessagePath, my_email, myelen);
+ CM_SetField(msg, eMessagePath, my_email);
}
else if (!IsEmptyStr(author->fullname)) {
- CM_SetField(msg, eMessagePath, author->fullname, -1);
+ CM_SetField(msg, eMessagePath, author->fullname);
}
convert_spaces_to_underscores(msg->cm_fields[eMessagePath]);
blen = snprintf(buf, sizeof buf, "%ld", (long)time(NULL));
- CM_SetField(msg, eTimestamp, buf, blen);
+ CM_SetField(msg, eTimestamp, buf);
if (fnlen > 0) {
FakeAuthor = NewStrBufPlain (fake_name, fnlen);
if (!!IsEmptyStr(CC->room.QRname)) {
if (CC->room.QRflags & QR_MAILBOX) { /* room */
- CM_SetField(msg, eOriginalRoom, &CC->room.QRname[11], -1);
+ CM_SetField(msg, eOriginalRoom, &CC->room.QRname[11]);
}
else {
- CM_SetField(msg, eOriginalRoom, CC->room.QRname, -1);
+ CM_SetField(msg, eOriginalRoom, CC->room.QRname);
}
}
if (rcplen > 0) {
- CM_SetField(msg, eRecipient, recipient, rcplen);
+ CM_SetField(msg, eRecipient, recipient);
}
if (cclen > 0) {
- CM_SetField(msg, eCarbonCopY, recp_cc, cclen);
+ CM_SetField(msg, eCarbonCopY, recp_cc);
}
if (myelen > 0) {
- CM_SetField(msg, erFc822Addr, my_email, myelen);
+ CM_SetField(msg, erFc822Addr, my_email);
}
else if ( (author == &CC->user) && (!IsEmptyStr(CC->cs_inet_email)) ) {
- CM_SetField(msg, erFc822Addr, CC->cs_inet_email, -1);
+ CM_SetField(msg, erFc822Addr, CC->cs_inet_email);
}
if (subject != NULL) {
(IsAscii = isascii(subject[i]) != 0 ))
i++;
if (IsAscii != 0)
- CM_SetField(msg, eMsgSubject, subject, subjlen);
+ CM_SetField(msg, eMsgSubject, subject);
else /* ok, we've got utf8 in the string. */
{
char *rfc2047Subj;
}
if (euidlen > 0) {
- CM_SetField(msg, eExclusiveID, supplied_euid, euidlen);
+ CM_SetField(msg, eExclusiveID, supplied_euid);
}
if (reflen > 0) {
- CM_SetField(msg, eWeferences, references, reflen);
+ CM_SetField(msg, eWeferences, references);
}
if (preformatted_text != NULL) {
- CM_SetField(msg, eMesageText, preformatted_text, textlen);
+ CM_SetField(msg, eMesageText, preformatted_text);
}
else {
StrBuf *MsgBody;
msg->cm_magic = CTDLMESSAGE_MAGIC;
msg->cm_anon_type = MES_NORMAL;
msg->cm_format_type = 4;
- CM_SetField(msg, eAuthor, CC->user.fullname, -1);
- CM_SetField(msg, eOriginalRoom, req_room, -1);
+ CM_SetField(msg, eAuthor, CC->user.fullname);
+ CM_SetField(msg, eOriginalRoom, req_room);
msg->cm_flags = flags;
CM_SetAsFieldSB(msg, eMesageText, &encoded_message);