[Telepathy] tp_cli_connection_manager_run_request_connection(): What parameter types.

Will Thompson will.thompson at collabora.co.uk
Tue Oct 28 11:38:24 PDT 2008


On 28/10/08 17:17, Murray Cumming wrote:
> I now have a connection and tried to connect the connection. I am
> surprised that I didn't get a GError in this test code:
> http://git.collabora.co.uk/?p=telepathy-doc.git;a=blob;f=docs/examples/list_contacts/main.c
>
> I am quite sure that my jabber password is not "passwordTODO". Am I
> missing something?
>   

:-) Yes. From the specification (and indeed the documentation of
tp_cli_connection_run_connect):

> Request that the connection be established. This will be done
> asynchronously and errors will be returned by emitting StatusChanged
> signals.

So, Connect returning successfully just means that the connection
manager will start trying to connect.

Having created the Connection, you should connect to the StatusChanged
signal, then call Connect. The connection will emit
StatusChanged(Connecting, Requested), and subsequently either emit
StatusChanged(Connected, None_Specified) if the connection succeeds, or
StatusChanged(Disconnected, Authentication).

For the sake of your example, the StatusChanged handler probably just
wants to log a message when the new state is Connecting. If it gets
Connected, it can start kicking off the relevant method calls to list
contacts, and subsequently call Disconnect() which will cause
StatusChanged(Disconnected, Requested) (at which point you probably want
to g_main_loop_quit () so the example exits). If it gets Disconnected
for any reason other than requested, it should log the reason (which in
the passwordTODO case will be Authentication_Failed) and
g_main_loop_quit ().

-- 
Will


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
Url : http://lists.freedesktop.org/archives/telepathy/attachments/20081028/94beacb3/attachment-0001.pgp 


More information about the Telepathy mailing list