PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

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 * $Revision: 26296 $
28 * $Author: rjongbloed $
29 * $Date: 2011-08-11 15:58:50 +1000 (Thu, 11 Aug 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 {
61 None,
62 Moderator,
63 Participant,
64 Visitor,
65 Unknown = 999
66 };
67
68 enum Affiliation {
69 None_a,
70 Owner,
71 Admin,
72 Member,
73 Outcast,
74 Unknown_a = 999
75 };
76
77 PString m_Nick;
78 Role m_Role;
79 Affiliation m_Affiliation;
80
81 Comparison Compare(const PObject & obj) const;
82 };
83 PSORTED_LIST(Users, User);
84
85 class Room : public PObject, public PValidatedNotifierTarget
86 {
87 PCLASSINFO(Room, PObject);
88 public:
89 Room(C2S::StreamHandler * handler,
90 const JID& jid,
91 const PString& nick);
92
93 const User& GetUser() const { return m_User; }
94 const Users& GetOtherUsers() const { return m_OtherUsers; }
95
96 virtual PBoolean Enter();
97 virtual PBoolean Leave();
98 virtual PBoolean SendMessage(const PString& msg);
99 virtual PBoolean SendMessage(Message& msg);
100
101 // Event methods
102 virtual void OnMessage(Message& msg);
103 virtual void OnRoomJoined();
104 virtual void OnRoomLeft();
105 virtual void OnUserAdded(User& user);
106 virtual void OnUserRemoved(User& user);
107 virtual void OnUserChanged(User& user);
108
109 protected:
110 PDECLARE_VALIDATED_NOTIFIER(C2S::StreamHandler, Room, OnSessionReleased);
111 PDECLARE_VALIDATED_NOTIFIER(Message, Room, OnMessage);
112 PDECLARE_VALIDATED_NOTIFIER(Presence, Room, OnPresence);
113
114 C2S::StreamHandler * m_Handler;
115 BareJID m_RoomJID;
116 User m_User;
117 Users m_OtherUsers;
118
119 PNotifierList m_MessageHandlers;
120 PNotifierList m_RoomJoinedHandlers;
121 PNotifierList m_RoomLeftHandlers;
122 PNotifierList m_UserAddedHandlers;
123 PNotifierList m_UserRemovedHandlers;
124 PNotifierList m_UserChangedHandlers;
125 };
126
127 } // namespace MUC
128 } // namespace XMPP
129
130
131 #endif // P_EXPAT
132
133 #endif // PTLIB_XMPP_MUC_H
134
135 // End of File ///////////////////////////////////////////////////////////////