mucroom.cpp
/*
Copyright (c) 2006-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#include "mucroom.h"
#include "clientbase.h"
#include "dataform.h"
#include "presence.h"
#include "disco.h"
#include "mucmessagesession.h"
#include "message.h"
#include "error.h"
#include "util.h"
#include "tag.h"
namespace gloox
{
// ---- MUCRoom::MUCAdmin ----
/* Error type values */
static const char* affiliationValues [] = {
"none",
"outcast",
"member",
"owner",
"admin"
};
/* Stanza error values */
static const char* roleValues [] = {
"none",
"visitor",
"participant",
"moderator",
};
const char* historyTypeValues[] =
{
"maxchars", "maxstanzas", "seconds", "since"
};
static inline MUCRoomAffiliation affiliationType( const std::string& type )
{
return static_cast<MUCRoomAffiliation>( util::lookup( type, affiliationValues ) );
}
static inline MUCRoomRole roleType( const std::string& type )
{
return static_cast<MUCRoomRole>( util::lookup( type, roleValues ) );
}
MUCRoom::MUCAdmin::MUCAdmin( MUCRoomRole role, const std::string& nick,
const std::string& reason )
: StanzaExtension( ExtMUCAdmin ), m_affiliation( AffiliationInvalid ), m_role( role )
{
m_list.push_back( MUCListItem( nick, role, reason ) );
}
MUCRoom::MUCAdmin::MUCAdmin( MUCRoomAffiliation affiliation, const std::string& nick,
const std::string& reason )
: StanzaExtension( ExtMUCAdmin ), m_affiliation( affiliation ), m_role( RoleInvalid )
{
m_list.push_back( MUCListItem( nick, affiliation, reason ) );
}
MUCRoom::MUCAdmin::MUCAdmin( MUCOperation operation, const MUCListItemList& jids )
: StanzaExtension( ExtMUCAdmin ), m_list( jids ), m_affiliation( AffiliationInvalid ),
m_role( RoleInvalid )
{
switch( operation )
{
case StoreVoiceList:
case RequestVoiceList:
m_role = RoleParticipant;
break;
case StoreModeratorList:
case RequestModeratorList:
m_role = RoleModerator;
break;
case StoreBanList:
case RequestBanList:
m_affiliation = AffiliationOutcast;
break;
case StoreMemberList:
case RequestMemberList:
m_affiliation = AffiliationMember;
break;
case StoreOwnerList:
case RequestOwnerList:
m_affiliation = AffiliationOwner;
break;
case StoreAdminList:
case RequestAdminList:
m_affiliation = AffiliationAdmin;
break;
default:
return;
break;
}
if( m_list.empty() )
m_list.push_back( MUCListItem( JID() ) );
}
MUCRoom::MUCAdmin::MUCAdmin( const Tag* tag )
: StanzaExtension( ExtMUCAdmin ), m_affiliation( AffiliationInvalid ), m_role( RoleInvalid )
{
if( !tag || tag->name() != "query" || tag->xmlns() != XMLNS_MUC_ADMIN )
return;
const TagList& items = tag->findChildren( "item" );
TagList::const_iterator it = items.begin();
for( ; it != items.end(); ++it )
{
m_list.push_back( MUCListItem( JID( (*it)->findAttribute( "jid" ) ),
roleType( (*it)->findAttribute( "role" ) ),
affiliationType( (*it)->findAttribute( "affiliation" ) ),
(*it)->findAttribute( "nick" ) ) );
if( m_role == RoleInvalid )
m_role = roleType( (*it)->findAttribute( "role" ) );
if( m_affiliation == AffiliationInvalid )
m_affiliation = affiliationType( (*it)->findAttribute( "affiliation" ) );
}
}
MUCRoom::MUCAdmin::~MUCAdmin()
{
}
const std::string& MUCRoom::MUCAdmin::filterString() const
{
static const std::string filter = "/iq/query[@xmlns='" + XMLNS_MUC_ADMIN + "']";
return filter;
}
Tag* MUCRoom::MUCAdmin::tag() const
{
Tag* t = new Tag( "query" );
t->setXmlns( XMLNS_MUC_ADMIN );
if( m_list.empty() || ( m_affiliation == AffiliationInvalid && m_role == RoleInvalid ) )
return t;
MUCListItemList::const_iterator it = m_list.begin();
for( ; it != m_list.end(); ++it )
{
Tag* i = new Tag( t, "item" );
if( (*it).jid() )
i->addAttribute( "jid", (*it).jid().bare() );
if( !(*it).nick().empty() )
i->addAttribute( "nick", (*it).nick() );
MUCRoomRole rol = RoleInvalid;
if( (*it).role() != RoleInvalid )
rol = (*it).role();
else if( m_role != RoleInvalid )
rol = m_role;
if( rol != RoleInvalid )
i->addAttribute( "role", util::lookup( rol, roleValues ) );
MUCRoomAffiliation aff = AffiliationInvalid;
if( (*it).affiliation() != AffiliationInvalid )
aff = (*it).affiliation();
else if( m_affiliation != AffiliationInvalid )
aff = m_affiliation;
if( aff != AffiliationInvalid )
i->addAttribute( "affiliation", util::lookup( aff, affiliationValues ) );
if( !(*it).reason().empty() )
new Tag( i, "reason", (*it).reason() );
}
return t;
}
// ---- ~MUCRoom::MUCAdmin ----
// ---- MUCRoom::MUCOwner ----
MUCRoom::MUCOwner::MUCOwner( QueryType type, DataForm* form )
: StanzaExtension( ExtMUCOwner ), m_type( type ), m_form( form )
{
m_valid = true;
if( m_form )
return;
switch( type )
{
case TypeCancelConfig:
m_form = new DataForm( TypeCancel );
break;
case TypeInstantRoom:
m_form = new DataForm( TypeSubmit );
break;
default:
break;
}
}
MUCRoom::MUCOwner::MUCOwner( const JID& alternate, const std::string& reason,
const std::string& password )
: StanzaExtension( ExtMUCOwner ), m_type( TypeDestroy ), m_jid( alternate ),
m_reason( reason ), m_pwd( password ), m_form( 0 )
{
m_valid = true;
}
MUCRoom::MUCOwner::MUCOwner( const Tag* tag )
: StanzaExtension( ExtMUCOwner ), m_type( TypeIncomingTag ), m_form( 0 )
{
if( !tag || tag->name() != "query" || tag->xmlns() != XMLNS_MUC_OWNER )
return;
const TagList& l = tag->children();
TagList::const_iterator it = l.begin();
for( ; it != l.end(); ++it )
{
const std::string& name = (*it)->name();
if( name == "x" && (*it)->xmlns() == XMLNS_X_DATA )
{
m_form = new DataForm( (*it) );
break;
}
else if( name == "destroy" )
{
m_type = TypeDestroy;
m_jid = (*it)->findAttribute( "jid" );
m_pwd = (*it)->findCData( "/query/destroy/password" );
m_reason = (*it)->findCData( "/query/destroy/reason" );
break;
}
}
m_valid = true;
}
MUCRoom::MUCOwner::~MUCOwner()
{
delete m_form;
}
const std::string& MUCRoom::MUCOwner::filterString() const
{
static const std::string filter = "/iq/query[@xmlns='" + XMLNS_MUC_OWNER + "']";
return filter;
}
Tag* MUCRoom::MUCOwner::tag() const
{
if( !m_valid )
return 0;
Tag* t = new Tag( "query" );
t->setXmlns( XMLNS_MUC_OWNER );
switch( m_type )
{
case TypeInstantRoom:
case TypeSendConfig:
case TypeCancelConfig:
case TypeIncomingTag:
if( m_form )
t->addChild( m_form->tag() );
break;
case TypeDestroy:
{
Tag* d = new Tag( t, "destroy" );
if( m_jid )
d->addAttribute( "jid", m_jid.bare() );
if( !m_reason.empty() )
new Tag( d, "reason", m_reason );
if( !m_pwd.empty() )
new Tag( d, "password", m_pwd );
break;
}
case TypeRequestConfig:
case TypeCreate:
default:
break;
}
return t;
}
// ---- ~MUCRoom::MUCOwner ----
// ---- MUCRoom::MUCUser ----
MUCRoom::MUCUser::MUCUser( MUCUserOperation operation, const std::string& to,
const std::string& reason, const std::string& thread )
: StanzaExtension( ExtMUCUser ), m_affiliation( AffiliationInvalid ), m_role( RoleInvalid ),
m_jid( new std::string( to ) ), m_actor( 0 ),
m_thread( thread.empty() ? 0 : new std::string( thread ) ),
m_reason( new std::string( reason ) ), m_newNick( 0 ), m_password( 0 ), m_alternate( 0 ),
m_operation( operation ),
m_flags( 0 ), m_del( false ), m_continue( !thread.empty() )
{
}
MUCRoom::MUCUser::MUCUser( const Tag* tag )
: StanzaExtension( ExtMUCUser ), m_affiliation( AffiliationInvalid ), m_role( RoleInvalid ),
m_jid( 0 ), m_actor( 0 ), m_thread( 0 ), m_reason( 0 ), m_newNick( 0 ),
m_password( 0 ), m_alternate( 0 ), m_operation( OpNone ),
m_flags( 0 ), m_del( false ), m_continue( false )
{
if( !tag || tag->name() != "x" || tag->xmlns() != XMLNS_MUC_USER )
return;
const Tag* t = 0;
const TagList& l = tag->children();
TagList::const_iterator it = l.begin();
for( ; it != l.end(); ++it )
{
if( (*it)->name() == "item" )
{
m_affiliation = getEnumAffiliation( (*it)->findAttribute( "affiliation" ) );
m_role = getEnumRole( (*it)->findAttribute( "role" ) );
if( (*it)->hasAttribute( "jid" ) )
m_jid = new std::string( (*it)->findAttribute( "jid" ) );
if( ( t = (*it)->findChild( "actor" ) ) )
m_actor = new std::string( t->findAttribute( "jid" ) );
if( ( t = (*it)->findChild( "reason" ) ) )
m_reason = new std::string( t->cdata() );
if( (*it)->hasAttribute( "nick" ) )
m_newNick = new std::string( (*it)->findAttribute( "nick" ) );
}
else if( (*it)->name() == "status" )
{
const std::string& code = (*it)->findAttribute( "code" );
if( code == "100" )
m_flags |= FlagNonAnonymous;
else if( code == "101" )
m_flags |= UserAffiliationChangedWNR;
else if( code == "110" )
m_flags |= UserSelf;
else if( code == "170" )
m_flags |= FlagPublicLogging;
else if( code == "201" )
m_flags |= UserNewRoom;
else if( code == "210" )
m_flags |= UserNickAssigned;
else if( code == "301" )
m_flags |= UserBanned;
else if( code == "303" )
m_flags |= UserNickChanged;
else if( code == "307" )
m_flags |= UserKicked;
else if( code == "321" )
m_flags |= UserAffiliationChanged;
else if( code == "322" )
m_flags |= UserMembershipRequired;
else if( code == "332" )
m_flags |= UserRoomShutdown;
}
else if( (*it)->name() == "destroy" )
{
m_del = true;
if( (*it)->hasAttribute( "jid" ) )
m_alternate = new std::string( (*it)->findAttribute( "jid" ) );
if( ( t = (*it)->findChild( "reason" ) ) )
m_reason = new std::string( t->cdata() );
m_flags |= UserRoomDestroyed;
}
else if( (*it)->name() == "invite" )
{
m_operation = OpInviteFrom;
m_jid = new std::string( (*it)->findAttribute( "from" ) );
if( m_jid->empty() )
{
m_operation = OpInviteTo;
m_jid->assign( (*it)->findAttribute( "to" ) );
}
if( (*it)->hasChild( "reason" ) )
m_reason = new std::string( (*it)->findChild( "reason" )->cdata() );
if( (*it)->hasChild( "continue" ) )
{
m_continue = true;
m_thread = new std::string( (*it)->findChild( "continue" )->findAttribute( "thread" ) );
}
}
else if( (*it)->name() == "decline" )
{
m_operation = OpDeclineFrom;
m_jid = new std::string( (*it)->findAttribute( "from" ) );
if( m_jid->empty() )
{
m_operation = OpDeclineTo;
m_jid->assign( (*it)->findAttribute( "from" ) );
}
if( (*it)->hasChild( "reason" ) )
m_reason = new std::string( (*it)->findChild( "reason" )->cdata() );
}
else if( (*it)->name() == "password" )
{
m_password = new std::string( (*it)->cdata() );
}
}
}
MUCRoom::MUCUser::~MUCUser()
{
delete m_jid;
delete m_actor;
delete m_thread;
delete m_reason;
delete m_newNick;
delete m_password;
delete m_alternate;
}
MUCRoomRole MUCRoom::MUCUser::getEnumRole( const std::string& role )
{
if( role == "moderator" )
return RoleModerator;
if( role == "participant" )
return RoleParticipant;
if( role == "visitor" )
return RoleVisitor;
return RoleNone;
}
MUCRoomAffiliation MUCRoom::MUCUser::getEnumAffiliation( const std::string& affiliation )
{
if( affiliation == "owner" )
return AffiliationOwner;
if( affiliation == "admin" )
return AffiliationAdmin;
if( affiliation == "member" )
return AffiliationMember;
if( affiliation == "outcast" )
return AffiliationOutcast;
return AffiliationNone;
}
const std::string& MUCRoom::MUCUser::filterString() const
{
static const std::string filter = "/presence/x[@xmlns='" + XMLNS_MUC_USER + "']"
"|/message/x[@xmlns='" + XMLNS_MUC_USER + "']";
return filter;
}
Tag* MUCRoom::MUCUser::tag() const
{
Tag* t = new Tag( "x" );
t->setXmlns( XMLNS_MUC_USER );
if( m_affiliation != AffiliationInvalid || m_role != RoleInvalid )
{
Tag* i = new Tag( t, "item" );
if( m_jid )
i->addAttribute( "jid", *m_jid );
if( m_role != RoleInvalid )
i->addAttribute( "role", util::lookup( m_role, roleValues ) );
if( m_affiliation != AffiliationInvalid )
i->addAttribute( "affiliation", util::lookup( m_affiliation, affiliationValues ) );
if( m_actor )
new Tag( i, "actor", "jid", *m_actor );
if( m_reason )
new Tag( i, "reason", *m_reason );
if( m_flags & FlagNonAnonymous )
new Tag( t, "status", "code", "100" );
if( m_flags & UserAffiliationChangedWNR )
new Tag( t, "status", "code", "101" );
if( m_flags & UserSelf )
new Tag( t, "status", "code", "110" );
if( m_flags & FlagPublicLogging )
new Tag( t, "status", "code", "170" );
if( m_flags & UserNewRoom )
new Tag( t, "status", "code", "201" );
if( m_flags & UserNickAssigned )
new Tag( t, "status", "code", "210" );
if( m_flags & UserBanned )
new Tag( t, "status", "code", "301" );
if( m_flags & UserNickChanged )
new Tag( t, "status", "code", "303" );
if( m_flags & UserKicked )
new Tag( t, "status", "code", "307" );
if( m_flags & UserAffiliationChanged )
new Tag( t, "status", "code", "321" );
if( m_flags & UserMembershipRequired )
new Tag( t, "status", "code", "322" );
if( m_flags & UserRoomShutdown )
new Tag( t, "status", "code", "332" );
}
else if( m_del )
{
Tag* d = new Tag( t, "destroy" );
if( m_alternate )
d->addAttribute( "jid", *m_alternate );
if( m_reason )
new Tag( d, "reason", *m_reason );
}
else if( m_operation != OpNone && m_jid )
{
Tag* d = 0;
if( m_operation == OpInviteTo )
d = new Tag( t, "invite", "to", *m_jid );
else if( m_operation == OpInviteFrom )
d = new Tag( t, "invite", "from", *m_jid );
else if( m_operation == OpDeclineTo )
d = new Tag( t, "decline", "to", *m_jid );
else if( m_operation == OpDeclineFrom )
d = new Tag( t, "decline", "from", *m_jid );
if( m_reason )
new Tag( d, "reason", *m_reason );
if( m_continue )
{
Tag* c = new Tag( d, "continue" );
if( m_thread )
c->addAttribute( "thread", *m_thread );
}
if( m_password )
new Tag( t, "password", *m_password );
}
return t;
}
// ---- ~MUCRoom::MUCUser ----
// ---- MUCRoom::MUC ----
MUCRoom::MUC::MUC( const std::string& password,
MUCRoom::HistoryRequestType historyType,
const std::string& historySince,
int historyValue )
: StanzaExtension( ExtMUC ),
m_password( password.empty() ? 0 : new std::string( password ) ),
m_historySince( new std::string( historySince ) ),
m_historyType( historyType ), m_historyValue( historyValue )
{
}
MUCRoom::MUC::MUC( const Tag* tag )
: StanzaExtension( ExtMUC ),
m_password( 0 ), m_historySince( 0 ),
m_historyType( HistoryUnknown ), m_historyValue( 0 )
{
if( !tag || tag->name() != "x" || tag->xmlns() != XMLNS_MUC_USER )
return;
const TagList& l = tag->children();
TagList::const_iterator it = l.begin();
for( ; it != l.end(); ++it )
{
if( (*it)->name() == "history" )
{
if( (*it)->hasAttribute( "seconds" ) )
m_historyValue = atoi( (*it)->findAttribute( "seconds" ).c_str() );
else if( (*it)->hasAttribute( "maxstanzas" ) )
m_historyValue = atoi( (*it)->findAttribute( "maxstanzas" ).c_str() );
else if( (*it)->hasAttribute( "maxchars" ) )
m_historyValue = atoi( (*it)->findAttribute( "maxchars" ).c_str() );
else if( (*it)->hasAttribute( "since" ) )
m_historySince = new std::string( (*it)->findAttribute( "since" ) );
}
else if( (*it)->name() == "password" )
{
m_password = new std::string( (*it)->cdata() );
}
}
}
MUCRoom::MUC::~MUC()
{
delete m_password;
delete m_historySince;
}
const std::string& MUCRoom::MUC::filterString() const
{
static const std::string filter = "/presence/x[@xmlns='" + XMLNS_MUC + "']";
return filter;
}
Tag* MUCRoom::MUC::tag() const
{
Tag* t = new Tag( "x" );
t->setXmlns( XMLNS_MUC );
if( m_historyType != HistoryUnknown )
{
const std::string& histStr = util::lookup( m_historyType, historyTypeValues );
Tag* h = new Tag( t, "history" );
if( m_historyType == HistorySince && m_historySince )
h->addAttribute( histStr, *m_historySince );
else
h->addAttribute( histStr, m_historyValue );
}
if( m_password )
new Tag( t, "password", *m_password );
return t;
}
// ---- ~MUCRoom::MUC ----
// --- MUCRoom ----
MUCRoom::MUCRoom( ClientBase* parent, const JID& nick, MUCRoomHandler* mrh,
MUCRoomConfigHandler* mrch )
: m_parent( parent ), m_nick( nick ), m_joined( false ), m_roomHandler( mrh ),
m_roomConfigHandler( mrch ), m_session( 0 ), m_affiliation( AffiliationNone ),
m_role( RoleNone ), m_historyType( HistoryUnknown ), m_historyValue( 0 ),
m_flags( 0 ), m_creationInProgress( false ), m_configChanged( false ),
m_publishNick( false ), m_publish( false ), m_unique( false )
{
if( m_parent )
{
m_parent->registerStanzaExtension( new MUCAdmin() );
m_parent->registerStanzaExtension( new MUCOwner() );
m_parent->registerStanzaExtension( new MUCUser() );
m_parent->registerStanzaExtension( new MUC() );
m_parent->registerStanzaExtension( new DelayedDelivery() );
}
}
MUCRoom::~MUCRoom()
{
if( m_joined )
leave();
if( m_parent )
{
if( m_publish )
m_parent->disco()->removeNodeHandler( this, XMLNS_MUC_ROOMS );
m_parent->removeIDHandler( this );
// m_parent->removeStanzaExtension( ExtMUCAdmin ); // don't remove, other rooms might need it
// m_parent->removeStanzaExtension( ExtMUCOwner );
m_parent->removePresenceHandler( m_nick.bareJID(), this );
m_parent->disco()->removeDiscoHandler( this );
}
}
void MUCRoom::join( Presence::PresenceType type, const std::string& status, int priority )
{
if( m_joined || !m_parent )
return;
m_parent->registerPresenceHandler( m_nick.bareJID(), this );
m_session = new MUCMessageSession( m_parent, m_nick.bareJID() );
m_session->registerMessageHandler( this );
Presence pres( type, m_nick.full(), status, priority );
pres.addExtension( new MUC( m_password, m_historyType, m_historySince, m_historyValue ) );
m_joined = true;
m_parent->send( pres );
}
void MUCRoom::leave( const std::string& msg )
{
if( !m_joined )
return;
if( m_parent )
{
Presence pres( Presence::Unavailable, m_nick.full(), msg );
m_parent->send( pres );
m_parent->removePresenceHandler( m_nick.bareJID(), this );
m_parent->disposeMessageSession( m_session );
}
m_session = 0;
m_joined = false;
}
void MUCRoom::destroy( const std::string& reason, const JID& alternate, const std::string& password )
{
if( !m_parent )
return;
const std::string& id = m_parent->getID();
IQ iq( IQ::Set, m_nick.bareJID(), id );
iq.addExtension( new MUCOwner( alternate, reason, password ) );
m_parent->send( iq, this, DestroyRoom );
}
void MUCRoom::send( const std::string& message )
{
if( m_session && m_joined )
m_session->send( message );
}
void MUCRoom::send( const std::string& message, const std::string& subject, const StanzaExtensionList& sel )
{
if( m_session && m_joined )
m_session->send( message, subject, sel );
}
void MUCRoom::setSubject( const std::string& subject )
{
if( m_session && m_joined )
m_session->setSubject( subject );
}
void MUCRoom::setNick( const std::string& nick )
{
if( m_parent && m_joined )
{
m_newNick = nick;
Presence p( Presence::Available, m_nick.bare() + "/" + m_newNick );
m_parent->send( p );
}
else
m_nick.setResource( nick );
}
void MUCRoom::getRoomInfo()
{
if( m_parent )
m_parent->disco()->getDiscoInfo( m_nick.bare(), EmptyString, this, GetRoomInfo );
}
void MUCRoom::getRoomItems()
{
if( m_parent )
m_parent->disco()->getDiscoItems( m_nick.bare(), EmptyString, this, GetRoomItems );
}
void MUCRoom::setPresence( Presence::PresenceType presence, const std::string& msg )
{
if( m_parent && presence != Presence::Unavailable && m_joined )
{
Presence p( presence, m_nick.full(), msg );
m_parent->send( p );
}
}
void MUCRoom::invite( const JID& invitee, const std::string& reason, const std::string& thread )
{
if( !m_parent || !m_joined )
return;
Message msg( Message::Normal, m_nick.bareJID() );
msg.addExtension( new MUCUser( OpInviteTo, invitee.bare(), reason, thread ) );
m_parent->send( msg );
}
Message* MUCRoom::declineInvitation( const JID& room, const JID& invitor, const std::string& reason )
{
Message* msg = new Message( Message::Normal, room.bare() );
msg->addExtension( new MUCUser( OpDeclineTo, invitor.bare(), reason ) );
return msg;
}
void MUCRoom::setPublish( bool publish, bool publishNick )
{
m_publish = publish;
m_publishNick = publishNick;
if( !m_parent )
return;
if( m_publish )
m_parent->disco()->registerNodeHandler( this, XMLNS_MUC_ROOMS );
else
m_parent->disco()->removeNodeHandler( this, XMLNS_MUC_ROOMS );
}
void MUCRoom::addHistory( const std::string& message, const JID& from, const std::string& stamp )
{
if( !m_joined || !m_parent )
return;
Message m( Message::Groupchat, m_nick.bareJID(), message );
m.addExtension( new DelayedDelivery( from, stamp ) );
m_parent->send( m );
}
void MUCRoom::setRequestHistory( int value, MUCRoom::HistoryRequestType type )
{
m_historyType = type;
m_historySince = EmptyString;
m_historyValue = value;
}
void MUCRoom::setRequestHistory( const std::string& since )
{
m_historyType = HistorySince;
m_historySince = since;
m_historyValue = 0;
}
Message* MUCRoom::createDataForm( const JID& room, const DataForm* df )
{
Message* m = new Message( Message::Normal, room.bare() );
m->addExtension( df );
return m;
}
void MUCRoom::requestVoice()
{
if( !m_parent || !m_joined )
return;
DataForm* df = new DataForm( TypeSubmit );
df->addField( DataFormField::TypeNone, "FORM_TYPE", XMLNS_MUC_REQUEST );
df->addField( DataFormField::TypeTextSingle, "muc#role", "participant", "Requested role" );
Message m( Message::Normal, m_nick.bare() );
m.addExtension( df );
m_parent->send( m );
}
void MUCRoom::setRole( const std::string& nick, MUCRoomRole role,
const std::string& reason )
{
if( !m_parent || !m_joined || nick.empty() || role == RoleInvalid )
return;
MUCOperation action = InvalidOperation;
switch( role )
{
case RoleNone:
action = SetRNone;
break;
case RoleVisitor:
action = SetVisitor;
break;
case RoleParticipant:
action = SetParticipant;
break;
case RoleModerator:
action = SetModerator;
break;
default:
break;
}
IQ iq( IQ::Set, m_nick.bareJID() );
iq.addExtension( new MUCAdmin( role, nick, reason ) );
m_parent->send( iq, this, action );
}
void MUCRoom::setAffiliation( const std::string& nick, MUCRoomAffiliation affiliation,
const std::string& reason )
{
if( !m_parent || !m_joined || nick.empty() || affiliation == AffiliationInvalid )
return;
MUCOperation action = InvalidOperation;
switch( affiliation )
{
case AffiliationOutcast:
action = SetOutcast;
break;
case AffiliationNone:
action = SetANone;
break;
case AffiliationMember:
action = SetMember;
break;
case AffiliationAdmin:
action = SetAdmin;
break;
case AffiliationOwner:
action = SetOwner;
break;
default:
break;
}
IQ iq( IQ::Set, m_nick.bareJID() );
iq.addExtension( new MUCAdmin( affiliation, nick, reason ) );
m_parent->send( iq, this, action );
}
void MUCRoom::requestList( MUCOperation operation )
{
if( !m_parent || !m_joined || !m_roomConfigHandler )
return;
IQ iq( IQ::Get, m_nick.bareJID() );
iq.addExtension( new MUCAdmin( operation ) );
m_parent->send( iq, this, operation );
}
void MUCRoom::storeList( const MUCListItemList items, MUCOperation operation )
{
if( !m_parent || !m_joined )
return;
IQ iq( IQ::Set, m_nick.bareJID() );
iq.addExtension( new MUCAdmin( operation , items ) );
m_parent->send( iq, this, operation );
}
void MUCRoom::handlePresence( const Presence& presence )
{
if( ( presence.from().bare() != m_nick.bare() ) || !m_roomHandler )
return;
if( presence.subtype() == Presence::Error )
{
if( m_newNick.empty() )
{
m_parent->removePresenceHandler( m_nick.bareJID(), this );
m_parent->disposeMessageSession( m_session );
m_joined = false;
m_session = 0;
}
else
m_newNick = "";
m_roomHandler->handleMUCError( this, presence.error()
? presence.error()->error()
: StanzaErrorUndefined );
}
else
{
const MUCUser* mu = presence.findExtension<MUCUser>( ExtMUCUser );
if( !mu )
return;
MUCRoomParticipant party;
party.nick = new JID( presence.from() );
party.status = presence.status();
party.affiliation = mu->affiliation();
party.role = mu->role();
party.jid = mu->jid() ? new JID( *(mu->jid()) ) : 0;
party.actor = mu->actor() ? new JID( *(mu->actor()) ) : 0;
party.reason = mu->reason() ? *(mu->reason()) : EmptyString;
party.newNick = mu->newNick() ? *(mu->newNick()) : EmptyString;
party.alternate = mu->alternate() ? new JID( *(mu->alternate()) ) : 0;
party.flags = mu->flags();
if( party.flags & FlagNonAnonymous )
setNonAnonymous();
if( party.flags & UserSelf )
{
m_role = party.role;
m_affiliation = party.affiliation;
}
if( party.flags & UserNewRoom )
{
m_creationInProgress = true;
if( instantRoomHook() || m_roomHandler->handleMUCRoomCreation( this ) )
acknowledgeInstantRoom();
}
if( party.flags & UserNickAssigned )
m_nick.setResource( presence.from().resource() );
if( party.flags & UserNickChanged && !party.newNick.empty()
&& m_nick.resource() == presence.from().resource()
&& party.newNick == m_newNick )
party.flags |= UserSelf;
if( party.flags & UserNickChanged && party.flags & UserSelf && !party.newNick.empty() )
m_nick.setResource( party.newNick );
if( m_roomHandler )
m_roomHandler->handleMUCParticipantPresence( this, party, presence );
delete party.nick;
delete party.jid;
delete party.actor;
delete party.alternate;
}
}
void MUCRoom::instantRoom( int context )
{
if( !m_creationInProgress || !m_parent || !m_joined )
return;
IQ iq( IQ::Set, m_nick.bareJID() );
iq.addExtension( new MUCOwner( context == CreateInstantRoom
? MUCOwner::TypeInstantRoom : MUCOwner::TypeCancelConfig ) );
m_parent->send( iq, this, context );
m_creationInProgress = false;
}
void MUCRoom::requestRoomConfig()
{
if( !m_parent || !m_joined )
return;
IQ iq( IQ::Get, m_nick.bareJID() );
iq.addExtension( new MUCOwner( MUCOwner::TypeRequestConfig ) );
m_parent->send( iq, this, RequestRoomConfig );
if( m_creationInProgress )
m_creationInProgress = false;
}
void MUCRoom::setRoomConfig( DataForm* form )
{
if( !m_parent || !m_joined )
return;
IQ iq( IQ::Set, m_nick.bareJID() );
iq.addExtension( new MUCOwner( MUCOwner::TypeSendConfig, form ) );
m_parent->send( iq, this, SendRoomConfig );
}
void MUCRoom::setNonAnonymous()
{
m_flags |= FlagNonAnonymous;
m_flags &= ~( FlagSemiAnonymous | FlagFullyAnonymous );
}
void MUCRoom::setSemiAnonymous()
{
m_flags &= ~( FlagNonAnonymous | FlagFullyAnonymous );
m_flags |= FlagSemiAnonymous;
}
void MUCRoom::setFullyAnonymous()
{
m_flags &= ~( FlagNonAnonymous | FlagSemiAnonymous );
m_flags |= FlagFullyAnonymous;
}
void MUCRoom::handleMessage( const Message& msg, MessageSession* /*session*/ )
{
if( !m_roomHandler )
return;
if( msg.subtype() == Message::Error )
{
m_roomHandler->handleMUCError( this, msg.error() ? msg.error()->error() : StanzaErrorUndefined );
}
else
{
const MUCUser* mu = msg.findExtension<MUCUser>( ExtMUCUser );
if( mu )
{
const int flags = mu->flags();
if( flags & FlagNonAnonymous )
setNonAnonymous();
if( flags & FlagPublicLogging )
{
m_flags &= ~FlagPublicLoggingOff;
m_flags |= FlagPublicLogging;
}
if( flags & FlagPublicLoggingOff )
{
m_flags &= ~FlagPublicLogging;
m_flags |= FlagPublicLoggingOff;
}
if( flags & FlagSemiAnonymous )
setSemiAnonymous();
if( flags & FlagFullyAnonymous )
setFullyAnonymous();
if( mu->operation() == OpDeclineFrom && mu->jid() )
m_roomHandler->handleMUCInviteDecline( this, JID( *(mu->jid()) ),
mu->reason() ? *(mu->reason()) : EmptyString );
}
const DataForm* df = msg.findExtension<DataForm>( ExtDataForm );
if( m_roomConfigHandler && df )
{
m_roomConfigHandler->handleMUCRequest( this, *df );
return;
}
if( !msg.subject().empty() )
{
m_roomHandler->handleMUCSubject( this, msg.from().resource(), msg.subject() );
}
else if( !msg.body().empty() || !msg.extensions().empty() )
{
std::string when;
bool privMsg = false;
if( msg.when() )
when = msg.when()->stamp();
if( msg.subtype() & ( Message::Chat | Message::Normal ) )
privMsg = true;
m_roomHandler->handleMUCMessage( this, msg, privMsg );
}
}
}
void MUCRoom::handleIqID( const IQ& iq, int context )
{
if( !m_roomConfigHandler )
return;
switch( iq.subtype() )
{
case IQ::Result:
handleIqResult( iq, context );
break;
case IQ::Error:
handleIqError( iq, context );
break;
default:
break;
}
}
void MUCRoom::handleIqResult( const IQ& iq, int context )
{
switch( context )
{
case SetRNone:
case SetVisitor:
case SetParticipant:
case SetModerator:
case SetANone:
case SetOutcast:
case SetMember:
case SetAdmin:
case SetOwner:
case CreateInstantRoom:
case CancelRoomCreation:
case SendRoomConfig:
case DestroyRoom:
case StoreVoiceList:
case StoreBanList:
case StoreMemberList:
case StoreModeratorList:
case StoreAdminList:
m_roomConfigHandler->handleMUCConfigResult( this, true, static_cast<MUCOperation>( context ) );
break;
case RequestRoomConfig:
{
const MUCOwner* mo = iq.findExtension<MUCOwner>( ExtMUCOwner );
if( !mo )
break;
if( mo->form() )
m_roomConfigHandler->handleMUCConfigForm( this, *(mo->form()) );
break;
}
case RequestVoiceList:
case RequestBanList:
case RequestMemberList:
case RequestModeratorList:
case RequestOwnerList:
case RequestAdminList:
{
const MUCAdmin* ma = iq.findExtension<MUCAdmin>( ExtMUCAdmin );
if( !ma )
break;
m_roomConfigHandler->handleMUCConfigList( this, ma->list(), static_cast<MUCOperation>( context ) );
break;
}
default:
break;
}
}
void MUCRoom::handleIqError( const IQ& /*iq*/, int context )
{
switch( context )
{
case SetRNone:
case SetVisitor:
case SetParticipant:
case SetModerator:
case SetANone:
case SetOutcast:
case SetMember:
case SetAdmin:
case SetOwner:
case CreateInstantRoom:
case CancelRoomCreation:
case RequestRoomConfig:
case SendRoomConfig:
case DestroyRoom:
case RequestVoiceList:
case StoreVoiceList:
case RequestBanList:
case StoreBanList:
case RequestMemberList:
case StoreMemberList:
case RequestModeratorList:
case StoreModeratorList:
case RequestOwnerList:
case StoreOwnerList:
case RequestAdminList:
case StoreAdminList:
m_roomConfigHandler->handleMUCConfigResult( this, false, static_cast<MUCOperation>( context ) );
break;
}
}
void MUCRoom::handleDiscoInfo( const JID& /*from*/, const Disco::Info& info, int context )
{
switch( context )
{
case GetRoomInfo:
{
int oldflags = m_flags;
m_flags = 0;
if( oldflags & FlagPublicLogging )
m_flags |= FlagPublicLogging;
std::string name;
const StringList& l = info.features();
StringList::const_iterator it = l.begin();
for( ; it != l.end(); ++it )
{
if( (*it) == "muc_hidden" )
m_flags |= FlagHidden;
else if( (*it) == "muc_membersonly" )
m_flags |= FlagMembersOnly;
else if( (*it) == "muc_moderated" )
m_flags |= FlagModerated;
else if( (*it) == "muc_nonanonymous" )
setNonAnonymous();
else if( (*it) == "muc_open" )
m_flags |= FlagOpen;
else if( (*it) == "muc_passwordprotected" )
m_flags |= FlagPasswordProtected;
else if( (*it) == "muc_persistent" )
m_flags |= FlagPersistent;
else if( (*it) == "muc_public" )
m_flags |= FlagPublic;
else if( (*it) == "muc_semianonymous" )
setSemiAnonymous();
else if( (*it) == "muc_temporary" )
m_flags |= FlagTemporary;
else if( (*it) == "muc_fullyanonymous" )
setFullyAnonymous();
else if( (*it) == "muc_unmoderated" )
m_flags |= FlagUnmoderated;
else if( (*it) == "muc_unsecured" )
m_flags |= FlagUnsecured;
}
const Disco::IdentityList& il = info.identities();
if( il.size() )
name = il.front()->name();
if( m_roomHandler )
m_roomHandler->handleMUCInfo( this, m_flags, name, info.form() );
break;
}
default:
break;
}
}
void MUCRoom::handleDiscoItems( const JID& /*from*/, const Disco::Items& items, int context )
{
if( !m_roomHandler )
return;
switch( context )
{
case GetRoomItems:
{
m_roomHandler->handleMUCItems( this, items.items() );
break;
}
default:
break;
}
}
void MUCRoom::handleDiscoError( const JID& /*from*/, const Error* /*error*/, int context )
{
if( !m_roomHandler )
return;
switch( context )
{
case GetRoomInfo:
m_roomHandler->handleMUCInfo( this, 0, EmptyString, 0 );
break;
case GetRoomItems:
m_roomHandler->handleMUCItems( this, Disco::ItemList() );
break;
default:
break;
}
}
StringList MUCRoom::handleDiscoNodeFeatures( const JID& /*from*/, const std::string& /*node*/ )
{
return StringList();
}
Disco::IdentityList MUCRoom::handleDiscoNodeIdentities( const JID& /*from*/,
const std::string& /*node*/ )
{
return Disco::IdentityList();
}
Disco::ItemList MUCRoom::handleDiscoNodeItems( const JID& /*from*/, const JID& /*to*/,
const std::string& node )
{
Disco::ItemList l;
if( node == XMLNS_MUC_ROOMS && m_publish )
{
l.push_back( new Disco::Item( m_nick.bareJID(), EmptyString,
m_publishNick ? m_nick.resource() : EmptyString ) );
}
return l;
}
}
gloox::ClientBase
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
Definition clientbase.h:79
gloox::ClientBase::send
void send(Tag *tag)
Definition clientbase.cpp:1004
gloox::DataFormFieldContainer::addField
virtual void addField(DataFormField *field)
Definition dataformfieldcontainer.h:99
gloox::DataFormField::TypeNone
@ TypeNone
Definition dataformfield.h:68
gloox::DataFormField::TypeTextSingle
@ TypeTextSingle
Definition dataformfield.h:64
gloox::DataForm
An abstraction of a XEP-0004 Data Form.
Definition dataform.h:57
gloox::DelayedDelivery
This is an implementation of XEP-0203 (Delayed Delivery).
Definition delayeddelivery.h:39
gloox::DelayedDelivery::stamp
const std::string & stamp() const
Definition delayeddelivery.h:68
gloox::Disco::Info
An abstraction of a Disco Info element (from Service Discovery, XEP-0030) as a StanzaExtension.
Definition disco.h:66
gloox::Disco::Info::form
const DataForm * form() const
Definition disco.h:99
gloox::Disco::Info::identities
const IdentityList & identities() const
Definition disco.h:93
gloox::Disco::Info::features
const StringList & features() const
Definition disco.h:80
gloox::Disco::Item
An abstraction of a Disco item (Service Discovery, XEP-0030).
Definition disco.h:353
gloox::Disco::Items
An abstraction of a Disco query element (from Service Discovery, XEP-0030) in the disco::items namesp...
Definition disco.h:276
gloox::Disco::Items::items
const ItemList & items() const
Definition disco.h:311
gloox::Disco::IdentityList
std::list< Identity * > IdentityList
Definition disco.h:56
gloox::Disco::ItemList
std::list< Item * > ItemList
Definition disco.h:266
gloox::Error
A stanza error abstraction implemented as a StanzaExtension.
Definition error.h:35
gloox::Error::error
StanzaError error() const
Definition error.h:75
gloox::IQ
An abstraction of an IQ stanza.
Definition iq.h:34
gloox::IQ::subtype
IqType subtype() const
Definition iq.h:74
gloox::IQ::Set
@ Set
Definition iq.h:46
gloox::IQ::Error
@ Error
Definition iq.h:49
gloox::IQ::Result
@ Result
Definition iq.h:48
gloox::IQ::Get
@ Get
Definition iq.h:45
gloox::JID
An abstraction of a JID.
Definition jid.h:31
gloox::JID::resource
const std::string & resource() const
Definition jid.h:116
gloox::JID::bareJID
JID bareJID() const
Definition jid.h:74
gloox::JID::bare
const std::string & bare() const
Definition jid.h:67
gloox::MUCListItem
Definition mucroomconfighandler.h:39
gloox::MUCMessageSession
This is a MessageSession, adapted to be used in a MUC context.
Definition mucmessagesession.h:33
gloox::MUCRoomConfigHandler
An abstract interface that can be implemented for MUC room configuration.
Definition mucroomconfighandler.h:177
gloox::MUCRoomConfigHandler::handleMUCConfigResult
virtual void handleMUCConfigResult(MUCRoom *room, bool success, MUCOperation operation)=0
gloox::MUCRoomConfigHandler::handleMUCConfigList
virtual void handleMUCConfigList(MUCRoom *room, const MUCListItemList &items, MUCOperation operation)=0
gloox::MUCRoomConfigHandler::handleMUCConfigForm
virtual void handleMUCConfigForm(MUCRoom *room, const DataForm &form)=0
gloox::MUCRoomHandler
This interface enables inheriting classes to be notified about certain events in a MUC room.
Definition mucroomhandler.h:91
gloox::MUCRoom::MUCUser
An abstraction of a MUC user query.
Definition mucroom.h:202
gloox::MUCRoom::MUCUser::affiliation
MUCRoomAffiliation affiliation() const
Definition mucroom.h:237
gloox::MUCRoom::MUCUser::~MUCUser
virtual ~MUCUser()
Definition mucroom.cpp:415
gloox::MUCRoom::MUCUser::alternate
const std::string * alternate() const
Definition mucroom.h:279
gloox::MUCRoom::MUCUser::MUCUser
MUCUser(MUCUserOperation operation, const std::string &to, const std::string &reason, const std::string &thread=EmptyString)
Definition mucroom.cpp:298
gloox::MUCRoom::MUCUser::filterString
virtual const std::string & filterString() const
Definition mucroom.cpp:450
gloox::MUCRoom::MUCUser::flags
int flags() const
Definition mucroom.h:231
gloox::MUCRoom::MUCUser::operation
MUCUserOperation operation() const
Definition mucroom.h:291
gloox::MUCRoom::MUCUser::role
MUCRoomRole role() const
Definition mucroom.h:243
gloox::MUCRoom::MUCUser::tag
virtual Tag * tag() const
Definition mucroom.cpp:457
gloox::MUCRoom::MUC
An abstraction of a MUC query.
Definition mucroom.h:128
gloox::MUCRoom::MUC::~MUC
virtual ~MUC()
Definition mucroom.cpp:584
gloox::MUCRoom::MUC::password
const std::string * password() const
Definition mucroom.h:155
gloox::MUCRoom::MUC::filterString
virtual const std::string & filterString() const
Definition mucroom.cpp:590
gloox::MUCRoom::MUC::MUC
MUC(const std::string &password, HistoryRequestType historyType=HistoryUnknown, const std::string &historySince=EmptyString, int historyValue=0)
Definition mucroom.cpp:543
gloox::MUCRoom::MUC::historySince
const std::string * historySince() const
Definition mucroom.h:161
gloox::MUCRoom::MUC::tag
virtual Tag * tag() const
Definition mucroom.cpp:596
gloox::MUCRoom::setPublish
void setPublish(bool publish, bool publishNick)
Definition mucroom.cpp:768
gloox::MUCRoom::affiliation
MUCRoomAffiliation affiliation() const
Definition mucroom.h:435
gloox::MUCRoom::instantRoomHook
virtual bool instantRoomHook() const
Definition mucroom.h:786
gloox::MUCRoom::requestVoice
void requestVoice()
Definition mucroom.cpp:813
gloox::MUCRoom::HistoryRequestType
HistoryRequestType
Definition mucroom.h:94
gloox::MUCRoom::HistoryUnknown
@ HistoryUnknown
Definition mucroom.h:103
gloox::MUCRoom::HistorySince
@ HistorySince
Definition mucroom.h:100
gloox::MUCRoom::MUCRoom
MUCRoom(ClientBase *parent, const JID &nick, MUCRoomHandler *mrh, MUCRoomConfigHandler *mrch=0)
Definition mucroom.cpp:619
gloox::MUCRoom::setPresence
void setPresence(Presence::PresenceType presence, const std::string &msg=EmptyString)
Definition mucroom.cpp:742
gloox::MUCRoom::handleIqID
virtual void handleIqID(const IQ &iq, int context)
Definition mucroom.cpp:1107
gloox::MUCRoom::send
void send(const std::string &message)
Definition mucroom.cpp:699
gloox::MUCRoom::requestRoomConfig
void requestRoomConfig()
Definition mucroom.cpp:1001
gloox::MUCRoom::setRequestHistory
void setRequestHistory(int value, HistoryRequestType type)
Definition mucroom.cpp:792
gloox::MUCRoom::handleDiscoInfo
virtual void handleDiscoInfo(const JID &from, const Disco::Info &info, int context)
Definition mucroom.cpp:1213
gloox::MUCRoom::acknowledgeInstantRoom
void acknowledgeInstantRoom()
Definition mucroom.h:673
gloox::MUCRoom::requestList
void requestList(MUCOperation operation)
Definition mucroom.cpp:893
gloox::MUCRoom::setRoomConfig
void setRoomConfig(DataForm *form)
Definition mucroom.cpp:1015
gloox::MUCRoom::getRoomItems
void getRoomItems()
Definition mucroom.cpp:736
gloox::MUCRoom::handlePresence
virtual void handlePresence(const Presence &presence)
Definition mucroom.cpp:913
gloox::MUCRoom::setAffiliation
void setAffiliation(const std::string &nick, MUCRoomAffiliation affiliation, const std::string &reason)
Definition mucroom.cpp:859
gloox::MUCRoom::declineInvitation
static Message * declineInvitation(const JID &room, const JID &invitor, const std::string &reason=EmptyString)
Definition mucroom.cpp:761
gloox::MUCRoom::join
virtual void join(Presence::PresenceType type=Presence::Available, const std::string &status=EmptyString, int priority=0)
Definition mucroom.cpp:655
gloox::MUCRoom::handleDiscoError
virtual void handleDiscoError(const JID &from, const Error *error, int context)
Definition mucroom.cpp:1287
gloox::MUCRoom::~MUCRoom
virtual ~MUCRoom()
Definition mucroom.cpp:637
gloox::MUCRoom::handleDiscoNodeItems
virtual Disco::ItemList handleDiscoNodeItems(const JID &from, const JID &to, const std::string &node=EmptyString)
Definition mucroom.cpp:1316
gloox::MUCRoom::flags
int flags() const
Definition mucroom.h:740
gloox::MUCRoom::handleDiscoItems
virtual void handleDiscoItems(const JID &from, const Disco::Items &items, int context)
Definition mucroom.cpp:1270
gloox::MUCRoom::addHistory
void addHistory(const std::string &message, const JID &from, const std::string &stamp)
Definition mucroom.cpp:782
gloox::MUCRoom::destroy
void destroy(const std::string &reason=EmptyString, const JID &alternate=JID(), const std::string &password=EmptyString)
Definition mucroom.cpp:688
gloox::MUCRoom::createDataForm
static Message * createDataForm(const JID &room, const DataForm *df)
Definition mucroom.cpp:806
gloox::MUCRoom::leave
void leave(const std::string &msg=EmptyString)
Definition mucroom.cpp:671
gloox::MUCRoom::handleDiscoNodeIdentities
virtual Disco::IdentityList handleDiscoNodeIdentities(const JID &from, const std::string &node)
Definition mucroom.cpp:1310
gloox::MUCRoom::role
MUCRoomRole role() const
Definition mucroom.h:441
gloox::MUCRoom::setSubject
void setSubject(const std::string &subject)
Definition mucroom.cpp:711
gloox::MUCRoom::handleDiscoNodeFeatures
virtual StringList handleDiscoNodeFeatures(const JID &from, const std::string &node)
Definition mucroom.cpp:1305
gloox::MUCRoom::getRoomInfo
void getRoomInfo()
Definition mucroom.cpp:730
gloox::MUCRoom::setRole
void setRole(const std::string &nick, MUCRoomRole role, const std::string &reason=EmptyString)
Definition mucroom.cpp:828
gloox::MUCRoom::storeList
void storeList(const MUCListItemList items, MUCOperation operation)
Definition mucroom.cpp:903
gloox::MUCRoom::invite
void invite(const JID &invitee, const std::string &reason, const std::string &thread=EmptyString)
Definition mucroom.cpp:751
gloox::MUCRoom::handleMessage
virtual void handleMessage(const Message &msg, MessageSession *session=0)
Definition mucroom.cpp:1044
gloox::MUCRoom::name
const std::string name() const
Definition mucroom.h:376
gloox::MUCRoom::nick
const std::string nick() const
Definition mucroom.h:389
gloox::MUCRoom::MUCUserOperation
MUCUserOperation
Definition mucroom.h:111
gloox::MUCRoom::OpDeclineTo
@ OpDeclineTo
Definition mucroom.h:115
gloox::MUCRoom::OpInviteTo
@ OpInviteTo
Definition mucroom.h:113
gloox::MUCRoom::OpDeclineFrom
@ OpDeclineFrom
Definition mucroom.h:116
gloox::MUCRoom::OpInviteFrom
@ OpInviteFrom
Definition mucroom.h:114
gloox::MUCRoom::OpNone
@ OpNone
Definition mucroom.h:112
gloox::MUCRoom::setNick
void setNick(const std::string &nick)
Definition mucroom.cpp:717
gloox::MessageSession
An abstraction of a message session between any two entities.
Definition messagesession.h:146
gloox::Message
An abstraction of a message stanza.
Definition message.h:34
gloox::Message::subject
const std::string subject(const std::string &lang="default") const
Definition message.h:101
gloox::Message::body
const std::string body(const std::string &lang="default") const
Definition message.h:87
gloox::Message::when
const DelayedDelivery * when() const
Definition message.h:131
gloox::Message::Error
@ Error
Definition message.h:47
gloox::Message::Normal
@ Normal
Definition message.h:50
gloox::Message::Groupchat
@ Groupchat
Definition message.h:48
gloox::Message::Chat
@ Chat
Definition message.h:46
gloox::Message::subtype
MessageType subtype() const
Definition message.h:76
gloox::Presence
An abstraction of a presence stanza.
Definition presence.h:33
gloox::Presence::subtype
PresenceType subtype() const
Definition presence.h:76
gloox::Presence::status
const std::string status(const std::string &lang="default") const
Definition presence.h:106
gloox::Presence::PresenceType
PresenceType
Definition presence.h:43
gloox::Presence::Available
@ Available
Definition presence.h:44
gloox::Presence::Error
@ Error
Definition presence.h:51
gloox::Presence::Unavailable
@ Unavailable
Definition presence.h:49
gloox::StanzaExtension
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
Definition stanzaextension.h:204
gloox::StanzaExtension::StanzaExtension
StanzaExtension(int type)
Definition stanzaextension.h:211
gloox::Stanza::addExtension
void addExtension(const StanzaExtension *se)
Definition stanza.cpp:52
gloox::Stanza::error
const Error * error() const
Definition stanza.cpp:47
gloox::Stanza::extensions
const StanzaExtensionList & extensions() const
Definition stanza.h:113
gloox::Stanza::from
const JID & from() const
Definition stanza.h:51
gloox::Stanza::findExtension
const StanzaExtension * findExtension(int type) const
Definition stanza.cpp:57
gloox::Tag
This is an abstraction of an XML element.
Definition tag.h:47
gloox::Tag::addAttribute
bool addAttribute(Attribute *attr)
Definition tag.cpp:354
gloox::Tag::setXmlns
bool setXmlns(const std::string &xmlns, const std::string &prefix=EmptyString)
Definition tag.cpp:522
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::TagList
std::list< Tag * > TagList
Definition tag.h:31
gloox::XMLNS_MUC_OWNER
const std::string XMLNS_MUC_OWNER
Definition gloox.cpp:72
gloox::StanzaExtensionList
std::list< const StanzaExtension * > StanzaExtensionList
Definition gloox.h:1272
gloox::MUCRoomRole
MUCRoomRole
Definition gloox.h:1164
gloox::RoleParticipant
@ RoleParticipant
Definition gloox.h:1167
gloox::RoleInvalid
@ RoleInvalid
Definition gloox.h:1169
gloox::RoleModerator
@ RoleModerator
Definition gloox.h:1168
gloox::RoleVisitor
@ RoleVisitor
Definition gloox.h:1166
gloox::RoleNone
@ RoleNone
Definition gloox.h:1165
gloox::StringList
std::list< std::string > StringList
Definition gloox.h:1251
gloox::XMLNS_MUC_REQUEST
const std::string XMLNS_MUC_REQUEST
Definition gloox.cpp:75
gloox::historyTypeValues
const char * historyTypeValues[]
Definition mucroom.cpp:48
gloox::UserBanned
@ UserBanned
Definition gloox.h:1204
gloox::UserNewRoom
@ UserNewRoom
Definition gloox.h:1210
gloox::UserRoomShutdown
@ UserRoomShutdown
Definition gloox.h:1214
gloox::UserSelf
@ UserSelf
Definition gloox.h:1201
gloox::UserNickChanged
@ UserNickChanged
Definition gloox.h:1202
gloox::UserNickAssigned
@ UserNickAssigned
Definition gloox.h:1208
gloox::UserKicked
@ UserKicked
Definition gloox.h:1203
gloox::UserAffiliationChangedWNR
@ UserAffiliationChangedWNR
Definition gloox.h:1216
gloox::UserMembershipRequired
@ UserMembershipRequired
Definition gloox.h:1211
gloox::UserAffiliationChanged
@ UserAffiliationChanged
Definition gloox.h:1205
gloox::MUCListItemList
std::list< MUCListItem > MUCListItemList
Definition mucroomconfighandler.h:131
gloox::MUCOperation
MUCOperation
Definition mucroomconfighandler.h:137
gloox::SetOutcast
@ SetOutcast
Definition mucroomconfighandler.h:151
gloox::SetOwner
@ SetOwner
Definition mucroomconfighandler.h:154
gloox::RequestAdminList
@ RequestAdminList
Definition mucroomconfighandler.h:165
gloox::GetRoomInfo
@ GetRoomInfo
Definition mucroomconfighandler.h:144
gloox::SetANone
@ SetANone
Definition mucroomconfighandler.h:150
gloox::GetRoomItems
@ GetRoomItems
Definition mucroomconfighandler.h:145
gloox::RequestVoiceList
@ RequestVoiceList
Definition mucroomconfighandler.h:155
gloox::StoreVoiceList
@ StoreVoiceList
Definition mucroomconfighandler.h:156
gloox::SetAdmin
@ SetAdmin
Definition mucroomconfighandler.h:153
gloox::StoreOwnerList
@ StoreOwnerList
Definition mucroomconfighandler.h:164
gloox::RequestModeratorList
@ RequestModeratorList
Definition mucroomconfighandler.h:161
gloox::StoreBanList
@ StoreBanList
Definition mucroomconfighandler.h:158
gloox::StoreAdminList
@ StoreAdminList
Definition mucroomconfighandler.h:166
gloox::SetMember
@ SetMember
Definition mucroomconfighandler.h:152
gloox::StoreModeratorList
@ StoreModeratorList
Definition mucroomconfighandler.h:162
gloox::RequestOwnerList
@ RequestOwnerList
Definition mucroomconfighandler.h:163
gloox::SetRNone
@ SetRNone
Definition mucroomconfighandler.h:146
gloox::CreateInstantRoom
@ CreateInstantRoom
Definition mucroomconfighandler.h:139
gloox::SendRoomConfig
@ SendRoomConfig
Definition mucroomconfighandler.h:142
gloox::InvalidOperation
@ InvalidOperation
Definition mucroomconfighandler.h:167
gloox::SetParticipant
@ SetParticipant
Definition mucroomconfighandler.h:148
gloox::SetVisitor
@ SetVisitor
Definition mucroomconfighandler.h:147
gloox::RequestMemberList
@ RequestMemberList
Definition mucroomconfighandler.h:159
gloox::RequestBanList
@ RequestBanList
Definition mucroomconfighandler.h:157
gloox::DestroyRoom
@ DestroyRoom
Definition mucroomconfighandler.h:143
gloox::StoreMemberList
@ StoreMemberList
Definition mucroomconfighandler.h:160
gloox::SetModerator
@ SetModerator
Definition mucroomconfighandler.h:149
gloox::CancelRoomCreation
@ CancelRoomCreation
Definition mucroomconfighandler.h:140
gloox::RequestRoomConfig
@ RequestRoomConfig
Definition mucroomconfighandler.h:141
gloox::EmptyString
const std::string EmptyString
Definition gloox.cpp:124
gloox::StanzaErrorUndefined
@ StanzaErrorUndefined
Definition gloox.h:952
gloox::XMLNS_MUC_USER
const std::string XMLNS_MUC_USER
Definition gloox.cpp:68
gloox::XMLNS_MUC_ADMIN
const std::string XMLNS_MUC_ADMIN
Definition gloox.cpp:69
gloox::MUCRoomAffiliation
MUCRoomAffiliation
Definition gloox.h:1151
gloox::AffiliationInvalid
@ AffiliationInvalid
Definition gloox.h:1157
gloox::AffiliationOwner
@ AffiliationOwner
Definition gloox.h:1155
gloox::AffiliationMember
@ AffiliationMember
Definition gloox.h:1154
gloox::AffiliationNone
@ AffiliationNone
Definition gloox.h:1152
gloox::AffiliationAdmin
@ AffiliationAdmin
Definition gloox.h:1156
gloox::AffiliationOutcast
@ AffiliationOutcast
Definition gloox.h:1153
gloox::ExtMUCAdmin
@ ExtMUCAdmin
Definition stanzaextension.h:71
gloox::ExtMUC
@ ExtMUC
Definition stanzaextension.h:69
gloox::ExtMUCUser
@ ExtMUCUser
Definition stanzaextension.h:72
gloox::ExtMUCOwner
@ ExtMUCOwner
Definition stanzaextension.h:70
gloox::ExtDataForm
@ ExtDataForm
Definition stanzaextension.h:52
gloox::TypeSubmit
@ TypeSubmit
Definition dataform.h:37
gloox::TypeCancel
@ TypeCancel
Definition dataform.h:39
gloox::XMLNS_MUC_ROOMS
const std::string XMLNS_MUC_ROOMS
Definition gloox.cpp:74
gloox::FlagPublicLoggingOff
@ FlagPublicLoggingOff
Definition gloox.h:1179
gloox::FlagHidden
@ FlagHidden
Definition gloox.h:1180
gloox::FlagMembersOnly
@ FlagMembersOnly
Definition gloox.h:1181
gloox::FlagTemporary
@ FlagTemporary
Definition gloox.h:1188
gloox::FlagPersistent
@ FlagPersistent
Definition gloox.h:1185
gloox::FlagModerated
@ FlagModerated
Definition gloox.h:1182
gloox::FlagOpen
@ FlagOpen
Definition gloox.h:1184
gloox::FlagPublicLogging
@ FlagPublicLogging
Definition gloox.h:1178
gloox::FlagNonAnonymous
@ FlagNonAnonymous
Definition gloox.h:1183
gloox::FlagPasswordProtected
@ FlagPasswordProtected
Definition gloox.h:1177
gloox::FlagSemiAnonymous
@ FlagSemiAnonymous
Definition gloox.h:1187
gloox::FlagUnmoderated
@ FlagUnmoderated
Definition gloox.h:1189
gloox::FlagFullyAnonymous
@ FlagFullyAnonymous
Definition gloox.h:1191
gloox::FlagUnsecured
@ FlagUnsecured
Definition gloox.h:1190
gloox::FlagPublic
@ FlagPublic
Definition gloox.h:1186
gloox::XMLNS_MUC
const std::string XMLNS_MUC
Definition gloox.cpp:67
gloox::MUCRoomParticipant
Definition mucroomhandler.h:36
gloox::MUCRoomParticipant::nick
JID * nick
Definition mucroomhandler.h:37
gloox::MUCRoomParticipant::role
MUCRoomRole role
Definition mucroomhandler.h:44
gloox::MUCRoomParticipant::jid
JID * jid
Definition mucroomhandler.h:45
gloox::MUCRoomParticipant::status
std::string status
Definition mucroomhandler.h:72
gloox::MUCRoomParticipant::affiliation
MUCRoomAffiliation affiliation
Definition mucroomhandler.h:43
gloox::MUCRoomParticipant::alternate
JID * alternate
Definition mucroomhandler.h:74
gloox::MUCRoomParticipant::reason
std::string reason
Definition mucroomhandler.h:54
gloox::MUCRoomParticipant::flags
int flags
Definition mucroomhandler.h:49
gloox::MUCRoomParticipant::actor
JID * actor
Definition mucroomhandler.h:57
gloox::MUCRoomParticipant::newNick
std::string newNick
Definition mucroomhandler.h:62