Using pointers in arguments of a signal via DBus
Paul Aurich
paul at darkrain42.org
Tue Jul 20 23:19:01 EDT 2010
This is probably a better question for the devel mailing list
On 2010-07-20 10:19, Liangent wrote:
> Hi,
>
> I'm listening to a signal in Python via DBus with the following code:
>
> def cb_jabber_receiving_message(gc, type, id, from_, to, message):
> # some code ...
>
> bus.add_signal_receiver(
> cb_jabber_receiving_message,
> dbus_interface = 'im.pidgin.purple.PurpleInterface',
> signal_name = 'JabberReceivingMessage',
> )
>
> I cannot figure out how the message argument can be used. I tried some
> Xmlnode* functions exported via DBus, but they always fail with
> "DBusException: im.pidgin.purple.InvalidHandle: xmlnode object with ID
> = 729930 not found" (where 729930 is the value of message argument). I
> guess the reason is that the xmlnode was freed before DBus function's
> invoking, then how can I read the content of message?
You are correct that the xmlnode is going to be destroyed before
libpurple gets around to processing your dbus request to fetch the
xmlnode's data.
Hmm, I thought there was a jabber-receiving-text signal, but it doesn't
look like there is. If it existed, you could watch on that and parse
the data yourself (ugly).
OTOH, I can think of two "solutions", neither of which are great:
* Develop your code as a native plugin (either C, Perl, or TCL),
which have synchronous access to things like that xmlnode
* Code up a shim plugin which *just* binds to the signals you care
about, turns around and emits a new signal with the output of
xmlnode_to_str().
Someone else may have a better idea or some other alternatives.
~Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 897 bytes
Desc: OpenPGP digital signature
URL: <http://pidgin.im/pipermail/support/attachments/20100720/5085641b/attachment.sig>
More information about the Support
mailing list