xmpp_muc.h
Go to the documentation of this file.
/*
* xmpp_muc.h
*
* Extensible Messaging and Presence Protocol (XMPP)
* JEP-0045 Multi-User Chat
*
* Portable Windows Library
*
* Copyright (c) 2004 Reitek S.p.A.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Post Increment
*
* Contributor(s): ______________________________________.
*
* $Revision: 25387 $
* $Author: rjongbloed $
* $Date: 2011-03-22 22:51:09 -0500 (Tue, 22 Mar 2011) $
*/
#ifndef PTLIB_XMPP_MUC_H
#define PTLIB_XMPP_MUC_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <ptclib/xmpp_c2s.h>
#if P_EXPAT
namespace XMPP
{
namespace MUC
{
extern const PCaselessString & NamespaceTag();
class User : public PObject
{
PCLASSINFO(User, PObject);
public:
User();
~User();
static const PCaselessString & NamespaceTag();
enum Role {
None,
Moderator,
Participant,
Visitor,
Unknown = 999
};
enum Affiliation {
None_a,
Owner,
Admin,
Member,
Outcast,
Unknown_a = 999
};
PString m_Nick;
Role m_Role;
Affiliation m_Affiliation;
Comparison Compare(const PObject & obj) const;
};
PSORTED_LIST(Users, User);
class Room : public PObject
{
PCLASSINFO(Room, PObject);
PDECLARE_SMART_NOTIFIEE;
public:
Room(C2S::StreamHandler * handler,
const JID& jid,
const PString& nick);
const User& GetUser() const { return m_User; }
const Users& GetOtherUsers() const { return m_OtherUsers; }
virtual PBoolean Enter();
virtual PBoolean Leave();
virtual PBoolean SendMessage(const PString& msg);
virtual PBoolean SendMessage(Message& msg);
// Event methods
virtual void OnMessage(Message& msg);
virtual void OnRoomJoined();
virtual void OnRoomLeft();
virtual void OnUserAdded(User& user);
virtual void OnUserRemoved(User& user);
virtual void OnUserChanged(User& user);
protected:
PDECLARE_SMART_NOTIFIER(C2S::StreamHandler, Room, OnSessionReleased);
PDECLARE_SMART_NOTIFIER(Message, Room, OnMessage);
PDECLARE_SMART_NOTIFIER(Presence, Room, OnPresence);
C2S::StreamHandler * m_Handler;
BareJID m_RoomJID;
User m_User;
Users m_OtherUsers;
PNotifierList m_MessageHandlers;
PNotifierList m_RoomJoinedHandlers;
PNotifierList m_RoomLeftHandlers;
PNotifierList m_UserAddedHandlers;
PNotifierList m_UserRemovedHandlers;
PNotifierList m_UserChangedHandlers;
};
} // namespace MUC
} // namespace XMPP
#endif // P_EXPAT
#endif // PTLIB_XMPP_MUC_H
// End of File ///////////////////////////////////////////////////////////////
XMPP::MUC::NamespaceTag
const PCaselessString & NamespaceTag()
XMPP::MUC::User::Owner
Definition: xmpp_muc.h:70
XMPP::MUC::Room::OnUserAdded
virtual void OnUserAdded(User &user)
XMPP::MUC::Room::m_RoomJID
BareJID m_RoomJID
Definition: xmpp_muc.h:116
XMPP::MUC::PSORTED_LIST
PSORTED_LIST(Users, User)
XMPP::MUC::User::~User
~User()
XMPP::MUC::Room::OnUserChanged
virtual void OnUserChanged(User &user)
XMPP::MUC::User::Unknown
Definition: xmpp_muc.h:65
XMPP::MUC::Room::m_UserAddedHandlers
PNotifierList m_UserAddedHandlers
Definition: xmpp_muc.h:123
PObject::Comparison
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
XMPP::MUC::User::Unknown_a
Definition: xmpp_muc.h:74
PCaselessString
This class is a variation of a string that ignores case.
Definition: pstring.h:1708
XMPP::MUC::User
Definition: xmpp_muc.h:51
XMPP::MUC::Room::OnMessage
virtual void OnMessage(Message &msg)
XMPP::MUC::Room::PDECLARE_SMART_NOTIFIER
PDECLARE_SMART_NOTIFIER(C2S::StreamHandler, Room, OnSessionReleased)
XMPP::MUC::Room::Room
Room(C2S::StreamHandler *handler, const JID &jid, const PString &nick)
Our user in the room.
XMPP::JID
Definition: xmpp.h:59
XMPP::MUC::Room::SendMessage
virtual PBoolean SendMessage(const PString &msg)
XMPP::MUC::Room::m_RoomLeftHandlers
PNotifierList m_RoomLeftHandlers
Definition: xmpp_muc.h:122
PBoolean
BOOL PBoolean
Definition: object.h:102
XMPP::MUC::User::NamespaceTag
static const PCaselessString & NamespaceTag()
XMPP::MUC::User::Moderator
Definition: xmpp_muc.h:62
XMPP::MUC::Room::OnRoomJoined
virtual void OnRoomJoined()
XMPP::MUC::User::Compare
Comparison Compare(const PObject &obj) const
Compare the two objects and return their relative rank.
XMPP::MUC::Room::Enter
virtual PBoolean Enter()
XMPP::MUC::User::m_Nick
PString m_Nick
Definition: xmpp_muc.h:77
XMPP::MUC::User::User
User()
XMPP::MUC::User::None_a
Definition: xmpp_muc.h:69
XMPP::MUC::Room::m_MessageHandlers
PNotifierList m_MessageHandlers
Definition: xmpp_muc.h:120
XMPP::MUC::Room::GetUser
const User & GetUser() const
Definition: xmpp_muc.h:94
XMPP::MUC::Room::OnRoomLeft
virtual void OnRoomLeft()
XMPP::MUC::Room::GetOtherUsers
const Users & GetOtherUsers() const
Definition: xmpp_muc.h:95
XMPP::MUC::User::m_Affiliation
Affiliation m_Affiliation
Definition: xmpp_muc.h:79
XMPP::MUC::User::Visitor
Definition: xmpp_muc.h:64
XMPP::MUC::User::Member
Definition: xmpp_muc.h:72
PString
The character string class.
Definition: pstring.h:108
XMPP::BareJID
Definition: xmpp.h:105
XMPP::Presence
Definition: xmpp.h:311
XMPP
Definition: xmpp.h:48
XMPP::MUC::Room
Definition: xmpp_muc.h:85
XMPP::MUC::Room::m_OtherUsers
Users m_OtherUsers
Definition: xmpp_muc.h:118
XMPP::C2S::StreamHandler
This class handles the client side of a C2S (Client to Server) XMPP stream.
Definition: xmpp_c2s.h:81
XMPP::MUC::Room::m_UserRemovedHandlers
PNotifierList m_UserRemovedHandlers
Definition: xmpp_muc.h:124
XMPP::MUC::User::Admin
Definition: xmpp_muc.h:71
XMPP::MUC::Room::m_UserChangedHandlers
PNotifierList m_UserChangedHandlers
Definition: xmpp_muc.h:125
XMPP::MUC::User::m_Role
Role m_Role
Definition: xmpp_muc.h:78
XMPP::MUC::User::Participant
Definition: xmpp_muc.h:63
XMPP::MUC::Room::OnUserRemoved
virtual void OnUserRemoved(User &user)
XMPP::MUC::User::Role
Role
Definition: xmpp_muc.h:60
XMPP::MUC::Room::Leave
virtual PBoolean Leave()
XMPP::MUC::Room::m_User
User m_User
Definition: xmpp_muc.h:117
xmpp_c2s.h
XMPP::MUC::User::Affiliation
Affiliation
Definition: xmpp_muc.h:68
PNotifierList
Definition: notifier_ext.h:102
XMPP::MUC::User::None
Definition: xmpp_muc.h:61
XMPP::Message
Definition: xmpp.h:252
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
XMPP::MUC::Room::m_RoomJoinedHandlers
PNotifierList m_RoomJoinedHandlers
Definition: xmpp_muc.h:121
XMPP::MUC::Room::m_Handler
C2S::StreamHandler * m_Handler
Definition: xmpp_muc.h:115
XMPP::MUC::User::Outcast
Definition: xmpp_muc.h:73