2 * @page upgrading Upgrading from earlier versions
4 * This page contains information about upgrading gloox from an earlier version to the current one.
5 * It lists the API changes that were made and how to change your code to achieve the same
6 * (or better) functionality as with the earlier version.
10 * @section upgrading_09_10 1. Upgrading from 0.9.x to 1.0
12 * Besides the changes detailed below, a major change is that the Stanza class now is an abstract
13 * base for more specialized
14 * @link gloox::Message Message @endlink, @link gloox::Presence Presence @endlink,
15 * @link gloox::IQ IQ @endlink, and @link gloox::Subscription Subscription @endlink classes.
17 * @link gloox::PresenceHandler PresenceHandler @endlink,
18 * @link gloox::MessageHandler MessageHandler @endlink,
19 * @link gloox::SubscriptionHandler SubscriptionHandler @endlink, and
20 * @link gloox::IqHandler IqHandler @endlink no longer take a Stanza* argument, but receive
21 * a pointer to the respective specialized class. Additionally, in a move to get away from
22 * unsafe pointers to safer references, these pointer-taking functions have been deprecated
23 * (but will continue to be available throughout the 1.0.x cycle).
24 * The recommended usage looks as follows:
28 * void MyClass::handlePresence( Stanza* stanza )
34 * New code (deprecated):
36 * void MyClass::handlePresence( Presence* pres )
42 * New code (recommended):
44 * void MyClass::handlePresence( const Presence& pres )
50 * @subsection deprecated_10 1.1 Deprecated classes and functions
52 * @subsubsection func_MUCRoomHandler_handleMucMessage 1.1.1 MUCRoomHandler::handleMUCMessage( MUCRoom*, string, string, bool, string, bool ),
54 * Use @link gloox::MUCRoomHandler::handleMUCMessage( MUCRoom*, const Message&, bool ) handleMUCMessage( MUCRoom*, Message&, bool ) @endlink instead.
56 * Due to the newly available StanzaExtensions, some of handleMUCMessage()'s arguments are obsolete:
57 * Instead of single values, all of these are included in the new @c msg parameter, which is the
58 * full Message stanza:
60 * @li the speaker's nick name,
61 * @code const std::string nick = msg.from().resource(); @endcode
62 * @li the message body,
63 * @code const std::string body = msg.body(); @endcode
64 * @li whether this message is part of the room history,
66 * bool history = msg.when() ? true : false;
68 * @li the message's time stamp.
70 * const DelayedDelivery* dd = msg.when();
72 * printf( "message was sent at %s\n", dd->stamp().c_str() );
75 * @subsubsection func_ClientBase_trackID 1.1.2 ClientBase::trackID()
77 * The functionality provided by this function really makes sense only for IQ stanzas of type
78 * get or set. As a result, there is a new function
79 * @link gloox::ClientBase::send( IQ&, IqHandler*, int, bool ) ClientBase::send( IQ&, IqHandler*, int ) @endlink
80 * that combines trackID()'s and send()'s functionality.
84 * const std::string& id = m_client->getID();
86 * iq->addAtrribute( "id", id );
88 * m_client->trackID( this, id, SomeContext );
89 * m_client->send( iq );
94 * IQ iq( IQ::Set, recipientJID );
96 * m_client->send( iq, this, SomeContext );
99 * Further, it is no longer necessary to explicitely add an ID to the IQ (for requests of type
100 * 'get' or 'set; 'result' and 'error' IQs need to have the IQ's ID passed they are supposed
101 * to answer). send() will take care of this.
103 * @subsubsection func_DiscoHandler_handleDiscoInfoResult 1.1.3 DiscoHandler::handleDiscoInfoResult()
106 * gloox::DiscoHandler::handleDiscoInfoResult()
107 * has been removed. Replacement is:
108 * @link gloox::DiscoHandler::handleDiscoInfo() DiscoHandler::handleDiscoInfo() @endlink.
110 * @subsubsection func_DiscoHandler_handleDiscoItemsResult 1.1.4 DiscoHandler::handleDiscoItemsResult()
113 * gloox::DiscoHandler::handleDiscoItemsResult()
114 * has been removed. Replacement is:
115 * @link gloox::DiscoHandler::handleDiscoItems() DiscoHandler::handleDiscoItems() @endlink.
117 * @subsubsection func_DiscoHandler_handleDiscoError 1.1.5 DiscoHandler::handleDiscoError()
120 * gloox::DiscoHandler::handleDiscoError( IQ*, int )
121 * has been removed. Replacement is:
122 * @link gloox::DiscoHandler::handleDiscoError( const JID&, const Error*, int ) DiscoHandler::handleDiscoError( const JID&, const Error*, int ) @endlink.
124 * @subsubsection func_MUCRoom_destroy 1.1.6 MUCRoom::destroy()
126 * The default argument now is a const reference to a JID -- defaulting to en empty JID --
127 * instead of a pointer to a JID object.
132 * @subsection removed_10 1.2 Removed classes and functions
134 * @subsubsection class_XDelayedDelivery 1.2.1 XDelayedDelivery
136 * The class XDelayedDelivery has been removed as the XSF replaced XEP-0091 with XEP-0203. The class
137 * @link gloox::DelayedDelivery DelayedDelivery @endlink covers both XEPs.
139 * @subsubsection func_JID_fullJID 1.2.2 JID::fullJID()
141 * Use the copy constructor instead. E.g.:
145 * JID j( "somejid" );
146 * JID copy = j.fullJID();
151 * JID j( "somejid" );
155 * @subsubsection func_JID_empty 1.2.3 JID::empty()
157 * This function has been replaced by JID::operator bool(). This has the added benefit of validity
174 * if( j ) // this evaluates to true only if the JID is not empty and if the contained JID
175 * // is in fact valid, i.e. if no prepping operation failed.
181 * @subsubsection func_Tag_empty 1.2.4 Tag::empty()
183 * This function has been replaced by Tag::operator bool(). This has the added benefit of validity
197 * Tag* t = new Tag( "foo" );
216 * Tag* t = new Tag( "foo" );
224 * @subsubsection func_Tag_attributes 1.2.5 Tag::attributes() (non-const)
226 * This function has been removed. Use the const version instead. To delete an attribute,
227 * use the new @link gloox::Tag::removeAttribute() removeAttribute() @endlink.
229 * @subsubsection func_Tag_attributes 1.2.6 Tag::children() (non-const)
231 * This function has been removed. Use the const version instead. To delete a child element,
232 * use @link gloox::Tag::removeChild() removeChild() @endlink.
234 * @subsubsection func_createStanzas 1.2.7 Stanza::createMessageStanza(), Stanza::createPresenceStanza(), Stanza::createIqStanza(), Stanza::createSubscriptionStanza()
236 * These functions have been removed in favour of the more specialized classes
237 * @link gloox::Message Message @endlink, @link gloox::Presence Presence @endlink,
238 * @link gloox::IQ IQ @endlink, and @link gloox::Subscription Subscription @endlink.
240 * @subsubsection class_InBandBytestreamManager 1.2.8 InBandBytestreamManager
242 * The Message-based Inband Bytestream implementation has been removed in favour of an IQ-based one.
243 * Also, Inband Bytestreams are now handled (transparently) by @link gloox::SIProfileFT SIProfileFT @endlink.
245 * @subsubsection func_AdhocHandler_handleAdhocError 1.2.9 AdhocHandler::handleAdhocError( const JID&, StanzaError )
247 * This function has been removed in favor of
248 * @link gloox::AdhocHandler::handleAdhocError( const JID&, const Error* ) handleAdhocError( const JID&, const Error* ) @endlink.
250 * @subsubsection func_SIProfileFTHandler_handleFTRequestError 1.2.10 SIProfileFTHandler::handleFTRequestError( IQ*, const std::string& )
252 * This function has been removed in favor of
253 * @link gloox::SIProfileFTHandler::handleFTRequestError( const IQ&, const std::string& ) handleFTRequestError( const IQ&, const std::string& ) @endlink.
255 * @subsubsection func_BytestreamHandler_handelBytestreamError 1.2.11 BytestreamHandler::handleBytestreamError( IQ* iq, const std::string& sid )
257 * This function has been removed in favor of
258 * @link gloox::BytestreamHandler::handleBytestreamError( const IQ& iq, const std::string& ) handleBytestreamError( const IQ& iq, const std::string& sid ) @endlink.
260 * @subsubsection func_BytestreamDataHandler_handelBytestreamError 1.2.12 BytestreamDataHandler::handleBytestreamError( Bytestream* bs, IQ* )
262 * This function has been removed in favor of
263 * @link gloox::BytestreamDataHandler::handleBytestreamError( Bytestream* bs, const IQ& ) handleBytestreamError( Bytestream* bs, const IQ& ) @endlink.
265 * @subsubsection func_Disco_category 1.2.13 Disco::category()
267 * This function has been removed. Use @link gloox::Disco::identities() Disco::identities() @endlink
270 * @subsubsection func_Disco_type 1.2.14 Disco::type()
272 * This function has been removed. Use @link gloox::Disco::identities() Disco::identities() @endlink
275 * @subsubsection func_PrivateXMLHandler_handlePrivateXML 1.2.15 PrivateXMLHandler::handlePrivateXML( const std::string&, Tag* )
277 * This function has been removed in favor of
278 * @link gloox::PrivateXMLHandler::handlePrivateXML() PrivateXMLHandler::handlePrivateXML( const Tag* ) @endlink.
280 * @subsubsection func_PrivateXML_storeXML 1.2.16 PrivateXML::storeXML( Tag*, PrivateXMLHandler* )
282 * This function has been removed in favor of
283 * @link gloox::PrivateXML::storeXML() PrivateXML::storeXML( const Tag*, PrivateXMLHandler* ) @endlink.
285 * @subsubsection func_Client 1.2.17 Client::Client( string, string, string, string, int )
287 * This function has been removed. The only recommended alternative is
288 * @link gloox::Client::Client() Client::Client( const JID&, const std::string&, int ) @endlink.
295 * @subsection semantics_10 1.3 Semantic Changes
297 * @subsubsection param_handleFTRequest 1.3.1 SIProfileFTHandler::handleFTRequest()
299 * The second parameter is now a Session ID (sid). This should be used with
300 * @link gloox::SIProfileFT::acceptFT() SIProfileFT::acceptFTRequest() @endlink or
301 * @link gloox::SIProfileFT::declineFT() SIProfileFT::declineFTRequest() @endlink.
303 * @subsubsection param_acceptFTRequest 1.3.2 SIProfileFT::acceptFTRequest()
305 * The second parameter is now a Session ID (sid). It must be the same value as the Session ID (sid)
307 * @link gloox::SIProfileFTHandler::handleFTRequest() SIProfileFTHandler::handleFTRequest() @endlink.
308 * Further, the function has been renamed to
309 * @link gloox::SIProfileFT::acceptFT() acceptFT() @endlink.
311 * @subsubsection param_declineFTRequest 1.3.3 SIProfileFT::declineFTRequest()
313 * The second parameter is now a Session ID (sid). It must be the same value as the Session ID (sid)
315 * @link gloox::SIProfileFTHandler::handleFTRequest() SIProfileFTHandler::handleFTRequest() @endlink.
316 * Further, the function has been renamed to
317 * @link gloox::SIProfileFT::declineFT() declineFT() @endlink.
319 * @section upgrading_10_101 2. Upgrading from to 1.0 to 1.0.1
321 * 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
322 * necessary to add a parameter to @link gloox::ClientBase::handleStartNode( const Tag* ) ClientBase::handleStartNode() @endlink.