Skip to content
Snippets Groups Projects
Commit 04c26f15 authored by rswindell's avatar rswindell
Browse files

Exports polls to VOTING.DAT file.

parent 0c2e2c23
No related branches found
No related tags found
No related merge requests found
...@@ -58,19 +58,26 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum ...@@ -58,19 +58,26 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum
get_msgid(&cfg, subnum, msg, msgid, sizeof(msgid)); get_msgid(&cfg, subnum, msg, msgid, sizeof(msgid));
if(msg->hdr.attr&(MSG_VOTE|MSG_POLL)) { if(msg->hdr.type == SMB_MSG_TYPE_POLL || msg->hdr.type == SMB_MSG_TYPE_BALLOT) {
if(voting == NULL) if(voting == NULL)
return 0; return 0;
if(msg->hdr.attr&MSG_VOTE) { if(msg->hdr.type == SMB_MSG_TYPE_BALLOT) {
fprintf(voting, "[vote:%s]\n", msgid); fprintf(voting, "[vote:%s]\n", msgid);
if((p = msg->reply_id) != NULL) if((p = msg->reply_id) != NULL)
fprintf(voting, "%s: %s\n", smb_hfieldtype(RFC822REPLYID), p); fprintf(voting, "%s: %s\n", smb_hfieldtype(RFC822REPLYID), p);
if((msg->hdr.attr&MSG_VOTE) == MSG_VOTE) if((msg->hdr.attr&MSG_VOTE) == MSG_VOTE)
fprintf(voting, "Vote = %hd\n", msg->hdr.vote); fprintf(voting, "Votes = 0x%hx\n", msg->hdr.votes);
else else
fprintf(voting, "%sVote = true\n", msg->hdr.attr&MSG_UPVOTE ? "Up" : "Down"); fprintf(voting, "%sVote = true\n", msg->hdr.attr&MSG_UPVOTE ? "Up" : "Down");
} else { } else {
fprintf(voting, "[poll:%s]\n", msgid); fprintf(voting, "[poll:%s]\n", msgid);
if(msg->hdr.votes)
fprintf(voting, "MaxVotes = %hd\n", msg->hdr.votes);
unsigned answers = 0;
for(i=0; i < msg->total_hfields; i++) {
if(msg->hfield[i].type == SMB_POLL_ANSWER)
fprintf(voting, "Answer%u = %s\n", answers++, (char*)msg->hfield_dat[i]);
}
} }
if(msg->subj && *msg->subj) if(msg->subj && *msg->subj)
fprintf(voting, "%s: %s\n",smb_hfieldtype(SUBJECT), msg->subj); fprintf(voting, "%s: %s\n",smb_hfieldtype(SUBJECT), msg->subj);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment