// Get a message off disk. (returns om_* values found in msgbase.h)
int CtdlOutputMsg(long msg_num, // message number (local) to fetch
int mode, // how would you like that message?
- int headers_only, // eschew the message body?
+ int headers_only, // If nonzero, skip the message body. Also avoids loading it, if it's stored separately.
int do_proto, // do Citadel protocol responses?
- int crlf, // Use CRLF newlines instead of LF?
+ int crlf, // If nonzero, terminate lines with CRLF instead of just LF
char *section, // NULL or a message/rfc822 section
int flags, // various flags; see msgbase.h
- char **Author,
- char **Address,
- char **MessageID
+ char **Author, // If non-NULL, allocate a string buffer and populate the display name (caller must free)
+ char **Address, // If non-NULL, allocate a string buffer and populate the email address (caller must free)
+ char **MessageID // If non-NULL, allocate a string buffer and populate the message ID (caller must free)
) {
struct CtdlMessage *TheMessage = NULL;
int retcode = CIT_OK;
r = check_cached_msglist(msg_num);
}
if (r != om_ok) {
- syslog(LOG_DEBUG, "msgbase: security check fail; message %ld is not in %s",
- msg_num, CC->room.QRname
- );
+ syslog(LOG_DEBUG, "msgbase: security check fail; message %ld is not in %s", msg_num, CC->room.QRname);
if (do_proto) {
if (r == om_access_denied) {
- cprintf("%d message %ld was not found in this room\n",
- ERROR + HIGHER_ACCESS_REQUIRED,
- msg_num
- );
+ cprintf("%d message %ld was not found in this room\n", ERROR + HIGHER_ACCESS_REQUIRED, msg_num);
}
}
return(r);
}
if (TheMessage == NULL) {
- if (do_proto) cprintf("%d Can't locate msg %ld on disk\n",
- ERROR + MESSAGE_NOT_FOUND, msg_num);
+ if (do_proto) cprintf("%d Can't locate msg %ld on disk\n", ERROR + MESSAGE_NOT_FOUND, msg_num);
return(om_no_such_msg);
}
else {
safestrncpy(display_name, buf, sizeof display_name);
}
- if ((is_room_aide())
- && ((TheMessage->cm_anon_type == MES_ANONONLY)
- || (TheMessage->cm_anon_type == MES_ANONOPT))) {
+ if ( (is_room_aide())
+ && ( (TheMessage->cm_anon_type == MES_ANONONLY)
+ || (TheMessage->cm_anon_type == MES_ANONOPT)
+ )
+ ) {
size_t tmp = strlen(display_name);
- snprintf(&display_name[tmp],
- sizeof display_name - tmp,
- " [%s]", buf);
+ snprintf(&display_name[tmp], sizeof display_name - tmp, " [%s]", buf);
}
}
// do nothing
}
else {
- if ((!eoh) &&
- (*mptr == '\n'))
- {
+ if ((!eoh) && (*mptr == '\n')) {
eoh = (*(mptr+1) == '\r') && (*(mptr+2) == '\n');
- if (!eoh)
+ if (!eoh) {
eoh = *(mptr+1) == '\n';
- if (eoh)
- {
+ }
+ if (eoh) {
StartOfText = mptr;
StartOfText = strchr(StartOfText, '\n');
StartOfText = strchr(StartOfText, '\n');
}
// nhdr=yes means that we're only displaying headers, no body
- if ( (TheMessage->cm_anon_type == MES_ANONONLY)
- && ((mode == MT_CITADEL) || (mode == MT_MIME))
- && (do_proto)
- ) {
+ if ( (TheMessage->cm_anon_type == MES_ANONONLY)
+ && ((mode == MT_CITADEL) || (mode == MT_MIME))
+ && (do_proto)
+ ) {
cprintf("nhdr=yes\n");
}
(void *)&ma, 1);
}
else if (mode == MT_RFC822) { // unparsed RFC822 dump
- Dump_RFC822HeadersBody(
- TheMessage,
- headers_only,
- flags,
- nl, nlen);
+ Dump_RFC822HeadersBody(TheMessage, headers_only, flags, nl, nlen);
goto DONE;
}
}
if (do_proto) cprintf("text\n");
}
- if (TheMessage->cm_format_type == FMT_FIXED)
- DumpFormatFixed(
- TheMessage,
- mode, // how would you like that message?
- nl, nlen);
+ if (TheMessage->cm_format_type == FMT_FIXED) {
+ DumpFormatFixed( TheMessage, mode, nl, nlen);
+ }
// If the message on disk is format 0 (Citadel vari-format), we
// output using the formatter at 80 columns. This is the final output
return(om_ok);
}
+
// Save one or more message pointers into a specified room
// (Returns 0 for success, nonzero for failure)
// roomname may be NULL to use the current room
// Generate an ID if we don't have one already
if (CM_IsEmpty(msg, emessageId)) {
- msgidbuflen = snprintf(msgidbuf, sizeof msgidbuf, "%08lX-%08lX@%s",
+ msgidbuflen = snprintf(msgidbuf, sizeof msgidbuf, "%lX-%lX@%s",
(long unsigned int) time(NULL),
(long unsigned int) newmsgid,
CtdlGetConfigStr("c_fqdn")