Update API scheme, add group call admin log events.
This commit is contained in:
parent
dde94d486b
commit
a14a62eefa
|
@ -2068,6 +2068,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_admin_log_removed_location_chat" = "{from} removed the group location";
|
"lng_admin_log_removed_location_chat" = "{from} removed the group location";
|
||||||
"lng_admin_log_changed_slow_mode" = "{from} changed slow mode to {duration}";
|
"lng_admin_log_changed_slow_mode" = "{from} changed slow mode to {duration}";
|
||||||
"lng_admin_log_removed_slow_mode" = "{from} disabled slow mode";
|
"lng_admin_log_removed_slow_mode" = "{from} disabled slow mode";
|
||||||
|
"lng_admin_log_started_group_call" = "{from} started a new voice chat";
|
||||||
|
"lng_admin_log_discarded_group_call" = "{from} discarded a voice chat";
|
||||||
|
"lng_admin_log_muted_participant" = "{from} muted {user} in a voice chat";
|
||||||
|
"lng_admin_log_unmuted_participant" = "{from} unmuted {user} in a voice chat";
|
||||||
|
"lng_admin_log_allowed_unmute_self" = "{from} allowed new voice chat members to speak";
|
||||||
|
"lng_admin_log_disallowed_unmute_self" = "{from} started muting new voice chat members";
|
||||||
"lng_admin_log_user_with_username" = "{name} ({mention})";
|
"lng_admin_log_user_with_username" = "{name} ({mention})";
|
||||||
"lng_admin_log_restricted_forever" = "indefinitely";
|
"lng_admin_log_restricted_forever" = "indefinitely";
|
||||||
"lng_admin_log_restricted_until" = "until {date}";
|
"lng_admin_log_restricted_until" = "until {date}";
|
||||||
|
|
|
@ -315,7 +315,7 @@ updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;
|
||||||
updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update;
|
updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update;
|
||||||
updateStickerSets#43ae3dec = Update;
|
updateStickerSets#43ae3dec = Update;
|
||||||
updateSavedGifs#9375341e = Update;
|
updateSavedGifs#9375341e = Update;
|
||||||
updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update;
|
updateBotInlineQuery#3f2038db flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update;
|
||||||
updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;
|
updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;
|
||||||
updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update;
|
updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update;
|
||||||
updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
|
updateBotCallbackQuery#e73547e1 flags:# query_id:long user_id:int peer:Peer msg_id:int chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update;
|
||||||
|
@ -879,6 +879,11 @@ channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEve
|
||||||
channelAdminLogEventActionChangeLinkedChat#a26f881b prev_value:int new_value:int = ChannelAdminLogEventAction;
|
channelAdminLogEventActionChangeLinkedChat#a26f881b prev_value:int new_value:int = ChannelAdminLogEventAction;
|
||||||
channelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction;
|
channelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction;
|
||||||
channelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction;
|
channelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction;
|
||||||
|
channelAdminLogEventActionStartGroupCall#23209745 call:InputGroupCall = ChannelAdminLogEventAction;
|
||||||
|
channelAdminLogEventActionDiscardGroupCall#db9f9140 call:InputGroupCall = ChannelAdminLogEventAction;
|
||||||
|
channelAdminLogEventActionParticipantMute#f92424d2 participant:GroupCallParticipant = ChannelAdminLogEventAction;
|
||||||
|
channelAdminLogEventActionParticipantUnmute#e64429c0 participant:GroupCallParticipant = ChannelAdminLogEventAction;
|
||||||
|
channelAdminLogEventActionToggleGroupCallSetting#56d6a247 join_muted:Bool = ChannelAdminLogEventAction;
|
||||||
|
|
||||||
channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
|
channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
|
||||||
|
|
||||||
|
@ -1195,6 +1200,12 @@ phone.groupCall#66ab0bfc call:GroupCall participants:Vector<GroupCallParticipant
|
||||||
|
|
||||||
phone.groupParticipants#9cfeb92d count:int participants:Vector<GroupCallParticipant> next_offset:string users:Vector<User> version:int = phone.GroupParticipants;
|
phone.groupParticipants#9cfeb92d count:int participants:Vector<GroupCallParticipant> next_offset:string users:Vector<User> version:int = phone.GroupParticipants;
|
||||||
|
|
||||||
|
inlineQueryPeerTypeSameBotPM#3081ed9d = InlineQueryPeerType;
|
||||||
|
inlineQueryPeerTypePM#833c0fac = InlineQueryPeerType;
|
||||||
|
inlineQueryPeerTypeChat#d766c50a = InlineQueryPeerType;
|
||||||
|
inlineQueryPeerTypeMegagroup#5ec4be43 = InlineQueryPeerType;
|
||||||
|
inlineQueryPeerTypeBroadcast#6334ee9a = InlineQueryPeerType;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
|
|
|
@ -147,7 +147,7 @@ void GroupCall::start() {
|
||||||
LOG(("Call Error: Could not create, error: %1"
|
LOG(("Call Error: Could not create, error: %1"
|
||||||
).arg(error.type()));
|
).arg(error.type()));
|
||||||
hangup();
|
hangup();
|
||||||
if (error.type() == u"GROUP_CALL_ANONYMOUS_FORBIDDEN"_q) {
|
if (error.type() == u"GROUPCALL_ANONYMOUS_FORBIDDEN"_q) {
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
.text = tr::lng_group_call_no_anonymous(tr::now),
|
.text = tr::lng_group_call_no_anonymous(tr::now),
|
||||||
});
|
});
|
||||||
|
@ -236,7 +236,7 @@ void GroupCall::rejoin() {
|
||||||
hangup();
|
hangup();
|
||||||
|
|
||||||
Ui::ShowMultilineToast({
|
Ui::ShowMultilineToast({
|
||||||
.text = (type == u"GROUP_CALL_ANONYMOUS_FORBIDDEN"_q
|
.text = (type == u"GROUPCALL_ANONYMOUS_FORBIDDEN"_q
|
||||||
? tr::lng_group_call_no_anonymous(tr::now)
|
? tr::lng_group_call_no_anonymous(tr::now)
|
||||||
: type == u"GROUPCALL_PARTICIPANTS_TOO_MUCH"_q
|
: type == u"GROUPCALL_PARTICIPANTS_TOO_MUCH"_q
|
||||||
? tr::lng_group_call_too_many(tr::now)
|
? tr::lng_group_call_too_many(tr::now)
|
||||||
|
@ -662,7 +662,7 @@ void GroupCall::sendMutedUpdate() {
|
||||||
_channel->session().api().applyUpdates(result);
|
_channel->session().api().applyUpdates(result);
|
||||||
}).fail([=](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
_updateMuteRequestId = 0;
|
_updateMuteRequestId = 0;
|
||||||
if (error.type() == u"GROUP_CALL_FORBIDDEN"_q) {
|
if (error.type() == u"GROUPCALL_FORBIDDEN"_q) {
|
||||||
LOG(("Call Info: Rejoin after error '%1' in editGroupCallMember."
|
LOG(("Call Info: Rejoin after error '%1' in editGroupCallMember."
|
||||||
).arg(error.type()));
|
).arg(error.type()));
|
||||||
rejoin();
|
rejoin();
|
||||||
|
@ -694,7 +694,7 @@ void GroupCall::toggleMute(not_null<UserData*> user, bool mute) {
|
||||||
)).done([=](const MTPUpdates &result) {
|
)).done([=](const MTPUpdates &result) {
|
||||||
_channel->session().api().applyUpdates(result);
|
_channel->session().api().applyUpdates(result);
|
||||||
}).fail([=](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
if (error.type() == u"GROUP_CALL_FORBIDDEN"_q) {
|
if (error.type() == u"GROUPCALL_FORBIDDEN"_q) {
|
||||||
LOG(("Call Info: Rejoin after error '%1' in editGroupCallMember."
|
LOG(("Call Info: Rejoin after error '%1' in editGroupCallMember."
|
||||||
).arg(error.type()));
|
).arg(error.type()));
|
||||||
rejoin();
|
rejoin();
|
||||||
|
|
|
@ -824,6 +824,71 @@ void GenerateItems(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto createStartGroupCall = [&](const MTPDchannelAdminLogEventActionStartGroupCall &data) {
|
||||||
|
const auto text = tr::lng_admin_log_started_group_call(tr::now, lt_from, fromLinkText);
|
||||||
|
addSimpleServiceMessage(text);
|
||||||
|
};
|
||||||
|
|
||||||
|
auto createDiscardGroupCall = [&](const MTPDchannelAdminLogEventActionDiscardGroupCall &data) {
|
||||||
|
const auto text = tr::lng_admin_log_discarded_group_call(tr::now, lt_from, fromLinkText);
|
||||||
|
addSimpleServiceMessage(text);
|
||||||
|
};
|
||||||
|
|
||||||
|
auto createParticipantMute = [&](const MTPDchannelAdminLogEventActionParticipantMute &data) {
|
||||||
|
data.vparticipant().match([&](const MTPDgroupCallParticipant &data) {
|
||||||
|
const auto user = history->owner().user(data.vuser_id().v);
|
||||||
|
const auto userLink = user->createOpenLink();
|
||||||
|
const auto userLinkText = textcmdLink(1, user->name);
|
||||||
|
auto text = tr::lng_admin_log_muted_participant(
|
||||||
|
tr::now,
|
||||||
|
lt_from,
|
||||||
|
fromLinkText,
|
||||||
|
lt_user,
|
||||||
|
userLinkText);
|
||||||
|
auto message = HistoryService::PreparedText{ text };
|
||||||
|
message.links.push_back(fromLink);
|
||||||
|
message.links.push_back(userLink);
|
||||||
|
addPart(history->makeServiceMessage(
|
||||||
|
history->nextNonHistoryEntryId(),
|
||||||
|
MTPDmessage_ClientFlag::f_admin_log_entry,
|
||||||
|
date,
|
||||||
|
message,
|
||||||
|
MTPDmessage::Flags(0),
|
||||||
|
peerToUser(from->id)));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto createParticipantUnmute = [&](const MTPDchannelAdminLogEventActionParticipantUnmute &data) {
|
||||||
|
data.vparticipant().match([&](const MTPDgroupCallParticipant &data) {
|
||||||
|
const auto user = history->owner().user(data.vuser_id().v);
|
||||||
|
const auto userLink = user->createOpenLink();
|
||||||
|
const auto userLinkText = textcmdLink(1, user->name);
|
||||||
|
auto text = tr::lng_admin_log_unmuted_participant(
|
||||||
|
tr::now,
|
||||||
|
lt_from,
|
||||||
|
fromLinkText,
|
||||||
|
lt_user,
|
||||||
|
userLinkText);
|
||||||
|
auto message = HistoryService::PreparedText{ text };
|
||||||
|
message.links.push_back(fromLink);
|
||||||
|
message.links.push_back(userLink);
|
||||||
|
addPart(history->makeServiceMessage(
|
||||||
|
history->nextNonHistoryEntryId(),
|
||||||
|
MTPDmessage_ClientFlag::f_admin_log_entry,
|
||||||
|
date,
|
||||||
|
message,
|
||||||
|
MTPDmessage::Flags(0),
|
||||||
|
peerToUser(from->id)));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto createToggleGroupCallSetting = [&](const MTPDchannelAdminLogEventActionToggleGroupCallSetting &data) {
|
||||||
|
const auto text = mtpIsTrue(data.vjoin_muted())
|
||||||
|
? tr::lng_admin_log_disallowed_unmute_self(tr::now, lt_from, fromLinkText)
|
||||||
|
: tr::lng_admin_log_allowed_unmute_self(tr::now, lt_from, fromLinkText);
|
||||||
|
addSimpleServiceMessage(text);
|
||||||
|
};
|
||||||
|
|
||||||
action.match([&](const MTPDchannelAdminLogEventActionChangeTitle &data) {
|
action.match([&](const MTPDchannelAdminLogEventActionChangeTitle &data) {
|
||||||
createChangeTitle(data);
|
createChangeTitle(data);
|
||||||
}, [&](const MTPDchannelAdminLogEventActionChangeAbout &data) {
|
}, [&](const MTPDchannelAdminLogEventActionChangeAbout &data) {
|
||||||
|
@ -866,6 +931,16 @@ void GenerateItems(
|
||||||
createChangeLocation(data);
|
createChangeLocation(data);
|
||||||
}, [&](const MTPDchannelAdminLogEventActionToggleSlowMode &data) {
|
}, [&](const MTPDchannelAdminLogEventActionToggleSlowMode &data) {
|
||||||
createToggleSlowMode(data);
|
createToggleSlowMode(data);
|
||||||
|
}, [&](const MTPDchannelAdminLogEventActionStartGroupCall &data) {
|
||||||
|
createStartGroupCall(data);
|
||||||
|
}, [&](const MTPDchannelAdminLogEventActionDiscardGroupCall &data) {
|
||||||
|
createDiscardGroupCall(data);
|
||||||
|
}, [&](const MTPDchannelAdminLogEventActionParticipantMute &data) {
|
||||||
|
createParticipantMute(data);
|
||||||
|
}, [&](const MTPDchannelAdminLogEventActionParticipantUnmute &data) {
|
||||||
|
createParticipantUnmute(data);
|
||||||
|
}, [&](const MTPDchannelAdminLogEventActionToggleGroupCallSetting &data) {
|
||||||
|
createToggleGroupCallSetting(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue