[Telepathy] Simple example for listening signals

Will Thompson will.thompson at collabora.co.uk
Thu Jun 9 08:13:14 PDT 2011


On 08/06/11 20:34, Krzysztof wrote:
> I am writting chat history manager. I need listen for incoming and
> outgoing text messages (from empathy). I have done similar plugin for
> pidgin IM using dbus too. So I am trying now create this same thing for
> empathy. I spent all day looking at the telepathy documentation and
> got a headache :) . I'm writting in Free Pascal. It doesn't have special
> bindings so I am using dbus low level api. I know that text
> channel is what I'm looking for, but there is so much interfaces and I
> am lost. All python examples using bindings and I can't see what is
> going in background. This is my code for listening signals in pidgin:
> 
>   { Initializes the errors }
>   dbus_error_init(@FDBErr);
> 
>   { Connection }
>   FDBConn := dbus_bus_get(DBUS_BUS_SESSION, @FDBErr);
> 
>   if FDBConn = nil then Exit;  
> 
>   dbus_bus_add_match(FDBConn,
> 'type=''signal'',interface=''im.pidgin.purple.PurpleInterface''', @FDBErr);
>   dbus_connection_flush(FDBConn);     
> 
> and in loop I just check:
> 
>   if (dbus_message_is_signal(msg, 'im.pidgin.purple.PurpleInterface',
> 'ReceivedImMsg')<>0) then
>   ........
> 
> What should I do to get this same thing on telepathy?

If you literally just want to look at incoming and outgoing messages,
add a match for
"type='signal',interface='org.freedesktop.Telepathy.Channel.Interface.Messages'"
and listen for the MessageSent or MessageReceived signals. See
http://telepathy.freedesktop.org/spec/Channel_Interface_Messages.html
for the details of the signals on that interface.

-- 
Will


More information about the telepathy mailing list