PTLib  Version 2.14.3
 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 {
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, 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:
113 
118 
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 ///////////////////////////////////////////////////////////////