void RosterReplacer::performRenames(const QMap<Buddy, Contact> &contactsToRename) { BuddyList buddiesToRemove; for (QMap<Buddy, Contact>::const_iterator i = contactsToRename.constBegin(); i != contactsToRename.constEnd(); i++) { // do not remove now as theoretically it could be used in next loop run buddiesToRemove.append(i.value().ownerBuddy()); i.value().setOwnerBuddy(i.key()); } for (auto &&buddy : buddiesToRemove) m_buddyManager->removeBuddyIfEmpty(buddy, true); }
BuddyList JabberOpenChatWithRunner::matchingContacts(const QString &query) { BuddyList matchedContacts; QString queryCopy(query); int pos = 0; JabberIdValidator validator; if (validator.validate(queryCopy, pos) != QValidator::Acceptable) return matchedContacts; auto contact = m_contactManager->byId(m_account, query, ActionCreate); auto buddy = m_buddyManager->byContact(contact, ActionCreate); matchedContacts.append(buddy); return matchedContacts; }
void GaduSearchService::handleEventPubdir50SearchReply(struct gg_event *e) { gg_pubdir50_t res = e->event.pubdir50; BuddyList results; int count = gg_pubdir50_count(res); kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "found %d results\n", count); for (int i = 0; i < count; i++) results.append(GaduProtocolHelper::searchResultToBuddy(account(), res, i)); From = gg_pubdir50_next(res); emit newResults(results); }
BuddyList TlenOpenChatWithRunner::matchingContacts(const QString &query) { kdebugf(); BuddyList matchedContacts; if (!validateUserID(query)) return matchedContacts; Contact contact = ContactManager::instance()->byId(ParentAccount, query, ActionCreate); Buddy buddy = contact.ownerBuddy(); if (buddy.isNull()) { Buddy buddy = Buddy::create(); buddy.setDisplay(QString("%1: %2").arg(ParentAccount.accountIdentity().name()).arg(query)); contact.setOwnerBuddy(buddy); } matchedContacts.append(buddy); return matchedContacts; }