mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-21 00:23:56 +08:00
Render confcall messages as phone calls.
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user