Update layer 119. Add sender_chat_id.
GitOrigin-RevId: ac837165b7bbd57631456291503e688339e04d03
This commit is contained in:
parent
0540ae7b60
commit
f05b8cec61
@ -617,6 +617,9 @@ secretChat id:int32 user_id:int32 state:SecretChatState is_outbound:Bool ttl:int
|
|||||||
//@description The message was originally written by a known user @sender_user_id Identifier of the user that originally sent the message
|
//@description The message was originally written by a known user @sender_user_id Identifier of the user that originally sent the message
|
||||||
messageForwardOriginUser sender_user_id:int32 = MessageForwardOrigin;
|
messageForwardOriginUser sender_user_id:int32 = MessageForwardOrigin;
|
||||||
|
|
||||||
|
//@description The message was originally written by an anonimous chat administrator on behalf of the chat @sender_chat_id Identifier of the chat that originally sent the message
|
||||||
|
messageForwardOriginChat sender_chat_id:int53 = MessageForwardOrigin;
|
||||||
|
|
||||||
//@description The message was originally written by a user, which is hidden by their privacy settings @sender_name Name of the sender
|
//@description The message was originally written by a user, which is hidden by their privacy settings @sender_name Name of the sender
|
||||||
messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin;
|
messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin;
|
||||||
|
|
||||||
@ -655,7 +658,8 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool r
|
|||||||
|
|
||||||
//@description Describes a message
|
//@description Describes a message
|
||||||
//@id Message identifier, unique for the chat to which the message belongs
|
//@id Message identifier, unique for the chat to which the message belongs
|
||||||
//@sender_user_id Identifier of the user who sent the message; 0 if unknown. Currently, it is unknown for channel posts and for channel posts automatically forwarded to discussion group
|
//@sender_user_id Identifier of the user who sent the message; 0 if unknown. Currently, it is unknown for channel posts, for channel posts automatically forwarded to discussion group and for anonimously sent supergroup messages
|
||||||
|
//@sender_chat_id Identifier of the chat on behalf of which the message was sent; 0 if none
|
||||||
//@chat_id Chat identifier
|
//@chat_id Chat identifier
|
||||||
//@sending_state Information about the sending state of the message; may be null
|
//@sending_state Information about the sending state of the message; may be null
|
||||||
//@scheduling_state Information about the scheduling state of the message; may be null
|
//@scheduling_state Information about the scheduling state of the message; may be null
|
||||||
@ -681,7 +685,7 @@ messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool r
|
|||||||
//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted
|
//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted
|
||||||
//@content Content of the message
|
//@content Content of the message
|
||||||
//@reply_markup Reply markup for the message; may be null
|
//@reply_markup Reply markup for the message; may be null
|
||||||
message id:int53 sender_user_id:int32 chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_statistics:Bool can_get_replies:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo reply_to_message_id:int53 ttl:int32 ttl_expires_in:double via_bot_user_id:int32 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message;
|
message id:int53 sender_user_id:int32 sender_chat_id:int53 chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_statistics:Bool can_get_replies:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo reply_to_message_id:int53 ttl:int32 ttl_expires_in:double via_bot_user_id:int32 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message;
|
||||||
|
|
||||||
//@description Contains a list of messages @total_count Approximate total count of messages found @messages List of messages; messages may be null
|
//@description Contains a list of messages @total_count Approximate total count of messages found @messages List of messages; messages may be null
|
||||||
messages total_count:int32 messages:vector<message> = Messages;
|
messages total_count:int32 messages:vector<message> = Messages;
|
||||||
@ -2535,10 +2539,11 @@ notificationTypeNewCall call_id:int32 = NotificationType;
|
|||||||
//@description New message was received through a push notification
|
//@description New message was received through a push notification
|
||||||
//@message_id The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages and as reply_to_message_id
|
//@message_id The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages and as reply_to_message_id
|
||||||
//@sender_user_id Sender of the message; 0 if unknown. Corresponding user may be inaccessible
|
//@sender_user_id Sender of the message; 0 if unknown. Corresponding user may be inaccessible
|
||||||
|
//@sender_chat_id Sender chat of the message; 0 if none
|
||||||
//@sender_name Name of the sender; can be different from the name of the sender user
|
//@sender_name Name of the sender; can be different from the name of the sender user
|
||||||
//@is_outgoing True, if the message is outgoing
|
//@is_outgoing True, if the message is outgoing
|
||||||
//@content Push message content
|
//@content Push message content
|
||||||
notificationTypeNewPushMessage message_id:int53 sender_user_id:int32 sender_name:string is_outgoing:Bool content:PushMessageContent = NotificationType;
|
notificationTypeNewPushMessage message_id:int53 sender_user_id:int32 sender_chat_id:int53 sender_name:string is_outgoing:Bool content:PushMessageContent = NotificationType;
|
||||||
|
|
||||||
|
|
||||||
//@class NotificationGroupType @description Describes the type of notifications in a notification group
|
//@class NotificationGroupType @description Describes the type of notifications in a notification group
|
||||||
|
Binary file not shown.
@ -128,8 +128,8 @@ chatPhotoEmpty#37c1011c = ChatPhoto;
|
|||||||
chatPhoto#d20b9f3c flags:# has_video:flags.0?true photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto;
|
chatPhoto#d20b9f3c flags:# has_video:flags.0?true photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto;
|
||||||
|
|
||||||
messageEmpty#83e5de54 id:int = Message;
|
messageEmpty#83e5de54 id:int = Message;
|
||||||
message#8a7e027d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int reply_to_top_id:flags.24?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> = Message;
|
message#58ae39c9 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true id:int from_id:flags.8?Peer peer_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> = Message;
|
||||||
messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message;
|
messageService#286fa604 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction = Message;
|
||||||
|
|
||||||
messageMediaEmpty#3ded6320 = MessageMedia;
|
messageMediaEmpty#3ded6320 = MessageMedia;
|
||||||
messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
|
messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
|
||||||
@ -357,8 +357,8 @@ updates.differenceSlice#a8fb1981 new_messages:Vector<Message> new_encrypted_mess
|
|||||||
updates.differenceTooLong#4afe8f6d pts:int = updates.Difference;
|
updates.differenceTooLong#4afe8f6d pts:int = updates.Difference;
|
||||||
|
|
||||||
updatesTooLong#e317af7e = Updates;
|
updatesTooLong#e317af7e = Updates;
|
||||||
updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
|
updateShortMessage#2296d2c8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> = Updates;
|
||||||
updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector<MessageEntity> = Updates;
|
updateShortChatMessage#402d5dbb flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> = Updates;
|
||||||
updateShort#78d4dec1 update:Update date:int = Updates;
|
updateShort#78d4dec1 update:Update date:int = Updates;
|
||||||
updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
|
updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
|
||||||
updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
|
updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
|
||||||
@ -591,7 +591,7 @@ channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:
|
|||||||
|
|
||||||
channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant;
|
channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant;
|
||||||
channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant;
|
channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant;
|
||||||
channelParticipantCreator#808d15a4 flags:# user_id:int rank:flags.0?string = ChannelParticipant;
|
channelParticipantCreator#447dca4b flags:# user_id:int admin_rights:ChatAdminRights rank:flags.0?string = ChannelParticipant;
|
||||||
channelParticipantAdmin#ccbebbaf flags:# can_edit:flags.0?true self:flags.1?true user_id:int inviter_id:flags.1?int promoted_by:int date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant;
|
channelParticipantAdmin#ccbebbaf flags:# can_edit:flags.0?true self:flags.1?true user_id:int inviter_id:flags.1?int promoted_by:int date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant;
|
||||||
channelParticipantBanned#1c0facaf flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChatBannedRights = ChannelParticipant;
|
channelParticipantBanned#1c0facaf flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChatBannedRights = ChannelParticipant;
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_off
|
|||||||
|
|
||||||
exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
|
exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
|
||||||
|
|
||||||
messageFwdHeader#353a686b flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;
|
messageFwdHeader#5f777dce flags:# from_id:flags.0?Peer from_name:flags.5?string date:int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;
|
||||||
|
|
||||||
auth.codeTypeSms#72a3158c = auth.CodeType;
|
auth.codeTypeSms#72a3158c = auth.CodeType;
|
||||||
auth.codeTypeCall#741cd3e3 = auth.CodeType;
|
auth.codeTypeCall#741cd3e3 = auth.CodeType;
|
||||||
@ -1019,7 +1019,7 @@ chatOnlines#f041e250 onlines:int = ChatOnlines;
|
|||||||
|
|
||||||
statsURL#47a971e0 url:string = StatsURL;
|
statsURL#47a971e0 url:string = StatsURL;
|
||||||
|
|
||||||
chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true = ChatAdminRights;
|
chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true = ChatAdminRights;
|
||||||
|
|
||||||
chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true until_date:int = ChatBannedRights;
|
chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true until_date:int = ChatBannedRights;
|
||||||
|
|
||||||
@ -1147,8 +1147,6 @@ help.country#c3878e23 flags:# hidden:flags.0?true iso2:string default_name:strin
|
|||||||
help.countriesListNotModified#93cc1f32 = help.CountriesList;
|
help.countriesListNotModified#93cc1f32 = help.CountriesList;
|
||||||
help.countriesList#87d0759e countries:Vector<help.Country> hash:int = help.CountriesList;
|
help.countriesList#87d0759e countries:Vector<help.Country> hash:int = help.CountriesList;
|
||||||
|
|
||||||
messageReplies#82e3c815 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<int> channel_id:flags.0?int = MessageReplies;
|
|
||||||
|
|
||||||
messageViews#455b853d flags:# views:flags.0?int forwards:flags.1?int replies:flags.2?MessageReplies = MessageViews;
|
messageViews#455b853d flags:# views:flags.0?int forwards:flags.1?int replies:flags.2?MessageReplies = MessageViews;
|
||||||
|
|
||||||
messages.messageViews#2c3f2ae2 views:Vector<MessageViews> users:Vector<User> = messages.MessageViews;
|
messages.messageViews#2c3f2ae2 views:Vector<MessageViews> users:Vector<User> = messages.MessageViews;
|
||||||
@ -1157,6 +1155,10 @@ stats.messageStats#8999f295 views_graph:StatsGraph = stats.MessageStats;
|
|||||||
|
|
||||||
messages.discussionMessage#d25fad90 message:Message read_max_id:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
|
messages.discussionMessage#d25fad90 message:Message read_max_id:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
|
||||||
|
|
||||||
|
messageReplyHeader#a6d57763 flags:# reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader;
|
||||||
|
|
||||||
|
messageReplies#4128faac flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?int max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
@ -1289,7 +1291,7 @@ messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
|
|||||||
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
|
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
|
||||||
messages.sendMessage#520c3870 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
|
messages.sendMessage#520c3870 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
|
||||||
messages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
|
messages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int = Updates;
|
||||||
messages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true grouped:flags.9?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int = Updates;
|
messages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int = Updates;
|
||||||
messages.reportSpam#cf1592db peer:InputPeer = Bool;
|
messages.reportSpam#cf1592db peer:InputPeer = Bool;
|
||||||
messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings;
|
messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings;
|
||||||
messages.report#bd82b658 peer:InputPeer id:Vector<int> reason:ReportReason = Bool;
|
messages.report#bd82b658 peer:InputPeer id:Vector<int> reason:ReportReason = Bool;
|
||||||
|
Binary file not shown.
@ -158,7 +158,7 @@ tl_object_ptr<telegram_api::chatAdminRights> DialogParticipantStatus::get_chat_a
|
|||||||
LOG(INFO) << "Create chat admin rights " << flags;
|
LOG(INFO) << "Create chat admin rights " << flags;
|
||||||
return make_tl_object<telegram_api::chatAdminRights>(flags, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
return make_tl_object<telegram_api::chatAdminRights>(flags, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||||
false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||||
false /*ignored*/, false /*ignored*/);
|
false /*ignored*/, false /*ignored*/, false /*ignored*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
tl_object_ptr<telegram_api::chatBannedRights> DialogParticipantStatus::get_chat_banned_rights() const {
|
tl_object_ptr<telegram_api::chatBannedRights> DialogParticipantStatus::get_chat_banned_rights() const {
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
//
|
//
|
||||||
#include "td/telegram/MessageReplyInfo.h"
|
#include "td/telegram/MessageReplyInfo.h"
|
||||||
|
|
||||||
|
#include "td/telegram/DialogId.h"
|
||||||
|
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
@ -22,12 +24,14 @@ MessageReplyInfo::MessageReplyInfo(tl_object_ptr<telegram_api::messageReplies> &
|
|||||||
pts = reply_info->replies_pts_;
|
pts = reply_info->replies_pts_;
|
||||||
|
|
||||||
if (!is_bot) {
|
if (!is_bot) {
|
||||||
for (auto &user_id_int : reply_info->recent_repliers_) {
|
for (auto &peer : reply_info->recent_repliers_) {
|
||||||
UserId user_id(user_id_int);
|
DialogId dialog_id(peer);
|
||||||
if (user_id.is_valid()) {
|
if (dialog_id.is_valid()) {
|
||||||
recent_replier_user_ids.push_back(user_id);
|
if (dialog_id.get_type() == DialogType::User) {
|
||||||
|
recent_replier_user_ids.push_back(dialog_id.get_user_id());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG(ERROR) << "Receive " << user_id << " as a recent replier";
|
LOG(ERROR) << "Receive " << dialog_id << " as a recent replier";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,6 @@ struct MessageReplyInfo {
|
|||||||
|
|
||||||
template <class ParserT>
|
template <class ParserT>
|
||||||
void parse(ParserT &parser) {
|
void parse(ParserT &parser) {
|
||||||
CHECK(!is_empty());
|
|
||||||
bool has_recent_replier_user_ids = !recent_replier_user_ids.empty();
|
bool has_recent_replier_user_ids = !recent_replier_user_ids.empty();
|
||||||
bool has_channel_id = channel_id.is_valid();
|
bool has_channel_id = channel_id.is_valid();
|
||||||
BEGIN_PARSE_FLAGS();
|
BEGIN_PARSE_FLAGS();
|
||||||
|
@ -1583,6 +1583,7 @@ class SearchMessagesQuery : public Td::ResultHandler {
|
|||||||
int32 offset_;
|
int32 offset_;
|
||||||
int32 limit_;
|
int32 limit_;
|
||||||
MessageSearchFilter filter_;
|
MessageSearchFilter filter_;
|
||||||
|
MessageId top_thread_message_id_;
|
||||||
int64 random_id_;
|
int64 random_id_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -1606,6 +1607,7 @@ class SearchMessagesQuery : public Td::ResultHandler {
|
|||||||
offset_ = offset;
|
offset_ = offset;
|
||||||
limit_ = limit;
|
limit_ = limit;
|
||||||
filter_ = filter;
|
filter_ = filter;
|
||||||
|
top_thread_message_id_ = top_thread_message_id;
|
||||||
random_id_ = random_id;
|
random_id_ = random_id;
|
||||||
|
|
||||||
if (filter == MessageSearchFilter::UnreadMention) {
|
if (filter == MessageSearchFilter::UnreadMention) {
|
||||||
@ -1640,8 +1642,8 @@ class SearchMessagesQuery : public Td::ResultHandler {
|
|||||||
|
|
||||||
auto info = td->messages_manager_->on_get_messages(result_ptr.move_as_ok(), "SearchMessagesQuery");
|
auto info = td->messages_manager_->on_get_messages(result_ptr.move_as_ok(), "SearchMessagesQuery");
|
||||||
td->messages_manager_->on_get_dialog_messages_search_result(dialog_id_, query_, sender_user_id_, from_message_id_,
|
td->messages_manager_->on_get_dialog_messages_search_result(dialog_id_, query_, sender_user_id_, from_message_id_,
|
||||||
offset_, limit_, filter_, random_id_, info.total_count,
|
offset_, limit_, filter_, top_thread_message_id_,
|
||||||
std::move(info.messages));
|
random_id_, info.total_count, std::move(info.messages));
|
||||||
|
|
||||||
promise_.set_value(Unit());
|
promise_.set_value(Unit());
|
||||||
}
|
}
|
||||||
@ -4190,6 +4192,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
|||||||
bool has_forward_psa_type = is_forwarded && !forward_info->psa_type.empty();
|
bool has_forward_psa_type = is_forwarded && !forward_info->psa_type.empty();
|
||||||
bool has_forward_count = forward_count > 0;
|
bool has_forward_count = forward_count > 0;
|
||||||
bool has_reply_info = !reply_info.is_empty();
|
bool has_reply_info = !reply_info.is_empty();
|
||||||
|
bool has_sender_dialog_id = sender_dialog_id.is_valid();
|
||||||
BEGIN_STORE_FLAGS();
|
BEGIN_STORE_FLAGS();
|
||||||
STORE_FLAG(is_channel_post);
|
STORE_FLAG(is_channel_post);
|
||||||
STORE_FLAG(is_outgoing);
|
STORE_FLAG(is_outgoing);
|
||||||
@ -4240,6 +4243,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
|||||||
STORE_FLAG(has_forward_psa_type);
|
STORE_FLAG(has_forward_psa_type);
|
||||||
STORE_FLAG(has_forward_count);
|
STORE_FLAG(has_forward_count);
|
||||||
STORE_FLAG(has_reply_info);
|
STORE_FLAG(has_reply_info);
|
||||||
|
STORE_FLAG(has_sender_dialog_id);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4260,7 +4264,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
|||||||
if (is_forwarded) {
|
if (is_forwarded) {
|
||||||
store(forward_info->sender_user_id, storer);
|
store(forward_info->sender_user_id, storer);
|
||||||
store(forward_info->date, storer);
|
store(forward_info->date, storer);
|
||||||
store(forward_info->dialog_id, storer);
|
store(forward_info->sender_dialog_id, storer);
|
||||||
store(forward_info->message_id, storer);
|
store(forward_info->message_id, storer);
|
||||||
if (has_forward_author_signature) {
|
if (has_forward_author_signature) {
|
||||||
store(forward_info->author_signature, storer);
|
store(forward_info->author_signature, storer);
|
||||||
@ -4324,6 +4328,9 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
|||||||
if (has_restriction_reasons) {
|
if (has_restriction_reasons) {
|
||||||
store(restriction_reasons, storer);
|
store(restriction_reasons, storer);
|
||||||
}
|
}
|
||||||
|
if (has_sender_dialog_id) {
|
||||||
|
store(sender_dialog_id, storer);
|
||||||
|
}
|
||||||
store_message_content(content.get(), storer);
|
store_message_content(content.get(), storer);
|
||||||
if (has_reply_markup) {
|
if (has_reply_markup) {
|
||||||
store(reply_markup, storer);
|
store(reply_markup, storer);
|
||||||
@ -4359,6 +4366,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
|||||||
bool has_forward_psa_type = false;
|
bool has_forward_psa_type = false;
|
||||||
bool has_forward_count = false;
|
bool has_forward_count = false;
|
||||||
bool has_reply_info = false;
|
bool has_reply_info = false;
|
||||||
|
bool has_sender_dialog_id = false;
|
||||||
BEGIN_PARSE_FLAGS();
|
BEGIN_PARSE_FLAGS();
|
||||||
PARSE_FLAG(is_channel_post);
|
PARSE_FLAG(is_channel_post);
|
||||||
PARSE_FLAG(is_outgoing);
|
PARSE_FLAG(is_outgoing);
|
||||||
@ -4409,6 +4417,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
|||||||
PARSE_FLAG(has_forward_psa_type);
|
PARSE_FLAG(has_forward_psa_type);
|
||||||
PARSE_FLAG(has_forward_count);
|
PARSE_FLAG(has_forward_count);
|
||||||
PARSE_FLAG(has_reply_info);
|
PARSE_FLAG(has_reply_info);
|
||||||
|
PARSE_FLAG(has_sender_dialog_id);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4435,7 +4444,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
|||||||
forward_info = make_unique<MessageForwardInfo>();
|
forward_info = make_unique<MessageForwardInfo>();
|
||||||
parse(forward_info->sender_user_id, parser);
|
parse(forward_info->sender_user_id, parser);
|
||||||
parse(forward_info->date, parser);
|
parse(forward_info->date, parser);
|
||||||
parse(forward_info->dialog_id, parser);
|
parse(forward_info->sender_dialog_id, parser);
|
||||||
parse(forward_info->message_id, parser);
|
parse(forward_info->message_id, parser);
|
||||||
if (has_forward_author_signature) {
|
if (has_forward_author_signature) {
|
||||||
parse(forward_info->author_signature, parser);
|
parse(forward_info->author_signature, parser);
|
||||||
@ -4499,6 +4508,9 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
|||||||
if (has_restriction_reasons) {
|
if (has_restriction_reasons) {
|
||||||
parse(restriction_reasons, parser);
|
parse(restriction_reasons, parser);
|
||||||
}
|
}
|
||||||
|
if (has_sender_dialog_id) {
|
||||||
|
parse(sender_dialog_id, parser);
|
||||||
|
}
|
||||||
parse_message_content(content, parser);
|
parse_message_content(content, parser);
|
||||||
if (has_reply_markup) {
|
if (has_reply_markup) {
|
||||||
parse(reply_markup, parser);
|
parse(reply_markup, parser);
|
||||||
@ -8642,12 +8654,14 @@ void MessagesManager::on_failed_public_dialogs_search(const string &query, Statu
|
|||||||
void MessagesManager::on_get_dialog_messages_search_result(DialogId dialog_id, const string &query,
|
void MessagesManager::on_get_dialog_messages_search_result(DialogId dialog_id, const string &query,
|
||||||
UserId sender_user_id, MessageId from_message_id,
|
UserId sender_user_id, MessageId from_message_id,
|
||||||
int32 offset, int32 limit, MessageSearchFilter filter,
|
int32 offset, int32 limit, MessageSearchFilter filter,
|
||||||
int64 random_id, int32 total_count,
|
MessageId top_thread_message_id, int64 random_id,
|
||||||
|
int32 total_count,
|
||||||
vector<tl_object_ptr<telegram_api::Message>> &&messages) {
|
vector<tl_object_ptr<telegram_api::Message>> &&messages) {
|
||||||
LOG(INFO) << "Receive " << messages.size() << " found messages in " << dialog_id;
|
LOG(INFO) << "Receive " << messages.size() << " found messages in " << dialog_id;
|
||||||
if (!dialog_id.is_valid()) {
|
if (!dialog_id.is_valid()) {
|
||||||
CHECK(query.empty());
|
CHECK(query.empty());
|
||||||
CHECK(!sender_user_id.is_valid());
|
CHECK(!sender_user_id.is_valid());
|
||||||
|
CHECK(!top_thread_message_id.is_valid());
|
||||||
auto it = found_call_messages_.find(random_id);
|
auto it = found_call_messages_.find(random_id);
|
||||||
CHECK(it != found_call_messages_.end());
|
CHECK(it != found_call_messages_.end());
|
||||||
|
|
||||||
@ -8753,7 +8767,7 @@ void MessagesManager::on_get_dialog_messages_search_result(DialogId dialog_id, c
|
|||||||
total_count = static_cast<int32>(result.size());
|
total_count = static_cast<int32>(result.size());
|
||||||
}
|
}
|
||||||
if (query.empty() && !sender_user_id.is_valid() && filter != MessageSearchFilter::Empty &&
|
if (query.empty() && !sender_user_id.is_valid() && filter != MessageSearchFilter::Empty &&
|
||||||
G()->parameters().use_message_db) {
|
!top_thread_message_id.is_valid() && G()->parameters().use_message_db) {
|
||||||
bool update_dialog = false;
|
bool update_dialog = false;
|
||||||
|
|
||||||
auto &old_message_count = d->message_count_by_index[message_search_filter_index(filter)];
|
auto &old_message_count = d->message_count_by_index[message_search_filter_index(filter)];
|
||||||
@ -9086,7 +9100,7 @@ bool MessagesManager::can_get_message_statistics(DialogId dialog_id, const Messa
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m == nullptr || m->message_id.is_scheduled() || !m->message_id.is_server() || m->view_count == 0 ||
|
if (m == nullptr || m->message_id.is_scheduled() || !m->message_id.is_server() || m->view_count == 0 ||
|
||||||
m->had_forward_info || (m->forward_info != nullptr && m->forward_info->dialog_id.is_valid())) {
|
m->had_forward_info || (m->forward_info != nullptr && m->forward_info->message_id.is_valid())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return td_->contacts_manager_->can_get_channel_message_statistics(dialog_id);
|
return td_->contacts_manager_->can_get_channel_message_statistics(dialog_id);
|
||||||
@ -10797,37 +10811,21 @@ MessageId MessagesManager::get_message_id(const tl_object_ptr<telegram_api::Mess
|
|||||||
}
|
}
|
||||||
|
|
||||||
DialogId MessagesManager::get_message_dialog_id(const tl_object_ptr<telegram_api::Message> &message_ptr) const {
|
DialogId MessagesManager::get_message_dialog_id(const tl_object_ptr<telegram_api::Message> &message_ptr) const {
|
||||||
DialogId dialog_id;
|
|
||||||
UserId sender_user_id;
|
|
||||||
switch (message_ptr->get_id()) {
|
switch (message_ptr->get_id()) {
|
||||||
case telegram_api::messageEmpty::ID:
|
case telegram_api::messageEmpty::ID:
|
||||||
return DialogId();
|
return DialogId();
|
||||||
case telegram_api::message::ID: {
|
case telegram_api::message::ID: {
|
||||||
auto message = static_cast<const telegram_api::message *>(message_ptr.get());
|
auto message = static_cast<const telegram_api::message *>(message_ptr.get());
|
||||||
dialog_id = DialogId(message->to_id_);
|
return DialogId(message->peer_id_);
|
||||||
if (message->flags_ & MESSAGE_FLAG_HAS_FROM_ID) {
|
|
||||||
sender_user_id = UserId(message->from_id_);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case telegram_api::messageService::ID: {
|
case telegram_api::messageService::ID: {
|
||||||
auto message = static_cast<const telegram_api::messageService *>(message_ptr.get());
|
auto message = static_cast<const telegram_api::messageService *>(message_ptr.get());
|
||||||
dialog_id = DialogId(message->to_id_);
|
return DialogId(message->peer_id_);
|
||||||
if (message->flags_ & MESSAGE_FLAG_HAS_FROM_ID) {
|
|
||||||
sender_user_id = UserId(message->from_id_);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
break;
|
return DialogId();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialog_id == get_my_dialog_id()) {
|
|
||||||
LOG_IF(ERROR, !sender_user_id.is_valid()) << "Receive invalid " << sender_user_id;
|
|
||||||
return DialogId(sender_user_id);
|
|
||||||
}
|
|
||||||
return dialog_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FullMessageId MessagesManager::get_full_message_id(const tl_object_ptr<telegram_api::Message> &message_ptr,
|
FullMessageId MessagesManager::get_full_message_id(const tl_object_ptr<telegram_api::Message> &message_ptr,
|
||||||
@ -11974,22 +11972,6 @@ void MessagesManager::finish_add_secret_message(unique_ptr<PendingSecretMessage>
|
|||||||
pending_secret_message->success_promise.set_value(Unit()); // TODO: set after message is saved
|
pending_secret_message->success_promise.set_value(Unit()); // TODO: set after message is saved
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::fix_message_info_dialog_id(MessageInfo &message_info) const {
|
|
||||||
if (message_info.dialog_id != get_my_dialog_id()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserId sender_user_id = message_info.sender_user_id;
|
|
||||||
if (!sender_user_id.is_valid()) {
|
|
||||||
LOG(ERROR) << "Receive invalid sender user id in private chat";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
message_info.dialog_id = DialogId(sender_user_id);
|
|
||||||
LOG_IF(ERROR, !message_info.message_id.is_scheduled() && (message_info.flags & MESSAGE_FLAG_IS_OUT) != 0)
|
|
||||||
<< "Receive message out flag for incoming " << message_info.message_id << " in " << message_info.dialog_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
||||||
tl_object_ptr<telegram_api::Message> message_ptr, bool is_scheduled, const char *source) const {
|
tl_object_ptr<telegram_api::Message> message_ptr, bool is_scheduled, const char *source) const {
|
||||||
LOG(DEBUG) << "Receive from " << source << " " << to_string(message_ptr);
|
LOG(DEBUG) << "Receive from " << source << " " << to_string(message_ptr);
|
||||||
@ -12004,14 +11986,13 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
|||||||
case telegram_api::message::ID: {
|
case telegram_api::message::ID: {
|
||||||
auto message = move_tl_object_as<telegram_api::message>(message_ptr);
|
auto message = move_tl_object_as<telegram_api::message>(message_ptr);
|
||||||
|
|
||||||
message_info.dialog_id = DialogId(message->to_id_);
|
message_info.dialog_id = DialogId(message->peer_id_);
|
||||||
if (message->flags_ & MESSAGE_FLAG_HAS_FROM_ID) {
|
if (message->flags_ & MESSAGE_FLAG_HAS_FROM_ID) {
|
||||||
message_info.sender_user_id = UserId(message->from_id_);
|
message_info.sender_dialog_id = DialogId(message->from_id_);
|
||||||
}
|
}
|
||||||
message_info.date = message->date_;
|
message_info.date = message->date_;
|
||||||
message_info.forward_header = std::move(message->fwd_from_);
|
message_info.forward_header = std::move(message->fwd_from_);
|
||||||
message_info.reply_to_message_id = MessageId(ServerMessageId(
|
message_info.reply_header = std::move(message->reply_to_);
|
||||||
message->flags_ & MESSAGE_FLAG_IS_REPLY ? message->reply_to_msg_id_ : 0)); // TODO zero init in fetch
|
|
||||||
if (message->flags_ & MESSAGE_FLAG_IS_SENT_VIA_BOT) {
|
if (message->flags_ & MESSAGE_FLAG_IS_SENT_VIA_BOT) {
|
||||||
message_info.via_bot_user_id = UserId(message->via_bot_id_);
|
message_info.via_bot_user_id = UserId(message->via_bot_id_);
|
||||||
if (!message_info.via_bot_user_id.is_valid()) {
|
if (!message_info.via_bot_user_id.is_valid()) {
|
||||||
@ -12033,7 +12014,6 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
|||||||
message_info.media_album_id = message->grouped_id_;
|
message_info.media_album_id = message->grouped_id_;
|
||||||
}
|
}
|
||||||
message_info.flags = message->flags_;
|
message_info.flags = message->flags_;
|
||||||
fix_message_info_dialog_id(message_info);
|
|
||||||
bool is_content_read = (message->flags_ & MESSAGE_FLAG_HAS_UNREAD_CONTENT) == 0;
|
bool is_content_read = (message->flags_ & MESSAGE_FLAG_HAS_UNREAD_CONTENT) == 0;
|
||||||
if (is_message_auto_read(message_info.dialog_id, (message->flags_ & MESSAGE_FLAG_IS_OUT) != 0)) {
|
if (is_message_auto_read(message_info.dialog_id, (message->flags_ & MESSAGE_FLAG_IS_OUT) != 0)) {
|
||||||
is_content_read = true;
|
is_content_read = true;
|
||||||
@ -12059,15 +12039,15 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
|||||||
case telegram_api::messageService::ID: {
|
case telegram_api::messageService::ID: {
|
||||||
auto message = move_tl_object_as<telegram_api::messageService>(message_ptr);
|
auto message = move_tl_object_as<telegram_api::messageService>(message_ptr);
|
||||||
|
|
||||||
message_info.dialog_id = DialogId(message->to_id_);
|
message_info.dialog_id = DialogId(message->peer_id_);
|
||||||
if (message->flags_ & MESSAGE_FLAG_HAS_FROM_ID) {
|
if (message->flags_ & MESSAGE_FLAG_HAS_FROM_ID) {
|
||||||
message_info.sender_user_id = UserId(message->from_id_);
|
message_info.sender_dialog_id = DialogId(message->from_id_);
|
||||||
}
|
}
|
||||||
message_info.date = message->date_;
|
message_info.date = message->date_;
|
||||||
message_info.flags = message->flags_;
|
message_info.flags = message->flags_;
|
||||||
fix_message_info_dialog_id(message_info);
|
message_info.reply_header = std::move(message->reply_to_);
|
||||||
MessageId reply_to_message_id = MessageId(ServerMessageId(
|
auto reply_to_message_id = MessageId(
|
||||||
message->flags_ & MESSAGE_FLAG_IS_REPLY ? message->reply_to_msg_id_ : 0)); // TODO zero init in fetch
|
ServerMessageId(message_info.reply_header == nullptr ? 0 : message_info.reply_header->reply_to_msg_id_));
|
||||||
message_info.content =
|
message_info.content =
|
||||||
get_action_message_content(td_, std::move(message->action_), message_info.dialog_id, reply_to_message_id);
|
get_action_message_content(td_, std::move(message->action_), message_info.dialog_id, reply_to_message_id);
|
||||||
break;
|
break;
|
||||||
@ -12076,6 +12056,10 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
|
|||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (message_info.sender_dialog_id.is_valid() && message_info.sender_dialog_id.get_type() == DialogType::User) {
|
||||||
|
message_info.sender_user_id = message_info.sender_dialog_id.get_user_id();
|
||||||
|
message_info.sender_dialog_id = DialogId();
|
||||||
|
}
|
||||||
return message_info;
|
return message_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12098,6 +12082,7 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
|
|
||||||
auto dialog_type = dialog_id.get_type();
|
auto dialog_type = dialog_id.get_type();
|
||||||
UserId sender_user_id = message_info.sender_user_id;
|
UserId sender_user_id = message_info.sender_user_id;
|
||||||
|
DialogId sender_dialog_id = message_info.sender_dialog_id;
|
||||||
if (!sender_user_id.is_valid()) {
|
if (!sender_user_id.is_valid()) {
|
||||||
if (!is_broadcast_channel(dialog_id) && td_->auth_manager_->is_bot()) {
|
if (!is_broadcast_channel(dialog_id) && td_->auth_manager_->is_bot()) {
|
||||||
sender_user_id = td_->contacts_manager_->get_service_notifications_user_id();
|
sender_user_id = td_->contacts_manager_->get_service_notifications_user_id();
|
||||||
@ -12106,6 +12091,16 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
sender_user_id = UserId();
|
sender_user_id = UserId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (sender_dialog_id.is_valid()) {
|
||||||
|
CHECK(!sender_user_id.is_valid());
|
||||||
|
if (dialog_type == DialogType::User || dialog_type == DialogType::SecretChat) {
|
||||||
|
LOG(ERROR) << "Receive " << message_id << " sent by " << sender_dialog_id << " in " << dialog_id;
|
||||||
|
return {DialogId(), nullptr};
|
||||||
|
}
|
||||||
|
} else if (sender_dialog_id != DialogId()) {
|
||||||
|
LOG(ERROR) << "Receive invalid " << sender_dialog_id;
|
||||||
|
sender_dialog_id = DialogId();
|
||||||
|
}
|
||||||
if (message_id.is_scheduled()) {
|
if (message_id.is_scheduled()) {
|
||||||
is_channel_message = (dialog_type == DialogType::Channel);
|
is_channel_message = (dialog_type == DialogType::Channel);
|
||||||
}
|
}
|
||||||
@ -12125,9 +12120,11 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
|
|
||||||
UserId my_id = td_->contacts_manager_->get_my_id();
|
UserId my_id = td_->contacts_manager_->get_my_id();
|
||||||
DialogId my_dialog_id = DialogId(my_id);
|
DialogId my_dialog_id = DialogId(my_id);
|
||||||
if (dialog_id == my_dialog_id) {
|
if (dialog_id == my_dialog_id && (sender_user_id != my_id || sender_dialog_id.is_valid())) {
|
||||||
// dialog_id should be already fixed
|
LOG(ERROR) << "Receive " << sender_user_id << "/" << sender_dialog_id << " as a sender of " << message_id
|
||||||
CHECK(sender_user_id == my_id);
|
<< " instead of self";
|
||||||
|
sender_user_id = my_id;
|
||||||
|
sender_dialog_id = DialogId();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supposed_to_be_outgoing = sender_user_id == my_id && !(dialog_id == my_dialog_id && !message_id.is_scheduled());
|
bool supposed_to_be_outgoing = sender_user_id == my_id && !(dialog_id == my_dialog_id && !message_id.is_scheduled());
|
||||||
@ -12148,15 +12145,32 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
}
|
}
|
||||||
|
|
||||||
MessageId reply_to_message_id = message_info.reply_to_message_id;
|
MessageId reply_to_message_id = message_info.reply_to_message_id;
|
||||||
|
DialogId reply_in_dialog_id;
|
||||||
|
if (message_info.reply_header != nullptr) {
|
||||||
|
reply_to_message_id = MessageId(ServerMessageId(message_info.reply_header->reply_to_msg_id_));
|
||||||
|
auto reply_to_peer_id = std::move(message_info.reply_header->reply_to_peer_id_);
|
||||||
|
if (reply_to_peer_id != nullptr) {
|
||||||
|
reply_in_dialog_id = DialogId(reply_to_peer_id);
|
||||||
|
if (!reply_in_dialog_id.is_valid()) {
|
||||||
|
LOG(ERROR) << " Receive reply in invalid " << to_string(reply_to_peer_id);
|
||||||
|
reply_to_message_id = MessageId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
CHECK(!reply_to_message_id.is_scheduled());
|
CHECK(!reply_to_message_id.is_scheduled());
|
||||||
if (!message_id.is_scheduled() && reply_to_message_id != MessageId() &&
|
if (reply_to_message_id != MessageId()) {
|
||||||
(!reply_to_message_id.is_valid() || reply_to_message_id >= message_id)) {
|
if (!reply_to_message_id.is_valid()) {
|
||||||
if (!reply_to_message_id.is_valid() ||
|
LOG(ERROR) << "Receive reply to " << reply_to_message_id << " for " << message_id << " in " << dialog_id;
|
||||||
reply_to_message_id.get() - message_id.get() <= MessageId(ServerMessageId(2000000000)).get()) {
|
reply_to_message_id = MessageId();
|
||||||
|
} else {
|
||||||
|
if (!message_id.is_scheduled() && !reply_in_dialog_id.is_valid() && reply_to_message_id >= message_id) {
|
||||||
|
if (reply_to_message_id.get() - message_id.get() <= MessageId(ServerMessageId(2000000000)).get()) {
|
||||||
LOG(ERROR) << "Receive reply to wrong " << reply_to_message_id << " in " << message_id;
|
LOG(ERROR) << "Receive reply to wrong " << reply_to_message_id << " in " << message_id;
|
||||||
}
|
}
|
||||||
reply_to_message_id = MessageId();
|
reply_to_message_id = MessageId();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UserId via_bot_user_id = message_info.via_bot_user_id;
|
UserId via_bot_user_id = message_info.via_bot_user_id;
|
||||||
if (!via_bot_user_id.is_valid()) {
|
if (!via_bot_user_id.is_valid()) {
|
||||||
@ -12206,11 +12220,12 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
|
|
||||||
bool has_forward_info = message_info.forward_header != nullptr;
|
bool has_forward_info = message_info.forward_header != nullptr;
|
||||||
|
|
||||||
LOG(INFO) << "Receive " << message_id << " in " << dialog_id << " from " << sender_user_id;
|
LOG(INFO) << "Receive " << message_id << " in " << dialog_id << " from " << sender_user_id << "/" << sender_dialog_id;
|
||||||
|
|
||||||
auto message = make_unique<Message>();
|
auto message = make_unique<Message>();
|
||||||
set_message_id(message, message_id);
|
set_message_id(message, message_id);
|
||||||
message->sender_user_id = sender_user_id;
|
message->sender_user_id = sender_user_id;
|
||||||
|
message->sender_dialog_id = sender_dialog_id;
|
||||||
message->date = date;
|
message->date = date;
|
||||||
message->ttl = ttl;
|
message->ttl = ttl;
|
||||||
message->edit_date = edit_date;
|
message->edit_date = edit_date;
|
||||||
@ -12359,7 +12374,8 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, bool f
|
|||||||
|
|
||||||
if (!new_message->is_outgoing && dialog_id != get_my_dialog_id()) {
|
if (!new_message->is_outgoing && dialog_id != get_my_dialog_id()) {
|
||||||
// sent message is not from me
|
// sent message is not from me
|
||||||
LOG(ERROR) << "Sent in " << dialog_id << " " << message_id << " is sent by " << new_message->sender_user_id;
|
LOG(ERROR) << "Sent in " << dialog_id << " " << message_id << " is sent by " << new_message->sender_user_id << "/"
|
||||||
|
<< new_message->sender_dialog_id;
|
||||||
return FullMessageId();
|
return FullMessageId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20323,11 +20339,12 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
|
|||||||
auto edit_date = m->hide_edit_date ? 0 : m->edit_date;
|
auto edit_date = m->hide_edit_date ? 0 : m->edit_date;
|
||||||
return make_tl_object<td_api::message>(
|
return make_tl_object<td_api::message>(
|
||||||
m->message_id.get(), td_->contacts_manager_->get_user_id_object(m->sender_user_id, "sender_user_id"),
|
m->message_id.get(), td_->contacts_manager_->get_user_id_object(m->sender_user_id, "sender_user_id"),
|
||||||
dialog_id.get(), std::move(sending_state), std::move(scheduling_state), is_outgoing, can_be_edited,
|
m->sender_dialog_id.get(), dialog_id.get(), std::move(sending_state), std::move(scheduling_state), is_outgoing,
|
||||||
can_be_forwarded, can_delete_for_self, can_delete_for_all_users, can_get_statistics, can_get_replies,
|
can_be_edited, can_be_forwarded, can_delete_for_self, can_delete_for_all_users, can_get_statistics,
|
||||||
m->is_channel_post, contains_unread_mention, date, edit_date, get_message_forward_info_object(m->forward_info),
|
can_get_replies, m->is_channel_post, contains_unread_mention, date, edit_date,
|
||||||
get_message_interaction_info_object(dialog_id, m), reply_to_message_id, ttl, ttl_expires_in, via_bot_user_id,
|
get_message_forward_info_object(m->forward_info), get_message_interaction_info_object(dialog_id, m),
|
||||||
m->author_signature, media_album_id, get_restriction_reason_description(m->restriction_reasons),
|
reply_to_message_id, ttl, ttl_expires_in, via_bot_user_id, m->author_signature, media_album_id,
|
||||||
|
get_restriction_reason_description(m->restriction_reasons),
|
||||||
get_message_content_object(m->content.get(), td_, live_location_date, m->is_content_secret),
|
get_message_content_object(m->content.get(), td_, live_location_date, m->is_content_secret),
|
||||||
get_reply_markup_object(m->reply_markup));
|
get_reply_markup_object(m->reply_markup));
|
||||||
}
|
}
|
||||||
@ -20844,11 +20861,15 @@ bool MessagesManager::is_message_auto_read(DialogId dialog_id, bool is_outgoing)
|
|||||||
|
|
||||||
void MessagesManager::add_message_dependencies(Dependencies &dependencies, DialogId dialog_id, const Message *m) {
|
void MessagesManager::add_message_dependencies(Dependencies &dependencies, DialogId dialog_id, const Message *m) {
|
||||||
dependencies.user_ids.insert(m->sender_user_id);
|
dependencies.user_ids.insert(m->sender_user_id);
|
||||||
|
if (m->sender_dialog_id.is_valid() && dependencies.dialog_ids.insert(m->sender_dialog_id).second) {
|
||||||
|
add_dialog_dependencies(dependencies, m->sender_dialog_id);
|
||||||
|
}
|
||||||
dependencies.user_ids.insert(m->via_bot_user_id);
|
dependencies.user_ids.insert(m->via_bot_user_id);
|
||||||
if (m->forward_info != nullptr) {
|
if (m->forward_info != nullptr) {
|
||||||
dependencies.user_ids.insert(m->forward_info->sender_user_id);
|
dependencies.user_ids.insert(m->forward_info->sender_user_id);
|
||||||
if (m->forward_info->dialog_id.is_valid() && dependencies.dialog_ids.insert(m->forward_info->dialog_id).second) {
|
if (m->forward_info->sender_dialog_id.is_valid() &&
|
||||||
add_dialog_dependencies(dependencies, m->forward_info->dialog_id);
|
dependencies.dialog_ids.insert(m->forward_info->sender_dialog_id).second) {
|
||||||
|
add_dialog_dependencies(dependencies, m->forward_info->sender_dialog_id);
|
||||||
}
|
}
|
||||||
if (m->forward_info->from_dialog_id.is_valid() &&
|
if (m->forward_info->from_dialog_id.is_valid() &&
|
||||||
dependencies.dialog_ids.insert(m->forward_info->from_dialog_id).second) {
|
dependencies.dialog_ids.insert(m->forward_info->from_dialog_id).second) {
|
||||||
@ -23081,7 +23102,7 @@ bool MessagesManager::is_forward_info_sender_hidden(const MessageForwardInfo *fo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
DialogId hidden_sender_dialog_id(static_cast<int64>(G()->is_test_dc() ? -1000010460537ll : -1001228946795ll));
|
DialogId hidden_sender_dialog_id(static_cast<int64>(G()->is_test_dc() ? -1000010460537ll : -1001228946795ll));
|
||||||
return forward_info->dialog_id == hidden_sender_dialog_id && !forward_info->author_signature.empty() &&
|
return forward_info->sender_dialog_id == hidden_sender_dialog_id && !forward_info->author_signature.empty() &&
|
||||||
!forward_info->message_id.is_valid();
|
!forward_info->message_id.is_valid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23097,24 +23118,17 @@ unique_ptr<MessagesManager::MessageForwardInfo> MessagesManager::get_message_for
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto flags = forward_header->flags_;
|
auto flags = forward_header->flags_;
|
||||||
UserId sender_user_id;
|
DialogId sender_dialog_id;
|
||||||
ChannelId channel_id;
|
|
||||||
MessageId message_id;
|
MessageId message_id;
|
||||||
string author_signature;
|
string author_signature;
|
||||||
DialogId from_dialog_id;
|
DialogId from_dialog_id;
|
||||||
MessageId from_message_id;
|
MessageId from_message_id;
|
||||||
string sender_name;
|
string sender_name;
|
||||||
if ((flags & telegram_api::messageFwdHeader::FROM_ID_MASK) != 0) {
|
if ((flags & telegram_api::messageFwdHeader::FROM_ID_MASK) != 0) {
|
||||||
sender_user_id = UserId(forward_header->from_id_);
|
sender_dialog_id = DialogId(forward_header->from_id_);
|
||||||
if (!sender_user_id.is_valid()) {
|
if (!sender_dialog_id.is_valid()) {
|
||||||
LOG(ERROR) << "Receive invalid sender id in message forward header: " << oneline(to_string(forward_header));
|
LOG(ERROR) << "Receive invalid sender id in message forward header: " << oneline(to_string(forward_header));
|
||||||
sender_user_id = UserId();
|
sender_dialog_id = DialogId();
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((flags & telegram_api::messageFwdHeader::CHANNEL_ID_MASK) != 0) {
|
|
||||||
channel_id = ChannelId(forward_header->channel_id_);
|
|
||||||
if (!channel_id.is_valid()) {
|
|
||||||
LOG(ERROR) << "Receive invalid channel id in message forward header: " << oneline(to_string(forward_header));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
constexpr int32 MESSAGE_FORWARD_HEADER_FLAG_HAS_MESSAGE_ID = telegram_api::messageFwdHeader::CHANNEL_POST_MASK;
|
constexpr int32 MESSAGE_FORWARD_HEADER_FLAG_HAS_MESSAGE_ID = telegram_api::messageFwdHeader::CHANNEL_POST_MASK;
|
||||||
@ -23143,8 +23157,12 @@ unique_ptr<MessagesManager::MessageForwardInfo> MessagesManager::get_message_for
|
|||||||
sender_name = std::move(forward_header->from_name_);
|
sender_name = std::move(forward_header->from_name_);
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogId dialog_id;
|
UserId sender_user_id;
|
||||||
if (!channel_id.is_valid()) {
|
if (sender_dialog_id.get_type() == DialogType::User) {
|
||||||
|
sender_user_id = sender_dialog_id.get_user_id();
|
||||||
|
sender_dialog_id = DialogId();
|
||||||
|
}
|
||||||
|
if (!sender_dialog_id.is_valid()) {
|
||||||
if (sender_user_id.is_valid()) {
|
if (sender_user_id.is_valid()) {
|
||||||
if (message_id.is_valid()) {
|
if (message_id.is_valid()) {
|
||||||
LOG(ERROR) << "Receive non-empty message identifier in message forward header: "
|
LOG(ERROR) << "Receive non-empty message identifier in message forward header: "
|
||||||
@ -23155,20 +23173,21 @@ unique_ptr<MessagesManager::MessageForwardInfo> MessagesManager::get_message_for
|
|||||||
LOG(ERROR) << "Receive wrong message forward header: " << oneline(to_string(forward_header));
|
LOG(ERROR) << "Receive wrong message forward header: " << oneline(to_string(forward_header));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
} else if (sender_dialog_id.get_type() != DialogType::Channel) {
|
||||||
|
LOG(ERROR) << "Receive wrong message forward header with non-channel sender: "
|
||||||
|
<< oneline(to_string(forward_header));
|
||||||
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
LOG_IF(ERROR, td_->contacts_manager_->have_min_channel(channel_id)) << "Receive forward from min channel";
|
auto channel_id = sender_dialog_id.get_channel_id();
|
||||||
dialog_id = DialogId(channel_id);
|
LOG_IF(ERROR, td_->contacts_manager_->have_min_channel(channel_id)) << "Receive forward from min " << channel_id;
|
||||||
force_create_dialog(dialog_id, "message forward info", true);
|
force_create_dialog(sender_dialog_id, "message forward info", true);
|
||||||
if (sender_user_id.is_valid()) {
|
CHECK(!sender_user_id.is_valid());
|
||||||
LOG(ERROR) << "Receive valid sender user id in message forward header: " << oneline(to_string(forward_header));
|
|
||||||
sender_user_id = UserId();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (from_dialog_id.is_valid()) {
|
if (from_dialog_id.is_valid()) {
|
||||||
force_create_dialog(from_dialog_id, "message forward from info", true);
|
force_create_dialog(from_dialog_id, "message forward from info", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return td::make_unique<MessageForwardInfo>(sender_user_id, forward_header->date_, dialog_id, message_id,
|
return td::make_unique<MessageForwardInfo>(sender_user_id, forward_header->date_, sender_dialog_id, message_id,
|
||||||
std::move(author_signature), std::move(sender_name), from_dialog_id,
|
std::move(author_signature), std::move(sender_name), from_dialog_id,
|
||||||
from_message_id, std::move(forward_header->psa_type_));
|
from_message_id, std::move(forward_header->psa_type_));
|
||||||
}
|
}
|
||||||
@ -23184,9 +23203,12 @@ td_api::object_ptr<td_api::messageForwardInfo> MessagesManager::get_message_forw
|
|||||||
return td_api::make_object<td_api::messageForwardOriginHiddenUser>(
|
return td_api::make_object<td_api::messageForwardOriginHiddenUser>(
|
||||||
forward_info->sender_name.empty() ? forward_info->author_signature : forward_info->sender_name);
|
forward_info->sender_name.empty() ? forward_info->author_signature : forward_info->sender_name);
|
||||||
}
|
}
|
||||||
if (forward_info->dialog_id.is_valid()) {
|
if (forward_info->message_id.is_valid()) {
|
||||||
return td_api::make_object<td_api::messageForwardOriginChannel>(
|
return td_api::make_object<td_api::messageForwardOriginChannel>(
|
||||||
forward_info->dialog_id.get(), forward_info->message_id.get(), forward_info->author_signature);
|
forward_info->sender_dialog_id.get(), forward_info->message_id.get(), forward_info->author_signature);
|
||||||
|
}
|
||||||
|
if (forward_info->sender_dialog_id.is_valid()) {
|
||||||
|
return td_api::make_object<td_api::messageForwardOriginChat>(forward_info->sender_dialog_id.get());
|
||||||
}
|
}
|
||||||
return td_api::make_object<td_api::messageForwardOriginUser>(
|
return td_api::make_object<td_api::messageForwardOriginUser>(
|
||||||
td_->contacts_manager_->get_user_id_object(forward_info->sender_user_id, "messageForwardOriginUser"));
|
td_->contacts_manager_->get_user_id_object(forward_info->sender_user_id, "messageForwardOriginUser"));
|
||||||
@ -23452,10 +23474,10 @@ Result<vector<MessageId>> MessagesManager::forward_messages(DialogId to_dialog_i
|
|||||||
} else {
|
} else {
|
||||||
LOG(ERROR) << "Don't know how to forward a channel post not from a channel";
|
LOG(ERROR) << "Don't know how to forward a channel post not from a channel";
|
||||||
}
|
}
|
||||||
} else if (forwarded_message->sender_user_id.is_valid()) {
|
} else if (forwarded_message->sender_user_id.is_valid() || forwarded_message->sender_dialog_id.is_valid()) {
|
||||||
forward_info =
|
forward_info = make_unique<MessageForwardInfo>(forwarded_message->sender_user_id, forwarded_message->date,
|
||||||
make_unique<MessageForwardInfo>(forwarded_message->sender_user_id, forwarded_message->date, DialogId(),
|
forwarded_message->sender_dialog_id, MessageId(), "", "",
|
||||||
MessageId(), "", "", saved_from_dialog_id, saved_from_message_id, "");
|
saved_from_dialog_id, saved_from_message_id, "");
|
||||||
} else {
|
} else {
|
||||||
LOG(ERROR) << "Don't know how to forward a non-channel post message without forward info and sender";
|
LOG(ERROR) << "Don't know how to forward a non-channel post message without forward info and sender";
|
||||||
}
|
}
|
||||||
@ -24061,8 +24083,8 @@ NotificationGroupId MessagesManager::get_dialog_notification_group_id(DialogId d
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<MessagesManager::MessagePushNotificationInfo> MessagesManager::get_message_push_notification_info(
|
Result<MessagesManager::MessagePushNotificationInfo> MessagesManager::get_message_push_notification_info(
|
||||||
DialogId dialog_id, MessageId message_id, int64 random_id, UserId sender_user_id, int32 date,
|
DialogId dialog_id, MessageId message_id, int64 random_id, UserId sender_user_id, DialogId sender_dialog_id,
|
||||||
bool is_from_scheduled, bool contains_mention, bool is_pinned, bool is_from_binlog) {
|
int32 date, bool is_from_scheduled, bool contains_mention, bool is_pinned, bool is_from_binlog) {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (!is_from_scheduled && dialog_id == get_my_dialog_id()) {
|
if (!is_from_scheduled && dialog_id == get_my_dialog_id()) {
|
||||||
@ -24076,6 +24098,9 @@ Result<MessagesManager::MessagePushNotificationInfo> MessagesManager::get_messag
|
|||||||
if (d == nullptr) {
|
if (d == nullptr) {
|
||||||
return Status::Error(406, "Ignore notification in unknown chat");
|
return Status::Error(406, "Ignore notification in unknown chat");
|
||||||
}
|
}
|
||||||
|
if (sender_dialog_id.is_valid() && !have_dialog_force(sender_dialog_id)) {
|
||||||
|
return Status::Error(406, "Ignore notification sent by unknown chat");
|
||||||
|
}
|
||||||
|
|
||||||
if (is_from_scheduled && dialog_id != get_my_dialog_id() &&
|
if (is_from_scheduled && dialog_id != get_my_dialog_id() &&
|
||||||
G()->shared_config().get_option_boolean("disable_sent_scheduled_message_notifications")) {
|
G()->shared_config().get_option_boolean("disable_sent_scheduled_message_notifications")) {
|
||||||
@ -24122,9 +24147,14 @@ Result<MessagesManager::MessagePushNotificationInfo> MessagesManager::get_messag
|
|||||||
|
|
||||||
DialogId settings_dialog_id = dialog_id;
|
DialogId settings_dialog_id = dialog_id;
|
||||||
Dialog *settings_dialog = d;
|
Dialog *settings_dialog = d;
|
||||||
if (contains_mention && sender_user_id.is_valid()) {
|
if (contains_mention) {
|
||||||
|
if (sender_user_id.is_valid()) {
|
||||||
settings_dialog_id = DialogId(sender_user_id);
|
settings_dialog_id = DialogId(sender_user_id);
|
||||||
settings_dialog = get_dialog_force(settings_dialog_id);
|
settings_dialog = get_dialog_force(settings_dialog_id);
|
||||||
|
} else if (sender_dialog_id.is_valid()) {
|
||||||
|
settings_dialog_id = sender_dialog_id;
|
||||||
|
settings_dialog = get_dialog_force(settings_dialog_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool have_settings;
|
bool have_settings;
|
||||||
@ -25017,10 +25047,15 @@ bool MessagesManager::add_new_message_notification(Dialog *d, Message *m, bool f
|
|||||||
|
|
||||||
DialogId settings_dialog_id = d->dialog_id;
|
DialogId settings_dialog_id = d->dialog_id;
|
||||||
Dialog *settings_dialog = d;
|
Dialog *settings_dialog = d;
|
||||||
if (m->contains_mention && !m->is_mention_notification_disabled && m->sender_user_id.is_valid()) {
|
if (m->contains_mention && !m->is_mention_notification_disabled) {
|
||||||
// have a mention, so use notification settings from the dialog with the sender
|
// have a mention, so use notification settings from the dialog with the sender
|
||||||
|
if (m->sender_user_id.is_valid()) {
|
||||||
settings_dialog_id = DialogId(m->sender_user_id);
|
settings_dialog_id = DialogId(m->sender_user_id);
|
||||||
settings_dialog = get_dialog_force(settings_dialog_id);
|
settings_dialog = get_dialog_force(settings_dialog_id);
|
||||||
|
} else if (m->sender_dialog_id.is_valid()) {
|
||||||
|
settings_dialog_id = m->sender_dialog_id;
|
||||||
|
settings_dialog = get_dialog_force(settings_dialog_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool have_settings;
|
bool have_settings;
|
||||||
@ -29470,8 +29505,8 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!td_->auth_manager_->is_bot() && from_update && m->forward_info != nullptr &&
|
if (!td_->auth_manager_->is_bot() && from_update && m->forward_info != nullptr &&
|
||||||
m->forward_info->dialog_id.is_valid() && m->forward_info->message_id.is_valid()) {
|
m->forward_info->sender_dialog_id.is_valid() && m->forward_info->message_id.is_valid()) {
|
||||||
update_forward_count(m->forward_info->dialog_id, m->forward_info->message_id);
|
update_forward_count(m->forward_info->sender_dialog_id, m->forward_info->message_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result_message;
|
return result_message;
|
||||||
@ -29994,25 +30029,38 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr
|
|||||||
|
|
||||||
if (old_message->author_signature != new_message->author_signature) {
|
if (old_message->author_signature != new_message->author_signature) {
|
||||||
LOG(DEBUG) << "Author signature has changed for " << message_id << " in " << dialog_id << " sent by "
|
LOG(DEBUG) << "Author signature has changed for " << message_id << " in " << dialog_id << " sent by "
|
||||||
<< old_message->sender_user_id << "/" << new_message->sender_user_id << " from "
|
<< old_message->sender_user_id << "/" << new_message->sender_user_id << " or "
|
||||||
|
<< old_message->sender_dialog_id << "/" << new_message->sender_dialog_id << " from "
|
||||||
<< old_message->author_signature << " to " << new_message->author_signature;
|
<< old_message->author_signature << " to " << new_message->author_signature;
|
||||||
old_message->author_signature = std::move(new_message->author_signature);
|
old_message->author_signature = std::move(new_message->author_signature);
|
||||||
need_send_update = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
if (old_message->sender_user_id != new_message->sender_user_id) {
|
if (old_message->sender_user_id != new_message->sender_user_id) {
|
||||||
// there can be race for sent signed posts
|
// there can be race for sent signed posts or changed anonymous flag
|
||||||
LOG_IF(ERROR, old_message->sender_user_id != UserId() && new_message->sender_user_id != UserId())
|
LOG_IF(ERROR, old_message->sender_user_id != UserId() && new_message->sender_user_id != UserId())
|
||||||
<< message_id << " in " << dialog_id << " has changed sender from " << old_message->sender_user_id << " to "
|
<< message_id << " in " << dialog_id << " has changed sender from " << old_message->sender_user_id << " to "
|
||||||
<< new_message->sender_user_id << ", message content type is " << old_message->content->get_type() << '/'
|
<< new_message->sender_user_id << ", message content type is " << old_message->content->get_type() << '/'
|
||||||
<< new_message->content->get_type();
|
<< new_message->content->get_type();
|
||||||
|
|
||||||
LOG_IF(WARNING, new_message->sender_user_id.is_valid() || old_message->author_signature.empty())
|
LOG_IF(WARNING, (new_message->sender_user_id.is_valid() || old_message->author_signature.empty()) &&
|
||||||
|
!old_message->sender_dialog_id.is_valid() && !new_message->sender_dialog_id.is_valid())
|
||||||
<< "Update message sender from " << old_message->sender_user_id << " to " << new_message->sender_user_id
|
<< "Update message sender from " << old_message->sender_user_id << " to " << new_message->sender_user_id
|
||||||
<< " in " << dialog_id;
|
<< " in " << dialog_id;
|
||||||
LOG(DEBUG) << "Change message sender";
|
LOG(DEBUG) << "Change message sender";
|
||||||
old_message->sender_user_id = new_message->sender_user_id;
|
old_message->sender_user_id = new_message->sender_user_id;
|
||||||
need_send_update = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
|
if (old_message->sender_dialog_id != new_message->sender_dialog_id) {
|
||||||
|
// there can be race for changed anonymous flag
|
||||||
|
LOG_IF(ERROR, old_message->sender_dialog_id != DialogId() && new_message->sender_dialog_id != DialogId())
|
||||||
|
<< message_id << " in " << dialog_id << " has changed sender from " << old_message->sender_dialog_id << " to "
|
||||||
|
<< new_message->sender_dialog_id << ", message content type is " << old_message->content->get_type() << '/'
|
||||||
|
<< new_message->content->get_type();
|
||||||
|
|
||||||
|
LOG(DEBUG) << "Change message sender";
|
||||||
|
old_message->sender_dialog_id = new_message->sender_dialog_id;
|
||||||
|
need_send_update = true;
|
||||||
|
}
|
||||||
if (old_message->forward_info == nullptr) {
|
if (old_message->forward_info == nullptr) {
|
||||||
if (new_message->forward_info != nullptr) {
|
if (new_message->forward_info != nullptr) {
|
||||||
if (!replace_legacy) {
|
if (!replace_legacy) {
|
||||||
@ -30042,10 +30090,11 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr
|
|||||||
need_send_update = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
} else if (is_new_available) {
|
} else if (is_new_available) {
|
||||||
LOG(ERROR) << message_id << " in " << dialog_id << " sent by " << old_message->sender_user_id
|
LOG(ERROR) << message_id << " in " << dialog_id << " sent by " << old_message->sender_user_id << "/"
|
||||||
<< " has lost forward info " << *old_message->forward_info << ", really forwarded from "
|
<< old_message->sender_dialog_id << " has lost forward info " << *old_message->forward_info
|
||||||
<< old_message->real_forward_from_dialog_id << ", message content type is "
|
<< ", really forwarded from " << old_message->real_forward_from_dialog_id
|
||||||
<< old_message->content->get_type() << '/' << new_message->content->get_type();
|
<< ", message content type is " << old_message->content->get_type() << '/'
|
||||||
|
<< new_message->content->get_type();
|
||||||
old_message->forward_info = nullptr;
|
old_message->forward_info = nullptr;
|
||||||
need_send_update = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
@ -30233,8 +30282,8 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr
|
|||||||
} else {
|
} else {
|
||||||
// if the message is not accessible anymore, then we don't need a warning
|
// if the message is not accessible anymore, then we don't need a warning
|
||||||
if (need_message_changed_warning(old_message) && is_new_available) {
|
if (need_message_changed_warning(old_message) && is_new_available) {
|
||||||
LOG(ERROR) << message_id << " in " << dialog_id << " sent by " << old_message->sender_user_id
|
LOG(ERROR) << message_id << " in " << dialog_id << " sent by " << old_message->sender_user_id << "/"
|
||||||
<< " has lost reply markup " << *old_message->reply_markup
|
<< old_message->sender_dialog_id << " has lost reply markup " << *old_message->reply_markup
|
||||||
<< ". Old message: " << to_string(get_message_object(dialog_id, old_message))
|
<< ". Old message: " << to_string(get_message_object(dialog_id, old_message))
|
||||||
<< ". New message: " << to_string(get_message_object(dialog_id, new_message.get()));
|
<< ". New message: " << to_string(get_message_object(dialog_id, new_message.get()));
|
||||||
}
|
}
|
||||||
@ -30810,7 +30859,7 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
|
|||||||
if (last_database_message != nullptr) {
|
if (last_database_message != nullptr) {
|
||||||
int32 dependent_dialog_count = 0;
|
int32 dependent_dialog_count = 0;
|
||||||
if (last_database_message->forward_info != nullptr) {
|
if (last_database_message->forward_info != nullptr) {
|
||||||
auto other_dialog_id = last_database_message->forward_info->dialog_id;
|
auto other_dialog_id = last_database_message->forward_info->sender_dialog_id;
|
||||||
if (other_dialog_id.is_valid() && !have_dialog(other_dialog_id)) {
|
if (other_dialog_id.is_valid() && !have_dialog(other_dialog_id)) {
|
||||||
LOG(INFO) << "Postpone adding of last message in " << dialog_id << " because of cyclic dependency with "
|
LOG(INFO) << "Postpone adding of last message in " << dialog_id << " because of cyclic dependency with "
|
||||||
<< other_dialog_id;
|
<< other_dialog_id;
|
||||||
@ -30824,6 +30873,13 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
|
|||||||
pending_add_dialog_last_database_message_dependent_dialogs_[other_dialog_id].push_back(dialog_id);
|
pending_add_dialog_last_database_message_dependent_dialogs_[other_dialog_id].push_back(dialog_id);
|
||||||
dependent_dialog_count++;
|
dependent_dialog_count++;
|
||||||
}
|
}
|
||||||
|
other_dialog_id = last_database_message->sender_dialog_id;
|
||||||
|
if (other_dialog_id.is_valid() && !have_dialog(other_dialog_id)) {
|
||||||
|
LOG(INFO) << "Postpone adding of last message in " << dialog_id << " because of cyclic dependency with "
|
||||||
|
<< other_dialog_id;
|
||||||
|
pending_add_dialog_last_database_message_dependent_dialogs_[other_dialog_id].push_back(dialog_id);
|
||||||
|
dependent_dialog_count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dependent_dialog_count == 0) {
|
if (dependent_dialog_count == 0) {
|
||||||
|
@ -165,7 +165,6 @@ class MessagesManager : public Actor {
|
|||||||
static constexpr int32 MESSAGE_FLAG_HIDE_EDIT_DATE = 1 << 21;
|
static constexpr int32 MESSAGE_FLAG_HIDE_EDIT_DATE = 1 << 21;
|
||||||
static constexpr int32 MESSAGE_FLAG_IS_RESTRICTED = 1 << 22;
|
static constexpr int32 MESSAGE_FLAG_IS_RESTRICTED = 1 << 22;
|
||||||
static constexpr int32 MESSAGE_FLAG_HAS_REPLY_INFO = 1 << 23;
|
static constexpr int32 MESSAGE_FLAG_HAS_REPLY_INFO = 1 << 23;
|
||||||
static constexpr int32 MESSAGE_FLAG_HAS_RECENT_REPLIERS = 1 << 24;
|
|
||||||
|
|
||||||
static constexpr int32 SEND_MESSAGE_FLAG_IS_REPLY = 1 << 0;
|
static constexpr int32 SEND_MESSAGE_FLAG_IS_REPLY = 1 << 0;
|
||||||
static constexpr int32 SEND_MESSAGE_FLAG_DISABLE_WEB_PAGE_PREVIEW = 1 << 1;
|
static constexpr int32 SEND_MESSAGE_FLAG_DISABLE_WEB_PAGE_PREVIEW = 1 << 1;
|
||||||
@ -234,7 +233,8 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
void on_get_dialog_messages_search_result(DialogId dialog_id, const string &query, UserId sender_user_id,
|
void on_get_dialog_messages_search_result(DialogId dialog_id, const string &query, UserId sender_user_id,
|
||||||
MessageId from_message_id, int32 offset, int32 limit,
|
MessageId from_message_id, int32 offset, int32 limit,
|
||||||
MessageSearchFilter filter, int64 random_id, int32 total_count,
|
MessageSearchFilter filter, MessageId top_thread_message_id,
|
||||||
|
int64 random_id, int32 total_count,
|
||||||
vector<tl_object_ptr<telegram_api::Message>> &&messages);
|
vector<tl_object_ptr<telegram_api::Message>> &&messages);
|
||||||
void on_failed_dialog_messages_search(DialogId dialog_id, int64 random_id);
|
void on_failed_dialog_messages_search(DialogId dialog_id, int64 random_id);
|
||||||
|
|
||||||
@ -833,9 +833,9 @@ class MessagesManager : public Actor {
|
|||||||
};
|
};
|
||||||
Result<MessagePushNotificationInfo> get_message_push_notification_info(DialogId dialog_id, MessageId message_id,
|
Result<MessagePushNotificationInfo> get_message_push_notification_info(DialogId dialog_id, MessageId message_id,
|
||||||
int64 random_id, UserId sender_user_id,
|
int64 random_id, UserId sender_user_id,
|
||||||
int32 date, bool is_from_scheduled,
|
DialogId sender_dialog_id, int32 date,
|
||||||
bool contains_mention, bool is_pinned,
|
bool is_from_scheduled, bool contains_mention,
|
||||||
bool is_from_binlog);
|
bool is_pinned, bool is_from_binlog);
|
||||||
|
|
||||||
struct MessageNotificationGroup {
|
struct MessageNotificationGroup {
|
||||||
DialogId dialog_id;
|
DialogId dialog_id;
|
||||||
@ -905,11 +905,13 @@ class MessagesManager : public Actor {
|
|||||||
DialogId dialog_id;
|
DialogId dialog_id;
|
||||||
MessageId message_id;
|
MessageId message_id;
|
||||||
UserId sender_user_id;
|
UserId sender_user_id;
|
||||||
|
DialogId sender_dialog_id;
|
||||||
int32 date = 0;
|
int32 date = 0;
|
||||||
int32 ttl = 0;
|
int32 ttl = 0;
|
||||||
int64 random_id = 0;
|
int64 random_id = 0;
|
||||||
tl_object_ptr<telegram_api::messageFwdHeader> forward_header;
|
tl_object_ptr<telegram_api::messageFwdHeader> forward_header;
|
||||||
MessageId reply_to_message_id;
|
MessageId reply_to_message_id;
|
||||||
|
tl_object_ptr<telegram_api::messageReplyHeader> reply_header;
|
||||||
UserId via_bot_user_id;
|
UserId via_bot_user_id;
|
||||||
int32 view_count = 0;
|
int32 view_count = 0;
|
||||||
int32 forward_count = 0;
|
int32 forward_count = 0;
|
||||||
@ -927,7 +929,7 @@ class MessagesManager : public Actor {
|
|||||||
struct MessageForwardInfo {
|
struct MessageForwardInfo {
|
||||||
UserId sender_user_id;
|
UserId sender_user_id;
|
||||||
int32 date = 0;
|
int32 date = 0;
|
||||||
DialogId dialog_id;
|
DialogId sender_dialog_id;
|
||||||
MessageId message_id;
|
MessageId message_id;
|
||||||
string author_signature;
|
string author_signature;
|
||||||
string sender_name;
|
string sender_name;
|
||||||
@ -937,12 +939,12 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
MessageForwardInfo() = default;
|
MessageForwardInfo() = default;
|
||||||
|
|
||||||
MessageForwardInfo(UserId sender_user_id, int32 date, DialogId dialog_id, MessageId message_id,
|
MessageForwardInfo(UserId sender_user_id, int32 date, DialogId sender_dialog_id, MessageId message_id,
|
||||||
string author_signature, string sender_name, DialogId from_dialog_id, MessageId from_message_id,
|
string author_signature, string sender_name, DialogId from_dialog_id, MessageId from_message_id,
|
||||||
string psa_type)
|
string psa_type)
|
||||||
: sender_user_id(sender_user_id)
|
: sender_user_id(sender_user_id)
|
||||||
, date(date)
|
, date(date)
|
||||||
, dialog_id(dialog_id)
|
, sender_dialog_id(sender_dialog_id)
|
||||||
, message_id(message_id)
|
, message_id(message_id)
|
||||||
, author_signature(std::move(author_signature))
|
, author_signature(std::move(author_signature))
|
||||||
, sender_name(std::move(sender_name))
|
, sender_name(std::move(sender_name))
|
||||||
@ -952,7 +954,7 @@ class MessagesManager : public Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const MessageForwardInfo &rhs) const {
|
bool operator==(const MessageForwardInfo &rhs) const {
|
||||||
return sender_user_id == rhs.sender_user_id && date == rhs.date && dialog_id == rhs.dialog_id &&
|
return sender_user_id == rhs.sender_user_id && date == rhs.date && sender_dialog_id == rhs.sender_dialog_id &&
|
||||||
message_id == rhs.message_id && author_signature == rhs.author_signature &&
|
message_id == rhs.message_id && author_signature == rhs.author_signature &&
|
||||||
sender_name == rhs.sender_name && from_dialog_id == rhs.from_dialog_id &&
|
sender_name == rhs.sender_name && from_dialog_id == rhs.from_dialog_id &&
|
||||||
from_message_id == rhs.from_message_id && psa_type == rhs.psa_type;
|
from_message_id == rhs.from_message_id && psa_type == rhs.psa_type;
|
||||||
@ -965,7 +967,7 @@ class MessagesManager : public Actor {
|
|||||||
friend StringBuilder &operator<<(StringBuilder &string_builder, const MessageForwardInfo &forward_info) {
|
friend StringBuilder &operator<<(StringBuilder &string_builder, const MessageForwardInfo &forward_info) {
|
||||||
return string_builder << "MessageForwardInfo[sender " << forward_info.sender_user_id << "("
|
return string_builder << "MessageForwardInfo[sender " << forward_info.sender_user_id << "("
|
||||||
<< forward_info.author_signature << "/" << forward_info.sender_name << "), psa_type "
|
<< forward_info.author_signature << "/" << forward_info.sender_name << "), psa_type "
|
||||||
<< forward_info.psa_type << ", source " << forward_info.dialog_id << ", source "
|
<< forward_info.psa_type << ", source " << forward_info.sender_dialog_id << ", source "
|
||||||
<< forward_info.message_id << ", from " << forward_info.from_dialog_id << ", from "
|
<< forward_info.message_id << ", from " << forward_info.from_dialog_id << ", from "
|
||||||
<< forward_info.from_message_id << " at " << forward_info.date << "]";
|
<< forward_info.from_message_id << " at " << forward_info.date << "]";
|
||||||
}
|
}
|
||||||
@ -977,6 +979,7 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
MessageId message_id;
|
MessageId message_id;
|
||||||
UserId sender_user_id;
|
UserId sender_user_id;
|
||||||
|
DialogId sender_dialog_id;
|
||||||
int32 date = 0;
|
int32 date = 0;
|
||||||
int32 edit_date = 0;
|
int32 edit_date = 0;
|
||||||
int32 send_date = 0;
|
int32 send_date = 0;
|
||||||
@ -1665,8 +1668,6 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
void finish_delete_secret_chat_history(DialogId dialog_id, MessageId last_message_id, Promise<> promise);
|
void finish_delete_secret_chat_history(DialogId dialog_id, MessageId last_message_id, Promise<> promise);
|
||||||
|
|
||||||
void fix_message_info_dialog_id(MessageInfo &message_info) const;
|
|
||||||
|
|
||||||
MessageInfo parse_telegram_api_message(tl_object_ptr<telegram_api::Message> message_ptr, bool is_scheduled,
|
MessageInfo parse_telegram_api_message(tl_object_ptr<telegram_api::Message> message_ptr, bool is_scheduled,
|
||||||
const char *source) const;
|
const char *source) const;
|
||||||
|
|
||||||
|
@ -3129,7 +3129,20 @@ Status NotificationManager::process_push_notification_payload(string payload, bo
|
|||||||
TRY_RESULT(random_id, get_json_object_long_field(custom, "random_id"));
|
TRY_RESULT(random_id, get_json_object_long_field(custom, "random_id"));
|
||||||
|
|
||||||
UserId sender_user_id;
|
UserId sender_user_id;
|
||||||
if (has_json_object_field(custom, "chat_from_id")) {
|
DialogId sender_dialog_id;
|
||||||
|
if (has_json_object_field(custom, "chat_from_broadcast_id")) {
|
||||||
|
TRY_RESULT(sender_channel_id_int, get_json_object_int_field(custom, "chat_from_broadcast_id"));
|
||||||
|
sender_dialog_id = DialogId(ChannelId(sender_channel_id_int));
|
||||||
|
if (!sender_dialog_id.is_valid()) {
|
||||||
|
return Status::Error("Receive invalid chat_from_broadcast_id");
|
||||||
|
}
|
||||||
|
} else if (has_json_object_field(custom, "chat_from_group_id")) {
|
||||||
|
TRY_RESULT(sender_channel_id_int, get_json_object_int_field(custom, "chat_from_group_id"));
|
||||||
|
sender_dialog_id = DialogId(ChannelId(sender_channel_id_int));
|
||||||
|
if (!sender_dialog_id.is_valid()) {
|
||||||
|
return Status::Error("Receive invalid chat_from_group_id");
|
||||||
|
}
|
||||||
|
} else if (has_json_object_field(custom, "chat_from_id")) {
|
||||||
TRY_RESULT(sender_user_id_int, get_json_object_int_field(custom, "chat_from_id"));
|
TRY_RESULT(sender_user_id_int, get_json_object_int_field(custom, "chat_from_id"));
|
||||||
sender_user_id = UserId(sender_user_id_int);
|
sender_user_id = UserId(sender_user_id_int);
|
||||||
if (!sender_user_id.is_valid()) {
|
if (!sender_user_id.is_valid()) {
|
||||||
@ -3195,7 +3208,7 @@ Status NotificationManager::process_push_notification_payload(string payload, bo
|
|||||||
}
|
}
|
||||||
if (dialog_id.get_type() == DialogType::User) {
|
if (dialog_id.get_type() == DialogType::User) {
|
||||||
sender_name = std::move(loc_args[0]);
|
sender_name = std::move(loc_args[0]);
|
||||||
} else if (sender_user_id.is_valid() && begins_with(loc_key, "PINNED_")) {
|
} else if ((sender_user_id.is_valid() || sender_dialog_id.is_valid()) && begins_with(loc_key, "PINNED_")) {
|
||||||
if (loc_args.size() < 2) {
|
if (loc_args.size() < 2) {
|
||||||
return Status::Error("Expected chat title as the last argument");
|
return Status::Error("Expected chat title as the last argument");
|
||||||
}
|
}
|
||||||
@ -3394,7 +3407,7 @@ Status NotificationManager::process_push_notification_payload(string payload, bo
|
|||||||
} else {
|
} else {
|
||||||
bool is_from_scheduled = has_json_object_field(custom, "schedule");
|
bool is_from_scheduled = has_json_object_field(custom, "schedule");
|
||||||
bool is_silent = has_json_object_field(custom, "silent");
|
bool is_silent = has_json_object_field(custom, "silent");
|
||||||
add_message_push_notification(dialog_id, MessageId(server_message_id), random_id, sender_user_id,
|
add_message_push_notification(dialog_id, MessageId(server_message_id), random_id, sender_user_id, sender_dialog_id,
|
||||||
std::move(sender_name), sent_date, is_from_scheduled, contains_mention, is_silent,
|
std::move(sender_name), sent_date, is_from_scheduled, contains_mention, is_silent,
|
||||||
is_silent, std::move(loc_key), std::move(arg), std::move(attached_photo),
|
is_silent, std::move(loc_key), std::move(arg), std::move(attached_photo),
|
||||||
std::move(attached_document), NotificationId(), 0, std::move(promise));
|
std::move(attached_document), NotificationId(), 0, std::move(promise));
|
||||||
@ -3408,6 +3421,7 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
|||||||
MessageId message_id_;
|
MessageId message_id_;
|
||||||
int64 random_id_;
|
int64 random_id_;
|
||||||
UserId sender_user_id_;
|
UserId sender_user_id_;
|
||||||
|
DialogId sender_dialog_id_;
|
||||||
string sender_name_;
|
string sender_name_;
|
||||||
int32 date_;
|
int32 date_;
|
||||||
bool is_from_scheduled_;
|
bool is_from_scheduled_;
|
||||||
@ -3428,6 +3442,7 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
|||||||
bool has_arg = !arg_.empty();
|
bool has_arg = !arg_.empty();
|
||||||
bool has_photo = !photo_.is_empty();
|
bool has_photo = !photo_.is_empty();
|
||||||
bool has_document = !document_.empty();
|
bool has_document = !document_.empty();
|
||||||
|
bool has_sender_dialog_id = sender_dialog_id_.is_valid();
|
||||||
BEGIN_STORE_FLAGS();
|
BEGIN_STORE_FLAGS();
|
||||||
STORE_FLAG(contains_mention_);
|
STORE_FLAG(contains_mention_);
|
||||||
STORE_FLAG(is_silent_);
|
STORE_FLAG(is_silent_);
|
||||||
@ -3439,6 +3454,7 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
|||||||
STORE_FLAG(has_photo);
|
STORE_FLAG(has_photo);
|
||||||
STORE_FLAG(has_document);
|
STORE_FLAG(has_document);
|
||||||
STORE_FLAG(is_from_scheduled_);
|
STORE_FLAG(is_from_scheduled_);
|
||||||
|
STORE_FLAG(has_sender_dialog_id);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
td::store(dialog_id_, storer);
|
td::store(dialog_id_, storer);
|
||||||
if (has_message_id) {
|
if (has_message_id) {
|
||||||
@ -3465,6 +3481,9 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
|||||||
td::store(document_, storer);
|
td::store(document_, storer);
|
||||||
}
|
}
|
||||||
td::store(notification_id_, storer);
|
td::store(notification_id_, storer);
|
||||||
|
if (has_sender_dialog_id) {
|
||||||
|
td::store(sender_dialog_id_, storer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ParserT>
|
template <class ParserT>
|
||||||
@ -3476,6 +3495,7 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
|||||||
bool has_arg;
|
bool has_arg;
|
||||||
bool has_photo;
|
bool has_photo;
|
||||||
bool has_document;
|
bool has_document;
|
||||||
|
bool has_sender_dialog_id;
|
||||||
BEGIN_PARSE_FLAGS();
|
BEGIN_PARSE_FLAGS();
|
||||||
PARSE_FLAG(contains_mention_);
|
PARSE_FLAG(contains_mention_);
|
||||||
PARSE_FLAG(is_silent_);
|
PARSE_FLAG(is_silent_);
|
||||||
@ -3487,6 +3507,7 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
|||||||
PARSE_FLAG(has_photo);
|
PARSE_FLAG(has_photo);
|
||||||
PARSE_FLAG(has_document);
|
PARSE_FLAG(has_document);
|
||||||
PARSE_FLAG(is_from_scheduled_);
|
PARSE_FLAG(is_from_scheduled_);
|
||||||
|
PARSE_FLAG(has_sender_dialog_id);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
td::parse(dialog_id_, parser);
|
td::parse(dialog_id_, parser);
|
||||||
if (has_message_id) {
|
if (has_message_id) {
|
||||||
@ -3515,20 +3536,27 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
|||||||
td::parse(document_, parser);
|
td::parse(document_, parser);
|
||||||
}
|
}
|
||||||
td::parse(notification_id_, parser);
|
td::parse(notification_id_, parser);
|
||||||
|
if (has_sender_dialog_id) {
|
||||||
|
td::parse(sender_dialog_id_, parser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void NotificationManager::add_message_push_notification(
|
void NotificationManager::add_message_push_notification(DialogId dialog_id, MessageId message_id, int64 random_id,
|
||||||
DialogId dialog_id, MessageId message_id, int64 random_id, UserId sender_user_id, string sender_name, int32 date,
|
UserId sender_user_id, DialogId sender_dialog_id,
|
||||||
bool is_from_scheduled, bool contains_mention, bool initial_is_silent, bool is_silent, string loc_key, string arg,
|
string sender_name, int32 date, bool is_from_scheduled,
|
||||||
Photo photo, Document document, NotificationId notification_id, uint64 logevent_id, Promise<Unit> promise) {
|
bool contains_mention, bool initial_is_silent, bool is_silent,
|
||||||
|
string loc_key, string arg, Photo photo, Document document,
|
||||||
|
NotificationId notification_id, uint64 logevent_id,
|
||||||
|
Promise<Unit> promise) {
|
||||||
auto is_pinned = begins_with(loc_key, "PINNED_");
|
auto is_pinned = begins_with(loc_key, "PINNED_");
|
||||||
auto r_info = td_->messages_manager_->get_message_push_notification_info(
|
auto r_info = td_->messages_manager_->get_message_push_notification_info(
|
||||||
dialog_id, message_id, random_id, sender_user_id, date, is_from_scheduled, contains_mention, is_pinned,
|
dialog_id, message_id, random_id, sender_user_id, sender_dialog_id, date, is_from_scheduled, contains_mention,
|
||||||
logevent_id != 0);
|
is_pinned, logevent_id != 0);
|
||||||
if (r_info.is_error()) {
|
if (r_info.is_error()) {
|
||||||
VLOG(notifications) << "Don't need message push notification for " << message_id << "/" << random_id << " from "
|
VLOG(notifications) << "Don't need message push notification for " << message_id << "/" << random_id << " from "
|
||||||
<< dialog_id << " sent by " << sender_user_id << " at " << date << ": " << r_info.error();
|
<< dialog_id << " sent by " << sender_user_id << "/" << sender_dialog_id << " at " << date
|
||||||
|
<< ": " << r_info.error();
|
||||||
if (logevent_id != 0) {
|
if (logevent_id != 0) {
|
||||||
binlog_erase(G()->td_db()->get_binlog(), logevent_id);
|
binlog_erase(G()->td_db()->get_binlog(), logevent_id);
|
||||||
}
|
}
|
||||||
@ -3581,9 +3609,9 @@ void NotificationManager::add_message_push_notification(
|
|||||||
|
|
||||||
if (logevent_id == 0 && G()->parameters().use_message_db) {
|
if (logevent_id == 0 && G()->parameters().use_message_db) {
|
||||||
AddMessagePushNotificationLogEvent logevent{
|
AddMessagePushNotificationLogEvent logevent{
|
||||||
dialog_id, message_id, random_id, sender_user_id, sender_name, date,
|
dialog_id, message_id, random_id, sender_user_id, sender_dialog_id, sender_name,
|
||||||
is_from_scheduled, contains_mention, initial_is_silent, loc_key, arg, photo,
|
date, is_from_scheduled, contains_mention, initial_is_silent, loc_key, arg,
|
||||||
document, notification_id};
|
photo, document, notification_id};
|
||||||
auto storer = LogEventStorerImpl<AddMessagePushNotificationLogEvent>(logevent);
|
auto storer = LogEventStorerImpl<AddMessagePushNotificationLogEvent>(logevent);
|
||||||
logevent_id = binlog_add(G()->td_db()->get_binlog(), LogEvent::HandlerType::AddMessagePushNotification, storer);
|
logevent_id = binlog_add(G()->td_db()->get_binlog(), LogEvent::HandlerType::AddMessagePushNotification, storer);
|
||||||
}
|
}
|
||||||
@ -3597,7 +3625,7 @@ void NotificationManager::add_message_push_notification(
|
|||||||
VLOG(notifications) << "Register temporary " << notification_id << " with logevent " << logevent_id;
|
VLOG(notifications) << "Register temporary " << notification_id << " with logevent " << logevent_id;
|
||||||
temporary_notification_logevent_ids_[notification_id] = logevent_id;
|
temporary_notification_logevent_ids_[notification_id] = logevent_id;
|
||||||
temporary_notifications_[FullMessageId(dialog_id, message_id)] = {group_id, notification_id, sender_user_id,
|
temporary_notifications_[FullMessageId(dialog_id, message_id)] = {group_id, notification_id, sender_user_id,
|
||||||
sender_name, is_outgoing};
|
sender_dialog_id, sender_name, is_outgoing};
|
||||||
temporary_notification_message_ids_[notification_id] = FullMessageId(dialog_id, message_id);
|
temporary_notification_message_ids_[notification_id] = FullMessageId(dialog_id, message_id);
|
||||||
}
|
}
|
||||||
push_notification_promises_[notification_id].push_back(std::move(promise));
|
push_notification_promises_[notification_id].push_back(std::move(promise));
|
||||||
@ -3605,15 +3633,15 @@ void NotificationManager::add_message_push_notification(
|
|||||||
auto group_type = info.group_type;
|
auto group_type = info.group_type;
|
||||||
auto settings_dialog_id = info.settings_dialog_id;
|
auto settings_dialog_id = info.settings_dialog_id;
|
||||||
VLOG(notifications) << "Add message push " << notification_id << " of type " << loc_key << " for " << message_id
|
VLOG(notifications) << "Add message push " << notification_id << " of type " << loc_key << " for " << message_id
|
||||||
<< "/" << random_id << " in " << dialog_id << ", sent by " << sender_user_id << "/\""
|
<< "/" << random_id << " in " << dialog_id << ", sent by " << sender_user_id << "/"
|
||||||
<< sender_name << "\" at " << date << " with arg " << arg << ", photo " << photo
|
<< sender_dialog_id << "/\"" << sender_name << "\" at " << date << " with arg " << arg
|
||||||
<< " and document " << document << " to " << group_id << " of type " << group_type
|
<< ", photo " << photo << " and document " << document << " to " << group_id << " of type "
|
||||||
<< " with settings from " << settings_dialog_id;
|
<< group_type << " with settings from " << settings_dialog_id;
|
||||||
|
|
||||||
add_notification(
|
add_notification(
|
||||||
group_id, group_type, dialog_id, date, settings_dialog_id, initial_is_silent, is_silent, 0, notification_id,
|
group_id, group_type, dialog_id, date, settings_dialog_id, initial_is_silent, is_silent, 0, notification_id,
|
||||||
create_new_push_message_notification(sender_user_id, sender_name, is_outgoing, message_id, std::move(loc_key),
|
create_new_push_message_notification(sender_user_id, sender_dialog_id, sender_name, is_outgoing, message_id,
|
||||||
std::move(arg), std::move(photo), std::move(document)),
|
std::move(loc_key), std::move(arg), std::move(photo), std::move(document)),
|
||||||
"add_message_push_notification");
|
"add_message_push_notification");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3704,6 +3732,7 @@ void NotificationManager::edit_message_push_notification(DialogId dialog_id, Mes
|
|||||||
auto group_id = it->second.group_id;
|
auto group_id = it->second.group_id;
|
||||||
auto notification_id = it->second.notification_id;
|
auto notification_id = it->second.notification_id;
|
||||||
auto sender_user_id = it->second.sender_user_id;
|
auto sender_user_id = it->second.sender_user_id;
|
||||||
|
auto sender_dialog_id = it->second.sender_dialog_id;
|
||||||
auto sender_name = it->second.sender_name;
|
auto sender_name = it->second.sender_name;
|
||||||
auto is_outgoing = it->second.is_outgoing;
|
auto is_outgoing = it->second.is_outgoing;
|
||||||
CHECK(group_id.is_valid());
|
CHECK(group_id.is_valid());
|
||||||
@ -3730,10 +3759,10 @@ void NotificationManager::edit_message_push_notification(DialogId dialog_id, Mes
|
|||||||
|
|
||||||
push_notification_promises_[notification_id].push_back(std::move(promise));
|
push_notification_promises_[notification_id].push_back(std::move(promise));
|
||||||
|
|
||||||
edit_notification(
|
edit_notification(group_id, notification_id,
|
||||||
group_id, notification_id,
|
create_new_push_message_notification(sender_user_id, sender_dialog_id, std::move(sender_name),
|
||||||
create_new_push_message_notification(sender_user_id, std::move(sender_name), is_outgoing, message_id,
|
is_outgoing, message_id, std::move(loc_key), std::move(arg),
|
||||||
std::move(loc_key), std::move(arg), std::move(photo), std::move(document)));
|
std::move(photo), std::move(document)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int64> NotificationManager::get_push_receiver_id(string payload) {
|
Result<int64> NotificationManager::get_push_receiver_id(string payload) {
|
||||||
@ -4059,9 +4088,10 @@ void NotificationManager::on_binlog_events(vector<BinlogEvent> &&events) {
|
|||||||
|
|
||||||
add_message_push_notification(
|
add_message_push_notification(
|
||||||
log_event.dialog_id_, log_event.message_id_, log_event.random_id_, log_event.sender_user_id_,
|
log_event.dialog_id_, log_event.message_id_, log_event.random_id_, log_event.sender_user_id_,
|
||||||
log_event.sender_name_, log_event.date_, log_event.is_from_scheduled_, log_event.contains_mention_,
|
log_event.sender_dialog_id_, log_event.sender_name_, log_event.date_, log_event.is_from_scheduled_,
|
||||||
log_event.is_silent_, true, log_event.loc_key_, log_event.arg_, log_event.photo_, log_event.document_,
|
log_event.contains_mention_, log_event.is_silent_, true, log_event.loc_key_, log_event.arg_,
|
||||||
log_event.notification_id_, event.id_, PromiseCreator::lambda([](Result<Unit> result) {
|
log_event.photo_, log_event.document_, log_event.notification_id_, event.id_,
|
||||||
|
PromiseCreator::lambda([](Result<Unit> result) {
|
||||||
if (result.is_error() && result.error().code() != 200 && result.error().code() != 406) {
|
if (result.is_error() && result.error().code() != 200 && result.error().code() != 406) {
|
||||||
LOG(ERROR) << "Receive error " << result.error() << ", while processing message push notification";
|
LOG(ERROR) << "Receive error " << result.error() << ", while processing message push notification";
|
||||||
}
|
}
|
||||||
|
@ -307,10 +307,10 @@ class NotificationManager : public Actor {
|
|||||||
Status process_push_notification_payload(string payload, bool was_encrypted, Promise<Unit> &promise);
|
Status process_push_notification_payload(string payload, bool was_encrypted, Promise<Unit> &promise);
|
||||||
|
|
||||||
void add_message_push_notification(DialogId dialog_id, MessageId message_id, int64 random_id, UserId sender_user_id,
|
void add_message_push_notification(DialogId dialog_id, MessageId message_id, int64 random_id, UserId sender_user_id,
|
||||||
string sender_name, int32 date, bool is_from_scheduled, bool contains_mention,
|
DialogId sender_dialog_id, string sender_name, int32 date, bool is_from_scheduled,
|
||||||
bool initial_is_silent, bool is_silent, string loc_key, string arg, Photo photo,
|
bool contains_mention, bool initial_is_silent, bool is_silent, string loc_key,
|
||||||
Document document, NotificationId notification_id, uint64 logevent_id,
|
string arg, Photo photo, Document document, NotificationId notification_id,
|
||||||
Promise<Unit> promise);
|
uint64 logevent_id, Promise<Unit> promise);
|
||||||
|
|
||||||
void edit_message_push_notification(DialogId dialog_id, MessageId message_id, int32 edit_date, string loc_key,
|
void edit_message_push_notification(DialogId dialog_id, MessageId message_id, int32 edit_date, string loc_key,
|
||||||
string arg, Photo photo, Document document, uint64 logevent_id,
|
string arg, Photo photo, Document document, uint64 logevent_id,
|
||||||
@ -388,6 +388,7 @@ class NotificationManager : public Actor {
|
|||||||
NotificationGroupId group_id;
|
NotificationGroupId group_id;
|
||||||
NotificationId notification_id;
|
NotificationId notification_id;
|
||||||
UserId sender_user_id;
|
UserId sender_user_id;
|
||||||
|
DialogId sender_dialog_id;
|
||||||
string sender_name;
|
string sender_name;
|
||||||
bool is_outgoing;
|
bool is_outgoing;
|
||||||
};
|
};
|
||||||
|
@ -321,16 +321,18 @@ class NotificationTypePushMessage : public NotificationType {
|
|||||||
auto sender_user_id = G()->td().get_actor_unsafe()->contacts_manager_->get_user_id_object(
|
auto sender_user_id = G()->td().get_actor_unsafe()->contacts_manager_->get_user_id_object(
|
||||||
sender_user_id_, "get_notification_type_object");
|
sender_user_id_, "get_notification_type_object");
|
||||||
return td_api::make_object<td_api::notificationTypeNewPushMessage>(
|
return td_api::make_object<td_api::notificationTypeNewPushMessage>(
|
||||||
message_id_.get(), sender_user_id, sender_name_, is_outgoing_,
|
message_id_.get(), sender_user_id, sender_dialog_id_.get(), sender_name_, is_outgoing_,
|
||||||
get_push_message_content_object(key_, arg_, photo_, document_));
|
get_push_message_content_object(key_, arg_, photo_, document_));
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder &to_string_builder(StringBuilder &string_builder) const override {
|
StringBuilder &to_string_builder(StringBuilder &string_builder) const override {
|
||||||
return string_builder << "NewPushMessageNotification[" << sender_user_id_ << "/\"" << sender_name_ << "\", "
|
return string_builder << "NewPushMessageNotification[" << sender_user_id_ << "/" << sender_dialog_id_ << "/\""
|
||||||
<< message_id_ << ", " << key_ << ", " << arg_ << ", " << photo_ << ", " << document_ << ']';
|
<< sender_name_ << "\", " << message_id_ << ", " << key_ << ", " << arg_ << ", " << photo_
|
||||||
|
<< ", " << document_ << ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
UserId sender_user_id_;
|
UserId sender_user_id_;
|
||||||
|
DialogId sender_dialog_id_;
|
||||||
MessageId message_id_;
|
MessageId message_id_;
|
||||||
string sender_name_;
|
string sender_name_;
|
||||||
string key_;
|
string key_;
|
||||||
@ -340,9 +342,10 @@ class NotificationTypePushMessage : public NotificationType {
|
|||||||
bool is_outgoing_;
|
bool is_outgoing_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NotificationTypePushMessage(UserId sender_user_id, string sender_name, bool is_outgoing, MessageId message_id,
|
NotificationTypePushMessage(UserId sender_user_id, DialogId sender_dialog_id, string sender_name, bool is_outgoing,
|
||||||
string key, string arg, Photo photo, Document document)
|
MessageId message_id, string key, string arg, Photo photo, Document document)
|
||||||
: sender_user_id_(std::move(sender_user_id))
|
: sender_user_id_(sender_user_id)
|
||||||
|
, sender_dialog_id_(sender_dialog_id)
|
||||||
, message_id_(message_id)
|
, message_id_(message_id)
|
||||||
, sender_name_(std::move(sender_name))
|
, sender_name_(std::move(sender_name))
|
||||||
, key_(std::move(key))
|
, key_(std::move(key))
|
||||||
@ -365,12 +368,13 @@ unique_ptr<NotificationType> create_new_call_notification(CallId call_id) {
|
|||||||
return make_unique<NotificationTypeCall>(call_id);
|
return make_unique<NotificationTypeCall>(call_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
unique_ptr<NotificationType> create_new_push_message_notification(UserId sender_user_id, string sender_name,
|
unique_ptr<NotificationType> create_new_push_message_notification(UserId sender_user_id, DialogId sender_dialog_id,
|
||||||
bool is_outgoing, MessageId message_id, string key,
|
string sender_name, bool is_outgoing,
|
||||||
string arg, Photo photo, Document document) {
|
MessageId message_id, string key, string arg,
|
||||||
return td::make_unique<NotificationTypePushMessage>(sender_user_id, std::move(sender_name), is_outgoing, message_id,
|
Photo photo, Document document) {
|
||||||
std::move(key), std::move(arg), std::move(photo),
|
return td::make_unique<NotificationTypePushMessage>(sender_user_id, sender_dialog_id, std::move(sender_name),
|
||||||
std::move(document));
|
is_outgoing, message_id, std::move(key), std::move(arg),
|
||||||
|
std::move(photo), std::move(document));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -59,8 +59,9 @@ unique_ptr<NotificationType> create_new_secret_chat_notification();
|
|||||||
|
|
||||||
unique_ptr<NotificationType> create_new_call_notification(CallId call_id);
|
unique_ptr<NotificationType> create_new_call_notification(CallId call_id);
|
||||||
|
|
||||||
unique_ptr<NotificationType> create_new_push_message_notification(UserId sender_user_id, string sender_name,
|
unique_ptr<NotificationType> create_new_push_message_notification(UserId sender_user_id, DialogId sender_dialog_id,
|
||||||
bool is_outgoing, MessageId message_id, string key,
|
string sender_name, bool is_outgoing,
|
||||||
string arg, Photo photo, Document document);
|
MessageId message_id, string key, string arg,
|
||||||
|
Photo photo, Document document);
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -400,15 +400,9 @@ bool UpdatesManager::is_acceptable_message_forward_header(
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto flags = header->flags_;
|
auto flags = header->flags_;
|
||||||
if (flags & telegram_api::messageFwdHeader::CHANNEL_ID_MASK) {
|
|
||||||
ChannelId channel_id(header->channel_id_);
|
|
||||||
if (!is_acceptable_channel(channel_id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (flags & telegram_api::messageFwdHeader::FROM_ID_MASK) {
|
if (flags & telegram_api::messageFwdHeader::FROM_ID_MASK) {
|
||||||
UserId user_id(header->from_id_);
|
DialogId dialog_id(header->from_id_);
|
||||||
if (!is_acceptable_user(user_id)) {
|
if (!is_acceptable_dialog(dialog_id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -431,11 +425,11 @@ bool UpdatesManager::is_acceptable_message(const telegram_api::Message *message_
|
|||||||
case telegram_api::message::ID: {
|
case telegram_api::message::ID: {
|
||||||
auto message = static_cast<const telegram_api::message *>(message_ptr);
|
auto message = static_cast<const telegram_api::message *>(message_ptr);
|
||||||
|
|
||||||
if (!is_acceptable_dialog(DialogId(message->to_id_))) {
|
if (!is_acceptable_dialog(DialogId(message->peer_id_))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (message->flags_ & MessagesManager::MESSAGE_FLAG_HAS_FROM_ID) {
|
if (message->flags_ & MessagesManager::MESSAGE_FLAG_HAS_FROM_ID) {
|
||||||
if (!is_acceptable_user(UserId(message->from_id_))) {
|
if (!is_acceptable_dialog(DialogId(message->from_id_))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -522,11 +516,11 @@ bool UpdatesManager::is_acceptable_message(const telegram_api::Message *message_
|
|||||||
case telegram_api::messageService::ID: {
|
case telegram_api::messageService::ID: {
|
||||||
auto message = static_cast<const telegram_api::messageService *>(message_ptr);
|
auto message = static_cast<const telegram_api::messageService *>(message_ptr);
|
||||||
|
|
||||||
if (!is_acceptable_dialog(DialogId(message->to_id_))) {
|
if (!is_acceptable_dialog(DialogId(message->peer_id_))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (message->flags_ & MessagesManager::MESSAGE_FLAG_HAS_FROM_ID) {
|
if (message->flags_ & MessagesManager::MESSAGE_FLAG_HAS_FROM_ID) {
|
||||||
if (!is_acceptable_user(UserId(message->from_id_))) {
|
if (!is_acceptable_dialog(DialogId(message->from_id_))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -698,16 +692,18 @@ void UpdatesManager::on_get_updates(tl_object_ptr<telegram_api::Updates> &&updat
|
|||||||
|
|
||||||
auto from_id = update->flags_ & MessagesManager::MESSAGE_FLAG_IS_OUT ? td_->contacts_manager_->get_my_id().get()
|
auto from_id = update->flags_ & MessagesManager::MESSAGE_FLAG_IS_OUT ? td_->contacts_manager_->get_my_id().get()
|
||||||
: update->user_id_;
|
: update->user_id_;
|
||||||
|
auto peer_id = update->flags_ & MessagesManager::MESSAGE_FLAG_IS_OUT ? update->user_id_
|
||||||
|
: td_->contacts_manager_->get_my_id().get();
|
||||||
|
|
||||||
update->flags_ |= MessagesManager::MESSAGE_FLAG_HAS_FROM_ID;
|
update->flags_ |= MessagesManager::MESSAGE_FLAG_HAS_FROM_ID;
|
||||||
on_pending_update(
|
on_pending_update(make_tl_object<telegram_api::updateNewMessage>(
|
||||||
make_tl_object<telegram_api::updateNewMessage>(
|
|
||||||
make_tl_object<telegram_api::message>(
|
make_tl_object<telegram_api::message>(
|
||||||
update->flags_, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
update->flags_, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, update->id_, from_id,
|
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||||
make_tl_object<telegram_api::peerUser>(update->user_id_), std::move(update->fwd_from_),
|
false /*ignored*/, update->id_, make_tl_object<telegram_api::peerUser>(from_id),
|
||||||
update->via_bot_id_, update->reply_to_msg_id_, 0, update->date_, update->message_, nullptr, nullptr,
|
make_tl_object<telegram_api::peerUser>(peer_id), std::move(update->fwd_from_),
|
||||||
std::move(update->entities_), 0, 0, nullptr, 0, string(), 0, Auto()),
|
update->via_bot_id_, std::move(update->reply_to_), update->date_, update->message_,
|
||||||
|
nullptr, nullptr, std::move(update->entities_), 0, 0, nullptr, 0, string(), 0, Auto()),
|
||||||
update->pts_, update->pts_count_),
|
update->pts_, update->pts_count_),
|
||||||
0, "telegram_api::updatesShortMessage");
|
0, "telegram_api::updatesShortMessage");
|
||||||
break;
|
break;
|
||||||
@ -724,14 +720,15 @@ void UpdatesManager::on_get_updates(tl_object_ptr<telegram_api::Updates> &&updat
|
|||||||
}
|
}
|
||||||
|
|
||||||
update->flags_ |= MessagesManager::MESSAGE_FLAG_HAS_FROM_ID;
|
update->flags_ |= MessagesManager::MESSAGE_FLAG_HAS_FROM_ID;
|
||||||
on_pending_update(make_tl_object<telegram_api::updateNewMessage>(
|
on_pending_update(
|
||||||
|
make_tl_object<telegram_api::updateNewMessage>(
|
||||||
make_tl_object<telegram_api::message>(
|
make_tl_object<telegram_api::message>(
|
||||||
update->flags_, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
update->flags_, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, update->id_,
|
||||||
false /*ignored*/, update->id_, update->from_id_,
|
make_tl_object<telegram_api::peerUser>(update->from_id_),
|
||||||
make_tl_object<telegram_api::peerChat>(update->chat_id_), std::move(update->fwd_from_),
|
make_tl_object<telegram_api::peerChat>(update->chat_id_), std::move(update->fwd_from_),
|
||||||
update->via_bot_id_, update->reply_to_msg_id_, 0, update->date_, update->message_,
|
update->via_bot_id_, std::move(update->reply_to_), update->date_, update->message_, nullptr, nullptr,
|
||||||
nullptr, nullptr, std::move(update->entities_), 0, 0, nullptr, 0, string(), 0, Auto()),
|
std::move(update->entities_), 0, 0, nullptr, 0, string(), 0, Auto()),
|
||||||
update->pts_, update->pts_count_),
|
update->pts_, update->pts_count_),
|
||||||
0, "telegram_api::updatesShortChatMessage");
|
0, "telegram_api::updatesShortChatMessage");
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user