From 3c095ccd7c470f9fc832ac9a4d8ac6cdd77bf033 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Wed, 8 Dec 2004 03:55:15 +0000
Subject: [PATCH] Fix up some group assumptions and allow replying to
 netmail... Replying to local mail still doesn't work however.  :-(

---
 web/root/msgs/reply.ssjs   | 16 +++++++++++++---
 web/root/msgs/savemsg.ssjs |  6 ++++--
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/web/root/msgs/reply.ssjs b/web/root/msgs/reply.ssjs
index be9f5065d8..0daad14791 100644
--- a/web/root/msgs/reply.ssjs
+++ b/web/root/msgs/reply.ssjs
@@ -1,7 +1,5 @@
 load("html_inc/msgslib.ssjs");
 
-template.group=msg_area.grp[msg_area.sub[sub].grp_name];
-
 if(sub=='mail') {
 	template.sub=new Object;
 	template.sub.description="Personal E-Mail";
@@ -23,7 +21,19 @@ hdr=msgbase.get_msg_header(false,parseInt(http_request.query.reply_to));
 template.subject=hdr.subject;
 if(template.subject.search(/^re:\s+/i)==-1)
 	template.subject='Re: '+template.subject;
-template.from=hdr.from;
+if(sub=='mail') {
+	if(hdr.replyto_net_addr!=undefined && hdr.replyto_net_addr != '')
+		template.from=hdr.replyto_net_addr;
+	else {
+		if(hdr.from_net_addr != undefined && hdr.from_net_addr != '')
+			template.from=hdr.from_net_addr;
+		else
+			template.from=hdr.from;
+	}
+}
+else
+	template.from=hdr.from;
+
 template.number=hdr.number;
 
 template.body=msgbase.get_msg_body(false,parseInt(http_request.query.reply_to),true,true);
diff --git a/web/root/msgs/savemsg.ssjs b/web/root/msgs/savemsg.ssjs
index 95a82bc127..1ba44375a3 100644
--- a/web/root/msgs/savemsg.ssjs
+++ b/web/root/msgs/savemsg.ssjs
@@ -1,13 +1,15 @@
 load("html_inc/msgslib.ssjs");
 
-template.group=msg_area.grp[msg_area.sub[sub].grp_name];
-
 if(sub=='mail') {
+	template.group=new Object;
+	template.group.name="E-Mail";
+	template.group.description="E-Mail";
 	template.sub=new Object;
 	template.sub.description="Personal E-Mail";
 	template.sub.code="mail";
 }
 else {
+	template.group=msg_area.grp[msg_area.sub[sub].grp_name];
 	template.sub=msg_area.sub[sub];
 }
 
-- 
GitLab