2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 09:05:14 +00:00

Simplest polls data export.

This commit is contained in:
John Preston
2018-12-23 00:08:15 +04:00
parent 93c8e9aa1f
commit ef1d38462f
6 changed files with 153 additions and 2 deletions

View File

@@ -436,6 +436,19 @@ QByteArray SerializeMessage(
? "ID-" + NumberToString(data.receiptMsgId)
: QByteArray()) }
}));
}, [&](const Poll &data) {
push("Poll", SerializeKeyValue({
{ "Question", data.question },
{ "Closed", data.closed ? QByteArray("Yes") : QByteArray() },
{ "Votes", NumberToString(data.totalVotes) },
}));
for (const auto &answer : data.answers) {
push("Answer", SerializeKeyValue({
{ "Text", answer.text },
{ "Votes", NumberToString(answer.votes) },
{ "Chosen", answer.my ? QByteArray("Yes") : QByteArray() }
}));
}
}, [](const UnsupportedMedia &data) {
Unexpected("Unsupported message.");
}, [](std::nullopt_t) {});