diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 686bb93bed..fc0f622fc4 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -126,6 +126,7 @@ PRIVATE api/api_earn.h api/api_editing.cpp api/api_editing.h + api/api_filter_updates.h api/api_global_privacy.cpp api/api_global_privacy.h api/api_hash.cpp diff --git a/Telegram/SourceFiles/api/api_filter_updates.h b/Telegram/SourceFiles/api/api_filter_updates.h new file mode 100644 index 0000000000..0126d37364 --- /dev/null +++ b/Telegram/SourceFiles/api/api_filter_updates.h @@ -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 +void PerformForUpdate( + const MTPUpdates &updates, + Fn 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