Commit 6b5d27f4 authored by rswindell's avatar rswindell
Browse files

The format of the votes included in the vote notification short-message

(telegram) sent to the pollster is now configurable via text.dat
(VoteNoticeFmt).
parent 83d3e235
......@@ -2418,7 +2418,7 @@ js_vote_msg(JSContext *cx, uintN argc, jsval *arglist)
if(parse_header_object(cx, p, hdr, &msg, FALSE)) {
rc = JS_SUSPENDREQUEST(cx);
if((p->smb_result=votemsg(scfg, &(p->smb), &msg, NULL)) == SMB_SUCCESS) {
if((p->smb_result=votemsg(scfg, &(p->smb), &msg, NULL, NULL)) == SMB_SUCCESS) {
JS_RESUMEREQUEST(cx, rc);
JS_SET_RVAL(cx, arglist, JSVAL_TRUE);
}
......
/* Synchronet user create/post public message routine */
// vi: tabstop=4
/* $Id$ */
......@@ -518,7 +519,7 @@ extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, client_t*
return(i);
}
extern "C" int DLLCALL votemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, const char* smsgfmt)
extern "C" int DLLCALL votemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, const char* smsgfmt, const char* votefmt)
{
int result;
smbmsg_t remsg;
......@@ -571,13 +572,13 @@ extern "C" int DLLCALL votemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, const cha
safe_snprintf(from, sizeof(from), "%s (%s)", msg->from, smb_netaddr(&msg->from_net));
else
SAFECOPY(from, msg->from);
if(remsg.hdr.type == SMB_MSG_TYPE_POLL) {
if(remsg.hdr.type == SMB_MSG_TYPE_POLL && votefmt != NULL) {
int answers = 0;
for(int i=0; i<remsg.total_hfields; i++) {
if(remsg.hfield[i].type == SMB_POLL_ANSWER) {
if(msg->hdr.votes&(1<<answers)) {
char vote[128];
SAFEPRINTF(vote, " %.78s\r\n", (char*)remsg.hfield_dat[i]);
SAFEPRINTF(vote, votefmt, (char*)remsg.hfield_dat[i]);
SAFECAT(votes, vote);
}
answers++;
......@@ -589,8 +590,8 @@ 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
,remsg.subj
,votes);
,remsg.subj);
SAFECAT(smsg, votes);
putsmsg(cfg, user.number, smsg);
}
}
......
......@@ -1187,7 +1187,7 @@ bool sbbs_t::qwk_vote(str_list_t ini, const char* section, smb_net_type_t net_ty
msg.hdr.votes = iniGetShortInt(ini, section, "votes", 0);
notice = text[PollVoteNotice];
}
result = votemsg(&cfg, &smb, &msg, notice);
result = votemsg(&cfg, &smb, &msg, notice, text[VoteNoticeFmt]);
if(result != SMB_SUCCESS && result != SMB_DUPE_MSG)
errormsg(WHERE, ERR_WRITE, smb.file, result, smb.last_error);
}
......
......@@ -1254,7 +1254,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, notice)) != SMB_SUCCESS)
if((i=votemsg(&cfg, &smb, &vote, notice, text[VoteNoticeFmt])) != SMB_SUCCESS)
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
break;
......
......@@ -1056,7 +1056,7 @@ extern "C" {
/* postmsg.cpp */
DLLEXPORT int DLLCALL savemsg(scfg_t*, smb_t*, smbmsg_t*, client_t*, const char* server, char* msgbuf);
DLLEXPORT int DLLCALL votemsg(scfg_t*, smb_t*, smbmsg_t*, const char* msgfmt);
DLLEXPORT int DLLCALL votemsg(scfg_t*, smb_t*, smbmsg_t*, const char* msgfmt, const char* votefmt);
DLLEXPORT int DLLCALL postpoll(scfg_t*, smb_t*, smbmsg_t*);
DLLEXPORT int DLLCALL closepoll(scfg_t*, smb_t*, uint32_t msgnum, const char* username);
DLLEXPORT void DLLCALL signal_sub_sem(scfg_t*, uint subnum);
......
......@@ -812,6 +812,7 @@ enum {
,FileHdrDescSeparator
,RemoveFileQ
,OriginFidoAddr
,VoteNoticeFmt
,TOTAL_TEXT
};
......
......@@ -1326,4 +1326,5 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x01\x2f\x0d\x0a\x40\x45\x58\x45\x43\x3a\x53\x48\x4f\x57\x46\x49\x4c\x45\x41\x56\x41\x54\x41\x52\x40" // 799 FileHdrDescSeparator
,"\x52\x65\x6d\x6f\x76\x65\x20\x66\x69\x6c\x65" // 800 RemoveFileQ
,"\x4f\x72\x69\x67\x69\x6e\x61\x74\x69\x6e\x67\x20\x41\x64\x64\x72\x65\x73\x73" // 801 OriginFidoAddr
,"\x01\x6e\x01\x68\xfb\x20\x01\x6d\x25\x2e\x37\x37\x73\x0d\x0a" // 802 VoteNoticeFmt
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment