tdlight/td/telegram/ForumTopic.h

76 lines
2.1 KiB
C
Raw Normal View History

2022-10-24 20:10:12 +02:00
//
2022-12-31 22:28:08 +01:00
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
2022-10-24 20:10:12 +02:00
//
// 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
2022-12-09 10:12:49 +01:00
#include "td/telegram/DialogId.h"
2022-10-24 20:10:12 +02:00
#include "td/telegram/DialogNotificationSettings.h"
2022-12-02 15:04:24 +01:00
#include "td/telegram/DraftMessage.h"
2022-12-09 10:12:49 +01:00
#include "td/telegram/ForumTopicInfo.h"
2022-10-24 20:10:12 +02:00
#include "td/telegram/MessageId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/utils/common.h"
namespace td {
class Td;
class ForumTopic {
2022-11-15 12:54:57 +01:00
bool is_short_ = false;
2022-10-24 20:10:12 +02:00
bool is_pinned_ = false;
int32 unread_count_ = 0;
2022-11-15 12:54:57 +01:00
MessageId last_message_id_;
2022-10-24 20:10:12 +02:00
MessageId last_read_inbox_message_id_;
MessageId last_read_outbox_message_id_;
int32 unread_mention_count_ = 0;
int32 unread_reaction_count_ = 0;
DialogNotificationSettings notification_settings_;
unique_ptr<DraftMessage> draft_message_;
public:
ForumTopic() = default;
ForumTopic(Td *td, tl_object_ptr<telegram_api::ForumTopic> &&forum_topic_ptr,
const DialogNotificationSettings *current_notification_settings);
2022-10-24 20:10:12 +02:00
2022-11-15 14:14:57 +01:00
bool is_short() const {
return is_short_;
2022-10-24 20:10:12 +02:00
}
bool update_last_read_outbox_message_id(MessageId last_read_outbox_message_id);
bool update_last_read_inbox_message_id(MessageId last_read_inbox_message_id, int32 unread_count);
bool set_is_pinned(bool is_pinned) {
if (is_pinned_ == is_pinned) {
return false;
}
is_pinned_ = is_pinned;
return true;
}
2022-12-06 12:53:54 +01:00
DialogNotificationSettings *get_notification_settings() {
return &notification_settings_;
}
const DialogNotificationSettings *get_notification_settings() const {
return &notification_settings_;
}
2022-12-02 15:58:00 +01:00
td_api::object_ptr<td_api::forumTopic> get_forum_topic_object(Td *td, DialogId dialog_id,
const ForumTopicInfo &info) const;
2022-12-05 15:37:09 +01:00
template <class StorerT>
void store(StorerT &storer) const;
template <class ParserT>
void parse(ParserT &parser);
2022-10-24 20:10:12 +02:00
};
} // namespace td