Exemple #1
0
	bool RoomCLEntry::MayChangePerm (QObject *participant,
			const QByteArray& permClass, const QByteArray& perm) const
	{
		RoomParticipantEntry *entry = qobject_cast<RoomParticipantEntry*> (participant);
		if (!entry)
		{
			qWarning () << Q_FUNC_INFO
					<< participant
					<< "is not a RoomParticipantEntry";
			return false;
		}

		const auto ourRole = RH_->GetSelf ()->GetRole ();
		const auto ourAff = RH_->GetSelf ()->GetAffiliation ();

		if (permClass == "role")
			return MayChange (ourRole, ourAff, entry, Role2Str_.key (perm));
		else if (permClass == "aff")
			return MayChange (ourRole, ourAff, entry, Aff2Str_.key (perm));
		else
		{
			qWarning () << Q_FUNC_INFO
					<< "unknown perm class"
					<< permClass;
			return false;
		}
	}
	bool ChannelCLEntry::MayChangePerm (QObject *participant,
			const QByteArray& permClass, const QByteArray& perm) const
	{
		ServerParticipantEntry *entry =
				qobject_cast<ServerParticipantEntry*> (participant);
		if (!entry)
		{
			qWarning () << Q_FUNC_INFO
					<< participant
					<< "is not a ServerParticipantEntry";
			return false;
		}

		const ChannelRole ourRole = ICH_->GetSelf ()->
				GetRole (ICH_->GetChannelOptions ().ChannelName_);

		if (permClass == "permclass_role")
			return MayChange (ourRole, entry, Role2Str_.key (perm));
		else
		{
			qWarning () << Q_FUNC_INFO
					<< "unknown perm class"
					<< permClass;
			return false;
		}
	}