QString ContactRegistry::getNickname(ContactId const& identity) const { if (hasIdentity(identity)) { accessMutex.lock(); QString result = identityToIdentityContactHashMap.find(identity).value()->getContactName(); accessMutex.unlock(); return result; } return emptyString; }
/// Checks whether a certain group axiom is fulfilled, can be used as a more /// fine-grained alternative to isGroup(). bool Group::fulfillsAxiom(GroupAxiom axiom) const { switch (axiom) { case Closure: return isClosed(); case Identity: return hasIdentity(); case Inversion: return eachElementHasInverse(); case Associativity: return associativityHolds(); default: return false; } }
Disco::Item::Actions Disco::Item::actions() const { if (d->actions & ActionsNotInitialized) { // Some kind of magic for client support d->actions = Disco::Item::Actions(); bool isIRC = hasIdentity(QLatin1String("conference"), QLatin1String("irc")); d->actions |= ActionAdd; if (d->features.contains(QLatin1String("http://jabber.org/protocol/muc")) && (!d->jid.node().isEmpty() || isIRC)) { d->actions |= ActionJoin; } if (d->features.contains(QLatin1String("http://jabber.org/protocol/bytestreams"))) d->actions |= ActionProxy; if(d->features.contains("http://jabber.org/protocol/muc#register") || d->features.contains(QLatin1String("jabber:iq:register"))) { d->actions |= ActionRegister; } if (d->features.contains(QLatin1String("jabber:iq:search"))) d->actions |= ActionSearch; if (d->features.contains(QLatin1String("vcard-temp"))) d->actions |= ActionVCard; if (d->features.contains(NS_DISCO_ITEMS) || (d->features.contains(QLatin1String("http://jabber.org/protocol/muc")) && !isIRC) || (d->features.isEmpty() && d->identities.isEmpty())) { d->actions |= ActionExpand; } if (hasIdentity(QLatin1String("automation"))) { if (hasIdentity(QString(), QLatin1String("command-list"))) d->actions |= ActionExpand; d->actions |= ActionExecute; } else if (d->features.contains(QLatin1String("http://jabber.org/protocol/commands"))) { d->actions |= ActionExpand; d->actions |= ActionExecute; } } return d->actions; }
int64_t PibDb::addKey(const Name& keyName, const PublicKey& key) { if (keyName.empty()) return 0; Name&& identity = keyName.getPrefix(-1); if (!hasIdentity(identity)) addIdentity(identity); sqlite3_stmt* statement; sqlite3_prepare_v2(m_database, "INSERT INTO keys (identity_id, key_name, key_type, key_bits) \ values ((SELECT id FROM identities WHERE identity=?), ?, ?, ?)", -1, &statement, nullptr); sqlite3_bind_block(statement, 1, identity.wireEncode(), SQLITE_TRANSIENT); sqlite3_bind_block(statement, 2, keyName.wireEncode(), SQLITE_TRANSIENT); sqlite3_bind_int(statement, 3, key.getKeyType()); sqlite3_bind_blob(statement, 4, key.get().buf(), key.get().size(), SQLITE_STATIC); sqlite3_step(statement); sqlite3_finalize(statement); return sqlite3_last_insert_rowid(m_database); }
/** * Returns whether the group fulfills the four group axioms * * When a Group is constructed from a list of symmetry operations, no checks * are performed whether this set of operations fulfills the four group axioms, * i.e. whether it is a group at all. If you are not sure whether a set of * symmetry operations is a group, construct one and look at the return value * of this method. * * @return True if group axioms are fulfilled, false otherwise. */ bool Group::isGroup() const { return isClosed() && hasIdentity() && eachElementHasInverse() && associativityHolds(); }