[Telepathy] message received method

George Kiagiadakis gkiagia at tolabaki.gr
Fri Jul 22 05:35:35 UTC 2016


On 21.07.2016 22:07, Mateus Bellomo wrote:
> Hello,
> 
> I've implemented methods to send and receive text message at
> telepathy-resiprocate but I think I'm mixing the sender/receiver
> handles. I'm using telepathy-morse [1] as a guide and I would like to
> know what is the meaning of contactHandle, targetHandle and
> initiatorHandle.
> 
> Right now I can send and receive text messages at
> telepathy-resiprocate in Empathy and this is what happening: when I
> receive a message (sent from Jitsi to telepathy-resiprocate) it shows
> in a window that appears to be a conversation with myself
> (telepathy-resiprocate Empathy with telepathy-resiprocate Empathy) and
> if I send a message through this same window from
> telepathy-resiprocate client, it actually sends the message to myself.
> 
> Any help would be greatly appreciated. Thanks.
> 
> [1]https://github.com/TelepathyQt/telepathy-morse/blob/master/connection.cpp#L928
> [1]
> 

Generally, the InitiatorHandle [1] is the handle of the *contact* that 
initiated the channel. If you start talking with Bob on your client, 
then the initiator is you. If Bob begins chatting with you first, then 
Bob is the initiator. If Bob starts talking with Alice in a chatroom and 
then Alice invites you, the initiator is Alice.

This piece of code that you have linked looks like it is being called 
when someone else initiates a channel, either 1-to-1 or a room. When it 
is a 1-to-1 channel (chatMessage == false, ... bad name for a variable I 
guess), the InitiatorHandle is the peer identifier, which I guess is the 
remote contact that started the channel. When it is a room channel 
(chatMessage == true), it uses the message.userId handle as the 
Initiator, which I don't really know what it represents, but it *should* 
represent the contact that initiated the chat room (i.e. invited you to 
join).

Now the TargetHandle [2] is the handle of the contact or room that this 
channel allows you to communicate with. This is always the remote 
contact in 1-to-1 channels and a room identifier in room channels.

I hope this helps. Note that this code may well be wrong or may rely on 
protocol-specific quirks that are not the same on SIP, so you should try 
to understand first what Telepathy expects from your connection manager 
and then try to provide it in the best way possible.

[1]. 
https://telepathy.freedesktop.org/spec/Channel.html#Property:InitiatorHandle.
[2]. 
https://telepathy.freedesktop.org/spec/Channel.html#Property:TargetHandle



More information about the telepathy mailing list