2018-12-31 20:04:05 +01:00
|
|
|
//
|
2022-01-01 01:35:39 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
|
2018-12-31 20:04:05 +01: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
|
|
|
|
|
2019-07-23 00:50:12 +02:00
|
|
|
#include "td/telegram/ChannelId.h"
|
|
|
|
#include "td/telegram/ChatId.h"
|
2018-02-28 23:08:45 +01:00
|
|
|
#include "td/telegram/DialogId.h"
|
2020-11-26 08:56:13 +01:00
|
|
|
#include "td/telegram/InputGroupCallId.h"
|
2021-01-15 23:51:01 +01:00
|
|
|
#include "td/telegram/MessageId.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/PtsManager.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
2019-07-23 00:50:12 +02:00
|
|
|
#include "td/telegram/UserId.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-07-03 21:29:04 +02:00
|
|
|
#include "td/actor/actor.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/actor/PromiseFuture.h"
|
|
|
|
#include "td/actor/Timeout.h"
|
2018-07-03 21:29:04 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/utils/common.h"
|
2018-12-11 21:18:58 +01:00
|
|
|
#include "td/utils/logging.h"
|
2021-01-27 00:57:59 +01:00
|
|
|
#include "td/utils/Status.h"
|
2021-01-15 23:51:01 +01:00
|
|
|
#include "td/utils/tl_storers.h"
|
2021-11-01 17:21:24 +01:00
|
|
|
#include "td/utils/TlStorerToString.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <unordered_set>
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
2018-11-15 18:25:54 +01:00
|
|
|
extern int VERBOSITY_NAME(get_difference);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
class Td;
|
|
|
|
|
2021-07-04 04:58:54 +02:00
|
|
|
class dummyUpdate final : public telegram_api::Update {
|
2021-01-15 23:51:01 +01:00
|
|
|
public:
|
|
|
|
static constexpr int32 ID = 1234567891;
|
2021-07-03 22:51:36 +02:00
|
|
|
int32 get_id() const final {
|
2021-01-15 23:51:01 +01:00
|
|
|
return ID;
|
|
|
|
}
|
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void store(TlStorerUnsafe &s) const final {
|
2021-01-15 23:51:01 +01:00
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void store(TlStorerCalcLength &s) const final {
|
2021-01-15 23:51:01 +01:00
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void store(TlStorerToString &s, const char *field_name) const final {
|
2021-01-15 23:51:01 +01:00
|
|
|
s.store_class_begin(field_name, "dummyUpdate");
|
|
|
|
s.store_class_end();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-07-04 04:58:54 +02:00
|
|
|
class updateSentMessage final : public telegram_api::Update {
|
2021-01-15 23:51:01 +01:00
|
|
|
public:
|
|
|
|
int64 random_id_;
|
|
|
|
MessageId message_id_;
|
|
|
|
int32 date_;
|
2021-02-02 00:00:28 +01:00
|
|
|
int32 ttl_period_;
|
2021-01-15 23:51:01 +01:00
|
|
|
|
2021-02-02 00:00:28 +01:00
|
|
|
updateSentMessage(int64 random_id, MessageId message_id, int32 date, int32 ttl_period)
|
|
|
|
: random_id_(random_id), message_id_(message_id), date_(date), ttl_period_(ttl_period) {
|
2021-01-15 23:51:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static constexpr int32 ID = 1234567890;
|
2021-07-03 22:51:36 +02:00
|
|
|
int32 get_id() const final {
|
2021-01-15 23:51:01 +01:00
|
|
|
return ID;
|
|
|
|
}
|
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void store(TlStorerUnsafe &s) const final {
|
2021-01-15 23:51:01 +01:00
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void store(TlStorerCalcLength &s) const final {
|
2021-01-15 23:51:01 +01:00
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void store(TlStorerToString &s, const char *field_name) const final {
|
2021-01-15 23:51:01 +01:00
|
|
|
s.store_class_begin(field_name, "updateSentMessage");
|
|
|
|
s.store_field("random_id", random_id_);
|
|
|
|
s.store_field("message_id", message_id_.get());
|
|
|
|
s.store_field("date", date_);
|
2021-02-02 00:00:28 +01:00
|
|
|
s.store_field("ttl_period", ttl_period_);
|
2021-01-15 23:51:01 +01:00
|
|
|
s.store_class_end();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-07-04 04:58:54 +02:00
|
|
|
class UpdatesManager final : public Actor {
|
2018-12-31 20:04:05 +01:00
|
|
|
public:
|
|
|
|
UpdatesManager(Td *td, ActorShared<> parent);
|
|
|
|
|
2020-12-21 20:06:52 +01:00
|
|
|
void on_get_updates(tl_object_ptr<telegram_api::Updates> &&updates_ptr, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-01-15 23:17:35 +01:00
|
|
|
void add_pending_pts_update(tl_object_ptr<telegram_api::Update> &&update, int32 new_pts, int32 pts_count,
|
2021-08-15 11:46:38 +02:00
|
|
|
double receive_time, Promise<Unit> &&promise, const char *source);
|
2021-01-15 23:17:35 +01:00
|
|
|
|
2019-02-14 19:44:20 +01:00
|
|
|
static std::unordered_set<int64> get_sent_messages_random_ids(const telegram_api::Updates *updates_ptr);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-02-14 19:44:20 +01:00
|
|
|
static vector<const tl_object_ptr<telegram_api::Message> *> get_new_messages(
|
|
|
|
const telegram_api::Updates *updates_ptr);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-11-26 08:56:13 +01:00
|
|
|
static vector<InputGroupCallId> get_update_new_group_call_ids(const telegram_api::Updates *updates_ptr);
|
|
|
|
|
2021-04-30 18:53:39 +02:00
|
|
|
static string extract_join_group_call_presentation_params(telegram_api::Updates *updates_ptr);
|
|
|
|
|
2019-02-14 19:44:20 +01:00
|
|
|
static vector<DialogId> get_update_notify_settings_dialog_ids(const telegram_api::Updates *updates_ptr);
|
|
|
|
|
|
|
|
static vector<DialogId> get_chat_dialog_ids(const telegram_api::Updates *updates_ptr);
|
2018-02-28 23:08:45 +01:00
|
|
|
|
2020-12-25 14:12:09 +01:00
|
|
|
static int32 get_update_edit_message_pts(const telegram_api::Updates *updates_ptr);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void get_difference(const char *source);
|
|
|
|
|
|
|
|
void schedule_get_difference(const char *source);
|
|
|
|
|
2018-02-11 19:33:32 +01:00
|
|
|
void ping_server();
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool running_get_difference() const {
|
|
|
|
return running_get_difference_;
|
|
|
|
}
|
|
|
|
|
2021-08-19 19:36:26 +02:00
|
|
|
void timeout_expired() final;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
private:
|
|
|
|
static constexpr int32 FORCED_GET_DIFFERENCE_PTS_DIFF = 100000;
|
2021-08-16 11:19:30 +02:00
|
|
|
static constexpr int32 GAP_TIMEOUT_UPDATE_COUNT = 20;
|
2021-01-15 23:17:35 +01:00
|
|
|
static const double MAX_UNFILLED_GAP_TIME;
|
2021-08-19 19:36:26 +02:00
|
|
|
static const double MAX_PTS_SAVE_DELAY;
|
2021-01-15 23:17:35 +01:00
|
|
|
static constexpr bool DROP_PTS_UPDATES = false;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
friend class OnUpdate;
|
|
|
|
|
2021-01-15 23:17:35 +01:00
|
|
|
class PendingPtsUpdate {
|
|
|
|
public:
|
|
|
|
tl_object_ptr<telegram_api::Update> update;
|
|
|
|
int32 pts;
|
|
|
|
int32 pts_count;
|
2021-08-15 11:46:38 +02:00
|
|
|
double receive_time;
|
2021-01-15 23:17:35 +01:00
|
|
|
Promise<Unit> promise;
|
|
|
|
|
2021-08-15 11:46:38 +02:00
|
|
|
PendingPtsUpdate(tl_object_ptr<telegram_api::Update> &&update, int32 pts, int32 pts_count, double receive_time,
|
|
|
|
Promise<Unit> &&promise)
|
|
|
|
: update(std::move(update))
|
|
|
|
, pts(pts)
|
|
|
|
, pts_count(pts_count)
|
|
|
|
, receive_time(receive_time)
|
|
|
|
, promise(std::move(promise)) {
|
2021-01-15 23:17:35 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class PendingSeqUpdates {
|
2018-12-31 20:04:05 +01:00
|
|
|
public:
|
|
|
|
int32 seq_begin;
|
|
|
|
int32 seq_end;
|
|
|
|
int32 date;
|
2021-08-15 11:46:38 +02:00
|
|
|
double receive_time;
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<tl_object_ptr<telegram_api::Update>> updates;
|
2020-12-21 20:06:52 +01:00
|
|
|
Promise<Unit> promise;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-08-15 11:46:38 +02:00
|
|
|
PendingSeqUpdates(int32 seq_begin, int32 seq_end, int32 date, double receive_time,
|
|
|
|
vector<tl_object_ptr<telegram_api::Update>> &&updates, Promise<Unit> &&promise)
|
|
|
|
: seq_begin(seq_begin)
|
|
|
|
, seq_end(seq_end)
|
|
|
|
, date(date)
|
|
|
|
, receive_time(receive_time)
|
|
|
|
, updates(std::move(updates))
|
|
|
|
, promise(std::move(promise)) {
|
2018-12-31 20:04:05 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-12-21 20:06:52 +01:00
|
|
|
class PendingQtsUpdate {
|
|
|
|
public:
|
2021-11-11 15:39:09 +01:00
|
|
|
double receive_time = 0.0;
|
2020-12-21 20:06:52 +01:00
|
|
|
tl_object_ptr<telegram_api::Update> update;
|
2020-12-22 23:58:56 +01:00
|
|
|
vector<Promise<Unit>> promises;
|
2020-12-21 20:06:52 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
Td *td_;
|
|
|
|
ActorShared<> parent_;
|
2021-11-05 01:31:48 +01:00
|
|
|
int32 ref_cnt_ = 1;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
PtsManager pts_manager_;
|
2020-08-02 21:07:22 +02:00
|
|
|
PtsManager qts_manager_;
|
2018-12-31 20:04:05 +01:00
|
|
|
int32 date_ = 0;
|
|
|
|
int32 seq_ = 0;
|
|
|
|
string date_source_ = "nowhere";
|
|
|
|
|
2021-08-19 19:36:26 +02:00
|
|
|
double last_pts_save_time_ = 0;
|
|
|
|
double last_qts_save_time_ = 0;
|
|
|
|
int32 pending_pts_ = 0;
|
|
|
|
int32 pending_qts_ = 0;
|
|
|
|
|
2019-03-15 01:16:44 +01:00
|
|
|
int32 short_update_date_ = 0;
|
|
|
|
|
2021-01-15 23:17:35 +01:00
|
|
|
int32 accumulated_pts_count_ = 0;
|
|
|
|
int32 accumulated_pts_ = -1;
|
|
|
|
double last_pts_jump_warning_time_ = 0;
|
2021-02-01 11:06:38 +01:00
|
|
|
double last_pts_gap_time_ = 0;
|
2021-01-15 23:17:35 +01:00
|
|
|
|
|
|
|
std::multimap<int32, PendingPtsUpdate> pending_pts_updates_;
|
|
|
|
std::multimap<int32, PendingPtsUpdate> postponed_pts_updates_;
|
|
|
|
|
|
|
|
std::multimap<int32, PendingSeqUpdates> postponed_updates_; // updates received during getDifference
|
|
|
|
std::multimap<int32, PendingSeqUpdates> pending_seq_updates_; // updates with too big seq
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-12-21 20:06:52 +01:00
|
|
|
std::map<int32, PendingQtsUpdate> pending_qts_updates_; // updates with too big qts
|
2020-08-03 15:57:30 +02:00
|
|
|
|
2021-01-15 23:17:35 +01:00
|
|
|
Timeout pts_gap_timeout_;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
Timeout seq_gap_timeout_;
|
|
|
|
|
2020-08-03 15:57:30 +02:00
|
|
|
Timeout qts_gap_timeout_;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
int32 retry_time_ = 1;
|
|
|
|
Timeout retry_timeout_;
|
|
|
|
|
|
|
|
bool running_get_difference_ = false;
|
|
|
|
int32 last_get_difference_pts_ = 0;
|
2021-01-05 14:29:45 +01:00
|
|
|
int32 last_get_difference_qts_ = 0;
|
2021-01-05 14:06:51 +01:00
|
|
|
int32 min_postponed_update_pts_ = 0;
|
|
|
|
int32 min_postponed_update_qts_ = 0;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void tear_down() final;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-11-05 01:31:48 +01:00
|
|
|
void hangup_shared() final;
|
|
|
|
|
|
|
|
void hangup() final;
|
|
|
|
|
|
|
|
ActorShared<UpdatesManager> create_reference();
|
|
|
|
|
2021-01-15 23:42:06 +01:00
|
|
|
int32 get_pts() const {
|
|
|
|
return pts_manager_.mem_pts();
|
|
|
|
}
|
|
|
|
int32 get_qts() const {
|
|
|
|
return qts_manager_.mem_pts();
|
|
|
|
}
|
|
|
|
int32 get_date() const {
|
|
|
|
return date_;
|
|
|
|
}
|
|
|
|
|
2021-01-16 00:44:58 +01:00
|
|
|
Promise<> set_pts(int32 pts, const char *source) TD_WARN_UNUSED_RESULT;
|
2018-12-31 20:04:05 +01:00
|
|
|
Promise<> add_pts(int32 pts);
|
|
|
|
void on_pts_ack(PtsManager::PtsId ack_token);
|
|
|
|
void save_pts(int32 pts);
|
|
|
|
|
2020-08-02 21:07:22 +02:00
|
|
|
Promise<> add_qts(int32 qts);
|
|
|
|
void on_qts_ack(PtsManager::PtsId ack_token);
|
|
|
|
void save_qts(int32 qts);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void set_date(int32 date, bool from_update, string date_source);
|
|
|
|
|
2019-03-15 01:16:44 +01:00
|
|
|
int32 get_short_update_date() const;
|
|
|
|
|
2021-01-16 00:55:47 +01:00
|
|
|
void init_state();
|
|
|
|
|
|
|
|
void on_get_updates_state(tl_object_ptr<telegram_api::updates_state> &&state, const char *source);
|
|
|
|
|
2021-01-16 00:59:03 +01:00
|
|
|
void on_server_pong(tl_object_ptr<telegram_api::updates_state> &&state);
|
|
|
|
|
2021-01-16 00:44:58 +01:00
|
|
|
void on_get_difference(tl_object_ptr<telegram_api::updates_Difference> &&difference_ptr);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void process_get_difference_updates(vector<tl_object_ptr<telegram_api::Message>> &&new_messages,
|
|
|
|
vector<tl_object_ptr<telegram_api::EncryptedMessage>> &&new_encrypted_messages,
|
2020-08-03 15:57:30 +02:00
|
|
|
vector<tl_object_ptr<telegram_api::Update>> &&other_updates);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-12-21 20:06:52 +01:00
|
|
|
void on_pending_update(tl_object_ptr<telegram_api::Update> update, int32 seq, Promise<Unit> &&promise,
|
|
|
|
const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-12-21 20:06:52 +01:00
|
|
|
void add_pending_qts_update(tl_object_ptr<telegram_api::Update> &&update, int32 qts, Promise<Unit> &&promise);
|
2020-08-03 15:57:30 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_pending_updates(vector<tl_object_ptr<telegram_api::Update>> &&updates, int32 seq_begin, int32 seq_end,
|
2021-08-15 11:46:38 +02:00
|
|
|
int32 date, double receive_time, Promise<Unit> &&promise, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-11-05 01:31:48 +01:00
|
|
|
void on_pending_updates_processed(Result<Unit> result, Promise<Unit> promise);
|
2021-10-07 14:28:52 +02:00
|
|
|
|
2020-12-21 20:06:52 +01:00
|
|
|
void process_updates(vector<tl_object_ptr<telegram_api::Update>> &&updates, bool force_apply,
|
|
|
|
Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-01-15 23:17:35 +01:00
|
|
|
void postpone_pts_update(tl_object_ptr<telegram_api::Update> &&update, int32 pts, int32 pts_count,
|
2021-08-15 11:46:38 +02:00
|
|
|
double receive_time, Promise<Unit> &&promise);
|
2021-01-15 23:17:35 +01:00
|
|
|
|
|
|
|
void process_pts_update(tl_object_ptr<telegram_api::Update> &&update);
|
|
|
|
|
2020-12-21 20:06:52 +01:00
|
|
|
void process_seq_updates(int32 seq_end, int32 date, vector<tl_object_ptr<telegram_api::Update>> &&updates,
|
|
|
|
Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-12-21 20:06:52 +01:00
|
|
|
void process_qts_update(tl_object_ptr<telegram_api::Update> &&update_ptr, int32 qts, Promise<Unit> &&promise);
|
2020-08-03 15:57:30 +02:00
|
|
|
|
2021-08-16 11:19:30 +02:00
|
|
|
void process_all_pending_pts_updates();
|
|
|
|
|
|
|
|
void drop_all_pending_pts_updates();
|
|
|
|
|
2021-08-16 12:35:30 +02:00
|
|
|
void process_postponed_pts_updates();
|
|
|
|
|
2021-01-15 23:17:35 +01:00
|
|
|
void process_pending_pts_updates();
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void process_pending_seq_updates();
|
|
|
|
|
2020-08-03 15:57:30 +02:00
|
|
|
void process_pending_qts_updates();
|
|
|
|
|
2021-01-15 23:17:35 +01:00
|
|
|
static void fill_pts_gap(void *td);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
static void fill_seq_gap(void *td);
|
|
|
|
|
2020-08-03 15:57:30 +02:00
|
|
|
static void fill_qts_gap(void *td);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
static void fill_get_difference_gap(void *td);
|
|
|
|
|
|
|
|
static void fill_gap(void *td, const char *source);
|
|
|
|
|
2021-01-15 23:17:35 +01:00
|
|
|
void set_pts_gap_timeout(double timeout);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void set_seq_gap_timeout(double timeout);
|
|
|
|
|
2020-08-03 15:57:30 +02:00
|
|
|
void set_qts_gap_timeout(double timeout);
|
|
|
|
|
2021-01-05 14:06:51 +01:00
|
|
|
void run_get_difference(bool is_recursive, const char *source);
|
|
|
|
|
2021-01-16 00:55:47 +01:00
|
|
|
void on_failed_get_updates_state(Status &&error);
|
|
|
|
|
2021-01-16 00:44:58 +01:00
|
|
|
void on_failed_get_difference(Status &&error);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-12-04 13:50:57 +01:00
|
|
|
void before_get_difference(bool is_initial);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void after_get_difference();
|
|
|
|
|
2021-01-05 14:06:51 +01:00
|
|
|
static bool have_update_pts_changed(const vector<tl_object_ptr<telegram_api::Update>> &updates);
|
|
|
|
|
2021-01-15 21:39:34 +01:00
|
|
|
static bool check_pts_update_dialog_id(DialogId dialog_id);
|
|
|
|
|
2021-01-15 23:17:35 +01:00
|
|
|
static bool check_pts_update(const tl_object_ptr<telegram_api::Update> &update);
|
|
|
|
|
2021-01-11 21:58:03 +01:00
|
|
|
static bool is_pts_update(const telegram_api::Update *update);
|
|
|
|
|
2021-01-05 10:41:35 +01:00
|
|
|
static int32 get_update_pts(const telegram_api::Update *update);
|
|
|
|
|
2021-01-11 21:58:03 +01:00
|
|
|
static bool is_qts_update(const telegram_api::Update *update);
|
|
|
|
|
2021-01-05 10:41:35 +01:00
|
|
|
static int32 get_update_qts(const telegram_api::Update *update);
|
|
|
|
|
2019-02-14 19:44:20 +01:00
|
|
|
static const vector<tl_object_ptr<telegram_api::Update>> *get_updates(const telegram_api::Updates *updates_ptr);
|
|
|
|
|
2021-04-30 16:07:01 +02:00
|
|
|
static vector<tl_object_ptr<telegram_api::Update>> *get_updates(telegram_api::Updates *updates_ptr);
|
|
|
|
|
2019-06-17 03:48:29 +02:00
|
|
|
bool is_acceptable_user(UserId user_id) const;
|
|
|
|
|
|
|
|
bool is_acceptable_chat(ChatId chat_id) const;
|
|
|
|
|
|
|
|
bool is_acceptable_channel(ChannelId channel_id) const;
|
|
|
|
|
2020-09-11 16:56:17 +02:00
|
|
|
bool is_acceptable_peer(const tl_object_ptr<telegram_api::Peer> &peer) const;
|
2019-06-17 03:25:33 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool is_acceptable_message_entities(const vector<tl_object_ptr<telegram_api::MessageEntity>> &message_entities) const;
|
|
|
|
|
2021-11-10 15:14:00 +01:00
|
|
|
bool is_acceptable_reply_markup(const tl_object_ptr<telegram_api::ReplyMarkup> &reply_markup) const;
|
|
|
|
|
2020-09-10 15:28:25 +02:00
|
|
|
bool is_acceptable_message_reply_header(
|
|
|
|
const telegram_api::object_ptr<telegram_api::messageReplyHeader> &header) const;
|
|
|
|
|
2019-06-17 03:25:33 +02:00
|
|
|
bool is_acceptable_message_forward_header(
|
|
|
|
const telegram_api::object_ptr<telegram_api::messageFwdHeader> &header) const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool is_acceptable_message(const telegram_api::Message *message_ptr) const;
|
|
|
|
|
|
|
|
bool is_acceptable_update(const telegram_api::Update *update) const;
|
|
|
|
|
2021-01-15 17:32:16 +01:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updateNewMessage> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateMessageID> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateReadMessagesContents> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateEditMessage> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateDeleteMessages> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateReadHistoryInbox> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateReadHistoryOutbox> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateNotifySettings> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePeerSettings> update, Promise<Unit> &&promise);
|
2021-02-09 15:35:48 +01:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePeerHistoryTTL> update, Promise<Unit> &&promise);
|
|
|
|
|
2021-01-15 17:32:16 +01:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePeerLocated> update, Promise<Unit> &&promise);
|
2019-12-02 17:20:54 +01:00
|
|
|
|
2021-01-15 17:32:16 +01:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updateWebPage> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChannelWebPage> update, Promise<Unit> &&promise);
|
2019-12-17 17:17:57 +01:00
|
|
|
|
2021-01-15 17:32:16 +01:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updateFolderPeers> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateUserTyping> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChatUserTyping> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChannelUserTyping> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateEncryptedChatTyping> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateUserStatus> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateUserName> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateUserPhone> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateUserPhoto> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePeerBlocked> update, Promise<Unit> &&promise);
|
2021-06-28 14:55:11 +02:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updateBotCommands> update, Promise<Unit> &&promise);
|
2021-01-15 17:32:16 +01:00
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChatParticipants> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChatParticipantAdd> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChatParticipantAdmin> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChatParticipantDelete> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChatDefaultBannedRights> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateServiceNotification> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateDcOptions> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChat> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateNewChannelMessage> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateReadChannelInbox> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateReadChannelOutbox> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChannelReadMessagesContents> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChannelTooLong> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChannel> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateEditChannelMessage> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateDeleteChannelMessages> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChannelMessageViews> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChannelMessageForwards> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChannelAvailableMessages> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateReadChannelDiscussionInbox> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateReadChannelDiscussionOutbox> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePinnedMessages> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePinnedChannelMessages> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateDraftMessage> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateDialogPinned> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePinnedDialogs> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateDialogUnreadMark> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateDialogFilter> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateDialogFilters> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateDialogFilterOrder> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateBotInlineQuery> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateBotInlineSend> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateBotCallbackQuery> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateInlineBotCallbackQuery> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateFavedStickers> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateSavedGifs> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateConfig> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePtsChanged> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePrivacy> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateEncryption> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateNewEncryptedMessage> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateEncryptedMessagesRead> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateNewStickerSet> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateStickerSets> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateStickerSetsOrder> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateReadFeaturedStickers> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateRecentStickers> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateBotShippingQuery> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateBotPrecheckoutQuery> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateBotWebhookJSON> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateBotWebhookJSONQuery> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePhoneCall> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePhoneCallSignalingData> update, Promise<Unit> &&promise);
|
|
|
|
|
2021-04-30 16:07:01 +02:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updateGroupCallConnection> update, Promise<Unit> &&promise);
|
2021-01-15 17:32:16 +01:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updateGroupCall> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateGroupCallParticipants> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateContactsReset> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateLangPackTooLong> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateLangPack> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateGeoLiveViewed> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateMessagePoll> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateMessagePollVote> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateNewScheduledMessage> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateDeleteScheduledMessages> update, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateLoginToken> update, Promise<Unit> &&promise);
|
|
|
|
|
2021-02-19 00:16:50 +01:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updateBotStopped> update, Promise<Unit> &&promise);
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChatParticipant> update, Promise<Unit> &&promise);
|
2021-01-15 17:32:16 +01:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updateChannelParticipant> update, Promise<Unit> &&promise);
|
2021-10-28 21:49:56 +02:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updateBotChatInviteRequester> update, Promise<Unit> &&promise);
|
2020-08-03 20:54:28 +02:00
|
|
|
|
2021-01-15 17:32:16 +01:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updateTheme> update, Promise<Unit> &&promise);
|
2021-09-12 21:29:40 +02:00
|
|
|
|
2021-10-08 12:45:10 +02:00
|
|
|
void on_update(tl_object_ptr<telegram_api::updatePendingJoinRequests> update, Promise<Unit> &&promise);
|
|
|
|
|
2021-10-12 17:11:17 +02:00
|
|
|
// unsupported updates
|
2021-12-28 15:19:18 +01:00
|
|
|
|
|
|
|
void on_update(tl_object_ptr<telegram_api::updateMessageReactions> update, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|