X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fserver%2Fmsgbase.c;h=f3188bcbd66dedf1c920da97c37e97f33ffcd884;hb=eab56df5d120be5d474378f8536837d0abd43214;hp=199a5efa366b9da07a7ef7dddf87926883a91c1b;hpb=dd9248637b2d2d26c30ace03a97b2877c49af399;p=citadel.git diff --git a/citadel/server/msgbase.c b/citadel/server/msgbase.c index 199a5efa3..f3188bcbd 100644 --- a/citadel/server/msgbase.c +++ b/citadel/server/msgbase.c @@ -1416,14 +1416,14 @@ int check_cached_msglist(long msgnum) { // 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; @@ -1456,15 +1456,10 @@ int CtdlOutputMsg(long msg_num, // message number (local) to fetch 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); @@ -1479,8 +1474,7 @@ int CtdlOutputMsg(long msg_num, // message number (local) to fetch } 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); } @@ -1566,13 +1560,13 @@ void OutputCtdlMsgHeaders(struct CtdlMessage *TheMessage, int do_proto) { 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); } } @@ -1756,14 +1750,12 @@ void Dump_RFC822HeadersBody( // 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'); @@ -1984,10 +1976,10 @@ int CtdlOutputPreLoadedMsg( } // 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"); } @@ -2060,11 +2052,7 @@ START_TEXT: (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; } } @@ -2078,11 +2066,9 @@ START_TEXT: 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 @@ -2131,6 +2117,7 @@ DONE: // now we're done 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 @@ -2353,7 +2340,7 @@ long send_message(struct CtdlMessage *msg) { // 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")