PWLib
1.10.10
|
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.3 2005/11/30 12:47:37 csoutheren 00029 * Removed tabs, reformatted some code, and changed tags for Doxygen 00030 * 00031 * Revision 1.2 2005/08/04 03:19:07 dereksmithies 00032 * Add xmpp_muc (XMPP multi user conference) to the compile process for unix. 00033 * Correct compile errors under unix. 00034 * 00035 * Revision 1.1 2004/05/09 07:23:46 rjongbloed 00036 * More work on XMPP, thanks Federico Pinna and Reitek S.p.A. 00037 * 00038 * 00039 */ 00040 00041 #ifndef _XMPP_MUC 00042 #define _XMPP_MUC 00043 00044 #ifdef P_USE_PRAGMA 00045 #pragma interface 00046 #endif 00047 00048 #include <ptclib/xmpp_c2s.h> 00049 00050 #if P_EXPAT 00051 00053 00054 namespace XMPP 00055 { 00056 namespace MUC 00057 { 00058 extern PString Namespace; 00059 00060 class User : public PObject 00061 { 00062 PCLASSINFO(User, PObject); 00063 public: 00064 User(); 00065 ~User(); 00066 00067 static PString Namespace; 00068 00069 enum Role { 00070 None, 00071 Moderator, 00072 Participant, 00073 Visitor, 00074 Unknown = 999 00075 }; 00076 00077 enum Affiliation { 00078 None_a, 00079 Owner, 00080 Admin, 00081 Member, 00082 Outcast, 00083 Unknown_a = 999 00084 }; 00085 00086 PString m_Nick; 00087 Role m_Role; 00088 Affiliation m_Affiliation; 00089 00090 Comparison Compare(const PObject & obj) const; 00091 }; 00092 PSORTED_LIST(Users, User); 00093 00094 class Room : public PObject 00095 { 00096 PCLASSINFO(Room, PObject); 00097 PDECLARE_SMART_NOTIFIEE; 00098 public: 00099 Room(C2S::StreamHandler * handler, 00100 const JID& jid, 00101 const PString& nick); 00102 00103 const User& GetUser() const { return m_User; } 00104 const Users& GetOtherUsers() const { return m_OtherUsers; } 00105 00106 virtual BOOL Enter(); 00107 virtual BOOL Leave(); 00108 virtual BOOL SendMessage(const PString& msg); 00109 virtual BOOL SendMessage(Message& msg); 00110 00111 // Event methods 00112 virtual void OnMessage(Message& msg); 00113 virtual void OnRoomJoined(); 00114 virtual void OnRoomLeft(); 00115 virtual void OnUserAdded(User& user); 00116 virtual void OnUserRemoved(User& user); 00117 virtual void OnUserChanged(User& user); 00118 00119 protected: 00120 PDECLARE_SMART_NOTIFIER(C2S::StreamHandler, Room, OnSessionReleased); 00121 PDECLARE_SMART_NOTIFIER(Message, Room, OnMessage); 00122 PDECLARE_SMART_NOTIFIER(Presence, Room, OnPresence); 00123 00124 C2S::StreamHandler * m_Handler; 00125 BareJID m_RoomJID; 00126 User m_User; 00127 Users m_OtherUsers; 00128 00129 PNotifierList m_MessageHandlers; 00130 PNotifierList m_RoomJoinedHandlers; 00131 PNotifierList m_RoomLeftHandlers; 00132 PNotifierList m_UserAddedHandlers; 00133 PNotifierList m_UserRemovedHandlers; 00134 PNotifierList m_UserChangedHandlers; 00135 }; 00136 00137 } // namespace MUC 00138 } // namespace XMPP 00139 00140 00141 #endif // P_EXPAT 00142 00143 #endif // _XMPP_MUC 00144 00145 // End of File /////////////////////////////////////////////////////////////// 00146 00147 00148