Add intro to businessInfo.
This commit is contained in:
parent
dd0fb9486f
commit
74b3c23e4b
@ -646,7 +646,8 @@ businessOpeningHours time_zone_id:string opening_hours:vector<businessOpeningHou
|
|||||||
//@opening_hours Opening hours of the business; may be null if none. The hours are guaranteed to be valid and has already been split by week days
|
//@opening_hours Opening hours of the business; may be null if none. The hours are guaranteed to be valid and has already been split by week days
|
||||||
//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user
|
//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user
|
||||||
//@away_message_settings The away message; may be null if none or the Business account is not of the current user
|
//@away_message_settings The away message; may be null if none or the Business account is not of the current user
|
||||||
businessInfo location:businessLocation opening_hours:businessOpeningHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings = BusinessInfo;
|
//@intro Information about intro of the business; may be null if none
|
||||||
|
businessInfo location:businessLocation opening_hours:businessOpeningHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings intro:businessIntro = BusinessInfo;
|
||||||
|
|
||||||
|
|
||||||
//@class ChatPhotoStickerType @description Describes type of a sticker, which was used to create a chat photo
|
//@class ChatPhotoStickerType @description Describes type of a sticker, which was used to create a chat photo
|
||||||
|
@ -12,10 +12,10 @@ td_api::object_ptr<td_api::businessInfo> BusinessInfo::get_business_info_object(
|
|||||||
if (is_empty()) {
|
if (is_empty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return td_api::make_object<td_api::businessInfo>(location_.get_business_location_object(),
|
return td_api::make_object<td_api::businessInfo>(
|
||||||
work_hours_.get_business_opening_hours_object(),
|
location_.get_business_location_object(), work_hours_.get_business_opening_hours_object(),
|
||||||
greeting_message_.get_business_greeting_message_settings_object(td),
|
greeting_message_.get_business_greeting_message_settings_object(td),
|
||||||
away_message_.get_business_away_message_settings_object(td));
|
away_message_.get_business_away_message_settings_object(td), intro_.get_business_intro_object(td));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BusinessInfo::is_empty_location(const DialogLocation &location) {
|
bool BusinessInfo::is_empty_location(const DialogLocation &location) {
|
||||||
@ -24,7 +24,7 @@ bool BusinessInfo::is_empty_location(const DialogLocation &location) {
|
|||||||
|
|
||||||
bool BusinessInfo::is_empty() const {
|
bool BusinessInfo::is_empty() const {
|
||||||
return is_empty_location(location_) && work_hours_.is_empty() && away_message_.is_empty() &&
|
return is_empty_location(location_) && work_hours_.is_empty() && away_message_.is_empty() &&
|
||||||
greeting_message_.is_empty();
|
greeting_message_.is_empty() && intro_.is_empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BusinessInfo::set_location(unique_ptr<BusinessInfo> &business_info, DialogLocation &&location) {
|
bool BusinessInfo::set_location(unique_ptr<BusinessInfo> &business_info, DialogLocation &&location) {
|
||||||
@ -84,4 +84,18 @@ bool BusinessInfo::set_greeting_message(unique_ptr<BusinessInfo> &business_info,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BusinessInfo::set_intro(unique_ptr<BusinessInfo> &business_info, BusinessIntro &&intro) {
|
||||||
|
if (business_info == nullptr) {
|
||||||
|
if (intro.is_empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
business_info = make_unique<BusinessInfo>();
|
||||||
|
}
|
||||||
|
if (business_info->intro_ != intro) {
|
||||||
|
business_info->intro_ = std::move(intro);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "td/telegram/BusinessAwayMessage.h"
|
#include "td/telegram/BusinessAwayMessage.h"
|
||||||
#include "td/telegram/BusinessGreetingMessage.h"
|
#include "td/telegram/BusinessGreetingMessage.h"
|
||||||
|
#include "td/telegram/BusinessIntro.h"
|
||||||
#include "td/telegram/BusinessWorkHours.h"
|
#include "td/telegram/BusinessWorkHours.h"
|
||||||
#include "td/telegram/DialogLocation.h"
|
#include "td/telegram/DialogLocation.h"
|
||||||
#include "td/telegram/td_api.h"
|
#include "td/telegram/td_api.h"
|
||||||
@ -32,6 +33,8 @@ class BusinessInfo {
|
|||||||
|
|
||||||
static bool set_greeting_message(unique_ptr<BusinessInfo> &business_info, BusinessGreetingMessage &&greeting_message);
|
static bool set_greeting_message(unique_ptr<BusinessInfo> &business_info, BusinessGreetingMessage &&greeting_message);
|
||||||
|
|
||||||
|
static bool set_intro(unique_ptr<BusinessInfo> &business_info, BusinessIntro &&intro);
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store(StorerT &storer) const;
|
void store(StorerT &storer) const;
|
||||||
|
|
||||||
@ -45,6 +48,7 @@ class BusinessInfo {
|
|||||||
BusinessWorkHours work_hours_;
|
BusinessWorkHours work_hours_;
|
||||||
BusinessAwayMessage away_message_;
|
BusinessAwayMessage away_message_;
|
||||||
BusinessGreetingMessage greeting_message_;
|
BusinessGreetingMessage greeting_message_;
|
||||||
|
BusinessIntro intro_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "td/telegram/BusinessAwayMessage.hpp"
|
#include "td/telegram/BusinessAwayMessage.hpp"
|
||||||
#include "td/telegram/BusinessGreetingMessage.hpp"
|
#include "td/telegram/BusinessGreetingMessage.hpp"
|
||||||
|
#include "td/telegram/BusinessIntro.hpp"
|
||||||
#include "td/telegram/BusinessWorkHours.hpp"
|
#include "td/telegram/BusinessWorkHours.hpp"
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
@ -23,11 +24,13 @@ void BusinessInfo::store(StorerT &storer) const {
|
|||||||
bool has_work_hours = !work_hours_.is_empty();
|
bool has_work_hours = !work_hours_.is_empty();
|
||||||
bool has_away_message = away_message_.is_valid();
|
bool has_away_message = away_message_.is_valid();
|
||||||
bool has_greeting_message = greeting_message_.is_valid();
|
bool has_greeting_message = greeting_message_.is_valid();
|
||||||
|
bool has_intro = !intro_.is_empty();
|
||||||
BEGIN_STORE_FLAGS();
|
BEGIN_STORE_FLAGS();
|
||||||
STORE_FLAG(has_location);
|
STORE_FLAG(has_location);
|
||||||
STORE_FLAG(has_work_hours);
|
STORE_FLAG(has_work_hours);
|
||||||
STORE_FLAG(has_away_message);
|
STORE_FLAG(has_away_message);
|
||||||
STORE_FLAG(has_greeting_message);
|
STORE_FLAG(has_greeting_message);
|
||||||
|
STORE_FLAG(has_intro);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
if (has_location) {
|
if (has_location) {
|
||||||
td::store(location_, storer);
|
td::store(location_, storer);
|
||||||
@ -41,6 +44,9 @@ void BusinessInfo::store(StorerT &storer) const {
|
|||||||
if (has_greeting_message) {
|
if (has_greeting_message) {
|
||||||
td::store(greeting_message_, storer);
|
td::store(greeting_message_, storer);
|
||||||
}
|
}
|
||||||
|
if (has_intro) {
|
||||||
|
td::store(intro_, storer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ParserT>
|
template <class ParserT>
|
||||||
@ -49,11 +55,13 @@ void BusinessInfo::parse(ParserT &parser) {
|
|||||||
bool has_work_hours;
|
bool has_work_hours;
|
||||||
bool has_away_message;
|
bool has_away_message;
|
||||||
bool has_greeting_message;
|
bool has_greeting_message;
|
||||||
|
bool has_intro;
|
||||||
BEGIN_PARSE_FLAGS();
|
BEGIN_PARSE_FLAGS();
|
||||||
PARSE_FLAG(has_location);
|
PARSE_FLAG(has_location);
|
||||||
PARSE_FLAG(has_work_hours);
|
PARSE_FLAG(has_work_hours);
|
||||||
PARSE_FLAG(has_away_message);
|
PARSE_FLAG(has_away_message);
|
||||||
PARSE_FLAG(has_greeting_message);
|
PARSE_FLAG(has_greeting_message);
|
||||||
|
PARSE_FLAG(has_intro);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
if (has_location) {
|
if (has_location) {
|
||||||
td::parse(location_, parser);
|
td::parse(location_, parser);
|
||||||
@ -67,6 +75,9 @@ void BusinessInfo::parse(ParserT &parser) {
|
|||||||
if (has_greeting_message) {
|
if (has_greeting_message) {
|
||||||
td::parse(greeting_message_, parser);
|
td::parse(greeting_message_, parser);
|
||||||
}
|
}
|
||||||
|
if (has_intro) {
|
||||||
|
td::parse(intro_, parser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "td/telegram/BusinessGreetingMessage.h"
|
#include "td/telegram/BusinessGreetingMessage.h"
|
||||||
#include "td/telegram/BusinessInfo.h"
|
#include "td/telegram/BusinessInfo.h"
|
||||||
#include "td/telegram/BusinessInfo.hpp"
|
#include "td/telegram/BusinessInfo.hpp"
|
||||||
|
#include "td/telegram/BusinessIntro.h"
|
||||||
#include "td/telegram/BusinessWorkHours.h"
|
#include "td/telegram/BusinessWorkHours.h"
|
||||||
#include "td/telegram/CommonDialogManager.h"
|
#include "td/telegram/CommonDialogManager.h"
|
||||||
#include "td/telegram/ConfigManager.h"
|
#include "td/telegram/ConfigManager.h"
|
||||||
@ -10302,6 +10303,7 @@ void ContactsManager::on_get_user_full(tl_object_ptr<telegram_api::userFull> &&u
|
|||||||
on_update_user_full_away_message(user_full, user_id, BusinessAwayMessage(std::move(user->business_away_message_)));
|
on_update_user_full_away_message(user_full, user_id, BusinessAwayMessage(std::move(user->business_away_message_)));
|
||||||
on_update_user_full_greeting_message(user_full, user_id,
|
on_update_user_full_greeting_message(user_full, user_id,
|
||||||
BusinessGreetingMessage(std::move(user->business_greeting_message_)));
|
BusinessGreetingMessage(std::move(user->business_greeting_message_)));
|
||||||
|
on_update_user_full_intro(user_full, user_id, BusinessIntro(td_, std::move(user->business_intro_)));
|
||||||
on_update_user_full_need_phone_number_privacy_exception(user_full, user_id,
|
on_update_user_full_need_phone_number_privacy_exception(user_full, user_id,
|
||||||
user->settings_->need_contacts_exception_);
|
user->settings_->need_contacts_exception_);
|
||||||
on_update_user_full_wallpaper_overridden(user_full, user_id, user->wallpaper_overridden_);
|
on_update_user_full_wallpaper_overridden(user_full, user_id, user->wallpaper_overridden_);
|
||||||
@ -11751,6 +11753,28 @@ void ContactsManager::on_update_user_full_greeting_message(UserFull *user_full,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContactsManager::on_update_user_intro(UserId user_id, BusinessIntro &&intro) {
|
||||||
|
LOG(INFO) << "Receive " << intro << " for " << user_id;
|
||||||
|
if (!user_id.is_valid()) {
|
||||||
|
LOG(ERROR) << "Receive invalid " << user_id;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserFull *user_full = get_user_full_force(user_id, "on_update_user_intro");
|
||||||
|
if (user_full == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
on_update_user_full_intro(user_full, user_id, std::move(intro));
|
||||||
|
update_user_full(user_full, user_id, "on_update_user_intro");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContactsManager::on_update_user_full_intro(UserFull *user_full, UserId user_id, BusinessIntro &&intro) {
|
||||||
|
CHECK(user_full != nullptr);
|
||||||
|
if (BusinessInfo::set_intro(user_full->business_info, std::move(intro))) {
|
||||||
|
user_full->is_changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::on_update_user_commands(
|
void ContactsManager::on_update_user_commands(
|
||||||
UserId user_id, vector<telegram_api::object_ptr<telegram_api::botCommand>> &&bot_commands) {
|
UserId user_id, vector<telegram_api::object_ptr<telegram_api::botCommand>> &&bot_commands) {
|
||||||
UserFull *user_full = get_user_full_force(user_id, "on_update_user_commands");
|
UserFull *user_full = get_user_full_force(user_id, "on_update_user_commands");
|
||||||
|
@ -67,6 +67,7 @@ struct BinlogEvent;
|
|||||||
class BusinessAwayMessage;
|
class BusinessAwayMessage;
|
||||||
class BusinessGreetingMessage;
|
class BusinessGreetingMessage;
|
||||||
class BusinessInfo;
|
class BusinessInfo;
|
||||||
|
class BusinessIntro;
|
||||||
class BusinessWorkHours;
|
class BusinessWorkHours;
|
||||||
struct MinChannel;
|
struct MinChannel;
|
||||||
class Td;
|
class Td;
|
||||||
@ -258,6 +259,7 @@ class ContactsManager final : public Actor {
|
|||||||
void on_update_user_work_hours(UserId user_id, BusinessWorkHours &&work_hours);
|
void on_update_user_work_hours(UserId user_id, BusinessWorkHours &&work_hours);
|
||||||
void on_update_user_away_message(UserId user_id, BusinessAwayMessage &&away_message);
|
void on_update_user_away_message(UserId user_id, BusinessAwayMessage &&away_message);
|
||||||
void on_update_user_greeting_message(UserId user_id, BusinessGreetingMessage &&greeting_message);
|
void on_update_user_greeting_message(UserId user_id, BusinessGreetingMessage &&greeting_message);
|
||||||
|
void on_update_user_intro(UserId user_id, BusinessIntro &&intro);
|
||||||
void on_update_user_need_phone_number_privacy_exception(UserId user_id, bool need_phone_number_privacy_exception);
|
void on_update_user_need_phone_number_privacy_exception(UserId user_id, bool need_phone_number_privacy_exception);
|
||||||
void on_update_user_wallpaper_overridden(UserId user_id, bool wallpaper_overridden);
|
void on_update_user_wallpaper_overridden(UserId user_id, bool wallpaper_overridden);
|
||||||
void on_update_user_commands(UserId user_id,
|
void on_update_user_commands(UserId user_id,
|
||||||
@ -1390,6 +1392,7 @@ class ContactsManager final : public Actor {
|
|||||||
void on_update_user_full_away_message(UserFull *user_full, UserId user_id, BusinessAwayMessage &&away_message) const;
|
void on_update_user_full_away_message(UserFull *user_full, UserId user_id, BusinessAwayMessage &&away_message) const;
|
||||||
void on_update_user_full_greeting_message(UserFull *user_full, UserId user_id,
|
void on_update_user_full_greeting_message(UserFull *user_full, UserId user_id,
|
||||||
BusinessGreetingMessage &&greeting_message) const;
|
BusinessGreetingMessage &&greeting_message) const;
|
||||||
|
static void on_update_user_full_intro(UserFull *user_full, UserId user_id, BusinessIntro &&intro);
|
||||||
static void on_update_user_full_commands(UserFull *user_full, UserId user_id,
|
static void on_update_user_full_commands(UserFull *user_full, UserId user_id,
|
||||||
vector<tl_object_ptr<telegram_api::botCommand>> &&bot_commands);
|
vector<tl_object_ptr<telegram_api::botCommand>> &&bot_commands);
|
||||||
static void on_update_user_full_menu_button(UserFull *user_full, UserId user_id,
|
static void on_update_user_full_menu_button(UserFull *user_full, UserId user_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user