Changes between Version 4 and Version 5 of XMPPClients


Ignore:
Timestamp:
Feb 29, 2008, 4:51:17 PM (15 years ago)
Author:
ralphm
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • XMPPClients

    v4 v5  
    134134We can now use this deferred to add callbacks for our one-time tasks. The first callback we add is `getVersion`, while using a lambda construct to ignore the result of the callback. We pass the object that represents the XML stream, as stored in the factory's stream manager. This is needed for tracking the response to the version query. The second parameter is the JID that we want to send the version request to, in this case, the server that holds the account we login with.
    135135
    136 The second callback uses the result from the version request, a dictionary with the keys `name` and `version` to hold the software name and version strings as reported by our server.
    137 
    138 The third callback neatly closes the stream. In case of any error, the added errback handler just logs it and finally we add a callback that is always called, shutting down the application after one second.
     136The second callback uses the result from the version request, a dictionary with the keys `name` and `version` to hold the software name and version strings as reported by our server. Having been passed this dictionary, `printVersion` prints the information to the terminal. The third callback neatly closes the stream. In case of any error, the added errback handler just logs it and finally we add a callback that is always called, shutting down the application after one second.