/*
* Citadel/UX message support routines
- * see copyright.doc for copyright information
+ * see copyright.txt for copyright information
*/
#include <stdlib.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include "citadel.h"
+#include "messages.h"
#define MAXWORDBUF 256
#define MAXMSGS 512
char text[MAXWORDBUF];
};
-long finduser();
-char inkey();
-void sttybbs();
-int struncmp();
-int fmout();
-int haschar();
-int checkpagin();
-void getline();
-void formout();
-int yesno();
-void newprompt();
-int file_checksum();
-void color();
-void do_edit();
+char inkey(void);
+void sttybbs(int cmd);
+int struncmp(char *lstr, char *rstr, int len);
+int fmout(int width, FILE *fp, char pagin, int height, int starting_lp, char subst);
+int haschar(char *st, int ch);
+int checkpagin(int lp, int pagin, int height);
+void getline(char *string, int lim);
+void formout(char *name);
+int yesno(void);
+void newprompt(char *prompt, char *str, int len);
+int file_checksum(char *filename);
+void color(int colornum);
+void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd);
char reply_to[512];
long msg_arr[MAXMSGS];
extern char sigcaught;
extern char editor_path[];
extern char printcmd[];
+extern int rc_allow_attachments;
extern int editor_pid;
}
-int read_message(long int num, char pagin) /* Read a message from the server */
- /* message number */
+int read_message(long int num, char pagin) /* Read a message from the server */
+ /* message number */
/* 0 = normal read, 1 = read with pagination, 2 = header */
{
char buf[256];
}
-int make_message(char *filename, char *recipient, int anon_type, int format_type, int mode)
+int make_message(char *filename, char *recipient, int anon_type, int format_type, int mode, char *boundary)
/* temporary file name */
/* NULL if it's not mail */
/* see MES_ types in header file */
printf("Hold message\n");
return(2);
}
+ if ((b=='f')&&(rc_allow_attachments==1)) {
+ printf("attach File\n");
+ if (strlen(boundary)==0) {
+ sprintf(boundary, "Citadel-Attachment-%ld.%d",
+ time(NULL), getpid() );
+ }
+ /* FIX FIX now you have to attach the file, stupid */
+ }
goto MECR2;
MEFIN: return(0);
{ /* */
char buf[300];
char cmd[256];
+ char boundary[256];
int a,b;
int need_recp = 0;
int mode;
}
/* now put together the message */
- a=make_message(temp,buf,b,0,c);
- if (a!=0)
- {
- return(2);
- }
+ strcpy(boundary, "");
+ if ( make_message(temp,buf,b,0,c,boundary) != 0 ) return(2);
/* and send it to the server */
- sprintf(cmd,"ENT0 1|%s|%d|%d",buf,b,mode);
+ sprintf(cmd,"ENT0 1|%s|%d|%d||%s|",buf,b,mode,boundary);
serv_puts(cmd);
serv_gets(cmd);
if (cmd[0]!='4') {
char buf[128];
int line,qstart,qend;
+ /* Unlink the second temp file as soon as it's opened, so it'll get
+ * deleted even if the program dies
+ */
qfile = fopen(temp2,"r");
+ unlink(temp2);
+
+ /* Display the quotable text with line numbers added */
line = 0;
fgets(buf,128,qfile);
while (fgets(buf,128,qfile)!=NULL) {
fprintf(tfile," \n");
fclose(qfile);
fclose(tfile);
- unlink(temp2);
chmod(temp,0666);
}