Improve naming of selected message sender in a chat.
This commit is contained in:
parent
3ff9723722
commit
81cebe39eb
@ -968,7 +968,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa
|
|||||||
//@permissions Actions that non-administrator chat members are allowed to take in the chat
|
//@permissions Actions that non-administrator chat members are allowed to take in the chat
|
||||||
//@last_message Last message in the chat; may be null
|
//@last_message Last message in the chat; may be null
|
||||||
//@positions Positions of the chat in chat lists
|
//@positions Positions of the chat in chat lists
|
||||||
//@default_message_sender_id Default identifier of a user or chat that is chosen to send messages in the chat; may be null if the user can't change message sender
|
//@message_sender_id Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender
|
||||||
//@has_protected_content True, if chat content can't be saved locally, forwarded, or copied
|
//@has_protected_content True, if chat content can't be saved locally, forwarded, or copied
|
||||||
//@is_marked_as_unread True, if the chat is marked as unread
|
//@is_marked_as_unread True, if the chat is marked as unread
|
||||||
//@is_blocked True, if the chat is blocked by the current user and private messages from the chat can't be received
|
//@is_blocked True, if the chat is blocked by the current user and private messages from the chat can't be received
|
||||||
@ -990,7 +990,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa
|
|||||||
//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
|
//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
|
||||||
//@draft_message A draft of a message in the chat; may be null
|
//@draft_message A draft of a message in the chat; may be null
|
||||||
//@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used
|
//@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used
|
||||||
chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector<chatPosition> default_message_sender_id:MessageSender has_protected_content:Bool is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings message_ttl_setting:int32 theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector<chatPosition> message_sender_id:MessageSender has_protected_content:Bool is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings message_ttl_setting:int32 theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
||||||
|
|
||||||
//@description Represents a list of chats @total_count Approximate total count of chats found @chat_ids List of chat identifiers
|
//@description Represents a list of chats @total_count Approximate total count of chats found @chat_ids List of chat identifiers
|
||||||
chats total_count:int32 chat_ids:vector<int53> = Chats;
|
chats total_count:int32 chat_ids:vector<int53> = Chats;
|
||||||
@ -3725,8 +3725,8 @@ updateChatLastMessage chat_id:int53 last_message:message positions:vector<chatPo
|
|||||||
//@description The position of a chat in a chat list has changed. Instead of this update updateChatLastMessage or updateChatDraftMessage might be sent @chat_id Chat identifier @position New chat position. If new order is 0, then the chat needs to be removed from the list
|
//@description The position of a chat in a chat list has changed. Instead of this update updateChatLastMessage or updateChatDraftMessage might be sent @chat_id Chat identifier @position New chat position. If new order is 0, then the chat needs to be removed from the list
|
||||||
updateChatPosition chat_id:int53 position:chatPosition = Update;
|
updateChatPosition chat_id:int53 position:chatPosition = Update;
|
||||||
|
|
||||||
//@description The default message sender that is chosen to send messages in a chat has changed @chat_id Chat identifier @default_message_sender_id New value of default_message_sender_id; may be null if the user can't change message sender
|
//@description The message sender that is selected to send messages in a chat has changed @chat_id Chat identifier @message_sender_id New value of message_sender_id; may be null if the user can't change message sender
|
||||||
updateChatDefaultMessageSenderId chat_id:int53 default_message_sender_id:MessageSender = Update;
|
updateChatMessageSender chat_id:int53 message_sender_id:MessageSender = Update;
|
||||||
|
|
||||||
//@description A chat content was allowed or restricted for saving @chat_id Chat identifier @has_protected_content New value of has_protected_content
|
//@description A chat content was allowed or restricted for saving @chat_id Chat identifier @has_protected_content New value of has_protected_content
|
||||||
updateChatHasProtectedContent chat_id:int53 has_protected_content:Bool = Update;
|
updateChatHasProtectedContent chat_id:int53 has_protected_content:Bool = Update;
|
||||||
@ -4395,8 +4395,8 @@ getMessageLinkInfo url:string = MessageLinkInfo;
|
|||||||
//@description Returns list of message sender identifiers, which can be used to send messages in a chat @chat_id Chat identifier
|
//@description Returns list of message sender identifiers, which can be used to send messages in a chat @chat_id Chat identifier
|
||||||
getChatAvailableMessageSenders chat_id:int53 = MessageSenders;
|
getChatAvailableMessageSenders chat_id:int53 = MessageSenders;
|
||||||
|
|
||||||
//@description Changes default message sender that is chosen in a chat @chat_id Chat identifier @default_message_sender_id New default message sender in the chat
|
//@description Selects a message sender to send messages in a chat @chat_id Chat identifier @message_sender_id New message sender for the chat
|
||||||
setChatDefaultMessageSender chat_id:int53 default_message_sender_id:MessageSender = Ok;
|
setChatMessageSender chat_id:int53 message_sender_id:MessageSender = Ok;
|
||||||
|
|
||||||
//@description Sends a message. Returns the sent message
|
//@description Sends a message. Returns the sent message
|
||||||
//@chat_id Target chat
|
//@chat_id Target chat
|
||||||
|
@ -20108,7 +20108,7 @@ void MessagesManager::open_dialog(Dialog *d) {
|
|||||||
d->default_send_message_as_dialog_id = DialogId();
|
d->default_send_message_as_dialog_id = DialogId();
|
||||||
LOG(INFO) << "Set message sender in " << d->dialog_id << " to " << d->default_send_message_as_dialog_id;
|
LOG(INFO) << "Set message sender in " << d->dialog_id << " to " << d->default_send_message_as_dialog_id;
|
||||||
on_dialog_updated(dialog_id, "open_dialog");
|
on_dialog_updated(dialog_id, "open_dialog");
|
||||||
send_update_chat_default_message_sender_id(d);
|
send_update_chat_message_sender(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dialog_id.get_type()) {
|
switch (dialog_id.get_type()) {
|
||||||
@ -20324,9 +20324,10 @@ td_api::object_ptr<td_api::videoChat> MessagesManager::get_video_chat_object(con
|
|||||||
std::move(default_participant_alias));
|
std::move(default_participant_alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::MessageSender> MessagesManager::get_default_sender_id_object(const Dialog *d) const {
|
td_api::object_ptr<td_api::MessageSender> MessagesManager::get_default_message_sender_object(const Dialog *d) const {
|
||||||
auto as_dialog_id = d->default_send_message_as_dialog_id;
|
auto as_dialog_id = d->default_send_message_as_dialog_id;
|
||||||
return as_dialog_id.is_valid() ? get_message_sender_object_const(td_, as_dialog_id, "get_default_sender_id_object")
|
return as_dialog_id.is_valid()
|
||||||
|
? get_message_sender_object_const(td_, as_dialog_id, "get_default_message_sender_object")
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20394,9 +20395,10 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
|
|||||||
get_chat_photo_info_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)),
|
get_chat_photo_info_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)),
|
||||||
get_dialog_default_permissions(d->dialog_id).get_chat_permissions_object(),
|
get_dialog_default_permissions(d->dialog_id).get_chat_permissions_object(),
|
||||||
get_message_object(d->dialog_id, get_message(d, d->last_message_id), "get_chat_object"),
|
get_message_object(d->dialog_id, get_message(d, d->last_message_id), "get_chat_object"),
|
||||||
get_chat_positions_object(d), get_default_sender_id_object(d), get_dialog_has_protected_content(d->dialog_id),
|
get_chat_positions_object(d), get_default_message_sender_object(d),
|
||||||
d->is_marked_as_unread, d->is_blocked, get_dialog_has_scheduled_messages(d), can_delete_for_self,
|
get_dialog_has_protected_content(d->dialog_id), d->is_marked_as_unread, d->is_blocked,
|
||||||
can_delete_for_all_users, can_report_dialog(d->dialog_id), d->notification_settings.silent_send_message,
|
get_dialog_has_scheduled_messages(d), can_delete_for_self, can_delete_for_all_users,
|
||||||
|
can_report_dialog(d->dialog_id), d->notification_settings.silent_send_message,
|
||||||
d->server_unread_count + d->local_unread_count, d->last_read_inbox_message_id.get(),
|
d->server_unread_count + d->local_unread_count, d->last_read_inbox_message_id.get(),
|
||||||
d->last_read_outbox_message_id.get(), d->unread_mention_count,
|
d->last_read_outbox_message_id.get(), d->unread_mention_count,
|
||||||
get_chat_notification_settings_object(&d->notification_settings),
|
get_chat_notification_settings_object(&d->notification_settings),
|
||||||
@ -29582,13 +29584,13 @@ void MessagesManager::send_update_chat_video_chat(const Dialog *d) {
|
|||||||
td_api::make_object<td_api::updateChatVideoChat>(d->dialog_id.get(), get_video_chat_object(d)));
|
td_api::make_object<td_api::updateChatVideoChat>(d->dialog_id.get(), get_video_chat_object(d)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::send_update_chat_default_message_sender_id(const Dialog *d) {
|
void MessagesManager::send_update_chat_message_sender(const Dialog *d) {
|
||||||
CHECK(!td_->auth_manager_->is_bot());
|
CHECK(!td_->auth_manager_->is_bot());
|
||||||
CHECK(d != nullptr);
|
CHECK(d != nullptr);
|
||||||
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_default_message_sender_id";
|
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_message_sender";
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(
|
||||||
td_api::make_object<td_api::updateChatDefaultMessageSenderId>(d->dialog_id.get(),
|
G()->td(), &Td::send_update,
|
||||||
get_default_sender_id_object(d)));
|
td_api::make_object<td_api::updateChatMessageSender>(d->dialog_id.get(), get_default_message_sender_object(d)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::send_update_chat_message_ttl_setting(const Dialog *d) {
|
void MessagesManager::send_update_chat_message_ttl_setting(const Dialog *d) {
|
||||||
@ -30998,7 +31000,7 @@ void MessagesManager::on_update_dialog_default_send_message_as_dialog_id(DialogI
|
|||||||
LOG(INFO) << "Set message sender in " << dialog_id << " to " << default_send_as_dialog_id;
|
LOG(INFO) << "Set message sender in " << dialog_id << " to " << default_send_as_dialog_id;
|
||||||
d->need_drop_default_send_message_as_dialog_id = false;
|
d->need_drop_default_send_message_as_dialog_id = false;
|
||||||
d->default_send_message_as_dialog_id = default_send_as_dialog_id;
|
d->default_send_message_as_dialog_id = default_send_as_dialog_id;
|
||||||
send_update_chat_default_message_sender_id(d);
|
send_update_chat_message_sender(d);
|
||||||
} else {
|
} else {
|
||||||
LOG(INFO) << "Postpone removal of message sender in " << dialog_id;
|
LOG(INFO) << "Postpone removal of message sender in " << dialog_id;
|
||||||
d->need_drop_default_send_message_as_dialog_id = true;
|
d->need_drop_default_send_message_as_dialog_id = true;
|
||||||
@ -35099,7 +35101,7 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
|
|||||||
LOG(INFO) << "Set postponed message sender in " << pending_dialog_id << " to " << dialog_id;
|
LOG(INFO) << "Set postponed message sender in " << pending_dialog_id << " to " << dialog_id;
|
||||||
pending_d->need_drop_default_send_message_as_dialog_id = pending_dialog_id.second;
|
pending_d->need_drop_default_send_message_as_dialog_id = pending_dialog_id.second;
|
||||||
pending_d->default_send_message_as_dialog_id = dialog_id;
|
pending_d->default_send_message_as_dialog_id = dialog_id;
|
||||||
send_update_chat_default_message_sender_id(pending_d);
|
send_update_chat_message_sender(pending_d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35214,7 +35216,7 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
|
|||||||
LOG(INFO) << "Set message sender in " << dialog_id << " to " << default_send_message_as_dialog_id;
|
LOG(INFO) << "Set message sender in " << dialog_id << " to " << default_send_message_as_dialog_id;
|
||||||
d->need_drop_default_send_message_as_dialog_id = need_drop_default_send_message_as_dialog_id;
|
d->need_drop_default_send_message_as_dialog_id = need_drop_default_send_message_as_dialog_id;
|
||||||
d->default_send_message_as_dialog_id = default_send_message_as_dialog_id;
|
d->default_send_message_as_dialog_id = default_send_message_as_dialog_id;
|
||||||
send_update_chat_default_message_sender_id(d);
|
send_update_chat_message_sender(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2398,7 +2398,7 @@ class MessagesManager final : public Actor {
|
|||||||
|
|
||||||
void send_update_chat_video_chat(const Dialog *d);
|
void send_update_chat_video_chat(const Dialog *d);
|
||||||
|
|
||||||
void send_update_chat_default_message_sender_id(const Dialog *d);
|
void send_update_chat_message_sender(const Dialog *d);
|
||||||
|
|
||||||
void send_update_chat_message_ttl_setting(const Dialog *d);
|
void send_update_chat_message_ttl_setting(const Dialog *d);
|
||||||
|
|
||||||
@ -2599,7 +2599,7 @@ class MessagesManager final : public Actor {
|
|||||||
|
|
||||||
td_api::object_ptr<td_api::videoChat> get_video_chat_object(const Dialog *d) const;
|
td_api::object_ptr<td_api::videoChat> get_video_chat_object(const Dialog *d) const;
|
||||||
|
|
||||||
td_api::object_ptr<td_api::MessageSender> get_default_sender_id_object(const Dialog *d) const;
|
td_api::object_ptr<td_api::MessageSender> get_default_message_sender_object(const Dialog *d) const;
|
||||||
|
|
||||||
td_api::object_ptr<td_api::chat> get_chat_object(const Dialog *d) const;
|
td_api::object_ptr<td_api::chat> get_chat_object(const Dialog *d) const;
|
||||||
|
|
||||||
|
@ -5298,11 +5298,11 @@ void Td::on_request(uint64 id, const td_api::getChatAvailableMessageSenders &req
|
|||||||
messages_manager_->get_dialog_send_message_as_dialog_ids(DialogId(request.chat_id_), std::move(promise));
|
messages_manager_->get_dialog_send_message_as_dialog_ids(DialogId(request.chat_id_), std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::setChatDefaultMessageSender &request) {
|
void Td::on_request(uint64 id, const td_api::setChatMessageSender &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
TRY_RESULT_PROMISE(promise, message_sender_dialog_id,
|
TRY_RESULT_PROMISE(promise, message_sender_dialog_id,
|
||||||
get_message_sender_dialog_id(this, request.default_message_sender_id_, true, false));
|
get_message_sender_dialog_id(this, request.message_sender_id_, true, false));
|
||||||
messages_manager_->set_dialog_default_send_message_as_dialog_id(DialogId(request.chat_id_), message_sender_dialog_id,
|
messages_manager_->set_dialog_default_send_message_as_dialog_id(DialogId(request.chat_id_), message_sender_dialog_id,
|
||||||
std::move(promise));
|
std::move(promise));
|
||||||
}
|
}
|
||||||
|
@ -661,7 +661,7 @@ class Td final : public Actor {
|
|||||||
|
|
||||||
void on_request(uint64 id, const td_api::getChatAvailableMessageSenders &request);
|
void on_request(uint64 id, const td_api::getChatAvailableMessageSenders &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::setChatDefaultMessageSender &request);
|
void on_request(uint64 id, const td_api::setChatMessageSender &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::sendMessage &request);
|
void on_request(uint64 id, td_api::sendMessage &request);
|
||||||
|
|
||||||
|
@ -3261,12 +3261,12 @@ class CliClient final : public Actor {
|
|||||||
message_thread_id_ = std::move(args);
|
message_thread_id_ = std::move(args);
|
||||||
} else if (op == "gcams") {
|
} else if (op == "gcams") {
|
||||||
send_request(td_api::make_object<td_api::getChatAvailableMessageSenders>(as_chat_id(args)));
|
send_request(td_api::make_object<td_api::getChatAvailableMessageSenders>(as_chat_id(args)));
|
||||||
} else if (op == "scdms") {
|
} else if (op == "scmsr") {
|
||||||
string chat_id;
|
string chat_id;
|
||||||
string sender_id;
|
string sender_id;
|
||||||
get_args(args, chat_id, sender_id);
|
get_args(args, chat_id, sender_id);
|
||||||
send_request(
|
send_request(
|
||||||
td_api::make_object<td_api::setChatDefaultMessageSender>(as_chat_id(chat_id), as_message_sender(sender_id)));
|
td_api::make_object<td_api::setChatMessageSender>(as_chat_id(chat_id), as_message_sender(sender_id)));
|
||||||
} else if (op == "sm" || op == "sms" || op == "smr" || op == "smf") {
|
} else if (op == "sm" || op == "sms" || op == "smr" || op == "smf") {
|
||||||
string chat_id;
|
string chat_id;
|
||||||
string reply_to_message_id;
|
string reply_to_message_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user