* make QP encoding of senders optional, so we can flag it if we need it.
[citadel.git] / citadel / modules / imap / imap_misc.c
index 671c6ce5fdc2f1c1847b3b2b78bbec4054cea25b..be350a5721c572294e8b34363bc58927875c4baf 100644 (file)
@@ -30,6 +30,7 @@
 #include <ctype.h>
 #include <string.h>
 #include <limits.h>
+#include <libcitadel.h>
 #include "citadel.h"
 #include "server.h"
 #include "sysdep_decls.h"
 #include "policy.h"
 #include "database.h"
 #include "msgbase.h"
-#include "tools.h"
 #include "internet_addressing.h"
 #include "serv_imap.h"
 #include "imap_tools.h"
 #include "imap_fetch.h"
 #include "imap_misc.h"
 #include "genstamp.h"
-
+#include "ctdl_module.h"
 
 
 
@@ -414,7 +414,7 @@ void imap_append(int num_parms, char *parms[]) {
        client_getln(buf, sizeof buf);
 
        /* Convert RFC822 newlines (CRLF) to Unix newlines (LF) */
-       lprintf(CTDL_DEBUG, "Converting CRLF to LF\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Converting CRLF to LF\n");
        stripped_length = 0;
        for (i=0; i<literal_length; ++i) {
                if (strncmp(&Imap->transmitted_message[i], "\r\n", 2)) {
@@ -425,7 +425,7 @@ void imap_append(int num_parms, char *parms[]) {
        literal_length = stripped_length;
        Imap->transmitted_message[literal_length] = 0;  /* reterminate it */
 
-       lprintf(CTDL_DEBUG, "Converting message format\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Converting message format\n");
        msg = convert_internet_message(Imap->transmitted_message);
        Imap->transmitted_message = NULL;
        Imap->transmitted_length = 0;
@@ -454,7 +454,7 @@ void imap_append(int num_parms, char *parms[]) {
         * private mailboxes.
         */
        if (CC->logged_in) {
-          if ( (CC->room.QRflags & QR_MAILBOX) == 0) {
+          if ( ((CC->room.QRflags & QR_MAILBOX) == 0) && (config.c_imap_keep_from == 0)) {
                if (msg->cm_fields['A'] != NULL) free(msg->cm_fields['A']);
                if (msg->cm_fields['N'] != NULL) free(msg->cm_fields['N']);
                if (msg->cm_fields['H'] != NULL) free(msg->cm_fields['H']);
@@ -467,7 +467,7 @@ void imap_append(int num_parms, char *parms[]) {
        /* 
         * Can we post here?
         */
-       ret = CtdlDoIHavePermissionToPostInThisRoom(buf, sizeof buf);
+       ret = CtdlDoIHavePermissionToPostInThisRoom(buf, sizeof buf, NULL, POST_LOGGED_IN);
 
        if (ret) {
                /* Nope ... print an error message */
@@ -477,7 +477,7 @@ void imap_append(int num_parms, char *parms[]) {
        else {
                /* Yes ... go ahead and post! */
                if (msg != NULL) {
-                       new_msgnum = CtdlSubmitMsg(msg, NULL, "");
+                       new_msgnum = CtdlSubmitMsg(msg, NULL, "", 0);
                }
                if (new_msgnum >= 0L) {
                        cprintf("%s OK [APPENDUID %ld %ld] APPEND completed\r\n",