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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
//
// 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/MessageInputReplyTo.h"
#include "td/telegram/MessageOrigin.hpp"
#include "td/telegram/MessageQuote.h"
#include "td/telegram/MessageQuote.hpp"
#include "td/utils/tl_helpers.h"
namespace td {
template <class StorerT>
void MessageInputReplyTo::store(StorerT &storer) const {
bool has_message_id = message_id_.is_valid();
bool has_story_full_id = story_full_id_.is_valid();
bool has_dialog_id = dialog_id_.is_valid();
bool has_quote = !quote_.is_empty();
bool has_todo_item_id = todo_item_id_ != 0;
bool has_poll_option_id = !poll_option_id_.empty();
bool has_ephemeral_message_id = ephemeral_message_id_.is_valid();
BEGIN_STORE_FLAGS();
STORE_FLAG(has_message_id);
STORE_FLAG(has_story_full_id);
STORE_FLAG(false);
STORE_FLAG(has_dialog_id);
STORE_FLAG(false);
STORE_FLAG(has_quote);
STORE_FLAG(has_todo_item_id);
STORE_FLAG(has_poll_option_id);
STORE_FLAG(has_ephemeral_message_id);
END_STORE_FLAGS();
if (has_message_id) {
td::store(message_id_, storer);
}
if (has_story_full_id) {
td::store(story_full_id_, storer);
}
if (has_dialog_id) {
td::store(dialog_id_, storer);
}
if (has_quote) {
td::store(quote_, storer);
}
if (has_todo_item_id) {
td::store(todo_item_id_, storer);
}
if (has_poll_option_id) {
td::store(poll_option_id_, storer);
}
if (has_ephemeral_message_id) {
td::store(ephemeral_message_id_, storer);
}
}
template <class ParserT>
void MessageInputReplyTo::parse(ParserT &parser) {
bool has_message_id;
bool has_story_full_id;
bool has_quote_legacy;
bool has_dialog_id;
bool has_quote_position_legacy;
bool has_quote;
bool has_todo_item_id;
bool has_poll_option_id;
bool has_ephemeral_message_id;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(has_message_id);
PARSE_FLAG(has_story_full_id);
PARSE_FLAG(has_quote_legacy);
PARSE_FLAG(has_dialog_id);
PARSE_FLAG(has_quote_position_legacy);
PARSE_FLAG(has_quote);
PARSE_FLAG(has_todo_item_id);
PARSE_FLAG(has_poll_option_id);
PARSE_FLAG(has_ephemeral_message_id);
END_PARSE_FLAGS();
if (has_message_id) {
td::parse(message_id_, parser);
debug_source_ = "binlog";
}
if (has_story_full_id) {
td::parse(story_full_id_, parser);
}
FormattedText quote_legacy;
if (has_quote_legacy) {
td::parse(quote_legacy, parser);
}
if (has_dialog_id) {
td::parse(dialog_id_, parser);
}
int32 quote_position_legacy = 0;
if (has_quote_position_legacy) {
td::parse(quote_position_legacy, parser);
}
if (has_quote) {
td::parse(quote_, parser);
} else if (has_quote_legacy) {
quote_ = MessageQuote(std::move(quote_legacy), quote_position_legacy);
}
if (has_todo_item_id) {
td::parse(todo_item_id_, parser);
}
if (has_poll_option_id) {
td::parse(poll_option_id_, parser);
}
if (has_ephemeral_message_id) {
td::parse(ephemeral_message_id_, parser);
}
}
} // namespace td
|