PeerData *NewGroupInner::selectedUser() { for (ContactsData::const_iterator i = _contactsData.cbegin(), e = _contactsData.cend(); i != e; ++i) { if (i.value()->check) { return i.key(); } } return 0; }
QVector<MTPInputUser> NewGroupInner::selectedInputs() { QVector<MTPInputUser> result; result.reserve(_contactsData.size()); for (ContactsData::const_iterator i = _contactsData.cbegin(), e = _contactsData.cend(); i != e; ++i) { if (i.value()->check) { result.push_back(i.key()->inputUser); } } return result; }
QVector<UserData*> AddParticipantInner::selected() { QVector<UserData*> result; result.reserve(_contactsData.size()); for (ContactsData::const_iterator i = _contactsData.cbegin(), e = _contactsData.cend(); i != e; ++i) { if (i.value()->check) { result.push_back(i.key()); } } return result; }
ContactsInner::ContactData *ContactsInner::contactData(DialogRow *row) { ContactData *data = (ContactData*)row->attached; if (!data) { UserData *user = row->history->peer->asUser(); ContactsData::const_iterator i = _contactsData.constFind(user); if (i == _contactsData.cend()) { _contactsData.insert(user, data = new ContactData()); data->name.setText(st::profileListNameFont, user->name, _textNameOptions); data->online = App::onlineText(user, _time); } else { data = i.value(); } row->attached = data; } return data; }