tdlight/td/telegram/StoryViewer.h

68 lines
2.0 KiB
C
Raw Normal View History

2023-08-07 15:03:10 +02:00
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
//
// 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
2023-08-07 16:19:12 +02:00
#include "td/telegram/ReactionType.h"
2023-08-07 15:03:10 +02:00
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h"
#include "td/utils/common.h"
#include "td/utils/StringBuilder.h"
namespace td {
class ContactsManager;
class StoryViewer {
UserId user_id_;
int32 date_ = 0;
2023-08-07 16:19:12 +02:00
bool is_blocked_ = false;
bool is_blocked_for_stories_ = false;
ReactionType reaction_type_;
2023-08-07 15:03:10 +02:00
friend StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewer &viewer);
public:
2023-08-07 16:19:12 +02:00
StoryViewer(telegram_api::object_ptr<telegram_api::storyView> &&story_view)
: user_id_(story_view->user_id_)
, date_(td::max(story_view->date_, static_cast<int32>(0)))
, is_blocked_(story_view->blocked_)
, is_blocked_for_stories_(story_view->blocked_my_stories_from_)
, reaction_type_(story_view->reaction_) {
2023-08-07 15:03:10 +02:00
}
UserId get_user_id() const {
return user_id_;
}
td_api::object_ptr<td_api::storyViewer> get_story_viewer_object(ContactsManager *contacts_manager) const;
};
StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewer &viewer);
class StoryViewers {
2023-08-07 19:49:31 +02:00
int32 total_count_ = 0;
2023-08-16 12:45:10 +02:00
int32 total_reaction_count_ = 0;
2023-08-07 15:03:10 +02:00
vector<StoryViewer> story_viewers_;
2023-08-07 18:40:15 +02:00
string next_offset_;
2023-08-07 15:03:10 +02:00
friend StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewers &viewers);
public:
2023-08-16 12:45:10 +02:00
StoryViewers(int32 total_count, int32 total_reaction_count,
vector<telegram_api::object_ptr<telegram_api::storyView>> &&story_views, string &&next_offset);
2023-08-07 15:03:10 +02:00
vector<UserId> get_user_ids() const;
td_api::object_ptr<td_api::storyViewers> get_story_viewers_object(ContactsManager *contacts_manager) const;
};
StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewers &viewers);
} // namespace td