]> code.citadel.org Git - citadel.git/blobdiff - citadel/msgbase.c
* database.c: print log messages for file defragmentations
[citadel.git] / citadel / msgbase.c
index 02df56809290049a6c9f2db0c96fb54cb1d2ea07..7d325aeba17425fd405e900a980a58dfab59612c 100644 (file)
@@ -1,4 +1,5 @@
 /* $Id$ */
+#include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -7,7 +8,10 @@
 #include <ctype.h>
 #include <string.h>
 #include <syslog.h>
+#ifdef HAVE_PTHREAD_H
 #include <pthread.h>
+#endif
+#include <limits.h>
 #include "citadel.h"
 #include "server.h"
 #include <errno.h>
 #include "msgbase.h"
 #include "support.h"
 #include "sysdep_decls.h"
+#include "citserver.h"
 #include "room_ops.h"
 #include "user_ops.h"
+#include "file_ops.h"
 #include "control.h"
 #include "dynloader.h"
 #include "tools.h"
+#include "mime_parser.h"
 
 #define MSGS_ALL       0
 #define MSGS_OLD       1
@@ -29,6 +36,8 @@
 #define MSGS_LAST      4
 #define MSGS_GT                5
 
+#define desired_section ((char *)CtdlGetUserData(SYM_DESIRED_SECTION))
+
 extern struct config config;
 
 
@@ -64,55 +73,43 @@ int alias(char *name)               /* process alias and routing info for mail */
        lprintf(9, "alias() called for <%s>\n", name);
 
        remove_any_whitespace_to_the_left_or_right_of_at_symbol(name);
-       
+
        fp=fopen("network/mail.aliases","r");
        if (fp==NULL) fp=fopen("/dev/null","r");
-       if (fp==NULL) return(M_ERROR);
-GNA:   strcpy(aaa,""); strcpy(bbb,"");
-       do {
-               a=getc(fp);
-               if (a==',') a=0;
-               if (a>0) {
-                       b=strlen(aaa);
-                       aaa[b]=a;
-                       aaa[b+1]=0;
-                       }
-               } while(a>0);
-       do {
-               a=getc(fp);
-               if (a==10) a=0;
-               if (a>0) {
-                       b=strlen(bbb);
-                       bbb[b]=a;
-                       bbb[b+1]=0;
+       if (fp==NULL) return(MES_ERROR);
+       strcpy(aaa,""); strcpy(bbb,"");
+       while (fgets(aaa, sizeof aaa, fp)!=NULL) {
+               while (isspace(name[0])) strcpy(name, &name[1]);
+               aaa[strlen(aaa)-1] = 0;
+               strcpy(bbb, "");
+               for (a=0; a<strlen(aaa); ++a) {
+                       if (aaa[a] == ',') {
+                               strcpy(bbb, &aaa[a+1]);
+                               aaa[a] = 0;
+                               }
                        }
-               } while(a>0);
-       if (a<0) {
-               fclose(fp);
-               goto DETYPE;
+               if (!strcasecmp(name, aaa)) strcpy(name, bbb);
                }
-       if (strcasecmp(name,aaa)) goto GNA;
        fclose(fp);
-       strcpy(name,bbb);
        lprintf(7, "Mail is being forwarded to %s\n", name);
 
-DETYPE:        /* determine local or remote type, see citadel.h */
-       for (a=0; a<strlen(name); ++a) if (name[a]=='!') return(M_INTERNET);
+       /* determine local or remote type, see citadel.h */
+       for (a=0; a<strlen(name); ++a) if (name[a]=='!') return(MES_INTERNET);
        for (a=0; a<strlen(name); ++a)
                if (name[a]=='@')
                        for (b=a; b<strlen(name); ++b)
-                               if (name[b]=='.') return(M_INTERNET);
+                               if (name[b]=='.') return(MES_INTERNET);
        b=0; for (a=0; a<strlen(name); ++a) if (name[a]=='@') ++b;
        if (b>1) {
                lprintf(7, "Too many @'s in address\n");
-               return(M_ERROR);
+               return(MES_ERROR);
                }
        if (b==1) {
                for (a=0; a<strlen(name); ++a)
                        if (name[a]=='@') strcpy(bbb,&name[a+1]);
                while (bbb[0]==32) strcpy(bbb,&bbb[1]);
                fp = fopen("network/mail.sysinfo","r");
-               if (fp==NULL) return(M_ERROR);
+               if (fp==NULL) return(MES_ERROR);
 GETSN:         do {
                        a=getstring(fp,aaa);
                        } while ((a>=0)&&(strcasecmp(aaa,bbb)));
@@ -131,7 +128,7 @@ GETSN:              do {
                                }
                        while(bbb[strlen(bbb)-1]=='_') bbb[strlen(bbb)-1]=0;
                        sprintf(name,&aaa[4],bbb);
-                       return(M_INTERNET);
+                       return(MES_INTERNET);
                        }
                if (!strncmp(aaa,"bin",3)) {
                        strcpy(aaa,name); strcpy(bbb,name);
@@ -142,11 +139,11 @@ GETSN:            do {
                        strcpy(bbb,&bbb[1]);
                        while (bbb[0]==' ') strcpy(bbb,&bbb[1]);
                        sprintf(name,"%s @%s",aaa,bbb);
-                       return(M_BINARY);
+                       return(MES_BINARY);
                        }
-               return(M_ERROR);
+               return(MES_ERROR);
                }
-       return(M_LOCAL);
+       return(MES_LOCAL);
        }
 
 
@@ -329,16 +326,78 @@ FMTA:     if (subst) {
                }
        goto FMTA;
 
-FMTEND:        cprintf("\n");
+FMTEND:        cprintf("%s\n", aaa);
+       }
+
+
+
+/*
+ * Callback function for mime parser that simply lists the part
+ */
+void list_this_part(char *name, char *filename, char *partnum, char *disp,
+                        void *content, char *cbtype, size_t length) {
+
+       cprintf("part=%s|%s|%s|%s|%s|%d\n",
+               name, filename, partnum, disp, cbtype, length);
        }
 
 
+/*
+ * Callback function for mime parser that wants to display text
+ */
+void fixed_output(char *name, char *filename, char *partnum, char *disp,
+                        void *content, char *cbtype, size_t length) {
+
+       if (!strcasecmp(cbtype, "text/plain")) {
+               client_write(content, length);
+               }
+       else {
+               cprintf("Part %s: %s (%s) (%d bytes)\n",
+                       partnum, filename, cbtype, length);
+               }
+       }
+
+
+/*
+ * Callback function for mime parser that opens a section for downloading
+ */
+void mime_download(char *name, char *filename, char *partnum, char *disp,
+                        void *content, char *cbtype, size_t length) {
+
+       char tmpname[PATH_MAX];
+       static int seq = 0;
+
+       /* Silently go away if there's already a download open... */
+       if (CC->download_fp != NULL) return;
+
+       /* ...or if this is not the desired section */
+       if (strcasecmp(desired_section, partnum)) return;
+
+       snprintf(tmpname, sizeof tmpname,
+               "/tmp/CitServer.download.%4x.%4x", getpid(), ++seq);
+
+       CC->download_fp = fopen(tmpname, "wb+");
+       if (CC->download_fp == NULL) return;
+
+       /* Unlink the file while it's open, to guarantee that the
+        * temp file will always be deleted.
+        */
+       unlink(tmpname);
+
+       fwrite(content, length, 1, CC->download_fp);
+       fflush(CC->download_fp);
+       rewind(CC->download_fp);
+
+       OpenCmdResult(filename, cbtype);
+       }
+
+
+
 /*
  * Get a message off disk.  (return value is the message's timestamp)
  * 
  */
-time_t output_message(char *msgid, int mode,
-                       int headers_only, int desired_section) {
+time_t output_message(char *msgid, int mode, int headers_only) {
        long msg_num;
        int a;
        CIT_UBYTE ch, rch;
@@ -357,7 +416,7 @@ time_t output_message(char *msgid, int mode,
        char lnode[256];
        char mid[256];
        time_t xtime = 0L;
-       /* */
+       /*                                       */
 
        msg_num = atol(msgid);
 
@@ -422,6 +481,41 @@ time_t output_message(char *msgid, int mode,
        anon_flag = *mptr++;
        format_type = *mptr++;
 
+       /* Are we downloading a MIME component? */
+       if (mode == MT_DOWNLOAD) {
+               if (format_type != 4) {
+                       cprintf("%d This is not a MIME message.\n",
+                               ERROR);
+                       }
+               else if (CC->download_fp != NULL) {
+                       cprintf("%d You already have a download open.\n",
+                               ERROR);
+                       }
+               else {
+                       /* Skip to the message body */
+                       while(ch = *mptr++, (ch!='M' && ch!=0)) {
+                               buf[0] = 0;
+                               do {
+                                       buf[strlen(buf)+1] = 0;
+                                       rch = *mptr++;
+                                       buf[strlen(buf)] = rch;
+                                       } while (rch > 0);
+                               }
+                       /* Now parse it */
+                       mime_parser(mptr, NULL, *mime_download);
+                       /* If there's no file open by this time, the requested
+                        * section wasn't found, so print an error
+                        */
+                       if (CC->download_fp == NULL) {
+                               cprintf("%d Section %s not found.\n",
+                                       ERROR+FILE_NOT_FOUND,
+                                       desired_section);
+                               }
+                       }
+               cdb_free(dmsgtext);
+               return(xtime);
+               }
+
        /* Are we just looking for the message date? */
        if (mode == MT_DATE) while(ch = *mptr++, (ch!='M' && ch!=0)) {
                buf[0] = 0;
@@ -442,7 +536,7 @@ time_t output_message(char *msgid, int mode,
        /* now for the user-mode message reading loops */
        cprintf("%d Message %ld:\n",LISTING_FOLLOWS,msg_num);
 
-       if (mode == MT_CITADEL) cprintf("type=%d\n",format_type);
+       if (mode == MT_CITADEL) cprintf("type=%d\n", format_type);
 
        if ( (anon_flag == MES_ANON) && (mode == MT_CITADEL) ) {
                cprintf("nhdr=yes\n");
@@ -450,7 +544,8 @@ time_t output_message(char *msgid, int mode,
 
        /* begin header processing loop for Citadel message format */
 
-       if (mode == MT_CITADEL) while(ch = *mptr++, (ch!='M' && ch!=0)) {
+       if ((mode == MT_CITADEL)||(mode == MT_MIME))
+          while(ch = *mptr++, (ch!='M' && ch!=0)) {
                buf[0] = 0;
                do {
                        buf[strlen(buf)+1] = 0;
@@ -535,6 +630,18 @@ time_t output_message(char *msgid, int mode,
                return(xtime);
                }
 
+       /* do some sort of MIME output */
+       if (format_type == 4) {
+               if ((mode == MT_CITADEL)||(mode == MT_MIME)) {
+                       mime_parser(mptr, NULL, *list_this_part);
+                       }
+               if (mode == MT_MIME) { /* If MT_MIME then it's parts only */
+                       cprintf("000\n");
+                       cdb_free(dmsgtext);
+                       return(xtime);
+                       }
+               }
+
        if (headers_only) {
                /* give 'em a length */
                msg_len = 0L;
@@ -549,7 +656,7 @@ time_t output_message(char *msgid, int mode,
 
        /* signify start of msg text */
        if (mode == MT_CITADEL) cprintf("text\n");
-       if (mode == MT_RFC822) cprintf("\n");
+       if ( (mode == MT_RFC822) && (format_type != 4) ) cprintf("\n");
 
        /* If the format type on disk is 1 (fixed-format), then we want
         * everything to be output completely literally ... regardless of
@@ -580,7 +687,14 @@ time_t output_message(char *msgid, int mode,
        if (format_type == 0) {
                memfmout(80,mptr,0);
                }
-
+       /* If the message on disk is format 4 (MIME), we've gotta hand it
+        * off to the MIME parser.  The client has already been told that
+        * this message is format 1 (fixed format), so the callback function
+        * we use will display those parts as-is.
+        */
+       if (format_type == 4) {
+               mime_parser(mptr, NULL, *fixed_output);
+               }
 
        /* now we're done */
        cprintf("000\n");
@@ -596,13 +710,11 @@ void cmd_msg0(char *cmdbuf)
 {
        char msgid[256];
        int headers_only = 0;
-       int desired_section = 0;
 
        extract(msgid,cmdbuf,0);
        headers_only = extract_int(cmdbuf, 1);
-       desired_section = extract_int(cmdbuf, 2);
 
-       output_message(msgid,MT_CITADEL, headers_only, desired_section);
+       output_message(msgid, MT_CITADEL, headers_only);
        return;
        }
 
@@ -618,7 +730,7 @@ void cmd_msg2(char *cmdbuf)
        extract(msgid,cmdbuf,0);
        headers_only = extract_int(cmdbuf,1);
 
-       output_message(msgid,MT_RFC822,headers_only,0);
+       output_message(msgid,MT_RFC822,headers_only);
        }
 
 /* 
@@ -638,7 +750,36 @@ void cmd_msg3(char *cmdbuf)
        extract(msgid,cmdbuf,0);
        headers_only = extract_int(cmdbuf,1);
 
-       output_message(msgid,MT_RAW,headers_only,0);
+       output_message(msgid,MT_RAW,headers_only);
+       }
+
+/* 
+ * display a message (mode 4 - MIME) (FIX ... still evolving, not complete)
+ */
+void cmd_msg4(char *cmdbuf)
+{
+       char msgid[256];
+
+       extract(msgid, cmdbuf, 0);
+
+       output_message(msgid, MT_MIME, 0);
+       }
+
+
+
+/*
+ * Open a component of a MIME message as a download file 
+ */
+void cmd_opna(char *cmdbuf)
+{
+       char msgid[256];
+
+       CtdlAllocUserData(SYM_DESIRED_SECTION, 64);
+
+       extract(msgid, cmdbuf, 0);
+       extract(desired_section, cmdbuf, 1);
+
+       output_message(msgid, MT_DOWNLOAD, 0);
        }
 
 
@@ -663,7 +804,7 @@ long send_message(char *message_in_memory,  /* pointer to buffer */
        if (generate_id) {
                sprintf(msgidbuf, "I%ld", newmsgid);
                actual_length = message_length + strlen(msgidbuf) + 1;
-               actual_message = malloc(actual_length);
+               actual_message = mallok(actual_length);
                memcpy(actual_message, message_in_memory, 3);
                memcpy(&actual_message[3], msgidbuf, (strlen(msgidbuf)+1) );
                memcpy(&actual_message[strlen(msgidbuf)+4],
@@ -688,7 +829,7 @@ long send_message(char *message_in_memory,  /* pointer to buffer */
        end_critical_section(S_MSGMAIN);
 
        if (generate_id) {
-               free(actual_message);
+               phree(actual_message);
                }
 
        /* Finally, return the pointers */
@@ -727,13 +868,14 @@ void copy_file(char *from, char *to)
  */
 void save_message(char *mtmp,  /* file containing proper message */
                char *rec,      /* Recipient (if mail) */
-               char mtsflag,   /* 0 for normal, 1 to force Aide> room */
+               char *force,    /* if non-zero length, force a room */
                int mailtype,   /* local or remote type, see citadel.h */
                int generate_id) /* set to 1 to generate an 'I' field */
 {
        char aaa[100];
        char hold_rm[ROOMNAMELEN];
        char actual_rm[ROOMNAMELEN];
+       char force_room[ROOMNAMELEN];
        char recipient[256];
        long newmsgid;
        char *message_in_memory;
@@ -744,8 +886,10 @@ void save_message(char *mtmp,      /* file containing proper message */
        int a;
        static int seqnum = 0;
 
-       lprintf(9, "save_message(%s,%s,%d,%d,%d)\n",
-               mtmp, rec, mtsflag, mailtype, generate_id);
+       lprintf(9, "save_message(%s,%s,%s,%d,%d)\n",
+               mtmp, rec, force, mailtype, generate_id);
+
+       strcpy(force_room, force);
 
        /* Strip non-printable characters out of the recipient name */
        strcpy(recipient, rec);
@@ -758,7 +902,7 @@ void save_message(char *mtmp,       /* file containing proper message */
        templen = statbuf.st_size;
 
        /* Now read it into memory */
-       message_in_memory = (char *) malloc(templen);
+       message_in_memory = (char *) mallok(templen);
        if (message_in_memory == NULL) {
                lprintf(2, "Can't allocate memory to save message!\n");
                return;
@@ -769,7 +913,7 @@ void save_message(char *mtmp,       /* file containing proper message */
        fclose(fp);
 
        newmsgid = send_message(message_in_memory, templen, generate_id);
-       free(message_in_memory);
+       phree(message_in_memory);
        if (newmsgid <= 0L) return;
 
        strcpy(actual_rm, CC->quickroom.QRname);
@@ -782,11 +926,13 @@ void save_message(char *mtmp,     /* file containing proper message */
                }
 
        /* ...or if this is a private message, go to the target mailbox. */
+       lprintf(9, "mailbox aliasing loop\n");
        if (strlen(recipient) > 0) {
                /* mailtype = alias(recipient); */
-               if (mailtype == M_LOCAL) {
+               if (mailtype == MES_LOCAL) {
                        if (getuser(&userbuf, recipient)!=0) {
-                               mtsflag = 1; /* User not found, goto Aide */
+                               /* User not found, goto Aide */
+                               strcpy(force_room, AIDEROOM);
                                }
                        else {
                                strcpy(hold_rm, actual_rm);
@@ -796,9 +942,10 @@ void save_message(char *mtmp,      /* file containing proper message */
                }
 
        /* ...or if this message is destined for Aide> then go there. */
-       if (mtsflag) {
+       lprintf(9, "actual room forcing loop\n");
+       if (strlen(force_room) > 0) {
                strcpy(hold_rm, actual_rm);
-               strcpy(actual_rm, AIDEROOM);
+               strcpy(actual_rm, force_room);
                }
 
        /* This call to usergoto() changes rooms if necessary.  It also
@@ -821,11 +968,11 @@ void save_message(char *mtmp,     /* file containing proper message */
        lputroom(&CC->quickroom, actual_rm);
 
        /* Network mail - send a copy to the network program. */
-       if ( (strlen(recipient)>0) && (mailtype != M_LOCAL) ) {
-               sprintf(aaa,"./network/spoolin/netmail.%04x.%04x.%04x",
-                       getpid(), CC->cs_pid, ++seqnum);
+       if ( (strlen(recipient)>0) && (mailtype != MES_LOCAL) ) {
+               sprintf(aaa,"./network/spoolin/netmail.%04lx.%04x.%04x",
+                       (long)getpid(), CC->cs_pid, ++seqnum);
                copy_file(mtmp,aaa);
-               system("exec nohup ./netproc >/dev/null 2>&1 &");
+               system("exec nohup ./netproc -i >/dev/null 2>&1 &");
                }
 
        /* Bump this user's messages posted counter. */
@@ -848,20 +995,18 @@ void save_message(char *mtmp,     /* file containing proper message */
  */
 void aide_message(char *text)
 {
-       time_t now;
        FILE *fp;
 
-       time(&now);
        fp=fopen(CC->temp,"wb");
        fprintf(fp,"%c%c%c",255,MES_NORMAL,0);
        fprintf(fp,"Psysop%c",0);
-       fprintf(fp,"T%ld%c",now,0);
+       fprintf(fp,"T%ld%c", (long)time(NULL), 0);
        fprintf(fp,"ACitadel%c",0);
        fprintf(fp,"OAide%c",0);
        fprintf(fp,"N%s%c",NODENAME,0);
        fprintf(fp,"M%s\n%c",text,0);
        fclose(fp);
-       save_message(CC->temp,"",1,M_LOCAL,1);
+       save_message(CC->temp,"",AIDEROOM,MES_LOCAL,1);
        syslog(LOG_NOTICE,text);
        }
 
@@ -890,8 +1035,8 @@ void make_message(
        strcpy(dest_node, "");
 
 
-       /* If net_type is M_BINARY, split out the destination node. */
-       if (net_type == M_BINARY) {
+       /* If net_type is MES_BINARY, split out the destination node. */
+       if (net_type == MES_BINARY) {
                strcpy(dest_node,NODENAME);
                for (a=0; a<strlen(recipient); ++a) {
                        if (recipient[a]=='@') {
@@ -901,8 +1046,8 @@ void make_message(
                        }
                }
 
-       /* if net_type is M_INTERNET, set the dest node to 'internet' */
-       if (net_type == M_INTERNET) {
+       /* if net_type is MES_INTERNET, set the dest node to 'internet' */
+       if (net_type == MES_INTERNET) {
                strcpy(dest_node,"internet");
                }
 
@@ -915,7 +1060,7 @@ void make_message(
        putc(type,fp);  /* Normal or anonymous, see MES_ flags */
        putc(format_type,fp);   /* Formatted or unformatted */
        fprintf(fp,"Pcit%ld%c",author->usernum,0);      /* path */
-       fprintf(fp,"T%ld%c",now,0);                     /* date/time */
+       fprintf(fp,"T%ld%c",(long)now,0);               /* date/time */
        if (fake_name[0])
           fprintf(fp,"A%s%c",fake_name,0);
        else
@@ -1005,7 +1150,7 @@ void cmd_ent0(char *entargs)
               return;
            }
           extract(newusername,entargs,4);
-          bzero(CC->fake_postname, 32);
+          memset(CC->fake_postname, 0, 32);
            strcpy(CC->fake_postname, newusername);
            cprintf("%d Ok\n",OK);
            return;
@@ -1019,18 +1164,20 @@ void cmd_ent0(char *entargs)
                        strcpy(buf,recipient);
                        }
                else strcpy(buf,"sysop");
+               lprintf(9, "calling alias()\n");
                e=alias(buf);                   /* alias and mail type */
-               if ((buf[0]==0) || (e==M_ERROR)) {
+               lprintf(9, "alias() returned %d\n", e);
+               if ((buf[0]==0) || (e==MES_ERROR)) {
                        cprintf("%d Unknown address - cannot send message.\n",
                                ERROR+NO_SUCH_USER);
                        return;
                        }
-               if ((e!=M_LOCAL)&&(CC->usersupp.axlevel<4)) {
+               if ((e!=MES_LOCAL)&&(CC->usersupp.axlevel<4)) {
                        cprintf("%d Net privileges required for network mail.\n",
                                ERROR+HIGHER_ACCESS_REQUIRED);
                        return;
                        }
-               if ((RESTRICT_INTERNET==1)&&(e==M_INTERNET)
+               if ((RESTRICT_INTERNET==1)&&(e==MES_INTERNET)
                   &&((CC->usersupp.flags&US_INTERNET)==0)
                   &&(!CC->internal_pgm) ) {
                        cprintf("%d You don't have access to Internet mail.\n",
@@ -1041,7 +1188,7 @@ void cmd_ent0(char *entargs)
                        mtsflag=1;
                        goto SKFALL;
                        }
-               if (e!=M_LOCAL) goto SKFALL;    /* don't search local file  */
+               if (e!=MES_LOCAL) goto SKFALL;  /* don't search local file  */
                if (!strcasecmp(buf,CC->usersupp.fullname)) {
                        cprintf("%d Can't send mail to yourself!\n",
                                ERROR+NO_SUCH_USER);
@@ -1051,7 +1198,7 @@ void cmd_ent0(char *entargs)
                /* Check to make sure the user exists; also get the correct
                * upper/lower casing of the name. 
                */
-               a = getuser(&tempUS,buf);
+               a = getuser(&tempUS, buf);
                if (a != 0) {
                        cprintf("%d No such user.\n",ERROR+NO_SUCH_USER);
                        return;
@@ -1082,7 +1229,7 @@ SKFALL: b=MES_NORMAL;
              make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, CC->fake_username);
           else
              make_message(CC->temp,&CC->usersupp,buf,CC->quickroom.QRname,b,e,format_type, "");
-       save_message(CC->temp,buf,mtsflag,e,1);
+       save_message(CC->temp,buf, (mtsflag ? AIDEROOM : ""), e,1);
         CC->fake_postname[0]='\0';
        return;
        }
@@ -1120,12 +1267,12 @@ void cmd_ent3(char *entargs)
        /* If we're in Mail, check the recipient */
        if (strlen(recp) > 0) {
                e=alias(recp);                  /* alias and mail type */
-               if ((recp[0]==0) || (e==M_ERROR)) {
+               if ((recp[0]==0) || (e==MES_ERROR)) {
                        cprintf("%d Unknown address - cannot send message.\n",
                                ERROR+NO_SUCH_USER);
                        return;
                        }
-               if (e == M_LOCAL) {
+               if (e == MES_LOCAL) {
                        a = getuser(&tempUS,recp);
                        if (a!=0) {
                                cprintf("%d No such user.\n",
@@ -1160,7 +1307,7 @@ void cmd_ent3(char *entargs)
                }
        fclose(fp);
 
-       save_message(CC->temp, recp, 0, e, 0);
+       save_message(CC->temp, recp, "", e, 0);
        }