From 7acd59313adc19911cfa2db30a8c9a345df444b8 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sat, 5 Dec 2020 16:56:01 -0800
Subject: [PATCH] New @-codes for current message thread info

- MSG_THREAD_ID
- MSG_THREAD_BACK
- MSG_THREAD_NEXT
- MSG_THREAD_FIRST

for John (JCBBS). Not sure what you're going to use these for, but there you have them. <shrug> :-)
---
 src/sbbs3/atcodes.cpp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/atcodes.cpp b/src/sbbs3/atcodes.cpp
index 971436da8b..ebdfd1d154 100644
--- a/src/sbbs3/atcodes.cpp
+++ b/src/sbbs3/atcodes.cpp
@@ -1821,7 +1821,22 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen, long* pmode, bool
 		return (current_msg != NULL && current_msg->user_voted == 1) ? text[PollAnswerChecked] : nulstr;
 	if(!strcmp(sp,"MSG_DOWNVOTED"))
 		return (current_msg != NULL && current_msg->user_voted == 2) ? text[PollAnswerChecked] : nulstr;
-
+	if(strcmp(sp, "MSG_THREAD_ID") == 0 && current_msg != NULL) {
+		safe_snprintf(str, maxlen, "%lu", (ulong)current_msg->hdr.thread_id);
+		return str;
+	}
+	if(strcmp(sp, "MSG_THREAD_BACK") == 0 && current_msg != NULL) {
+		safe_snprintf(str, maxlen, "%lu", (ulong)current_msg->hdr.thread_back);
+		return str;
+	}
+	if(strcmp(sp, "MSG_THREAD_NEXT") == 0 && current_msg != NULL) {
+		safe_snprintf(str, maxlen, "%lu", (ulong)current_msg->hdr.thread_next);
+		return str;
+	}
+	if(strcmp(sp, "MSG_THREAD_FIRST") == 0 && current_msg != NULL) {
+		safe_snprintf(str, maxlen, "%lu", (ulong)current_msg->hdr.thread_first);
+		return str;
+	}
 	if(!strcmp(sp,"SMB_AREA")) {
 		if(smb.subnum!=INVALID_SUB && smb.subnum<cfg.total_subs)
 			safe_snprintf(str,maxlen,"%s %s"
-- 
GitLab