From 1d279c52db9956e156b828e782fdc51546efb714 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Wed, 13 Jun 2012 08:54:33 +0000
Subject: [PATCH] Fix bug reported by Deuce: when editing an existing message,
 don't convert tear lines (---) to non-tear lines (-+-).

---
 src/sbbs3/sbbsdefs.h   | 3 ++-
 src/sbbs3/writemsg.cpp | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/sbbs3/sbbsdefs.h b/src/sbbs3/sbbsdefs.h
index 6ba31ab897..d10399bf3f 100644
--- a/src/sbbs3/sbbsdefs.h
+++ b/src/sbbs3/sbbsdefs.h
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2012 Rob Swindell - http://www.synchro.net/copyright.html		*
  *																			*
  * This program is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU General Public License				*
@@ -723,6 +723,7 @@ typedef enum {						/* Values for xtrn_t.event				*/
 #define WM_QWKNET	(1<<7)		/* Writing QWK NetMail (25 char title)		*/
 #define WM_PRIVATE	(1<<8)		/* Private (for creating MSGINF file)		*/
 #define WM_SUBJ_RO	(1<<9)		/* Subject/title is read-only				*/
+#define WM_EDIT		(1<<10)		/* Editing existing message					*/
 								
 								/* Bits in the mode of loadposts()			*/
 #define LP_BYSELF	(1<<0)		/* Include messages sent by self			*/
diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp
index 37b54de4d3..1a13ce9ac1 100644
--- a/src/sbbs3/writemsg.cpp
+++ b/src/sbbs3/writemsg.cpp
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2012 Rob Swindell - http://www.synchro.net/copyright.html		*
  *																			*
  * This program is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU General Public License				*
@@ -133,7 +133,7 @@ int sbbs_t::process_edited_text(char* buf, FILE* stream, long mode, unsigned* li
 				break;
 			continue;
 		}
-		if(!(mode&(WM_EMAIL|WM_NETMAIL))
+		if(!(mode&(WM_EMAIL|WM_NETMAIL|WM_EDIT))
 			&& (!l || buf[l-1]==LF)
 			&& buf[l]=='-' && buf[l+1]=='-' && buf[l+2]=='-'
 			&& (buf[l+3]==' ' || buf[l+3]==TAB || buf[l+3]==CR))
@@ -1025,7 +1025,7 @@ bool sbbs_t::editfile(char *fname, bool msg)
 		rioctl(IOCM|PAUSE|ABORT);
 		if(external(cmdstr(cfg.xedit[useron.xedit-1]->rcmd,msgtmp,nulstr,NULL),mode,cfg.node_dir)!=0)
 			return false;
-		l=process_edited_file(msgtmp, path, /* mode: */0, &lines,maxlines);
+		l=process_edited_file(msgtmp, path, /* mode: */WM_EDIT, &lines,maxlines);
 		if(l>0) {
 			SAFEPRINTF4(str,"%s created or edited file: %s (%u bytes, %u lines)"
 				,useron.alias, path, l, lines);
@@ -1071,7 +1071,7 @@ bool sbbs_t::editfile(char *fname, bool msg)
 		free(buf);
 		return false; 
 	}
-	l=process_edited_text(buf,stream,/* mode: */0,&lines,maxlines);
+	l=process_edited_text(buf,stream,/* mode: */WM_EDIT,&lines,maxlines);
 	bprintf(text[SavedNBytes],l,lines);
 	fclose(stream);
 	free(buf);
-- 
GitLab