From bdc43c0aeaccf5e6bc7f88a38958162ff32ff173 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 22 Nov 2021 16:48:49 +0400 Subject: [PATCH] Update API scheme on layer 135. Add channelAdminLogEventActionSendMessage admin log action. --- Telegram/Resources/langs/lang.strings | 9 +++++---- Telegram/Resources/tl/api.tl | 5 +++-- .../history/admin_log/history_admin_log_item.cpp | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 514c9027b..62b58354f 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2497,14 +2497,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_admin_log_forwards_disabled" = "{from} restricted content copying"; "lng_admin_log_history_made_hidden" = "{from} made group history hidden for new members"; "lng_admin_log_history_made_visible" = "{from} made group history visible for new members"; -"lng_admin_log_pinned_message" = "{from} pinned message:"; -"lng_admin_log_unpinned_message" = "{from} unpinned message"; +"lng_admin_log_pinned_message" = "{from} pinned this message:"; +"lng_admin_log_unpinned_message" = "{from} unpinned this message"; "lng_admin_log_edited_caption" = "{from} edited caption:"; "lng_admin_log_removed_caption" = "{from} removed caption"; "lng_admin_log_previous_caption" = "Original caption"; -"lng_admin_log_edited_message" = "{from} edited message:"; +"lng_admin_log_edited_message" = "{from} edited this message:"; "lng_admin_log_previous_message" = "Original message"; -"lng_admin_log_deleted_message" = "{from} deleted message:"; +"lng_admin_log_deleted_message" = "{from} deleted this message:"; +"lng_admin_log_sent_message" = "{from} sent this message:"; "lng_admin_log_participant_joined" = "{from} joined the group"; "lng_admin_log_participant_joined_channel" = "{from} joined the channel"; "lng_admin_log_participant_joined_by_link" = "{from} joined the group via {link}"; diff --git a/Telegram/Resources/tl/api.tl b/Telegram/Resources/tl/api.tl index 139cc03b4..21aed824a 100644 --- a/Telegram/Resources/tl/api.tl +++ b/Telegram/Resources/tl/api.tl @@ -222,7 +222,7 @@ inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings; -peerSettings#a8228d2e flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true geo_distance:flags.6?int request_chat:flags.9?Peer request_chat_date:flags.9?int = PeerSettings; +peerSettings#a518110d flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int = PeerSettings; wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper; wallPaperNoFile#e0804116 id:long flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper; @@ -916,12 +916,13 @@ channelAdminLogEventActionParticipantVolume#3e7f6847 participant:GroupCallPartic channelAdminLogEventActionChangeHistoryTTL#6e941a38 prev_value:int new_value:int = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantJoinByRequest#afb6144a invite:ExportedChatInvite approved_by:long = ChannelAdminLogEventAction; channelAdminLogEventActionToggleNoForwards#cb2ac766 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionSendMessage#278f2868 message:Message = ChannelAdminLogEventAction; channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; -channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true = ChannelAdminLogEventsFilter; +channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index 7e3d8b69a..b98f177bd 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -1123,6 +1123,20 @@ void GenerateItems( addSimpleServiceMessage(text(tr::now, lt_from, fromLinkText)); }; + auto createSendMessage = [&](const MTPDchannelAdminLogEventActionSendMessage &data) { + auto text = tr::lng_admin_log_sent_message(tr::now, lt_from, fromLinkText); + addSimpleServiceMessage(text); + + auto detachExistingItem = false; + addPart( + history->createItem( + history->nextNonHistoryEntryId(), + PrepareLogMessage(data.vmessage(), date), + MessageFlag::AdminLogEntry, + detachExistingItem), + ExtractSentDate(data.vmessage())); + }; + action.match([&](const MTPDchannelAdminLogEventActionChangeTitle &data) { createChangeTitle(data); }, [&](const MTPDchannelAdminLogEventActionChangeAbout &data) { @@ -1191,6 +1205,8 @@ void GenerateItems( createParticipantJoinByRequest(data); }, [&](const MTPDchannelAdminLogEventActionToggleNoForwards &data) { createToggleNoForwards(data); + }, [&](const MTPDchannelAdminLogEventActionSendMessage &data) { + createSendMessage(data); }); }