Make Location.access_hash mutable.

GitOrigin-RevId: c035dcdc3873d39436bb5fb9f5680f066c8debe1
This commit is contained in:
levlam 2019-02-19 18:52:09 +03:00
parent 839c1856ff
commit 74b37c56a2
4 changed files with 17 additions and 11 deletions

View File

@ -151,6 +151,10 @@ Location &Venue::location() {
return location_;
}
const Location &Venue::location() const {
return location_;
}
tl_object_ptr<td_api::venue> Venue::get_venue_object() const {
return make_tl_object<td_api::venue>(location_.get_location_object(), title_, address_, provider_, id_, type_);
}

View File

@ -27,7 +27,7 @@ class Location {
bool is_empty_ = true;
double latitude_ = 0.0;
double longitude_ = 0.0;
int64 access_hash_ = 0;
mutable int64 access_hash_ = 0;
friend bool operator==(const Location &lhs, const Location &rhs);
friend bool operator!=(const Location &lhs, const Location &rhs);
@ -69,7 +69,7 @@ class Location {
return access_hash_;
}
void set_access_hash(int64 access_hash) {
void set_access_hash(int64 access_hash) const {
access_hash_ = access_hash;
}
@ -139,6 +139,8 @@ class Venue {
Location &location();
const Location &location() const;
tl_object_ptr<td_api::venue> get_venue_object() const;
tl_object_ptr<telegram_api::inputMediaVenue> get_input_media_venue() const;

View File

@ -2679,7 +2679,7 @@ void set_message_content_web_page_id(MessageContent *content, WebPageId web_page
static_cast<MessageText *>(content)->web_page_id = web_page_id;
}
static void merge_location_access_hash(Location &first, Location &second) {
static void merge_location_access_hash(const Location &first, const Location &second) {
if (second.get_access_hash() != 0) {
first.set_access_hash(second.get_access_hash());
} else {
@ -2709,7 +2709,7 @@ static bool need_message_text_changed_warning(const MessageText *old_content, co
return true;
}
void merge_message_contents(Td *td, MessageContent *old_content, MessageContent *new_content,
void merge_message_contents(Td *td, const MessageContent *old_content, MessageContent *new_content,
bool need_message_changed_warning, DialogId dialog_id, bool need_merge_files,
bool &is_content_changed, bool &need_update) {
MessageContentType content_type = new_content->get_type();
@ -2812,8 +2812,8 @@ void merge_message_contents(Td *td, MessageContent *old_content, MessageContent
break;
}
case MessageContentType::LiveLocation: {
auto old_ = static_cast<MessageLiveLocation *>(old_content);
auto new_ = static_cast<MessageLiveLocation *>(new_content);
auto old_ = static_cast<const MessageLiveLocation *>(old_content);
auto new_ = static_cast<const MessageLiveLocation *>(new_content);
if (old_->location != new_->location) {
need_update = true;
}
@ -2827,8 +2827,8 @@ void merge_message_contents(Td *td, MessageContent *old_content, MessageContent
break;
}
case MessageContentType::Location: {
auto old_ = static_cast<MessageLocation *>(old_content);
auto new_ = static_cast<MessageLocation *>(new_content);
auto old_ = static_cast<const MessageLocation *>(old_content);
auto new_ = static_cast<const MessageLocation *>(new_content);
if (old_->location != new_->location) {
need_update = true;
}
@ -2903,8 +2903,8 @@ void merge_message_contents(Td *td, MessageContent *old_content, MessageContent
break;
}
case MessageContentType::Venue: {
auto old_ = static_cast<MessageVenue *>(old_content);
auto new_ = static_cast<MessageVenue *>(new_content);
auto old_ = static_cast<const MessageVenue *>(old_content);
auto new_ = static_cast<const MessageVenue *>(new_content);
if (old_->venue != new_->venue) {
need_update = true;
}

View File

@ -179,7 +179,7 @@ WebPageId get_message_content_web_page_id(const MessageContent *content);
void set_message_content_web_page_id(MessageContent *content, WebPageId web_page_id);
void merge_message_contents(Td *td, MessageContent *old_content, MessageContent *new_content,
void merge_message_contents(Td *td, const MessageContent *old_content, MessageContent *new_content,
bool need_message_changed_warning, DialogId dialog_id, bool need_merge_files,
bool &is_content_changed, bool &need_update);