gloox  1.0.28
mucroomconfighandler.h
1 /*
2  Copyright (c) 2006-2023 by Jakob Schröter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 
15 #ifndef MUCROOMCONFIGHANDLER_H__
16 #define MUCROOMCONFIGHANDLER_H__
17 
18 #include "gloox.h"
19 #include "jid.h"
20 
21 #include <string>
22 #include <list>
23 
24 namespace gloox
25 {
26 
27  class MUCRoom;
28  class DataForm;
29 
39  {
40  public:
45  MUCListItem( const JID& jid )
46  : m_jid( jid ), m_affiliation( AffiliationInvalid ), m_role( RoleInvalid )
47  {}
48 
57  const std::string& nick )
58  : m_jid( jid ), m_nick( nick ), m_affiliation( affiliation ), m_role( role )
59  {}
60 
67  MUCListItem( const std::string& nick, MUCRoomAffiliation affiliation, const std::string& reason )
68  : m_nick( nick ), m_affiliation( affiliation ), m_role( RoleInvalid ),
69  m_reason( reason )
70  {}
71 
78  MUCListItem( const std::string& nick, MUCRoomRole role, const std::string& reason )
79  : m_nick( nick ), m_affiliation( AffiliationInvalid ), m_role( role ),
80  m_reason( reason )
81  {}
82 
87 
92  const JID& jid() const { return m_jid; }
93 
98  const std::string& nick() const { return m_nick; }
99 
104  MUCRoomAffiliation affiliation() const { return m_affiliation; }
105 
110  MUCRoomRole role() const { return m_role; }
111 
116  const std::string& reason() const { return m_reason; }
117 
118  private:
119  JID m_jid;
120  std::string m_nick;
121  MUCRoomAffiliation m_affiliation;
122  MUCRoomRole m_role;
123  std::string m_reason;
126  };
127 
131  typedef std::list<MUCListItem> MUCListItemList;
132 
137  {
168  };
169 
176  class GLOOX_API MUCRoomConfigHandler
177  {
178  public:
183 
191  virtual void handleMUCConfigList( MUCRoom* room, const MUCListItemList& items,
192  MUCOperation operation ) = 0;
193 
202  virtual void handleMUCConfigForm( MUCRoom* room, const DataForm& form ) = 0;
203 
211  virtual void handleMUCConfigResult( MUCRoom* room, bool success, MUCOperation operation ) = 0;
212 
220  virtual void handleMUCRequest( MUCRoom* room, const DataForm& form ) = 0;
221 
222  };
223 
224 }
225 
226 #endif // MUCROOMCONFIGHANDLER_H__
An abstraction of a XEP-0004 Data Form.
Definition: dataform.h:57
An abstraction of a JID.
Definition: jid.h:31
MUCRoomAffiliation affiliation() const
const std::string & nick() const
const JID & jid() const
MUCListItem(const JID &jid, MUCRoomRole role, MUCRoomAffiliation affiliation, const std::string &nick)
MUCListItem(const std::string &nick, MUCRoomAffiliation affiliation, const std::string &reason)
MUCListItem(const JID &jid)
const std::string & reason() const
MUCRoomRole role() const
MUCListItem(const std::string &nick, MUCRoomRole role, const std::string &reason)
An abstract interface that can be implemented for MUC room configuration.
virtual void handleMUCConfigResult(MUCRoom *room, bool success, MUCOperation operation)=0
virtual void handleMUCConfigList(MUCRoom *room, const MUCListItemList &items, MUCOperation operation)=0
virtual void handleMUCRequest(MUCRoom *room, const DataForm &form)=0
virtual void handleMUCConfigForm(MUCRoom *room, const DataForm &form)=0
This is an implementation of XEP-0045 (Multi-User Chat).
Definition: mucroom.h:87
The namespace for the gloox library.
Definition: adhoc.cpp:28
MUCRoomRole
Definition: gloox.h:1164
@ RoleInvalid
Definition: gloox.h:1169
std::list< MUCListItem > MUCListItemList
MUCRoomAffiliation
Definition: gloox.h:1151
@ AffiliationInvalid
Definition: gloox.h:1157