LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
LC::Azoth::IMUCPerms Class Referenceabstract

This interface describes permissions in the given room. More...

#include "imucperms.h"

Public Member Functions

virtual ~IMUCPerms ()
 
virtual QMap< QByteArray, QList< QByteArray > > GetPossiblePerms () const =0
 Returns all possible permission classes and values. More...
 
virtual QMap< QByteArray, QList< QByteArray > > GetPerms (QObject *participant) const =0
 Returns current permissions for the given participant. More...
 
virtual QPair< QByteArray, QByteArray > GetKickPerm () const =0
 
virtual QPair< QByteArray, QByteArray > GetBanPerm () const =0
 
virtual QByteArray GetAffName (QObject *participant) const =0
 Returns the name of the affiliation icon. More...
 
virtual bool MayChangePerm (QObject *participant, const QByteArray &permClass, const QByteArray &targetPerm) const =0
 Whether given participant's permission may be changed to the given value. More...
 
virtual void SetPerm (QObject *participant, const QByteArray &permClass, const QByteArray &targetPerm, const QString &reason)=0
 Sets the permission for the given participant. More...
 
virtual bool IsLessByPerm (QObject *part1, QObject *part2) const =0
 Returns if one participant has less perms than another. More...
 
virtual bool IsMultiPerm (const QByteArray &permClass) const =0
 Returns whether users can have many perms of the given class at once. More...
 
virtual QString GetUserString (const QByteArray &id) const =0
 Returns a human-readable string for the given id. More...
 
virtual void TrySetPerm (const QString &userId, const QByteArray &permClass, const QByteArray &targetPerm, const QString &reason)
 Sets a perm on a user not present in the room. More...
 

Detailed Description

This interface describes permissions in the given room.

If a room supports getting/changing permissions for participants, this interface should be implemented by the room's CL entry object.

There may be different permission classes in a room, and each permission class has several permission variants, which are exclusive, while permissions from different classes are not exclusive.

For example, an XMPP MUC room has two permission classes: roles and affiliations. Role class and affiliation class have a different set of permissions, like participant/moderator or outcast/member/admin respectively.

Definition at line 49 of file imucperms.h.

Constructor & Destructor Documentation

◆ ~IMUCPerms()

virtual LC::Azoth::IMUCPerms::~IMUCPerms ( )
inlinevirtual

Definition at line 58 of file imucperms.h.

Member Function Documentation

◆ GetAffName()

virtual QByteArray LC::Azoth::IMUCPerms::GetAffName ( QObject *  participant) const
pure virtual

Returns the name of the affiliation icon.

Returns the name of the icon which is somewhat analogous to XMPP's affiliation system. The plugin is free to choose what participants should have as the affiliation.

The name should be one of the following:

  • "noaffiliation"
  • "outcast"
  • "member"
  • "admin"
  • "owner"
Parameters
[in]participantThe participant to query.
Returns
The affiliation analog for this participant

◆ GetBanPerm()

virtual QPair<QByteArray, QByteArray> LC::Azoth::IMUCPerms::GetBanPerm ( ) const
pure virtual

◆ GetKickPerm()

virtual QPair<QByteArray, QByteArray> LC::Azoth::IMUCPerms::GetKickPerm ( ) const
pure virtual

◆ GetPerms()

virtual QMap<QByteArray, QList<QByteArray> > LC::Azoth::IMUCPerms::GetPerms ( QObject *  participant) const
pure virtual

Returns current permissions for the given participant.

The returned map must have the same keys as the one from GetPossiblePerms(), and the values must be contained in the corresponding lists in GetPossiblePerms()'s return value.

Note
This function is also used for getting our user's permissions. For this, null pointer is passed instead of participant, and permissions of our user are expected to be returned.
Parameters
[in]participantThe participant for which to query the permissions, or NULL to query self.
Returns
The current permissions for the given participant.

◆ GetPossiblePerms()

virtual QMap<QByteArray, QList<QByteArray> > LC::Azoth::IMUCPerms::GetPossiblePerms ( ) const
pure virtual

Returns all possible permission classes and values.

Returns all possible permission classes and values for this MUC. In the map, the key is used as the permission class identifier, while the corresponding list of QByteArrays is the list of permission variants for this class.

Please note that this list should not change between calls to this method.

Returns
The possible permissions for this room.

◆ GetUserString()

virtual QString LC::Azoth::IMUCPerms::GetUserString ( const QByteArray &  id) const
pure virtual

Returns a human-readable string for the given id.

Parameters
[in]idThe identifier to query.
Returns
The human-readable translated string for this id.

◆ IsLessByPerm()

virtual bool LC::Azoth::IMUCPerms::IsLessByPerm ( QObject *  part1,
QObject *  part2 
) const
pure virtual

Returns if one participant has less perms than another.

This method is used for ordering participants when displaying them in MUC's participants list. For example, an XMPP room would typically use participants' roles for ordering.

Parameters
[in]part1First participant.
[in]part2Second participant.
Returns
True if first participant is "less than" the other one, false otherwise.

◆ IsMultiPerm()

virtual bool LC::Azoth::IMUCPerms::IsMultiPerm ( const QByteArray &  permClass) const
pure virtual

Returns whether users can have many perms of the given class at once.

This function is used to query the whether users in this MUC can have multiple perms of the given permClass at once.

Parameters
[in]permClassThe permission class to query.
Returns
True if a user can have multiple permissions at once.

◆ MayChangePerm()

virtual bool LC::Azoth::IMUCPerms::MayChangePerm ( QObject *  participant,
const QByteArray &  permClass,
const QByteArray &  targetPerm 
) const
pure virtual

Whether given participant's permission may be changed to the given value.

This function is used to query whether at this moment the permission from the given permClass could be set to the targetPerm value by our user.

targetPerm is one of the corresponding values from the map returned from GetPossiblePerms() map.

In case of failure (for example, participant doesn't belong to this room), this function should return false.

Parameters
[in]participantThe participant to query.
[in]permClassPermission class to operate in.
[in]targetPermTarget permission in that class.
Returns
Whether permission could be set successfully.

◆ SetPerm()

virtual void LC::Azoth::IMUCPerms::SetPerm ( QObject *  participant,
const QByteArray &  permClass,
const QByteArray &  targetPerm,
const QString &  reason 
)
pure virtual

Sets the permission for the given participant.

This function is used to set the participant's permission from the given permClass to the given targetPerm value (which is one of returned from GetPossiblePerms() for that class). If applicable, reason is used to describe the reason for changing the permission, which may be extremely useful, for example, when kicking or banning.

Parameters
[in]participantThe participant to change the permission for.
[in]permClassThe permission class to update.
[in]targetPermThe target permission in the given permission class.
[in]reasonThe reason of the permission change.
See also
TrySetPerm

◆ TrySetPerm()

virtual void LC::Azoth::IMUCPerms::TrySetPerm ( const QString &  userId,
const QByteArray &  permClass,
const QByteArray &  targetPerm,
const QString &  reason 
)
inlinevirtual

Sets a perm on a user not present in the room.

This function tries to set a given targetPerm of the given permClass on the user identified by the given userId. The user may or may not be present in the room at the moment. The userId should be the same as would be returned by ICLEntry::GetHumanReadableID() if the user was present in the room.

It is OK for the function to do nothing.

Parameters
[in]userIdThe ID of the user to change the permission for.
[in]permClassThe permission class to update.
[in]targetPermThe target permission in the given permission class.
[in]reasonThe reason of the permission change.
See also
SetPerm()

Definition at line 205 of file imucperms.h.


The documentation for this class was generated from the following file: