Add some debug logging.

This commit is contained in:
levlam 2021-12-31 16:21:03 +03:00
parent 330100d67c
commit d3e1385b8b

View File

@ -4417,9 +4417,11 @@ bool ContactsManager::have_input_peer_user(UserId user_id, AccessRights access_r
bool ContactsManager::have_input_peer_user(const User *u, AccessRights access_rights) { bool ContactsManager::have_input_peer_user(const User *u, AccessRights access_rights) {
if (u == nullptr) { if (u == nullptr) {
LOG(DEBUG) << "Have no user";
return false; return false;
} }
if (u->access_hash == -1 || u->is_min_access_hash) { if (u->access_hash == -1 || u->is_min_access_hash) {
LOG(DEBUG) << "Have user without access hash";
return false; return false;
} }
if (access_rights == AccessRights::Know) { if (access_rights == AccessRights::Know) {
@ -4429,6 +4431,7 @@ bool ContactsManager::have_input_peer_user(const User *u, AccessRights access_ri
return true; return true;
} }
if (u->is_deleted) { if (u->is_deleted) {
LOG(DEBUG) << "Have a deleted user";
return false; return false;
} }
return true; return true;
@ -4457,6 +4460,7 @@ bool ContactsManager::have_input_peer_chat(ChatId chat_id, AccessRights access_r
bool ContactsManager::have_input_peer_chat(const Chat *c, AccessRights access_rights) { bool ContactsManager::have_input_peer_chat(const Chat *c, AccessRights access_rights) {
if (c == nullptr) { if (c == nullptr) {
LOG(DEBUG) << "Have no basic group";
return false; return false;
} }
if (access_rights == AccessRights::Know) { if (access_rights == AccessRights::Know) {
@ -4466,9 +4470,11 @@ bool ContactsManager::have_input_peer_chat(const Chat *c, AccessRights access_ri
return true; return true;
} }
if (c->status.is_left()) { if (c->status.is_left()) {
LOG(DEBUG) << "Have left basic group";
return false; return false;
} }
if (access_rights == AccessRights::Write && !c->is_active) { if (access_rights == AccessRights::Write && !c->is_active) {
LOG(DEBUG) << "Have inactive basic group";
return false; return false;
} }
return true; return true;
@ -4505,6 +4511,7 @@ tl_object_ptr<telegram_api::InputPeer> ContactsManager::get_input_peer_channel(C
bool ContactsManager::have_input_peer_channel(const Channel *c, ChannelId channel_id, AccessRights access_rights, bool ContactsManager::have_input_peer_channel(const Channel *c, ChannelId channel_id, AccessRights access_rights,
bool from_linked) const { bool from_linked) const {
if (c == nullptr) { if (c == nullptr) {
LOG(DEBUG) << "Have no supergroup";
return false; return false;
} }
if (access_rights == AccessRights::Know) { if (access_rights == AccessRights::Know) {
@ -4514,6 +4521,7 @@ bool ContactsManager::have_input_peer_channel(const Channel *c, ChannelId channe
return true; return true;
} }
if (c->status.is_banned()) { if (c->status.is_banned()) {
LOG(DEBUG) << "Was banned in a supergroup";
return false; return false;
} }
if (c->status.is_member()) { if (c->status.is_member()) {
@ -4549,6 +4557,7 @@ bool ContactsManager::have_input_peer_channel(const Channel *c, ChannelId channe
} }
} }
} }
LOG(DEBUG) << "Have no access to a private supergroup";
return false; return false;
} }
@ -4558,6 +4567,7 @@ bool ContactsManager::have_input_encrypted_peer(SecretChatId secret_chat_id, Acc
bool ContactsManager::have_input_encrypted_peer(const SecretChat *secret_chat, AccessRights access_rights) { bool ContactsManager::have_input_encrypted_peer(const SecretChat *secret_chat, AccessRights access_rights) {
if (secret_chat == nullptr) { if (secret_chat == nullptr) {
LOG(DEBUG) << "Have no secret chat";
return false; return false;
} }
if (access_rights == AccessRights::Know) { if (access_rights == AccessRights::Know) {