Q_FOREACH (QObject *partObj, GetParticipants ()) { RoomParticipantEntry *part = qobject_cast<RoomParticipantEntry*> (partObj); if (part->GetEntryName () == OurNick_) return part; }
QString RoomCLEntry::GetRealID (QObject *obj) const { RoomParticipantEntry *entry = qobject_cast<RoomParticipantEntry*> (obj); if (!entry) return QString (); const QString& jid = entry->GetRealJID (); QString bare; QString resource; ClientConnection::Split (jid, &bare, &resource); return bare; }
QByteArray RoomCLEntry::GetAffName (QObject *participant) const { RoomParticipantEntry *entry = qobject_cast<RoomParticipantEntry*> (participant); if (!entry) { qWarning () << Q_FUNC_INFO << participant << "is not a RoomParticipantEntry"; return "noaffiliation"; } return Aff2Str_ [entry->GetAffiliation ()]; }
void RoomHandler::handleMessagesAreRead () { RoomParticipantEntry *entry = qobject_cast<RoomParticipantEntry*> (sender ()); if (!entry) { qWarning () << Q_FUNC_INFO << sender () << "is not a RoomParticipantEntry"; return; } if (entry->GetStatus (QString ()).State_ == SOffline) RemoveEntry (entry); }
IMUCEntry::MUCRole RoomCLEntry::GetRole (QObject *participant) const { if (!participant) participant = RH_->GetSelf (); RoomParticipantEntry *entry = qobject_cast<RoomParticipantEntry*> (participant); if (!entry) { qWarning () << Q_FUNC_INFO << participant << "is not a RoomParticipantEntry"; return MUCRInvalid; } return static_cast<MUCRole> (entry->GetRole ()); }
QMap<QByteArray, QList<QByteArray>> RoomCLEntry::GetPerms (QObject *participant) const { if (!participant) participant = RH_->GetSelf (); QMap<QByteArray, QList<QByteArray>> result; RoomParticipantEntry *entry = qobject_cast<RoomParticipantEntry*> (participant); if (!entry) { qWarning () << Q_FUNC_INFO << participant << "is not a RoomParticipantEntry"; result ["role"] << "norole"; result ["aff"] << "noaffiliation"; } else { result ["role"] << Role2Str_.value (entry->GetRole (), "invalid"); result ["aff"] << Aff2Str_.value (entry->GetAffiliation (), "invalid"); } return result; }