Skip to content

Commit 1722aef

Browse files
committed
Process information about communities.
1 parent 006c7b6 commit 1722aef

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

td/telegram/ChatManager.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "td/telegram/BotVerification.h"
1212
#include "td/telegram/BotVerification.hpp"
1313
#include "td/telegram/ChatTheme.h"
14+
#include "td/telegram/CommunityManager.h"
1415
#include "td/telegram/Dependencies.h"
1516
#include "td/telegram/DialogAdministrator.h"
1617
#include "td/telegram/DialogInviteLink.hpp"
@@ -5698,8 +5699,11 @@ void ChatManager::on_get_chat(tl_object_ptr<telegram_api::Chat> &&chat, const ch
56985699
on_get_channel_forbidden(static_cast<telegram_api::channelForbidden &>(*chat), source);
56995700
break;
57005701
case telegram_api::community::ID:
5702+
td_->community_manager_->on_get_community(static_cast<telegram_api::community &>(*chat), source);
57015703
break;
57025704
case telegram_api::communityForbidden::ID:
5705+
td_->community_manager_->on_get_community_forbidden(static_cast<telegram_api::communityForbidden &>(*chat),
5706+
source);
57035707
break;
57045708
default:
57055709
UNREACHABLE();
@@ -5709,12 +5713,22 @@ void ChatManager::on_get_chat(tl_object_ptr<telegram_api::Chat> &&chat, const ch
57095713
void ChatManager::on_get_chats(vector<tl_object_ptr<telegram_api::Chat>> &&chats, const char *source) {
57105714
for (auto &chat : chats) {
57115715
auto constuctor_id = chat->get_id();
5712-
if (constuctor_id == telegram_api::channel::ID || constuctor_id == telegram_api::channelForbidden::ID) {
5713-
// apply info about megagroups before corresponding chats
5716+
if (constuctor_id == telegram_api::community::ID || constuctor_id == telegram_api::communityForbidden::ID) {
5717+
// apply info about communities before the corresponding channels
57145718
on_get_chat(std::move(chat), source);
57155719
chat = nullptr;
57165720
}
57175721
}
5722+
for (auto &chat : chats) {
5723+
if (chat != nullptr) {
5724+
auto constuctor_id = chat->get_id();
5725+
if (constuctor_id == telegram_api::channel::ID || constuctor_id == telegram_api::channelForbidden::ID) {
5726+
// apply info about megagroups before the corresponding chats
5727+
on_get_chat(std::move(chat), source);
5728+
chat = nullptr;
5729+
}
5730+
}
5731+
}
57185732
for (auto &chat : chats) {
57195733
if (chat != nullptr) {
57205734
on_get_chat(std::move(chat), source);

0 commit comments

Comments
 (0)