diff options
| -rw-r--r-- | CMakeLists.txt | 1 | ||||
| -rw-r--r-- | SplitSource.php | 1 | ||||
| -rw-r--r-- | td/telegram/ForumTopicFullId.h | 72 | ||||
| -rw-r--r-- | td/telegram/NotificationSettingsManager.h | 1 |
4 files changed, 75 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c6064508e..081ff59ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -816,6 +816,7 @@ set(TDLIB_SOURCE_PART2 td/telegram/FolderId.h td/telegram/ForumTopic.h td/telegram/ForumTopicEditedData.h + td/telegram/ForumTopicFullId.h td/telegram/ForumTopicIcon.h td/telegram/ForumTopicId.h td/telegram/ForumTopicInfo.h diff --git a/SplitSource.php b/SplitSource.php index 17773a68e..4e7341e64 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -352,6 +352,7 @@ function split_file($file, $chunks, $undo) { 'file_reference_manager[_(-](?![.]get[(][)])|FileReferenceManager|file_references[)]' => 'FileReferenceManager', 'file_manager[_(-](?![.]get[(][)])|FileManager([^ ;.]| [^*])|update_file[)]' => 'files/FileManager', 'FolderId' => 'FolderId', + 'ForumTopicFullId' => 'ForumTopicFullId', 'ForumTopicId' => 'ForumTopicId', 'forum_topic_manager[_(-](?![.]get[(][)])|ForumTopicManager' => 'ForumTopicManager', 'game_manager[_(-](?![.]get[(][)])|GameManager' => 'GameManager', diff --git a/td/telegram/ForumTopicFullId.h b/td/telegram/ForumTopicFullId.h new file mode 100644 index 000000000..68ad8e79a --- /dev/null +++ b/td/telegram/ForumTopicFullId.h @@ -0,0 +1,72 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2025 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +#pragma once + +#include "td/telegram/DialogId.h" +#include "td/telegram/ForumTopicId.h" +#include "td/telegram/telegram_api.h" + +#include "td/utils/common.h" +#include "td/utils/HashTableUtils.h" +#include "td/utils/StringBuilder.h" + +namespace td { + +struct ForumTopicFullId { + private: + DialogId dialog_id; + ForumTopicId forum_topic_id; + + public: + ForumTopicFullId() : dialog_id(), forum_topic_id() { + } + + ForumTopicFullId(DialogId dialog_id, ForumTopicId forum_topic_id) + : dialog_id(dialog_id), forum_topic_id(forum_topic_id) { + } + + bool operator==(const ForumTopicFullId &other) const { + return dialog_id == other.dialog_id && forum_topic_id == other.forum_topic_id; + } + + bool operator!=(const ForumTopicFullId &other) const { + return !(*this == other); + } + + DialogId get_dialog_id() const { + return dialog_id; + } + + ForumTopicId get_forum_topic_id() const { + return forum_topic_id; + } + + template <class StorerT> + void store(StorerT &storer) const { + dialog_id.store(storer); + forum_topic_id.store(storer); + } + + template <class ParserT> + void parse(ParserT &parser) { + dialog_id.parse(parser); + forum_topic_id.parse(parser); + } +}; + +struct ForumTopicFullIdHash { + uint32 operator()(ForumTopicFullId forum_topic_full_id) const { + return combine_hashes(DialogIdHash()(forum_topic_full_id.get_dialog_id()), + ForumTopicIdHash()(forum_topic_full_id.get_forum_topic_id())); + } +}; + +inline StringBuilder &operator<<(StringBuilder &string_builder, ForumTopicFullId forum_topic_full_id) { + return string_builder << forum_topic_full_id.get_forum_topic_id() << " in " << forum_topic_full_id.get_dialog_id(); +} + +} // namespace td diff --git a/td/telegram/NotificationSettingsManager.h b/td/telegram/NotificationSettingsManager.h index c44cea5be..d2128c2dd 100644 --- a/td/telegram/NotificationSettingsManager.h +++ b/td/telegram/NotificationSettingsManager.h @@ -11,6 +11,7 @@ #include "td/telegram/files/FileId.h" #include "td/telegram/files/FileSourceId.h" #include "td/telegram/files/FileUploadId.h" +#include "td/telegram/ForumTopicFullId.h" #include "td/telegram/MessageFullId.h" #include "td/telegram/MessageId.h" #include "td/telegram/NotificationSettingsScope.h" |
