cleanup includes
[citadel.git] / citadel / msgbase.c
index 03ef35df6158d99a1d5151cc17b305a61832018a..d4a933e76e13c478463fe9be3ae078763a5800bc 100644 (file)
  * GNU General Public License for more details.
  */
 
-#include "sysdep.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
 
-
-#include <ctype.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+#include <stdio.h>
 #include <regex.h>
+#include <libcitadel.h>
 
 #include "md5.h"
 
-#include <libcitadel.h>
-#include "citadel.h"
-#include "server.h"
-#include "serv_extensions.h"
-#include "database.h"
-#include "msgbase.h"
-#include "support.h"
-#include "sysdep_decls.h"
+#include "ctdl_module.h"
 #include "citserver.h"
-#include "room_ops.h"
-#include "user_ops.h"
-#include "file_ops.h"
-#include "config.h"
 #include "control.h"
+#include "clientsocket.h"
 #include "genstamp.h"
+#include "room_ops.h"
+#include "user_ops.h"
+
 #include "internet_addressing.h"
 #include "euidindex.h"
+#include "msgbase.h"
 #include "journaling.h"
-#include "citadel_dirs.h"
-#include "clientsocket.h"
-#include "threads.h"
-
-#include "ctdl_module.h"
 
 struct addresses_to_be_filed *atbf = NULL;
 
@@ -193,6 +160,18 @@ void CM_FlushField(struct CtdlMessage *Msg, eMsgField which)
                free (Msg->cm_fields[which]);
        Msg->cm_fields[which] = NULL;
 }
+void CM_Flush(struct CtdlMessage *Msg)
+{
+       int i;
+
+       if (CM_IsValidMsg(Msg) == 0) 
+               return;
+
+       for (i = 0; i < 256; ++i)
+       {
+               CM_FlushField(Msg, i);
+       }
+}
 
 void CM_CopyField(struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy)
 {
@@ -204,7 +183,7 @@ void CM_CopyField(struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField Whi
        {
                len = strlen(Msg->cm_fields[WhichtToCopy]);
                Msg->cm_fields[WhichToPutTo] = malloc(len + 1);
-               memcpy(Msg->cm_fields[WhichToPutTo], Msg->cm_fields[WhichToPutTo], len);
+               memcpy(Msg->cm_fields[WhichToPutTo], Msg->cm_fields[WhichtToCopy], len);
                Msg->cm_fields[WhichToPutTo][len] = '\0';
        }
        else
@@ -1016,7 +995,9 @@ void list_this_suff(char *name, char *filename, char *partnum, char *disp,
 
 /*
  * Callback function for mime parser that opens a section for downloading
+ * we use serv_files function here: 
  */
+extern void OpenCmdResult(char *filename, const char *mime_type);
 void mime_download(char *name, char *filename, char *partnum, char *disp,
                   void *content, char *cbtype, char *cbcharset, size_t length,
                   char *encoding, char *cbid, void *cbuserdata)