[swift-users] isAvailable( ) not evaluating to true...

Kevin Smith kevin at kismith.co.uk
Wed Feb 29 19:00:31 CET 2012


On Wed, Feb 29, 2012 at 5:47 PM, Marc Neeley <neeleym at ociweb.com> wrote:
> Hi,
>
>    I’ve been experimenting with the Swift C++ client library and have the
> following snippet of code that doesn’t seem to want to execute on the ‘true’
> side of the Boolean.
>
> When the client code does connect, I see that the onConnected handler does
> execute and a presence indicator does get sent to an OpenFire server. I see
> it in my Pidgin client.
>
> If the connect is working, then why is the isAvailable() not resolving to
> true?  Any help would be appreciated.

This is because Swiften's an async API - the connect() call returns
immediately, and you get told when the connection completes with the
onConnected signal; only once it's connected will isAvailable() be
true. I imagine you want to move that block of code into a
handleConnected method, connect to the onConnected signal, and it
should work much better - there's a walkthrough at
http://swift.im/swiften/guide/ that will probably help with this.

/K


More information about the swift-users mailing list