Bug 34308 - Simple “sign in and send a message” example (with porter bug)
Summary: Simple “sign in and send a message” example (with porter bug)
Status: RESOLVED FIXED
Alias: None
Product: Wocky
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL: http://cgit.collabora.co.uk/git/user/...
Whiteboard: review+
Keywords: patch
Depends on:
Blocks:
 
Reported: 2011-02-15 12:14 UTC by Will Thompson
Modified: 2011-03-17 09:37 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Will Thompson 2011-02-15 12:14:01 UTC
Hello,

I've been working on a trivial example program that signs in and sends a single message to a contact. Here is the branch: http://git.collabora.co.uk/?p=user/wjt/wocky.git;a=shortlog;h=refs/heads/message-example

Here is the actual code: http://git.collabora.co.uk/?p=user/wjt/wocky.git;a=blob;f=examples/message.c;h=82be292a617adef14f5df034d8ea7e9d84049627;hb=0dd3a10f6dbfa6f580eed5ae0f492eaaac2e540f

However! wocky_porter_close_async() always fails as follows:


2008 % ./examples/wocky-message t-pain@test.collabora.co.uk XXXXXX will.thompson@collabora.co.uk "very thin ice"       
Sent 'very thin ice' to will.thompson@collabora.co.uk

** (process:11990): WARNING **: Couldn't sign out: Another send operation is pending

I can't see anything I'm obviously doing wrong in the example… I'd rather hope I knew how to drive Wocky by now, but I have been wrong on many occasions in the past.
Comment 1 Jonny Lamb 2011-03-11 02:15:21 UTC
I fixed the bug wjt was hitting:

http://cgit.freedesktop.org/~jonny/wocky/log?h=message-example
Comment 2 Will Thompson 2011-03-17 07:27:28 UTC
I endorse Jonny's patch. I've stolen it, and rebased my branch with the test case and example onto it. Also, I've added an example of receiving incoming messages, and deleted the connector examples, and fixed a few cosmetic issues I stumbled upon. See the branch!
Comment 3 Jonny Lamb 2011-03-17 08:21:36 UTC
+ g_print ("%s\n", G_STRFUNC);

o rly

Neither of your tests call wocky_deinit().

+ '@', "show", "chat",

Not chatty? :-(

Other than that it's fine.
Comment 4 Will Thompson 2011-03-17 08:28:04 UTC
(In reply to comment #3)
> + g_print ("%s\n", G_STRFUNC);
> 
> o rly

Whoops.

> Neither of your tests call wocky_deinit().

I assume you mean examples? (The tests do call it, so they can be valground.) I don't think real applications generally should feel the need to call wocky_deinit():

/**
 * wocky_deinit:
 *
 * Clean up any resources created by Wocky in wocky_init().
 *
 * It is normally not needed to call this function in a normal application
 * as the resources will automatically be freed when the program terminates.
 * This function is therefore mostly used by testsuites and other memory
 * profiling tools.

But I'm prepared to be told they should?

> + '@', "show", "chat",
> 
> Not chatty? :-(

http://xmpp.org/rfcs/rfc3921.html#stanzas-presence-children-show
Comment 5 Jonny Lamb 2011-03-17 08:33:26 UTC
(In reply to comment #4)
> I assume you mean examples? (The tests do call it, so they can be valground.) I
> don't think real applications generally should feel the need to call
> wocky_deinit():

OK.

> http://xmpp.org/rfcs/rfc3921.html#stanzas-presence-children-show

:-(
Comment 6 Will Thompson 2011-03-17 08:35:07 UTC
(In reply to comment #5)
> > http://xmpp.org/rfcs/rfc3921.html#stanzas-presence-children-show
> 
> :-(

hah, despite linking to le rfc i still got it wrong. refresh for a new patch verified to work with the unique power of telepathy-inspector
Comment 7 Jonny Lamb 2011-03-17 08:42:39 UTC
<show>longcat</show

gogogogogo merge
Comment 8 Will Thompson 2011-03-17 09:37:03 UTC
It is done.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.