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

Marc Neeley neeleym at ociweb.com
Wed Feb 29 23:48:32 CET 2012


Kevin,
  Thanks for the reply. That was the issue and I needed to refactor some of
the code to account for this simple difference. I had other classes that
were attempting to use this same Client instantiation and failing because of
the same problem.
Anyway I'm good now.

Thanks for the help,
Marc

-----Original Message-----
From: k.i.smith at gmail.com [mailto:k.i.smith at gmail.com] On Behalf Of Kevin
Smith
Sent: Wednesday, February 29, 2012 12:01 PM
To: Marc Neeley
Cc: swift-users at swift.im
Subject: Re: [swift-users] isAvailable( ) not evaluating to true...

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