gloox  1.0.9
Upgrading from earlier versions

Table of Contents

This page contains information about upgrading gloox from an earlier version to the current one. It lists the API changes that were made and how to change your code to achieve the same (or better) functionality as with the earlier version.

1. Upgrading from 0.9.x to 1.0

Besides the changes detailed below, a major change is that the Stanza class now is an abstract base for more specialized Message , Presence , IQ , and Subscription classes. Therefore, PresenceHandler , MessageHandler , SubscriptionHandler , and IqHandler no longer take a Stanza* argument, but receive a pointer to the respective specialized class. Additionally, in a move to get away from unsafe pointers to safer references, these pointer-taking functions have been deprecated (but will continue to be available throughout the 1.0.x cycle). The recommended usage looks as follows:

Old code:

void MyClass::handlePresence( Stanza* stanza )
{
// ...
}

New code (deprecated):

void MyClass::handlePresence( Presence* pres )
{
// ...
}

or New code (recommended):

void MyClass::handlePresence( const Presence& pres )
{
// ...
}

1.1 Deprecated classes and functions

1.1.1 MUCRoomHandler::handleMUCMessage( MUCRoom*, string, string, bool, string, bool ),

Use handleMUCMessage( MUCRoom*, Message&, bool ) instead.

Due to the newly available StanzaExtensions, some of handleMUCMessage()'s arguments are obsolete: Instead of single values, all of these are included in the new msg parameter, which is the full Message stanza:

1.1.2 ClientBase::trackID()

The functionality provided by this function really makes sense only for IQ stanzas of type get or set. As a result, there is a new function ClientBase::send( IQ&, IqHandler*, int ) that combines trackID()'s and send()'s functionality.

Old code:

const std::string& id = m_client->getID();
Tag* iq = ...
iq->addAtrribute( "id", id );
...
m_client->trackID( this, id, SomeContext );
m_client->send( iq );

New code:

IQ iq( IQ::Set, recipientJID );
...
m_client->send( iq, this, SomeContext );

Further, it is no longer necessary to explicitely add an ID to the IQ (for requests of type 'get' or 'set; 'result' and 'error' IQs need to have the IQ's ID passed they are supposed to answer). send() will take care of this.

1.1.3 DiscoHandler::handleDiscoInfoResult()

The function gloox::DiscoHandler::handleDiscoInfoResult() has been removed. Replacement is: DiscoHandler::handleDiscoInfo() .

1.1.4 DiscoHandler::handleDiscoItemsResult()

The function gloox::DiscoHandler::handleDiscoItemsResult() has been removed. Replacement is: DiscoHandler::handleDiscoItems() .

1.1.5 DiscoHandler::handleDiscoError()

The function gloox::DiscoHandler::handleDiscoError( IQ*, int ) has been removed. Replacement is: DiscoHandler::handleDiscoError( const JID&, const Error*, int ) .

1.1.6 MUCRoom::destroy()

The default argument now is a const reference to a JID – defaulting to en empty JID – instead of a pointer to a JID object.

1.2 Removed classes and functions

1.2.1 XDelayedDelivery

The class XDelayedDelivery has been removed as the XSF replaced XEP-0091 with XEP-0203. The class DelayedDelivery covers both XEPs.

1.2.2 JID::fullJID()

Use the copy constructor instead. E.g.:

Old code:

JID j( "somejid" );
JID copy = j.fullJID();

New code:

JID j( "somejid" );
JID copy( j );

1.2.3 JID::empty()

This function has been replaced by JID::operator bool(). This has the added benefit of validity checking. E.g.:

Old code:

JID j;
// ...
if( !j.empty() )
{
// do something
}

New code:

JID j;
// ...
if( j ) // this evaluates to true only if the JID is not empty and if the contained JID
// is in fact valid, i.e. if no prepping operation failed.
{
// do something
}

1.2.4 Tag::empty()

This function has been replaced by Tag::operator bool(). This has the added benefit of validity checking. E.g.:

Old code:

Tag t;
// ...
if( !t.empty() )
{
// do something
}

Or:

Tag* t = new Tag( "foo" );
// ...
if( !t->empty() )
{
// do something
}

New code:

Tag t;
// ...
if( t )
{
// do something
}

Or:

Tag* t = new Tag( "foo" );
// ...
if( *t )
{
// do something
}

1.2.6 Tag::children() (non-const)

This function has been removed. Use the const version instead. To delete an attribute, use the new removeAttribute() .

1.2.6 Tag::children() (non-const)

This function has been removed. Use the const version instead. To delete a child element, use removeChild() .

1.2.7 Stanza::createMessageStanza(), Stanza::createPresenceStanza(), Stanza::createIqStanza(), Stanza::createSubscriptionStanza()

These functions have been removed in favour of the more specialized classes Message , Presence , IQ , and Subscription .

1.2.8 InBandBytestreamManager

The Message-based Inband Bytestream implementation has been removed in favour of an IQ-based one. Also, Inband Bytestreams are now handled (transparently) by SIProfileFT .

1.2.9 AdhocHandler::handleAdhocError( const JID&, StanzaError )

This function has been removed in favor of handleAdhocError( const JID&, const Error* ) .

1.2.10 SIProfileFTHandler::handleFTRequestError( IQ*, const std::string& )

This function has been removed in favor of handleFTRequestError( const IQ&, const std::string& ) .

1.2.11 BytestreamHandler::handleBytestreamError( IQ* iq, const std::string& sid )

This function has been removed in favor of handleBytestreamError( const IQ& iq, const std::string& sid ) .

1.2.12 BytestreamDataHandler::handleBytestreamError( Bytestream* bs, IQ* )

This function has been removed in favor of handleBytestreamError( Bytestream* bs, const IQ& ) .

1.2.13 Disco::category()

This function has been removed. Use Disco::identities() instead.

1.2.14 Disco::type()

This function has been removed. Use Disco::identities() instead.

1.2.15 PrivateXMLHandler::handlePrivateXML( const std::string&, Tag* )

This function has been removed in favor of PrivateXMLHandler::handlePrivateXML( const Tag* ) .

1.2.16 PrivateXML::storeXML( Tag*, PrivateXMLHandler* )

This function has been removed in favor of PrivateXML::storeXML( const Tag*, PrivateXMLHandler* ) .

1.2.17 Client::Client( string, string, string, string, int )

This function has been removed. The only recommended alternative is Client::Client( const JID&, const std::string&, int ) .

1.3 Semantic Changes

1.3.1 SIProfileFTHandler::handleFTRequest()

The second parameter is now a Session ID (sid). This should be used with SIProfileFT::acceptFTRequest() or SIProfileFT::declineFTRequest() .

1.3.2 SIProfileFT::acceptFTRequest()

The second parameter is now a Session ID (sid). It must be the same value as the Session ID (sid) passed to SIProfileFTHandler::handleFTRequest() . Further, the function has been renamed to acceptFT() .

1.3.3 SIProfileFT::declineFTRequest()

The second parameter is now a Session ID (sid). It must be the same value as the Session ID (sid) passed to SIProfileFTHandler::handleFTRequest() . Further, the function has been renamed to declineFT() .

2. Upgrading from to 1.0 to 1.0.1

NB: 1.0.1 is not binary-compatible to 1.0. The reason for that is the addition of support for XEP-0174, which made it necessary to add a parameter to ClientBase::handleStartNode() .