diff --git a/td/telegram/Location.cpp b/td/telegram/Location.cpp index e4c09bcf7..931eac788 100644 --- a/td/telegram/Location.cpp +++ b/td/telegram/Location.cpp @@ -151,6 +151,10 @@ Location &Venue::location() { return location_; } +const Location &Venue::location() const { + return location_; +} + tl_object_ptr Venue::get_venue_object() const { return make_tl_object(location_.get_location_object(), title_, address_, provider_, id_, type_); } diff --git a/td/telegram/Location.h b/td/telegram/Location.h index 771ccd7de..9d7ecbec1 100644 --- a/td/telegram/Location.h +++ b/td/telegram/Location.h @@ -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 get_venue_object() const; tl_object_ptr get_input_media_venue() const; diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 3e3c20600..23c0aa44f 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -2679,7 +2679,7 @@ void set_message_content_web_page_id(MessageContent *content, WebPageId web_page static_cast(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(old_content); - auto new_ = static_cast(new_content); + auto old_ = static_cast(old_content); + auto new_ = static_cast(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(old_content); - auto new_ = static_cast(new_content); + auto old_ = static_cast(old_content); + auto new_ = static_cast(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(old_content); - auto new_ = static_cast(new_content); + auto old_ = static_cast(old_content); + auto new_ = static_cast(new_content); if (old_->venue != new_->venue) { need_update = true; } diff --git a/td/telegram/MessageContent.h b/td/telegram/MessageContent.h index 06bf06df3..931ba82c2 100644 --- a/td/telegram/MessageContent.h +++ b/td/telegram/MessageContent.h @@ -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);