Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

xmpp_muc.h

Go to the documentation of this file.
00001 /* 00002 * xmpp_muc.h 00003 * 00004 * Extensible Messaging and Presence Protocol (XMPP) 00005 * JEP-0045 Multi-User Chat 00006 * 00007 * Portable Windows Library 00008 * 00009 * Copyright (c) 2004 Reitek S.p.A. 00010 * 00011 * The contents of this file are subject to the Mozilla Public License 00012 * Version 1.0 (the "License"); you may not use this file except in 00013 * compliance with the License. You may obtain a copy of the License at 00014 * http://www.mozilla.org/MPL/ 00015 * 00016 * Software distributed under the License is distributed on an "AS IS" 00017 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00018 * the License for the specific language governing rights and limitations 00019 * under the License. 00020 * 00021 * The Original Code is Portable Windows Library. 00022 * 00023 * The Initial Developer of the Original Code is Post Increment 00024 * 00025 * Contributor(s): ______________________________________. 00026 * 00027 * $Log: xmpp_muc.h,v $ 00028 * Revision 1.1 2004/05/09 07:23:46 rjongbloed 00029 * More work on XMPP, thanks Federico Pinna and Reitek S.p.A. 00030 * 00031 * 00032 */ 00033 00034 #ifndef _XMPP_MUC 00035 #define _XMPP_MUC 00036 00037 #ifdef P_USE_PRAGMA 00038 #pragma interface 00039 #endif 00040 00041 #include <ptclib/xmpp_c2s.h> 00042 00043 #if P_EXPAT 00044 00046 00047 namespace XMPP 00048 { 00049 namespace MUC 00050 { 00051 extern PString Namespace; 00052 00053 class User : public PObject 00054 { 00055 PCLASSINFO(User, PObject); 00056 public: 00057 static PString Namespace; 00058 00059 enum Role { 00060 None, 00061 Moderator, 00062 Participant, 00063 Visitor, 00064 Unknown = 999 00065 }; 00066 00067 enum Affiliation { 00068 None_a, 00069 Owner, 00070 Admin, 00071 Member, 00072 Outcast, 00073 Unknown_a = 999 00074 }; 00075 00076 PString m_Nick; 00077 Role m_Role; 00078 Affiliation m_Affiliation; 00079 00080 Comparison Compare(const PObject & obj) const; 00081 }; 00082 PSORTED_LIST(Users, User); 00083 00084 class Room : public PObject 00085 { 00086 PCLASSINFO(Room, PObject); 00087 PDECLARE_SMART_NOTIFIEE; 00088 public: 00089 Room(C2S::StreamHandler * handler, // The C2S stream handler 00090 const JID& jid, // The room's jid 00091 const PString& nick); // Our user in the room 00092 00093 const User& GetUser() const { return m_User; } 00094 const Users& GetOtherUsers() const { return m_OtherUsers; } 00095 00096 virtual BOOL Enter(); 00097 virtual BOOL Leave(); 00098 virtual BOOL SendMessage(const PString& msg); 00099 virtual BOOL SendMessage(Message& msg); 00100 00101 // Event methods 00102 virtual void OnMessage(Message& msg); 00103 virtual void OnRoomJoined(); 00104 virtual void OnRoomLeft(); 00105 virtual void OnUserAdded(User& user); 00106 virtual void OnUserRemoved(User& user); 00107 virtual void OnUserChanged(User& user); 00108 00109 protected: 00110 PDECLARE_SMART_NOTIFIER(C2S::StreamHandler, Room, OnSessionReleased); 00111 PDECLARE_SMART_NOTIFIER(Message, Room, OnMessage); 00112 PDECLARE_SMART_NOTIFIER(Presence, Room, OnPresence); 00113 00114 C2S::StreamHandler * m_Handler; 00115 BareJID m_RoomJID; 00116 User m_User; 00117 Users m_OtherUsers; 00118 00119 PNotifierList m_MessageHandlers; 00120 PNotifierList m_RoomJoinedHandlers; 00121 PNotifierList m_RoomLeftHandlers; 00122 PNotifierList m_UserAddedHandlers; 00123 PNotifierList m_UserRemovedHandlers; 00124 PNotifierList m_UserChangedHandlers; 00125 }; 00126 00127 } // namespace MUC 00128 } // namespace XMPP 00129 00130 00131 #endif // P_EXPAT 00132 00133 #endif // _XMPP_MUC 00134 00135 // End of File /////////////////////////////////////////////////////////////// 00136 00137 00138

Generated on Sat Jul 24 15:35:57 2004 for PWLib by doxygen 1.3.7