#include <sys/stat.h>
#include <sys/types.h>
#include <regex.h>
+#include <libcitadel.h>
#include "citadel.h"
#include "server.h"
#include "serv_extensions.h"
#include "file_ops.h"
#include "config.h"
#include "control.h"
-#include "tools.h"
-#include "mime_parser.h"
#include "html.h"
#include "genstamp.h"
#include "internet_addressing.h"
*choose_preferred, *fixed_output_pre,
*fixed_output_post, (void *)&ma, 0);
mime_parser(mptr, NULL,
- *output_preferred, NULL, NULL, (void *)&ma, 0);
+ *output_preferred, NULL, NULL, (void *)&ma, CC->msg4_dont_decode);
}
else {
ma.use_fo_hooks = 1;
*/
void cmd_msgp(char *cmdbuf)
{
- safestrncpy(CC->preferred_formats, cmdbuf,
- sizeof(CC->preferred_formats));
- cprintf("%d ok\n", CIT_OK);
+ if (!strcasecmp(cmdbuf, "dont_decode")) {
+ CC->msg4_dont_decode = 1;
+ cprintf("%d MSG4 will not pre-decode messages.\n", CIT_OK);
+ }
+ else {
+ safestrncpy(CC->preferred_formats, cmdbuf, sizeof(CC->preferred_formats));
+ cprintf("%d Preferred MIME formats have been set.\n", CIT_OK);
+ }
}
struct addresses_to_be_filed *aptr = NULL;
char *saved_rfc822_version = NULL;
int qualified_for_journaling = 0;
+ struct CitContext *CCC = CC; /* CachedCitContext - performance boost */
lprintf(CTDL_DEBUG, "CtdlSubmitMsg() called\n");
if (is_valid_message(msg) == 0) return(-1); /* self check */
}
/* Goto the correct room */
- lprintf(CTDL_DEBUG, "Selected room %s\n", (recps) ? CC->room.QRname : SENTITEMS);
- strcpy(hold_rm, CC->room.QRname);
- strcpy(actual_rm, CC->room.QRname);
+ lprintf(CTDL_DEBUG, "Selected room %s\n", (recps) ? CCC->room.QRname : SENTITEMS);
+ strcpy(hold_rm, CCC->room.QRname);
+ strcpy(actual_rm, CCC->room.QRname);
if (recps != NULL) {
strcpy(actual_rm, SENTITEMS);
}
/* If the user is a twit, move to the twit room for posting */
if (TWITDETECT) {
- if (CC->user.axlevel == 2) {
+ if (CCC->user.axlevel == 2) {
strcpy(hold_rm, actual_rm);
strcpy(actual_rm, config.c_twitroom);
lprintf(CTDL_DEBUG, "Diverting to twit room\n");
}
lprintf(CTDL_DEBUG, "Final selection: %s\n", actual_rm);
- if (strcasecmp(actual_rm, CC->room.QRname)) {
- /* getroom(&CC->room, actual_rm); */
+ if (strcasecmp(actual_rm, CCC->room.QRname)) {
+ /* getroom(&CCC->room, actual_rm); */
usergoto(actual_rm, 0, 1, NULL, NULL);
}
* If this message has no O (room) field, generate one.
*/
if (msg->cm_fields['O'] == NULL) {
- msg->cm_fields['O'] = strdup(CC->room.QRname);
+ msg->cm_fields['O'] = strdup(CCC->room.QRname);
}
/* Perform "before save" hooks (aborting if any return nonzero) */
* If this message has an Exclusive ID, and the room is replication
* checking enabled, then do replication checks.
*/
- if (DoesThisRoomNeedEuidIndexing(&CC->room)) {
+ if (DoesThisRoomNeedEuidIndexing(&CCC->room)) {
ReplicationChecks(msg);
}
* 2. If journaling is enabled, we will need an RFC822 version of the
* message to attach to the journalized copy.
*/
- if (CC->redirect_buffer != NULL) {
- lprintf(CTDL_ALERT, "CC->redirect_buffer is not NULL during message submission!\n");
+ if (CCC->redirect_buffer != NULL) {
+ lprintf(CTDL_ALERT, "CCC->redirect_buffer is not NULL during message submission!\n");
abort();
}
- CC->redirect_buffer = malloc(SIZ);
- CC->redirect_len = 0;
- CC->redirect_alloc = SIZ;
+ CCC->redirect_buffer = malloc(SIZ);
+ CCC->redirect_len = 0;
+ CCC->redirect_alloc = SIZ;
CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ALL, 0, 1);
- smi.meta_rfc822_length = CC->redirect_len;
- saved_rfc822_version = CC->redirect_buffer;
- CC->redirect_buffer = NULL;
- CC->redirect_len = 0;
- CC->redirect_alloc = 0;
+ smi.meta_rfc822_length = CCC->redirect_len;
+ saved_rfc822_version = CCC->redirect_buffer;
+ CCC->redirect_buffer = NULL;
+ CCC->redirect_len = 0;
+ CCC->redirect_alloc = 0;
PutMetaData(&smi);
* message, we want to BYPASS saving the sender's copy (because there
* is no local sender; it would otherwise go to the Trashcan).
*/
- if ((!CC->internal_pgm) || (recps == NULL)) {
+ if ((!CCC->internal_pgm) || (recps == NULL)) {
if (CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 1, msg) != 0) {
lprintf(CTDL_ERR, "ERROR saving message pointer!\n");
CtdlSaveMsgPointerInRoom(config.c_aideroom, newmsgid, 0, msg);
/* Bump this user's messages posted counter. */
lprintf(CTDL_DEBUG, "Updating user\n");
- lgetuser(&CC->user, CC->curr_user);
- CC->user.posted = CC->user.posted + 1;
- lputuser(&CC->user);
+ lgetuser(&CCC->user, CCC->curr_user);
+ CCC->user.posted = CCC->user.posted + 1;
+ lputuser(&CCC->user);
/* If this is private, local mail, make a copy in the
* recipient's mailbox and bump the reference count.
snprintf(submit_filename, sizeof submit_filename,
"%s/netmail.%04lx.%04x.%04x",
ctdl_netin_dir,
- (long) getpid(), CC->cs_pid, ++seqnum);
+ (long) getpid(), CCC->cs_pid, ++seqnum);
network_fp = fopen(submit_filename, "wb+");
if (network_fp != NULL) {
fwrite(smr.ser, smr.len, 1, network_fp);
/* Go back to the room we started from */
lprintf(CTDL_DEBUG, "Returning to original room %s\n", hold_rm);
- if (strcasecmp(hold_rm, CC->room.QRname))
+ if (strcasecmp(hold_rm, CCC->room.QRname))
usergoto(hold_rm, 0, 1, NULL, NULL);
/* For internet mail, generate delivery instructions.
/*
* Any addresses to harvest for someone's address book?
*/
- if ( (CC->logged_in) && (recps != NULL) ) {
+ if ( (CCC->logged_in) && (recps != NULL) ) {
collected_addresses = harvest_collected_addresses(msg);
}
malloc(sizeof(struct addresses_to_be_filed));
aptr->next = atbf;
MailboxName(actual_rm, sizeof actual_rm,
- &CC->user, USERCONTACTSROOM);
+ &CCC->user, USERCONTACTSROOM);
aptr->roomname = strdup(actual_rm);
aptr->collected_addresses = collected_addresses;
atbf = aptr;
CtdlEncodeBase64(
&encoded_message[strlen(encoded_message)],
raw_message,
- (int)raw_length
+ (int)raw_length,
+ 0
);
}
else {