Update libgloox to 1.0.13
This commit is contained in:
parent
ae0652f3cc
commit
7a11cae117
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -15,11 +15,14 @@
|
||||||
#include "adhochandler.h"
|
#include "adhochandler.h"
|
||||||
#include "adhoccommandprovider.h"
|
#include "adhoccommandprovider.h"
|
||||||
#include "disco.h"
|
#include "disco.h"
|
||||||
|
#include "dataform.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "iodata.h"
|
||||||
#include "discohandler.h"
|
#include "discohandler.h"
|
||||||
#include "clientbase.h"
|
#include "clientbase.h"
|
||||||
#include "dataform.h"
|
#include "adhocplugin.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "mutexguard.h"
|
||||||
|
|
||||||
namespace gloox
|
namespace gloox
|
||||||
{
|
{
|
||||||
|
@ -78,37 +81,37 @@ namespace gloox
|
||||||
|
|
||||||
// ---- Adhoc::Command ----
|
// ---- Adhoc::Command ----
|
||||||
Adhoc::Command::Command( const std::string& node, Adhoc::Command::Action action,
|
Adhoc::Command::Command( const std::string& node, Adhoc::Command::Action action,
|
||||||
DataForm* form )
|
AdhocPlugin* plugin )
|
||||||
: StanzaExtension( ExtAdhocCommand ), m_node( node ), m_form( form ), m_action( action ),
|
: StanzaExtension( ExtAdhocCommand ), m_node( node ), m_plugin( plugin ), m_action( action ),
|
||||||
m_status( InvalidStatus ), m_actions( 0 )
|
m_status( InvalidStatus ), m_actions( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Adhoc::Command::Command( const std::string& node, const std::string& sessionid, Status status,
|
Adhoc::Command::Command( const std::string& node, const std::string& sessionid, Status status,
|
||||||
DataForm* form )
|
AdhocPlugin* plugin )
|
||||||
: StanzaExtension( ExtAdhocCommand ), m_node( node ), m_sessionid( sessionid ),
|
: StanzaExtension( ExtAdhocCommand ), m_node( node ), m_sessionid( sessionid ),
|
||||||
m_form( form ), m_action( InvalidAction ), m_status( status ), m_actions( 0 )
|
m_plugin( plugin ), m_action( InvalidAction ), m_status( status ), m_actions( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Adhoc::Command::Command( const std::string& node, const std::string& sessionid,
|
Adhoc::Command::Command( const std::string& node, const std::string& sessionid,
|
||||||
Adhoc::Command::Action action,
|
Adhoc::Command::Action action,
|
||||||
DataForm* form )
|
AdhocPlugin* plugin )
|
||||||
: StanzaExtension( ExtAdhocCommand ), m_node( node ), m_sessionid( sessionid ),
|
: StanzaExtension( ExtAdhocCommand ), m_node( node ), m_sessionid( sessionid ),
|
||||||
m_form( form ), m_action( action ), m_actions( 0 )
|
m_plugin( plugin ), m_action( action ), m_actions( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Adhoc::Command::Command( const std::string& node, const std::string& sessionid, Status status,
|
Adhoc::Command::Command( const std::string& node, const std::string& sessionid, Status status,
|
||||||
Action executeAction, int allowedActions,
|
Action executeAction, int allowedActions,
|
||||||
DataForm* form )
|
AdhocPlugin* plugin )
|
||||||
: StanzaExtension( ExtAdhocCommand ), m_node( node ), m_sessionid( sessionid ),
|
: StanzaExtension( ExtAdhocCommand ), m_node( node ), m_sessionid( sessionid ),
|
||||||
m_form( form ), m_action( executeAction ), m_status( status ), m_actions( allowedActions )
|
m_plugin( plugin ), m_action( executeAction ), m_status( status ), m_actions( allowedActions )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Adhoc::Command::Command( const Tag* tag )
|
Adhoc::Command::Command( const Tag* tag )
|
||||||
: StanzaExtension( ExtAdhocCommand ), m_form( 0 ), m_actions( 0 )
|
: StanzaExtension( ExtAdhocCommand ), m_plugin( 0 ), m_actions( 0 )
|
||||||
{
|
{
|
||||||
if( !tag || tag->name() != "command" || tag->xmlns() != XMLNS_ADHOC_COMMANDS )
|
if( !tag || tag->name() != "command" || tag->xmlns() != XMLNS_ADHOC_COMMANDS )
|
||||||
return;
|
return;
|
||||||
|
@ -141,13 +144,19 @@ namespace gloox
|
||||||
|
|
||||||
Tag* x = tag->findChild( "x", "xmlns", XMLNS_X_DATA );
|
Tag* x = tag->findChild( "x", "xmlns", XMLNS_X_DATA );
|
||||||
if( x )
|
if( x )
|
||||||
m_form = new DataForm( x );
|
m_plugin = new DataForm( x );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Tag* x = tag->findChild( "iodata", "xmlns", XMLNS_IODATA );
|
||||||
|
if( x )
|
||||||
|
m_plugin = new IOData( x );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Adhoc::Command::~Command()
|
Adhoc::Command::~Command()
|
||||||
{
|
{
|
||||||
util::clearList( m_notes );
|
util::clearList( m_notes );
|
||||||
delete m_form;
|
delete m_plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& Adhoc::Command::filterString() const
|
const std::string& Adhoc::Command::filterString() const
|
||||||
|
@ -200,8 +209,8 @@ namespace gloox
|
||||||
if ( !m_sessionid.empty() )
|
if ( !m_sessionid.empty() )
|
||||||
c->addAttribute( "sessionid", m_sessionid );
|
c->addAttribute( "sessionid", m_sessionid );
|
||||||
|
|
||||||
if( m_form && *m_form )
|
if( m_plugin && *m_plugin )
|
||||||
c->addChild( m_form->tag() );
|
c->addChild( m_plugin->tag() );
|
||||||
|
|
||||||
NoteList::const_iterator it = m_notes.begin();
|
NoteList::const_iterator it = m_notes.begin();
|
||||||
for( ; it != m_notes.end(); ++it )
|
for( ; it != m_notes.end(); ++it )
|
||||||
|
@ -227,6 +236,10 @@ namespace gloox
|
||||||
|
|
||||||
Adhoc::~Adhoc()
|
Adhoc::~Adhoc()
|
||||||
{
|
{
|
||||||
|
m_adhocTrackMapMutex.lock();
|
||||||
|
m_adhocTrackMap.clear();
|
||||||
|
m_adhocTrackMapMutex.unlock();
|
||||||
|
|
||||||
if( !m_parent || !m_parent->disco() )
|
if( !m_parent || !m_parent->disco() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -306,27 +319,32 @@ namespace gloox
|
||||||
if( context != ExecuteAdhocCommand )
|
if( context != ExecuteAdhocCommand )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_adhocTrackMapMutex.lock();
|
||||||
AdhocTrackMap::iterator it = m_adhocTrackMap.find( iq.id() );
|
AdhocTrackMap::iterator it = m_adhocTrackMap.find( iq.id() );
|
||||||
if( it == m_adhocTrackMap.end() || (*it).second.context != context
|
bool haveIdHandler = ( it != m_adhocTrackMap.end() );
|
||||||
|
m_adhocTrackMapMutex.unlock();
|
||||||
|
if( !haveIdHandler || (*it).second.context != context
|
||||||
|| (*it).second.remote != iq.from() )
|
|| (*it).second.remote != iq.from() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch( iq.subtype() )
|
switch( iq.subtype() )
|
||||||
{
|
{
|
||||||
case IQ::Error:
|
case IQ::Error:
|
||||||
(*it).second.ah->handleAdhocError( iq.from(), iq.error() );
|
(*it).second.ah->handleAdhocError( iq.from(), iq.error(), (*it).second.handlerContext );
|
||||||
break;
|
break;
|
||||||
case IQ::Result:
|
case IQ::Result:
|
||||||
{
|
{
|
||||||
const Adhoc::Command* ac = iq.findExtension<Adhoc::Command>( ExtAdhocCommand );
|
const Adhoc::Command* ac = iq.findExtension<Adhoc::Command>( ExtAdhocCommand );
|
||||||
if( ac )
|
if( ac )
|
||||||
(*it).second.ah->handleAdhocExecutionResult( iq.from(), *ac );
|
(*it).second.ah->handleAdhocExecutionResult( iq.from(), *ac, (*it).second.handlerContext );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
m_adhocTrackMapMutex.lock();
|
||||||
m_adhocTrackMap.erase( it );
|
m_adhocTrackMap.erase( it );
|
||||||
|
m_adhocTrackMapMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Adhoc::registerAdhocCommandProvider( AdhocCommandProvider* acp, const std::string& command,
|
void Adhoc::registerAdhocCommandProvider( AdhocCommandProvider* acp, const std::string& command,
|
||||||
|
@ -345,6 +363,8 @@ namespace gloox
|
||||||
if( context != CheckAdhocSupport )
|
if( context != CheckAdhocSupport )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
util::MutexGuard m( m_adhocTrackMapMutex );
|
||||||
|
|
||||||
AdhocTrackMap::iterator it = m_adhocTrackMap.begin();
|
AdhocTrackMap::iterator it = m_adhocTrackMap.begin();
|
||||||
for( ; it != m_adhocTrackMap.end() && (*it).second.context != context
|
for( ; it != m_adhocTrackMap.end() && (*it).second.context != context
|
||||||
&& (*it).second.remote != from; ++it )
|
&& (*it).second.remote != from; ++it )
|
||||||
|
@ -352,7 +372,7 @@ namespace gloox
|
||||||
if( it == m_adhocTrackMap.end() )
|
if( it == m_adhocTrackMap.end() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(*it).second.ah->handleAdhocSupport( from, info.hasFeature( XMLNS_ADHOC_COMMANDS ) );
|
(*it).second.ah->handleAdhocSupport( from, info.hasFeature( XMLNS_ADHOC_COMMANDS ), (*it).second.handlerContext );
|
||||||
m_adhocTrackMap.erase( it );
|
m_adhocTrackMap.erase( it );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,6 +381,8 @@ namespace gloox
|
||||||
if( context != FetchAdhocCommands )
|
if( context != FetchAdhocCommands )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
util::MutexGuard m( m_adhocTrackMapMutex );
|
||||||
|
|
||||||
AdhocTrackMap::iterator it = m_adhocTrackMap.begin();
|
AdhocTrackMap::iterator it = m_adhocTrackMap.begin();
|
||||||
for( ; it != m_adhocTrackMap.end(); ++it )
|
for( ; it != m_adhocTrackMap.end(); ++it )
|
||||||
{
|
{
|
||||||
|
@ -373,7 +395,7 @@ namespace gloox
|
||||||
{
|
{
|
||||||
commands[(*it2)->node()] = (*it2)->name();
|
commands[(*it2)->node()] = (*it2)->name();
|
||||||
}
|
}
|
||||||
(*it).second.ah->handleAdhocCommands( from, commands );
|
(*it).second.ah->handleAdhocCommands( from, commands, (*it).second.handlerContext );
|
||||||
|
|
||||||
m_adhocTrackMap.erase( it );
|
m_adhocTrackMap.erase( it );
|
||||||
break;
|
break;
|
||||||
|
@ -383,19 +405,28 @@ namespace gloox
|
||||||
|
|
||||||
void Adhoc::handleDiscoError( const JID& from, const Error* error, int context )
|
void Adhoc::handleDiscoError( const JID& from, const Error* error, int context )
|
||||||
{
|
{
|
||||||
AdhocTrackMap::iterator it = m_adhocTrackMap.begin();
|
util::MutexGuard m( m_adhocTrackMapMutex );
|
||||||
for( ; it != m_adhocTrackMap.end(); ++it )
|
for( AdhocTrackMap::iterator it = m_adhocTrackMap.begin(); it != m_adhocTrackMap.end(); )
|
||||||
{
|
{
|
||||||
if( (*it).second.context == context && (*it).second.remote == from )
|
if( (*it).second.context == context && (*it).second.remote == from )
|
||||||
{
|
{
|
||||||
(*it).second.ah->handleAdhocError( from, error );
|
(*it).second.ah->handleAdhocError( from, error, (*it).second.handlerContext );
|
||||||
|
|
||||||
m_adhocTrackMap.erase( it );
|
// Normally we'd just assign it to the return value of the .erase() call,
|
||||||
|
// which is either the next element, or .end(). However,
|
||||||
|
// it's only since C++11 that this works; C++03 version returns void.
|
||||||
|
// So instead, we do a post-increment. this increments the iterator to point
|
||||||
|
// to the next element, then passes a copy of the old iterator (that is to the item to be deleted)
|
||||||
|
m_adhocTrackMap.erase( it++ );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Adhoc::checkSupport( const JID& remote, AdhocHandler* ah )
|
void Adhoc::checkSupport( const JID& remote, AdhocHandler* ah, int context )
|
||||||
{
|
{
|
||||||
if( !remote || !ah || !m_parent || !m_parent->disco() )
|
if( !remote || !ah || !m_parent || !m_parent->disco() )
|
||||||
return;
|
return;
|
||||||
|
@ -404,12 +435,15 @@ namespace gloox
|
||||||
track.remote = remote;
|
track.remote = remote;
|
||||||
track.context = CheckAdhocSupport;
|
track.context = CheckAdhocSupport;
|
||||||
track.ah = ah;
|
track.ah = ah;
|
||||||
|
track.handlerContext = context;
|
||||||
const std::string& id = m_parent->getID();
|
const std::string& id = m_parent->getID();
|
||||||
|
m_adhocTrackMapMutex.lock();
|
||||||
m_adhocTrackMap[id] = track;
|
m_adhocTrackMap[id] = track;
|
||||||
|
m_adhocTrackMapMutex.unlock();
|
||||||
m_parent->disco()->getDiscoInfo( remote, EmptyString, this, CheckAdhocSupport, id );
|
m_parent->disco()->getDiscoInfo( remote, EmptyString, this, CheckAdhocSupport, id );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Adhoc::getCommands( const JID& remote, AdhocHandler* ah )
|
void Adhoc::getCommands( const JID& remote, AdhocHandler* ah, int context )
|
||||||
{
|
{
|
||||||
if( !remote || !ah || !m_parent || !m_parent->disco() )
|
if( !remote || !ah || !m_parent || !m_parent->disco() )
|
||||||
return;
|
return;
|
||||||
|
@ -418,12 +452,15 @@ namespace gloox
|
||||||
track.remote = remote;
|
track.remote = remote;
|
||||||
track.context = FetchAdhocCommands;
|
track.context = FetchAdhocCommands;
|
||||||
track.ah = ah;
|
track.ah = ah;
|
||||||
|
track.handlerContext = context;
|
||||||
const std::string& id = m_parent->getID();
|
const std::string& id = m_parent->getID();
|
||||||
|
m_adhocTrackMapMutex.lock();
|
||||||
m_adhocTrackMap[id] = track;
|
m_adhocTrackMap[id] = track;
|
||||||
|
m_adhocTrackMapMutex.unlock();
|
||||||
m_parent->disco()->getDiscoItems( remote, XMLNS_ADHOC_COMMANDS, this, FetchAdhocCommands, id );
|
m_parent->disco()->getDiscoItems( remote, XMLNS_ADHOC_COMMANDS, this, FetchAdhocCommands, id );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Adhoc::execute( const JID& remote, const Adhoc::Command* command, AdhocHandler* ah )
|
void Adhoc::execute( const JID& remote, const Adhoc::Command* command, AdhocHandler* ah, int context )
|
||||||
{
|
{
|
||||||
if( !remote || !command || !m_parent || !ah )
|
if( !remote || !command || !m_parent || !ah )
|
||||||
return;
|
return;
|
||||||
|
@ -437,7 +474,10 @@ namespace gloox
|
||||||
track.context = ExecuteAdhocCommand;
|
track.context = ExecuteAdhocCommand;
|
||||||
track.session = command->sessionID();
|
track.session = command->sessionID();
|
||||||
track.ah = ah;
|
track.ah = ah;
|
||||||
|
track.handlerContext = context;
|
||||||
|
m_adhocTrackMapMutex.lock();
|
||||||
m_adhocTrackMap[id] = track;
|
m_adhocTrackMap[id] = track;
|
||||||
|
m_adhocTrackMapMutex.unlock();
|
||||||
|
|
||||||
m_parent->send( iq, this, ExecuteAdhocCommand );
|
m_parent->send( iq, this, ExecuteAdhocCommand );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -15,12 +15,13 @@
|
||||||
#ifndef ADHOC_H__
|
#ifndef ADHOC_H__
|
||||||
#define ADHOC_H__
|
#define ADHOC_H__
|
||||||
|
|
||||||
#include "dataform.h"
|
#include "adhocplugin.h"
|
||||||
#include "disco.h"
|
#include "disco.h"
|
||||||
#include "disconodehandler.h"
|
#include "disconodehandler.h"
|
||||||
#include "discohandler.h"
|
#include "discohandler.h"
|
||||||
#include "iqhandler.h"
|
#include "iqhandler.h"
|
||||||
#include "stanzaextension.h"
|
#include "stanzaextension.h"
|
||||||
|
#include "mutex.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -35,7 +36,7 @@ namespace gloox
|
||||||
class AdhocCommandProvider;
|
class AdhocCommandProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class implements a provider for XEP-0050 (Ad-hoc Commands).
|
* @brief This class implements a provider for @xep{0050} (Ad-hoc Commands).
|
||||||
*
|
*
|
||||||
* The current, not complete, implementation is probably best suited for fire-and-forget
|
* The current, not complete, implementation is probably best suited for fire-and-forget
|
||||||
* type of commands. Any additional feature, like multiple stages, etc., would have to be
|
* type of commands. Any additional feature, like multiple stages, etc., would have to be
|
||||||
|
@ -75,16 +76,16 @@ namespace gloox
|
||||||
* ...TBC...
|
* ...TBC...
|
||||||
*
|
*
|
||||||
* XEP version: 1.2
|
* XEP version: 1.2
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Adhoc : public DiscoNodeHandler, public DiscoHandler, public IqHandler
|
class GLOOX_API Adhoc : public DiscoNodeHandler, public DiscoHandler, public IqHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of an Adhoc Command element (from Adhoc Commands, XEP-0050)
|
* @brief An abstraction of an Adhoc Command element (from Adhoc Commands, @xep{0050})
|
||||||
* as a StanzaExtension.
|
* as a StanzaExtension.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Command : public StanzaExtension
|
class GLOOX_API Command : public StanzaExtension
|
||||||
|
@ -123,7 +124,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* An abstraction of a command note.
|
* An abstraction of a command note.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Note
|
class GLOOX_API Note
|
||||||
|
@ -203,11 +204,11 @@ namespace gloox
|
||||||
* @param node The node (command) to perform the action on.
|
* @param node The node (command) to perform the action on.
|
||||||
* @param sessionid The session ID of an already running adhoc command session.
|
* @param sessionid The session ID of an already running adhoc command session.
|
||||||
* @param action The action to perform.
|
* @param action The action to perform.
|
||||||
* @param form An optional DataForm to include in the request. Will be deleted in Command's
|
* @param plugin An optional AdhocPlugin (e.g. DataForm) to include in the request. Will be deleted in Command's
|
||||||
* destructor.
|
* destructor.
|
||||||
*/
|
*/
|
||||||
Command( const std::string& node, const std::string& sessionid, Action action,
|
Command( const std::string& node, const std::string& sessionid, Action action,
|
||||||
DataForm* form = 0 );
|
AdhocPlugin* plugin = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Command object that can be used to perform the provided Action.
|
* Creates a Command object that can be used to perform the provided Action.
|
||||||
|
@ -215,11 +216,11 @@ namespace gloox
|
||||||
* @param node The node (command) to perform the action on.
|
* @param node The node (command) to perform the action on.
|
||||||
* @param sessionid The (possibly newly created) session ID of the adhoc command session.
|
* @param sessionid The (possibly newly created) session ID of the adhoc command session.
|
||||||
* @param status The execution status.
|
* @param status The execution status.
|
||||||
* @param form An optional DataForm to include in the reply. Will be deleted in Command's
|
* @param plugin An optional AdhocPlugin (e.g. DataForm) to include in the reply. Will be deleted in Command's
|
||||||
* destructor.
|
* destructor.
|
||||||
*/
|
*/
|
||||||
Command( const std::string& node, const std::string& sessionid, Status status,
|
Command( const std::string& node, const std::string& sessionid, Status status,
|
||||||
DataForm* form = 0 );
|
AdhocPlugin* plugin = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Command object that can be used to perform the provided Action.
|
* Creates a Command object that can be used to perform the provided Action.
|
||||||
|
@ -230,12 +231,12 @@ namespace gloox
|
||||||
* @param status The execution status.
|
* @param status The execution status.
|
||||||
* @param executeAction The action to execute.
|
* @param executeAction The action to execute.
|
||||||
* @param allowedActions Allowed reply actions.
|
* @param allowedActions Allowed reply actions.
|
||||||
* @param form An optional DataForm to include in the reply. Will be deleted in Command's
|
* @param plugin An optional AdhocPlugin (e.g. DataForm) to include in the reply. Will be deleted in Command's
|
||||||
* destructor.
|
* destructor.
|
||||||
*/
|
*/
|
||||||
Command( const std::string& node, const std::string& sessionid, Status status,
|
Command( const std::string& node, const std::string& sessionid, Status status,
|
||||||
Action executeAction, int allowedActions = Complete,
|
Action executeAction, int allowedActions = Complete,
|
||||||
DataForm* form = 0 );
|
AdhocPlugin* plugin = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Command object that can be used to perform the provided Action.
|
* Creates a Command object that can be used to perform the provided Action.
|
||||||
|
@ -243,11 +244,11 @@ namespace gloox
|
||||||
* (single or multi stage).
|
* (single or multi stage).
|
||||||
* @param node The node (command) to perform the action on.
|
* @param node The node (command) to perform the action on.
|
||||||
* @param action The action to perform.
|
* @param action The action to perform.
|
||||||
* @param form An optional DataForm to include in the request. Will be deleted in Command's
|
* @param plugin An optional AdhocPlugin (e.g. DataForm) to include in the request. Will be deleted in Command's
|
||||||
* destructor.
|
* destructor.
|
||||||
*/
|
*/
|
||||||
Command( const std::string& node, Action action,
|
Command( const std::string& node, Action action,
|
||||||
DataForm* form = 0 );
|
AdhocPlugin* plugin = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Command object from the given Tag.
|
* Creates a Command object from the given Tag.
|
||||||
|
@ -306,10 +307,17 @@ namespace gloox
|
||||||
void addNote( const Note* note ) { m_notes.push_back( note ); }
|
void addNote( const Note* note ) { m_notes.push_back( note ); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the command's embedded DataForm.
|
* Returns the command's embedded AdhocPlugin (e.g. DataForm).
|
||||||
* @return The command's embedded DataForm. May be 0.
|
* @return The command's embedded AdhocPlugin (e.g. DataForm). May be 0.
|
||||||
|
* @note This will be removed in 1.1. Use plugin() instead.
|
||||||
*/
|
*/
|
||||||
const DataForm* form() const { return m_form; }
|
GLOOX_DEPRECATED const AdhocPlugin* form() const { return m_plugin; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the command's embedded AdhocPlugin (e.g. DataForm).
|
||||||
|
* @return The command's embedded AdhocPlugin (e.g. DataForm). May be 0.
|
||||||
|
*/
|
||||||
|
const AdhocPlugin* plugin() const { return m_plugin; }
|
||||||
|
|
||||||
// reimplemented from StanzaExtension
|
// reimplemented from StanzaExtension
|
||||||
virtual const std::string& filterString() const;
|
virtual const std::string& filterString() const;
|
||||||
|
@ -334,7 +342,7 @@ namespace gloox
|
||||||
|
|
||||||
c->m_node = m_node;
|
c->m_node = m_node;
|
||||||
c->m_sessionid = m_sessionid;
|
c->m_sessionid = m_sessionid;
|
||||||
c->m_form = m_form ? static_cast<DataForm*>( m_form->clone() ) : 0;
|
c->m_plugin = m_plugin ? static_cast<AdhocPlugin*>( m_plugin->clone() ) : 0;
|
||||||
c->m_action = m_action;
|
c->m_action = m_action;
|
||||||
c->m_status = m_status;
|
c->m_status = m_status;
|
||||||
c->m_actions = m_actions;
|
c->m_actions = m_actions;
|
||||||
|
@ -350,7 +358,7 @@ namespace gloox
|
||||||
|
|
||||||
std::string m_node;
|
std::string m_node;
|
||||||
std::string m_sessionid;
|
std::string m_sessionid;
|
||||||
DataForm* m_form;
|
AdhocPlugin* m_plugin;
|
||||||
Action m_action;
|
Action m_action;
|
||||||
Status m_status;
|
Status m_status;
|
||||||
int m_actions;
|
int m_actions;
|
||||||
|
@ -372,16 +380,18 @@ namespace gloox
|
||||||
* This function queries the given remote entity for Adhoc Commands support.
|
* This function queries the given remote entity for Adhoc Commands support.
|
||||||
* @param remote The remote entity's JID.
|
* @param remote The remote entity's JID.
|
||||||
* @param ah The object handling the result of this request.
|
* @param ah The object handling the result of this request.
|
||||||
|
* @param context A user defined context.
|
||||||
*/
|
*/
|
||||||
void checkSupport( const JID& remote, AdhocHandler* ah );
|
void checkSupport( const JID& remote, AdhocHandler* ah, int context = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a list of commands from the remote entity. You should check whether the remote
|
* Retrieves a list of commands from the remote entity. You should check whether the remote
|
||||||
* entity actually supports Adhoc Commands by means of checkSupport().
|
* entity actually supports Adhoc Commands by means of checkSupport().
|
||||||
* @param remote The remote entity's JID.
|
* @param remote The remote entity's JID.
|
||||||
* @param ah The object handling the result of this request.
|
* @param ah The object handling the result of this request.
|
||||||
|
* @param context A user defined context.
|
||||||
*/
|
*/
|
||||||
void getCommands( const JID& remote, AdhocHandler* ah );
|
void getCommands( const JID& remote, AdhocHandler* ah, int context = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes or continues the given command on the given remote entity.
|
* Executes or continues the given command on the given remote entity.
|
||||||
|
@ -392,14 +402,15 @@ namespace gloox
|
||||||
* @param remote The remote entity's JID.
|
* @param remote The remote entity's JID.
|
||||||
* @param command The command to execute.
|
* @param command The command to execute.
|
||||||
* @param ah The object handling the result of this request.
|
* @param ah The object handling the result of this request.
|
||||||
|
* @param context A user defined context.
|
||||||
*/
|
*/
|
||||||
void execute( const JID& remote, const Adhoc::Command* command, AdhocHandler* ah );
|
void execute( const JID& remote, const Adhoc::Command* command, AdhocHandler* ah, int context = 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this function to respond to an execution request submitted by means
|
* Use this function to respond to an execution request submitted by means
|
||||||
* of AdhocCommandProvider::handleAdhocCommand().
|
* of AdhocCommandProvider::handleAdhocCommand().
|
||||||
* It is recommended to use
|
* It is recommended to use
|
||||||
* Command( const std::string&, const std::string&, Status, DataForm* )
|
* Command( const std::string&, const std::string&, Status, AdhocPlugin* )
|
||||||
* to construct the @c command object.
|
* to construct the @c command object.
|
||||||
* Optionally, an Error object can be included. In that case the IQ sent is of type @c error.
|
* Optionally, an Error object can be included. In that case the IQ sent is of type @c error.
|
||||||
* @param remote The requester's JID.
|
* @param remote The requester's JID.
|
||||||
|
@ -411,8 +422,8 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Using this function, you can register a AdhocCommandProvider -derived object as
|
* Using this function, you can register a AdhocCommandProvider -derived object as
|
||||||
* handler for a specific Ad-hoc Command as defined in XEP-0050.
|
* handler for a specific Ad-hoc Command as defined in @xep{0050}.
|
||||||
* @param acp The obejct to register as handler for the specified command.
|
* @param acp The object to register as handler for the specified command.
|
||||||
* @param command The node name of the command. Will be announced in disco#items.
|
* @param command The node name of the command. Will be announced in disco#items.
|
||||||
* @param name The natural-language name of the command. Will be announced in disco#items.
|
* @param name The natural-language name of the command. Will be announced in disco#items.
|
||||||
*/
|
*/
|
||||||
|
@ -471,9 +482,11 @@ namespace gloox
|
||||||
AdhocContext context;
|
AdhocContext context;
|
||||||
std::string session;
|
std::string session;
|
||||||
AdhocHandler* ah;
|
AdhocHandler* ah;
|
||||||
|
int handlerContext;
|
||||||
};
|
};
|
||||||
typedef std::map<std::string, TrackStruct> AdhocTrackMap;
|
typedef std::map<std::string, TrackStruct> AdhocTrackMap;
|
||||||
AdhocTrackMap m_adhocTrackMap;
|
AdhocTrackMap m_adhocTrackMap;
|
||||||
|
util::Mutex m_adhocTrackMapMutex;
|
||||||
|
|
||||||
ClientBase* m_parent;
|
ClientBase* m_parent;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -27,11 +27,11 @@ namespace gloox
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A virtual interface for an Ad-hoc Command Provider according to XEP-0050.
|
* @brief A virtual interface for an Ad-hoc Command Provider according to @xep{0050}.
|
||||||
*
|
*
|
||||||
* Derived classes can be registered as Command Providers with the Adhoc object.
|
* Derived classes can be registered as Command Providers with the Adhoc object.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
*/
|
*/
|
||||||
class GLOOX_API AdhocCommandProvider
|
class GLOOX_API AdhocCommandProvider
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -21,12 +21,12 @@ namespace gloox
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A virtual interface for an Ad-hoc Command users according to XEP-0050.
|
* @brief A virtual interface for an Ad-hoc Command users according to @xep{0050}.
|
||||||
*
|
*
|
||||||
* Derived classes can be registered with the Adhoc object to receive notifications
|
* Derived classes can be registered with the Adhoc object to receive notifications
|
||||||
* about Adhoc Commands remote entities support.
|
* about Adhoc Commands remote entities support.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API AdhocHandler
|
class GLOOX_API AdhocHandler
|
||||||
|
@ -41,17 +41,19 @@ namespace gloox
|
||||||
* This function is called in response to a call to Adhoc::checkSupport().
|
* This function is called in response to a call to Adhoc::checkSupport().
|
||||||
* @param remote The queried remote entity's JID.
|
* @param remote The queried remote entity's JID.
|
||||||
* @param support Whether the remote entity supports Adhoc Commands.
|
* @param support Whether the remote entity supports Adhoc Commands.
|
||||||
|
* @param context A user defined context.
|
||||||
*/
|
*/
|
||||||
virtual void handleAdhocSupport( const JID& remote, bool support ) = 0;
|
virtual void handleAdhocSupport( const JID& remote, bool support, int context ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called in response to a call to Adhoc::getCommands()
|
* This function is called in response to a call to Adhoc::getCommands()
|
||||||
* and delivers a list of supported commands.
|
* and delivers a list of supported commands.
|
||||||
* @param remote The queried remote entity's JID.
|
* @param remote The queried remote entity's JID.
|
||||||
* @param commands A map of supported commands and their human-readable name.
|
* @param commands A map of supported commands and their human-readable name.
|
||||||
|
* @param context A user defined context.
|
||||||
* The map may be empty.
|
* The map may be empty.
|
||||||
*/
|
*/
|
||||||
virtual void handleAdhocCommands( const JID& remote, const StringMap& commands ) = 0;
|
virtual void handleAdhocCommands( const JID& remote, const StringMap& commands, int context ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called in response to a call to Adhoc::getCommands() or
|
* This function is called in response to a call to Adhoc::getCommands() or
|
||||||
|
@ -59,15 +61,17 @@ namespace gloox
|
||||||
* an error.
|
* an error.
|
||||||
* @param remote The queried remote entity's JID.
|
* @param remote The queried remote entity's JID.
|
||||||
* @param error The error condition. May be 0.
|
* @param error The error condition. May be 0.
|
||||||
|
* @param context A user defined context.
|
||||||
*/
|
*/
|
||||||
virtual void handleAdhocError( const JID& remote, const Error* error ) = 0;
|
virtual void handleAdhocError( const JID& remote, const Error* error, int context ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called in response to a remote command execution.
|
* This function is called in response to a remote command execution.
|
||||||
* @param remote The remote entity's JID.
|
* @param remote The remote entity's JID.
|
||||||
* @param command The command being executed.
|
* @param command The command being executed.
|
||||||
|
* @param context A user defined context.
|
||||||
*/
|
*/
|
||||||
virtual void handleAdhocExecutionResult( const JID& remote, const Adhoc::Command& command ) = 0;
|
virtual void handleAdhocExecutionResult( const JID& remote, const Adhoc::Command& command, int context ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -28,11 +28,11 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is an implementation of XEP-0079 (Advanced Message Processing)
|
* @brief This is an implementation of @xep{0079} (Advanced Message Processing)
|
||||||
* as a StanzaExtension.
|
* as a StanzaExtension.
|
||||||
*
|
*
|
||||||
* XEP Version: 1.2
|
* XEP Version: 1.2
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @author Vincent Thomasset
|
* @author Vincent Thomasset
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@ -110,7 +110,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* Describes an AMP rule.
|
* Describes an AMP rule.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Rule
|
class GLOOX_API Rule
|
||||||
|
@ -125,7 +125,7 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new AMP rule object with a condition of 'expire-at'.
|
* Creates a new AMP rule object with a condition of 'expire-at'.
|
||||||
* @param date The expiry date/time in the format defined in XEP-0082.
|
* @param date The expiry date/time in the format defined in @xep{0082}.
|
||||||
* @param action The rule's action.
|
* @param action The rule's action.
|
||||||
*/
|
*/
|
||||||
Rule( const std::string& date, ActionType action );
|
Rule( const std::string& date, ActionType action );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -30,7 +30,7 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is an implementation of XEP-0145 (Annotations).
|
* @brief This is an implementation of @xep{0145} (Annotations).
|
||||||
*
|
*
|
||||||
* You can use this class to store arbitrary notes about a roster item on the server
|
* You can use this class to store arbitrary notes about a roster item on the server
|
||||||
* (and to retrieve them later on).
|
* (and to retrieve them later on).
|
||||||
|
@ -88,7 +88,7 @@ namespace gloox
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.3
|
* @since 0.3
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Annotations : public PrivateXML, public PrivateXMLHandler
|
class GLOOX_API Annotations : public PrivateXML, public PrivateXMLHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -43,7 +43,7 @@ namespace gloox
|
||||||
* @brief A virtual interface which can be reimplemented to receive notes with help of
|
* @brief A virtual interface which can be reimplemented to receive notes with help of
|
||||||
* the Annotations object.
|
* the Annotations object.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.3
|
* @since 0.3
|
||||||
*/
|
*/
|
||||||
class GLOOX_API AnnotationsHandler
|
class GLOOX_API AnnotationsHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2009-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2009-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -26,9 +26,9 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is an implementation of XEP-0224 as a StanzaExtension.
|
* @brief This is an implementation of @xep{0224} as a StanzaExtension.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Attention : public StanzaExtension
|
class GLOOX_API Attention : public StanzaExtension
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -24,7 +24,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* @brief An implementation of the Base64 data encoding (RFC 3548)
|
* @brief An implementation of the Base64 data encoding (RFC 3548)
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.8
|
* @since 0.8
|
||||||
*/
|
*/
|
||||||
namespace Base64
|
namespace Base64
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -58,7 +58,7 @@ namespace gloox
|
||||||
* @brief A virtual interface which can be reimplemented to receive bookmarks with help of a
|
* @brief A virtual interface which can be reimplemented to receive bookmarks with help of a
|
||||||
* BookmarkStorage object.
|
* BookmarkStorage object.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.3
|
* @since 0.3
|
||||||
*/
|
*/
|
||||||
class GLOOX_API BookmarkHandler
|
class GLOOX_API BookmarkHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -30,7 +30,7 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is an implementation of XEP-0048 (Bookmark Storage).
|
* @brief This is an implementation of @xep{0048} (Bookmark Storage).
|
||||||
*
|
*
|
||||||
* You can use this class to store bookmarks to multi-user chat rooms or ordinary URLs
|
* You can use this class to store bookmarks to multi-user chat rooms or ordinary URLs
|
||||||
* on the server (and to retrieve them later on).
|
* on the server (and to retrieve them later on).
|
||||||
|
@ -91,7 +91,7 @@ namespace gloox
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.3
|
* @since 0.3
|
||||||
*/
|
*/
|
||||||
class GLOOX_API BookmarkStorage : public PrivateXML, public PrivateXMLHandler
|
class GLOOX_API BookmarkStorage : public PrivateXML, public PrivateXMLHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -30,7 +30,7 @@ namespace gloox
|
||||||
* Used as a base class for InBand Bytestreams as well as SOCKS5 Bytestreams.
|
* Used as a base class for InBand Bytestreams as well as SOCKS5 Bytestreams.
|
||||||
* You should not need to use this class directly.
|
* You should not need to use this class directly.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Bytestream
|
class GLOOX_API Bytestream
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -26,14 +26,14 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A virtual interface that allows implementors to receive data
|
* @brief A virtual interface that allows implementors to receive data
|
||||||
* sent over a SOCKS5 Bytestream as defined in XEP-0066, or an In-Band Bytestream
|
* sent over a SOCKS5 Bytestream as defined in @xep{0066}, or an In-Band Bytestream
|
||||||
* as defined in XEP-0047. You'll also need it for sending of data.
|
* as defined in @xep{0047}. You'll also need it for sending of data.
|
||||||
*
|
*
|
||||||
* An BytestreamDataHandler is registered with a Bytestream.
|
* An BytestreamDataHandler is registered with a Bytestream.
|
||||||
*
|
*
|
||||||
* See SIProfileFT for more information regarding file transfer.
|
* See SIProfileFT for more information regarding file transfer.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API BytestreamDataHandler
|
class GLOOX_API BytestreamDataHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -30,7 +30,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* See SIProfileFT on how to implement file transfer in general.
|
* See SIProfileFT on how to implement file transfer in general.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API BytestreamHandler
|
class GLOOX_API BytestreamHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -27,10 +27,10 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is an implementation of XEP-0115 (Entity Capabilities).
|
* @brief This is an implementation of @xep{0115} (Entity Capabilities).
|
||||||
*
|
*
|
||||||
* XEP Version: 1.5-15
|
* XEP Version: 1.5-15
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Capabilities : public StanzaExtension, public DiscoNodeHandler
|
class GLOOX_API Capabilities : public StanzaExtension, public DiscoNodeHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -32,7 +32,8 @@ namespace gloox
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatState::ChatState( const Tag* tag )
|
ChatState::ChatState( const Tag* tag )
|
||||||
: StanzaExtension( ExtChatState )
|
: StanzaExtension( ExtChatState ),
|
||||||
|
m_state( ChatStateInvalid )
|
||||||
{
|
{
|
||||||
if( tag )
|
if( tag )
|
||||||
m_state = chatStateType( tag->name() );
|
m_state = chatStateType( tag->name() );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -24,10 +24,10 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An implementation of Chat State Notifications (XEP-0085) as a StanzaExtension.
|
* @brief An implementation of Chat State Notifications (@xep{0085}) as a StanzaExtension.
|
||||||
*
|
*
|
||||||
* @author Vincent Thomasset
|
* @author Vincent Thomasset
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ChatState : public StanzaExtension
|
class GLOOX_API ChatState : public StanzaExtension
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -26,7 +26,7 @@ namespace gloox
|
||||||
class Message;
|
class Message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class adds Chat State Notifications (XEP-0085) support to a MessageSession.
|
* @brief This class adds Chat State Notifications (@xep{0085}) support to a MessageSession.
|
||||||
*
|
*
|
||||||
* This implementation of Chat States is fully transparent to the user of the class.
|
* This implementation of Chat States is fully transparent to the user of the class.
|
||||||
* If the remote entity does not request chat states, ChatStateFilter will not send
|
* If the remote entity does not request chat states, ChatStateFilter will not send
|
||||||
|
@ -34,7 +34,10 @@ namespace gloox
|
||||||
* You MUST annouce this capability by use of Disco (associated namespace is XMLNS_CHAT_STATES).
|
* You MUST annouce this capability by use of Disco (associated namespace is XMLNS_CHAT_STATES).
|
||||||
* (This is also required by the protocol specification.)
|
* (This is also required by the protocol specification.)
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @note You must register ChatState as a StanzaExtension by calling
|
||||||
|
* ClientBase::registerStanzaExtension() for notifications to work.
|
||||||
|
*
|
||||||
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.8
|
* @since 0.8
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ChatStateFilter : public MessageFilter
|
class GLOOX_API ChatStateFilter : public MessageFilter
|
||||||
|
@ -52,7 +55,7 @@ namespace gloox
|
||||||
virtual ~ChatStateFilter();
|
virtual ~ChatStateFilter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this function to set a chat state as defined in XEP-0085.
|
* Use this function to set a chat state as defined in @xep{0085}.
|
||||||
* @note The Spec states that Chat States shall not be sent to an entity
|
* @note The Spec states that Chat States shall not be sent to an entity
|
||||||
* which did not request them. Reasonable effort is taken in this function to
|
* which did not request them. Reasonable effort is taken in this function to
|
||||||
* avoid spurious state sending. You should be safe to call this even if Message
|
* avoid spurious state sending. You should be safe to call this even if Message
|
||||||
|
@ -65,7 +68,7 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ChatStateHandler registered here will receive Chat States according
|
* The ChatStateHandler registered here will receive Chat States according
|
||||||
* to XEP-0085.
|
* to @xep{0085}.
|
||||||
* @param csh The ChatStateHandler to register.
|
* @param csh The ChatStateHandler to register.
|
||||||
*/
|
*/
|
||||||
void registerChatStateHandler( ChatStateHandler* csh )
|
void registerChatStateHandler( ChatStateHandler* csh )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -23,9 +23,9 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A virtual interface that enables an object to be notified about
|
* @brief A virtual interface that enables an object to be notified about
|
||||||
* a remote entity's Chat States (XEP-0085).
|
* a remote entity's Chat States (@xep{0085}).
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.8
|
* @since 0.8
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ChatStateHandler
|
class GLOOX_API ChatStateHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -30,8 +30,6 @@
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
namespace gloox
|
namespace gloox
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -107,6 +105,7 @@ namespace gloox
|
||||||
m_rosterManager( 0 ), m_auth( 0 ),
|
m_rosterManager( 0 ), m_auth( 0 ),
|
||||||
m_presence( Presence::Available, JID() ), m_resourceBound( false ),
|
m_presence( Presence::Available, JID() ), m_resourceBound( false ),
|
||||||
m_forceNonSasl( false ), m_manageRoster( true ),
|
m_forceNonSasl( false ), m_manageRoster( true ),
|
||||||
|
m_smId( EmptyString ), m_smLocation( EmptyString ), m_smResume( false ), m_smWanted( false ), m_smMax( 0 ),
|
||||||
m_streamFeatures( 0 )
|
m_streamFeatures( 0 )
|
||||||
{
|
{
|
||||||
m_jid.setServer( server );
|
m_jid.setServer( server );
|
||||||
|
@ -118,6 +117,7 @@ namespace gloox
|
||||||
m_rosterManager( 0 ), m_auth( 0 ),
|
m_rosterManager( 0 ), m_auth( 0 ),
|
||||||
m_presence( Presence::Available, JID() ), m_resourceBound( false ),
|
m_presence( Presence::Available, JID() ), m_resourceBound( false ),
|
||||||
m_forceNonSasl( false ), m_manageRoster( true ),
|
m_forceNonSasl( false ), m_manageRoster( true ),
|
||||||
|
m_smId( EmptyString ), m_smLocation( EmptyString ), m_smResume( false ), m_smWanted( false ), m_smMax( 0 ),
|
||||||
m_streamFeatures( 0 )
|
m_streamFeatures( 0 )
|
||||||
{
|
{
|
||||||
m_jid = jid;
|
m_jid = jid;
|
||||||
|
@ -176,7 +176,11 @@ namespace gloox
|
||||||
{
|
{
|
||||||
if( m_authed )
|
if( m_authed )
|
||||||
{
|
{
|
||||||
if( m_streamFeatures & StreamFeatureBind )
|
if( m_streamFeatures & StreamFeatureStreamManagement && m_smWanted && m_smContext >= CtxSMEnabled )
|
||||||
|
{
|
||||||
|
sendStreamManagement();
|
||||||
|
}
|
||||||
|
else if( m_streamFeatures & StreamFeatureBind && m_smContext < CtxSMEnabled )
|
||||||
{
|
{
|
||||||
notifyStreamEvent( StreamEventResourceBinding );
|
notifyStreamEvent( StreamEventResourceBinding );
|
||||||
bindResource( resource() );
|
bindResource( resource() );
|
||||||
|
@ -290,11 +294,66 @@ namespace gloox
|
||||||
}
|
}
|
||||||
else if( name == "success" && xmlns == XMLNS_STREAM_SASL )
|
else if( name == "success" && xmlns == XMLNS_STREAM_SASL )
|
||||||
{
|
{
|
||||||
|
if( !processSASLSuccess( tag->cdata() ) )
|
||||||
|
{
|
||||||
|
logInstance().err( LogAreaClassClient, "The Server response could not be verified!" );
|
||||||
|
disconnect( ConnAuthenticationFailed );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
logInstance().dbg( LogAreaClassClient, "SASL authentication successful" );
|
logInstance().dbg( LogAreaClassClient, "SASL authentication successful" );
|
||||||
processSASLSuccess();
|
|
||||||
setAuthed( true );
|
setAuthed( true );
|
||||||
header();
|
header();
|
||||||
}
|
}
|
||||||
|
else if( name == "enabled" && xmlns == XMLNS_STREAM_MANAGEMENT )
|
||||||
|
{
|
||||||
|
m_smContext = CtxSMEnabled;
|
||||||
|
m_smMax = atoi( tag->findAttribute( "max" ).c_str() );
|
||||||
|
m_smId = tag->findAttribute( "id" );
|
||||||
|
const std::string res = tag->findAttribute( "resume" );
|
||||||
|
m_smResume = ( ( res == "true" || res == "1" ) && !m_smId.empty() ) ? true : false;
|
||||||
|
m_smLocation = tag->findAttribute( "location" );
|
||||||
|
|
||||||
|
if( m_streamFeatures & StreamFeatureSession )
|
||||||
|
createSession();
|
||||||
|
else
|
||||||
|
connected();
|
||||||
|
}
|
||||||
|
else if( name == "resumed" && xmlns == XMLNS_STREAM_MANAGEMENT && m_smContext == CtxSMResume )
|
||||||
|
{
|
||||||
|
if( tag->findAttribute( "previd" ) == m_smId )
|
||||||
|
{
|
||||||
|
m_smContext = CtxSMResumed;
|
||||||
|
notifyStreamEvent( StreamEventSMResumed );
|
||||||
|
int h = atoi( tag->findAttribute( "h" ).c_str() );
|
||||||
|
connected();
|
||||||
|
checkQueue( h, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( name == "a" && xmlns == XMLNS_STREAM_MANAGEMENT && m_smContext >= CtxSMEnabled )
|
||||||
|
{
|
||||||
|
int h = atoi( tag->findAttribute( "h" ).c_str() );
|
||||||
|
checkQueue( h, false );
|
||||||
|
}
|
||||||
|
else if( name == "r" && xmlns == XMLNS_STREAM_MANAGEMENT )
|
||||||
|
{
|
||||||
|
ackStreamManagement();
|
||||||
|
}
|
||||||
|
else if( name == "failed" && xmlns == XMLNS_STREAM_MANAGEMENT )
|
||||||
|
{
|
||||||
|
switch( m_smContext )
|
||||||
|
{
|
||||||
|
case CtxSMEnable:
|
||||||
|
notifyStreamEvent( StreamEventSMEnableFailed );
|
||||||
|
break;
|
||||||
|
case CtxSMResume:
|
||||||
|
notifyStreamEvent( StreamEventSMResumeFailed );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_smContext = CtxSMFailed;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -333,6 +392,9 @@ namespace gloox
|
||||||
if( tag->hasChild( "compression", XMLNS, XMLNS_STREAM_COMPRESS ) )
|
if( tag->hasChild( "compression", XMLNS, XMLNS_STREAM_COMPRESS ) )
|
||||||
features |= getCompressionMethods( tag->findChild( "compression" ) );
|
features |= getCompressionMethods( tag->findChild( "compression" ) );
|
||||||
|
|
||||||
|
if( tag->hasChild( "sm", XMLNS, XMLNS_STREAM_MANAGEMENT ) )
|
||||||
|
features |= StreamFeatureStreamManagement;
|
||||||
|
|
||||||
if( features == 0 )
|
if( features == 0 )
|
||||||
features = StreamFeatureIqAuth;
|
features = StreamFeatureIqAuth;
|
||||||
|
|
||||||
|
@ -345,6 +407,12 @@ namespace gloox
|
||||||
|
|
||||||
const std::string mech = "mechanism";
|
const std::string mech = "mechanism";
|
||||||
|
|
||||||
|
if( tag->hasChildWithCData( mech, "SCRAM-SHA-1-PLUS" ) )
|
||||||
|
mechs |= SaslMechScramSha1Plus;
|
||||||
|
|
||||||
|
if( tag->hasChildWithCData( mech, "SCRAM-SHA-1" ) )
|
||||||
|
mechs |= SaslMechScramSha1;
|
||||||
|
|
||||||
if( tag->hasChildWithCData( mech, "DIGEST-MD5" ) )
|
if( tag->hasChildWithCData( mech, "DIGEST-MD5" ) )
|
||||||
mechs |= SaslMechDigestMd5;
|
mechs |= SaslMechDigestMd5;
|
||||||
|
|
||||||
|
@ -383,7 +451,20 @@ namespace gloox
|
||||||
{
|
{
|
||||||
bool retval = true;
|
bool retval = true;
|
||||||
|
|
||||||
if( m_streamFeatures & SaslMechDigestMd5 && m_availableSaslMechs & SaslMechDigestMd5
|
if( ( m_streamFeatures & SaslMechScramSha1Plus && m_availableSaslMechs & SaslMechScramSha1Plus
|
||||||
|
&& m_encryption && m_encryptionActive && m_encryption->hasChannelBinding() )
|
||||||
|
&& !m_forceNonSasl )
|
||||||
|
{
|
||||||
|
notifyStreamEvent( StreamEventAuthentication );
|
||||||
|
startSASL( SaslMechScramSha1Plus );
|
||||||
|
}
|
||||||
|
else if( m_streamFeatures & SaslMechScramSha1 && m_availableSaslMechs & SaslMechScramSha1
|
||||||
|
&& !m_forceNonSasl )
|
||||||
|
{
|
||||||
|
notifyStreamEvent( StreamEventAuthentication );
|
||||||
|
startSASL( SaslMechScramSha1 );
|
||||||
|
}
|
||||||
|
else if( m_streamFeatures & SaslMechDigestMd5 && m_availableSaslMechs & SaslMechDigestMd5
|
||||||
&& !m_forceNonSasl )
|
&& !m_forceNonSasl )
|
||||||
{
|
{
|
||||||
notifyStreamEvent( StreamEventAuthentication );
|
notifyStreamEvent( StreamEventAuthentication );
|
||||||
|
@ -438,11 +519,12 @@ namespace gloox
|
||||||
|
|
||||||
bool Client::selectResource( const std::string& resource )
|
bool Client::selectResource( const std::string& resource )
|
||||||
{
|
{
|
||||||
|
m_selectedResource = resource; // TODO: remove for 1.1
|
||||||
|
m_jid.setResource( resource );
|
||||||
|
|
||||||
if( !( m_streamFeatures & StreamFeatureUnbind ) )
|
if( !( m_streamFeatures & StreamFeatureUnbind ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_selectedResource = resource;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,10 +543,12 @@ namespace gloox
|
||||||
|
|
||||||
m_jid = rb->jid();
|
m_jid = rb->jid();
|
||||||
m_resourceBound = true;
|
m_resourceBound = true;
|
||||||
m_selectedResource = m_jid.resource();
|
m_selectedResource = m_jid.resource(); // TODO: remove for 1.1
|
||||||
notifyOnResourceBind( m_jid.resource() );
|
notifyOnResourceBind( m_jid.resource() );
|
||||||
|
|
||||||
if( m_streamFeatures & StreamFeatureSession )
|
if( m_streamFeatures & StreamFeatureStreamManagement && m_smWanted )
|
||||||
|
sendStreamManagement();
|
||||||
|
else if( m_streamFeatures & StreamFeatureSession )
|
||||||
createSession();
|
createSession();
|
||||||
else
|
else
|
||||||
connected();
|
connected();
|
||||||
|
@ -480,6 +564,71 @@ namespace gloox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::setStreamManagement( bool enable, bool resume )
|
||||||
|
{
|
||||||
|
m_smWanted = enable;
|
||||||
|
m_smResume = resume;
|
||||||
|
|
||||||
|
if( !m_smWanted )
|
||||||
|
{
|
||||||
|
m_smId = EmptyString;
|
||||||
|
m_smLocation = EmptyString;
|
||||||
|
m_smMax = 0;
|
||||||
|
m_smResume = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_smWanted && m_resourceBound )
|
||||||
|
sendStreamManagement();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Client::sendStreamManagement()
|
||||||
|
{
|
||||||
|
if( !m_smWanted )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( m_smContext == CtxSMInvalid )
|
||||||
|
{
|
||||||
|
notifyStreamEvent( StreamEventSMEnable );
|
||||||
|
Tag* e = new Tag( "enable" );
|
||||||
|
e->setXmlns( XMLNS_STREAM_MANAGEMENT );
|
||||||
|
if( m_smResume )
|
||||||
|
e->addAttribute( "resume", "true" );
|
||||||
|
send( e );
|
||||||
|
m_smContext = CtxSMEnable;
|
||||||
|
m_smHandled = 0;
|
||||||
|
}
|
||||||
|
else if( m_smContext == CtxSMEnabled )
|
||||||
|
{
|
||||||
|
notifyStreamEvent( StreamEventSMResume );
|
||||||
|
Tag* r = new Tag( "resume" );
|
||||||
|
r->setXmlns( XMLNS_STREAM_MANAGEMENT );
|
||||||
|
r->addAttribute( "h", m_smHandled );
|
||||||
|
r->addAttribute( "previd", m_smId );
|
||||||
|
send( r );
|
||||||
|
m_smContext = CtxSMResume;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Client::ackStreamManagement()
|
||||||
|
{
|
||||||
|
if( m_smContext >= CtxSMEnabled )
|
||||||
|
{
|
||||||
|
Tag* a = new Tag( "a", "xmlns", XMLNS_STREAM_MANAGEMENT );
|
||||||
|
a->addAttribute( "h", m_smHandled );
|
||||||
|
send( a );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Client::reqStreamManagement()
|
||||||
|
{
|
||||||
|
if( m_smContext >= CtxSMEnabled )
|
||||||
|
{
|
||||||
|
Tag* r = new Tag( "r", "xmlns", XMLNS_STREAM_MANAGEMENT );
|
||||||
|
send( r );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Client::createSession()
|
void Client::createSession()
|
||||||
{
|
{
|
||||||
notifyStreamEvent( StreamEventSessionCreation );
|
notifyStreamEvent( StreamEventSessionCreation );
|
||||||
|
@ -556,7 +705,7 @@ namespace gloox
|
||||||
|
|
||||||
void Client::connected()
|
void Client::connected()
|
||||||
{
|
{
|
||||||
if( m_authed )
|
if( m_authed && m_smContext != CtxSMResumed )
|
||||||
{
|
{
|
||||||
if( m_manageRoster )
|
if( m_manageRoster )
|
||||||
{
|
{
|
||||||
|
@ -582,6 +731,14 @@ namespace gloox
|
||||||
|
|
||||||
void Client::disconnect()
|
void Client::disconnect()
|
||||||
{
|
{
|
||||||
|
m_smContext = CtxSMInvalid;
|
||||||
|
m_smHandled = 0;
|
||||||
|
m_smId = EmptyString;
|
||||||
|
m_smLocation = EmptyString;
|
||||||
|
m_smMax = 0;
|
||||||
|
m_smResume = false;
|
||||||
|
m_smWanted = false;
|
||||||
|
|
||||||
disconnect( ConnUserDisconnected );
|
disconnect( ConnUserDisconnected );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -28,7 +28,7 @@ namespace gloox
|
||||||
class IQ;
|
class IQ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class implements a basic Jabber Client.
|
* @brief This class implements a basic Jabber/XMPP Client.
|
||||||
*
|
*
|
||||||
* It supports @ref sasl_auth as well as TLS (Encryption), which can be
|
* It supports @ref sasl_auth as well as TLS (Encryption), which can be
|
||||||
* switched on/off separately. They are used automatically if the server supports them.
|
* switched on/off separately. They are used automatically if the server supports them.
|
||||||
|
@ -36,7 +36,7 @@ namespace gloox
|
||||||
* To use, create a new Client instance and feed it connection credentials, either in the Constructor or
|
* To use, create a new Client instance and feed it connection credentials, either in the Constructor or
|
||||||
* afterwards using the setters. You should then register packet handlers implementing the corresponding
|
* afterwards using the setters. You should then register packet handlers implementing the corresponding
|
||||||
* Interfaces (ConnectionListener, PresenceHandler, MessageHandler, IqHandler, SubscriptionHandler),
|
* Interfaces (ConnectionListener, PresenceHandler, MessageHandler, IqHandler, SubscriptionHandler),
|
||||||
* and call @ref connect() to establish the connection to the server.<br>
|
* and call @ref connect() to establish the connection to the server.
|
||||||
*
|
*
|
||||||
* @note While the MessageHandler interface is still available (and will be in future versions)
|
* @note While the MessageHandler interface is still available (and will be in future versions)
|
||||||
* it is now recommended to use the new @link gloox::MessageSession MessageSession @endlink for any
|
* it is now recommended to use the new @link gloox::MessageSession MessageSession @endlink for any
|
||||||
|
@ -67,9 +67,9 @@ namespace gloox
|
||||||
* include:
|
* include:
|
||||||
* @li jabber:iq:roster: by default the server-side roster is fetched and handled. Use
|
* @li jabber:iq:roster: by default the server-side roster is fetched and handled. Use
|
||||||
* @ref rosterManager() and @ref RosterManager to interact with the Roster.
|
* @ref rosterManager() and @ref RosterManager to interact with the Roster.
|
||||||
* @li XEP-0092 (Software Version): If no version is specified, a name of "based on gloox" with
|
* @li @xep{0092} (Software Version): If no version is specified, a name of "based on gloox" with
|
||||||
* gloox's current version is announced.
|
* gloox's current version is announced.
|
||||||
* @li XEP-0030 (Service Discovery): All supported/available services are announced. No items are
|
* @li @xep{0030} (Service Discovery): All supported/available services are announced. No items are
|
||||||
* returned.
|
* returned.
|
||||||
* @note As of gloox 0.9, by default a priority of 0 is sent along with the initial presence.
|
* @note As of gloox 0.9, by default a priority of 0 is sent along with the initial presence.
|
||||||
* @note As of gloox 0.9, initial presence is automatically sent. Presence: available, Priority: 0.
|
* @note As of gloox 0.9, initial presence is automatically sent. Presence: available, Priority: 0.
|
||||||
|
@ -78,7 +78,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* @section sasl_auth SASL Authentication
|
* @section sasl_auth SASL Authentication
|
||||||
*
|
*
|
||||||
* Besides the simple, IQ-based authentication (XEP-0078), gloox supports several SASL (Simple
|
* Besides the simple, IQ-based authentication (@xep{0078}), gloox supports several SASL (Simple
|
||||||
* Authentication and Security Layer, RFC 2222) authentication mechanisms.
|
* Authentication and Security Layer, RFC 2222) authentication mechanisms.
|
||||||
* @li DIGEST-MD5: This mechanism is preferred over all other mechanisms if username and password are
|
* @li DIGEST-MD5: This mechanism is preferred over all other mechanisms if username and password are
|
||||||
* provided to the Client instance. It is secure even without TLS encryption.
|
* provided to the Client instance. It is secure even without TLS encryption.
|
||||||
|
@ -93,7 +93,25 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* Of course, all these mechanisms are not tried unless the server offers them.
|
* Of course, all these mechanisms are not tried unless the server offers them.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @section stream_management Stream Management
|
||||||
|
*
|
||||||
|
* To enable Stream Management (@xep{0198}), call @ref setStreamManagement() with the first parameter set to @b true
|
||||||
|
* at any time. This will tell the server to enable Stream Management, if the feature is available. Once switched on,
|
||||||
|
* Stream Management can not be disabled for a given active stream. However, setting the first
|
||||||
|
* parameter to @b false, it can be disabled inside gloox so that Stream Management will not be used
|
||||||
|
* for subsequent connections.
|
||||||
|
*
|
||||||
|
* To enable the stream resumption feature, pass @b true as the second parameter to @ref setStreamManagement().
|
||||||
|
* Upon re-connect after an unexpected (i.e. neither user-triggered nor server-triggered) disconnect, gloox will try
|
||||||
|
* to resume the stream and re-send any non-acknowledged stanzas automatically.
|
||||||
|
* For stream resumption to work you have to re-connect using the very same Client instance.
|
||||||
|
*
|
||||||
|
* After an unexpected disconnect you may check the send queue using @link ClientBase::sendQueue() sendQueue() @endlink.
|
||||||
|
* Stanzas in the queue have been sent but not yet acknowledged by the server. Depending on the circumstances of the
|
||||||
|
* disconnect, this does not mean that those stanzas have not been received by the recipient.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Client : public ClientBase
|
class GLOOX_API Client : public ClientBase
|
||||||
{
|
{
|
||||||
|
@ -149,7 +167,7 @@ namespace gloox
|
||||||
* Use this function to select a resource identifier that has been bound
|
* Use this function to select a resource identifier that has been bound
|
||||||
* previously by means of bindResource(). It is not necessary to call this function
|
* previously by means of bindResource(). It is not necessary to call this function
|
||||||
* if only one resource is bound. Use hasResourceBind() to find out if the
|
* if only one resource is bound. Use hasResourceBind() to find out if the
|
||||||
* server supports binding of multiple resources. selectResource() is a NOOP if it doesn't.
|
* server supports binding of multiple resources.
|
||||||
* @param resource A resource string that has been bound previously.
|
* @param resource A resource string that has been bound previously.
|
||||||
* @note If the resource string has not been bound previously, future sending of
|
* @note If the resource string has not been bound previously, future sending of
|
||||||
* stanzas will fail.
|
* stanzas will fail.
|
||||||
|
@ -181,6 +199,39 @@ namespace gloox
|
||||||
*/
|
*/
|
||||||
const std::string& resource() const { return m_jid.resource(); }
|
const std::string& resource() const { return m_jid.resource(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function enables Stream Management (@xep{0198}) if the server supports it.
|
||||||
|
* Optionally, stream resumption can be disabled.
|
||||||
|
* @note You can use this function at any time. However, gloox will make sure Stream Management
|
||||||
|
* requests are sent only when allowed by the specification.
|
||||||
|
* @param enable Enable or disable Stream Management. Note: once enabled on a connection, Stream
|
||||||
|
* Management can not be disabled for that connection.
|
||||||
|
* @param resume Tells the server whether to enable stream resumption. Defaults to @b true.
|
||||||
|
* @note This function is part of @xep{0198}.
|
||||||
|
* @since 1.0.4
|
||||||
|
*/
|
||||||
|
void setStreamManagement( bool enable = true, bool resume = true );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to send an unrequested 'ack' to the server to let it know the number of handled stanzas.
|
||||||
|
* You may use this function at any time. However, gloox will also reply to incoming 'ack requests' automatically.
|
||||||
|
* These automatic 'acks' are not announced anywhere in gloox.
|
||||||
|
* This function is a no-op if called in situations where sending an ack is not
|
||||||
|
* allowed by the protocol.
|
||||||
|
* @note This function is part of @xep{0198}.
|
||||||
|
* @since 1.0.4
|
||||||
|
*/
|
||||||
|
void ackStreamManagement();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to request the number of handled stanzas from the server.
|
||||||
|
* You may use this function at any time. gloox does not send any such requests
|
||||||
|
* automatically.
|
||||||
|
* @note This function is part of @xep{0198}.
|
||||||
|
* @since 1.0.4
|
||||||
|
*/
|
||||||
|
void reqStreamManagement();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current priority.
|
* Returns the current priority.
|
||||||
* @return The priority of the current resource.
|
* @return The priority of the current resource.
|
||||||
|
@ -288,10 +339,13 @@ namespace gloox
|
||||||
void nonSaslLogin();
|
void nonSaslLogin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef CLIENT_TEST
|
||||||
|
public:
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* @brief This is an implementation of a resource binding StanzaExtension.
|
* @brief This is an implementation of a resource binding StanzaExtension.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class ResourceBind : public StanzaExtension
|
class ResourceBind : public StanzaExtension
|
||||||
|
@ -363,7 +417,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* @brief This is an implementation of a session creating StanzaExtension.
|
* @brief This is an implementation of a session creating StanzaExtension.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class SessionCreation : public StanzaExtension
|
class SessionCreation : public StanzaExtension
|
||||||
|
@ -396,7 +450,7 @@ namespace gloox
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void handleStartNode() {}
|
virtual void handleStartNode( const Tag* /*start*/ ) {}
|
||||||
virtual bool handleNormalNode( Tag* tag );
|
virtual bool handleNormalNode( Tag* tag );
|
||||||
virtual void disconnect( ConnectionError reason );
|
virtual void disconnect( ConnectionError reason );
|
||||||
virtual void handleIqIDForward( const IQ& iq, int context );
|
virtual void handleIqIDForward( const IQ& iq, int context );
|
||||||
|
@ -413,6 +467,7 @@ namespace gloox
|
||||||
virtual void rosterFilled();
|
virtual void rosterFilled();
|
||||||
virtual void cleanup();
|
virtual void cleanup();
|
||||||
bool bindOperation( const std::string& resource, bool bind );
|
bool bindOperation( const std::string& resource, bool bind );
|
||||||
|
void sendStreamManagement();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
@ -432,6 +487,12 @@ namespace gloox
|
||||||
bool m_forceNonSasl;
|
bool m_forceNonSasl;
|
||||||
bool m_manageRoster;
|
bool m_manageRoster;
|
||||||
|
|
||||||
|
std::string m_smId;
|
||||||
|
std::string m_smLocation;
|
||||||
|
bool m_smResume;
|
||||||
|
bool m_smWanted;
|
||||||
|
int m_smMax;
|
||||||
|
|
||||||
int m_streamFeatures;
|
int m_streamFeatures;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -14,38 +14,41 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "base64.h"
|
||||||
#include "clientbase.h"
|
#include "clientbase.h"
|
||||||
#include "connectionbase.h"
|
|
||||||
#include "tlsbase.h"
|
|
||||||
#include "compressionbase.h"
|
#include "compressionbase.h"
|
||||||
|
#include "compressionzlib.h"
|
||||||
|
#include "connectionbase.h"
|
||||||
|
#include "connectionlistener.h"
|
||||||
#include "connectiontcpclient.h"
|
#include "connectiontcpclient.h"
|
||||||
#include "disco.h"
|
#include "disco.h"
|
||||||
#include "messagesessionhandler.h"
|
|
||||||
#include "tag.h"
|
|
||||||
#include "iq.h"
|
|
||||||
#include "message.h"
|
|
||||||
#include "subscription.h"
|
|
||||||
#include "presence.h"
|
|
||||||
#include "connectionlistener.h"
|
|
||||||
#include "iqhandler.h"
|
|
||||||
#include "messagehandler.h"
|
|
||||||
#include "presencehandler.h"
|
|
||||||
#include "rosterlistener.h"
|
|
||||||
#include "subscriptionhandler.h"
|
|
||||||
#include "loghandler.h"
|
|
||||||
#include "taghandler.h"
|
|
||||||
#include "mucinvitationhandler.h"
|
|
||||||
#include "mucroom.h"
|
|
||||||
#include "jid.h"
|
|
||||||
#include "base64.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "md5.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "tlsdefault.h"
|
|
||||||
#include "compressionzlib.h"
|
|
||||||
#include "stanzaextensionfactory.h"
|
|
||||||
#include "eventhandler.h"
|
#include "eventhandler.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
#include "iq.h"
|
||||||
|
#include "iqhandler.h"
|
||||||
|
#include "jid.h"
|
||||||
|
#include "loghandler.h"
|
||||||
|
#include "md5.h"
|
||||||
|
#include "message.h"
|
||||||
|
#include "messagehandler.h"
|
||||||
|
#include "messagesessionhandler.h"
|
||||||
|
#include "mucinvitationhandler.h"
|
||||||
|
#include "mucroom.h"
|
||||||
|
#include "mutexguard.h"
|
||||||
|
#include "presence.h"
|
||||||
|
#include "presencehandler.h"
|
||||||
|
#include "rosterlistener.h"
|
||||||
|
#include "stanzaextensionfactory.h"
|
||||||
|
#include "sha.h"
|
||||||
|
#include "subscription.h"
|
||||||
|
#include "subscriptionhandler.h"
|
||||||
|
#include "tag.h"
|
||||||
|
#include "taghandler.h"
|
||||||
|
#include "tlsbase.h"
|
||||||
|
#include "tlsdefault.h"
|
||||||
|
#include "prep.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -60,6 +63,11 @@
|
||||||
|
|
||||||
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
# ifdef __MINGW32__
|
||||||
|
# ifndef SecureZeroMemory
|
||||||
|
# define SecureZeroMemory(p,s) RtlFillMemory((p),(s),0)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace gloox
|
namespace gloox
|
||||||
|
@ -87,13 +95,15 @@ namespace gloox
|
||||||
: m_connection( 0 ), m_encryption( 0 ), m_compression( 0 ), m_disco( 0 ), m_namespace( ns ),
|
: m_connection( 0 ), m_encryption( 0 ), m_compression( 0 ), m_disco( 0 ), m_namespace( ns ),
|
||||||
m_xmllang( "en" ), m_server( server ), m_compressionActive( false ), m_encryptionActive( false ),
|
m_xmllang( "en" ), m_server( server ), m_compressionActive( false ), m_encryptionActive( false ),
|
||||||
m_compress( true ), m_authed( false ), m_block( false ), m_sasl( true ), m_tls( TLSOptional ), m_port( port ),
|
m_compress( true ), m_authed( false ), m_block( false ), m_sasl( true ), m_tls( TLSOptional ), m_port( port ),
|
||||||
m_availableSaslMechs( SaslMechAll ),
|
m_availableSaslMechs( SaslMechAll ), m_smContext( CtxSMInvalid ), m_smHandled( 0 ),
|
||||||
m_statisticsHandler( 0 ), m_mucInvitationHandler( 0 ),
|
m_statisticsHandler( 0 ), m_mucInvitationHandler( 0 ),
|
||||||
m_messageSessionHandlerChat( 0 ), m_messageSessionHandlerGroupchat( 0 ),
|
m_messageSessionHandlerChat( 0 ), m_messageSessionHandlerGroupchat( 0 ),
|
||||||
m_messageSessionHandlerHeadline( 0 ), m_messageSessionHandlerNormal( 0 ),
|
m_messageSessionHandlerHeadline( 0 ), m_messageSessionHandlerNormal( 0 ),
|
||||||
m_parser( this ), m_seFactory( 0 ), m_authError( AuthErrorUndefined ),
|
m_parser( this ), m_seFactory( 0 ), m_authError( AuthErrorUndefined ),
|
||||||
m_streamError( StreamErrorUndefined ), m_streamErrorAppCondition( 0 ),
|
m_streamError( StreamErrorUndefined ), m_streamErrorAppCondition( 0 ),
|
||||||
m_selectedSaslMech( SaslMechNone ), m_autoMessageSession( false )
|
m_selectedSaslMech( SaslMechNone ), m_customConnection( false ),
|
||||||
|
m_uniqueBaseId( (unsigned int)( ( (unsigned long long)time( 0 ) & 0xFFFF ) << 16 ) | ( ( (unsigned long long) & m_nextId ) & 0xFFFF ) ),
|
||||||
|
m_smSent( 0 )
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -104,19 +114,23 @@ namespace gloox
|
||||||
m_password( password ),
|
m_password( password ),
|
||||||
m_xmllang( "en" ), m_server( server ), m_compressionActive( false ), m_encryptionActive( false ),
|
m_xmllang( "en" ), m_server( server ), m_compressionActive( false ), m_encryptionActive( false ),
|
||||||
m_compress( true ), m_authed( false ), m_block( false ), m_sasl( true ), m_tls( TLSOptional ),
|
m_compress( true ), m_authed( false ), m_block( false ), m_sasl( true ), m_tls( TLSOptional ),
|
||||||
m_port( port ), m_availableSaslMechs( SaslMechAll ),
|
m_port( port ), m_availableSaslMechs( SaslMechAll ), m_smContext( CtxSMInvalid ), m_smHandled( 0 ),
|
||||||
m_statisticsHandler( 0 ), m_mucInvitationHandler( 0 ),
|
m_statisticsHandler( 0 ), m_mucInvitationHandler( 0 ),
|
||||||
m_messageSessionHandlerChat( 0 ), m_messageSessionHandlerGroupchat( 0 ),
|
m_messageSessionHandlerChat( 0 ), m_messageSessionHandlerGroupchat( 0 ),
|
||||||
m_messageSessionHandlerHeadline( 0 ), m_messageSessionHandlerNormal( 0 ),
|
m_messageSessionHandlerHeadline( 0 ), m_messageSessionHandlerNormal( 0 ),
|
||||||
m_parser( this ), m_seFactory( 0 ), m_authError( AuthErrorUndefined ),
|
m_parser( this ), m_seFactory( 0 ), m_authError( AuthErrorUndefined ),
|
||||||
m_streamError( StreamErrorUndefined ), m_streamErrorAppCondition( 0 ),
|
m_streamError( StreamErrorUndefined ), m_streamErrorAppCondition( 0 ),
|
||||||
m_selectedSaslMech( SaslMechNone ), m_autoMessageSession( false )
|
m_selectedSaslMech( SaslMechNone ), m_customConnection( false ),
|
||||||
|
m_uniqueBaseId( (unsigned int)( ( (unsigned long long)time( 0 ) & 0xFFFF ) << 16 ) | ( ( (unsigned long long) & m_nextId ) & 0xFFFF ) ),
|
||||||
|
m_smSent( 0 )
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::init()
|
void ClientBase::init()
|
||||||
{
|
{
|
||||||
|
srand( time( 0 ) );
|
||||||
|
|
||||||
if( !m_disco )
|
if( !m_disco )
|
||||||
{
|
{
|
||||||
m_disco = new Disco( this );
|
m_disco = new Disco( this );
|
||||||
|
@ -136,9 +150,20 @@ namespace gloox
|
||||||
|
|
||||||
ClientBase::~ClientBase()
|
ClientBase::~ClientBase()
|
||||||
{
|
{
|
||||||
delete m_connection;
|
m_iqHandlerMapMutex.lock();
|
||||||
delete m_encryption;
|
m_iqIDHandlers.clear();
|
||||||
delete m_compression;
|
m_iqHandlerMapMutex.unlock();
|
||||||
|
|
||||||
|
m_iqExtHandlerMapMutex.lock();
|
||||||
|
m_iqExtHandlers.clear();
|
||||||
|
m_iqExtHandlerMapMutex.unlock();
|
||||||
|
|
||||||
|
util::clearList( m_presenceExtensions );
|
||||||
|
util::clearMap( m_smQueue );
|
||||||
|
|
||||||
|
setConnectionImpl( 0 );
|
||||||
|
setEncryptionImpl( 0 );
|
||||||
|
setCompressionImpl( 0 );
|
||||||
delete m_seFactory;
|
delete m_seFactory;
|
||||||
m_seFactory = 0; // to avoid usage when Disco gets deleted below
|
m_seFactory = 0; // to avoid usage when Disco gets deleted below
|
||||||
delete m_disco;
|
delete m_disco;
|
||||||
|
@ -177,7 +202,7 @@ namespace gloox
|
||||||
m_compression = getDefaultCompression();
|
m_compression = getDefaultCompression();
|
||||||
|
|
||||||
m_logInstance.dbg( LogAreaClassClientbase, "This is gloox " + GLOOX_VERSION + ", connecting to "
|
m_logInstance.dbg( LogAreaClassClientbase, "This is gloox " + GLOOX_VERSION + ", connecting to "
|
||||||
+ m_server + ":" + util::int2string( m_port ) + "..." );
|
+ m_server + ( ( m_customConnection )?( " using a custom connection" ):( m_port > 0 ? ( ":" + util::int2string( m_port ) ) : EmptyString ) ) + "..." );
|
||||||
m_block = block;
|
m_block = block;
|
||||||
ConnectionError ret = m_connection->connect();
|
ConnectionError ret = m_connection->connect();
|
||||||
if( ret != ConnNoError )
|
if( ret != ConnNoError )
|
||||||
|
@ -213,7 +238,7 @@ namespace gloox
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sid = tag->findAttribute( "id" );
|
m_sid = tag->findAttribute( "id" );
|
||||||
handleStartNode();
|
handleStartNode( tag );
|
||||||
}
|
}
|
||||||
else if( tag->name() == "error" && tag->xmlns() == XMLNS_STREAM )
|
else if( tag->name() == "error" && tag->xmlns() == XMLNS_STREAM )
|
||||||
{
|
{
|
||||||
|
@ -230,15 +255,23 @@ namespace gloox
|
||||||
{
|
{
|
||||||
IQ iq( tag );
|
IQ iq( tag );
|
||||||
m_seFactory->addExtensions( iq, tag );
|
m_seFactory->addExtensions( iq, tag );
|
||||||
|
if( iq.hasEmbeddedStanza() )
|
||||||
|
m_seFactory->addExtensions( *iq.embeddedStanza(), iq.embeddedTag() );
|
||||||
notifyIqHandlers( iq );
|
notifyIqHandlers( iq );
|
||||||
++m_stats.iqStanzasReceived;
|
++m_stats.iqStanzasReceived;
|
||||||
|
if( m_smContext >= CtxSMEnabled )
|
||||||
|
++m_smHandled;
|
||||||
}
|
}
|
||||||
else if( tag->name() == "message" )
|
else if( tag->name() == "message" )
|
||||||
{
|
{
|
||||||
Message msg( tag );
|
Message msg( tag );
|
||||||
m_seFactory->addExtensions( msg, tag );
|
m_seFactory->addExtensions( msg, tag );
|
||||||
|
if( msg.hasEmbeddedStanza() )
|
||||||
|
m_seFactory->addExtensions( *msg.embeddedStanza(), msg.embeddedTag() );
|
||||||
notifyMessageHandlers( msg );
|
notifyMessageHandlers( msg );
|
||||||
++m_stats.messageStanzasReceived;
|
++m_stats.messageStanzasReceived;
|
||||||
|
if( m_smContext >= CtxSMEnabled )
|
||||||
|
++m_smHandled;
|
||||||
}
|
}
|
||||||
else if( tag->name() == "presence" )
|
else if( tag->name() == "presence" )
|
||||||
{
|
{
|
||||||
|
@ -248,6 +281,8 @@ namespace gloox
|
||||||
{
|
{
|
||||||
Subscription sub( tag );
|
Subscription sub( tag );
|
||||||
m_seFactory->addExtensions( sub, tag );
|
m_seFactory->addExtensions( sub, tag );
|
||||||
|
if( sub.hasEmbeddedStanza() )
|
||||||
|
m_seFactory->addExtensions( *sub.embeddedStanza(), sub.embeddedTag() );
|
||||||
notifySubscriptionHandlers( sub );
|
notifySubscriptionHandlers( sub );
|
||||||
++m_stats.s10nStanzasReceived;
|
++m_stats.s10nStanzasReceived;
|
||||||
}
|
}
|
||||||
|
@ -255,12 +290,16 @@ namespace gloox
|
||||||
{
|
{
|
||||||
Presence pres( tag );
|
Presence pres( tag );
|
||||||
m_seFactory->addExtensions( pres, tag );
|
m_seFactory->addExtensions( pres, tag );
|
||||||
|
if( pres.hasEmbeddedStanza() )
|
||||||
|
m_seFactory->addExtensions( *pres.embeddedStanza(), pres.embeddedTag() );
|
||||||
notifyPresenceHandlers( pres );
|
notifyPresenceHandlers( pres );
|
||||||
++m_stats.presenceStanzasReceived;
|
++m_stats.presenceStanzasReceived;
|
||||||
}
|
}
|
||||||
|
if( m_smContext >= CtxSMEnabled )
|
||||||
|
++m_smHandled;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_logInstance.err( LogAreaClassClientbase, "Received invalid stanza." );
|
m_logInstance.err( LogAreaClassClientbase, "Invalid stanza received: " + tag->name() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -377,8 +416,13 @@ namespace gloox
|
||||||
|
|
||||||
m_encryptionActive = false;
|
m_encryptionActive = false;
|
||||||
m_compressionActive = false;
|
m_compressionActive = false;
|
||||||
|
m_smSent = 0;
|
||||||
|
|
||||||
notifyOnDisconnect( reason );
|
notifyOnDisconnect( reason );
|
||||||
|
|
||||||
|
#ifdef CLIENTBASE_TEST
|
||||||
|
m_nextId.reset();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::parse( const std::string& data )
|
void ClientBase::parse( const std::string& data )
|
||||||
|
@ -442,6 +486,40 @@ namespace gloox
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
|
case SaslMechScramSha1Plus:
|
||||||
|
case SaslMechScramSha1:
|
||||||
|
{
|
||||||
|
if( type == SaslMechScramSha1 )
|
||||||
|
{
|
||||||
|
if( ( m_availableSaslMechs & SaslMechScramSha1Plus ) != SaslMechScramSha1Plus )
|
||||||
|
m_gs2Header = "y,";
|
||||||
|
else
|
||||||
|
m_gs2Header = "n,";
|
||||||
|
a->addAttribute( "mechanism", "SCRAM-SHA-1" );
|
||||||
|
}
|
||||||
|
else // SaslMechScramSha1Plus
|
||||||
|
{
|
||||||
|
m_gs2Header = "p=tls-unique,";
|
||||||
|
a->addAttribute( "mechanism", "SCRAM-SHA-1-PLUS" );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string t;
|
||||||
|
if( m_authzid && prep::saslprep( m_authzid.bare(), t ) )
|
||||||
|
m_gs2Header += "a=" + t;
|
||||||
|
|
||||||
|
m_gs2Header += ",";
|
||||||
|
|
||||||
|
m_clientFirstMessageBare = "n=";
|
||||||
|
if( !m_authcid.empty() && prep::saslprep( m_authcid, t ) )
|
||||||
|
m_clientFirstMessageBare += t;
|
||||||
|
else if( prep::saslprep( m_jid.username(), t ) )
|
||||||
|
m_clientFirstMessageBare += t;
|
||||||
|
|
||||||
|
m_clientFirstMessageBare += ",r=" + getRandom();
|
||||||
|
|
||||||
|
a->setCData( Base64::encode64( m_gs2Header + m_clientFirstMessageBare ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SaslMechDigestMd5:
|
case SaslMechDigestMd5:
|
||||||
a->addAttribute( "mechanism", "DIGEST-MD5" );
|
a->addAttribute( "mechanism", "DIGEST-MD5" );
|
||||||
break;
|
break;
|
||||||
|
@ -495,20 +573,70 @@ namespace gloox
|
||||||
{
|
{
|
||||||
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
a->addAttribute( "mechanism", "NTLM" );
|
a->addAttribute( "mechanism", "NTLM" );
|
||||||
SEC_WINNT_AUTH_IDENTITY identity, *ident = 0;
|
SEC_WINNT_AUTH_IDENTITY_W identity, *ident = 0;
|
||||||
memset( &identity, 0, sizeof( identity ) );
|
memset( &identity, 0, sizeof( identity ) );
|
||||||
|
|
||||||
|
WCHAR *usernameW = 0, *domainW = 0, *passwordW = 0;
|
||||||
|
int cchUsernameW = 0, cchDomainW = 0, cchPasswordW = 0;
|
||||||
|
|
||||||
if( m_jid.username().length() > 0 )
|
if( m_jid.username().length() > 0 )
|
||||||
{
|
{
|
||||||
identity.User = (unsigned char*)m_jid.username().c_str();
|
// NOTE: The return values of MultiByteToWideChar will include room
|
||||||
identity.UserLength = (unsigned long)m_jid.username().length();
|
// for the NUL character since we use -1 for the input length.
|
||||||
identity.Domain = (unsigned char*)m_ntlmDomain.c_str();
|
|
||||||
identity.DomainLength = (unsigned long)m_ntlmDomain.length();
|
cchUsernameW = ::MultiByteToWideChar( CP_UTF8, 0, m_jid.username().c_str(), -1, 0, 0 );
|
||||||
identity.Password = (unsigned char*)m_password.c_str();
|
if( cchUsernameW > 0 )
|
||||||
identity.PasswordLength = (unsigned long)m_password.length();
|
{
|
||||||
|
usernameW = new WCHAR[cchUsernameW];
|
||||||
|
::MultiByteToWideChar( CP_UTF8, 0, m_jid.username().c_str(), -1, usernameW, cchUsernameW );
|
||||||
|
// Guarantee its NUL terminated.
|
||||||
|
usernameW[cchUsernameW-1] = L'\0';
|
||||||
|
}
|
||||||
|
cchDomainW = ::MultiByteToWideChar( CP_UTF8, 0, m_ntlmDomain.c_str(), -1, 0, 0 );
|
||||||
|
if( cchDomainW > 0 )
|
||||||
|
{
|
||||||
|
domainW = new WCHAR[cchDomainW];
|
||||||
|
::MultiByteToWideChar( CP_UTF8, 0, m_ntlmDomain.c_str(), -1, domainW, cchDomainW );
|
||||||
|
// Guarantee its NUL terminated.
|
||||||
|
domainW[cchDomainW-1] = L'\0';
|
||||||
|
}
|
||||||
|
cchPasswordW = ::MultiByteToWideChar( CP_UTF8, 0, m_password.c_str(), -1, 0, 0 );
|
||||||
|
if( cchPasswordW > 0 )
|
||||||
|
{
|
||||||
|
passwordW = new WCHAR[cchPasswordW];
|
||||||
|
::MultiByteToWideChar( CP_UTF8, 0, m_password.c_str(), -1, passwordW, cchPasswordW );
|
||||||
|
// Guarantee its NUL terminated.
|
||||||
|
passwordW[cchPasswordW-1] = L'\0';
|
||||||
|
}
|
||||||
|
identity.User = (unsigned short*)usernameW;
|
||||||
|
identity.UserLength = (unsigned long)cchUsernameW-1;
|
||||||
|
identity.Domain = (unsigned short*)domainW;
|
||||||
|
identity.DomainLength = (unsigned long)cchDomainW-1;
|
||||||
|
identity.Password = (unsigned short*)passwordW;
|
||||||
|
identity.PasswordLength = (unsigned long)cchPasswordW-1;
|
||||||
identity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
identity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
||||||
ident = &identity;
|
ident = &identity;
|
||||||
}
|
}
|
||||||
AcquireCredentialsHandle( 0, _T( "NTLM" ), SECPKG_CRED_OUTBOUND, 0, ident, 0, 0, &m_credHandle, 0 );
|
|
||||||
|
AcquireCredentialsHandleW( 0, L"NTLM", SECPKG_CRED_OUTBOUND, 0, ident, 0, 0, &m_credHandle, 0 );
|
||||||
|
|
||||||
|
if( usernameW != 0 )
|
||||||
|
{
|
||||||
|
delete[] usernameW;
|
||||||
|
usernameW = 0;
|
||||||
|
}
|
||||||
|
if( domainW != 0 )
|
||||||
|
{
|
||||||
|
delete[] domainW;
|
||||||
|
domainW = 0;
|
||||||
|
}
|
||||||
|
if( passwordW != 0 )
|
||||||
|
{
|
||||||
|
::SecureZeroMemory( passwordW, cchPasswordW* sizeof( WCHAR ) );
|
||||||
|
delete[] passwordW;
|
||||||
|
passwordW = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
logInstance().err( LogAreaClassClientbase,
|
logInstance().err( LogAreaClassClientbase,
|
||||||
"SASL NTLM is not supported on this platform. You should never see this." );
|
"SASL NTLM is not supported on this platform. You should never see this." );
|
||||||
|
@ -522,6 +650,52 @@ namespace gloox
|
||||||
send( a );
|
send( a );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ClientBase::hmac( const std::string& key, const std::string& str )
|
||||||
|
{
|
||||||
|
SHA sha;
|
||||||
|
std::string key_ = key;
|
||||||
|
if( key_.length() > 64 )
|
||||||
|
{
|
||||||
|
sha.feed( key_ );
|
||||||
|
key_ = sha.binary();
|
||||||
|
sha.reset();
|
||||||
|
}
|
||||||
|
unsigned char ipad[65];
|
||||||
|
unsigned char opad[65];
|
||||||
|
memset( ipad, '\0', sizeof( ipad ) );
|
||||||
|
memset( opad, '\0', sizeof( opad ) );
|
||||||
|
memcpy( ipad, key_.c_str(), key_.length() );
|
||||||
|
memcpy( opad, key_.c_str(), key_.length() );
|
||||||
|
for( int i = 0; i < 64; i++ )
|
||||||
|
{
|
||||||
|
ipad[i] ^= 0x36;
|
||||||
|
opad[i] ^= 0x5c;
|
||||||
|
}
|
||||||
|
sha.feed( ipad, 64 );
|
||||||
|
sha.feed( str );
|
||||||
|
key_ = sha.binary();
|
||||||
|
sha.reset();
|
||||||
|
sha.feed( opad, 64 );
|
||||||
|
sha.feed( key_ );
|
||||||
|
|
||||||
|
return sha.binary(); // hex() for testing
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ClientBase::hi( const std::string& str, const std::string& salt, int iter )
|
||||||
|
{
|
||||||
|
unsigned char xored[20];
|
||||||
|
memset( xored, '\0', sizeof( xored ) );
|
||||||
|
std::string tmp = salt;
|
||||||
|
tmp.append( "\0\0\0\1", 4 );
|
||||||
|
for( int i = 0; i < iter; ++i )
|
||||||
|
{
|
||||||
|
tmp = hmac( str, tmp );
|
||||||
|
for( int j = 0; j < 20; ++j )
|
||||||
|
xored[j] ^= tmp.c_str()[j];
|
||||||
|
}
|
||||||
|
return std::string( (char*)xored, 20 );
|
||||||
|
}
|
||||||
|
|
||||||
void ClientBase::processSASLChallenge( const std::string& challenge )
|
void ClientBase::processSASLChallenge( const std::string& challenge )
|
||||||
{
|
{
|
||||||
Tag* t = new Tag( "response", XMLNS, XMLNS_STREAM_SASL );
|
Tag* t = new Tag( "response", XMLNS, XMLNS_STREAM_SASL );
|
||||||
|
@ -530,6 +704,53 @@ namespace gloox
|
||||||
|
|
||||||
switch( m_selectedSaslMech )
|
switch( m_selectedSaslMech )
|
||||||
{
|
{
|
||||||
|
case SaslMechScramSha1Plus:
|
||||||
|
case SaslMechScramSha1:
|
||||||
|
{
|
||||||
|
std::string snonce, salt, tmp;
|
||||||
|
int iter = 0;
|
||||||
|
std::string::size_type posn = decoded.find( "r=" );
|
||||||
|
std::string::size_type poss = decoded.find( "s=" );
|
||||||
|
std::string::size_type posi = decoded.find( "i=" );
|
||||||
|
if( posn == std::string::npos || poss == std::string::npos || posi == std::string::npos )
|
||||||
|
break;
|
||||||
|
|
||||||
|
snonce = decoded.substr( posn + 2, poss - posn - 3 );
|
||||||
|
salt = Base64::decode64( decoded.substr( poss + 2, posi - poss - 3 ) );
|
||||||
|
tmp = decoded.substr( posi + 2, decoded.length() - posi - 2 );
|
||||||
|
iter = atoi( tmp.c_str() );
|
||||||
|
|
||||||
|
if( !prep::saslprep( m_password, tmp ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
std::string saltedPwd = hi( tmp, salt, iter );
|
||||||
|
std::string ck = hmac( saltedPwd, "Client Key" );
|
||||||
|
SHA sha;
|
||||||
|
sha.feed( ck );
|
||||||
|
std::string storedKey = sha.binary();
|
||||||
|
|
||||||
|
if( m_selectedSaslMech == SaslMechScramSha1Plus )
|
||||||
|
tmp = "c=" + Base64::encode64( m_gs2Header + m_encryption->channelBinding() );
|
||||||
|
else
|
||||||
|
tmp = "c=biws";
|
||||||
|
tmp += ",r=" + snonce;
|
||||||
|
|
||||||
|
std::string authMessage = m_clientFirstMessageBare + "," + decoded + "," + tmp; // client-final-message-without-proof
|
||||||
|
std::string clientSignature = hmac( storedKey, authMessage );
|
||||||
|
unsigned char clientProof[20]; // ck XOR clientSignature
|
||||||
|
memcpy( clientProof, ck.c_str(), 20 );
|
||||||
|
for( int i = 0; i < 20; ++i )
|
||||||
|
clientProof[i] ^= clientSignature.c_str()[i];
|
||||||
|
std::string serverKey = hmac( saltedPwd, "Server Key" );
|
||||||
|
m_serverSignature = hmac( serverKey, authMessage );
|
||||||
|
|
||||||
|
tmp += ",p=";
|
||||||
|
tmp.append( Base64::encode64( std::string( (char*)clientProof, 20 ) ) );
|
||||||
|
|
||||||
|
t->setCData( Base64::encode64( tmp ) );
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SaslMechDigestMd5:
|
case SaslMechDigestMd5:
|
||||||
{
|
{
|
||||||
if( !decoded.compare( 0, 7, "rspauth" ) )
|
if( !decoded.compare( 0, 7, "rspauth" ) )
|
||||||
|
@ -555,11 +776,7 @@ namespace gloox
|
||||||
end = decoded.find( '"', end + 1 );
|
end = decoded.find( '"', end + 1 );
|
||||||
std::string nonce = decoded.substr( pos + 7, end - ( pos + 7 ) );
|
std::string nonce = decoded.substr( pos + 7, end - ( pos + 7 ) );
|
||||||
|
|
||||||
std::string cnonce;
|
std::string cnonce = getRandom();
|
||||||
char cn[4*8+1];
|
|
||||||
for( int i = 0; i < 4; ++i )
|
|
||||||
sprintf( cn + i*8, "%08x", rand() );
|
|
||||||
cnonce.assign( cn, 4*8 );
|
|
||||||
|
|
||||||
MD5 md5;
|
MD5 md5;
|
||||||
md5.feed( m_jid.username() );
|
md5.feed( m_jid.username() );
|
||||||
|
@ -699,7 +916,7 @@ namespace gloox
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::processSASLSuccess()
|
bool ClientBase::processSASLSuccess( const std::string& payload )
|
||||||
{
|
{
|
||||||
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
if( m_selectedSaslMech == SaslMechNTLM )
|
if( m_selectedSaslMech == SaslMechNTLM )
|
||||||
|
@ -708,6 +925,14 @@ namespace gloox
|
||||||
DeleteSecurityContext( &m_ctxtHandle );
|
DeleteSecurityContext( &m_ctxtHandle );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if( m_selectedSaslMech == SaslMechScramSha1 || m_selectedSaslMech == SaslMechScramSha1Plus )
|
||||||
|
{
|
||||||
|
const std::string decoded = Base64::decode64( payload );
|
||||||
|
if( decoded.length() < 3 || Base64::decode64( decoded.substr( 2 ) ) != m_serverSignature )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::send( IQ& iq, IqHandler* ih, int context, bool del )
|
void ClientBase::send( IQ& iq, IqHandler* ih, int context, bool del )
|
||||||
|
@ -735,7 +960,7 @@ namespace gloox
|
||||||
Tag* tag = iq.tag();
|
Tag* tag = iq.tag();
|
||||||
addFrom( tag );
|
addFrom( tag );
|
||||||
addNamespace( tag );
|
addNamespace( tag );
|
||||||
send( tag );
|
send( tag, true, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::send( const Message& msg )
|
void ClientBase::send( const Message& msg )
|
||||||
|
@ -744,7 +969,7 @@ namespace gloox
|
||||||
Tag* tag = msg.tag();
|
Tag* tag = msg.tag();
|
||||||
addFrom( tag );
|
addFrom( tag );
|
||||||
addNamespace( tag );
|
addNamespace( tag );
|
||||||
send( tag );
|
send( tag, true, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::send( const Subscription& sub )
|
void ClientBase::send( const Subscription& sub )
|
||||||
|
@ -753,10 +978,10 @@ namespace gloox
|
||||||
Tag* tag = sub.tag();
|
Tag* tag = sub.tag();
|
||||||
addFrom( tag );
|
addFrom( tag );
|
||||||
addNamespace( tag );
|
addNamespace( tag );
|
||||||
send( tag );
|
send( tag, true, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::send( Presence& pres )
|
void ClientBase::send( const Presence& pres )
|
||||||
{
|
{
|
||||||
++m_stats.presenceStanzasSent;
|
++m_stats.presenceStanzasSent;
|
||||||
Tag* tag = pres.tag();
|
Tag* tag = pres.tag();
|
||||||
|
@ -765,10 +990,18 @@ namespace gloox
|
||||||
tag->addChild( (*it)->tag() );
|
tag->addChild( (*it)->tag() );
|
||||||
addFrom( tag );
|
addFrom( tag );
|
||||||
addNamespace( tag );
|
addNamespace( tag );
|
||||||
send( tag );
|
send( tag, true, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::send( Tag* tag )
|
void ClientBase::send( Tag* tag )
|
||||||
|
{
|
||||||
|
if( !tag )
|
||||||
|
return;
|
||||||
|
|
||||||
|
send( tag, false, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientBase::send( Tag* tag, bool queue, bool del )
|
||||||
{
|
{
|
||||||
if( !tag )
|
if( !tag )
|
||||||
return;
|
return;
|
||||||
|
@ -780,6 +1013,13 @@ namespace gloox
|
||||||
if( m_statisticsHandler )
|
if( m_statisticsHandler )
|
||||||
m_statisticsHandler->handleStatistics( getStatistics() );
|
m_statisticsHandler->handleStatistics( getStatistics() );
|
||||||
|
|
||||||
|
if( queue && m_smContext >= CtxSMEnabled )
|
||||||
|
{
|
||||||
|
m_queueMutex.lock();
|
||||||
|
m_smQueue.insert( std::make_pair( ++m_smSent, tag ) );
|
||||||
|
m_queueMutex.unlock();
|
||||||
|
}
|
||||||
|
else if( del || m_smContext < CtxSMEnabled )
|
||||||
delete tag;
|
delete tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,15 +1038,49 @@ namespace gloox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientBase::checkQueue( int handled, bool resend )
|
||||||
|
{
|
||||||
|
if( m_smContext < CtxSMEnabled || handled < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
util::MutexGuard mg( m_queueMutex );
|
||||||
|
SMQueueMap::iterator it = m_smQueue.begin();
|
||||||
|
while( it != m_smQueue.end() )
|
||||||
|
{
|
||||||
|
if( (*it).first <= handled )
|
||||||
|
{
|
||||||
|
delete (*it).second;
|
||||||
|
m_smQueue.erase( it++ );
|
||||||
|
}
|
||||||
|
else if( resend && (*it).first > handled )
|
||||||
|
{
|
||||||
|
send( (*it).second, false, false );
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const TagList ClientBase::sendQueue()
|
||||||
|
{
|
||||||
|
TagList l;
|
||||||
|
util::MutexGuard mg( m_queueMutex );
|
||||||
|
SMQueueMap::iterator it = m_smQueue.begin();
|
||||||
|
for( ; it != m_smQueue.end(); ++it )
|
||||||
|
l.push_back( (*it).second->clone() );
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
void ClientBase::addFrom( Tag* tag )
|
void ClientBase::addFrom( Tag* tag )
|
||||||
{
|
{
|
||||||
if( !m_authed /*for IQ Auth */ || !tag || tag->hasAttribute( "from" ) )
|
if( !m_authed /*for IQ Auth */ || !tag || tag->hasAttribute( "from" ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( m_selectedResource.empty() )
|
tag->addAttribute( "from", m_jid.full() );
|
||||||
tag->addAttribute( "from", m_jid.bare() );
|
|
||||||
else
|
|
||||||
tag->addAttribute( "from", m_jid.bare() + '/' + m_selectedResource );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::addNamespace( Tag* tag )
|
void ClientBase::addNamespace( Tag* tag )
|
||||||
|
@ -885,11 +1159,14 @@ namespace gloox
|
||||||
|
|
||||||
const std::string ClientBase::getID()
|
const std::string ClientBase::getID()
|
||||||
{
|
{
|
||||||
static unsigned int uniqueBaseID = (unsigned int)time( 0 );
|
#ifdef CLIENTBASE_TEST // to create predictable UIDs in test mode
|
||||||
|
return "uid" + util::int2string( m_nextId.increment() );
|
||||||
|
#else
|
||||||
char r[21+1];
|
char r[21+1];
|
||||||
sprintf( r, "uid:%08x:%08x", uniqueBaseID, rand() );
|
sprintf( r, "uid-%08x-%08x", m_uniqueBaseId, m_nextId.increment() );
|
||||||
std::string ret( r, 21 );
|
std::string ret( r, 21 );
|
||||||
return ret;
|
return ret;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientBase::checkStreamVersion( const std::string& version )
|
bool ClientBase::checkStreamVersion( const std::string& version )
|
||||||
|
@ -898,44 +1175,42 @@ namespace gloox
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int major = 0;
|
int major = 0;
|
||||||
int minor = 0;
|
// int minor = 0;
|
||||||
int myMajor = atoi( XMPP_STREAM_VERSION_MAJOR.c_str() );
|
int myMajor = atoi( XMPP_STREAM_VERSION_MAJOR.c_str() );
|
||||||
|
|
||||||
size_t dot = version.find( '.' );
|
size_t dot = version.find( '.' );
|
||||||
if( !version.empty() && dot && dot != std::string::npos )
|
if( !version.empty() && dot && dot != std::string::npos )
|
||||||
{
|
{
|
||||||
major = atoi( version.substr( 0, dot ).c_str() );
|
major = atoi( version.substr( 0, dot ).c_str() );
|
||||||
minor = atoi( version.substr( dot ).c_str() );
|
// minor = atoi( version.substr( dot ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return myMajor >= major;
|
return myMajor >= major;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::setConnectionImpl( ConnectionBase* cb )
|
void ClientBase::setConnectionImpl( ConnectionBase* connection )
|
||||||
{
|
{
|
||||||
if( m_connection )
|
ConnectionBase* old = m_connection;
|
||||||
{
|
m_connection = connection;
|
||||||
delete m_connection;
|
m_customConnection = true;
|
||||||
}
|
if( old )
|
||||||
m_connection = cb;
|
delete old;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::setEncryptionImpl( TLSBase* tb )
|
void ClientBase::setEncryptionImpl( TLSBase* encryption )
|
||||||
{
|
{
|
||||||
if( m_encryption )
|
TLSBase* old = m_encryption;
|
||||||
{
|
m_encryption = encryption;
|
||||||
delete m_encryption;
|
if( old )
|
||||||
}
|
delete old;
|
||||||
m_encryption = tb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::setCompressionImpl( CompressionBase* cb )
|
void ClientBase::setCompressionImpl( CompressionBase* compression )
|
||||||
{
|
{
|
||||||
if( m_compression )
|
CompressionBase* old = m_compression;
|
||||||
{
|
m_compression = compression;
|
||||||
delete m_compression;
|
if( old )
|
||||||
}
|
delete old;
|
||||||
m_compression = cb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientBase::handleStreamError( Tag* tag )
|
void ClientBase::handleStreamError( Tag* tag )
|
||||||
|
@ -1093,11 +1368,14 @@ namespace gloox
|
||||||
if( !ih )
|
if( !ih )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
util::MutexGuard m( m_iqExtHandlerMapMutex );
|
||||||
typedef IqHandlerMap::const_iterator IQci;
|
typedef IqHandlerMap::const_iterator IQci;
|
||||||
std::pair<IQci, IQci> g = m_iqExtHandlers.equal_range( exttype );
|
std::pair<IQci, IQci> g = m_iqExtHandlers.equal_range( exttype );
|
||||||
for( IQci it = g.first; it != g.second; ++it )
|
for( IQci it = g.first; it != g.second; ++it )
|
||||||
|
{
|
||||||
if( (*it).second == ih )
|
if( (*it).second == ih )
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_iqExtHandlers.insert( std::make_pair( exttype, ih ) );
|
m_iqExtHandlers.insert( std::make_pair( exttype, ih ) );
|
||||||
}
|
}
|
||||||
|
@ -1107,6 +1385,7 @@ namespace gloox
|
||||||
if( !ih )
|
if( !ih )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
util::MutexGuard m( m_iqExtHandlerMapMutex );
|
||||||
typedef IqHandlerMap::iterator IQi;
|
typedef IqHandlerMap::iterator IQi;
|
||||||
std::pair<IQi, IQi> g = m_iqExtHandlers.equal_range( exttype );
|
std::pair<IQi, IQi> g = m_iqExtHandlers.equal_range( exttype );
|
||||||
IQi it2;
|
IQi it2;
|
||||||
|
@ -1180,11 +1459,21 @@ namespace gloox
|
||||||
{
|
{
|
||||||
if( th )
|
if( th )
|
||||||
{
|
{
|
||||||
TagHandlerList::iterator it = m_tagHandlers.begin();
|
for( TagHandlerList::iterator it = m_tagHandlers.begin(); it != m_tagHandlers.end(); )
|
||||||
for( ; it != m_tagHandlers.end(); ++it )
|
|
||||||
{
|
{
|
||||||
if( (*it).th == th && (*it).tag == tag && (*it).xmlns == xmlns )
|
if( (*it).th == th && (*it).tag == tag && (*it).xmlns == xmlns )
|
||||||
m_tagHandlers.erase( it );
|
{
|
||||||
|
// Normally we'd just assign it to the return value of the .erase() call,
|
||||||
|
// which is either the next element, or .end(). However,
|
||||||
|
// it's only since C++11 that this works; C++03 version returns void.
|
||||||
|
// So instead, we do a post-increment. this increments the iterator to point
|
||||||
|
// to the next element, then passes a copy of the old iterator (that is to the item to be deleted)
|
||||||
|
m_tagHandlers.erase( it++ );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1309,8 +1598,9 @@ namespace gloox
|
||||||
{
|
{
|
||||||
m_iqHandlerMapMutex.lock();
|
m_iqHandlerMapMutex.lock();
|
||||||
IqTrackMap::iterator it_id = m_iqIDHandlers.find( iq.id() );
|
IqTrackMap::iterator it_id = m_iqIDHandlers.find( iq.id() );
|
||||||
|
bool haveIdHandler = ( it_id != m_iqIDHandlers.end() );
|
||||||
m_iqHandlerMapMutex.unlock();
|
m_iqHandlerMapMutex.unlock();
|
||||||
if( it_id != m_iqIDHandlers.end() && iq.subtype() & ( IQ::Result | IQ::Error ) )
|
if( haveIdHandler && ( iq.subtype() == IQ::Result || iq.subtype() == IQ::Error ) )
|
||||||
{
|
{
|
||||||
(*it_id).second.ih->handleIqID( iq, (*it_id).second.context );
|
(*it_id).second.ih->handleIqID( iq, (*it_id).second.context );
|
||||||
if( (*it_id).second.del )
|
if( (*it_id).second.del )
|
||||||
|
@ -1322,9 +1612,17 @@ namespace gloox
|
||||||
}
|
}
|
||||||
|
|
||||||
if( iq.extensions().empty() )
|
if( iq.extensions().empty() )
|
||||||
|
{
|
||||||
|
if ( iq.subtype() == IQ::Get || iq.subtype() == IQ::Set )
|
||||||
|
{
|
||||||
|
IQ re( IQ::Error, iq.from(), iq.id() );
|
||||||
|
re.addExtension( new Error( StanzaErrorTypeCancel, StanzaErrorFeatureNotImplemented ) );
|
||||||
|
send( re );
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool res = false;
|
bool handled = false;
|
||||||
|
|
||||||
// FIXME remove for 1.1
|
// FIXME remove for 1.1
|
||||||
// typedef IqHandlerMapXmlns::const_iterator IQciXmlns
|
// typedef IqHandlerMapXmlns::const_iterator IQciXmlns
|
||||||
|
@ -1337,20 +1635,22 @@ namespace gloox
|
||||||
// }
|
// }
|
||||||
// delete tag;
|
// delete tag;
|
||||||
|
|
||||||
|
m_iqExtHandlerMapMutex.lock();
|
||||||
typedef IqHandlerMap::const_iterator IQci;
|
typedef IqHandlerMap::const_iterator IQci;
|
||||||
const StanzaExtensionList& sel = iq.extensions();
|
const StanzaExtensionList& sel = iq.extensions();
|
||||||
StanzaExtensionList::const_iterator itse = sel.begin();
|
StanzaExtensionList::const_iterator itse = sel.begin();
|
||||||
for( ; itse != sel.end(); ++itse )
|
for( ; !handled && itse != sel.end(); ++itse )
|
||||||
{
|
{
|
||||||
std::pair<IQci, IQci> g = m_iqExtHandlers.equal_range( (*itse)->extensionType() );
|
std::pair<IQci, IQci> g = m_iqExtHandlers.equal_range( (*itse)->extensionType() );
|
||||||
for( IQci it = g.first; it != g.second; ++it )
|
for( IQci it = g.first; !handled && it != g.second; ++it )
|
||||||
{
|
{
|
||||||
if( (*it).second->handleIq( iq ) )
|
if( (*it).second->handleIq( iq ) )
|
||||||
res = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_iqExtHandlerMapMutex.unlock();
|
||||||
|
|
||||||
if( !res && iq.subtype() & ( IQ::Get | IQ::Set ) )
|
if( !handled && ( iq.subtype() == IQ::Get || iq.subtype() == IQ::Set ) )
|
||||||
{
|
{
|
||||||
IQ re( IQ::Error, iq.from(), iq.id() );
|
IQ re( IQ::Error, iq.from(), iq.id() );
|
||||||
re.addExtension( new Error( StanzaErrorTypeCancel, StanzaErrorServiceUnavailable ) );
|
re.addExtension( new Error( StanzaErrorTypeCancel, StanzaErrorServiceUnavailable ) );
|
||||||
|
@ -1429,8 +1729,6 @@ namespace gloox
|
||||||
|
|
||||||
if( msHandler )
|
if( msHandler )
|
||||||
{
|
{
|
||||||
if( msg.subtype() == Message::Chat && msg.body().empty() )
|
|
||||||
return; // don't want a new MS for empty messages
|
|
||||||
MessageSession* session = new MessageSession( this, msg.from(), true, msg.subtype() );
|
MessageSession* session = new MessageSession( this, msg.from(), true, msg.subtype() );
|
||||||
msHandler->handleMessageSession( session );
|
msHandler->handleMessageSession( session );
|
||||||
session->handleMessage( msg );
|
session->handleMessage( msg );
|
||||||
|
@ -1483,6 +1781,14 @@ namespace gloox
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ClientBase::getRandom()
|
||||||
|
{
|
||||||
|
char cn[4*8+1];
|
||||||
|
for( int i = 0; i < 4; ++i )
|
||||||
|
sprintf( cn + i*8, "%08x", rand() );
|
||||||
|
return std::string( cn, 4*8 );;
|
||||||
|
}
|
||||||
|
|
||||||
CompressionBase* ClientBase::getDefaultCompression()
|
CompressionBase* ClientBase::getDefaultCompression()
|
||||||
{
|
{
|
||||||
if( !m_compress )
|
if( !m_compress )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
#include "compressiondatahandler.h"
|
#include "compressiondatahandler.h"
|
||||||
#include "connectiondatahandler.h"
|
#include "connectiondatahandler.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
#include "atomicrefcount.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -69,7 +70,7 @@ namespace gloox
|
||||||
* It manages connection establishing, authentication, filter registration and invocation.
|
* It manages connection establishing, authentication, filter registration and invocation.
|
||||||
* You should normally use Client for client connections and Component for component connections.
|
* You should normally use Client for client connections and Component for component connections.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.3
|
* @since 0.3
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ClientBase : public TagHandler, public ConnectionDataHandler,
|
class GLOOX_API ClientBase : public TagHandler, public ConnectionDataHandler,
|
||||||
|
@ -128,7 +129,7 @@ namespace gloox
|
||||||
* until data was available.
|
* until data was available.
|
||||||
* @return The state of the connection.
|
* @return The state of the connection.
|
||||||
*/
|
*/
|
||||||
ConnectionError recv( int timeout = -1 );
|
virtual ConnectionError recv( int timeout = -1 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reimplement this function to provide a username for connection purposes.
|
* Reimplement this function to provide a username for connection purposes.
|
||||||
|
@ -147,7 +148,7 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switches usage of SASL on/off. Default: on. SASL should only be disabled if there are
|
* Switches usage of SASL on/off. Default: on. SASL should only be disabled if there are
|
||||||
* problems with using it.
|
* problems with using it, and if an alternative authentication method exists.
|
||||||
* @param sasl Whether to switch SASL usage on or off.
|
* @param sasl Whether to switch SASL usage on or off.
|
||||||
*/
|
*/
|
||||||
void setSasl( bool sasl ) { m_sasl = sasl; }
|
void setSasl( bool sasl ) { m_sasl = sasl; }
|
||||||
|
@ -280,7 +281,7 @@ namespace gloox
|
||||||
* A convenience function that sends the given Presence stanza.
|
* A convenience function that sends the given Presence stanza.
|
||||||
* @param pres The Presence stanza to send.
|
* @param pres The Presence stanza to send.
|
||||||
*/
|
*/
|
||||||
void send( Presence& pres );
|
void send( const Presence& pres );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether authentication has taken place and was successful.
|
* Returns whether authentication has taken place and was successful.
|
||||||
|
@ -363,7 +364,7 @@ namespace gloox
|
||||||
void whitespacePing();
|
void whitespacePing();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a XMPP Ping (XEP-0199) to the given JID.
|
* Sends a XMPP Ping (@xep{0199}) to the given JID.
|
||||||
* @param to Then entity to ping.
|
* @param to Then entity to ping.
|
||||||
* @param eh An EventHandler to inform about the reply.
|
* @param eh An EventHandler to inform about the reply.
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
|
@ -433,7 +434,7 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the given IqHandler from the list of handlers of pending operations, added
|
* Removes the given IqHandler from the list of handlers of pending operations, added
|
||||||
* using trackID(). Necessary, for example, when closing a GUI element that has an
|
* using send( IQ&, IqHandler*, int, bool ). Necessary, for example, when closing a GUI element that has an
|
||||||
* operation pending.
|
* operation pending.
|
||||||
* @param ih The IqHandler to remove.
|
* @param ih The IqHandler to remove.
|
||||||
* @since 0.8.7
|
* @since 0.8.7
|
||||||
|
@ -678,6 +679,15 @@ namespace gloox
|
||||||
*/
|
*/
|
||||||
const StanzaExtensionList& presenceExtensions() const { return m_presenceExtensions; }
|
const StanzaExtensionList& presenceExtensions() const { return m_presenceExtensions; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of Tags that are currently in the send queue.
|
||||||
|
* You should not rely on the currentness of this data when there is an established connection.
|
||||||
|
* @return A 'decoupled' list of Tags (deep copies) in the send queue. The caller is responsible
|
||||||
|
* for deleting the tags.
|
||||||
|
* @since 1.0.6
|
||||||
|
*/
|
||||||
|
const TagList sendQueue();
|
||||||
|
|
||||||
// reimplemented from ParserHandler
|
// reimplemented from ParserHandler
|
||||||
virtual void handleTag( Tag* tag );
|
virtual void handleTag( Tag* tag );
|
||||||
|
|
||||||
|
@ -706,6 +716,9 @@ namespace gloox
|
||||||
virtual void handleHandshakeResult( const TLSBase* base, bool success, CertInfo &certinfo );
|
virtual void handleHandshakeResult( const TLSBase* base, bool success, CertInfo &certinfo );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
#ifdef CLIENTBASE_TEST
|
||||||
|
public:
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* This function is called when resource binding yieled an error.
|
* This function is called when resource binding yieled an error.
|
||||||
* @param error A pointer to an Error object that contains more
|
* @param error A pointer to an Error object that contains more
|
||||||
|
@ -786,9 +799,13 @@ namespace gloox
|
||||||
void startSASL( SaslMechanism type );
|
void startSASL( SaslMechanism type );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases SASL related resources.
|
* Verifies the server response after successful authentication (if applicable) and
|
||||||
|
* releases SASL related resources (if applicable).
|
||||||
|
* @param payload The server's verification string.
|
||||||
|
* @return @b True if verification is not supported by the chosen SASL mechanism or could be completed successfully,
|
||||||
|
* @b false if verification failed.
|
||||||
*/
|
*/
|
||||||
void processSASLSuccess();
|
bool processSASLSuccess( const std::string& payload );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes the given SASL challenge and sends a response.
|
* Processes the given SASL challenge and sends a response.
|
||||||
|
@ -819,6 +836,35 @@ namespace gloox
|
||||||
*/
|
*/
|
||||||
bool hasTls();
|
bool hasTls();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the given data unchecked over the underlying transport connection. Use at your own risk.
|
||||||
|
* The server will check any data received anyway and disconnect if something is wrong.
|
||||||
|
* @param xml The data to send.
|
||||||
|
*/
|
||||||
|
void send( const std::string& xml );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function checks if there are any unacknowledged Tags in the send queue and resends
|
||||||
|
* as necessary.
|
||||||
|
* @param handled The sequence number of the last handled stanza.
|
||||||
|
* @param resend Whether to resend unhandled stanzas.
|
||||||
|
* @note This function is part of @xep{0198}. You should not need to use it directly.
|
||||||
|
* @since 1.0.4
|
||||||
|
*/
|
||||||
|
void checkQueue( int handled, bool resend );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of sent stanzas, if Stream Management is enabled.
|
||||||
|
* @return The number of sent stanzas.
|
||||||
|
*/
|
||||||
|
int stanzasSent() const { return m_smSent; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 32 octets of random characters.
|
||||||
|
* @return Random characters.
|
||||||
|
*/
|
||||||
|
std::string getRandom();
|
||||||
|
|
||||||
JID m_jid; /**< The 'self' JID. */
|
JID m_jid; /**< The 'self' JID. */
|
||||||
JID m_authzid; /**< An optional authorization ID. See setAuthzid(). */
|
JID m_authzid; /**< An optional authorization ID. See setAuthzid(). */
|
||||||
std::string m_authcid; /**< An alternative authentication ID. See setAuthcid(). */
|
std::string m_authcid; /**< An alternative authentication ID. See setAuthcid(). */
|
||||||
|
@ -830,8 +876,10 @@ namespace gloox
|
||||||
/** A list of permanent presence extensions. */
|
/** A list of permanent presence extensions. */
|
||||||
StanzaExtensionList m_presenceExtensions;
|
StanzaExtensionList m_presenceExtensions;
|
||||||
|
|
||||||
std::string m_selectedResource; /**< The currently selected resource.
|
GLOOX_DEPRECATED std::string m_selectedResource; /**< The currently selected resource.
|
||||||
* See Client::selectResource() and Client::binRessource(). */
|
* See Client::selectResource() and Client::bindRessource().
|
||||||
|
* @deprecated Not used anymore. Will be removed for 1.1.
|
||||||
|
* @todo Remove for 1.1 */
|
||||||
std::string m_clientCerts; /**< TLS client certificates. */
|
std::string m_clientCerts; /**< TLS client certificates. */
|
||||||
std::string m_clientKey; /**< TLS client private key. */
|
std::string m_clientKey; /**< TLS client private key. */
|
||||||
std::string m_namespace; /**< Default namespace. */
|
std::string m_namespace; /**< Default namespace. */
|
||||||
|
@ -855,14 +903,31 @@ namespace gloox
|
||||||
|
|
||||||
int m_availableSaslMechs; /**< The SASL mechanisms the server offered. */
|
int m_availableSaslMechs; /**< The SASL mechanisms the server offered. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An enum for the Stream Management state machine.
|
||||||
|
*/
|
||||||
|
enum SMContext
|
||||||
|
{
|
||||||
|
CtxSMInvalid, /**< Initial value. */
|
||||||
|
CtxSMFailed, /**< Either of the below failed. */
|
||||||
|
CtxSMEnable, /**< 'enable' request sent */
|
||||||
|
CtxSMResume, /**< 'resume' request sent */
|
||||||
|
CtxSMEnabled, /**< Stream Management successfully enabled. */
|
||||||
|
CtxSMResumed /**< Stream successfully resumed. */
|
||||||
|
};
|
||||||
|
|
||||||
|
SMContext m_smContext; /**< The Stream Management state. Used in @xep{0198}. */
|
||||||
|
int m_smHandled; /**< The number of handled stanzas. Used in @xep{0198}.
|
||||||
|
* You should NOT mess with this. */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef CLIENTBASE_TEST
|
#ifdef CLIENTBASE_TEST
|
||||||
public:
|
public:
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* @brief This is an implementation of an XMPP Ping (XEP-199).
|
* @brief This is an implementation of an XMPP Ping (@xep{0199}).
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class Ping : public StanzaExtension
|
class Ping : public StanzaExtension
|
||||||
|
@ -908,18 +973,24 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called right after the opening <stream:stream> was received.
|
* This function is called right after the opening <stream:stream> was received.
|
||||||
|
* @param start The complete stream opening tag. Note that the XML representation (Tag::xml())
|
||||||
|
* will contain a closed stream tag. The original is open.
|
||||||
*/
|
*/
|
||||||
virtual void handleStartNode() = 0;
|
virtual void handleStartNode( const Tag* start ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called for each Tag. Only stream initiation/negotiation should
|
* This function is called for each Tag. Only stream initiation/negotiation should
|
||||||
* be done here.
|
* be done here.
|
||||||
* @param tag A Tag to handle.
|
* @param tag A Tag to handle.
|
||||||
|
* @return Returns @b true if the tag has been handled inside the function, @b false otherwise.
|
||||||
*/
|
*/
|
||||||
virtual bool handleNormalNode( Tag* tag ) = 0;
|
virtual bool handleNormalNode( Tag* tag ) = 0;
|
||||||
virtual void rosterFilled() = 0;
|
virtual void rosterFilled() = 0;
|
||||||
virtual void cleanup() {}
|
virtual void cleanup() {}
|
||||||
virtual void handleIqIDForward( const IQ& iq, int context ) { (void) iq; (void) context; }
|
virtual void handleIqIDForward( const IQ& iq, int context ) { (void) iq; (void) context; }
|
||||||
|
void send( Tag* tag, bool queue, bool del );
|
||||||
|
std::string hmac( const std::string& str, const std::string& key );
|
||||||
|
std::string hi( const std::string& str, const std::string& key, int iter );
|
||||||
|
|
||||||
void parse( const std::string& data );
|
void parse( const std::string& data );
|
||||||
void init();
|
void init();
|
||||||
|
@ -933,7 +1004,6 @@ namespace gloox
|
||||||
void notifySubscriptionHandlers( Subscription& s10n );
|
void notifySubscriptionHandlers( Subscription& s10n );
|
||||||
void notifyTagHandlers( Tag* tag );
|
void notifyTagHandlers( Tag* tag );
|
||||||
void notifyOnDisconnect( ConnectionError e );
|
void notifyOnDisconnect( ConnectionError e );
|
||||||
void send( const std::string& xml );
|
|
||||||
void addFrom( Tag* tag );
|
void addFrom( Tag* tag );
|
||||||
void addNamespace( Tag* tag );
|
void addNamespace( Tag* tag );
|
||||||
|
|
||||||
|
@ -973,6 +1043,7 @@ namespace gloox
|
||||||
typedef std::multimap<const int, IqHandler*> IqHandlerMap;
|
typedef std::multimap<const int, IqHandler*> IqHandlerMap;
|
||||||
typedef std::map<const std::string, TrackStruct> IqTrackMap;
|
typedef std::map<const std::string, TrackStruct> IqTrackMap;
|
||||||
typedef std::map<const std::string, MessageHandler*> MessageHandlerMap;
|
typedef std::map<const std::string, MessageHandler*> MessageHandlerMap;
|
||||||
|
typedef std::map<int, Tag*> SMQueueMap;
|
||||||
typedef std::list<MessageSession*> MessageSessionList;
|
typedef std::list<MessageSession*> MessageSessionList;
|
||||||
typedef std::list<MessageHandler*> MessageHandlerList;
|
typedef std::list<MessageHandler*> MessageHandlerList;
|
||||||
typedef std::list<PresenceHandler*> PresenceHandlerList;
|
typedef std::list<PresenceHandler*> PresenceHandlerList;
|
||||||
|
@ -984,6 +1055,7 @@ namespace gloox
|
||||||
IqHandlerMapXmlns m_iqNSHandlers;
|
IqHandlerMapXmlns m_iqNSHandlers;
|
||||||
IqHandlerMap m_iqExtHandlers;
|
IqHandlerMap m_iqExtHandlers;
|
||||||
IqTrackMap m_iqIDHandlers;
|
IqTrackMap m_iqIDHandlers;
|
||||||
|
SMQueueMap m_smQueue;
|
||||||
MessageSessionList m_messageSessions;
|
MessageSessionList m_messageSessions;
|
||||||
MessageHandlerList m_messageHandlers;
|
MessageHandlerList m_messageHandlers;
|
||||||
PresenceHandlerList m_presenceHandlers;
|
PresenceHandlerList m_presenceHandlers;
|
||||||
|
@ -999,6 +1071,8 @@ namespace gloox
|
||||||
MessageSessionHandler * m_messageSessionHandlerNormal;
|
MessageSessionHandler * m_messageSessionHandlerNormal;
|
||||||
|
|
||||||
util::Mutex m_iqHandlerMapMutex;
|
util::Mutex m_iqHandlerMapMutex;
|
||||||
|
util::Mutex m_iqExtHandlerMapMutex;
|
||||||
|
util::Mutex m_queueMutex;
|
||||||
|
|
||||||
Parser m_parser;
|
Parser m_parser;
|
||||||
LogSink m_logInstance;
|
LogSink m_logInstance;
|
||||||
|
@ -1015,8 +1089,16 @@ namespace gloox
|
||||||
|
|
||||||
SaslMechanism m_selectedSaslMech;
|
SaslMechanism m_selectedSaslMech;
|
||||||
|
|
||||||
|
std::string m_clientFirstMessageBare;
|
||||||
|
std::string m_serverSignature;
|
||||||
|
std::string m_gs2Header;
|
||||||
std::string m_ntlmDomain;
|
std::string m_ntlmDomain;
|
||||||
bool m_autoMessageSession;
|
bool m_customConnection;
|
||||||
|
|
||||||
|
int m_uniqueBaseId;
|
||||||
|
util::AtomicRefCount m_nextId;
|
||||||
|
|
||||||
|
int m_smSent;
|
||||||
|
|
||||||
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
CredHandle m_credHandle;
|
CredHandle m_credHandle;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -32,7 +32,7 @@ namespace gloox
|
||||||
m_disco->setIdentity( "component", "generic" );
|
m_disco->setIdentity( "component", "generic" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Component::handleStartNode()
|
void Component::handleStartNode( const Tag* /*start*/ )
|
||||||
{
|
{
|
||||||
if( m_sid.empty() )
|
if( m_sid.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -25,9 +25,9 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* @brief This is an implementation of a basic jabber Component.
|
* @brief This is an implementation of a basic jabber Component.
|
||||||
*
|
*
|
||||||
* It's using XEP-0114 (Jabber Component Protocol) to authenticate with a server.
|
* It's using @xep{0114} (Jabber Component Protocol) to authenticate with a server.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.3
|
* @since 0.3
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Component : public ClientBase
|
class GLOOX_API Component : public ClientBase
|
||||||
|
@ -36,7 +36,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* Constructs a new Component.
|
* Constructs a new Component.
|
||||||
* @param ns The namespace that qualifies the stream. Either @b jabber:component:accept or
|
* @param ns The namespace that qualifies the stream. Either @b jabber:component:accept or
|
||||||
* @b jabber:component:connect. See XEP-0114 for details.
|
* @b jabber:component:connect. See @xep{0114} for details.
|
||||||
* @param server The server to connect to.
|
* @param server The server to connect to.
|
||||||
* @param component The component's hostname. FQDN.
|
* @param component The component's hostname. FQDN.
|
||||||
* @param password The component's password.
|
* @param password The component's password.
|
||||||
|
@ -54,11 +54,11 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* Disconnects from the server.
|
* Disconnects from the server.
|
||||||
*/
|
*/
|
||||||
void disconnect() { ClientBase::disconnect( ConnUserDisconnected ); }
|
virtual void disconnect() { ClientBase::disconnect( ConnUserDisconnected ); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// reimplemented from ClientBase
|
// reimplemented from ClientBase
|
||||||
virtual void handleStartNode();
|
virtual void handleStartNode( const Tag* start );
|
||||||
|
|
||||||
// reimplemented from ClientBase
|
// reimplemented from ClientBase
|
||||||
virtual bool handleNormalNode( Tag* tag );
|
virtual bool handleNormalNode( Tag* tag );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -28,7 +28,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* You should not need to use this class directly.
|
* You should not need to use this class directly.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API CompressionBase
|
class GLOOX_API CompressionBase
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -28,7 +28,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* You should not need to use this class directly.
|
* You should not need to use this class directly.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API CompressionDataHandler
|
class GLOOX_API CompressionDataHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 by Jakob Schroeter <js@camaya.net>
|
* Copyright (c) 2009-2015 by Jakob Schröter <js@camaya.net>
|
||||||
* This file is part of the gloox library. http://camaya.net/gloox
|
* This file is part of the gloox library. http://camaya.net/gloox
|
||||||
*
|
*
|
||||||
* This software is distributed under a license. The full license
|
* This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 by Jakob Schroeter <js@camaya.net>
|
* Copyright (c) 2009-2015 by Jakob Schröter <js@camaya.net>
|
||||||
* This file is part of the gloox library. http://camaya.net/gloox
|
* This file is part of the gloox library. http://camaya.net/gloox
|
||||||
*
|
*
|
||||||
* This software is distributed under a license. The full license
|
* This software is distributed under a license. The full license
|
||||||
|
@ -24,7 +24,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* @brief This is an abstraction of the various Compression implementations.
|
* @brief This is an abstraction of the various Compression implementations.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API CompressionDefault : public CompressionBase
|
class GLOOX_API CompressionDefault : public CompressionBase
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -71,13 +71,12 @@ namespace gloox
|
||||||
m_zdeflate.avail_in = static_cast<uInt>( data.length() );
|
m_zdeflate.avail_in = static_cast<uInt>( data.length() );
|
||||||
m_zdeflate.next_in = (Bytef*)in;
|
m_zdeflate.next_in = (Bytef*)in;
|
||||||
|
|
||||||
int ret;
|
|
||||||
std::string result;
|
std::string result;
|
||||||
do {
|
do {
|
||||||
m_zdeflate.avail_out = static_cast<uInt>( CHUNK );
|
m_zdeflate.avail_out = static_cast<uInt>( CHUNK );
|
||||||
m_zdeflate.next_out = (Bytef*)out;
|
m_zdeflate.next_out = (Bytef*)out;
|
||||||
|
|
||||||
ret = deflate( &m_zdeflate, Z_SYNC_FLUSH );
|
deflate( &m_zdeflate, Z_SYNC_FLUSH );
|
||||||
result.append( (char*)out, CHUNK - m_zdeflate.avail_out );
|
result.append( (char*)out, CHUNK - m_zdeflate.avail_out );
|
||||||
} while( m_zdeflate.avail_out == 0 );
|
} while( m_zdeflate.avail_out == 0 );
|
||||||
|
|
||||||
|
@ -103,14 +102,13 @@ namespace gloox
|
||||||
m_zinflate.avail_in = static_cast<uInt>( data.length() );
|
m_zinflate.avail_in = static_cast<uInt>( data.length() );
|
||||||
m_zinflate.next_in = (Bytef*)in;
|
m_zinflate.next_in = (Bytef*)in;
|
||||||
|
|
||||||
int ret = Z_OK;
|
|
||||||
std::string result;
|
std::string result;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
m_zinflate.avail_out = CHUNK;
|
m_zinflate.avail_out = CHUNK;
|
||||||
m_zinflate.next_out = (Bytef*)out;
|
m_zinflate.next_out = (Bytef*)out;
|
||||||
|
|
||||||
ret = inflate( &m_zinflate, Z_SYNC_FLUSH );
|
inflate( &m_zinflate, Z_SYNC_FLUSH );
|
||||||
result.append( out, CHUNK - m_zinflate.avail_out );
|
result.append( out, CHUNK - m_zinflate.avail_out );
|
||||||
} while( m_zinflate.avail_out == 0 );
|
} while( m_zinflate.avail_out == 0 );
|
||||||
|
|
||||||
|
@ -121,15 +119,19 @@ namespace gloox
|
||||||
|
|
||||||
void CompressionZlib::cleanup()
|
void CompressionZlib::cleanup()
|
||||||
{
|
{
|
||||||
if( !m_valid )
|
m_compressMutex.lock();
|
||||||
return;
|
|
||||||
|
|
||||||
|
if( m_valid )
|
||||||
|
{
|
||||||
inflateEnd( &m_zinflate );
|
inflateEnd( &m_zinflate );
|
||||||
deflateEnd( &m_zdeflate );
|
deflateEnd( &m_zdeflate );
|
||||||
|
|
||||||
m_valid = false;
|
m_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_compressMutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAVE_ZLIB
|
#endif // HAVE_ZLIB
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -30,7 +30,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* An implementation of CompressionBase using zlib.
|
* An implementation of CompressionBase using zlib.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API CompressionZlib : public CompressionBase
|
class GLOOX_API CompressionZlib : public CompressionBase
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2009-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -13,12 +13,18 @@
|
||||||
/* Define to 1 if you have the <errno.h> header file. */
|
/* Define to 1 if you have the <errno.h> header file. */
|
||||||
#define HAVE_ERRNO_H 1
|
#define HAVE_ERRNO_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if GCC atomic builtins are available */
|
||||||
|
#define HAVE_GCC_ATOMIC_BUILTINS 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `getaddrinfo' function. */
|
/* Define to 1 if you have the `getaddrinfo' function. */
|
||||||
/* #undef HAVE_GETADDRINFO */
|
/* #undef HAVE_GETADDRINFO */
|
||||||
|
|
||||||
/* Define to 1 if you want TLS support (GnuTLS). Undefine HAVE_OPENSSL. */
|
/* Define to 1 if you want TLS support (GnuTLS). Undefine HAVE_OPENSSL. */
|
||||||
/* #undef HAVE_GNUTLS */
|
/* #undef HAVE_GNUTLS */
|
||||||
|
|
||||||
|
/* Define to 1 if you have GnuTLS 2.12.0 or above. */
|
||||||
|
/* #undef HAVE_GNUTLS_SESSION_CHANNEL_BINDING */
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#define HAVE_INTTYPES_H 1
|
#define HAVE_INTTYPES_H 1
|
||||||
|
|
||||||
|
@ -28,15 +34,15 @@
|
||||||
/* Define to 1 if you want IDN support. */
|
/* Define to 1 if you want IDN support. */
|
||||||
/* #undef HAVE_LIBIDN */
|
/* #undef HAVE_LIBIDN */
|
||||||
|
|
||||||
/* Define to 1 if you have the `network' library (-lnetwork). */
|
|
||||||
#define HAVE_LIBNETWORK 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `resolv' library (-lresolv). */
|
/* Define to 1 if you have the `resolv' library (-lresolv). */
|
||||||
/* #undef HAVE_LIBRESOLV */
|
/* #undef HAVE_LIBRESOLV */
|
||||||
|
|
||||||
/* Define to 1 if you have the `socket' library (-lsocket). */
|
/* Define to 1 if you have the `socket' library (-lsocket). */
|
||||||
/* #undef HAVE_LIBSOCKET */
|
/* #undef HAVE_LIBSOCKET */
|
||||||
|
|
||||||
|
/* enable mdns support */
|
||||||
|
/* #undef HAVE_MDNS */
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
#define HAVE_MEMORY_H 1
|
#define HAVE_MEMORY_H 1
|
||||||
|
|
||||||
|
@ -53,7 +59,7 @@
|
||||||
/* #undef HAVE_RES_QUERYDOMAIN */
|
/* #undef HAVE_RES_QUERYDOMAIN */
|
||||||
|
|
||||||
/* Define to 1 if you have the `setsockopt' function. */
|
/* Define to 1 if you have the `setsockopt' function. */
|
||||||
#define HAVE_SETSOCKOPT 1
|
/* #undef HAVE_SETSOCKOPT */
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
#define HAVE_STDINT_H 1
|
#define HAVE_STDINT_H 1
|
||||||
|
@ -93,7 +99,7 @@
|
||||||
#define PACKAGE_NAME "gloox"
|
#define PACKAGE_NAME "gloox"
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
/* Define to the full name and version of this package. */
|
||||||
#define PACKAGE_STRING "gloox 1.0"
|
#define PACKAGE_STRING "gloox 1.0.13"
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
/* Define to the one symbol short name of this package. */
|
||||||
#define PACKAGE_TARNAME "gloox"
|
#define PACKAGE_TARNAME "gloox"
|
||||||
|
@ -102,7 +108,7 @@
|
||||||
#define PACKAGE_URL ""
|
#define PACKAGE_URL ""
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#define PACKAGE_VERSION "1.0"
|
#define PACKAGE_VERSION "1.0.13"
|
||||||
|
|
||||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||||
your system. */
|
your system. */
|
||||||
|
@ -112,6 +118,7 @@
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
|
#define VERSION "1.0.13"
|
||||||
|
|
||||||
/* Define to empty if `const' does not conform to ANSI C. */
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
/* #undef const */
|
/* #undef const */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -28,7 +28,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* You should not need to use this class directly.
|
* You should not need to use this class directly.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionBase
|
class GLOOX_API ConnectionBase
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
* Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
* This file is part of the gloox library. http://camaya.net/gloox
|
* This file is part of the gloox library. http://camaya.net/gloox
|
||||||
*
|
*
|
||||||
* This software is distributed under a license. The full license
|
* This software is distributed under a license. The full license
|
||||||
|
@ -110,7 +110,7 @@ namespace gloox
|
||||||
|
|
||||||
m_state = StateConnecting;
|
m_state = StateConnecting;
|
||||||
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
||||||
"bosh initiating connection to server: " +
|
"Initiating BOSH connection to server: " +
|
||||||
( ( m_connMode == ModePipelining ) ? std::string( "Pipelining" )
|
( ( m_connMode == ModePipelining ) ? std::string( "Pipelining" )
|
||||||
: ( ( m_connMode == ModeLegacyHTTP ) ? std::string( "LegacyHTTP" )
|
: ( ( m_connMode == ModeLegacyHTTP ) ? std::string( "LegacyHTTP" )
|
||||||
: std::string( "PersistentHTTP" ) ) ) );
|
: std::string( "PersistentHTTP" ) ) ) );
|
||||||
|
@ -142,12 +142,12 @@ namespace gloox
|
||||||
}
|
}
|
||||||
sendRequest( requestBody );
|
sendRequest( requestBody );
|
||||||
|
|
||||||
m_logInstance.dbg( LogAreaClassConnectionBOSH, "bosh disconnection request sent" );
|
m_logInstance.dbg( LogAreaClassConnectionBOSH, "BOSH disconnection request sent" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_logInstance.err( LogAreaClassConnectionBOSH,
|
m_logInstance.err( LogAreaClassConnectionBOSH,
|
||||||
"disconnecting from server in a non-graceful fashion" );
|
"Disconnecting from server in a non-graceful fashion" );
|
||||||
}
|
}
|
||||||
|
|
||||||
util::ForEach( m_activeConnections, &ConnectionBase::disconnect );
|
util::ForEach( m_activeConnections, &ConnectionBase::disconnect );
|
||||||
|
@ -160,13 +160,15 @@ namespace gloox
|
||||||
|
|
||||||
ConnectionError ConnectionBOSH::recv( int timeout )
|
ConnectionError ConnectionBOSH::recv( int timeout )
|
||||||
{
|
{
|
||||||
|
ConnectionError ret = ConnNoError;
|
||||||
|
|
||||||
if( m_state == StateDisconnected )
|
if( m_state == StateDisconnected )
|
||||||
return ConnNotConnected;
|
return ConnNotConnected;
|
||||||
|
|
||||||
if( !m_connectionPool.empty() )
|
if( !m_connectionPool.empty() )
|
||||||
m_connectionPool.front()->recv( 0 );
|
ret = m_connectionPool.front()->recv( 0 );
|
||||||
if( !m_activeConnections.empty() )
|
if( !m_activeConnections.empty() )
|
||||||
m_activeConnections.front()->recv( timeout );
|
ret = m_activeConnections.front()->recv( timeout );
|
||||||
|
|
||||||
// If there are no open requests then the spec allows us to send an empty request...
|
// If there are no open requests then the spec allows us to send an empty request...
|
||||||
// (Some CMs do not obey this, it seems)
|
// (Some CMs do not obey this, it seems)
|
||||||
|
@ -177,7 +179,7 @@ namespace gloox
|
||||||
sendXML();
|
sendXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConnNoError; // FIXME?
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectionBOSH::send( const std::string& data )
|
bool ConnectionBOSH::send( const std::string& data )
|
||||||
|
@ -197,7 +199,7 @@ namespace gloox
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// m_initialStreamSent = true;
|
// m_initialStreamSent = true;
|
||||||
// m_logInstance.dbg( LogAreaClassConnectionBOSH, "initial <stream:stream> dropped" );
|
// m_logInstance.dbg( LogAreaClassConnectionBOSH, "Initial <stream:stream> dropped" );
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -260,7 +262,7 @@ namespace gloox
|
||||||
--m_rid; // I think... (may need to rethink when acks are implemented)
|
--m_rid; // I think... (may need to rethink when acks are implemented)
|
||||||
m_logInstance.warn( LogAreaClassConnectionBOSH,
|
m_logInstance.warn( LogAreaClassConnectionBOSH,
|
||||||
"Unable to send. Connection not complete, or too many open requests,"
|
"Unable to send. Connection not complete, or too many open requests,"
|
||||||
" so added to buffer.\n" );
|
" so added to buffer." );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -303,7 +305,7 @@ namespace gloox
|
||||||
|
|
||||||
bool ci_equal( char ch1, char ch2 )
|
bool ci_equal( char ch1, char ch2 )
|
||||||
{
|
{
|
||||||
return toupper( (unsigned char)ch1 ) == toupper( (unsigned char)ch2 );
|
return std::toupper( (unsigned char)ch1 ) == std::toupper( (unsigned char)ch2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string::size_type ci_find( const std::string& str1, const std::string& str2 )
|
std::string::size_type ci_find( const std::string& str1, const std::string& str2 )
|
||||||
|
@ -397,7 +399,7 @@ namespace gloox
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_logInstance.warn( LogAreaClassConnectionBOSH, "buffer length mismatch" );
|
m_logInstance.warn( LogAreaClassConnectionBOSH, "Buffer length mismatch" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,7 +427,7 @@ namespace gloox
|
||||||
requestBody.addAttribute( "xmpp:version", "1.0" );
|
requestBody.addAttribute( "xmpp:version", "1.0" );
|
||||||
requestBody.addAttribute( "to", m_server );
|
requestBody.addAttribute( "to", m_server );
|
||||||
|
|
||||||
m_logInstance.dbg( LogAreaClassConnectionBOSH, "sending bosh connection request" );
|
m_logInstance.dbg( LogAreaClassConnectionBOSH, "Sending BOSH connection request" );
|
||||||
sendRequest( requestBody.xml() );
|
sendRequest( requestBody.xml() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,7 +447,7 @@ namespace gloox
|
||||||
case ModePipelining:
|
case ModePipelining:
|
||||||
m_connMode = ModeLegacyHTTP; // Server seems not to support pipelining
|
m_connMode = ModeLegacyHTTP; // Server seems not to support pipelining
|
||||||
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
||||||
"connection closed - falling back to HTTP/1.0 connection method" );
|
"Connection closed - falling back to HTTP/1.0 connection method" );
|
||||||
break;
|
break;
|
||||||
case ModeLegacyHTTP:
|
case ModeLegacyHTTP:
|
||||||
case ModePersistentHTTP:
|
case ModePersistentHTTP:
|
||||||
|
@ -463,7 +465,7 @@ namespace gloox
|
||||||
if( m_streamRestart )
|
if( m_streamRestart )
|
||||||
{
|
{
|
||||||
m_streamRestart = false;
|
m_streamRestart = false;
|
||||||
m_logInstance.dbg( LogAreaClassConnectionBOSH, "sending spoofed <stream:stream>" );
|
m_logInstance.dbg( LogAreaClassConnectionBOSH, "Sending spoofed <stream:stream>" );
|
||||||
m_handler->handleReceivedData( this, "<?xml version='1.0' ?>"
|
m_handler->handleReceivedData( this, "<?xml version='1.0' ?>"
|
||||||
"<stream:stream xmlns:stream='http://etherx.jabber.org/streams'"
|
"<stream:stream xmlns:stream='http://etherx.jabber.org/streams'"
|
||||||
" xmlns='" + XMLNS_CLIENT + "' version='" + XMPP_STREAM_VERSION_MAJOR
|
" xmlns='" + XMLNS_CLIENT + "' version='" + XMPP_STREAM_VERSION_MAJOR
|
||||||
|
@ -483,7 +485,7 @@ namespace gloox
|
||||||
{
|
{
|
||||||
m_maxOpenRequests = serverRequests;
|
m_maxOpenRequests = serverRequests;
|
||||||
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
||||||
"bosh parameter 'requests' now set to " + tag->findAttribute( "requests" ) );
|
"BOSH parameter 'requests' now set to " + tag->findAttribute( "requests" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( tag->hasAttribute( "hold" ) )
|
if( tag->hasAttribute( "hold" ) )
|
||||||
|
@ -493,7 +495,7 @@ namespace gloox
|
||||||
{
|
{
|
||||||
m_hold = maxHold;
|
m_hold = maxHold;
|
||||||
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
||||||
"bosh parameter 'hold' now set to " + tag->findAttribute( "hold" ) );
|
"BOSH parameter 'hold' now set to " + tag->findAttribute( "hold" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( tag->hasAttribute( "wait" ) )
|
if( tag->hasAttribute( "wait" ) )
|
||||||
|
@ -503,7 +505,7 @@ namespace gloox
|
||||||
{
|
{
|
||||||
m_wait = maxWait;
|
m_wait = maxWait;
|
||||||
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
||||||
"bosh parameter 'wait' now set to " + tag->findAttribute( "wait" )
|
"BOSH parameter 'wait' now set to " + tag->findAttribute( "wait" )
|
||||||
+ " seconds" );
|
+ " seconds" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -512,7 +514,7 @@ namespace gloox
|
||||||
const int minTime = atoi( tag->findAttribute( "polling" ).c_str() );
|
const int minTime = atoi( tag->findAttribute( "polling" ).c_str() );
|
||||||
m_minTimePerRequest = minTime;
|
m_minTimePerRequest = minTime;
|
||||||
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
||||||
"bosh parameter 'polling' now set to " + tag->findAttribute( "polling" )
|
"BOSH parameter 'polling' now set to " + tag->findAttribute( "polling" )
|
||||||
+ " seconds" );
|
+ " seconds" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,7 +533,7 @@ namespace gloox
|
||||||
if( tag->findAttribute( "type" ) == "terminate" )
|
if( tag->findAttribute( "type" ) == "terminate" )
|
||||||
{
|
{
|
||||||
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
m_logInstance.dbg( LogAreaClassConnectionBOSH,
|
||||||
"bosh connection closed by server: " + tag->findAttribute( "condition" ) );
|
"BOSH connection closed by server: " + tag->findAttribute( "condition" ) );
|
||||||
m_state = StateDisconnected;
|
m_state = StateDisconnected;
|
||||||
m_handler->handleDisconnect( this, ConnStreamClosed );
|
m_handler->handleDisconnect( this, ConnStreamClosed );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
* Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
* This file is part of the gloox library. http://camaya.net/gloox
|
* This file is part of the gloox library. http://camaya.net/gloox
|
||||||
*
|
*
|
||||||
* This software is distributed under a license. The full license
|
* This software is distributed under a license. The full license
|
||||||
|
@ -58,7 +58,7 @@ namespace gloox
|
||||||
* with gloox in the @b src/examples/ directory.
|
* with gloox in the @b src/examples/ directory.
|
||||||
*
|
*
|
||||||
* @author Matthew Wild <mwild1@gmail.com>
|
* @author Matthew Wild <mwild1@gmail.com>
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionBOSH : public ConnectionBase, ConnectionDataHandler, TagHandler
|
class GLOOX_API ConnectionBOSH : public ConnectionBase, ConnectionDataHandler, TagHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -29,7 +29,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* You should not need to use this class directly.
|
* You should not need to use this class directly.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionDataHandler
|
class GLOOX_API ConnectionDataHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -27,7 +27,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* You should not need to use this class directly.
|
* You should not need to use this class directly.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionHandler
|
class GLOOX_API ConnectionHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -139,7 +139,7 @@ namespace gloox
|
||||||
m_proxyHandshakeBuffer = EmptyString;
|
m_proxyHandshakeBuffer = EmptyString;
|
||||||
m_state = StateConnected;
|
m_state = StateConnected;
|
||||||
m_logInstance.dbg( LogAreaClassConnectionHTTPProxy,
|
m_logInstance.dbg( LogAreaClassConnectionHTTPProxy,
|
||||||
"http proxy connection established" );
|
"HTTP proxy connection established" );
|
||||||
m_handler->handleConnect( this );
|
m_handler->handleConnect( this );
|
||||||
}
|
}
|
||||||
else if( !m_proxyHandshakeBuffer.compare( 9, 3, "407" ) )
|
else if( !m_proxyHandshakeBuffer.compare( 9, 3, "407" ) )
|
||||||
|
@ -174,7 +174,7 @@ namespace gloox
|
||||||
port = host.second;
|
port = host.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string message = "Requesting http proxy connection to " + server + ":"
|
std::string message = "Requesting HTTP proxy connection to " + server + ":"
|
||||||
+ util::int2string( port );
|
+ util::int2string( port );
|
||||||
m_logInstance.dbg( LogAreaClassConnectionHTTPProxy, message );
|
m_logInstance.dbg( LogAreaClassConnectionHTTPProxy, message );
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -47,7 +47,7 @@ namespace gloox
|
||||||
* The reason why ConnectionHTTPProxy doesn't manage its own ConnectionTCPClient is that it allows it
|
* The reason why ConnectionHTTPProxy doesn't manage its own ConnectionTCPClient is that it allows it
|
||||||
* to be used with other transports (like IPv6 or chained SOCKS5/HTTP proxies).
|
* to be used with other transports (like IPv6 or chained SOCKS5/HTTP proxies).
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionHTTPProxy : public ConnectionBase, public ConnectionDataHandler
|
class GLOOX_API ConnectionHTTPProxy : public ConnectionBase, public ConnectionDataHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -28,7 +28,7 @@ namespace gloox
|
||||||
* In onTLSConnect(), the server's certificate information needs to be checked, and @b true
|
* In onTLSConnect(), the server's certificate information needs to be checked, and @b true
|
||||||
* returned if the certificate is to be accepted.
|
* returned if the certificate is to be accepted.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionListener
|
class GLOOX_API ConnectionListener
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -47,7 +47,7 @@ namespace gloox
|
||||||
* @note Simple @b plain-text username/password authentication is supported. GSSAPI authentication
|
* @note Simple @b plain-text username/password authentication is supported. GSSAPI authentication
|
||||||
* is not supported.
|
* is not supported.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionSOCKS5Proxy : public ConnectionBase, public ConnectionDataHandler
|
class GLOOX_API ConnectionSOCKS5Proxy : public ConnectionBase, public ConnectionDataHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
#include "logsink.h"
|
#include "logsink.h"
|
||||||
#include "prep.h"
|
#include "prep.h"
|
||||||
#include "mutexguard.h"
|
#include "mutexguard.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
# include <winsock.h>
|
# include <winsock.h>
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
# include <errno.h>
|
||||||
#elif ( defined( _WIN32 ) || defined( _WIN32_WCE ) ) && !defined( __SYMBIAN32__ )
|
#elif ( defined( _WIN32 ) || defined( _WIN32_WCE ) ) && !defined( __SYMBIAN32__ )
|
||||||
# include <winsock.h>
|
# include <winsock.h>
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
|
@ -49,7 +51,7 @@ namespace gloox
|
||||||
const std::string& server, int port )
|
const std::string& server, int port )
|
||||||
: ConnectionBase( 0 ),
|
: ConnectionBase( 0 ),
|
||||||
m_logInstance( logInstance ), m_buf( 0 ), m_socket( -1 ), m_totalBytesIn( 0 ),
|
m_logInstance( logInstance ), m_buf( 0 ), m_socket( -1 ), m_totalBytesIn( 0 ),
|
||||||
m_totalBytesOut( 0 ), m_bufsize( 1024 ), m_cancel( true )
|
m_totalBytesOut( 0 ), m_bufsize( 8192 ), m_cancel( true )
|
||||||
{
|
{
|
||||||
init( server, port );
|
init( server, port );
|
||||||
}
|
}
|
||||||
|
@ -58,7 +60,7 @@ namespace gloox
|
||||||
const std::string& server, int port )
|
const std::string& server, int port )
|
||||||
: ConnectionBase( cdh ),
|
: ConnectionBase( cdh ),
|
||||||
m_logInstance( logInstance ), m_buf( 0 ), m_socket( -1 ), m_totalBytesIn( 0 ),
|
m_logInstance( logInstance ), m_buf( 0 ), m_socket( -1 ), m_totalBytesIn( 0 ),
|
||||||
m_totalBytesOut( 0 ), m_bufsize( 1024 ), m_cancel( true )
|
m_totalBytesOut( 0 ), m_bufsize( 8192 ), m_cancel( true )
|
||||||
{
|
{
|
||||||
init( server, port );
|
init( server, port );
|
||||||
}
|
}
|
||||||
|
@ -110,7 +112,7 @@ namespace gloox
|
||||||
return ConnNotConnected;
|
return ConnNotConnected;
|
||||||
|
|
||||||
ConnectionError err = ConnNoError;
|
ConnectionError err = ConnNoError;
|
||||||
while( !m_cancel && ( err = recv( 10 ) ) == ConnNoError )
|
while( !m_cancel && ( err = recv( 1000000 ) ) == ConnNoError )
|
||||||
;
|
;
|
||||||
return err == ConnNoError ? ConnNotConnected : err;
|
return err == ConnNoError ? ConnNotConnected : err;
|
||||||
}
|
}
|
||||||
|
@ -135,8 +137,20 @@ namespace gloox
|
||||||
|
|
||||||
m_sendMutex.unlock();
|
m_sendMutex.unlock();
|
||||||
|
|
||||||
if( sent == -1 && m_handler )
|
if( sent == -1 )
|
||||||
|
{
|
||||||
|
// send() failed for an unexpected reason
|
||||||
|
std::string message = "send() failed. "
|
||||||
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
|
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
|
||||||
|
#else
|
||||||
|
"errno: " + util::int2string( errno ) + ": " + strerror( errno );
|
||||||
|
#endif
|
||||||
|
m_logInstance.err( LogAreaClassConnectionTCPBase, message );
|
||||||
|
|
||||||
|
if( m_handler )
|
||||||
m_handler->handleDisconnect( this, ConnIoError );
|
m_handler->handleDisconnect( this, ConnIoError );
|
||||||
|
}
|
||||||
|
|
||||||
return sent != -1;
|
return sent != -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -34,7 +34,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* You should not need to use this class directly.
|
* You should not need to use this class directly.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionTCPBase : public ConnectionBase
|
class GLOOX_API ConnectionTCPBase : public ConnectionBase
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -18,6 +18,7 @@
|
||||||
#include "dns.h"
|
#include "dns.h"
|
||||||
#include "logsink.h"
|
#include "logsink.h"
|
||||||
#include "mutexguard.h"
|
#include "mutexguard.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
# include <winsock.h>
|
# include <winsock.h>
|
||||||
|
@ -28,6 +29,8 @@
|
||||||
# include <sys/socket.h>
|
# include <sys/socket.h>
|
||||||
# include <sys/select.h>
|
# include <sys/select.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
# include <string.h>
|
||||||
|
# include <errno.h>
|
||||||
#elif ( defined( _WIN32 ) || defined( _WIN32_WCE ) ) && !defined( __SYMBIAN32__ )
|
#elif ( defined( _WIN32 ) || defined( _WIN32_WCE ) ) && !defined( __SYMBIAN32__ )
|
||||||
# include <winsock.h>
|
# include <winsock.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -142,6 +145,18 @@ namespace gloox
|
||||||
|
|
||||||
if( size <= 0 )
|
if( size <= 0 )
|
||||||
{
|
{
|
||||||
|
if( size == -1 )
|
||||||
|
{
|
||||||
|
// recv() failed for an unexpected reason
|
||||||
|
std::string message = "recv() failed. "
|
||||||
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
|
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
|
||||||
|
#else
|
||||||
|
"errno: " + util::int2string( errno ) + ": " + strerror( errno );
|
||||||
|
#endif
|
||||||
|
m_logInstance.err( LogAreaClassConnectionTCPClient, message );
|
||||||
|
}
|
||||||
|
|
||||||
ConnectionError error = ( size ? ConnIoError : ConnStreamClosed );
|
ConnectionError error = ( size ? ConnIoError : ConnStreamClosed );
|
||||||
if( m_handler )
|
if( m_handler )
|
||||||
m_handler->handleDisconnect( this, error );
|
m_handler->handleDisconnect( this, error );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -30,7 +30,7 @@ namespace gloox
|
||||||
* the raw socket(), or if you need HTTP proxy support (see @ref gloox::ConnectionHTTPProxy for more
|
* the raw socket(), or if you need HTTP proxy support (see @ref gloox::ConnectionHTTPProxy for more
|
||||||
* information).
|
* information).
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionTCPClient : public ConnectionTCPBase
|
class GLOOX_API ConnectionTCPClient : public ConnectionTCPBase
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include "gloox.h"
|
#include "gloox.h"
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include "connectiontcpserver.h"
|
#include "connectiontcpserver.h"
|
||||||
#include "connectiontcpclient.h"
|
#include "connectiontcpclient.h"
|
||||||
#include "connectionhandler.h"
|
#include "connectionhandler.h"
|
||||||
|
@ -38,7 +40,6 @@
|
||||||
# include <sys/select.h>
|
# include <sys/select.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <string.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
|
@ -88,6 +89,22 @@ namespace gloox
|
||||||
if( m_socket < 0 )
|
if( m_socket < 0 )
|
||||||
return ConnIoError;
|
return ConnIoError;
|
||||||
|
|
||||||
|
#ifdef HAVE_SETSOCKOPT
|
||||||
|
int buf = 0;
|
||||||
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
|
int bufbytes = sizeof( int );
|
||||||
|
#else
|
||||||
|
socklen_t bufbytes = sizeof( int );
|
||||||
|
#endif
|
||||||
|
if( ( getsockopt( m_socket, SOL_SOCKET, SO_RCVBUF, (char*)&buf, &bufbytes ) != -1 ) &&
|
||||||
|
( m_bufsize > buf ) )
|
||||||
|
setsockopt( m_socket, SOL_SOCKET, SO_RCVBUF, (char*)&m_bufsize, sizeof( m_bufsize ) );
|
||||||
|
|
||||||
|
if( ( getsockopt( m_socket, SOL_SOCKET, SO_SNDBUF, (char*)&buf, &bufbytes ) != -1 ) &&
|
||||||
|
( m_bufsize > buf ) )
|
||||||
|
setsockopt( m_socket, SOL_SOCKET, SO_SNDBUF, (char*)&m_bufsize, sizeof( m_bufsize ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sockaddr_in local;
|
struct sockaddr_in local;
|
||||||
local.sin_family = AF_INET;
|
local.sin_family = AF_INET;
|
||||||
local.sin_port = static_cast<unsigned short int>( htons( m_port ) );
|
local.sin_port = static_cast<unsigned short int>( htons( m_port ) );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -30,7 +30,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* You should not need to use this class directly.
|
* You should not need to use this class directly.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionTCPServer : public ConnectionTCPBase
|
class GLOOX_API ConnectionTCPServer : public ConnectionTCPBase
|
||||||
|
@ -38,7 +38,7 @@ namespace gloox
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructs a new ConnectionTCPServer object.
|
* Constructs a new ConnectionTCPServer object.
|
||||||
* @param ch An ConnectionHandler-derived object that will handle incoming connections.
|
* @param ch A ConnectionHandler-derived object that will handle incoming connections.
|
||||||
* @param logInstance The log target. Obtain it from ClientBase::logInstance().
|
* @param logInstance The log target. Obtain it from ClientBase::logInstance().
|
||||||
* @param ip The local IP address to listen on. This must @b not be a hostname.
|
* @param ip The local IP address to listen on. This must @b not be a hostname.
|
||||||
* Leave this empty to listen on all local interfaces.
|
* Leave this empty to listen on all local interfaces.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
* Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
* This file is part of the gloox library. http://camaya.net/gloox
|
* This file is part of the gloox library. http://camaya.net/gloox
|
||||||
*
|
*
|
||||||
* This software is distributed under a license. The full license
|
* This software is distributed under a license. The full license
|
||||||
|
@ -14,6 +14,8 @@
|
||||||
#include "connectiontls.h"
|
#include "connectiontls.h"
|
||||||
#include "tlsdefault.h"
|
#include "tlsdefault.h"
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
namespace gloox
|
namespace gloox
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -84,16 +86,7 @@ namespace gloox
|
||||||
|
|
||||||
ConnectionError ConnectionTLS::recv( int timeout )
|
ConnectionError ConnectionTLS::recv( int timeout )
|
||||||
{
|
{
|
||||||
if( m_connection->state() == StateConnected )
|
return m_connection ? m_connection->recv( timeout ) : ConnNotConnected;
|
||||||
{
|
|
||||||
return m_connection->recv( timeout );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.log( LogLevelWarning, LogAreaClassConnectionTLS,
|
|
||||||
"Attempt to receive data on a connection that is not connected (or is connecting)" );
|
|
||||||
return ConnNotConnected;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectionTLS::send( const std::string& data )
|
bool ConnectionTLS::send( const std::string& data )
|
||||||
|
@ -198,6 +191,9 @@ namespace gloox
|
||||||
m_log.log( LogLevelWarning, LogAreaClassConnectionTLS, "TLS handshake failed" );
|
m_log.log( LogLevelWarning, LogAreaClassConnectionTLS, "TLS handshake failed" );
|
||||||
if( m_tlsHandler )
|
if( m_tlsHandler )
|
||||||
m_tlsHandler->handleHandshakeResult( tls, success, certinfo );
|
m_tlsHandler->handleHandshakeResult( tls, success, certinfo );
|
||||||
|
cleanup();
|
||||||
|
if( m_handler )
|
||||||
|
m_handler->handleDisconnect( this, ConnTlsFailed );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
* Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
* This file is part of the gloox library. http://camaya.net/gloox
|
* This file is part of the gloox library. http://camaya.net/gloox
|
||||||
*
|
*
|
||||||
* This software is distributed under a license. The full license
|
* This software is distributed under a license. The full license
|
||||||
|
@ -35,7 +35,7 @@ namespace gloox
|
||||||
* @code
|
* @code
|
||||||
* Client *c = new Client( ... );
|
* Client *c = new Client( ... );
|
||||||
* c->setConnectionImpl( new ConnectionTLS( c,
|
* c->setConnectionImpl( new ConnectionTLS( c,
|
||||||
* new ConnectionTCP( c->logInstance(), server, 5223 ),
|
* new ConnectionTCPClient( c->logInstance(), server, 5223 ),
|
||||||
* c->logInstance()) );
|
* c->logInstance()) );
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
|
@ -43,7 +43,7 @@ namespace gloox
|
||||||
* established, be sure not to use the connection until ConnectionDataHandler::handleConnect()
|
* established, be sure not to use the connection until ConnectionDataHandler::handleConnect()
|
||||||
* of the specified ConnectionDataHandler is called.
|
* of the specified ConnectionDataHandler is called.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @author Matthew Wild <mwild1@gmail.com>
|
* @author Matthew Wild <mwild1@gmail.com>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 by Jakob Schroeter <js@camaya.net>
|
* Copyright (c) 2009-2015 by Jakob Schröter <js@camaya.net>
|
||||||
* This file is part of the gloox library. http://camaya.net/gloox
|
* This file is part of the gloox library. http://camaya.net/gloox
|
||||||
*
|
*
|
||||||
* This software is distributed under a license. The full license
|
* This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 by Jakob Schroeter <js@camaya.net>
|
* Copyright (c) 2009-2015 by Jakob Schröter <js@camaya.net>
|
||||||
* This file is part of the gloox library. http://camaya.net/gloox
|
* This file is part of the gloox library. http://camaya.net/gloox
|
||||||
*
|
*
|
||||||
* This software is distributed under a license. The full license
|
* This software is distributed under a license. The full license
|
||||||
|
@ -32,7 +32,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* You should not need to use this class directly.
|
* You should not need to use this class directly.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API ConnectionTLSServer : public ConnectionTLS
|
class GLOOX_API ConnectionTLSServer : public ConnectionTLS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -22,26 +22,26 @@ namespace gloox
|
||||||
{
|
{
|
||||||
|
|
||||||
DataForm::DataForm( FormType type, const StringList& instructions, const std::string& title )
|
DataForm::DataForm( FormType type, const StringList& instructions, const std::string& title )
|
||||||
: StanzaExtension( ExtDataForm ),
|
: AdhocPlugin( ExtDataForm ),
|
||||||
m_type( type ), m_instructions( instructions ), m_title( title ), m_reported( 0 )
|
m_type( type ), m_instructions( instructions ), m_title( title ), m_reported( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DataForm::DataForm( FormType type, const std::string& title )
|
DataForm::DataForm( FormType type, const std::string& title )
|
||||||
: StanzaExtension( ExtDataForm ),
|
: AdhocPlugin( ExtDataForm ),
|
||||||
m_type( type ), m_title( title ), m_reported( 0 )
|
m_type( type ), m_title( title ), m_reported( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DataForm::DataForm( const Tag* tag )
|
DataForm::DataForm( const Tag* tag )
|
||||||
: StanzaExtension( ExtDataForm ),
|
: AdhocPlugin( ExtDataForm ),
|
||||||
m_type( TypeInvalid ), m_reported( 0 )
|
m_type( TypeInvalid ), m_reported( 0 )
|
||||||
{
|
{
|
||||||
parse( tag );
|
parse( tag );
|
||||||
}
|
}
|
||||||
|
|
||||||
DataForm::DataForm( const DataForm& form )
|
DataForm::DataForm( const DataForm& form )
|
||||||
: StanzaExtension( ExtDataForm ), DataFormFieldContainer( form ),
|
: AdhocPlugin( ExtDataForm ), DataFormFieldContainer( form ),
|
||||||
m_type( form.m_type ), m_instructions( form.m_instructions ),
|
m_type( form.m_type ), m_instructions( form.m_instructions ),
|
||||||
m_title( form.m_title ), m_reported( form.m_reported ? new DataFormReported( form.m_reported->tag() ) : 0 )
|
m_title( form.m_title ), m_reported( form.m_reported ? new DataFormReported( form.m_reported->tag() ) : 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
#define DATAFORM_H__
|
#define DATAFORM_H__
|
||||||
|
|
||||||
#include "dataformfieldcontainer.h"
|
#include "dataformfieldcontainer.h"
|
||||||
#include "stanzaextension.h"
|
#include "adhocplugin.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -46,14 +46,14 @@ namespace gloox
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of a XEP-0004 Data Form.
|
* @brief An abstraction of a @xep{0004} Data Form.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.7
|
* @since 0.7
|
||||||
*/
|
*/
|
||||||
class GLOOX_API DataForm : public StanzaExtension, public DataFormFieldContainer
|
class GLOOX_API DataForm : public AdhocPlugin, public DataFormFieldContainer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -25,9 +25,9 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of a single field in a XEP-0004 Data Form.
|
* @brief An abstraction of a single field in a @xep{0004} Data Form.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.7
|
* @since 0.7
|
||||||
*/
|
*/
|
||||||
class GLOOX_API DataFormField
|
class GLOOX_API DataFormField
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -25,11 +25,11 @@ namespace gloox
|
||||||
class DataFormField;
|
class DataFormField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An abstract base class for a XEP-0004 Data Form.
|
* @brief An abstract base class for a @xep{0004} Data Form.
|
||||||
*
|
*
|
||||||
* You shouldn't need to use this class directly. Use DataForm instead.
|
* You shouldn't need to use this class directly. Use DataForm instead.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.7
|
* @since 0.7
|
||||||
*/
|
*/
|
||||||
class GLOOX_API DataFormFieldContainer
|
class GLOOX_API DataFormFieldContainer
|
||||||
|
@ -52,7 +52,7 @@ namespace gloox
|
||||||
virtual ~DataFormFieldContainer();
|
virtual ~DataFormFieldContainer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of XEP-0004 Data Form Fields.
|
* A list of @xep{0004} Data Form Fields.
|
||||||
*/
|
*/
|
||||||
typedef std::list<DataFormField*> FieldList;
|
typedef std::list<DataFormField*> FieldList;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -20,12 +20,12 @@ namespace gloox
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of an <item> element in a XEP-0004 Data Form of type result.
|
* @brief An abstraction of an <item> element in a @xep{0004} Data Form of type result.
|
||||||
*
|
*
|
||||||
* There are some constraints regarding usage of this element you should be aware of. Check XEP-0004
|
* There are some constraints regarding usage of this element you should be aware of. Check @xep{0004}
|
||||||
* section 3.4. This class does not enforce correct usage at this point.
|
* section 3.4. This class does not enforce correct usage at this point.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.7
|
* @since 0.7
|
||||||
*/
|
*/
|
||||||
class GLOOX_API DataFormItem : public DataFormFieldContainer
|
class GLOOX_API DataFormItem : public DataFormFieldContainer
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -22,12 +22,12 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of a <reported> element in a XEP-0004 Data Form of type result.
|
* @brief An abstraction of a <reported> element in a @xep{0004} Data Form of type result.
|
||||||
*
|
*
|
||||||
* There are some constraints regarding usage of this element you should be aware of. Check XEP-0004
|
* There are some constraints regarding usage of this element you should be aware of. Check @xep{0004}
|
||||||
* section 3.4. This class does not enforce correct usage at this point.
|
* section 3.4. This class does not enforce correct usage at this point.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.7
|
* @since 0.7
|
||||||
*/
|
*/
|
||||||
class GLOOX_API DataFormReported : public DataFormFieldContainer
|
class GLOOX_API DataFormReported : public DataFormFieldContainer
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -31,6 +31,7 @@ namespace gloox
|
||||||
{
|
{
|
||||||
if( !tag || !tag->hasAttribute( "stamp" ) )
|
if( !tag || !tag->hasAttribute( "stamp" ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !( tag->name() == "x" && tag->hasAttribute( XMLNS, XMLNS_X_DELAY ) ) )
|
if( !( tag->name() == "x" && tag->hasAttribute( XMLNS, XMLNS_X_DELAY ) ) )
|
||||||
if( !( tag->name() == "delay" && tag->hasAttribute( XMLNS, XMLNS_DELAY ) ) )
|
if( !( tag->name() == "delay" && tag->hasAttribute( XMLNS, XMLNS_DELAY ) ) )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -26,13 +26,13 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is an implementation of XEP-0203 (Delayed Delivery).
|
* @brief This is an implementation of @xep{0203} (Delayed Delivery).
|
||||||
*
|
*
|
||||||
* The class also implements the deprecated XEP-0091 (Delayed Delivery) in a read-only fashion.
|
* The class also implements the deprecated @xep{0091} (Delayed Delivery) in a read-only fashion.
|
||||||
* It understands both XEP formats for input, but any output will conform to XEP-0203.
|
* It understands both XEP formats for input, but any output will conform to @xep{0203}.
|
||||||
*
|
*
|
||||||
* XEP Version: 0.1
|
* XEP Version: 0.1
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API DelayedDelivery : public StanzaExtension
|
class GLOOX_API DelayedDelivery : public StanzaExtension
|
||||||
|
@ -61,7 +61,7 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the datetime when the stanza was originally sent.
|
* Returns the datetime when the stanza was originally sent.
|
||||||
* The format MUST adhere to the dateTime format specified in XEP-0082 and MUST
|
* The format MUST adhere to the dateTime format specified in @xep{0082} and MUST
|
||||||
* be expressed in UTC.
|
* be expressed in UTC.
|
||||||
* @return The original datetime.
|
* @return The original datetime.
|
||||||
*/
|
*/
|
||||||
|
@ -76,7 +76,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* Returns the JID of the original sender of the stanza or the entity that
|
* Returns the JID of the original sender of the stanza or the entity that
|
||||||
* delayed the sending.
|
* delayed the sending.
|
||||||
* The format MUST adhere to the dateTime format specified in XEP-0082 and MUST
|
* The format MUST adhere to the dateTime format specified in @xep{0082} and MUST
|
||||||
* be expressed in UTC.
|
* be expressed in UTC.
|
||||||
* @return The JID.
|
* @return The JID.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -34,13 +34,13 @@ namespace gloox
|
||||||
class IQ;
|
class IQ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class implements XEP-0030 (Service Discovery) and XEP-0092 (Software Version).
|
* @brief This class implements @xep{0030} (Service Discovery) and @xep{0092} (Software Version).
|
||||||
*
|
*
|
||||||
* ClientBase will automatically instantiate a Disco object. It can be used to
|
* ClientBase will automatically instantiate a Disco object. It can be used to
|
||||||
* announce special features of your client, or its version, or...
|
* announce special features of your client, or its version, or...
|
||||||
*
|
*
|
||||||
* XEP version: 2.2
|
* XEP version: 2.2
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Disco : public IqHandler
|
class GLOOX_API Disco : public IqHandler
|
||||||
{
|
{
|
||||||
|
@ -56,10 +56,10 @@ namespace gloox
|
||||||
typedef std::list<Identity*> IdentityList;
|
typedef std::list<Identity*> IdentityList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of a Disco Info element (from Service Discovery, XEP-0030)
|
* @brief An abstraction of a Disco Info element (from Service Discovery, @xep{0030})
|
||||||
* as a StanzaExtension.
|
* as a StanzaExtension.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Info : public StanzaExtension
|
class GLOOX_API Info : public StanzaExtension
|
||||||
|
@ -93,13 +93,13 @@ namespace gloox
|
||||||
const IdentityList& identities() const { return m_identities; }
|
const IdentityList& identities() const { return m_identities; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an optionally included data form. This is used by e.g. MUC (XEP-0045).
|
* Returns an optionally included data form. This is used by e.g. MUC (@xep{0045}).
|
||||||
* @return An optional data form included in the disco#info. May be 0.
|
* @return An optional data form included in the disco#info. May be 0.
|
||||||
*/
|
*/
|
||||||
const DataForm* form() const { return m_form; }
|
const DataForm* form() const { return m_form; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an optional DataForm, e.g. for XEP-0232. Only one form can be added
|
* Adds an optional DataForm, e.g. for @xep{0232}. Only one form can be added
|
||||||
* at this point.
|
* at this point.
|
||||||
* @param form An optional DataForm to include in the Info reply.
|
* @param form An optional DataForm to include in the Info reply.
|
||||||
* The form will be owned by and deleted on destruction of the Info object.
|
* The form will be owned by and deleted on destruction of the Info object.
|
||||||
|
@ -188,9 +188,9 @@ namespace gloox
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of a Disco identity (Service Discovery, XEP-0030).
|
* @brief An abstraction of a Disco identity (Service Discovery, @xep{0030}).
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Identity
|
class GLOOX_API Identity
|
||||||
|
@ -266,10 +266,10 @@ namespace gloox
|
||||||
typedef std::list<Item*> ItemList;
|
typedef std::list<Item*> ItemList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of a Disco query element (from Service Discovery, XEP-0030)
|
* @brief An abstraction of a Disco query element (from Service Discovery, @xep{0030})
|
||||||
* in the disco#items namespace, implemented as a StanzaExtension.
|
* in the disco#items namespace, implemented as a StanzaExtension.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Items : public StanzaExtension
|
class GLOOX_API Items : public StanzaExtension
|
||||||
|
@ -278,7 +278,7 @@ namespace gloox
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This needs to be public so one can proactively send a list of adhoc commands
|
// This needs to be public so one can proactively send a list of adhoc commands
|
||||||
// see XEP-0050
|
// see @xep{0050}
|
||||||
/**
|
/**
|
||||||
* Creates an empty Items object, suitable for making disco#items requests.
|
* Creates an empty Items object, suitable for making disco#items requests.
|
||||||
* @param node The node identifier to query (optional).
|
* @param node The node identifier to query (optional).
|
||||||
|
@ -344,9 +344,9 @@ namespace gloox
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of a Disco item (Service Discovery, XEP-0030).
|
* @brief An abstraction of a Disco item (Service Discovery, @xep{0030}).
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Item
|
class GLOOX_API Item
|
||||||
|
@ -439,7 +439,7 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries the given JID for general infomation according to
|
* Queries the given JID for general infomation according to
|
||||||
* XEP-0030 (Service Discovery).
|
* @xep{0030} (Service Discovery).
|
||||||
* To receive the results inherit from DiscoHandler and register with the Disco object.
|
* To receive the results inherit from DiscoHandler and register with the Disco object.
|
||||||
* @param to The destination-JID of the query.
|
* @param to The destination-JID of the query.
|
||||||
* @param node An optional node to query. Not inserted if empty.
|
* @param node An optional node to query. Not inserted if empty.
|
||||||
|
@ -454,7 +454,7 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries the given JID for its items according to
|
* Queries the given JID for its items according to
|
||||||
* XEP-0030 (Service Discovery).
|
* @xep{0030} (Service Discovery).
|
||||||
* To receive the results inherit from DiscoHandler and register with the Disco object.
|
* To receive the results inherit from DiscoHandler and register with the Disco object.
|
||||||
* @param to The destination-JID of the query.
|
* @param to The destination-JID of the query.
|
||||||
* @param node An optional node to query. Not inserted if empty.
|
* @param node An optional node to query. Not inserted if empty.
|
||||||
|
@ -471,8 +471,8 @@ namespace gloox
|
||||||
* Sets the version of the host application using this library.
|
* Sets the version of the host application using this library.
|
||||||
* The library takes care of jabber:iq:version requests. These
|
* The library takes care of jabber:iq:version requests. These
|
||||||
* IQ packets will not be forwarded to the IqHandlers.
|
* IQ packets will not be forwarded to the IqHandlers.
|
||||||
* @param name The name to be returned to inquireing clients.
|
* @param name The name to be returned to inquiring clients.
|
||||||
* @param version The version to be returned to inquireing clients.
|
* @param version The version to be returned to inquiring clients.
|
||||||
* @param os The operating system to announce. Default: don't include.
|
* @param os The operating system to announce. Default: don't include.
|
||||||
*/
|
*/
|
||||||
void setVersion( const std::string& name, const std::string& version,
|
void setVersion( const std::string& name, const std::string& version,
|
||||||
|
@ -500,10 +500,10 @@ namespace gloox
|
||||||
* Sets the identity of this entity.
|
* Sets the identity of this entity.
|
||||||
* The library uses this information to answer disco#info requests
|
* The library uses this information to answer disco#info requests
|
||||||
* with a correct identity.
|
* with a correct identity.
|
||||||
* XEP-0030 requires an entity to have at least one identity. See XEP-0030
|
* @xep{0030} requires an entity to have at least one identity. See @xep{0030}
|
||||||
* for more information on categories and types.
|
* for more information on categories and types.
|
||||||
* @param category The entity category of this client. Default: client.
|
* @param category The entity category of this client. Default: client. May not be empty.
|
||||||
* @param type The type of this entity. Default: bot.
|
* @param type The type of this entity. Default: bot. May not be empty.
|
||||||
* @param name The name of the entity. Default: empty.
|
* @param name The name of the entity. Default: empty.
|
||||||
* @note An entity can have more than one identity. You cann add more identities
|
* @note An entity can have more than one identity. You cann add more identities
|
||||||
* using addIdentity(). A call to setIdentity() will clear the list of identities
|
* using addIdentity(). A call to setIdentity() will clear the list of identities
|
||||||
|
@ -514,8 +514,8 @@ namespace gloox
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds another identity to the list of identities.
|
* Adds another identity to the list of identities.
|
||||||
* @param category The entity category of this client. Default: client.
|
* @param category The entity category of this client. Default: client. May not be empty.
|
||||||
* @param type The type of this entity. Default: bot.
|
* @param type The type of this entity. Default: bot. May not be empty.
|
||||||
* @param name The name of the entity. Default: empty.
|
* @param name The name of the entity. Default: empty.
|
||||||
*/
|
*/
|
||||||
void addIdentity( const std::string& category, const std::string& type,
|
void addIdentity( const std::string& category, const std::string& type,
|
||||||
|
@ -529,7 +529,7 @@ namespace gloox
|
||||||
const IdentityList& identities() const { return m_identities; }
|
const IdentityList& identities() const { return m_identities; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an optional DataForm to Disco:Info replies, e.g. for XEP-0232.
|
* Adds an optional DataForm to Disco:Info replies, e.g. for @xep{0232}.
|
||||||
* Only one form can be added at this point.
|
* Only one form can be added at this point.
|
||||||
* @param form An optional DataForm to include in the Info reply.
|
* @param form An optional DataForm to include in the Info reply.
|
||||||
* The form will be owned by and deleted on destruction of the Disco object.
|
* The form will be owned by and deleted on destruction of the Disco object.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -25,11 +25,11 @@ namespace gloox
|
||||||
class IQ;
|
class IQ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A virtual interface that enables objects to receive Service Discovery (XEP-0030) events.
|
* @brief A virtual interface that enables objects to receive Service Discovery (@xep{0030}) events.
|
||||||
*
|
*
|
||||||
* A class implementing this interface can receive the results of sent disco queries.
|
* A class implementing this interface can receive the results of sent disco queries.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
*/
|
*/
|
||||||
class GLOOX_API DiscoHandler
|
class GLOOX_API DiscoHandler
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2004-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -30,7 +30,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* Incoming disco#info and disco#items queries are delegated to their respective handlers.
|
* Incoming disco#info and disco#items queries are delegated to their respective handlers.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
*/
|
*/
|
||||||
class GLOOX_API DiscoNodeHandler
|
class GLOOX_API DiscoNodeHandler
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -22,7 +22,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#if ( !defined( _WIN32 ) && !defined( _WIN32_WCE ) ) || defined( __SYMBIAN32__ )
|
#if ( !defined( _WIN32 ) && !defined( _WIN32_WCE ) ) || defined( __SYMBIAN32__ )
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
|
@ -99,7 +98,7 @@ namespace gloox
|
||||||
HEADER* hdr = (HEADER*)srvbuf.buf;
|
HEADER* hdr = (HEADER*)srvbuf.buf;
|
||||||
unsigned char* here = srvbuf.buf + NS_HFIXEDSZ;
|
unsigned char* here = srvbuf.buf + NS_HFIXEDSZ;
|
||||||
|
|
||||||
if( ( hdr->tc ) || ( srvbuf.len < NS_HFIXEDSZ ) )
|
if( srvbuf.len < NS_HFIXEDSZ )
|
||||||
error = true;
|
error = true;
|
||||||
|
|
||||||
if( hdr->rcode >= 1 && hdr->rcode <= 5 )
|
if( hdr->rcode >= 1 && hdr->rcode <= 5 )
|
||||||
|
@ -157,7 +156,7 @@ namespace gloox
|
||||||
return servers;
|
return servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined( _WIN32 ) && defined( HAVE_WINDNS_H )
|
#elif defined( _WIN32 ) && defined( HAVE_WINDNS_H ) && !defined( __MINGW32__ )
|
||||||
DNS::HostMap DNS::resolve( const std::string& service, const std::string& proto,
|
DNS::HostMap DNS::resolve( const std::string& service, const std::string& proto,
|
||||||
const std::string& domain, const LogSink& logInstance )
|
const std::string& domain, const LogSink& logInstance )
|
||||||
{
|
{
|
||||||
|
@ -169,7 +168,10 @@ namespace gloox
|
||||||
DNS_STATUS status = DnsQuery_UTF8( dname.c_str(), DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &pRecord, NULL );
|
DNS_STATUS status = DnsQuery_UTF8( dname.c_str(), DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &pRecord, NULL );
|
||||||
if( status == ERROR_SUCCESS )
|
if( status == ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
DNS_RECORD* pRec = pRecord;
|
// NOTE: DnsQuery_UTF8 and DnsQuery_A really should have been defined with
|
||||||
|
// PDNS_RECORDA instead of PDNS_RECORD, since that's what it is (even with _UNICODE defined).
|
||||||
|
// We'll correct for that mistake with a cast.
|
||||||
|
DNS_RECORDA* pRec = (DNS_RECORDA*)pRecord;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if( pRec->wType == DNS_TYPE_SRV )
|
if( pRec->wType == DNS_TYPE_SRV )
|
||||||
|
@ -290,10 +292,9 @@ namespace gloox
|
||||||
}
|
}
|
||||||
|
|
||||||
if( res->ai_canonname )
|
if( res->ai_canonname )
|
||||||
logInstance.dbg( LogAreaClassDns, "Connecting to " + std::string( res->ai_canonname )
|
logInstance.dbg( LogAreaClassDns, std::string( "Connecting to " ).append( res->ai_canonname ).append( " (" ).append( ip ).append( "), port " ).append( port ) );
|
||||||
+ " (" + ip + "), port " + port );
|
|
||||||
else
|
else
|
||||||
logInstance.dbg( LogAreaClassDns, "Connecting to " + ip + ":" + port );
|
logInstance.dbg( LogAreaClassDns, std::string( "Connecting to " ).append( ip ).append( ":" ).append( port ) );
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
@ -302,7 +303,7 @@ namespace gloox
|
||||||
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
|
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
|
||||||
#else
|
#else
|
||||||
"errno: " + util::int2string( errno );
|
"errno: " + util::int2string( errno ) + ": " + strerror( errno );
|
||||||
#endif
|
#endif
|
||||||
logInstance.dbg( LogAreaClassDns, message );
|
logInstance.dbg( LogAreaClassDns, message );
|
||||||
|
|
||||||
|
@ -343,6 +344,7 @@ namespace gloox
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int protocol = IPPROTO_TCP;
|
int protocol = IPPROTO_TCP;
|
||||||
|
#if !defined( __APPLE__ ) // Sandboxing on Apple doesn't like you to use getprotobyname
|
||||||
struct protoent* prot;
|
struct protoent* prot;
|
||||||
if( ( prot = getprotobyname( "tcp" ) ) != 0 )
|
if( ( prot = getprotobyname( "tcp" ) ) != 0 )
|
||||||
{
|
{
|
||||||
|
@ -354,13 +356,14 @@ namespace gloox
|
||||||
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() )
|
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() )
|
||||||
#else
|
#else
|
||||||
"errno: " + util::int2string( errno );
|
"errno: " + util::int2string( errno ) + ": " + strerror( errno );
|
||||||
#endif
|
#endif
|
||||||
+ ". Falling back to IPPROTO_TCP: " + util::int2string( IPPROTO_TCP );
|
+ ". Falling back to IPPROTO_TCP: " + util::int2string( IPPROTO_TCP );
|
||||||
logInstance.dbg( LogAreaClassDns, message );
|
logInstance.dbg( LogAreaClassDns, message );
|
||||||
|
|
||||||
// Do not return an error. We'll fall back to IPPROTO_TCP.
|
// Do not return an error. We'll fall back to IPPROTO_TCP.
|
||||||
}
|
}
|
||||||
|
#endif // !defined( __APPLE__ )
|
||||||
|
|
||||||
return getSocket( PF_INET, SOCK_STREAM, protocol, logInstance );
|
return getSocket( PF_INET, SOCK_STREAM, protocol, logInstance );
|
||||||
}
|
}
|
||||||
|
@ -382,7 +385,7 @@ namespace gloox
|
||||||
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
|
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
|
||||||
#else
|
#else
|
||||||
"errno: " + util::int2string( errno );
|
"errno: " + util::int2string( errno ) + ": " + strerror( errno );
|
||||||
#endif
|
#endif
|
||||||
logInstance.dbg( LogAreaClassDns, message );
|
logInstance.dbg( LogAreaClassDns, message );
|
||||||
|
|
||||||
|
@ -392,8 +395,9 @@ namespace gloox
|
||||||
|
|
||||||
#ifdef HAVE_SETSOCKOPT
|
#ifdef HAVE_SETSOCKOPT
|
||||||
int timeout = 5000;
|
int timeout = 5000;
|
||||||
|
int reuseaddr = 1;
|
||||||
setsockopt( fd, SOL_SOCKET, SO_SNDTIMEO, (char*)&timeout, sizeof( timeout ) );
|
setsockopt( fd, SOL_SOCKET, SO_SNDTIMEO, (char*)&timeout, sizeof( timeout ) );
|
||||||
setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, (char*)&timeout, sizeof( timeout ) );
|
setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, (char*)&reuseaddr, sizeof( reuseaddr ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (int)fd;
|
return (int)fd;
|
||||||
|
@ -410,6 +414,7 @@ namespace gloox
|
||||||
{
|
{
|
||||||
logInstance.dbg( LogAreaClassDns, "gethostbyname() failed for " + host + "." );
|
logInstance.dbg( LogAreaClassDns, "gethostbyname() failed for " + host + "." );
|
||||||
cleanup( logInstance );
|
cleanup( logInstance );
|
||||||
|
closeSocket( fd, logInstance );
|
||||||
return -ConnDnsError;
|
return -ConnDnsError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,6 +426,7 @@ namespace gloox
|
||||||
{
|
{
|
||||||
logInstance.dbg( LogAreaClassDns, "gethostbyname() returned unexpected structure." );
|
logInstance.dbg( LogAreaClassDns, "gethostbyname() returned unexpected structure." );
|
||||||
cleanup( logInstance );
|
cleanup( logInstance );
|
||||||
|
closeSocket( fd, logInstance );
|
||||||
return -ConnDnsError;
|
return -ConnDnsError;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -444,7 +450,7 @@ namespace gloox
|
||||||
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
|
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
|
||||||
#else
|
#else
|
||||||
"errno: " + util::int2string( errno );
|
"errno: " + util::int2string( errno ) + ": " + strerror( errno );
|
||||||
#endif
|
#endif
|
||||||
logInstance.dbg( LogAreaClassDns, message );
|
logInstance.dbg( LogAreaClassDns, message );
|
||||||
|
|
||||||
|
@ -466,7 +472,7 @@ namespace gloox
|
||||||
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
|
||||||
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
|
"WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
|
||||||
#else
|
#else
|
||||||
"errno: " + util::int2string( errno );
|
"errno: " + util::int2string( errno ) + ": " + strerror( errno );
|
||||||
#endif
|
#endif
|
||||||
logInstance.dbg( LogAreaClassDns, message );
|
logInstance.dbg( LogAreaClassDns, message );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -55,7 +55,7 @@ namespace gloox
|
||||||
*
|
*
|
||||||
* You should not need to use these functions directly.
|
* You should not need to use these functions directly.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.3
|
* @since 0.3
|
||||||
*/
|
*/
|
||||||
class GLOOX_API DNS
|
class GLOOX_API DNS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -28,7 +28,7 @@ namespace gloox
|
||||||
* @brief A stanza error abstraction implemented as a StanzaExtension.
|
* @brief A stanza error abstraction implemented as a StanzaExtension.
|
||||||
*
|
*
|
||||||
* @author Vincent Thomasset
|
* @author Vincent Thomasset
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API Error : public StanzaExtension
|
class GLOOX_API Error : public StanzaExtension
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2008-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2008-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -22,7 +22,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* @brief A base class for events.
|
* @brief A base class for events.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class Event
|
class Event
|
||||||
|
@ -34,9 +34,9 @@ namespace gloox
|
||||||
*/
|
*/
|
||||||
enum EventType
|
enum EventType
|
||||||
{
|
{
|
||||||
PingPing, /**< Incoming Ping (XEP-0199). */
|
PingPing, /**< Incoming Ping (@xep{0199}). */
|
||||||
PingPong, /**< Incoming Pong (XEP-0199). */
|
PingPong, /**< Incoming Pong (@xep{0199}). */
|
||||||
PingError /**< Incoming Error Pong (XEP-0199). */
|
PingError /**< Incoming Error Pong (@xep{0199}). */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2008-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2008-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2008-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2008-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -27,7 +27,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* @brief An Event dispatcher.
|
* @brief An Event dispatcher.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class EventDispatcher
|
class EventDispatcher
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2008-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2008-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -22,7 +22,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* @brief An base class for event handlers.
|
* @brief An base class for event handlers.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class EventHandler
|
class EventHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -25,11 +25,11 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of Feature Negotiation (XEP-0020), implemented
|
* @brief An abstraction of Feature Negotiation (@xep{0020}), implemented
|
||||||
* as a StanzaExtension.
|
* as a StanzaExtension.
|
||||||
*
|
*
|
||||||
* XEP Version: 1.5
|
* XEP Version: 1.5
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class GLOOX_API FeatureNeg : public StanzaExtension
|
class GLOOX_API FeatureNeg : public StanzaExtension
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -24,11 +24,11 @@ namespace gloox
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An implementation of XEP-0013 (Flexible Offline Message Retrieval).
|
* @brief An implementation of @xep{0013} (Flexible Offline Message Retrieval).
|
||||||
*
|
*
|
||||||
* Use the FlexibleOfflineHandler to receive results.
|
* Use the FlexibleOfflineHandler to receive results.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.7
|
* @since 0.7
|
||||||
*/
|
*/
|
||||||
class GLOOX_API FlexibleOffline : public DiscoHandler, public IqHandler
|
class GLOOX_API FlexibleOffline : public DiscoHandler, public IqHandler
|
||||||
|
@ -84,7 +84,7 @@ namespace gloox
|
||||||
{ messageOperation( FORemoveMsgs, msgs ); }
|
{ messageOperation( FORemoveMsgs, msgs ); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a FlexibleOfflineHandler as object that receives results of XEP-0013 queries.
|
* Registers a FlexibleOfflineHandler as object that receives results of @xep{0013} queries.
|
||||||
* Only one Handler at a time is possible.
|
* Only one Handler at a time is possible.
|
||||||
* @param foh The Handler object to register.
|
* @param foh The Handler object to register.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -30,14 +30,14 @@ namespace gloox
|
||||||
FomrForbidden, /**< The requester is a JID other than an authorized resource of the
|
FomrForbidden, /**< The requester is a JID other than an authorized resource of the
|
||||||
* user. Something wnet serieously wrong */
|
* user. Something wnet serieously wrong */
|
||||||
FomrItemNotFound, /**< The requested node (message ID) does not exist. */
|
FomrItemNotFound, /**< The requested node (message ID) does not exist. */
|
||||||
FomrUnknownError /**< An error occurred which is not specified in XEP-0013. */
|
FomrUnknownError /**< An error occurred which is not specified in @xep{0013}. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Implementation of this virtual interface allows for retrieval of offline messages following
|
* @brief Implementation of this virtual interface allows for retrieval of offline messages following
|
||||||
* XEP-0030.
|
* @xep{0030}.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.7
|
* @since 0.7
|
||||||
*/
|
*/
|
||||||
class GLOOX_API FlexibleOfflineHandler
|
class GLOOX_API FlexibleOfflineHandler
|
||||||
|
@ -49,9 +49,9 @@ namespace gloox
|
||||||
virtual ~FlexibleOfflineHandler() {}
|
virtual ~FlexibleOfflineHandler() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called to indicate whether the server supports XEP-0013 or not.
|
* This function is called to indicate whether the server supports @xep{0013} or not.
|
||||||
* Call @ref FlexibleOffline::checkSupport() to trigger the check.
|
* Call @ref FlexibleOffline::checkSupport() to trigger the check.
|
||||||
* @param support Whether the server support XEP-0013 or not.
|
* @param support Whether the server support @xep{0013} or not.
|
||||||
*/
|
*/
|
||||||
virtual void handleFlexibleOfflineSupport( bool support ) = 0;
|
virtual void handleFlexibleOfflineSupport( bool support ) = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -25,50 +25,50 @@ namespace gloox
|
||||||
const std::string XMLNS_DISCO_PUBLISH = "http://jabber.org/protocol/disco#publish";
|
const std::string XMLNS_DISCO_PUBLISH = "http://jabber.org/protocol/disco#publish";
|
||||||
const std::string XMLNS_ADHOC_COMMANDS = "http://jabber.org/protocol/commands";
|
const std::string XMLNS_ADHOC_COMMANDS = "http://jabber.org/protocol/commands";
|
||||||
const std::string XMLNS_COMPRESSION = "http://jabber.org/protocol/compress";
|
const std::string XMLNS_COMPRESSION = "http://jabber.org/protocol/compress";
|
||||||
const std::string XMLNS_OFFLINE = "http://jabber.org/protocol/offline";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_OFFLINE = "http://jabber.org/protocol/offline";
|
||||||
const std::string XMLNS_CHAT_STATES = "http://jabber.org/protocol/chatstates";
|
const std::string XMLNS_CHAT_STATES = "http://jabber.org/protocol/chatstates";
|
||||||
const std::string XMLNS_AMP = "http://jabber.org/protocol/amp";
|
const std::string XMLNS_AMP = "http://jabber.org/protocol/amp";
|
||||||
const std::string XMLNS_IBB = "http://jabber.org/protocol/ibb";
|
const std::string XMLNS_IBB = "http://jabber.org/protocol/ibb";
|
||||||
const std::string XMLNS_FEATURE_NEG = "http://jabber.org/protocol/feature-neg";
|
const std::string XMLNS_FEATURE_NEG = "http://jabber.org/protocol/feature-neg";
|
||||||
const std::string XMLNS_CHATNEG = "http://jabber.org/protocol/chatneg";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_CHATNEG = "http://jabber.org/protocol/chatneg";
|
||||||
const std::string XMLNS_XHTML_IM = "http://jabber.org/protocol/xhtml-im";
|
const std::string XMLNS_XHTML_IM = "http://jabber.org/protocol/xhtml-im";
|
||||||
const std::string XMLNS_DELAY = "urn:xmpp:delay";
|
const std::string XMLNS_DELAY = "urn:xmpp:delay";
|
||||||
const std::string XMLNS_ROSTER = "jabber:iq:roster";
|
const std::string XMLNS_ROSTER = "jabber:iq:roster";
|
||||||
const std::string XMLNS_VERSION = "jabber:iq:version";
|
const std::string XMLNS_VERSION = "jabber:iq:version";
|
||||||
const std::string XMLNS_REGISTER = "jabber:iq:register";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_REGISTER = "jabber:iq:register";
|
||||||
const std::string XMLNS_PRIVACY = "jabber:iq:privacy";
|
const std::string XMLNS_PRIVACY = "jabber:iq:privacy";
|
||||||
const std::string XMLNS_AUTH = "jabber:iq:auth";
|
const std::string XMLNS_AUTH = "jabber:iq:auth";
|
||||||
const std::string XMLNS_PRIVATE_XML = "jabber:iq:private";
|
const std::string XMLNS_PRIVATE_XML = "jabber:iq:private";
|
||||||
const std::string XMLNS_LAST = "jabber:iq:last";
|
const std::string XMLNS_LAST = "jabber:iq:last";
|
||||||
const std::string XMLNS_SEARCH = "jabber:iq:search";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_SEARCH = "jabber:iq:search";
|
||||||
const std::string XMLNS_IQ_OOB = "jabber:iq:oob";
|
const std::string XMLNS_IQ_OOB = "jabber:iq:oob";
|
||||||
const std::string XMLNS_X_DATA = "jabber:x:data";
|
const std::string XMLNS_X_DATA = "jabber:x:data";
|
||||||
const std::string XMLNS_X_EVENT = "jabber:x:event";
|
const std::string XMLNS_X_EVENT = "jabber:x:event";
|
||||||
const std::string XMLNS_X_OOB = "jabber:x:oob";
|
const std::string XMLNS_X_OOB = "jabber:x:oob";
|
||||||
const std::string XMLNS_X_DELAY = "jabber:x:delay";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_X_DELAY = "jabber:x:delay";
|
||||||
const std::string XMLNS_X_GPGSIGNED = "jabber:x:signed";
|
const std::string XMLNS_X_GPGSIGNED = "jabber:x:signed";
|
||||||
const std::string XMLNS_X_GPGENCRYPTED = "jabber:x:encrypted";
|
const std::string XMLNS_X_GPGENCRYPTED = "jabber:x:encrypted";
|
||||||
const std::string XMLNS_VCARD_TEMP = "vcard-temp";
|
const std::string XMLNS_VCARD_TEMP = "vcard-temp";
|
||||||
const std::string XMLNS_X_VCARD_UPDATE = "vcard-temp:x:update";
|
const std::string XMLNS_X_VCARD_UPDATE = "vcard-temp:x:update";
|
||||||
const std::string XMLNS_BOOKMARKS = "storage:bookmarks";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_BOOKMARKS = "storage:bookmarks";
|
||||||
const std::string XMLNS_ANNOTATIONS = "storage:rosternotes";
|
const std::string XMLNS_ANNOTATIONS = "storage:rosternotes";
|
||||||
const std::string XMLNS_ROSTER_DELIMITER = "roster:delimiter";
|
const std::string XMLNS_ROSTER_DELIMITER = "roster:delimiter";
|
||||||
const std::string XMLNS_XMPP_PING = "urn:xmpp:ping";
|
const std::string XMLNS_XMPP_PING = "urn:xmpp:ping";
|
||||||
const std::string XMLNS_SI = "http://jabber.org/protocol/si";
|
const std::string XMLNS_SI = "http://jabber.org/protocol/si";
|
||||||
const std::string XMLNS_SI_FT = "http://jabber.org/protocol/si/profile/file-transfer";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_SI_FT = "http://jabber.org/protocol/si/profile/file-transfer";
|
||||||
const std::string XMLNS_BYTESTREAMS = "http://jabber.org/protocol/bytestreams";
|
const std::string XMLNS_BYTESTREAMS = "http://jabber.org/protocol/bytestreams";
|
||||||
const std::string XMLNS_MUC = "http://jabber.org/protocol/muc";
|
const std::string XMLNS_MUC = "http://jabber.org/protocol/muc";
|
||||||
const std::string XMLNS_MUC_USER = "http://jabber.org/protocol/muc#user";
|
const std::string XMLNS_MUC_USER = "http://jabber.org/protocol/muc#user";
|
||||||
const std::string XMLNS_MUC_ADMIN = "http://jabber.org/protocol/muc#admin";
|
const std::string XMLNS_MUC_ADMIN = "http://jabber.org/protocol/muc#admin";
|
||||||
const std::string XMLNS_MUC_UNIQUE = "http://jabber.org/protocol/muc#unique";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_MUC_UNIQUE = "http://jabber.org/protocol/muc#unique";
|
||||||
const std::string XMLNS_MUC_OWNER = "http://jabber.org/protocol/muc#owner";
|
const std::string XMLNS_MUC_OWNER = "http://jabber.org/protocol/muc#owner";
|
||||||
const std::string XMLNS_MUC_ROOMINFO = "http://jabber.org/protocol/muc#roominfo";
|
const std::string XMLNS_MUC_ROOMINFO = "http://jabber.org/protocol/muc#roominfo";
|
||||||
const std::string XMLNS_MUC_ROOMS = "http://jabber.org/protocol/muc#rooms";
|
const std::string XMLNS_MUC_ROOMS = "http://jabber.org/protocol/muc#rooms";
|
||||||
|
@ -78,39 +78,44 @@ namespace gloox
|
||||||
const std::string XMLNS_PUBSUB_ERRORS = "http://jabber.org/protocol/pubsub#errors";
|
const std::string XMLNS_PUBSUB_ERRORS = "http://jabber.org/protocol/pubsub#errors";
|
||||||
const std::string XMLNS_PUBSUB_EVENT = "http://jabber.org/protocol/pubsub#event";
|
const std::string XMLNS_PUBSUB_EVENT = "http://jabber.org/protocol/pubsub#event";
|
||||||
const std::string XMLNS_PUBSUB_OWNER = "http://jabber.org/protocol/pubsub#owner";
|
const std::string XMLNS_PUBSUB_OWNER = "http://jabber.org/protocol/pubsub#owner";
|
||||||
|
|
||||||
const std::string XMLNS_CAPS = "http://jabber.org/protocol/caps";
|
const std::string XMLNS_CAPS = "http://jabber.org/protocol/caps";
|
||||||
const std::string XMLNS_FT_FASTMODE = "http://affinix.com/jabber/stream";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_FT_FASTMODE = "http://affinix.com/jabber/stream";
|
||||||
const std::string XMLNS_STREAM = "http://etherx.jabber.org/streams";
|
const std::string XMLNS_STREAM = "http://etherx.jabber.org/streams";
|
||||||
const std::string XMLNS_XMPP_STREAM = "urn:ietf:params:xml:ns:xmpp-streams";
|
const std::string XMLNS_XMPP_STREAM = "urn:ietf:params:xml:ns:xmpp-streams";
|
||||||
const std::string XMLNS_XMPP_STANZAS = "urn:ietf:params:xml:ns:xmpp-stanzas";
|
const std::string XMLNS_XMPP_STANZAS = "urn:ietf:params:xml:ns:xmpp-stanzas";
|
||||||
const std::string XMLNS_STREAM_TLS = "urn:ietf:params:xml:ns:xmpp-tls";
|
const std::string XMLNS_STREAM_TLS = "urn:ietf:params:xml:ns:xmpp-tls";
|
||||||
const std::string XMLNS_STREAM_SASL = "urn:ietf:params:xml:ns:xmpp-sasl";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_STREAM_SASL = "urn:ietf:params:xml:ns:xmpp-sasl";
|
||||||
const std::string XMLNS_STREAM_BIND = "urn:ietf:params:xml:ns:xmpp-bind";
|
const std::string XMLNS_STREAM_BIND = "urn:ietf:params:xml:ns:xmpp-bind";
|
||||||
const std::string XMLNS_STREAM_SESSION = "urn:ietf:params:xml:ns:xmpp-session";
|
const std::string XMLNS_STREAM_SESSION = "urn:ietf:params:xml:ns:xmpp-session";
|
||||||
const std::string XMLNS_STREAM_IQAUTH = "http://jabber.org/features/iq-auth";
|
const std::string XMLNS_STREAM_IQAUTH = "http://jabber.org/features/iq-auth";
|
||||||
const std::string XMLNS_STREAM_IQREGISTER = "http://jabber.org/features/iq-register";
|
const std::string XMLNS_STREAM_IQREGISTER = "http://jabber.org/features/iq-register";
|
||||||
const std::string XMLNS_STREAM_COMPRESS = "http://jabber.org/features/compress";
|
|
||||||
|
|
||||||
|
const std::string XMLNS_STREAM_COMPRESS = "http://jabber.org/features/compress";
|
||||||
const std::string XMLNS_HTTPBIND = "http://jabber.org/protocol/httpbind";
|
const std::string XMLNS_HTTPBIND = "http://jabber.org/protocol/httpbind";
|
||||||
const std::string XMLNS_XMPP_BOSH = "urn:xmpp:xbosh";
|
const std::string XMLNS_XMPP_BOSH = "urn:xmpp:xbosh";
|
||||||
const std::string XMLNS_RECEIPTS = "urn:xmpp:receipts";
|
const std::string XMLNS_RECEIPTS = "urn:xmpp:receipts";
|
||||||
const std::string XMLNS_NICKNAME = "http://jabber.org/protocol/nick";
|
const std::string XMLNS_NICKNAME = "http://jabber.org/protocol/nick";
|
||||||
|
|
||||||
const std::string XMLNS_JINGLE = "urn:xmpp:tmp:jingle";
|
const std::string XMLNS_JINGLE = "urn:xmpp:jingle:1";
|
||||||
const std::string XMLNS_JINGLE_AUDIO_RTP = "urn:xmpp:tmp:jingle:apps:audio-rtp";
|
const std::string XMLNS_JINGLE_ERRORS = "urn:xmpp:jingle:errors:1";
|
||||||
const std::string XMLNS_JINGLE_ICE_UDP = "urn:xmpp:tmp:jingle:transports:ice-udp";
|
const std::string XMLNS_JINGLE_ICE_UDP = "urn:xmpp:jingle:transports:ice-udp:1";
|
||||||
const std::string XMLNS_JINGLE_RAW_UDP = "urn:xmpp:tmp:jingle:transports:raw-udp";
|
const std::string XMLNS_JINGLE_FILE_TRANSFER = "urn:xmpp:jingle:apps:file-transfer:3";
|
||||||
const std::string XMLNS_JINGLE_VIDEO_RTP = "urn:xmpp:tmp:jingle:apps:video-rtp";
|
const std::string XMLNS_JINGLE_FILE_TRANSFER_MULTI = "urn:xmpp:jingle:apps:file-transfer:multi";
|
||||||
|
|
||||||
const std::string XMLNS_SHIM = "http://jabber.org/protocol/shim";
|
const std::string XMLNS_SHIM = "http://jabber.org/protocol/shim";
|
||||||
const std::string XMLNS_ATTENTION = "urn:xmpp:attention:0";
|
const std::string XMLNS_ATTENTION = "urn:xmpp:attention:0";
|
||||||
|
const std::string XMLNS_STREAM_MANAGEMENT = "urn:xmpp:sm:3";
|
||||||
|
const std::string XMLNS_STANZA_FORWARDING = "urn:xmpp:forward:0";
|
||||||
|
const std::string XMLNS_MESSAGE_CARBONS = "urn:xmpp:carbons:2";
|
||||||
|
|
||||||
|
const std::string XMLNS_HASHES = "urn:xmpp:hashes:1";
|
||||||
|
const std::string XMLNS_IODATA = "urn:xmpp:tmp:io-data";
|
||||||
|
|
||||||
const std::string XMPP_STREAM_VERSION_MAJOR = "1";
|
const std::string XMPP_STREAM_VERSION_MAJOR = "1";
|
||||||
const std::string XMPP_STREAM_VERSION_MINOR = "0";
|
const std::string XMPP_STREAM_VERSION_MINOR = "0";
|
||||||
const std::string GLOOX_VERSION = "1.0";
|
const std::string GLOOX_VERSION = "1.0.13";
|
||||||
const std::string GLOOX_CAPS_NODE = "http://camaya.net/gloox";
|
const std::string GLOOX_CAPS_NODE = "http://camaya.net/gloox";
|
||||||
|
|
||||||
const std::string XMLNS = "xmlns";
|
const std::string XMLNS = "xmlns";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
*
|
*
|
||||||
* A component in the Jabber/XMPP network is an add-on to a server which runs externally
|
* A component in the Jabber/XMPP network is an add-on to a server which runs externally
|
||||||
* to the actual server software, but can have similar privileges. Components use a protocol described in
|
* to the actual server software, but can have similar privileges. Components use a protocol described in
|
||||||
* XEP-0114 to connect and authenticate to a server.
|
* @xep{0114} to connect and authenticate to a server.
|
||||||
*
|
*
|
||||||
* The @link gloox::Component Component @endlink class supports this protocol and can be used to create
|
* The @link gloox::Component Component @endlink class supports this protocol and can be used to create
|
||||||
* a new Jabber component. It's as simple as:
|
* a new Jabber component. It's as simple as:
|
||||||
|
@ -262,7 +262,7 @@
|
||||||
*
|
*
|
||||||
* @section auth_sec Authentication
|
* @section auth_sec Authentication
|
||||||
*
|
*
|
||||||
* gloox supports old-style IQ-based authentication defined in XEP-0078 as well as several SASL mechanisms.
|
* gloox supports old-style IQ-based authentication defined in @xep{0078} as well as several SASL mechanisms.
|
||||||
* See the documentation of the @link gloox::Client Client @endlink class for more information.
|
* See the documentation of the @link gloox::Client Client @endlink class for more information.
|
||||||
*
|
*
|
||||||
* @section msg_sec Sending and Receiving of Chat Messages
|
* @section msg_sec Sending and Receiving of Chat Messages
|
||||||
|
@ -276,58 +276,65 @@
|
||||||
* The XMPP Standards Foundation has published a number of extensions to the core protocols, called
|
* The XMPP Standards Foundation has published a number of extensions to the core protocols, called
|
||||||
* XMPP Extension Protocols (XEPs). A couple of these XEPs are implemented in gloox:
|
* XMPP Extension Protocols (XEPs). A couple of these XEPs are implemented in gloox:
|
||||||
*
|
*
|
||||||
* @li XEP-0004 @link gloox::DataForm Data Forms @endlink
|
* @li @xep{0004} @link gloox::DataForm Data Forms @endlink
|
||||||
* @li XEP-0012 @link gloox::LastActivity Last Activity @endlink
|
* @li @xep{0012} @link gloox::LastActivity Last Activity @endlink
|
||||||
* @li XEP-0013 @link gloox::FlexibleOffline Flexible Offline Message Retrieval @endlink
|
* @li @xep{0013} @link gloox::FlexibleOffline Flexible Offline Message Retrieval @endlink
|
||||||
* @li XEP-0022 Message Events (see @link gloox::MessageSession MessageSession @endlink for examples)
|
* @li @xep{0022} Message Events (see @link gloox::MessageSession MessageSession @endlink for examples)
|
||||||
* @li XEP-0027 Current Jabber OpenPGP Usage (see @link gloox::GPGSigned GPGSigned @endlink
|
* @li @xep{0027} Current Jabber OpenPGP Usage (see @link gloox::GPGSigned GPGSigned @endlink
|
||||||
* and @link gloox::GPGEncrypted GPGEncrypted @endlink)
|
* and @link gloox::GPGEncrypted GPGEncrypted @endlink)
|
||||||
* @li XEP-0030 @link gloox::Disco Service Discovery @endlink
|
* @li @xep{0030} @link gloox::Disco Service Discovery @endlink
|
||||||
* @li XEP-0045 @link gloox::MUCRoom Multi-User Chat @endlink
|
* @li @xep{0045} @link gloox::MUCRoom Multi-User Chat @endlink
|
||||||
* @li XEP-0047 Used with @ref filetransfer_sec
|
* @li @xep{0047} Used with @ref filetransfer_sec
|
||||||
* @li XEP-0048 @link gloox::BookmarkStorage Bookmark Storage @endlink
|
* @li @xep{0048} @link gloox::BookmarkStorage Bookmark Storage @endlink
|
||||||
* @li XEP-0049 @link gloox::PrivateXML Private XML Storage @endlink
|
* @li @xep{0049} @link gloox::PrivateXML Private XML Storage @endlink
|
||||||
* @li XEP-0050 @link gloox::Adhoc Ad-hoc Commands @endlink
|
* @li @xep{0050} @link gloox::Adhoc Ad-hoc Commands @endlink
|
||||||
* @li XEP-0054 @link gloox::VCardManager vcard-temp @endlink
|
* @li @xep{0054} @link gloox::VCardManager vcard-temp @endlink
|
||||||
* @li XEP-0060 @link gloox::PubSub::Manager Publish-Subscribe @endlink
|
* @li @xep{0060} @link gloox::PubSub::Manager Publish-Subscribe @endlink
|
||||||
* @li XEP-0065 @link gloox::SOCKS5BytestreamManager SOCKS5 Bytestreams @endlink, used with
|
* @li @xep{0065} @link gloox::SOCKS5BytestreamManager SOCKS5 Bytestreams @endlink, used with
|
||||||
* @ref filetransfer_sec and @ref proxy_sec
|
* @ref filetransfer_sec and @ref proxy_sec
|
||||||
* @li XEP-0066 @link gloox::OOB Out of Band Data @endlink, also used with @ref filetransfer_sec
|
* @li @xep{0066} @link gloox::OOB Out of Band Data @endlink, also used with @ref filetransfer_sec
|
||||||
* @li XEP-0077 @link gloox::Registration In-Band Registration @endlink
|
* @li @xep{0077} @link gloox::Registration In-Band Registration @endlink
|
||||||
* @li XEP-0078 Non-SASL Authentication (automatically used if the server does not support SASL)
|
* @li @xep{0078} Non-SASL Authentication (automatically used if the server does not support SASL)
|
||||||
* @li XEP-0079 @link gloox::AMP Advanced Message Processing @endlink
|
* @li @xep{0079} @link gloox::AMP Advanced Message Processing @endlink
|
||||||
* @li XEP-0083 Nested Roster Groups (automatically used if supported by the server. see
|
* @li @xep{0083} Nested Roster Groups (automatically used if supported by the server. see
|
||||||
* @link gloox::RosterManager::delimiter() RosterManager @endlink)
|
* @link gloox::RosterManager::delimiter() RosterManager @endlink)
|
||||||
* @li XEP-0085 Chat State Notifications (see @link gloox::MessageSession MessageSession @endlink for
|
* @li @xep{0085} Chat State Notifications (see @link gloox::MessageSession MessageSession @endlink for
|
||||||
* examples)
|
* examples)
|
||||||
* @li XEP-0091 @link gloox::DelayedDelivery Delayed Delivery @endlink (old spec)
|
* @li @xep{0091} @link gloox::DelayedDelivery Delayed Delivery @endlink (old spec)
|
||||||
* @li XEP-0092 Software Version (integrated into @link gloox::Disco Service Discovery @endlink)
|
* @li @xep{0092} Software Version (integrated into @link gloox::Disco Service Discovery @endlink)
|
||||||
* @li XEP-0095 @link gloox::SIManager Stream Initiation @endlink, used with @ref filetransfer_sec
|
* @li @xep{0095} @link gloox::SIManager Stream Initiation @endlink, used with @ref filetransfer_sec
|
||||||
* @li XEP-0096 @ref filetransfer_sec
|
* @li @xep{0096} @ref filetransfer_sec
|
||||||
* @li XEP-0106 @link gloox::JID::escapeNode() JID Escaping @endlink
|
* @li @xep{0106} @link gloox::JID::escapeNode() JID Escaping @endlink
|
||||||
* @li XEP-0114 @link gloox::Component Jabber Component Protocol @endlink
|
* @li @xep{0114} @link gloox::Component Jabber Component Protocol @endlink
|
||||||
* @li XEP-0115 @link gloox::Capabilities Entity Capabilities @endlink (used automatically internally)
|
* @li @xep{0115} @link gloox::Capabilities Entity Capabilities @endlink (used automatically internally)
|
||||||
* @li XEP-0124 @link gloox::ConnectionBOSH Bidirectional-streams Over Synchronous HTTP (BOSH) @endlink
|
* @li @xep{0124} @link gloox::ConnectionBOSH Bidirectional-streams Over Synchronous HTTP (BOSH) @endlink
|
||||||
* @li XEP-0131 @link gloox::SHIM Stanza Headers and Internet Metadata @endlink
|
* @li @xep{0131} @link gloox::SHIM Stanza Headers and Internet Metadata @endlink
|
||||||
* @li XEP-0138 Stream Compression (used automatically if gloox is compiled with zlib and if the server
|
* @li @xep{0138} Stream Compression (used automatically if gloox is compiled with zlib and if the server
|
||||||
* supports it)
|
* supports it)
|
||||||
* @li XEP-0145 @link gloox::Annotations Annotations @endlink
|
* @li @xep{0145} @link gloox::Annotations Annotations @endlink
|
||||||
* @li XEP-0153 @link gloox::VCardUpdate vCard-based Avatars @endlink
|
* @li @xep{0153} @link gloox::VCardUpdate vCard-based Avatars @endlink
|
||||||
* @li XEP-0172 @link gloox::Nickname User Nickname @endlink
|
* @li @xep{0166} @link gloox::Jingle::SessionManager Jingle @endlink
|
||||||
* @li XEP-0184 @link gloox::Receipt Message Receipts @endlink
|
* @li @xep{0172} @link gloox::Nickname User Nickname @endlink
|
||||||
* @li XEP-0199 @link gloox::ClientBase::xmppPing() XMPP Ping @endlink
|
* @li @xep{0174} @link gloox::LinkLocal::Manager Link-local Messaging @endlink
|
||||||
* @li XEP-0203 @link gloox::DelayedDelivery Delayed Delivery @endlink (new spec)
|
* @li @xep{0176} @link gloox::Jingle::ICEUDP Jingle ICE-UDP Transport Method @endlink
|
||||||
* @li XEP-0206 @link gloox::ConnectionBOSH see BOSH @endlink
|
* @li @xep{0184} @link gloox::Receipt Message Receipts @endlink
|
||||||
* @li XEP-0224 @link gloox::Attention Attention @endlink
|
* @li @xep{0198} Stream Management (integrated into @link gloox::Client @endlink)
|
||||||
* @li XEP-0256 @link gloox::LastActivity::Query Last Activity in Presence @endlink
|
* @li @xep{0199} @link gloox::ClientBase::xmppPing() XMPP Ping @endlink
|
||||||
|
* @li @xep{0203} @link gloox::DelayedDelivery Delayed Delivery @endlink (new spec)
|
||||||
|
* @li @xep{0206} @link gloox::ConnectionBOSH see BOSH @endlink
|
||||||
|
* @li @xep{0224} @link gloox::Attention Attention @endlink
|
||||||
|
* @li @xep{0234} @link gloox::Jingle::FileTransfer Jingle File Transfer @endlink
|
||||||
|
* @li @xep{0256} @link gloox::LastActivity::Query Last Activity in Presence @endlink
|
||||||
|
* @li @xep{0280} @link gloox::Carbons Message Carbons @endlink
|
||||||
|
* @li @xep{0297} @link gloox::Forward Stanza Forwarding @endlink
|
||||||
*
|
*
|
||||||
* Further extensions can easily be implemented using
|
* Further extensions can easily be implemented using
|
||||||
* @link gloox::StanzaExtension StanzaExtensions @endlink.
|
* @link gloox::StanzaExtension StanzaExtensions @endlink.
|
||||||
*
|
*
|
||||||
* @section filetransfer_sec File Transfer
|
* @section filetransfer_sec File Transfer
|
||||||
*
|
*
|
||||||
* For file transfer, gloox implements XEP-0095 (Stream Initiation) as well XEP-0096 (File Transfer)
|
* For file transfer, gloox implements @xep{0095} (Stream Initiation) as well @xep{0096} (File Transfer)
|
||||||
* for the signalling, and XEP-0065 (SOCKS5 Bytestreams) as well as XEP-0047 (In-Band Bytestreams)
|
* for the signalling, and @xep{0065} (SOCKS5 Bytestreams) as well as @xep{0047} (In-Band Bytestreams)
|
||||||
* for the transport. See @link gloox::SIProfileFT SIProfileFT @endlink.
|
* for the transport. See @link gloox::SIProfileFT SIProfileFT @endlink.
|
||||||
*
|
*
|
||||||
* @section proxy_sec HTTP and SOCKS5 Proxy support
|
* @section proxy_sec HTTP and SOCKS5 Proxy support
|
||||||
|
@ -354,7 +361,7 @@
|
||||||
/**
|
/**
|
||||||
* @brief The namespace for the gloox library.
|
* @brief The namespace for the gloox library.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.3
|
* @since 0.3
|
||||||
*/
|
*/
|
||||||
namespace gloox
|
namespace gloox
|
||||||
|
@ -362,160 +369,160 @@ namespace gloox
|
||||||
/** Client namespace (RFC 3920)*/
|
/** Client namespace (RFC 3920)*/
|
||||||
GLOOX_API extern const std::string XMLNS_CLIENT;
|
GLOOX_API extern const std::string XMLNS_CLIENT;
|
||||||
|
|
||||||
/** Component Accept namespace (XEP-0114) */
|
/** Component Accept namespace (@xep{0114}) */
|
||||||
GLOOX_API extern const std::string XMLNS_COMPONENT_ACCEPT;
|
GLOOX_API extern const std::string XMLNS_COMPONENT_ACCEPT;
|
||||||
|
|
||||||
/** Component Connect namespace (XEP-0114) */
|
/** Component Connect namespace (@xep{0114}) */
|
||||||
GLOOX_API extern const std::string XMLNS_COMPONENT_CONNECT;
|
GLOOX_API extern const std::string XMLNS_COMPONENT_CONNECT;
|
||||||
|
|
||||||
/** Service Discovery Info namespace (XEP-0030) */
|
/** Service Discovery Info namespace (@xep{0030}) */
|
||||||
GLOOX_API extern const std::string XMLNS_DISCO_INFO;
|
GLOOX_API extern const std::string XMLNS_DISCO_INFO;
|
||||||
|
|
||||||
/** Service Discovery Items namespace (XEP-0030) */
|
/** Service Discovery Items namespace (@xep{0030}) */
|
||||||
GLOOX_API extern const std::string XMLNS_DISCO_ITEMS;
|
GLOOX_API extern const std::string XMLNS_DISCO_ITEMS;
|
||||||
|
|
||||||
/** Service Discovery Publish namespace (XEP-0030) */
|
/** Service Discovery Publish namespace (@xep{0030}) */
|
||||||
GLOOX_API extern const std::string XMLNS_DISCO_PUBLISH;
|
GLOOX_API extern const std::string XMLNS_DISCO_PUBLISH;
|
||||||
|
|
||||||
/** Adhoc Commands namespace (XEP-0050) */
|
/** Adhoc Commands namespace (@xep{0050}) */
|
||||||
GLOOX_API extern const std::string XMLNS_ADHOC_COMMANDS;
|
GLOOX_API extern const std::string XMLNS_ADHOC_COMMANDS;
|
||||||
|
|
||||||
/** Stream Compression namespace (XEP-0138) */
|
/** Stream Compression namespace (@xep{0138}) */
|
||||||
GLOOX_API extern const std::string XMLNS_COMPRESSION;
|
GLOOX_API extern const std::string XMLNS_COMPRESSION;
|
||||||
|
|
||||||
/** Flexible Offline Message Retrieval (XEP-0013) */
|
/** Flexible Offline Message Retrieval (@xep{0013}) */
|
||||||
GLOOX_API extern const std::string XMLNS_OFFLINE;
|
GLOOX_API extern const std::string XMLNS_OFFLINE;
|
||||||
|
|
||||||
/** Chat State Notifications namespace (XEP-0085) */
|
/** Chat State Notifications namespace (@xep{0085}) */
|
||||||
GLOOX_API extern const std::string XMLNS_CHAT_STATES;
|
GLOOX_API extern const std::string XMLNS_CHAT_STATES;
|
||||||
|
|
||||||
/** Advanced Message Processing (XEP-0079) */
|
/** Advanced Message Processing (@xep{0079}) */
|
||||||
GLOOX_API extern const std::string XMLNS_AMP;
|
GLOOX_API extern const std::string XMLNS_AMP;
|
||||||
|
|
||||||
/** In-Band Bytestreams namespace (XEP-0047) */
|
/** In-Band Bytestreams namespace (@xep{0047}) */
|
||||||
GLOOX_API extern const std::string XMLNS_IBB;
|
GLOOX_API extern const std::string XMLNS_IBB;
|
||||||
|
|
||||||
/** Feature Negotiation namespace (XEP-0020) */
|
/** Feature Negotiation namespace (@xep{0020}) */
|
||||||
GLOOX_API extern const std::string XMLNS_FEATURE_NEG;
|
GLOOX_API extern const std::string XMLNS_FEATURE_NEG;
|
||||||
|
|
||||||
/** Chat Session Negotiation namespace (XEP-0155) */
|
/** Chat Session Negotiation namespace (@xep{0155}) */
|
||||||
GLOOX_API extern const std::string XMLNS_CHATNEG;
|
GLOOX_API extern const std::string XMLNS_CHATNEG;
|
||||||
|
|
||||||
/** XHTML-IM namespace (XEP-0071) */
|
/** XHTML-IM namespace (@xep{0071}) */
|
||||||
GLOOX_API extern const std::string XMLNS_XHTML_IM;
|
GLOOX_API extern const std::string XMLNS_XHTML_IM;
|
||||||
|
|
||||||
/** Delayed Delivery namespace (XEP-0203) */
|
/** Delayed Delivery namespace (@xep{0203}) */
|
||||||
GLOOX_API extern const std::string XMLNS_DELAY;
|
GLOOX_API extern const std::string XMLNS_DELAY;
|
||||||
|
|
||||||
/** Roster namespace (RFC 3921) */
|
/** Roster namespace (RFC 3921) */
|
||||||
GLOOX_API extern const std::string XMLNS_ROSTER;
|
GLOOX_API extern const std::string XMLNS_ROSTER;
|
||||||
|
|
||||||
/** Software Version namespace (XEP-0092) */
|
/** Software Version namespace (@xep{0092}) */
|
||||||
GLOOX_API extern const std::string XMLNS_VERSION;
|
GLOOX_API extern const std::string XMLNS_VERSION;
|
||||||
|
|
||||||
/** In-Band Registration namespace (XEP-0077) */
|
/** In-Band Registration namespace (@xep{0077}) */
|
||||||
GLOOX_API extern const std::string XMLNS_REGISTER;
|
GLOOX_API extern const std::string XMLNS_REGISTER;
|
||||||
|
|
||||||
/** Privacy lists namespace (RFC 3921) */
|
/** Privacy lists namespace (RFC 3921) */
|
||||||
GLOOX_API extern const std::string XMLNS_PRIVACY;
|
GLOOX_API extern const std::string XMLNS_PRIVACY;
|
||||||
|
|
||||||
/** Non-SASL Authentication namespace (XEP-0078) */
|
/** Non-SASL Authentication namespace (@xep{0078}) */
|
||||||
GLOOX_API extern const std::string XMLNS_AUTH;
|
GLOOX_API extern const std::string XMLNS_AUTH;
|
||||||
|
|
||||||
/** Private XML Storage namespace (XEP-0049) */
|
/** Private XML Storage namespace (@xep{0049}) */
|
||||||
GLOOX_API extern const std::string XMLNS_PRIVATE_XML;
|
GLOOX_API extern const std::string XMLNS_PRIVATE_XML;
|
||||||
|
|
||||||
/** Last Activity namespace (XEP-0012) */
|
/** Last Activity namespace (@xep{0012}) */
|
||||||
GLOOX_API extern const std::string XMLNS_LAST;
|
GLOOX_API extern const std::string XMLNS_LAST;
|
||||||
|
|
||||||
/** Jabber Search namespace (XEP-0055) */
|
/** Jabber Search namespace (@xep{0055}) */
|
||||||
GLOOX_API extern const std::string XMLNS_SEARCH;
|
GLOOX_API extern const std::string XMLNS_SEARCH;
|
||||||
|
|
||||||
/** Out of Band Data (IQ) namespace (XEP-0066) */
|
/** Out of Band Data (IQ) namespace (@xep{0066}) */
|
||||||
GLOOX_API extern const std::string XMLNS_IQ_OOB;
|
GLOOX_API extern const std::string XMLNS_IQ_OOB;
|
||||||
|
|
||||||
/** Data Forms namespace (XEP-0004) */
|
/** Data Forms namespace (@xep{0004}) */
|
||||||
GLOOX_API extern const std::string XMLNS_X_DATA;
|
GLOOX_API extern const std::string XMLNS_X_DATA;
|
||||||
|
|
||||||
/** Message Events (XEP-0022) */
|
/** Message Events (@xep{0022}) */
|
||||||
GLOOX_API extern const std::string XMLNS_X_EVENT;
|
GLOOX_API extern const std::string XMLNS_X_EVENT;
|
||||||
|
|
||||||
/** Out of Band Data (X) namespace (XEP-0066) */
|
/** Out of Band Data (X) namespace (@xep{0066}) */
|
||||||
GLOOX_API extern const std::string XMLNS_X_OOB;
|
GLOOX_API extern const std::string XMLNS_X_OOB;
|
||||||
|
|
||||||
/** Delayed Delivery namespace (XEP-0091) */
|
/** Delayed Delivery namespace (@xep{0091}) */
|
||||||
GLOOX_API extern const std::string XMLNS_X_DELAY;
|
GLOOX_API extern const std::string XMLNS_X_DELAY;
|
||||||
|
|
||||||
/** Current Jabber OpenPGP Usage (Sign.) (XEP-0027) */
|
/** Current Jabber OpenPGP Usage (Sign.) (@xep{0027}) */
|
||||||
GLOOX_API extern const std::string XMLNS_X_GPGSIGNED;
|
GLOOX_API extern const std::string XMLNS_X_GPGSIGNED;
|
||||||
|
|
||||||
/** Current Jabber OpenPGP Usage (Enc.) (XEP-0027) */
|
/** Current Jabber OpenPGP Usage (Enc.) (@xep{0027}) */
|
||||||
GLOOX_API extern const std::string XMLNS_X_GPGENCRYPTED;
|
GLOOX_API extern const std::string XMLNS_X_GPGENCRYPTED;
|
||||||
|
|
||||||
/** vcard-temp namespace (XEP-0054) */
|
/** vcard-temp namespace (@xep{0054}) */
|
||||||
GLOOX_API extern const std::string XMLNS_VCARD_TEMP;
|
GLOOX_API extern const std::string XMLNS_VCARD_TEMP;
|
||||||
|
|
||||||
/** vCard-Based Avatars namespace (XEP-0153) */
|
/** vCard-Based Avatars namespace (@xep{0153}) */
|
||||||
GLOOX_API extern const std::string XMLNS_X_VCARD_UPDATE;
|
GLOOX_API extern const std::string XMLNS_X_VCARD_UPDATE;
|
||||||
|
|
||||||
/** Bookmark Storage namespace (XEP-0048) */
|
/** Bookmark Storage namespace (@xep{0048}) */
|
||||||
GLOOX_API extern const std::string XMLNS_BOOKMARKS;
|
GLOOX_API extern const std::string XMLNS_BOOKMARKS;
|
||||||
|
|
||||||
/** Annotations namespace (XEP-0145) */
|
/** Annotations namespace (@xep{0145}) */
|
||||||
GLOOX_API extern const std::string XMLNS_ANNOTATIONS;
|
GLOOX_API extern const std::string XMLNS_ANNOTATIONS;
|
||||||
|
|
||||||
/** Nested Roster Groups namespace (XEP-0083) */
|
/** Nested Roster Groups namespace (@xep{0083}) */
|
||||||
GLOOX_API extern const std::string XMLNS_ROSTER_DELIMITER;
|
GLOOX_API extern const std::string XMLNS_ROSTER_DELIMITER;
|
||||||
|
|
||||||
/** XMPP Ping namespace (XEP-0199) */
|
/** XMPP Ping namespace (@xep{0199}) */
|
||||||
GLOOX_API extern const std::string XMLNS_XMPP_PING;
|
GLOOX_API extern const std::string XMLNS_XMPP_PING;
|
||||||
|
|
||||||
/** Stream Initiation namespace (XEP-0095) */
|
/** Stream Initiation namespace (@xep{0095}) */
|
||||||
GLOOX_API extern const std::string XMLNS_SI;
|
GLOOX_API extern const std::string XMLNS_SI;
|
||||||
|
|
||||||
/** File transfer profile of Stream Initiation (XEP-0096) */
|
/** File transfer profile of Stream Initiation (@xep{0096}) */
|
||||||
GLOOX_API extern const std::string XMLNS_SI_FT;
|
GLOOX_API extern const std::string XMLNS_SI_FT;
|
||||||
|
|
||||||
/** SOCKS5 Bytestreams namespace (XEP-0065) */
|
/** SOCKS5 Bytestreams namespace (@xep{0065}) */
|
||||||
GLOOX_API extern const std::string XMLNS_BYTESTREAMS;
|
GLOOX_API extern const std::string XMLNS_BYTESTREAMS;
|
||||||
|
|
||||||
/** Multi-User Chat namespace (XEP-0045) */
|
/** Multi-User Chat namespace (@xep{0045}) */
|
||||||
GLOOX_API extern const std::string XMLNS_MUC;
|
GLOOX_API extern const std::string XMLNS_MUC;
|
||||||
|
|
||||||
/** Multi-User Chat namespace (user) (XEP-0045) */
|
/** Multi-User Chat namespace (user) (@xep{0045}) */
|
||||||
GLOOX_API extern const std::string XMLNS_MUC_USER;
|
GLOOX_API extern const std::string XMLNS_MUC_USER;
|
||||||
|
|
||||||
/** Multi-User Chat namespace (admin) (XEP-0045) */
|
/** Multi-User Chat namespace (admin) (@xep{0045}) */
|
||||||
GLOOX_API extern const std::string XMLNS_MUC_ADMIN;
|
GLOOX_API extern const std::string XMLNS_MUC_ADMIN;
|
||||||
|
|
||||||
/** Multi-User Chat namespace (unique) (XEP-0045) */
|
/** Multi-User Chat namespace (unique) (@xep{0045}) */
|
||||||
GLOOX_API extern const std::string XMLNS_MUC_UNIQUE;
|
GLOOX_API extern const std::string XMLNS_MUC_UNIQUE;
|
||||||
|
|
||||||
/** Multi-User Chat namespace (owner) (XEP-0045) */
|
/** Multi-User Chat namespace (owner) (@xep{0045}) */
|
||||||
GLOOX_API extern const std::string XMLNS_MUC_OWNER;
|
GLOOX_API extern const std::string XMLNS_MUC_OWNER;
|
||||||
|
|
||||||
/** Multi-User Chat namespace (roominfo) (XEP-0045) */
|
/** Multi-User Chat namespace (roominfo) (@xep{0045}) */
|
||||||
GLOOX_API extern const std::string XMLNS_MUC_ROOMINFO;
|
GLOOX_API extern const std::string XMLNS_MUC_ROOMINFO;
|
||||||
|
|
||||||
/** Multi-User Chat namespace (rooms) (XEP-0045) */
|
/** Multi-User Chat namespace (rooms) (@xep{0045}) */
|
||||||
GLOOX_API extern const std::string XMLNS_MUC_ROOMS;
|
GLOOX_API extern const std::string XMLNS_MUC_ROOMS;
|
||||||
|
|
||||||
/** Multi-User Chat namespace (request) (XEP-0045) */
|
/** Multi-User Chat namespace (request) (@xep{0045}) */
|
||||||
GLOOX_API extern const std::string XMLNS_MUC_REQUEST;
|
GLOOX_API extern const std::string XMLNS_MUC_REQUEST;
|
||||||
|
|
||||||
/** PubSub namespace (XEP-0060) */
|
/** PubSub namespace (@xep{0060}) */
|
||||||
GLOOX_API extern const std::string XMLNS_PUBSUB;
|
GLOOX_API extern const std::string XMLNS_PUBSUB;
|
||||||
|
|
||||||
/** PubSub namespace (errors) (XEP-0060) */
|
/** PubSub namespace (errors) (@xep{0060}) */
|
||||||
GLOOX_API extern const std::string XMLNS_PUBSUB_ERRORS;
|
GLOOX_API extern const std::string XMLNS_PUBSUB_ERRORS;
|
||||||
|
|
||||||
/** PubSub namespace (event) (XEP-0060) */
|
/** PubSub namespace (event) (@xep{0060}) */
|
||||||
GLOOX_API extern const std::string XMLNS_PUBSUB_EVENT;
|
GLOOX_API extern const std::string XMLNS_PUBSUB_EVENT;
|
||||||
|
|
||||||
/** PubSub namespace (owner) (XEP-0060) */
|
/** PubSub namespace (owner) (@xep{0060}) */
|
||||||
GLOOX_API extern const std::string XMLNS_PUBSUB_OWNER;
|
GLOOX_API extern const std::string XMLNS_PUBSUB_OWNER;
|
||||||
|
|
||||||
/** Entity Capabilities namespace (XEP-0115) */
|
/** Entity Capabilities namespace (@xep{0115}) */
|
||||||
GLOOX_API extern const std::string XMLNS_CAPS;
|
GLOOX_API extern const std::string XMLNS_CAPS;
|
||||||
|
|
||||||
/** SOCKS5 Fast Mode namespace */
|
/** SOCKS5 Fast Mode namespace */
|
||||||
|
@ -542,48 +549,65 @@ namespace gloox
|
||||||
/** Session Create Stream Feature (RFC 3921) */
|
/** Session Create Stream Feature (RFC 3921) */
|
||||||
GLOOX_API extern const std::string XMLNS_STREAM_SESSION;
|
GLOOX_API extern const std::string XMLNS_STREAM_SESSION;
|
||||||
|
|
||||||
/** Non-SASL Auth. Stream Feature (XEP-0078) */
|
/** Non-SASL Auth. Stream Feature (@xep{0078}) */
|
||||||
GLOOX_API extern const std::string XMLNS_STREAM_IQAUTH;
|
GLOOX_API extern const std::string XMLNS_STREAM_IQAUTH;
|
||||||
|
|
||||||
/** In-Band Registration namespace (XEP-0077) */
|
/** In-Band Registration namespace (@xep{0077}) */
|
||||||
GLOOX_API extern const std::string XMLNS_STREAM_IQREGISTER;
|
GLOOX_API extern const std::string XMLNS_STREAM_IQREGISTER;
|
||||||
|
|
||||||
/** Stream Compression Feature namespace (XEP-0138) */
|
/** Stream Compression Feature namespace (@xep{0138}) */
|
||||||
GLOOX_API extern const std::string XMLNS_STREAM_COMPRESS;
|
GLOOX_API extern const std::string XMLNS_STREAM_COMPRESS;
|
||||||
|
|
||||||
/** General HTTP binding (BOSH) namespace (XEP-0124) */
|
/** General HTTP binding (BOSH) namespace (@xep{0124}) */
|
||||||
GLOOX_API extern const std::string XMLNS_HTTPBIND;
|
GLOOX_API extern const std::string XMLNS_HTTPBIND;
|
||||||
|
|
||||||
/** XMPP-over-BOSH extensions (XEP-0206) */
|
/** XMPP-over-BOSH extensions (@xep{0206}) */
|
||||||
GLOOX_API extern const std::string XMLNS_XMPP_BOSH;
|
GLOOX_API extern const std::string XMLNS_XMPP_BOSH;
|
||||||
|
|
||||||
/** Message Receipt namespace (XEP-0184) */
|
/** Message Receipt namespace (@xep{0184}) */
|
||||||
GLOOX_API extern const std::string XMLNS_RECEIPTS;
|
GLOOX_API extern const std::string XMLNS_RECEIPTS;
|
||||||
|
|
||||||
/** Message Receipt namespace (XEP-0172) */
|
/** Message Receipt namespace (@xep{0172}) */
|
||||||
GLOOX_API extern const std::string XMLNS_NICKNAME;
|
GLOOX_API extern const std::string XMLNS_NICKNAME;
|
||||||
|
|
||||||
/** Jingle namespace (XEP-0166) */
|
/** Jabber RPC namespace (@xep{0009}) */
|
||||||
|
GLOOX_API extern const std::string XMLNS_JABBER_RPC;
|
||||||
|
|
||||||
|
/** Jingle namespace (@xep{0166}) */
|
||||||
GLOOX_API extern const std::string XMLNS_JINGLE;
|
GLOOX_API extern const std::string XMLNS_JINGLE;
|
||||||
|
|
||||||
/** Jingle Audio via RTP namespace (XEP-0167) */
|
/** Jingle error namespace (@xep{0166}) */
|
||||||
GLOOX_API extern const std::string XMLNS_JINGLE_AUDIO_RTP;
|
GLOOX_API extern const std::string XMLNS_JINGLE_ERRORS;
|
||||||
|
|
||||||
/** Jingle ICE-UDP Transport namespace (XEP-0176) */
|
/** Jingle ICE-UDP Transport namespace (@xep{0176}) */
|
||||||
GLOOX_API extern const std::string XMLNS_JINGLE_ICE_UDP;
|
GLOOX_API extern const std::string XMLNS_JINGLE_ICE_UDP;
|
||||||
|
|
||||||
/** Jingle Raw UDP Transport namespace (XEP-0177) */
|
/** Jingle File Transfer namespace (@xep{0234}) */
|
||||||
GLOOX_API extern const std::string XMLNS_JINGLE_RAW_UDP;
|
GLOOX_API extern const std::string XMLNS_JINGLE_FILE_TRANSFER;
|
||||||
|
|
||||||
/** Jingle Video via RTP namespace (XEP-0180) */
|
/** Jingle File Transfer namespace (multiple files) (@xep{0234}) */
|
||||||
GLOOX_API extern const std::string XMLNS_JINGLE_VIDEO_RTP;
|
GLOOX_API extern const std::string XMLNS_JINGLE_FILE_TRANSFER_MULTI;
|
||||||
|
|
||||||
/** Stanza Headers and Internet Metadata (SHIM) namespace (XEP-0131) */
|
/** Stanza Headers and Internet Metadata (SHIM) namespace (@xep{0131}) */
|
||||||
GLOOX_API extern const std::string XMLNS_SHIM;
|
GLOOX_API extern const std::string XMLNS_SHIM;
|
||||||
|
|
||||||
/** Attention namespace (XEP-0224) */
|
/** Attention namespace (@xep{0224}) */
|
||||||
GLOOX_API extern const std::string XMLNS_ATTENTION;
|
GLOOX_API extern const std::string XMLNS_ATTENTION;
|
||||||
|
|
||||||
|
/** Stream Management namespace (@xep{0198}) */
|
||||||
|
GLOOX_API extern const std::string XMLNS_STREAM_MANAGEMENT;
|
||||||
|
|
||||||
|
/** Stanza Forwarding namespace (@xep{0297}) */
|
||||||
|
GLOOX_API extern const std::string XMLNS_STANZA_FORWARDING;
|
||||||
|
|
||||||
|
/** Message Carbons namespace (@xep{0280}) */
|
||||||
|
GLOOX_API extern const std::string XMLNS_MESSAGE_CARBONS;
|
||||||
|
|
||||||
|
/** Use of Cryptographic Hash Functions in XMPP namespace (@xep{0300}) */
|
||||||
|
GLOOX_API extern const std::string XMLNS_HASHES;
|
||||||
|
|
||||||
|
/** IO Data (@xep 0244) */
|
||||||
|
GLOOX_API extern const std::string XMLNS_IODATA;
|
||||||
|
|
||||||
/** Supported stream version (major). */
|
/** Supported stream version (major). */
|
||||||
GLOOX_API extern const std::string XMPP_STREAM_VERSION_MAJOR;
|
GLOOX_API extern const std::string XMPP_STREAM_VERSION_MAJOR;
|
||||||
|
@ -629,6 +653,20 @@ namespace gloox
|
||||||
StreamEventAuthentication, /**< The Client is about to authenticate. */
|
StreamEventAuthentication, /**< The Client is about to authenticate. */
|
||||||
StreamEventSessionInit, /**< The Client is about to create a session. */
|
StreamEventSessionInit, /**< The Client is about to create a session. */
|
||||||
StreamEventResourceBinding, /**< The Client is about to bind a resource to the stream. */
|
StreamEventResourceBinding, /**< The Client is about to bind a resource to the stream. */
|
||||||
|
StreamEventSMEnable, /**< The Client is about to request Stream Management (@xep{0198}).
|
||||||
|
* @since 1.0.4 */
|
||||||
|
StreamEventSMResume, /**< The Client is about to request resumption by means of Stream Management
|
||||||
|
* (@xep{0198}).
|
||||||
|
* @since 1.0.4 */
|
||||||
|
StreamEventSMResumed, /**< The stream has successfully been resumed by means of Stream Management
|
||||||
|
* (@xep{0198}).
|
||||||
|
* @since 1.0.4 */
|
||||||
|
StreamEventSMEnableFailed, /**< The attempt to enable Stream Management
|
||||||
|
* (@xep{0198}) failed. This is not critical.
|
||||||
|
* @since 1.0.4 */
|
||||||
|
StreamEventSMResumeFailed, /**< The attempt to resume an aborted session by means of Stream Management
|
||||||
|
* (@xep{0198}) failed. This is not critical.
|
||||||
|
* @since 1.0.4 */
|
||||||
StreamEventSessionCreation, /**< The Client is about to create a session.
|
StreamEventSessionCreation, /**< The Client is about to create a session.
|
||||||
* @since 0.9.1 */
|
* @since 0.9.1 */
|
||||||
StreamEventRoster, /**< The Client is about to request the roster. */
|
StreamEventRoster, /**< The Client is about to request the roster. */
|
||||||
|
@ -694,15 +732,16 @@ namespace gloox
|
||||||
StreamFeatureUnbind = 2, /**< The server supports binding multiple resources. */
|
StreamFeatureUnbind = 2, /**< The server supports binding multiple resources. */
|
||||||
StreamFeatureSession = 4, /**< The server supports sessions. */
|
StreamFeatureSession = 4, /**< The server supports sessions. */
|
||||||
StreamFeatureStartTls = 8, /**< The server supports <starttls>. */
|
StreamFeatureStartTls = 8, /**< The server supports <starttls>. */
|
||||||
StreamFeatureIqRegister = 16, /**< The server supports XEP-0077 (In-Band
|
StreamFeatureIqRegister = 16, /**< The server supports @xep{0077} (In-Band
|
||||||
* Registration). */
|
* Registration). */
|
||||||
StreamFeatureIqAuth = 32, /**< The server supports XEP-0078 (Non-SASL
|
StreamFeatureIqAuth = 32, /**< The server supports @xep{0078} (Non-SASL
|
||||||
* Authentication). */
|
* Authentication). */
|
||||||
StreamFeatureCompressZlib = 64, /**< The server supports XEP-0138 (Stream
|
StreamFeatureCompressZlib = 64, /**< The server supports @xep{0138} (Stream
|
||||||
* Compression) (Zlib). */
|
* Compression) (Zlib). */
|
||||||
StreamFeatureCompressDclz = 128 /**< The server supports XEP-0138 (Stream
|
StreamFeatureCompressDclz = 128, /**< The server supports @xep{0138} (Stream
|
||||||
* Compression) (LZW/DCLZ). */
|
* Compression) (LZW/DCLZ). */
|
||||||
// SASLMechanism below must be adjusted accordingly.
|
StreamFeatureStreamManagement = 256 /**< The server supports @xep{0198} (Stream Management). */
|
||||||
|
// SaslMechanism below must be adjusted accordingly.
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -712,14 +751,16 @@ namespace gloox
|
||||||
enum SaslMechanism
|
enum SaslMechanism
|
||||||
{
|
{
|
||||||
SaslMechNone = 0, /**< Invalid SASL Mechanism. */
|
SaslMechNone = 0, /**< Invalid SASL Mechanism. */
|
||||||
SaslMechDigestMd5 = 256, /**< SASL Digest-MD5 according to RFC 2831. */
|
SaslMechScramSha1 = 2048, /**< SASL SCRAM-SHA-1-PLUS accroding to RFC 5801 */
|
||||||
SaslMechPlain = 512, /**< SASL PLAIN according to RFC 2595 Section 6. */
|
SaslMechScramSha1Plus = 1024, /**< SASL SCRAM-SHA-1 accroding to RFC 5801 */
|
||||||
SaslMechAnonymous = 1024, /**< SASL ANONYMOUS according to draft-ietf-sasl-anon-05.txt/
|
SaslMechDigestMd5 = 4096, /**< SASL Digest-MD5 according to RFC 2831. */
|
||||||
|
SaslMechPlain = 8192, /**< SASL PLAIN according to RFC 2595 Section 6. */
|
||||||
|
SaslMechAnonymous = 16384, /**< SASL ANONYMOUS according to draft-ietf-sasl-anon-05.txt/
|
||||||
* RFC 2245 Section 6. */
|
* RFC 2245 Section 6. */
|
||||||
SaslMechExternal = 2048, /**< SASL EXTERNAL according to RFC 2222 Section 7.4. */
|
SaslMechExternal = 32768, /**< SASL EXTERNAL according to RFC 2222 Section 7.4. */
|
||||||
SaslMechGssapi = 4096, /**< SASL GSSAPI (Win32 only). */
|
SaslMechGssapi = 65536, /**< SASL GSSAPI (Win32 only). */
|
||||||
SaslMechNTLM = 8192, /**< SASL NTLM (Win32 only). */
|
SaslMechNTLM = 131072, /**< SASL NTLM (Win32 only). */
|
||||||
SaslMechAll = 65535 /**< Includes all supported SASL mechanisms. */
|
SaslMechAll = 262143 /**< Includes all supported SASL mechanisms. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -993,9 +1034,9 @@ namespace gloox
|
||||||
SaslTemporaryAuthFailure, /**< The authentication failed because of a temporary error condition
|
SaslTemporaryAuthFailure, /**< The authentication failed because of a temporary error condition
|
||||||
* within the receiving entity; sent in reply to an <auth/> element
|
* within the receiving entity; sent in reply to an <auth/> element
|
||||||
* or <response/> element. */
|
* or <response/> element. */
|
||||||
NonSaslConflict, /**< XEP-0078: Resource Conflict */
|
NonSaslConflict, /**< @xep{0078}: Resource Conflict */
|
||||||
NonSaslNotAcceptable, /**< XEP-0078: Required Information Not Provided */
|
NonSaslNotAcceptable, /**< @xep{0078}: Required Information Not Provided */
|
||||||
NonSaslNotAuthorized /**< XEP-0078: Incorrect Credentials */
|
NonSaslNotAuthorized /**< @xep{0078}: Incorrect Credentials */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1017,6 +1058,7 @@ namespace gloox
|
||||||
LogAreaClassSOCKS5Bytestream = 0x000800, /**< Log messages from SOCKS5Bytestream. */
|
LogAreaClassSOCKS5Bytestream = 0x000800, /**< Log messages from SOCKS5Bytestream. */
|
||||||
LogAreaClassConnectionBOSH = 0x001000, /**< Log messages from ConnectionBOSH */
|
LogAreaClassConnectionBOSH = 0x001000, /**< Log messages from ConnectionBOSH */
|
||||||
LogAreaClassConnectionTLS = 0x002000, /**< Log messages from ConnectionTLS */
|
LogAreaClassConnectionTLS = 0x002000, /**< Log messages from ConnectionTLS */
|
||||||
|
LogAreaLinkLocalManager = 0x004000, /**< Log messages from LinkLocalManager */
|
||||||
LogAreaAllClasses = 0x01FFFF, /**< All log messages from all the classes. */
|
LogAreaAllClasses = 0x01FFFF, /**< All log messages from all the classes. */
|
||||||
LogAreaXmlIncoming = 0x020000, /**< Incoming XML. */
|
LogAreaXmlIncoming = 0x020000, /**< Incoming XML. */
|
||||||
LogAreaXmlOutgoing = 0x040000, /**< Outgoing XML. */
|
LogAreaXmlOutgoing = 0x040000, /**< Outgoing XML. */
|
||||||
|
@ -1035,7 +1077,7 @@ namespace gloox
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The possible Message Events according to XEP-0022.
|
* The possible Message Events according to @xep{0022}.
|
||||||
*/
|
*/
|
||||||
enum MessageEventType
|
enum MessageEventType
|
||||||
{
|
{
|
||||||
|
@ -1050,7 +1092,7 @@ namespace gloox
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The possible Chat States according to XEP-0085.
|
* The possible Chat States according to @xep{0085}.
|
||||||
*/
|
*/
|
||||||
enum ChatStateType
|
enum ChatStateType
|
||||||
{
|
{
|
||||||
|
@ -1091,12 +1133,12 @@ namespace gloox
|
||||||
*/
|
*/
|
||||||
enum MessageSessionFilter
|
enum MessageSessionFilter
|
||||||
{
|
{
|
||||||
FilterMessageEvents = 1, /**< Message Events (XEP-0022) */
|
FilterMessageEvents = 1, /**< Message Events (@xep{0022}) */
|
||||||
FilterChatStates = 2 /**< Chat State Notifications (XEP-0085) */
|
FilterChatStates = 2 /**< Chat State Notifications (@xep{0085}) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defined MUC room affiliations. See XEP-0045 for default privileges.
|
* Defined MUC room affiliations. See @xep{0045} for default privileges.
|
||||||
*/
|
*/
|
||||||
enum MUCRoomAffiliation
|
enum MUCRoomAffiliation
|
||||||
{
|
{
|
||||||
|
@ -1109,7 +1151,7 @@ namespace gloox
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defined MUC room roles. See XEP-0045 for default privileges.
|
* Defined MUC room roles. See @xep{0045} for default privileges.
|
||||||
*/
|
*/
|
||||||
enum MUCRoomRole
|
enum MUCRoomRole
|
||||||
{
|
{
|
||||||
|
@ -1214,7 +1256,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* A multimap of strings.
|
* A multimap of strings.
|
||||||
*/
|
*/
|
||||||
typedef std::multimap<const std::string, const std::string> StringMultiMap;
|
typedef std::multimap<std::string, std::string> StringMultiMap;
|
||||||
|
|
||||||
class StanzaExtension;
|
class StanzaExtension;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2009-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -10,4 +10,4 @@
|
||||||
This software is distributed without any warranty.
|
This software is distributed without any warranty.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GLOOXVERSION 0x010000
|
#define GLOOXVERSION 0x010013
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -25,14 +25,14 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is an abstraction of a jabber:x:encrypted namespace element, as used in XEP-0027
|
* @brief This is an abstraction of a jabber:x:encrypted namespace element, as used in @xep{0027}
|
||||||
* (Current Jabber OpenPGP Usage).
|
* (Current Jabber OpenPGP Usage).
|
||||||
*
|
*
|
||||||
* This class does not encrypt or decrypt any stanza content. It's meant to be an abstraction
|
* This class does not encrypt or decrypt any stanza content. It's meant to be an abstraction
|
||||||
* of the XML representation only.
|
* of the XML representation only.
|
||||||
*
|
*
|
||||||
* XEP version: 1.3
|
* XEP version: 1.3
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API GPGEncrypted : public StanzaExtension
|
class GLOOX_API GPGEncrypted : public StanzaExtension
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -25,14 +25,14 @@ namespace gloox
|
||||||
class Tag;
|
class Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is an abstraction of a jabber:x:signed namespace element, as used in XEP-0027
|
* @brief This is an abstraction of a jabber:x:signed namespace element, as used in @xep{0027}
|
||||||
* (Current Jabber OpenPGP Usage).
|
* (Current Jabber OpenPGP Usage).
|
||||||
*
|
*
|
||||||
* This class does not sign or verify any stanza content. It's meant to be an abstraction
|
* This class does not sign or verify any stanza content. It's meant to be an abstraction
|
||||||
* of the XML representation only.
|
* of the XML representation only.
|
||||||
*
|
*
|
||||||
* XEP version: 1.3
|
* XEP version: 1.3
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API GPGSigned : public StanzaExtension
|
class GLOOX_API GPGSigned : public StanzaExtension
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -113,6 +113,8 @@ namespace gloox
|
||||||
|
|
||||||
InBandBytestream::~InBandBytestream()
|
InBandBytestream::~InBandBytestream()
|
||||||
{
|
{
|
||||||
|
m_handler = 0; // to prevent handleBytestreamClose() from being called in close()
|
||||||
|
|
||||||
if( m_open )
|
if( m_open )
|
||||||
close();
|
close();
|
||||||
|
|
||||||
|
@ -161,7 +163,7 @@ namespace gloox
|
||||||
bool InBandBytestream::handleIq( const IQ& iq ) // data or open request, always 'set'
|
bool InBandBytestream::handleIq( const IQ& iq ) // data or open request, always 'set'
|
||||||
{
|
{
|
||||||
const IBB* i = iq.findExtension<IBB>( ExtIBB );
|
const IBB* i = iq.findExtension<IBB>( ExtIBB );
|
||||||
if( !i || !m_handler || iq.subtype() != IQ::Set )
|
if( !i || !m_handler || iq.subtype() != IQ::Set || i->sid() != this->sid() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !m_open )
|
if( !m_open )
|
||||||
|
@ -254,7 +256,7 @@ namespace gloox
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const std::string& id = m_clientbase->getID();
|
const std::string& id = m_clientbase->getID();
|
||||||
IQ iq( IQ::Set, m_target, id );
|
IQ iq( IQ::Set, m_clientbase->jid() == m_target ? m_initiator : m_target, id );
|
||||||
iq.addExtension( new IBB( m_sid, ++m_sequence, data.substr( pos, m_blockSize ) ) );
|
iq.addExtension( new IBB( m_sid, ++m_sequence, data.substr( pos, m_blockSize ) ) );
|
||||||
m_clientbase->send( iq, this, IBBData );
|
m_clientbase->send( iq, this, IBBData );
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2006-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -27,7 +27,7 @@ namespace gloox
|
||||||
class Message;
|
class Message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An implementation of a single In-Band Bytestream (XEP-0047).
|
* @brief An implementation of a single In-Band Bytestream (@xep{0047}).
|
||||||
*
|
*
|
||||||
* One instance of this class handles a single byte stream.
|
* One instance of this class handles a single byte stream.
|
||||||
*
|
*
|
||||||
|
@ -37,7 +37,7 @@ namespace gloox
|
||||||
* are not using MessageSessions. However, it will always send
|
* are not using MessageSessions. However, it will always send
|
||||||
* data using IQ stanzas (which will always work).
|
* data using IQ stanzas (which will always work).
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.8
|
* @since 0.8
|
||||||
*/
|
*/
|
||||||
class GLOOX_API InBandBytestream : public Bytestream, public IqHandler, public MessageHandler
|
class GLOOX_API InBandBytestream : public Bytestream, public IqHandler, public MessageHandler
|
||||||
|
@ -100,7 +100,7 @@ namespace gloox
|
||||||
/**
|
/**
|
||||||
* @brief An abstraction of IBB elements, implemented as as StanzaExtension.
|
* @brief An abstraction of IBB elements, implemented as as StanzaExtension.
|
||||||
*
|
*
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class IBB : public StanzaExtension
|
class IBB : public StanzaExtension
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2007-2009 by Jakob Schroeter <js@camaya.net>
|
Copyright (c) 2007-2015 by Jakob Schröter <js@camaya.net>
|
||||||
This file is part of the gloox library. http://camaya.net/gloox
|
This file is part of the gloox library. http://camaya.net/gloox
|
||||||
|
|
||||||
This software is distributed under a license. The full license
|
This software is distributed under a license. The full license
|
||||||
|
@ -24,7 +24,7 @@ namespace gloox
|
||||||
* @brief This class implements an instant MUC room.
|
* @brief This class implements an instant MUC room.
|
||||||
*
|
*
|
||||||
* XEP version: 1.21
|
* XEP version: 1.21
|
||||||
* @author Jakob Schroeter <js@camaya.net>
|
* @author Jakob Schröter <js@camaya.net>
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
class GLOOX_API InstantMUCRoom : public MUCRoom
|
class GLOOX_API InstantMUCRoom : public MUCRoom
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Ŝarĝante…
Reference in New Issue