mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 22:46:10 +00:00
Added initial implementation of filter for MTP updates.
This commit is contained in:
27
Telegram/SourceFiles/api/api_filter_updates.h
Normal file
27
Telegram/SourceFiles/api/api_filter_updates.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Api {
|
||||
|
||||
template <typename Type>
|
||||
void PerformForUpdate(
|
||||
const MTPUpdates &updates,
|
||||
Fn<void(const Type &)> callback) {
|
||||
updates.match([&](const MTPDupdates &updates) {
|
||||
for (const auto &update : updates.vupdates().v) {
|
||||
update.match([&](const Type &d) {
|
||||
callback(d);
|
||||
}, [](const auto &) {
|
||||
});
|
||||
}
|
||||
}, [](const auto &) {
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Api
|
Reference in New Issue
Block a user