From 6b441def07a14d7102b21bfc6dd57f3eb2965c42 Mon Sep 17 00:00:00 2001
From: Michiel Broek <mbse@mbse.eu>
Date: Tue, 5 Mar 2002 21:32:52 +0000
Subject: [PATCH] Added support for external message editor

---
 ChangeLog          | 10 +++++
 lang/Language.xref | 12 +++---
 lang/dutch.txt     | 12 +++---
 lang/english.txt   | 12 +++---
 lang/galego.txt    | 12 +++---
 lang/german.txt    | 12 +++---
 lang/italian.txt   | 12 +++---
 lang/spanish.txt   | 12 +++---
 lib/structs.h      |  2 +-
 lib/users.h        |  8 ++--
 mbsebbs/Makefile   |  4 +-
 mbsebbs/change.c   | 58 +++++++++++++++++++++--------
 mbsebbs/dispfile.c | 10 ++++-
 mbsebbs/door.c     |  6 ++-
 mbsebbs/door.h     |  2 +-
 mbsebbs/mail.c     | 93 ++++++++++++++++++++++++++++++++++++++++++++--
 mbsebbs/mail.h     | 22 ++++++-----
 mbsebbs/menu.c     |  2 +-
 mbsebbs/newuser.c  |  2 +-
 mbsetup/ledit.c    | 45 ++++++++++++++++++++++
 mbsetup/ledit.h    |  3 ++
 mbsetup/m_global.c | 19 ++++++----
 mbsetup/m_menu.c   | 34 ++++++++++-------
 mbsetup/m_users.c  | 20 +++++++---
 24 files changed, 315 insertions(+), 109 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8f8c7ca2..7f518bfb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4596,6 +4596,7 @@ v0.33.20        10-Feb-2002
 		Updated German, Spanish and Galego languages.
 		The location of the sourcefiles is not important anymore.
 		Added detection of vpopmail in default installation path.
+		Changed language prompts 372, 373, 387, 388, 389 and 390.
 
 	common.a:
 		Added 2 functions to return the OS name and CPU family.
@@ -4615,6 +4616,9 @@ v0.33.20        10-Feb-2002
 		that area are moved to the new path.
 		It is now possible to move file areas.
 		It is now possible to move JAM message bases.
+		Added edit of external message editor in menu 1.4.
+		Added edit of NoPrompt setting in menus for doors.
+		Changed edit of message editor in user editor.
 
 	mbfido:
 		In AreaMgr and FileMgr changed aka matching for area 
@@ -4685,6 +4689,12 @@ v0.33.20        10-Feb-2002
 	mbsebbs:
 		On some systems the download taglists contained garbage after
 		the short filename causing wrong filenames at the users side.
+		Added support for external message editor written by Redy.
+		Doors are now passed the parameter to display a prompt after
+		the door or return silently.
+
+	mbnewusr:
+		New users have the default internal fullscreen editor.
 
 	mbuser:
 		If a new user has registered and not yet used the bbs, mbuser
diff --git a/lang/Language.xref b/lang/Language.xref
index 789cf798..211793f2 100644
--- a/lang/Language.xref
+++ b/lang/Language.xref
@@ -370,8 +370,8 @@
 369	file.c				YN|Are you Sure? [Y/n]: 
 370	change.c			|New Files check is now ON 
 371	change.c			|New Files check is now OFF
-372	change.c			|Fullscreen Editor is now ON
-373	change.c			|Fullscreen Editor is now OFF
+372	change.c			|Now using the
+373	change.c			123|Select: 1) Line editor, 2) Fullscreen editor, 3) External editor 
 374	offline.c			|No messages found to download!
 375	funcs4.c			|Press (Enter) to continue: 
 376	lineedit.c			|Center
@@ -385,10 +385,10 @@
 384	funcs4.c			|ie. John Doe, login = jdoe
 385	funcs4.c			|login > 
 386	funcs4.c			|That login name already exists, please choose another one.
-387					|
-388					|
-389					|
-390				        |
+387	change.c			|Line
+388	change.c			|Fullscreen
+389	change.c			|External
+390	change.c		        |Editor
 391	offline.c			|New    
 392	offline.c			|Local    
 393	offline.c			|Netmail  
diff --git a/lang/dutch.txt b/lang/dutch.txt
index 3f82c9c2..493cc2d7 100644
--- a/lang/dutch.txt
+++ b/lang/dutch.txt
@@ -370,8 +370,8 @@ SV|(S)chakel aktief, (V)erwijder alles, (ENTER) voor doorgaan:
 JN|Zeker weten? [J/n]: 
 |Tonen nieuwe Bestanden is nu AAN
 |Tonen nieuwe Bestanden is nu UIT
-|Schermgestuurde Tekstverwerker is nu AAN
-|Schermgestuurde Tekstverwerker is nu UIT
+|U gebruikt nu de
+123|Kies: 1) Regel editer, 2) Volle scherm editer, 3) Externe editer 
 |Geen berichten gevonden voor download!
 |Geef (Enter) voor doorgaan: 
 |Centreer
@@ -385,10 +385,10 @@ JN|Zeker weten? [J/n]:
 |bv. Piet Snot, login = psnot
 |login > 
 |Die login naam bestaat al, kies iets anders.
-|
-|
-|
-|
+|Regel
+|Volle scherm
+|Externe
+|Textverwerker
 |Nieuw  
 |Lokaal   
 |Netmail  
diff --git a/lang/english.txt b/lang/english.txt
index 78e6e81e..afcdd8b2 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -370,8 +370,8 @@ TE|(T)oggle active, (E)rase all, (ENTER) to continue:
 YN|Are you Sure? [Y/n]: 
 |New Files check is now ON
 |New Files check is now OFF
-|Fullscreen Editor is now ON
-|Fullscreen Editor is now OFF
+|Now using the
+123|Select: 1) Line editor, 2) Fullscreen editor, 3) External editor 
 |No messages found to download!
 |Press (Enter) to continue: 
 |Center
@@ -385,10 +385,10 @@ YN|Are you Sure? [Y/n]:
 |ie. John Doe, login = jdoe
 |login > 
 |That login name already exists, please choose another one.
-|
-|
-|
-|
+|Line
+|Fullscreen
+|External
+|Editor
 |New    
 |Local    
 |Netmail  
diff --git a/lang/galego.txt b/lang/galego.txt
index cb2f6f1f..4e85a38e 100644
--- a/lang/galego.txt
+++ b/lang/galego.txt
@@ -370,8 +370,8 @@ AT|(A)ctivar/desactivar, desactivar (T)odos, (ENTER) para seguir:
 SN|�Est�s seguro? [S/n]: 
 |Comprobar ficheiros novos ACTIVADO
 |Comprobar ficheios novos DESACTIVADO
-|Editor a pantalla completa ACTIVADO
-|Editor a pantalla completa DESACTIVADO
+|Now using the
+123|Select: 1) Line editor, 2) Fullscreen editor, 3) External editor 
 |�Non hai mensaxes! 
 |Pulsa (Enter) para seguir: 
 |Centrar
@@ -385,10 +385,10 @@ SN|
 |'Elena Nito del Bosque ' podes usar 'enitob', 'elenanb' ou 'enbosque'
 |login > 
 |Ese nome de LOGIN xa existe. Escolle outro...
-|
-|
-|
-|
+|Line
+|Fullscreen
+|External
+|Editor
 |New    
 |Local    
 |Netmail  
diff --git a/lang/german.txt b/lang/german.txt
index fe3bdf70..fc55f507 100644
--- a/lang/german.txt
+++ b/lang/german.txt
@@ -370,8 +370,8 @@ UA|Aufgelistete (U)mschalten, alle (A)bwaehlen, <ENTER> um fortzufahren:
 JN|Sind Sie sicher? [J/n]: 
 |Check auf neue Dateien ist jetzt AN
 |Check auf neue Dateien ist jetzt AUS
-|Vollbild-Editor ist jetzt AN
-|Vollbild-Editor ist jetzt AUS
+|Now using the
+123|Select: 1) Line editor, 2) Fullscreen editor, 3) External editor 
 |Es liegen keine Mitteilungen zum Herunterladen vor!
 |Weiter mit <Enter> ... 
 |Zentrieren
@@ -385,10 +385,10 @@ JN|Sind Sie sicher? [J/n]:
 |Beispiel:  "Gerhard Schroeder",  login = gschroed
 |Ihr gewuenschter Anmeldename: 
 |Dieser Anmeldename existiert bereits, bitte waehlen Sie einen anderen.
-|
-|
-|
-|
+|Line
+|Fullscreen
+|External
+|Editor
 |Neu    
 |Local    
 |Netmail  
diff --git a/lang/italian.txt b/lang/italian.txt
index 708bf6e3..aac67188 100644
--- a/lang/italian.txt
+++ b/lang/italian.txt
@@ -370,8 +370,8 @@ CE|(C)ambia aree attive, (E)limina tutto, (INVIO) per continuare:
 SN|Sei sicuro? [S/n]: 
 |Controllo per i nuovi file ATTIVATO
 |Controllo per i nuovi file DISATTIVATO
-|Editor a schermo pieno ATTIVATO
-|Editor a schermo pieno DISATTIVATO
+|Now using the
+123|Select: 1) Line editor, 2) Fullscreen editor, 3) External editor 
 |Nessun messaggio da scaricare trovato!
 |Premi (Invio) per continuare: 
 |Centra
@@ -385,10 +385,10 @@ SN|Sei sicuro? [S/n]:
 |es. Mario Rossi, login = mrossi
 |login > 
 |Quel login esiste gia', scegline uno leggermente diverso.
-|
-|
-|
-|
+|Line
+|Fullscreen
+|External
+|Editor
 |Nuovo    
 |Locale    
 |Netmail  
diff --git a/lang/spanish.txt b/lang/spanish.txt
index 5f187c68..501610d8 100644
--- a/lang/spanish.txt
+++ b/lang/spanish.txt
@@ -370,8 +370,8 @@ AT|(A)ctivar/desactivar, desactivar (T)odos, (ENTER) para seguir:
 SN|�Est�s seguro? [S/n]: 
 |Comprobar ficheros nuevos ACTIVADO
 |Comprobar ficheros nuevos DESACTIVADO
-|Editor a pantalla completa ACTIVADO
-|Editor a pantalla completa DESACTIVADO
+|Now using the
+123|Select: 1) Line editor, 2) Fullscreen editor, 3) External editor 
 |�No hay mensajes! 
 |Pulsa (Enter) para seguir: 
 |Centrar
@@ -385,10 +385,10 @@ SN|
 |'Elena Nito del Bosque ' puedes usar 'enitob', 'elenanb' o 'enbosque'
 |login > 
 |Ese nombre de LOGIN ya existe. Elije otro...
-|
-|
-|
-|
+|Line
+|Fullscreen
+|External
+|Editor
 |New    
 |Local    
 |Netmail  
diff --git a/lib/structs.h b/lib/structs.h
index 0d917c5e..a5ce49c8 100644
--- a/lib/structs.h
+++ b/lib/structs.h
@@ -523,7 +523,7 @@ struct	sysconfig {
 	char		inbound[65];		/* Inbound directory	    */
 	char		pinbound[65];		/* Protected inbound	    */
 	char		outbound[65];		/* Outbound		    */
-	char		xsequencer[65];
+	char		externaleditor[65];	/* External mail editor	    */
 	char		dospath[65];		/* DOS path		    */
 	char		uxpath[65];		/* Unix path		    */
 
diff --git a/lib/users.h b/lib/users.h
index 3a6e95b3..7e662137 100644
--- a/lib/users.h
+++ b/lib/users.h
@@ -36,6 +36,8 @@
 #define Max_passlen     14      /* Define maximum passwd length            */
 
 
+typedef enum {LINEEDIT, FSEDIT, EXTEDIT} MSGEDITOR;
+
 
 /************************************************************************
  *
@@ -78,7 +80,7 @@ struct	userhdr {
 struct	userrec {
 	char		sUserName[36];		/* User First and Last Name */
 	char		Name[9];		/* Unix name		    */
-	unsigned long	xPassword;		/* Users Password (CRC)     */
+	unsigned long	xPassword;
 	char		sVoicePhone[20];	/* Voice Number             */
 	char		sDataPhone[20];		/* Data/Business Number     */
 	char		sLocation[28];		/* Users Location           */
@@ -102,7 +104,7 @@ struct	userrec {
 	unsigned	DoNotDisturb	: 1;	/* DoNot disturb	    */
 	unsigned	Cls		: 1;	/* CLS on/off		    */
 	unsigned	More		: 1;	/* More prompt		    */
-	unsigned	FsMsged		: 1;	/* Fullscreen editor	    */
+	unsigned	xFsMsged	: 1;
 	unsigned	MailScan	: 1;	/* New Mail scan	    */
 	unsigned	Guest		: 1;	/* Is guest account	    */
 	unsigned	OL_ExtInfo	: 1;	/* OLR extended msg info    */
@@ -115,7 +117,7 @@ struct	userrec {
 	unsigned	xHangUps;
 	long		Credit;			/* Users credit		    */
 	int		Paged;			/* Times paged today	    */
-	int		xOfflineFmt;
+	int		MsgEditor;		/* Message Editor to use    */
 	int		LastPktNum;		/* Todays Last packet number*/
 	char		Archiver[6];		/* Archiver to use	    */
 
diff --git a/mbsebbs/Makefile b/mbsebbs/Makefile
index 44febaa3..28548b57 100644
--- a/mbsebbs/Makefile
+++ b/mbsebbs/Makefile
@@ -30,7 +30,7 @@ MBSEBBS_OBJS	= bank.o bbslist.o chat.o file.o funcs.o mail.o menu.o \
 MBSEBBS_LIBS	= ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a \
 		  ../lib/libdbase.a ../lib/libmbinet.a
 MBNEWUSR_OBJS	= mbnewusr.o newuser.o language.o timeout.o dispfile.o oneline.o \
-		  timecheck.o input.o exitinfo.o funcs.o misc.o change.o \
+		  timecheck.o input.o exitinfo.o funcs.o misc.o change.o door.o \
 		  filesub.o mail.o email.o msgutil.o pop3.o lineedit.o fsedit.o whoson.o
 MBNEWUSR_LIBS	= ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a \
 		  ../lib/libdbase.a ../lib/libmbinet.a
@@ -150,7 +150,7 @@ mbuser.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/
 page.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h
 bye.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h dispfile.h misc.h language.h bye.h
 funcs.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h
-mail.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h whoson.h
+mail.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h
 newuser.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h
 pinfo.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h pinfo.h input.h
 timecheck.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h timecheck.h funcs.h bye.h exitinfo.h language.h input.h
diff --git a/mbsebbs/change.c b/mbsebbs/change.c
index bde64a4e..5d5c8338 100644
--- a/mbsebbs/change.c
+++ b/mbsebbs/change.c
@@ -392,27 +392,53 @@ void Chg_FileCheck()
 
 
 /*
- * Toggle Fullscreen Editor
+ * Choose Message Editor
  */
 void Chg_FsMsged()
 {
-	ReadExitinfo();
-	Enter(2);
+    int	    z;
 
-	if (exitinfo.FsMsged) {
-		exitinfo.FsMsged = FALSE;
-		/* Fullscreen Editor is now OFF */
-		pout(10, 0, (char *) Language(373));
-	} else {
-		exitinfo.FsMsged = TRUE;
-		/* Fullscreen Editor is now ON */
-		pout(10, 0, (char *) Language(372));
-	}
+    ReadExitinfo();
+    Enter(2);
 
-	Enter(2);
-	sleep(2);
-	Syslog('+', "Fullscreen Editor changed to %s", exitinfo.FsMsged ?"True":"False");
-	WriteExitinfo();
+    /*                               Now using the */
+    pout(LIGHTMAGENTA, BLACK, (char *)Language(372));
+    /*                 Line/Fullscreen/External    */
+    colour(LIGHTCYAN, BLACK);
+    printf(" %s ", Language(387 + (exitinfo.MsgEditor & 3)));
+    /*                                      Editor */
+    pout(LIGHTMAGENTA, BLACK, (char *)Language(390));
+    Enter(1);
+
+    pout(WHITE, BLACK, (char *)Language(373));
+    fflush(stdout);
+    alarm_on();
+    z = toupper(Getone());
+
+    if (z == Keystroke(373, 0)) {
+	exitinfo.MsgEditor = LINEEDIT;
+	Syslog('+', "User selected line editor");
+    } else if (z == Keystroke(373, 1)) {
+	exitinfo.MsgEditor = FSEDIT;
+	Syslog('+', "User selected fullscreen editor");
+    } else if (z == Keystroke(373, 2)) {
+	exitinfo.MsgEditor = EXTEDIT;
+	Syslog('+', "User selected external editor");
+    }
+
+    Enter(2);
+
+    /*                               Now using the */
+    pout(LIGHTMAGENTA, BLACK, (char *)Language(372));
+    /*                 Line/Fullscreen/External    */
+    colour(LIGHTCYAN, BLACK);
+    printf(" %s ", Language(387 + (exitinfo.MsgEditor & 3)));
+    /*                                      Editor */
+    pout(LIGHTMAGENTA, BLACK, (char *)Language(390));
+
+    Enter(2);
+    sleep(2);
+    WriteExitinfo();
 }
 
 
diff --git a/mbsebbs/dispfile.c b/mbsebbs/dispfile.c
index 1f148c97..6ae99d02 100644
--- a/mbsebbs/dispfile.c
+++ b/mbsebbs/dispfile.c
@@ -391,7 +391,15 @@ void ControlCodeU(int ch)
 		break;
 
 	case '3':
-		printf("%s", exitinfo.FsMsged ? (char *) Language(147) : (char *) Language(148));
+		switch(exitinfo.MsgEditor) {
+		    case LINEEDIT:  printf(Language(387));
+				    break;
+		    case FSEDIT:    printf(Language(388));
+				    break;
+		    case EXTEDIT:   printf(Language(389));
+				    break;
+		    default:	    printf("?");
+		}	    
 		break;
 
 	case '4':
diff --git a/mbsebbs/door.c b/mbsebbs/door.c
index f7bab9d0..0f893316 100644
--- a/mbsebbs/door.c
+++ b/mbsebbs/door.c
@@ -95,7 +95,7 @@ char *Rdate(char *ind, int Y2K)
 /*
  * Function will run a external program or door
  */
-void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSuid)
+void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSuid, int NoPrompt)
 {
 	char	*String, *String1;
 	int	i, rc;
@@ -232,7 +232,9 @@ void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSu
 
 	free(temp1);
 	printf("\n\n");
-	Pause();
+
+	if (!NoPrompt)
+	    Pause();
 }
 
 
diff --git a/mbsebbs/door.h b/mbsebbs/door.h
index 6b7047cd..c844d7f0 100644
--- a/mbsebbs/door.h
+++ b/mbsebbs/door.h
@@ -3,7 +3,7 @@
 #ifndef _DOOR_H
 #define _DOOR_H
 
-void ExtDoor(char *, int, int, int, int);   /* Run external door		*/
+void ExtDoor(char *, int, int, int, int, int);   /* Run external door		*/
 int  exec_nosuid(char *);		    /* Execute as real user		*/
 
 #endif
diff --git a/mbsebbs/mail.c b/mbsebbs/mail.c
index dcd88baf..4577a5eb 100644
--- a/mbsebbs/mail.c
+++ b/mbsebbs/mail.c
@@ -58,6 +58,7 @@
 #include "msgutil.h"
 #include "pop3.h"
 #include "email.h"
+#include "door.h"
 #include "whoson.h"
 
 
@@ -375,10 +376,12 @@ void SysopComment(char *Cmt)
  */
 int Edit_Msg()
 {
-	if (exitinfo.FsMsged)
-		return Fs_Edit();
-	else
-		return Line_Edit();
+    switch (exitinfo.MsgEditor) {
+	case LINEEDIT:	return Line_Edit();
+	case FSEDIT:	return Fs_Edit();
+	case EXTEDIT:	return Ext_Edit();
+    }
+    return 0;
 }
 
 
@@ -2218,3 +2221,85 @@ void SetMsgArea(unsigned long AreaNum)
 }
 
 
+
+/*
+ * External Message Editor
+ */
+int Ext_Edit()
+{
+    int     changed;
+    int     j, i;
+    char    *l, *tmpname;
+    FILE    *fd;
+    struct stat     st1,st2;
+
+    changed=FALSE;
+
+    tmpname = calloc(PATH_MAX, sizeof(char));
+
+    sprintf(tmpname, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, "data.msg");
+    if ((fd = fopen(tmpname, "w")) == NULL) {
+	Syslog('+',"EXT_EDIT: Unable to open %s for writing", tmpname);
+    } else {
+	fprintf(fd,"AREA='%s'\n",sMsgAreaDesc);
+	fprintf(fd,"AREANUM='%d'\n",iMsgAreaNumber+1);
+	fprintf(fd,"AREATYPE='%d'\n",iMsgAreaType);
+	fprintf(fd,"MSGFROM='%s'\n",Msg.From);
+	fprintf(fd,"MSGTO='%s'\n",Msg.To);
+	fprintf(fd,"MSGTOADDR='%s'\n",Msg.ToAddress);
+	fprintf(fd,"MSGSUBJECT='%s'\n",Msg.Subject);
+	fprintf(fd,"BBSLANGUAGE='%c'\n",exitinfo.iLanguage);
+	fprintf(fd,"BBSFSEDKEYS='%d'\n",exitinfo.FSemacs);
+	fclose(fd);
+    }
+
+    sprintf(tmpname, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, "edit.msg");
+    if ((fd = fopen(tmpname, "w")) == NULL) {
+	Syslog('+',"EXT_EDIT: Unable to open %s for writing", tmpname);
+    } else {
+	for (i = 1; i <= Line; i++) {
+	    fprintf(fd,"%s\n",Message[i]);
+	}
+	fclose(fd);
+	stat( tmpname, &st1 );
+	ExtDoor(CFG.externaleditor,FALSE,TRUE,TRUE,FALSE,TRUE);
+	stat( tmpname, &st2 );
+    }
+    
+    if ( st1.st_mtime != st2.st_mtime ) {
+	l = calloc(81, sizeof(char));
+	if ((fd = fopen(tmpname, "r")) == NULL) {
+	    Syslog('+',"EXT_EDIT: Unable to open %s for reading", tmpname);
+	} else {
+	    i=1;
+	    while ( (fgets(l,80,fd) != NULL) && (i < TEXTBUFSIZE ) ) {
+		for (j = 0; i < strlen(l); j++) {
+		    if (*(l + j) == '\0')
+			break;
+		    if (*(l + j) == '\n')
+			*(l + j) = '\0';
+		    if (*(l + j) == '\r')
+			*(l + j) = '\0';
+		    /*
+		     * Make sure that any tear or origin lines are
+		     * made invalid.
+		     */
+		    if (strncmp(l, (char *)"--- ", 4) == 0)
+			l[1] = 'v';
+		    if (strncmp(l, (char *)" * Origin:", 10) == 0)
+			l[1] = '+';
+		}
+		sprintf(Message[i],"%s",l);
+		i++;
+	    }
+	    changed=TRUE;
+	    Line=i;
+	    fclose(fd);
+	}
+	free(l);
+    }
+    free(tmpname);
+    return changed;
+}
+
+
diff --git a/mbsebbs/mail.h b/mbsebbs/mail.h
index cdd79b58..692280db 100644
--- a/mbsebbs/mail.h
+++ b/mbsebbs/mail.h
@@ -1,20 +1,24 @@
+/* $Id$ */
+
 #ifndef _MAIL_H
 #define _MAIL_H
 
 #define	TEXTBUFSIZE	500
 
+
 int  LC(int);				/* More prompt for reading messages */
 int  Edit_Msg(void);                    /* Edit a message                   */
+int  Ext_Edit(void);			/* External Message editor	    */
 int  CheckLine(int, int, int);		/* Check linecounter for read       */
-void SysopComment(char *);		/* Comment to Sysop		   */
-void Post_Msg(void);			/* Post a message		   */
-void Read_Msgs(void);			/* Read Messages		   */
-void QuickScan_Msgs(void);		/* List Message Headers		   */
-void Delete_Msg(void);			/* Delete a specified message	   */
-void MsgArea_List(char *);		/* Select message area		   */
-void CheckMail(void);			/* Check for new mail		   */
-void MailStatus(void);			/* Mail status in areas		   */
-void SetMsgArea(unsigned long);		/* Set message area and variables  */
+void SysopComment(char *);		/* Comment to Sysop		    */
+void Post_Msg(void);			/* Post a message		    */
+void Read_Msgs(void);			/* Read Messages		    */
+void QuickScan_Msgs(void);		/* List Message Headers		    */
+void Delete_Msg(void);			/* Delete a specified message	    */
+void MsgArea_List(char *);		/* Select message area		    */
+void CheckMail(void);			/* Check for new mail		    */
+void MailStatus(void);			/* Mail status in areas		    */
+void SetMsgArea(unsigned long);		/* Set message area and variables   */
 
 
 #endif
diff --git a/mbsebbs/menu.c b/mbsebbs/menu.c
index 3603c422..dc4ab6b7 100644
--- a/mbsebbs/menu.c
+++ b/mbsebbs/menu.c
@@ -334,7 +334,7 @@ void DoMenu(int Type)
 
 	case 7:
 		/* Run external program */
-		ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport, menus.NoSuid);
+		ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport, menus.NoSuid, menus.NoPrompt);
 		break;
 
 	case 8:
diff --git a/mbsebbs/newuser.c b/mbsebbs/newuser.c
index ab0d03f4..0c9e93db 100644
--- a/mbsebbs/newuser.c
+++ b/mbsebbs/newuser.c
@@ -103,7 +103,7 @@ int newuser()
 	FullName = calloc(81, sizeof(char));
 
 	usrconfig.iLanguage = iLang;
-	usrconfig.FsMsged = TRUE;
+	usrconfig.MsgEditor = FSEDIT;
 
 	do {
 
diff --git a/mbsetup/ledit.c b/mbsetup/ledit.c
index 7c57d60c..02c1dc9d 100644
--- a/mbsetup/ledit.c
+++ b/mbsetup/ledit.c
@@ -1537,6 +1537,51 @@ int edit_newsmode(int y, int x, int val)
 
 
 
+char *getmsgeditor(int val)
+{
+    switch (val) {
+	case LINEEDIT:	return (char *)"Line";
+	case FSEDIT:	return (char *)"FS. ";
+	case EXTEDIT:	return (char *)"Ext.";
+	default:	return NULL;
+    }
+}
+
+
+
+void show_msgeditor(int y, int x, int val)
+{
+    mvprintw(y, x, getmsgeditor(val));
+}
+
+
+
+int edit_msgeditor(int y, int x, int val)
+{
+    int	ch;
+
+    showhelp((char *)"Toggle ^Message editor^ with spacebar, press <Enter> whene done");
+
+    do {
+	set_color(YELLOW, BLUE);
+	show_msgeditor(y, x, val);
+	ch = readkey(y, x, YELLOW, BLUE);
+
+	if (ch == ' ') {
+	    if (val < EXTEDIT)
+		val++;
+	    else
+		val = LINEEDIT;
+	}
+    } while ((ch != KEY_ENTER) && (ch != '\012'));
+
+    set_color(WHITE, BLACK);
+    show_msgeditor(y, x, val);
+    return val;
+}
+
+
+
 void show_magictype(int y, int x, int val)
 {
 	mvprintw(y, x, getmagictype(val));
diff --git a/mbsetup/ledit.h b/mbsetup/ledit.h
index 891c8f6d..6fd916ef 100644
--- a/mbsetup/ledit.h
+++ b/mbsetup/ledit.h
@@ -55,6 +55,9 @@ int		edit_service(int, int, int);
 char            *getnewsmode(int);
 void            show_newsmode(int, int, int);
 int             edit_newsmode(int, int, int);
+char		*getmsgeditor(int);
+void		show_msgeditor(int, int, int);
+int		edit_msgeditor(int, int, int);
 char		*getlinetype(int);
 void		show_linetype(int, int, int);
 int 		edit_linetype(int, int, int);
diff --git a/mbsetup/m_global.c b/mbsetup/m_global.c
index 48e44299..25c240c0 100644
--- a/mbsetup/m_global.c
+++ b/mbsetup/m_global.c
@@ -226,6 +226,7 @@ void e_global2(void)
         mvprintw( 9, 2, "4.  LeaveCase");
 	mvprintw(10, 2, "5.  Ftp base");
 	mvprintw(11, 2, "6.  Arealists");
+	mvprintw(12, 2, "7.  Ext. edit");
 
         for (;;) {
                 set_color(WHITE, BLACK);
@@ -235,15 +236,17 @@ void e_global2(void)
                 show_bool(9,16,    CFG.leavecase);
 		show_str(10,16,64, CFG.ftp_base);
 		show_str(11,16,64, CFG.alists_path);
+		show_str(12,16,64, CFG.externaleditor);
 
-                switch(select_menu(6)) {
+                switch(select_menu(7)) {
                 case 0: return;
-                case 1: E_PTH(16,16,64, CFG.req_magic,    "The path to the ^magic filerequest^ files.")
-                case 2: E_STR(17,16,64, CFG.dospath,      "The translated ^DOS^ drive and path, empty disables translation")
-                case 3: E_PTH(18,16,64, CFG.uxpath,       "The translated ^Unix^ path.")
-                case 4: E_BOOL(19,16,   CFG.leavecase,    "^Leave^ outbound flo filenames as is, ^No^ forces uppercase.")
-		case 5: E_PTH(10,16,64, CFG.ftp_base,     "The ^FTP home^ directory to strip of the real directory")
-		case 6: E_PTH(11,16,64, CFG.alists_path,  "The path where ^area lists^ and ^filebone lists^ are stored.")
+                case 1: E_PTH(16,16,64, CFG.req_magic,      "The path to the ^magic filerequest^ files.")
+                case 2: E_STR(17,16,64, CFG.dospath,        "The translated ^DOS^ drive and path, empty disables translation")
+                case 3: E_PTH(18,16,64, CFG.uxpath,         "The translated ^Unix^ path.")
+                case 4: E_BOOL(19,16,   CFG.leavecase,      "^Leave^ outbound flo filenames as is, ^No^ forces uppercase.")
+		case 5: E_PTH(10,16,64, CFG.ftp_base,       "The ^FTP home^ directory to strip of the real directory")
+		case 6: E_PTH(11,16,64, CFG.alists_path,    "The path where ^area lists^ and ^filebone lists^ are stored.")
+		case 7: E_STR(12,16,64, CFG.externaleditor, "The full path and filename to the ^external message editor^")
                 }
         };
 }
@@ -1528,7 +1531,6 @@ void global_menu(void)
 		 */
 		Syslog('+', "Main config, clearing unused fields");
 		memset(&CFG.alists_path, 0, sizeof(CFG.alists_path));
-		memset(&CFG.xsequencer, 0, sizeof(CFG.xsequencer));
 		CFG.xmax_login = 0;
 		CFG.xUseSysDomain = FALSE;
 		CFG.xChkMail = FALSE;
@@ -1777,6 +1779,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
 	fprintf(fp, "      Leave case as is %s\n", getboolean(CFG.leavecase));
 	fprintf(fp, "      FTP base path    %s\n", CFG.ftp_base);
 	fprintf(fp, "      Area lists       %s\n", CFG.alists_path);
+	fprintf(fp, "      External editor  %s\n", CFG.externaleditor);
 
 	page = newpage(fp, page);
 	addtoc(fp, toc, 1, 6, page, (char *)"Global settings");
diff --git a/mbsetup/m_menu.c b/mbsetup/m_menu.c
index 9064b31b..eee642d9 100644
--- a/mbsetup/m_menu.c
+++ b/mbsetup/m_menu.c
@@ -113,10 +113,11 @@ void Show_A_Menu(void)
 	mvprintw(18, 2, "11. Hi-colors");
 	mvprintw(19, 2, "12. Autoexec");
 	if (menus.MenuType == 7) {
-		mvprintw(16,42, "13. No door.sys");
-		mvprintw(17,42, "14. Y2K style");
-		mvprintw(18,42, "15. Use Comport");
-		mvprintw(19,42, "16. Run nosuid");
+		mvprintw(15,42, "13. No door.sys");
+		mvprintw(16,42, "14. Y2K style");
+		mvprintw(17,42, "15. Use Comport");
+		mvprintw(18,42, "16. Run nosuid");
+		mvprintw(19,42, "17. No Prompt");
 	}
 
 	set_color(WHITE, BLACK);
@@ -138,10 +139,11 @@ void Show_A_Menu(void)
 	set_color(WHITE, BLACK);
 	show_bool(19,16,   menus.AutoExec);
 	if (menus.MenuType == 7) {
-		show_bool(16,58,  menus.NoDoorsys);
-		show_bool(17,58,  menus.Y2Kdoorsys);
-		show_bool(18,58,  menus.Comport);
-		show_bool(19,58,  menus.NoSuid);
+		show_bool(15,58,  menus.NoDoorsys);
+		show_bool(16,58,  menus.Y2Kdoorsys);
+		show_bool(17,58,  menus.Comport);
+		show_bool(18,58,  menus.NoSuid);
+		show_bool(19,58,  menus.NoPrompt);
 	}
 }
 
@@ -214,7 +216,7 @@ void Edit_A_Menu(void)
 	Show_A_Menu();
 
 	for (;;) {
-		switch(select_menu(16)) {
+		switch(select_menu(17)) {
 		case 0: return;
 			break;
 		case 1:	E_UPS( 7,16, 1, menus.MenuKey,   "The ^key^ to select this menu item")
@@ -249,19 +251,23 @@ void Edit_A_Menu(void)
 			break;
 		case 12:E_BOOL(19,16,   menus.AutoExec,     "Is this an ^Autoexecute^ menu item")
 		case 13:if (menus.MenuType == 7) {
-				E_BOOL(16,58,   menus.NoDoorsys,    "Suppress writing ^door.sys^ dropfile")
+				E_BOOL(15,58,   menus.NoDoorsys,    "Suppress writing ^door.sys^ dropfile")
 			} else
 				break;
 		case 14:if (menus.MenuType == 7) {
-				E_BOOL(17,58,   menus.Y2Kdoorsys,   "Create ^door.sys^ with 4 digit yearnumbers")
+				E_BOOL(16,58,   menus.Y2Kdoorsys,   "Create ^door.sys^ with 4 digit yearnumbers")
 			} else
 				break;
 		case 15:if (menus.MenuType == 7) {
-				E_BOOL(18,58,   menus.Comport,      "Write real ^COM port^ in door.sys for Vmodem patch")
+				E_BOOL(17,58,   menus.Comport,      "Write real ^COM port^ in door.sys for Vmodem patch")
 			} else
 				break;
 		case 16:if (menus.MenuType == 7) {
-				E_BOOL(19,58,   menus.NoSuid,       "Run the door as ^real user (nosuid)^")
+				E_BOOL(18,58,   menus.NoSuid,       "Run the door as ^real user (nosuid)^")
+			} else
+				break;
+		case 17:if (menus.MenuType == 7) {
+				E_BOOL(19,58,   menus.NoPrompt,     "^Don't display prompt^ when door is finished")
 			} else
 				break;
 		}
@@ -594,6 +600,8 @@ int bbs_menu_doc(FILE *fp, FILE *toc, int page)
 								fprintf(fp, "    No door.sys   %s\n", getboolean(menus.NoDoorsys));
 								fprintf(fp, "    Y2K door.sys  %s\n", getboolean(menus.Y2Kdoorsys));
 								fprintf(fp, "    Use COM port  %s\n", getboolean(menus.Comport));
+								fprintf(fp, "    No setuid     %s\n", getboolean(menus.NoSuid));
+								fprintf(fp, "    No Prompt     %s\n", getboolean(menus.NoPrompt));
 							}
 							fprintf(fp, "\n\n");
 							j++;
diff --git a/mbsetup/m_users.c b/mbsetup/m_users.c
index 21151a91..e204c0fc 100644
--- a/mbsetup/m_users.c
+++ b/mbsetup/m_users.c
@@ -124,8 +124,17 @@ int OpenUsers(void)
 			 */
 			memset(&usrconfig, 0, sizeof(usrconfig));
 			while (fread(&usrconfig, oldsize, 1, fin) == 1) {
-				fwrite(&usrconfig, sizeof(usrconfig), 1, fout);
-				memset(&usrconfig, 0, sizeof(usrconfig));
+			    /*
+			     * In version 0.33.20 the message editor has 3 choices,
+			     * adjust settings.
+			     */
+			    if (usrconfig.xFsMsged && (usrconfig.MsgEditor == LINEEDIT)) {
+				usrconfig.MsgEditor = FSEDIT;
+				UsrUpdated = 1;
+				Syslog('+', "Adjusted editor setting for user %s", usrconfig.sUserName);
+			    }
+			    fwrite(&usrconfig, sizeof(usrconfig), 1, fout);
+			    memset(&usrconfig, 0, sizeof(usrconfig));
 			}
 
 			fclose(fin);
@@ -295,7 +304,7 @@ void Screen2(void)
 	mvprintw(10,63, "18. Silent");
 	mvprintw(11,63, "19. CLS");
 	mvprintw(12,63, "20. More");
-	mvprintw(13,63, "21. Fs Edit");
+	mvprintw(13,63, "21. Editor");
 	mvprintw(14,63, "22. MailScan");
 	mvprintw(15,63, "23. ShowNews");
 	mvprintw(16,63, "24. NewFiles");
@@ -331,7 +340,7 @@ void Fields2(void)
 	show_bool(10,76,   usrconfig.DoNotDisturb);
 	show_bool(11,76,   usrconfig.Cls);
 	show_bool(12,76,   usrconfig.More);
-	show_bool(13,76,   usrconfig.FsMsged);
+	show_msgeditor(13,76, usrconfig.MsgEditor);
 	show_bool(14,76,   usrconfig.MailScan);
 	show_bool(15,76,   usrconfig.ieNEWS);
 	show_bool(16,76,   usrconfig.ieFILE);
@@ -408,7 +417,8 @@ int EditUsrRec2(void)
                 case 18:E_BOOL(10,76,usrconfig.DoNotDisturb, "User will not be ^disturbed^")
                 case 19:E_BOOL(11,76,usrconfig.Cls,          "Send ^ClearScreen code^ to users terminal")
                 case 20:E_BOOL(12,76,usrconfig.More,         "User uses the ^More prompt^")
-                case 21:E_BOOL(13,76,usrconfig.FsMsged,      "User uses the ^Fullscreen editor^")
+                case 21:usrconfig.MsgEditor = edit_msgeditor(13,76,usrconfig.MsgEditor);
+			break;
                 case 22:E_BOOL(14,76,usrconfig.MailScan,     "Don't check for ^new mail^")
                 case 23:E_BOOL(15,76,usrconfig.ieNEWS,       "Show ^News Bulletins^ when logging in")
                 case 24:E_BOOL(16,76,usrconfig.ieFILE,       "Show ^New Files^ when logging in")