Skip to content

Commit

Permalink
Don't add group chats that we are not a member of
Browse files Browse the repository at this point in the history
  • Loading branch information
Thaodan committed Jun 23, 2022
1 parent 17b4727 commit ca1ff97
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion td-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,18 @@ void PurpleTdClient::processUpdate(td::td_api::Object &update)
case td::td_api::updateNewChat::ID: {
auto &newChat = static_cast<td::td_api::updateNewChat &>(update);
purple_debug_misc(config::pluginId, "Incoming update: new chat\n");
addChat(std::move(newChat.chat_));
if (newChat.chat_->type_->get_id() == td::td_api::chatTypePrivate::ID ||
newChat.chat_->type_->get_id() == td::td_api::chatTypeSecret::ID ||
m_data.isGroupChatWithMembership(*newChat.chat_.get()))
addChat(std::move(newChat.chat_));
else {
purple_debug_misc(config::pluginId,
"Incoming update: ignorig ID=%d\n",
update.get_id());
purple_debug_misc(config::pluginId,
"Not adding a group that we are not a member of");
}

break;
}

Expand Down

0 comments on commit ca1ff97

Please sign in to comment.