PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
28 #ifndef PTLIB_XMPP_MUC_H
29 #define PTLIB_XMPP_MUC_H
30 
31 #ifdef P_USE_PRAGMA
32 #pragma interface
33 #endif
34 
35 #include <ptclib/xmpp_c2s.h>
36 
37 #if P_EXPAT
38 
40 
41 namespace XMPP
42 {
43  namespace MUC
44  {
45  extern const PCaselessString & NamespaceTag();
46 
47  class User : public PObject
48  {
49  PCLASSINFO(User, PObject);
50  public:
51  User();
52  ~User();
53 
54  static const PCaselessString & NamespaceTag();
55 
56  enum Role {
61  Unknown = 999
62  };
63 
64  enum Affiliation {
70  Unknown_a = 999
71  };
72 
76 
77  Comparison Compare(const PObject & obj) const;
78  };
79  PSORTED_LIST(Users, User);
80 
81  class Room : public PObject, public PValidatedNotifierTarget
82  {
83  PCLASSINFO(Room, PObject);
84  public:
85  Room(C2S::StreamHandler * handler,
86  const JID& jid,
87  const PString& nick);
88 
89  const User& GetUser() const { return m_User; }
90  const Users& GetOtherUsers() const { return m_OtherUsers; }
91 
92  virtual PBoolean Enter();
93  virtual PBoolean Leave();
94  virtual PBoolean SendMessage(const PString& msg);
95  virtual PBoolean SendMessage(Message& msg);
96 
97  // Event methods
98  virtual void OnMessage(Message& msg);
99  virtual void OnRoomJoined();
100  virtual void OnRoomLeft();
101  virtual void OnUserAdded(User& user);
102  virtual void OnUserRemoved(User& user);
103  virtual void OnUserChanged(User& user);
104 
105  protected:
109 
114 
121  };
122 
123  } // namespace MUC
124 } // namespace XMPP
125 
126 
127 #endif // P_EXPAT
128 
129 #endif // PTLIB_XMPP_MUC_H
130 
131 // End of File ///////////////////////////////////////////////////////////////
const PCaselessString & NamespaceTag()
Definition: xmpp_muc.h:66
virtual void OnUserAdded(User &user)
BareJID m_RoomJID
Definition: xmpp_muc.h:111
PSORTED_LIST(Users, User)
Validated PNotifier class.
Definition: notifier_ext.h:56
virtual void OnUserChanged(User &user)
Definition: xmpp_muc.h:61
PNotifierList m_UserAddedHandlers
Definition: xmpp_muc.h:118
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:2251
Definition: xmpp_muc.h:70
This class is a variation of a string that ignores case.
Definition: pstring.h:2012
Definition: xmpp_muc.h:47
virtual void OnMessage(Message &msg)
Room(C2S::StreamHandler *handler, const JID &jid, const PString &nick)
Our user in the room.
Definition: xmpp.h:55
virtual PBoolean SendMessage(const PString &msg)
PNotifierList m_RoomLeftHandlers
Definition: xmpp_muc.h:117
static const PCaselessString & NamespaceTag()
Definition: xmpp_muc.h:58
virtual void OnRoomJoined()
Comparison Compare(const PObject &obj) const
Compare the two objects and return their relative rank.
virtual PBoolean Enter()
PString m_Nick
Definition: xmpp_muc.h:73
Definition: xmpp_muc.h:65
PNotifierList m_MessageHandlers
Definition: xmpp_muc.h:115
const User & GetUser() const
Definition: xmpp_muc.h:89
virtual void OnRoomLeft()
bool PBoolean
Definition: object.h:174
const Users & GetOtherUsers() const
Definition: xmpp_muc.h:90
Affiliation m_Affiliation
Definition: xmpp_muc.h:75
Definition: xmpp_muc.h:60
Definition: xmpp_muc.h:68
The character string class.
Definition: pstring.h:108
Definition: xmpp.h:101
PDECLARE_VALIDATED_NOTIFIER(C2S::StreamHandler, Room, OnSessionReleased)
Definition: xmpp.h:307
Definition: xmpp_muc.h:81
Users m_OtherUsers
Definition: xmpp_muc.h:113
This class handles the client side of a C2S (Client to Server) XMPP stream.
Definition: xmpp_c2s.h:77
PNotifierList m_UserRemovedHandlers
Definition: xmpp_muc.h:119
Definition: xmpp_muc.h:67
PNotifierList m_UserChangedHandlers
Definition: xmpp_muc.h:120
Role m_Role
Definition: xmpp_muc.h:74
Definition: xmpp_muc.h:59
virtual void OnUserRemoved(User &user)
Role
Definition: xmpp_muc.h:56
virtual PBoolean Leave()
User m_User
Definition: xmpp_muc.h:112
Affiliation
Definition: xmpp_muc.h:64
Definition: xmpp_muc.h:57
Definition: xmpp.h:250
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
PNotifierList m_RoomJoinedHandlers
Definition: xmpp_muc.h:116
C2S::StreamHandler * m_Handler
Definition: xmpp_muc.h:110
Definition: xmpp_muc.h:69