diff --git a/CMakeLists.txt b/CMakeLists.txt index a2434394c..9e5253e85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -322,6 +322,7 @@ set(TDLIB_SOURCE td/telegram/HashtagHints.cpp td/telegram/InlineQueriesManager.cpp td/telegram/InputDialogId.cpp + td/telegram/InputGroupCallId.cpp td/telegram/InputMessageText.cpp td/telegram/JsonValue.cpp td/telegram/LanguagePackManager.cpp @@ -494,6 +495,7 @@ set(TDLIB_SOURCE td/telegram/HashtagHints.h td/telegram/InlineQueriesManager.h td/telegram/InputDialogId.h + td/telegram/InputGroupCallId.h td/telegram/InputMessageText.h td/telegram/JsonValue.h td/telegram/LanguagePackManager.h diff --git a/td/telegram/InputGroupCallId.cpp b/td/telegram/InputGroupCallId.cpp new file mode 100644 index 000000000..b50b039d7 --- /dev/null +++ b/td/telegram/InputGroupCallId.cpp @@ -0,0 +1,25 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020 +// +// 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) +// +#include "td/telegram/InputGroupCallId.h" + +#include "td/utils/logging.h" + +namespace td { + +InputGroupCallId::InputGroupCallId(const tl_object_ptr &input_group_call) + : group_call_id(input_group_call->id_), access_hash(input_group_call->access_hash_) { +} + +tl_object_ptr InputGroupCallId::get_input_group_call() const { + return make_tl_object(group_call_id, access_hash); +} + +StringBuilder &operator<<(StringBuilder &string_builder, InputGroupCallId input_group_call_id) { + return string_builder << "input group call " << input_group_call_id.group_call_id; +} + +} // namespace td diff --git a/td/telegram/InputGroupCallId.h b/td/telegram/InputGroupCallId.h new file mode 100644 index 000000000..a1db1a5bb --- /dev/null +++ b/td/telegram/InputGroupCallId.h @@ -0,0 +1,54 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020 +// +// 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/telegram_api.h" + +#include "td/utils/common.h" +#include "td/utils/StringBuilder.h" + +namespace td { + +class InputGroupCallId { + int64 group_call_id = 0; + int64 access_hash = 0; + + public: + InputGroupCallId() = default; + + explicit InputGroupCallId(const tl_object_ptr &input_group_call); + + bool operator==(const InputGroupCallId &other) const { + return group_call_id == other.group_call_id && access_hash == other.access_hash; + } + + bool operator!=(const InputGroupCallId &other) const { + return !(*this == other); + } + + bool is_valid() const { + return group_call_id != 0; + } + + tl_object_ptr get_input_group_call() const; + + template + void store(StorerT &storer) const { + storer.store_long(group_call_id); + storer.store_long(access_hash); + } + + template + void parse(ParserT &parser) { + group_call_id = parser.fetch_long(); + access_hash = parser.fetch_long(); + } + + friend StringBuilder &operator<<(StringBuilder &string_builder, InputGroupCallId input_group_call_id); +}; + +} // namespace td