Move check_currency_amount to misc.h.

This commit is contained in:
levlam 2022-09-22 19:33:43 +03:00
parent 7f433c7e18
commit cb01c3022c
7 changed files with 11 additions and 10 deletions

View File

@ -718,11 +718,6 @@ StringBuilder &operator<<(StringBuilder &string_builder, const ShippingOption &s
<< " with price parts " << format::as_array(shipping_option.price_parts) << "]";
}
bool check_currency_amount(int64 amount) {
constexpr int64 MAX_AMOUNT = 9999'9999'9999;
return -MAX_AMOUNT <= amount && amount <= MAX_AMOUNT;
}
void answer_shipping_query(Td *td, int64 shipping_query_id,
vector<tl_object_ptr<td_api::shippingOption>> &&shipping_options,
const string &error_message, Promise<Unit> &&promise) {

View File

@ -33,8 +33,6 @@ bool operator!=(const ShippingOption &lhs, const ShippingOption &rhs);
StringBuilder &operator<<(StringBuilder &string_builder, const ShippingOption &shipping_option);
bool check_currency_amount(int64 amount);
tl_object_ptr<td_api::formattedText> get_product_description_object(const string &description);
void answer_shipping_query(Td *td, int64 shipping_query_id,

View File

@ -14,7 +14,7 @@
#include "td/telegram/DocumentsManager.h"
#include "td/telegram/Global.h"
#include "td/telegram/MessageEntity.h"
#include "td/telegram/Payments.h"
#include "td/telegram/misc.h"
#include "td/telegram/Td.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UpdatesManager.h"

View File

@ -7,7 +7,7 @@
#include "td/telegram/PremiumGiftOption.h"
#include "td/telegram/LinkManager.h"
#include "td/telegram/Payments.h"
#include "td/telegram/misc.h"
#include "td/utils/algorithm.h"
#include "td/utils/common.h"

View File

@ -30,6 +30,7 @@
#include "td/telegram/MessageId.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/MessageTtl.h"
#include "td/telegram/misc.h"
#include "td/telegram/net/DcOptions.h"
#include "td/telegram/net/NetQuery.h"
#include "td/telegram/NotificationManager.h"
@ -37,7 +38,6 @@
#include "td/telegram/NotificationSettingsManager.h"
#include "td/telegram/OptionManager.h"
#include "td/telegram/OrderInfo.h"
#include "td/telegram/Payments.h"
#include "td/telegram/PollId.h"
#include "td/telegram/PollManager.h"
#include "td/telegram/PrivacyManager.h"

View File

@ -311,4 +311,9 @@ string get_emoji_fingerprint(uint64 num) {
return emojis[static_cast<size_t>((num & 0x7FFFFFFFFFFFFFFF) % emojis.size())].str();
}
bool check_currency_amount(int64 amount) {
constexpr int64 MAX_AMOUNT = 9999'9999'9999;
return -MAX_AMOUNT <= amount && amount <= MAX_AMOUNT;
}
} // namespace td

View File

@ -37,4 +37,7 @@ int64 get_vector_hash(const vector<uint64> &numbers) TD_WARN_UNUSED_RESULT;
// returns emoji corresponding to the specified number
string get_emoji_fingerprint(uint64 num);
// checks whether currency amount is valid
bool check_currency_amount(int64 amount);
} // namespace td