gloox  1.0.28
UPGRADING
1 /**
2  * @page upgrading Upgrading from earlier versions
3  *
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.
7  *
8  * @tableofcontents
9  *
10  * @section upgrading_09_10 1. Upgrading from 0.9.x to 1.0
11  *
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.
16  * Therefore,
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:
25  *
26  * Old code:
27  * @code
28  * void MyClass::handlePresence( Stanza* stanza )
29  * {
30  * // ...
31  * }
32  * @endcode
33  *
34  * New code (deprecated):
35  * @code
36  * void MyClass::handlePresence( Presence* pres )
37  * {
38  * // ...
39  * }
40  * @endcode
41  * or
42  * New code (recommended):
43  * @code
44  * void MyClass::handlePresence( const Presence& pres )
45  * {
46  * // ...
47  * }
48  * @endcode
49  *
50  * @subsection deprecated_10 1.1 Deprecated classes and functions
51  *
52  * @subsubsection func_MUCRoomHandler_handleMucMessage 1.1.1 MUCRoomHandler::handleMUCMessage( MUCRoom*, string, string, bool, string, bool ),
53  *
54  * Use @link gloox::MUCRoomHandler::handleMUCMessage( MUCRoom*, const Message&, bool ) handleMUCMessage( MUCRoom*, Message&, bool ) @endlink instead.
55  *
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:
59  *
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,
65  * @code
66  * bool history = msg.when() ? true : false;
67  * @endcode
68  * @li the message's time stamp.
69  * @code
70  * const DelayedDelivery* dd = msg.when();
71  * if( dd )
72  * printf( "message was sent at %s\n", dd->stamp().c_str() );
73  * @endcode
74  *
75  * @subsubsection func_ClientBase_trackID 1.1.2 ClientBase::trackID()
76  *
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.
81  *
82  * Old code:
83  * @code
84  * const std::string& id = m_client->getID();
85  * Tag* iq = ...
86  * iq->addAtrribute( "id", id );
87  * ...
88  * m_client->trackID( this, id, SomeContext );
89  * m_client->send( iq );
90  * @endcode
91  *
92  * New code:
93  * @code
94  * IQ iq( IQ::Set, recipientJID );
95  * ...
96  * m_client->send( iq, this, SomeContext );
97  * @endcode
98  *
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.
102  *
103  * @subsubsection func_DiscoHandler_handleDiscoInfoResult 1.1.3 DiscoHandler::handleDiscoInfoResult()
104  *
105  * The function
106  * gloox::DiscoHandler::handleDiscoInfoResult()
107  * has been removed. Replacement is:
108  * @link gloox::DiscoHandler::handleDiscoInfo() DiscoHandler::handleDiscoInfo() @endlink.
109  *
110  * @subsubsection func_DiscoHandler_handleDiscoItemsResult 1.1.4 DiscoHandler::handleDiscoItemsResult()
111  *
112  * The function
113  * gloox::DiscoHandler::handleDiscoItemsResult()
114  * has been removed. Replacement is:
115  * @link gloox::DiscoHandler::handleDiscoItems() DiscoHandler::handleDiscoItems() @endlink.
116  *
117  * @subsubsection func_DiscoHandler_handleDiscoError 1.1.5 DiscoHandler::handleDiscoError()
118  *
119  * The function
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.
123  *
124  * @subsubsection func_MUCRoom_destroy 1.1.6 MUCRoom::destroy()
125  *
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.
128  *
129  *
130  *
131  *
132  * @subsection removed_10 1.2 Removed classes and functions
133  *
134  * @subsubsection class_XDelayedDelivery 1.2.1 XDelayedDelivery
135  *
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.
138  *
139  * @subsubsection func_JID_fullJID 1.2.2 JID::fullJID()
140  *
141  * Use the copy constructor instead. E.g.:
142  *
143  * Old code:
144  * @code
145  * JID j( "somejid" );
146  * JID copy = j.fullJID();
147  * @endcode
148  *
149  * New code:
150  * @code
151  * JID j( "somejid" );
152  * JID copy( j );
153  * @endcode
154  *
155  * @subsubsection func_JID_empty 1.2.3 JID::empty()
156  *
157  * This function has been replaced by JID::operator bool(). This has the added benefit of validity
158  * checking. E.g.:
159  *
160  * Old code:
161  * @code
162  * JID j;
163  * // ...
164  * if( !j.empty() )
165  * {
166  * // do something
167  * }
168  * @endcode
169  *
170  * New code:
171  * @code
172  * JID j;
173  * // ...
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.
176  * {
177  * // do something
178  * }
179  * @endcode
180  *
181  * @subsubsection func_Tag_empty 1.2.4 Tag::empty()
182  *
183  * This function has been replaced by Tag::operator bool(). This has the added benefit of validity
184  * checking. E.g.:
185  *
186  * Old code:
187  * @code
188  * Tag t;
189  * // ...
190  * if( !t.empty() )
191  * {
192  * // do something
193  * }
194  * @endcode
195  * Or:
196  * @code
197  * Tag* t = new Tag( "foo" );
198  * // ...
199  * if( !t->empty() )
200  * {
201  * // do something
202  * }
203  * @endcode
204  *
205  * New code:
206  * @code
207  * Tag t;
208  * // ...
209  * if( t )
210  * {
211  * // do something
212  * }
213  * @endcode
214  * Or:
215  * @code
216  * Tag* t = new Tag( "foo" );
217  * // ...
218  * if( *t )
219  * {
220  * // do something
221  * }
222  * @endcode
223  *
224  * @subsubsection func_Tag_attributes 1.2.5 Tag::attributes() (non-const)
225  *
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.
228  *
229  * @subsubsection func_Tag_attributes 1.2.6 Tag::children() (non-const)
230  *
231  * This function has been removed. Use the const version instead. To delete a child element,
232  * use @link gloox::Tag::removeChild() removeChild() @endlink.
233  *
234  * @subsubsection func_createStanzas 1.2.7 Stanza::createMessageStanza(), Stanza::createPresenceStanza(), Stanza::createIqStanza(), Stanza::createSubscriptionStanza()
235  *
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.
239  *
240  * @subsubsection class_InBandBytestreamManager 1.2.8 InBandBytestreamManager
241  *
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.
244  *
245  * @subsubsection func_AdhocHandler_handleAdhocError 1.2.9 AdhocHandler::handleAdhocError( const JID&, StanzaError )
246  *
247  * This function has been removed in favor of
248  * @link gloox::AdhocHandler::handleAdhocError( const JID&, const Error* ) handleAdhocError( const JID&, const Error* ) @endlink.
249  *
250  * @subsubsection func_SIProfileFTHandler_handleFTRequestError 1.2.10 SIProfileFTHandler::handleFTRequestError( IQ*, const std::string& )
251  *
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.
254  *
255  * @subsubsection func_BytestreamHandler_handelBytestreamError 1.2.11 BytestreamHandler::handleBytestreamError( IQ* iq, const std::string& sid )
256  *
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.
259  *
260  * @subsubsection func_BytestreamDataHandler_handelBytestreamError 1.2.12 BytestreamDataHandler::handleBytestreamError( Bytestream* bs, IQ* )
261  *
262  * This function has been removed in favor of
263  * @link gloox::BytestreamDataHandler::handleBytestreamError( Bytestream* bs, const IQ& ) handleBytestreamError( Bytestream* bs, const IQ& ) @endlink.
264  *
265  * @subsubsection func_Disco_category 1.2.13 Disco::category()
266  *
267  * This function has been removed. Use @link gloox::Disco::identities() Disco::identities() @endlink
268  * instead.
269  *
270  * @subsubsection func_Disco_type 1.2.14 Disco::type()
271  *
272  * This function has been removed. Use @link gloox::Disco::identities() Disco::identities() @endlink
273  * instead.
274  *
275  * @subsubsection func_PrivateXMLHandler_handlePrivateXML 1.2.15 PrivateXMLHandler::handlePrivateXML( const std::string&, Tag* )
276  *
277  * This function has been removed in favor of
278  * @link gloox::PrivateXMLHandler::handlePrivateXML() PrivateXMLHandler::handlePrivateXML( const Tag* ) @endlink.
279  *
280  * @subsubsection func_PrivateXML_storeXML 1.2.16 PrivateXML::storeXML( Tag*, PrivateXMLHandler* )
281  *
282  * This function has been removed in favor of
283  * @link gloox::PrivateXML::storeXML() PrivateXML::storeXML( const Tag*, PrivateXMLHandler* ) @endlink.
284  *
285  * @subsubsection func_Client 1.2.17 Client::Client( string, string, string, string, int )
286  *
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.
289  *
290  *
291  *
292  *
293  *
294  *
295  * @subsection semantics_10 1.3 Semantic Changes
296  *
297  * @subsubsection param_handleFTRequest 1.3.1 SIProfileFTHandler::handleFTRequest()
298  *
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.
302  *
303  * @subsubsection param_acceptFTRequest 1.3.2 SIProfileFT::acceptFTRequest()
304  *
305  * The second parameter is now a Session ID (sid). It must be the same value as the Session ID (sid)
306  * passed to
307  * @link gloox::SIProfileFTHandler::handleFTRequest() SIProfileFTHandler::handleFTRequest() @endlink.
308  * Further, the function has been renamed to
309  * @link gloox::SIProfileFT::acceptFT() acceptFT() @endlink.
310  *
311  * @subsubsection param_declineFTRequest 1.3.3 SIProfileFT::declineFTRequest()
312  *
313  * The second parameter is now a Session ID (sid). It must be the same value as the Session ID (sid)
314  * passed to
315  * @link gloox::SIProfileFTHandler::handleFTRequest() SIProfileFTHandler::handleFTRequest() @endlink.
316  * Further, the function has been renamed to
317  * @link gloox::SIProfileFT::declineFT() declineFT() @endlink.
318  *
319  * @section upgrading_10_101 2. Upgrading from to 1.0 to 1.0.1
320  *
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.
323  *
324  */