From ae3253085e11eb788b9acbcd9bbd1d8083f63433 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Wed, 23 Oct 2024 10:57:25 -0700
Subject: [PATCH] Don't use user's default download protocol for msg
 attachments

Fix issue #801
---
 src/sbbs3/getmsg.cpp | 4 ++--
 src/sbbs3/sbbs.h     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/sbbs3/getmsg.cpp b/src/sbbs3/getmsg.cpp
index 063c20d84f..61c488124e 100644
--- a/src/sbbs3/getmsg.cpp
+++ b/src/sbbs3/getmsg.cpp
@@ -357,7 +357,7 @@ bool sbbs_t::show_msg(smb_t* smb, smbmsg_t* msg, int p_mode, post_t* post)
 	return true;
 }
 
-void sbbs_t::download_msg_attachments(smb_t* smb, smbmsg_t* msg, bool del)
+void sbbs_t::download_msg_attachments(smb_t* smb, smbmsg_t* msg, bool del, bool use_default_prot)
 {
 	char str[256];
 	char fpath[MAX_PATH+1];
@@ -383,7 +383,7 @@ void sbbs_t::download_msg_attachments(smb_t* smb, smbmsg_t* msg, bool del)
 					if(!result)
 						errormsg(WHERE, ERR_WRITE, fpath, filelen);
 					else
-						sendfile(fpath, useron.prot, "attachment");
+						sendfile(fpath, use_default_prot ? useron.prot : 0, "attachment");
 				}
 			}
 		} else
diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h
index 8fcbedbeb2..5765a67959 100644
--- a/src/sbbs3/sbbs.h
+++ b/src/sbbs3/sbbs.h
@@ -900,7 +900,7 @@ public:
 	uint	getlastmsg(int subnum, uint32_t *ptr, time_t *t);
 	time_t	getmsgtime(int subnum, uint ptr);
 	int		getmsgnum(int subnum, time_t t);
-	void	download_msg_attachments(smb_t*, smbmsg_t*, bool del);
+	void	download_msg_attachments(smb_t*, smbmsg_t*, bool del, bool use_default_prot = false);
 
 	/* readmail.cpp */
 	int		readmail(uint usernumber, int which, int lm_mode = 0);
-- 
GitLab