aboutsummaryrefslogtreecommitdiffhomepage
path: root/td/telegram/EmojiGroup.h
blob: 1134605ce10805a2c6850aace73668256130074b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2026
//
// 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/CustomEmojiId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"

#include "td/utils/common.h"

namespace td {

class StickersManager;

class EmojiGroup {
  string title_;
  CustomEmojiId icon_custom_emoji_id_;
  vector<string> emojis_;
  bool is_greeting_ = false;
  bool is_premium_ = false;

 public:
  EmojiGroup() = default;

  explicit EmojiGroup(telegram_api::object_ptr<telegram_api::EmojiGroup> &&emoji_group);

  td_api::object_ptr<td_api::emojiCategory> get_emoji_category_object(StickersManager *stickers_manager) const;

  CustomEmojiId get_icon_custom_emoji_id() const {
    return icon_custom_emoji_id_;
  }

  template <class StorerT>
  void store(StorerT &storer) const;

  template <class ParserT>
  void parse(ParserT &parser);
};

class EmojiGroupList {
  string used_language_codes_;
  int32 hash_ = 0;
  vector<EmojiGroup> emoji_groups_;
  double next_reload_time_ = 0.0;

 public:
  EmojiGroupList() = default;

  EmojiGroupList(string used_language_codes, int32 hash,
                 vector<telegram_api::object_ptr<telegram_api::EmojiGroup>> &&emoji_groups);

  td_api::object_ptr<td_api::emojiCategories> get_emoji_categories_object(StickersManager *stickers_manager) const;

  const string &get_used_language_codes() const {
    return used_language_codes_;
  }

  int32 get_hash() const {
    return hash_;
  }

  bool is_expired() const;

  void update_next_reload_time();

  vector<CustomEmojiId> get_icon_custom_emoji_ids() const;

  template <class StorerT>
  void store(StorerT &storer) const;

  template <class ParserT>
  void parse(ParserT &parser);
};

}  // namespace td