Re: xtrn/DDMsgReader/DDMsgReader.js
By: Nightfox to Digital Man on Fri Nov 25 2016 09:50:12
I suppose a poll is a readable message, is that correct? And how are poll
Yes. You can tell if a message is a poll by checking:
header.attr&MSG_POLL
And if the poll is closed to votes with:
header.auxattr&POLL_CLOSED
And evaluate who the results can be displayed to with:
header.auxattr&POLL_RESULTS_CLOSED
header.auxattr&POLL_RESULTS_OPEN
header.auxattr&POLL_RESULTS_VOTERS
(The above are explained in comments in sbbsdefs.js.)
answers inputted from the user? Does Synchronet give a multiple-choice selection with available poll answers, or do poll messages have yes/no answers that are answered with up/downvotes?
The 'header.votes' property on a poll message tells you how many answers can be accepted from a user. 0 and 1 are treated as the same (the user can provide one answer), anything greater than 1 means the user can select multiple answers.
To submit a user's answers to a poll:
// Let's say the user selected answers 0, 1, and 3:
var votes = (1<<0)|(1<<1)|(1<<3);
msgBase.vote_msg(
{ from : msgBase.cfg.settings&SUB_NAME ? user.name : user.alias,
from_ext : user.number,
from_net_type : NET_NONE,
thread_back : header.number, // poll message being voted on
attr : MSG_VOTE,
votes : votes
}
);
---
echicken
electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com