Subject: Re: gemtext (was: So I made a thing: nncp-echomail)

From: Eugene Medvedev <[email-masked]>
Date: Wed, 15 Oct 2025 23:46:32 +0300

On Sat, 4 Oct 2025 at 19:58, Sergey Matveev <[email-masked]> wrote:

> Yeah, that should be fixed easily, as that information actually exists
> in packets/NNCP-utilities.

So I took a stab at this, patch enclosed.

Thoughts? I might have easily misunderstood something.

-- 
Eugene Medvedev
diff -r -u nncp-8.13.0/src/node.go nncp-8.13.0-patched/src/node.go
--- nncp-8.13.0/src/node.go	1981-01-01 03:00:00.000000000 +0300
+++ nncp-8.13.0-patched/src/node.go	2025-10-15 22:56:13.944830866 +0300
@@ -57,6 +57,7 @@
 	OnlineDeadline time.Duration
 	MaxOnlineTime  time.Duration
 	Calls          []*Call
+	Origin         *NodeId
 
 	Busy bool
 	sync.Mutex
diff -r -u nncp-8.13.0/src/toss.go nncp-8.13.0-patched/src/toss.go
--- nncp-8.13.0/src/toss.go	1981-01-01 03:00:00.000000000 +0300
+++ nncp-8.13.0-patched/src/toss.go	2025-10-15 23:06:32.799861865 +0300
@@ -185,10 +185,16 @@
 		}
 		if !opts.DryRun {
 			cmd := exec.Command(cmdline[0], append(cmdline[1:], args...)...)
+			origin := sender.Id.String()
+			if sender.Origin != nil {
+				origin = sender.Origin.String()
+			}
 			cmd.Env = append(
 				cmd.Env,
 				"NNCP_SELF="+ctx.Self.Id.String(),
 				"NNCP_SENDER="+sender.Id.String(),
+				"NNCP_PACKET="+pktName,
+				"NNCP_ORIGIN="+origin,
 				"NNCP_NICE="+strconv.Itoa(int(pkt.Nice)),
 			)
 			if pkt.Type == PktTypeExec {
@@ -903,6 +909,7 @@
 				Name:     area.Name,
 				Incoming: area.Incoming,
 				Exec:     area.Exec,
+				Origin:   pktEnc.Sender,
 			}
 			copy(areaNode.Id[:], area.Id[:])
 			pktName := fmt.Sprintf(