Render confcall messages as phone calls.

This commit is contained in:
John Preston
2025-03-31 00:06:02 +05:00
parent be611c1920
commit 346f7aadd6
13 changed files with 137 additions and 127 deletions

View File

@@ -1387,16 +1387,6 @@ auto HtmlWriter::Wrap::pushMessage(
+ QString::number(data.stars).toUtf8()
+ " Telegram Stars.";
return result;
}, [&](const ActionConferenceCall &data) {
return data.missed
? "Missed conference call"
: data.active
? "Ongoing conference call"
: data.duration
? "Conference call ("
+ NumberToString(data.duration)
+ " seconds)"
: "Declined conference call";
}, [](v::null_t) { return QByteArray(); });
if (!serviceText.isEmpty()) {
@@ -2286,16 +2276,20 @@ MediaData HtmlWriter::Wrap::prepareMediaData(
if (const auto call = std::get_if<ActionPhoneCall>(&action.content)) {
result.classes = "media_call";
result.title = peers.peer(message.out
? message.peerId
: message.selfId).name();
? message.peerId
: message.selfId).name();
result.status = [&] {
using Reason = ActionPhoneCall::DiscardReason;
const auto reason = call->discardReason;
if (message.out) {
return reason == Reason::Missed ? "Cancelled" : "Outgoing";
} else if (reason == Reason::Missed) {
using State = ActionPhoneCall::State;
const auto state = call->state;
if (state == State::Invitation) {
return "Invitation";
} else if (state == State::Active) {
return "Ongoing";
} else if (message.out) {
return (state == State::Missed) ? "Cancelled" : "Outgoing";
} else if (state == State::Missed) {
return "Missed";
} else if (reason == Reason::Busy) {
} else if (state == State::Busy) {
return "Declined";
}
return "Incoming";