Improve field names style.
This commit is contained in:
parent
c24501f2d9
commit
47d4c08de2
@ -14801,7 +14801,7 @@ DialogParticipants ContactsManager::search_private_chat_participants(UserId my_u
|
||||
const string &query, int32 limit,
|
||||
DialogParticipantsFilter filter) const {
|
||||
vector<DialogId> dialog_ids;
|
||||
switch (filter.type) {
|
||||
switch (filter.type_) {
|
||||
case DialogParticipantsFilter::Type::Contacts:
|
||||
if (peer_user_id.is_valid() && is_user_contact(peer_user_id)) {
|
||||
dialog_ids.push_back(DialogId(peer_user_id));
|
||||
@ -14862,7 +14862,7 @@ void ContactsManager::search_dialog_participants(DialogId dialog_id, const strin
|
||||
td_api::object_ptr<td_api::SupergroupMembersFilter> request_filter;
|
||||
string additional_query;
|
||||
int32 additional_limit = 0;
|
||||
switch (filter.type) {
|
||||
switch (filter.type_) {
|
||||
case DialogParticipantsFilter::Type::Contacts:
|
||||
request_filter = td_api::make_object<td_api::supergroupMembersFilterContacts>();
|
||||
break;
|
||||
@ -14880,7 +14880,7 @@ void ContactsManager::search_dialog_participants(DialogId dialog_id, const strin
|
||||
break;
|
||||
case DialogParticipantsFilter::Type::Mention:
|
||||
request_filter =
|
||||
td_api::make_object<td_api::supergroupMembersFilterMention>(query, filter.top_thread_message_id.get());
|
||||
td_api::make_object<td_api::supergroupMembersFilterMention>(query, filter.top_thread_message_id_.get());
|
||||
break;
|
||||
case DialogParticipantsFilter::Type::Bots:
|
||||
request_filter = td_api::make_object<td_api::supergroupMembersFilterBots>();
|
||||
@ -14888,7 +14888,7 @@ void ContactsManager::search_dialog_participants(DialogId dialog_id, const strin
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
switch (filter.type) {
|
||||
switch (filter.type_) {
|
||||
case DialogParticipantsFilter::Type::Contacts:
|
||||
case DialogParticipantsFilter::Type::Administrators:
|
||||
case DialogParticipantsFilter::Type::Bots:
|
||||
@ -14988,7 +14988,7 @@ void ContactsManager::do_search_chat_participants(ChatId chat_id, const string &
|
||||
}
|
||||
|
||||
auto is_dialog_participant_suitable = [this, filter](const DialogParticipant &participant) {
|
||||
switch (filter.type) {
|
||||
switch (filter.type_) {
|
||||
case DialogParticipantsFilter::Type::Contacts:
|
||||
return participant.dialog_id.get_type() == DialogType::User &&
|
||||
is_user_contact(participant.dialog_id.get_user_id());
|
||||
|
@ -770,30 +770,30 @@ td_api::object_ptr<td_api::chatMembers> DialogParticipants::get_chat_members_obj
|
||||
|
||||
tl_object_ptr<telegram_api::ChannelParticipantsFilter>
|
||||
ChannelParticipantsFilter::get_input_channel_participants_filter() const {
|
||||
switch (type) {
|
||||
switch (type_) {
|
||||
case Type::Recent:
|
||||
return make_tl_object<telegram_api::channelParticipantsRecent>();
|
||||
case Type::Contacts:
|
||||
return make_tl_object<telegram_api::channelParticipantsContacts>(query);
|
||||
return make_tl_object<telegram_api::channelParticipantsContacts>(query_);
|
||||
case Type::Administrators:
|
||||
return make_tl_object<telegram_api::channelParticipantsAdmins>();
|
||||
case Type::Search:
|
||||
return make_tl_object<telegram_api::channelParticipantsSearch>(query);
|
||||
return make_tl_object<telegram_api::channelParticipantsSearch>(query_);
|
||||
case Type::Mention: {
|
||||
int32 flags = 0;
|
||||
if (!query.empty()) {
|
||||
if (!query_.empty()) {
|
||||
flags |= telegram_api::channelParticipantsMentions::Q_MASK;
|
||||
}
|
||||
if (top_thread_message_id.is_valid()) {
|
||||
if (top_thread_message_id_.is_valid()) {
|
||||
flags |= telegram_api::channelParticipantsMentions::TOP_MSG_ID_MASK;
|
||||
}
|
||||
return make_tl_object<telegram_api::channelParticipantsMentions>(
|
||||
flags, query, top_thread_message_id.get_server_message_id().get());
|
||||
flags, query_, top_thread_message_id_.get_server_message_id().get());
|
||||
}
|
||||
case Type::Restricted:
|
||||
return make_tl_object<telegram_api::channelParticipantsBanned>(query);
|
||||
return make_tl_object<telegram_api::channelParticipantsBanned>(query_);
|
||||
case Type::Banned:
|
||||
return make_tl_object<telegram_api::channelParticipantsKicked>(query);
|
||||
return make_tl_object<telegram_api::channelParticipantsKicked>(query_);
|
||||
case Type::Bots:
|
||||
return make_tl_object<telegram_api::channelParticipantsBots>();
|
||||
default:
|
||||
@ -804,67 +804,67 @@ ChannelParticipantsFilter::get_input_channel_participants_filter() const {
|
||||
|
||||
ChannelParticipantsFilter::ChannelParticipantsFilter(const tl_object_ptr<td_api::SupergroupMembersFilter> &filter) {
|
||||
if (filter == nullptr) {
|
||||
type = Type::Recent;
|
||||
type_ = Type::Recent;
|
||||
return;
|
||||
}
|
||||
switch (filter->get_id()) {
|
||||
case td_api::supergroupMembersFilterRecent::ID:
|
||||
type = Type::Recent;
|
||||
type_ = Type::Recent;
|
||||
return;
|
||||
case td_api::supergroupMembersFilterContacts::ID:
|
||||
type = Type::Contacts;
|
||||
query = static_cast<const td_api::supergroupMembersFilterContacts *>(filter.get())->query_;
|
||||
type_ = Type::Contacts;
|
||||
query_ = static_cast<const td_api::supergroupMembersFilterContacts *>(filter.get())->query_;
|
||||
return;
|
||||
case td_api::supergroupMembersFilterAdministrators::ID:
|
||||
type = Type::Administrators;
|
||||
type_ = Type::Administrators;
|
||||
return;
|
||||
case td_api::supergroupMembersFilterSearch::ID:
|
||||
type = Type::Search;
|
||||
query = static_cast<const td_api::supergroupMembersFilterSearch *>(filter.get())->query_;
|
||||
type_ = Type::Search;
|
||||
query_ = static_cast<const td_api::supergroupMembersFilterSearch *>(filter.get())->query_;
|
||||
return;
|
||||
case td_api::supergroupMembersFilterMention::ID: {
|
||||
auto mention_filter = static_cast<const td_api::supergroupMembersFilterMention *>(filter.get());
|
||||
type = Type::Mention;
|
||||
query = mention_filter->query_;
|
||||
top_thread_message_id = MessageId(mention_filter->message_thread_id_);
|
||||
if (!top_thread_message_id.is_valid() || !top_thread_message_id.is_server()) {
|
||||
top_thread_message_id = MessageId();
|
||||
type_ = Type::Mention;
|
||||
query_ = mention_filter->query_;
|
||||
top_thread_message_id_ = MessageId(mention_filter->message_thread_id_);
|
||||
if (!top_thread_message_id_.is_valid() || !top_thread_message_id_.is_server()) {
|
||||
top_thread_message_id_ = MessageId();
|
||||
}
|
||||
return;
|
||||
}
|
||||
case td_api::supergroupMembersFilterRestricted::ID:
|
||||
type = Type::Restricted;
|
||||
query = static_cast<const td_api::supergroupMembersFilterRestricted *>(filter.get())->query_;
|
||||
type_ = Type::Restricted;
|
||||
query_ = static_cast<const td_api::supergroupMembersFilterRestricted *>(filter.get())->query_;
|
||||
return;
|
||||
case td_api::supergroupMembersFilterBanned::ID:
|
||||
type = Type::Banned;
|
||||
query = static_cast<const td_api::supergroupMembersFilterBanned *>(filter.get())->query_;
|
||||
type_ = Type::Banned;
|
||||
query_ = static_cast<const td_api::supergroupMembersFilterBanned *>(filter.get())->query_;
|
||||
return;
|
||||
case td_api::supergroupMembersFilterBots::ID:
|
||||
type = Type::Bots;
|
||||
type_ = Type::Bots;
|
||||
return;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
type = Type::Recent;
|
||||
type_ = Type::Recent;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const ChannelParticipantsFilter &filter) {
|
||||
switch (filter.type) {
|
||||
switch (filter.type_) {
|
||||
case ChannelParticipantsFilter::Type::Recent:
|
||||
return string_builder << "Recent";
|
||||
case ChannelParticipantsFilter::Type::Contacts:
|
||||
return string_builder << "Contacts \"" << filter.query << '"';
|
||||
return string_builder << "Contacts \"" << filter.query_ << '"';
|
||||
case ChannelParticipantsFilter::Type::Administrators:
|
||||
return string_builder << "Administrators";
|
||||
case ChannelParticipantsFilter::Type::Search:
|
||||
return string_builder << "Search \"" << filter.query << '"';
|
||||
return string_builder << "Search \"" << filter.query_ << '"';
|
||||
case ChannelParticipantsFilter::Type::Mention:
|
||||
return string_builder << "Mention \"" << filter.query << "\" in thread of " << filter.top_thread_message_id;
|
||||
return string_builder << "Mention \"" << filter.query_ << "\" in thread of " << filter.top_thread_message_id_;
|
||||
case ChannelParticipantsFilter::Type::Restricted:
|
||||
return string_builder << "Restricted \"" << filter.query << '"';
|
||||
return string_builder << "Restricted \"" << filter.query_ << '"';
|
||||
case ChannelParticipantsFilter::Type::Banned:
|
||||
return string_builder << "Banned \"" << filter.query << '"';
|
||||
return string_builder << "Banned \"" << filter.query_ << '"';
|
||||
case ChannelParticipantsFilter::Type::Bots:
|
||||
return string_builder << "Bots";
|
||||
default:
|
||||
@ -874,7 +874,7 @@ StringBuilder &operator<<(StringBuilder &string_builder, const ChannelParticipan
|
||||
}
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const DialogParticipantsFilter &filter) {
|
||||
switch (filter.type) {
|
||||
switch (filter.type_) {
|
||||
case DialogParticipantsFilter::Type::Contacts:
|
||||
return string_builder << "Contacts";
|
||||
case DialogParticipantsFilter::Type::Administrators:
|
||||
|
@ -448,9 +448,10 @@ struct DialogParticipants {
|
||||
};
|
||||
|
||||
class ChannelParticipantsFilter {
|
||||
enum class Type : int32 { Recent, Contacts, Administrators, Search, Mention, Restricted, Banned, Bots } type;
|
||||
string query;
|
||||
MessageId top_thread_message_id;
|
||||
enum class Type : int32 { Recent, Contacts, Administrators, Search, Mention, Restricted, Banned, Bots };
|
||||
Type type_;
|
||||
string query_;
|
||||
MessageId top_thread_message_id_;
|
||||
|
||||
friend StringBuilder &operator<<(StringBuilder &string_builder, const ChannelParticipantsFilter &filter);
|
||||
|
||||
@ -460,31 +461,31 @@ class ChannelParticipantsFilter {
|
||||
tl_object_ptr<telegram_api::ChannelParticipantsFilter> get_input_channel_participants_filter() const;
|
||||
|
||||
bool is_administrators() const {
|
||||
return type == Type::Administrators;
|
||||
return type_ == Type::Administrators;
|
||||
}
|
||||
|
||||
bool is_bots() const {
|
||||
return type == Type::Bots;
|
||||
return type_ == Type::Bots;
|
||||
}
|
||||
|
||||
bool is_recent() const {
|
||||
return type == Type::Recent;
|
||||
return type_ == Type::Recent;
|
||||
}
|
||||
|
||||
bool is_contacts() const {
|
||||
return type == Type::Contacts;
|
||||
return type_ == Type::Contacts;
|
||||
}
|
||||
|
||||
bool is_search() const {
|
||||
return type == Type::Search;
|
||||
return type_ == Type::Search;
|
||||
}
|
||||
|
||||
bool is_restricted() const {
|
||||
return type == Type::Restricted;
|
||||
return type_ == Type::Restricted;
|
||||
}
|
||||
|
||||
bool is_banned() const {
|
||||
return type == Type::Banned;
|
||||
return type_ == Type::Banned;
|
||||
}
|
||||
};
|
||||
|
||||
@ -493,11 +494,11 @@ StringBuilder &operator<<(StringBuilder &string_builder, const ChannelParticipan
|
||||
class DialogParticipantsFilter {
|
||||
public:
|
||||
enum class Type : int32 { Contacts, Administrators, Members, Restricted, Banned, Mention, Bots };
|
||||
Type type;
|
||||
MessageId top_thread_message_id;
|
||||
Type type_;
|
||||
MessageId top_thread_message_id_;
|
||||
|
||||
explicit DialogParticipantsFilter(Type type, MessageId top_thread_message_id = MessageId())
|
||||
: type(type), top_thread_message_id(top_thread_message_id) {
|
||||
: type_(type), top_thread_message_id_(top_thread_message_id) {
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user