gloox 1.0
mucroomconfighandler.h
00001 /*
00002   Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 
00015 #ifndef MUCROOMCONFIGHANDLER_H__
00016 #define MUCROOMCONFIGHANDLER_H__
00017 
00018 #include "gloox.h"
00019 #include "jid.h"
00020 
00021 #include <string>
00022 #include <list>
00023 
00024 namespace gloox
00025 {
00026 
00027   class MUCRoom;
00028   class DataForm;
00029 
00038   class MUCListItem
00039   {
00040     public:
00045       MUCListItem( const JID& jid )
00046         : m_jid( jid ), m_affiliation( AffiliationInvalid ), m_role( RoleInvalid )
00047       {}
00048 
00056       MUCListItem( const JID& jid, MUCRoomRole role, MUCRoomAffiliation affiliation,
00057                    const std::string& nick )
00058         : m_jid( jid ), m_nick( nick ), m_affiliation( affiliation ), m_role( role )
00059       {}
00060 
00067       MUCListItem( const std::string& nick, MUCRoomAffiliation affiliation, const std::string& reason )
00068         : m_nick( nick ), m_affiliation( affiliation ), m_role( RoleInvalid ),
00069           m_reason( reason )
00070       {}
00071 
00078       MUCListItem( const std::string& nick, MUCRoomRole role, const std::string& reason )
00079         : m_nick( nick ), m_affiliation( AffiliationInvalid ), m_role( role ),
00080           m_reason( reason )
00081       {}
00082 
00086       ~MUCListItem() {}
00087 
00092       const JID& jid() const { return m_jid; }
00093 
00098       const std::string& nick() const { return m_nick; }
00099 
00104       MUCRoomAffiliation affiliation() const { return m_affiliation; }
00105 
00110       MUCRoomRole role() const { return m_role; }
00111 
00116       const std::string& reason() const { return m_reason; }
00117 
00118     private:
00119       JID m_jid;                   
00120       std::string m_nick;           
00121       MUCRoomAffiliation m_affiliation; 
00122       MUCRoomRole m_role;           
00123       std::string m_reason;         
00126   };
00127 
00131   typedef std::list<MUCListItem> MUCListItemList;
00132 
00136   enum MUCOperation
00137   {
00138     RequestUniqueName,              
00139     CreateInstantRoom,              
00140     CancelRoomCreation,             
00141     RequestRoomConfig,              
00142     SendRoomConfig,                 
00143     DestroyRoom,                    
00144     GetRoomInfo,                    
00145     GetRoomItems,                   
00146     SetRNone,                       
00147     SetVisitor,                     
00148     SetParticipant,                 
00149     SetModerator,                   
00150     SetANone,                       
00151     SetOutcast,                     
00152     SetMember,                      
00153     SetAdmin,                       
00154     SetOwner,                       
00155     RequestVoiceList,               
00156     StoreVoiceList,                 
00157     RequestBanList,                 
00158     StoreBanList,                   
00159     RequestMemberList,              
00160     StoreMemberList,                
00161     RequestModeratorList,           
00162     StoreModeratorList,             
00163     RequestOwnerList,               
00164     StoreOwnerList,                 
00165     RequestAdminList,               
00166     StoreAdminList,                 
00167     InvalidOperation                
00168   };
00169 
00176   class GLOOX_API MUCRoomConfigHandler
00177   {
00178     public:
00182       virtual ~MUCRoomConfigHandler() {}
00183 
00191       virtual void handleMUCConfigList( MUCRoom* room, const MUCListItemList& items,
00192                                         MUCOperation operation ) = 0;
00193 
00202       virtual void handleMUCConfigForm( MUCRoom* room, const DataForm& form ) = 0;
00203 
00211       virtual void handleMUCConfigResult( MUCRoom* room, bool success, MUCOperation operation ) = 0;
00212 
00220       virtual void handleMUCRequest( MUCRoom* room, const DataForm& form ) = 0;
00221 
00222   };
00223 
00224 }
00225 
00226 #endif // MUCROOMCONFIGHANDLER_H__