From f7e4fd9104cb57c27f555400f1dae8234ad71ab4 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Tue, 28 Mar 2023 14:45:15 -0700
Subject: [PATCH] Use SMTP-routable Fido/QWK netmail addresses is From header
 fields

Use the Synchronet-supported FTN/QWKnet routable addressing in the from fields
of messages posted via those network types. Using the mailutil.js
fidoaddr_to_emailaddr() function that was apparently created for listserver.js
but then made unnecessary (and thus unused for several years).

I think this addresses the concerns from issue #487. Reading a message via
NTTP (using the Synchronet NNTP service) in Thunderbird, one can now reply
to sender via email and it "just works" so long as the sysop has configured
the network support for those net-types correctly and Thunderbird is
configured with the Synchronet mail server as its SMTP server to use for that
newsgroup folder. Whether the Synchronet mail server is configured to use
direct delivery or relay is not relevant (though mentioned in the issue
description).
---
 exec/nntpservice.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/exec/nntpservice.js b/exec/nntpservice.js
index a58fecce40..db300d3c6a 100644
--- a/exec/nntpservice.js
+++ b/exec/nntpservice.js
@@ -34,6 +34,7 @@ var tagline	=  format(" *  %s - %s - telnet://%s\r\n"
 
 load("sbbsdefs.js");
 load("newsutil.js");
+load("mailutil.js");
 
 var debug = false;
 var no_anonymous = false;
@@ -757,6 +758,18 @@ while(client.socket.is_connected && !quit) {
 					writeln(format("From: \"%s\" <%s>"
 						,hdr.from
 						,hdr.from_net_addr));
+				else if(hdr.from_net_type == NET_FIDO)
+					writeln(format("From: \"%s\" (%s) <%s>"
+						,hdr.from
+						,hdr.from_net_addr
+						,fidoaddr_to_emailaddr(hdr.from, hdr.from_net_addr)));
+				else if(hdr.from_net_type == NET_QWK)
+					writeln(format("From: \"%s\" (%s) <%s!%s@%s>"
+						,hdr.from
+						,hdr.from_net_addr
+						,hdr.from_net_addr
+						,hdr.from.replace(/ /g,".")
+						,system.inetaddr));
 				else
 					writeln(format("From: \"%s\" <%s@%s>"
 						,hdr.from
-- 
GitLab