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

Generated on Fri Mar 7 06:25:03 2008 for PTLib by  doxygen 1.5.1