aboutsummaryrefslogtreecommitdiffhomepage
path: root/td/telegram/ChatReactions.cpp
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2023-11-19 02:03:19 +0300
committerlevlam <levlam@telegram.org>2023-11-19 02:03:19 +0300
commit3e3fe5f9bbc44d70bf0e01da4d565585c9433a0b (patch)
treebc4276b2b6b126b8476515394b3fbc7039c6086e /td/telegram/ChatReactions.cpp
parentec788c7505c4f2b31b59743d2f4f97d6fdcba451 (diff)
Improve ChatReactions field names.
Diffstat (limited to 'td/telegram/ChatReactions.cpp')
-rw-r--r--td/telegram/ChatReactions.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/td/telegram/ChatReactions.cpp b/td/telegram/ChatReactions.cpp
index ac2c6370e..879be05f3 100644
--- a/td/telegram/ChatReactions.cpp
+++ b/td/telegram/ChatReactions.cpp
@@ -19,8 +19,8 @@ ChatReactions::ChatReactions(telegram_api::object_ptr<telegram_api::ChatReaction
break;
case telegram_api::chatReactionsAll::ID: {
auto chat_reactions = move_tl_object_as<telegram_api::chatReactionsAll>(chat_reactions_ptr);
- allow_all_ = true;
- allow_custom_ = chat_reactions->allow_custom_;
+ allow_all_regular_ = true;
+ allow_all_custom_ = chat_reactions->allow_custom_;
break;
}
case telegram_api::chatReactionsSome::ID: {
@@ -36,14 +36,14 @@ ChatReactions::ChatReactions(telegram_api::object_ptr<telegram_api::ChatReaction
}
ChatReactions::ChatReactions(td_api::object_ptr<td_api::ChatAvailableReactions> &&chat_reactions_ptr,
- bool allow_custom) {
+ bool allow_all_custom) {
if (chat_reactions_ptr == nullptr) {
return;
}
switch (chat_reactions_ptr->get_id()) {
case td_api::chatAvailableReactionsAll::ID:
- allow_all_ = true;
- allow_custom_ = allow_custom;
+ allow_all_regular_ = true;
+ allow_all_custom_ = allow_all_custom;
break;
case td_api::chatAvailableReactionsSome::ID: {
auto chat_reactions = move_tl_object_as<td_api::chatAvailableReactionsSome>(chat_reactions_ptr);
@@ -61,8 +61,8 @@ ChatReactions ChatReactions::get_active_reactions(
const FlatHashMap<ReactionType, size_t, ReactionTypeHash> &active_reaction_pos) const {
ChatReactions result = *this;
if (!reaction_types_.empty()) {
- CHECK(!allow_all_);
- CHECK(!allow_custom_);
+ CHECK(!allow_all_regular_);
+ CHECK(!allow_all_custom_);
td::remove_if(result.reaction_types_, [&](const ReactionType &reaction_type) {
return !reaction_type.is_active_reaction(active_reaction_pos);
});
@@ -71,15 +71,15 @@ ChatReactions ChatReactions::get_active_reactions(
}
bool ChatReactions::is_allowed_reaction_type(const ReactionType &reaction_type) const {
- CHECK(!allow_all_);
- if (allow_custom_ && reaction_type.is_custom_reaction()) {
+ CHECK(!allow_all_regular_);
+ if (allow_all_custom_ && reaction_type.is_custom_reaction()) {
return true;
}
return td::contains(reaction_types_, reaction_type);
}
td_api::object_ptr<td_api::ChatAvailableReactions> ChatReactions::get_chat_available_reactions_object() const {
- if (allow_all_) {
+ if (allow_all_regular_) {
return td_api::make_object<td_api::chatAvailableReactionsAll>();
}
return td_api::make_object<td_api::chatAvailableReactionsSome>(transform(
@@ -87,12 +87,12 @@ td_api::object_ptr<td_api::ChatAvailableReactions> ChatReactions::get_chat_avail
}
telegram_api::object_ptr<telegram_api::ChatReactions> ChatReactions::get_input_chat_reactions() const {
- if (allow_all_) {
+ if (allow_all_regular_) {
int32 flags = 0;
- if (allow_custom_) {
+ if (allow_all_custom_) {
flags |= telegram_api::chatReactionsAll::ALLOW_CUSTOM_MASK;
}
- return telegram_api::make_object<telegram_api::chatReactionsAll>(flags, allow_custom_);
+ return telegram_api::make_object<telegram_api::chatReactionsAll>(flags, allow_all_custom_);
}
if (!reaction_types_.empty()) {
return telegram_api::make_object<telegram_api::chatReactionsSome>(transform(
@@ -102,13 +102,13 @@ telegram_api::object_ptr<telegram_api::ChatReactions> ChatReactions::get_input_c
}
bool operator==(const ChatReactions &lhs, const ChatReactions &rhs) {
- // don't compare allow_custom_
- return lhs.reaction_types_ == rhs.reaction_types_ && lhs.allow_all_ == rhs.allow_all_;
+ // don't compare allow_all_custom_
+ return lhs.reaction_types_ == rhs.reaction_types_ && lhs.allow_all_regular_ == rhs.allow_all_regular_;
}
StringBuilder &operator<<(StringBuilder &string_builder, const ChatReactions &reactions) {
- if (reactions.allow_all_) {
- if (reactions.allow_custom_) {
+ if (reactions.allow_all_regular_) {
+ if (reactions.allow_all_custom_) {
return string_builder << "AllReactions";
}
return string_builder << "AllRegularReactions";