MUCRoomHandler Class Referenceabstract

`#include <mucroomhandler.h>`

## Public Member Functions

virtual | ~MUCRoomHandler ()
virtual void | handleMUCParticipantPresence (MUCRoom *room, const MUCRoomParticipant participant, const Presence &presence)=0
virtual void | handleMUCMessage (MUCRoom *room, const Message &msg, bool priv)=0
virtual bool | handleMUCRoomCreation (MUCRoom *room)=0
virtual void | handleMUCSubject (MUCRoom *room, const std::string &nick, const std::string &subject)=0
virtual void | handleMUCInviteDecline (MUCRoom *room, const JID &invitee, const std::string &reason)=0
virtual void | handleMUCError (MUCRoom *room, StanzaError error)=0
virtual void | handleMUCInfo (MUCRoom *room, int features, const std::string &name, const DataForm *infoForm)=0
virtual void | handleMUCItems (MUCRoom *room, const Disco::ItemList &items)=0

## Detailed Description

This interface enables inheriting classes to be notified about certain events in a MUC room.

See MUCRoom for examples how to use this interface.

Note
  This interface does not notify about room configuration related events. Use MUCRoomConfigHandler for that puprose.

Author
  Jakob Schröter js@ca.nosp@m.maya.nosp@m..net

Since
  0.9

Definition at line 90 of file mucroomhandler.h.

## Constructor & Destructor Documentation

## ~MUCRoomHandler()

virtual ~MUCRoomHandler | ( |  | ) |

inline virtual

Virtual Destructor.

Definition at line 96 of file mucroomhandler.h.

## Member Function Documentation

## handleMUCError()

virtual void handleMUCError | ( | MUCRoom * | room,
|  | StanzaError | error )

pure virtual

This function is called when an error occurs in the room or when entering the room.

Note
  The following error conditions are specified for MUC:
  - Not Authorized: Password required.
  - Forbidden: Access denied, user is banned.
  - Item Not Found: The room does not exist.
  - Not Allowed: Room creation is restricted.
  - Not Acceptable: Room nicks are locked down.
  - Registration Required: User is not on the member list.
  - Conflict: Desired room nickname is in use or registered by another user.
  - Service Unavailable: Maximum number of users has been reached.
  Other errors might appear, depending on the service implementation.

Parameters

  room | The room.
  error | The error.

## handleMUCInfo()

virtual void handleMUCInfo | ( | MUCRoom * | room,
|  | int | features,
|  | const std::string & | name,
|  | const DataForm * | infoForm )

pure virtual

This function usually (see below) is called in response to a call to MUCRoom::getRoomInfo().

Parameters

  room | The room.
  features | ORed MUCRoomFlag's.
  name | The room's name as returned by Service Discovery.
  infoForm | A DataForm containing extended room information. May be 0 if the service doesn't support extended room information. See Section 15.5 of XEP-0045 for defined field types. You should not delete the form.

Note
  This function may be called without a prior call to MUCRoom::getRoomInfo(). This happens if the room config is changed, e.g. by a room admin.

## handleMUCInviteDecline()

virtual void handleMUCInviteDecline | ( | MUCRoom * | room,
|  | const JID & | invitee,
|  | const std::string & | reason )

pure virtual

This function is called when the user invited somebody (e.g., by using MUCRoom::invite()) to the room, but the invitation was declined by that person.

Parameters

  room | The room.
  invitee | The JID if the person that declined the invitation.
  reason | An optional reason for declining the invitation.

## handleMUCItems()

virtual void handleMUCItems | ( | MUCRoom * | room,
|  | const Disco::ItemList & | items )

pure virtual

This function is called in response to a call to MUCRoom::getRoomItems().

Parameters

  room | The room.
  items | A map of room participants. The key is the name, the value is the occupant's room JID. The map may be empty if such info is private.

## handleMUCMessage()

virtual void handleMUCMessage | ( | MUCRoom * | room,
|  | const Message & | msg,
|  | bool | priv )

pure virtual

This function is called when a message arrives through the room.

Note
  This may be a private message! If the message is private, and you want to answer it privately, you should create a new MessageSession to the user's full room nick and use that for any further private communication with the user.

Parameters

  room | The room the message came from.
  msg | The entire Message.
  priv | Indicates whether this is a private message.

Note
  The sender's nick name can be obtained with this call:
  const std::string nick = msg.from().resource();
  The message may contain an extension of type DelayedDelivery describing the date/time when the message was originally sent. The presence of such an extension usually indicates that the message is sent as part of the room history. This extension can be obtained with this call:
  const DelayedDelivery* dd = msg.when(); // may be 0 if no such extension exists
  gloox::DelayedDelivery
  This is an implementation of XEP-0203 (Delayed Delivery).
  Definition delayeddelivery.h:39

## handleMUCParticipantPresence()

virtual void handleMUCParticipantPresence | ( | MUCRoom * | room,
|  | const MUCRoomParticipant | participant,
|  | const Presence & | presence )

pure virtual

This function is called whenever a room occupant enters the room, changes presence inside the room, or leaves the room.

Note
  The MUCRoomParticipant struct, including pointers to JIDs, will be cleaned up after this function returned.

Parameters

  room | The room.
  participant | A struct describing the occupant's status and/or action.
  presence | The occupant's full presence.

## handleMUCRoomCreation()

virtual bool handleMUCRoomCreation | ( | MUCRoom * | room | ) |

pure virtual

This function is called if the room that was just joined didn't exist prior to the attempted join. Therfore the room was created by MUC service. To accept the default configuration of the room assigned by the MUC service, return true from this function. The room will be opened by the MUC service and available for other users to join. If you don't want to accept the default room configuration, return false from this function. The room will stay locked until it is either fully configured, created as an instant room, or creation is canceled.

If you returned false from this function you should use one of the following options:

- use MUCRoom::cancelRoomCreation() to abort creation and delete the room,
- use MUCRoom::acknowledgeInstantRoom() to accept the room's default configuration, or
- use MUCRoom::requestRoomConfig() to request the room's configuration form.

Parameters

  room | The room.

Returns
  True to accept the default room configuration, false to keep the room locked until configured manually by the room owner.

## handleMUCSubject()

virtual void handleMUCSubject | ( | MUCRoom * | room,
|  | const std::string & | nick,
|  | const std::string & | subject )

pure virtual

This function is called when the room subject has been changed.

Parameters

  room | The room.
  nick | The nick of the occupant that changed the room subject.

Note
  With some MUC services the nick may be empty when a room is first entered.

Parameters

  subject | The new room subject.

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

- mucroomhandler.h