/usr/include/gloox/mucroomhandler.h is in libgloox-dev 1.0.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | /*
Copyright (c) 2006-2014 by Jakob Schroeter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef MUCROOMHANDLER_H__
#define MUCROOMHANDLER_H__
#include "gloox.h"
#include "presence.h"
#include "disco.h"
#include <string>
namespace gloox
{
class JID;
class MUCRoom;
class Message;
class DataForm;
/**
* Describes a participant in a MUC room.
*/
struct MUCRoomParticipant
{
JID* nick; /**< Pointer to a JID holding the participant's full JID
* in the form @c room\@service/nick. <br>
* @note The MUC server @b may change the chosen nickname.
* If the @b self member of this struct is true, one should
* check the resource of this member if the actual nickname
* is important. */
MUCRoomAffiliation affiliation; /**< The participant's affiliation with the room. */
MUCRoomRole role; /**< The participant's role with the room. */
JID* jid; /**< Pointer to the occupant's full JID in a non-anonymous room or
* in a semi-anonymous room if the user (of gloox) has a role of
* moderator.
* 0 if the MUC service doesn't provide the JID. */
int flags; /**< ORed MUCUserFlag values. Indicate conditions like: user has
* been kicked or banned from the room. Also may indicate that
* this struct refers to this instance's user.
* (MUC servers send presence to all room occupants, including
* the originator of the presence.) */
std::string reason; /**< If the presence change is the result of an action where the
* actor can provide a reason for the action, this reason is stored
* here. Examples: Kicking, banning, leaving the room. */
JID* actor; /**< If the presence change is the result of an action of a room
* member, a pointer to the actor's JID is stored here, if the
* actor chose to disclose his or her identity. Examples: Kicking
* and banning.
* 0 if the identity is not disclosed. */
std::string newNick; /**< In case of a nickname change, this holds the new nick, while the
* nick member holds the old room nick (in JID form). @c newNick is only
* set if @c flags contains @b UserNickChanged. If @c flags contains
* @b UserSelf as well, a foregoing nick change request (using
* MUCRoom::setNick()) can be considered acknowledged. In any case
* the user's presence sent with the nick change acknowledgement
* is of type @c unavailable. Another presence of type @c available
* (or whatever the user's presence was at the time of the nick change
* request) will follow (not necessarily immediately) coming from the
* user's new nickname. Empty if there is no nick change in progress. */
std::string status; /**< If the presence packet contained a status message, it is stored
* here. */
JID* alternate; /**< If @c flags contains UserRoomDestroyed, and if the user who
* destroyed the room specified an alternate room, this member holds
* a pointer to the alternate room's JID, else it is 0. */
};
/**
* @brief 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 Schroeter <js@camaya.net>
* @since 0.9
*/
class GLOOX_API MUCRoomHandler
{
public:
/**
* Virtual Destructor.
*/
virtual ~MUCRoomHandler() {}
/**
* 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.
* @param room The room.
* @param participant A struct describing the occupant's status and/or action.
* @param presence The occupant's full presence.
*/
virtual void handleMUCParticipantPresence( MUCRoom* room, const MUCRoomParticipant participant,
const Presence& presence ) = 0;
/**
* 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.
* @param room The room the message came from.
* @param msg The entire Message.
* @param priv Indicates whether this is a private message.
* @note The sender's nick name can be obtained with this call:
* @code
* const std::string nick = msg.from().resource();
* @endcode
* @note 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:
* @code
* const DelayedDelivery* dd = msg.when(); // may be 0 if no such extension exists
* @endcode
*/
virtual void handleMUCMessage( MUCRoom* room, const Message& msg, bool priv ) = 0;
/**
* 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 @b 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 @b 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:
* @li use MUCRoom::cancelRoomCreation() to abort creation and delete the room,
* @li use MUCRoom::acknowledgeInstantRoom() to accept the room's default configuration, or
* @li use MUCRoom::requestRoomConfig() to request the room's configuration form.
*
* @param room The room.
* @return @b True to accept the default room configuration, @b false to keep the room locked
* until configured manually by the room owner.
*/
virtual bool handleMUCRoomCreation( MUCRoom* room ) = 0;
/**
* This function is called when the room subject has been changed.
* @param room The room.
* @param 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.
* @param subject The new room subject.
*/
virtual void handleMUCSubject( MUCRoom* room, const std::string& nick,
const std::string& subject ) = 0;
/**
* 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.
* @param room The room.
* @param invitee The JID if the person that declined the invitation.
* @param reason An optional reason for declining the invitation.
*/
virtual void handleMUCInviteDecline( MUCRoom* room, const JID& invitee,
const std::string& reason ) = 0;
/**
* 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:
* @li @b Not @b Authorized: Password required.
* @li @b Forbidden: Access denied, user is banned.
* @li @b Item @b Not @b Found: The room does not exist.
* @li @b Not @b Allowed: Room creation is restricted.
* @li @b Not @b Acceptable: Room nicks are locked down.
* @li @b Registration @b Required: User is not on the member list.
* @li @b Conflict: Desired room nickname is in use or registered by another user.
* @li @b Service @b Unavailable: Maximum number of users has been reached.
*
* Other errors might appear, depending on the service implementation.
* @param room The room.
* @param error The error.
*/
virtual void handleMUCError( MUCRoom* room, StanzaError error ) = 0;
/**
* This function usually (see below) is called in response to a call to MUCRoom::getRoomInfo().
* @param room The room.
* @param features ORed MUCRoomFlag's.
* @param name The room's name as returned by Service Discovery.
* @param 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.
*/
virtual void handleMUCInfo( MUCRoom* room, int features, const std::string& name,
const DataForm* infoForm ) = 0;
/**
* This function is called in response to a call to MUCRoom::getRoomItems().
* @param room The room.
* @param 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.
*/
virtual void handleMUCItems( MUCRoom* room, const Disco::ItemList& items ) = 0;
};
}
#endif// MUCROOMHANDLER_H__
|