void ContactsInner::peerUpdated(PeerData *peer) { if (!peer->chat) { ContactsData::iterator i = _contactsData.find(peer->asUser()); if (i != _contactsData.cend()) { for (DialogRow *row = _contacts->list.begin; row->next; row = row->next) { if (row->attached == i.value()) row->attached = 0; } if (!_filter.isEmpty()) { for (int32 j = 0, s = _filtered.size(); j < s; ++j) { if (_filtered[j]->attached == i.value()) _filtered[j]->attached = 0; } } delete i.value(); _contactsData.erase(i); } } parentWidget()->update(); }
void AddParticipantInner::peerUpdated(PeerData *peer) { if (!peer || peer == _chat) { if (_chat->forbidden) { App::wnd()->hideLayer(); } else if (!_chat->participants.isEmpty() || _chat->count <= 0) { for (ContactsData::iterator i = _contactsData.begin(), e = _contactsData.end(); i != e; ++i ) { delete i.value(); } _contactsData.clear(); for (DialogRow *row = _contacts->list.begin; row->next; row = row->next) { row->attached = 0; } if (!_filter.isEmpty()) { for (int32 j = 0, s = _filtered.size(); j < s; ++j) { _filtered[j]->attached = 0; } } } } else if (!peer->chat) { ContactsData::iterator i = _contactsData.find(peer->asUser()); if (i != _contactsData.cend()) { for (DialogRow *row = _contacts->list.begin; row->next; row = row->next) { if (row->attached == i.value()) row->attached = 0; } if (!_filter.isEmpty()) { for (int32 j = 0, s = _filtered.size(); j < s; ++j) { if (_filtered[j]->attached == i.value()) _filtered[j]->attached = 0; } } delete i.value(); _contactsData.erase(i); } } parentWidget()->update(); }