PTLib  Version 2.10.10
 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: 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  {
87  PCLASSINFO(Room, PObject);
88  PDECLARE_SMART_NOTIFIEE;
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);
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 ///////////////////////////////////////////////////////////////