From 7c17c5f2a8a94aad2df4ac2f97fc3af5cfc94e57 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sun, 13 Nov 2016 21:29:57 +0000
Subject: [PATCH] Replaced text.dat line MsgVoteNotice with 2 new strings:
 MsgUpVoteNotice and MsgDownVoteNotice. Also moved the R_Voting string, so the
 last few voting related strings in the text.dat have been re-arranged (sorry
 about the thrash) - if you don't have these new 8 lines, the default strings
 are used and you're fine. When listing messages from the "Reading" prompt,
 the vote status and Replied attribute flag are now indicated: 'V' = voted up
 (more than down), 'v' = voted down (more than up), and 'R' = replied-to.
 Unread/new messages still show a '*' in the A (for attributes) column. Voting
 via JS still does not automatically send a notice to the poster, that still
 needs to be worked out.

---
 src/sbbs3/postmsg.cpp     |  3 ---
 src/sbbs3/qwk.cpp         |  2 +-
 src/sbbs3/readmsgs.cpp    | 17 ++++++++++-------
 src/sbbs3/sbbs.h          |  2 +-
 src/sbbs3/text.h          |  5 +++--
 src/sbbs3/text_defaults.c |  9 ++++++---
 6 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/src/sbbs3/postmsg.cpp b/src/sbbs3/postmsg.cpp
index 82370af3d2..01b8a6c13e 100644
--- a/src/sbbs3/postmsg.cpp
+++ b/src/sbbs3/postmsg.cpp
@@ -1,5 +1,3 @@
-/* postmsg.cpp */
-
 /* Synchronet user create/post public message routine */
 
 /* $Id$ */
@@ -587,7 +585,6 @@ extern "C" int DLLCALL votemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, const cha
 						,cfg->grp[cfg->sub[smb->subnum]->grp]->sname
 						,cfg->sub[smb->subnum]->sname
 						,from
-						,(msg->hdr.attr&MSG_UPVOTE) ? "Up":"Down"
 						,remsg.subj);
 					putsmsg(cfg, user.number, smsg);
 				}
diff --git a/src/sbbs3/qwk.cpp b/src/sbbs3/qwk.cpp
index 1570db297f..d16b9514d0 100644
--- a/src/sbbs3/qwk.cpp
+++ b/src/sbbs3/qwk.cpp
@@ -1054,7 +1054,7 @@ bool sbbs_t::qwk_voting(const char* fname, smb_net_type_t net_type)
 				smb.subnum = subnum;
 			}
 			int i;
-			if((i=votemsg(&cfg, &smb, &msg, text[MsgVoteNotice])) != SMB_SUCCESS)
+			if((i=votemsg(&cfg, &smb, &msg, text[msg.hdr.attr == MSG_UPVOTE ? MsgUpVoteNotice:MsgDownVoteNotice])) != SMB_SUCCESS)
 				errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
 		}
 		if(smb.subnum != INVALID_SUB)
diff --git a/src/sbbs3/readmsgs.cpp b/src/sbbs3/readmsgs.cpp
index b98d3c66d0..ceb57bb09c 100644
--- a/src/sbbs3/readmsgs.cpp
+++ b/src/sbbs3/readmsgs.cpp
@@ -40,7 +40,7 @@ int sbbs_t::sub_op(uint subnum)
 	return(is_user_subop(&cfg, subnum, &useron, &client));
 }
 
-char sbbs_t::msg_listing_flag(uint subnum, smbmsg_t* msg)
+char sbbs_t::msg_listing_flag(uint subnum, smbmsg_t* msg, post_t* post)
 {
 	if(msg->hdr.attr&MSG_DELETE)						return '-';
 	if((stricmp(msg->to,useron.alias)==0 || stricmp(msg->to,useron.name)==0)
@@ -48,10 +48,13 @@ char sbbs_t::msg_listing_flag(uint subnum, smbmsg_t* msg)
 	if(msg->hdr.attr&MSG_PERMANENT)						return 'p';
 	if(msg->hdr.attr&MSG_LOCKED)						return 'L';
 	if(msg->hdr.attr&MSG_KILLREAD)						return 'K';
-	if(msg->hdr.attr&MSG_NOREPLY)						return 'r';
+	if(msg->hdr.attr&MSG_NOREPLY)						return '#';
 	if(msg->hdr.number > subscan[subnum].ptr)			return '*';
 	if(msg->hdr.attr&MSG_PRIVATE)						return 'P'; 
-	if(sub_op(subnum) && msg->hdr.attr&MSG_ANONYMOUS)	return 'A'; 
+	if(post->upvotes > post->downvotes)					return 'V';
+	if(post->upvotes || post->downvotes)				return 'v';
+	if(msg->hdr.attr&MSG_REPLIED)						return 'R';
+	if(sub_op(subnum) && msg->hdr.attr&MSG_ANONYMOUS)	return 'A';
 	return ' ';
 }
 
@@ -73,7 +76,7 @@ long sbbs_t::listmsgs(uint subnum, long mode, post_t *post, long i, long posts)
 			,msg.hdr.attr&MSG_ANONYMOUS && !sub_op(subnum)
 			? text[Anonymous] : msg.from
 			,msg.to
-			,msg_listing_flag(subnum, &msg)
+			,msg_listing_flag(subnum, &msg, &post[i])
 			,msg.subj);
 		smb_freemsgmem(&msg);
 		msg.total_hfields=0;
@@ -1060,7 +1063,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
 				msg_client_hfields(&vote, &client);
 				smb_hfield_str(&vote, SENDERSERVER, startup->host_name);
 
-				if((i=votemsg(&cfg, &smb, &vote, text[MsgVoteNotice])) != SMB_SUCCESS)
+				if((i=votemsg(&cfg, &smb, &vote, text[vote.hdr.attr&MSG_UPVOTE ? MsgUpVoteNotice : MsgDownVoteNotice])) != SMB_SUCCESS)
 					errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
 
 				break;
@@ -1405,7 +1408,7 @@ long sbbs_t::searchposts(uint subnum, post_t *post, long start, long posts
 				,(msg.hdr.attr&MSG_ANONYMOUS) && !sub_op(subnum) ? text[Anonymous]
 				: msg.from
 				,msg.to
-				,msg_listing_flag(subnum, &msg)
+				,msg_listing_flag(subnum, &msg, &post[l])
 				,msg.subj);
 			found++; 
 		}
@@ -1460,7 +1463,7 @@ long sbbs_t::showposts_toyou(uint subnum, post_t *post, ulong start, long posts,
 				,(msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
 				? text[Anonymous] : msg.from
 				,msg.to
-				,msg_listing_flag(subnum, &msg)
+				,msg_listing_flag(subnum, &msg, &post[l])
 				,msg.subj); 
 		} 
 	}
diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h
index d69f6dd643..f56ea45148 100644
--- a/src/sbbs3/sbbs.h
+++ b/src/sbbs3/sbbs.h
@@ -755,7 +755,7 @@ public:
 	long	searchposts(uint subnum, post_t* post, long start, long msgs, const char* find);
 	long	showposts_toyou(uint subnum, post_t* post, ulong start, long posts, long mode=0);
 	void	msghdr(smbmsg_t* msg);
-	char	msg_listing_flag(uint subnum, smbmsg_t*);
+	char	msg_listing_flag(uint subnum, smbmsg_t*, post_t*);
 
 	/* chat.cpp */
 	void	chatsection(void);
diff --git a/src/sbbs3/text.h b/src/sbbs3/text.h
index 6a00f62e1e..d1845dc526 100644
--- a/src/sbbs3/text.h
+++ b/src/sbbs3/text.h
@@ -824,11 +824,12 @@ enum {
 	,NodeStatusLogout
 	,VotingNotAllowed
 	,VotedAlready
+	,R_Voting
 	,QWKSettingsVoting
 	,VoteMsgUpDownOrQuit
 	,MsgVotes
-	,MsgVoteNotice
-	,R_Voting
+	,MsgUpVoteNotice
+	,MsgDownVoteNotice
 
 	,TOTAL_TEXT
 };
diff --git a/src/sbbs3/text_defaults.c b/src/sbbs3/text_defaults.c
index e228a56956..563a3cd2d9 100644
--- a/src/sbbs3/text_defaults.c
+++ b/src/sbbs3/text_defaults.c
@@ -1287,6 +1287,8 @@ const char * const text_defaults[TOTAL_TEXT]={
 		"\x6c\x6c\x6f\x77\x65\x64\x20\x68\x65\x72\x65\x2e\x0d\x0a"
 	,"\x0d\x0a\x01\x68\x01\x72\x49\x27\x6d\x20\x73\x6f\x72\x72\x79\x2c\x20\x79\x6f\x75\x27\x76\x65\x20\x61\x6c\x72\x65\x61\x64\x79\x20"
 		"\x76\x6f\x74\x65\x64\x20\x6f\x6e\x20\x74\x68\x69\x73\x2e\x0d\x0a"
+	,"\x0d\x0a\x01\x68\x01\x72\x49\x27\x6d\x20\x73\x6f\x72\x72\x79\x2c\x20\x79\x6f\x75\x27\x72\x65\x20\x6e\x6f\x74\x20\x61\x6c\x6c\x6f"
+		"\x77\x65\x64\x20\x74\x6f\x20\x76\x6f\x74\x65\x2e\x0d\x0a"
 	,"\x01\x6e\x01\x62\x5b\x01\x68\x01\x77\x56\x01\x6e\x01\x62\x5d\x20\x01\x68\x49\x6e\x63\x6c\x75\x64\x65\x20\x56\x4f\x54\x49\x4e\x47"
 		"\x2e\x44\x41\x54\x20\x46\x69\x6c\x65\x20\x20\x20\x20\x20\x20\x01\x6e\x01\x62\x3a\x20\x01\x63\x25\x73\x0d\x0a"
 	,"\x0d\x0a\x56\x6f\x74\x65\x20\x66\x6f\x72\x20\x6d\x65\x73\x73\x61\x67\x65\x3a\x20\x7e\x55\x70\x2c\x20\x7e\x44\x6f\x77\x6e\x2c\x20"
@@ -1294,8 +1296,9 @@ const char * const text_defaults[TOTAL_TEXT]={
 	,"\x0d\x0a\xb3\x20\x01\x62\x4d\x73\x67\x20\x01\x6e\x01\x62\x3a\x20\x01\x68\x01\x63\x56\x6f\x74\x65\x64\x20\x55\x70\x20\x25\x75\x20"
 		"\x74\x69\x6d\x65\x73\x20\x61\x6e\x64\x20\x44\x6f\x77\x6e\x20\x25\x75\x20\x74\x69\x6d\x65\x73"
 	,"\x0d\x0a\x01\x6e\x01\x68\x4f\x6e\x20\x25\x73\x2c\x20\x69\x6e\x20\x01\x63\x25\x73\x20\x01\x6e\x01\x63\x25\x73\x0d\x0a\x01\x68\x01"
-		"\x6d\x25\x73\x20\x01\x63\x25\x73\x01\x6e\x01\x6d\x2d\x76\x6f\x74\x65\x64\x20\x79\x6f\x75\x72\x20\x6d\x65\x73\x73\x61\x67\x65\x3a"
+		"\x6d\x25\x73\x20\x01\x63\x55\x70\x01\x6e\x01\x6d\x2d\x76\x6f\x74\x65\x64\x20\x79\x6f\x75\x72\x20\x6d\x65\x73\x73\x61\x67\x65\x3a"
 		"\x20\x01\x6e\x01\x68\x25\x73\x0d\x0a"
-	,"\x0d\x0a\x01\x68\x01\x72\x49\x27\x6d\x20\x73\x6f\x72\x72\x79\x2c\x20\x79\x6f\x75\x27\x72\x65\x20\x6e\x6f\x74\x20\x61\x6c\x6c\x6f"
-		"\x77\x65\x64\x20\x74\x6f\x20\x76\x6f\x74\x65\x2e\x0d\x0a"
+	,"\x0d\x0a\x01\x6e\x01\x68\x4f\x6e\x20\x25\x73\x2c\x20\x69\x6e\x20\x01\x63\x25\x73\x20\x01\x6e\x01\x63\x25\x73\x0d\x0a\x01\x68\x01"
+		"\x6d\x25\x73\x20\x01\x72\x44\x6f\x77\x6e\x01\x6e\x01\x6d\x2d\x76\x6f\x74\x65\x64\x20\x79\x6f\x75\x72\x20\x6d\x65\x73\x73\x61\x67"
+		"\x65\x3a\x20\x01\x6e\x01\x68\x25\x73\x0d\x0a"
 };
-- 
GitLab