Skip to content
Snippets Groups Projects
Commit e35e7886 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Support @-codes in Regarding* text.dat strings

Expected to use the MSG_* @-codes in this context. This allows more freedom
of ordering the message header fields reused in this expanded string. The %s
specifiers can be eliminated altogether when using @-codes.

For Accession to play with.
parent 3678922e
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,7 @@ static uchar* findsig(char* msgbuf) ...@@ -67,6 +67,7 @@ static uchar* findsig(char* msgbuf)
bool sbbs_t::postmsg(int subnum, int wm_mode, smb_t* resmb, smbmsg_t* remsg) bool sbbs_t::postmsg(int subnum, int wm_mode, smb_t* resmb, smbmsg_t* remsg)
{ {
char str[256]; char str[256];
char fmt[256];
char title[LEN_TITLE+1] = ""; char title[LEN_TITLE+1] = "";
char top[256] = ""; char top[256] = "";
char touser[64] = ""; char touser[64] = "";
...@@ -107,7 +108,8 @@ bool sbbs_t::postmsg(int subnum, int wm_mode, smb_t* resmb, smbmsg_t* remsg) ...@@ -107,7 +108,8 @@ bool sbbs_t::postmsg(int subnum, int wm_mode, smb_t* resmb, smbmsg_t* remsg)
if(remsg->to != NULL) if(remsg->to != NULL)
strListPush(&names, remsg->to); strListPush(&names, remsg->to);
msgattr=(ushort)(remsg->hdr.attr&MSG_PRIVATE); msgattr=(ushort)(remsg->hdr.attr&MSG_PRIVATE);
sprintf(top,text[RegardingByToOn] expand_atcodes(text[RegardingByToOn], fmt, sizeof fmt);
snprintf(top, sizeof top, fmt
,title ,title
,from ,from
,msghdr_field(remsg, remsg->to, NULL, term_supports(UTF8)) ,msghdr_field(remsg, remsg->to, NULL, term_supports(UTF8))
......
...@@ -43,6 +43,7 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) ...@@ -43,6 +43,7 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode)
{ {
char str[256],str2[256],done=0,domsg=1 char str[256],str2[256],done=0,domsg=1
,*p; ,*p;
char fmt[256];
char tmp[512]; char tmp[512];
int i; int i;
uint32_t u,v; uint32_t u,v;
...@@ -344,9 +345,10 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) ...@@ -344,9 +345,10 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode)
smb_getmsgidx(&smb,&msg); smb_getmsgidx(&smb,&msg);
if(!stricmp(str2,str)) /* Reply to sender */ if(!stricmp(str2,str)) /* Reply to sender */
SAFEPRINTF(str2,text[Regarding], msghdr_field(&msg, msg.subj)); expand_atcodes(text[Regarding], fmt, sizeof fmt);
else /* Reply to other */ else /* Reply to other */
SAFEPRINTF3(str2,text[RegardingByOn], msghdr_field(&msg, msg.subj), msghdr_field(&msg, msg.from, tmp) expand_atcodes(text[RegardingByOn], fmt, sizeof fmt);
SAFEPRINTF3(str2, fmt, msghdr_field(&msg, msg.subj), msghdr_field(&msg, msg.from, tmp)
,timestr(msg.hdr.when_written.time)); ,timestr(msg.hdr.when_written.time));
p=strrchr(str,'@'); p=strrchr(str,'@');
......
...@@ -396,6 +396,7 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find) ...@@ -396,6 +396,7 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find)
{ {
char str[256],str2[256],do_find=true,mismatches=0 char str[256],str2[256],do_find=true,mismatches=0
,done=0,domsg=1,*buf; ,done=0,domsg=1,*buf;
char fmt[256];
char find_buf[128]; char find_buf[128];
char tmp[128]; char tmp[128];
int i; int i;
...@@ -1006,7 +1007,8 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find) ...@@ -1006,7 +1007,8 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find)
&& stricmp(msg.to,useron.name) && stricmp(msg.to,useron.name)
&& stricmp(msg.to,useron.alias)) && stricmp(msg.to,useron.alias))
break; break;
SAFEPRINTF2(str2,text[Regarding] expand_atcodes(text[Regarding], fmt, sizeof fmt);
SAFEPRINTF2(str2, fmt
,msghdr_field(&msg, msg.subj) ,msghdr_field(&msg, msg.subj)
,timestr(msg.hdr.when_written.time)); ,timestr(msg.hdr.when_written.time));
if(msg.from_net.addr==NULL) if(msg.from_net.addr==NULL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment