PTLib  Version 2.10.11
xmpp_muc.h
Go to the documentation of this file.
1 /*
2  * xmpp_muc.h
3  *
4  * Extensible Messaging and Presence Protocol (XMPP)
5  * JEP-0045 Multi-User Chat
6  *
7  * Portable Windows Library
8  *
9  * Copyright (c) 2004 Reitek S.p.A.
10  *
11  * The contents of this file are subject to the Mozilla Public License
12  * Version 1.0 (the "License"); you may not use this file except in
13  * compliance with the License. You may obtain a copy of the License at
14  * http://www.mozilla.org/MPL/
15  *
16  * Software distributed under the License is distributed on an "AS IS"
17  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18  * the License for the specific language governing rights and limitations
19  * under the License.
20  *
21  * The Original Code is Portable Windows Library.
22  *
23  * The Initial Developer of the Original Code is Post Increment
24  *
25  * Contributor(s): ______________________________________.
26  *
27  * $Revision: 25387 $
28  * $Author: rjongbloed $
29  * $Date: 2011-03-22 22:51:09 -0500 (Tue, 22 Mar 2011) $
30  */
31 
32 #ifndef PTLIB_XMPP_MUC_H
33 #define PTLIB_XMPP_MUC_H
34 
35 #ifdef P_USE_PRAGMA
36 #pragma interface
37 #endif
38 
39 #include <ptclib/xmpp_c2s.h>
40 
41 #if P_EXPAT
42 
44 
45 namespace XMPP
46 {
47  namespace MUC
48  {
49  extern const PCaselessString & NamespaceTag();
50 
51  class User : public PObject
52  {
53  PCLASSINFO(User, PObject);
54  public:
55  User();
56  ~User();
57 
58  static const PCaselessString & NamespaceTag();
59 
60  enum Role {
65  Unknown = 999
66  };
67 
68  enum Affiliation {
74  Unknown_a = 999
75  };
76 
80 
81  Comparison Compare(const PObject & obj) const;
82  };
83  PSORTED_LIST(Users, User);
84 
85  class Room : public PObject
86  {
89  public:
90  Room(C2S::StreamHandler * handler,
91  const JID& jid,
92  const PString& nick);
93 
94  const User& GetUser() const { return m_User; }
95  const Users& GetOtherUsers() const { return m_OtherUsers; }
96 
97  virtual PBoolean Enter();
98  virtual PBoolean Leave();
99  virtual PBoolean SendMessage(const PString& msg);
100  virtual PBoolean SendMessage(Message& msg);
101 
102  // Event methods
103  virtual void OnMessage(Message& msg);
104  virtual void OnRoomJoined();
105  virtual void OnRoomLeft();
106  virtual void OnUserAdded(User& user);
107  virtual void OnUserRemoved(User& user);
108  virtual void OnUserChanged(User& user);
109 
110  protected:
111  PDECLARE_SMART_NOTIFIER(C2S::StreamHandler, Room, OnSessionReleased);
112  PDECLARE_SMART_NOTIFIER(Message, Room, OnMessage);
113  PDECLARE_SMART_NOTIFIER(Presence, Room, OnPresence);
114 
119 
126  };
127 
128  } // namespace MUC
129 } // namespace XMPP
130 
131 
132 #endif // P_EXPAT
133 
134 #endif // PTLIB_XMPP_MUC_H
135 
136 // End of File ///////////////////////////////////////////////////////////////
const PCaselessString & NamespaceTag()
Definition: xmpp_muc.h:70
#define PDECLARE_SMART_NOTIFIER(notifier, notifiee, func)
Definition: notifier_ext.h:83
BareJID m_RoomJID
Definition: xmpp_muc.h:116
PSORTED_LIST(Users, User)
Comparison Compare(const PObject &obj) const
Compare the two objects and return their relative rank.
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
const Users & GetOtherUsers() const
Definition: xmpp_muc.h:95
Definition: xmpp_muc.h:65
PNotifierList m_UserAddedHandlers
Definition: xmpp_muc.h:123
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
Definition: xmpp_muc.h:74
This class is a variation of a string that ignores case.
Definition: pstring.h:1708
Definition: xmpp_muc.h:51
Definition: xmpp.h:59
PNotifierList m_RoomLeftHandlers
Definition: xmpp_muc.h:122
BOOL PBoolean
Definition: object.h:102
static const PCaselessString & NamespaceTag()
Definition: xmpp_muc.h:62
PString m_Nick
Definition: xmpp_muc.h:77
Definition: xmpp_muc.h:69
PNotifierList m_MessageHandlers
Definition: xmpp_muc.h:120
Affiliation m_Affiliation
Definition: xmpp_muc.h:79
Definition: xmpp_muc.h:64
Definition: xmpp_muc.h:72
The character string class.
Definition: pstring.h:108
Definition: xmpp.h:105
Definition: xmpp.h:311
Definition: xmpp.h:48
Definition: xmpp_muc.h:85
Users m_OtherUsers
Definition: xmpp_muc.h:118
This class handles the client side of a C2S (Client to Server) XMPP stream.
Definition: xmpp_c2s.h:81
PNotifierList m_UserRemovedHandlers
Definition: xmpp_muc.h:124
Definition: xmpp_muc.h:71
PNotifierList m_UserChangedHandlers
Definition: xmpp_muc.h:125
Role m_Role
Definition: xmpp_muc.h:78
Definition: xmpp_muc.h:63
const User & GetUser() const
Definition: xmpp_muc.h:94
Role
Definition: xmpp_muc.h:60
User m_User
Definition: xmpp_muc.h:117
#define PDECLARE_SMART_NOTIFIEE
Definition: notifier_ext.h:78
Affiliation
Definition: xmpp_muc.h:68
Definition: notifier_ext.h:102
Definition: xmpp_muc.h:61
Definition: xmpp.h:252
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PNotifierList m_RoomJoinedHandlers
Definition: xmpp_muc.h:121
C2S::StreamHandler * m_Handler
Definition: xmpp_muc.h:115
Definition: xmpp_muc.h:73