Created attachment 68452 [details]
When a contact goes offline it's clientTypes list is not updated (cleared) so it still contains "pc" or "mobile", but that's not true anymore.
I don't know where exactly this should be fixed - whether backend should send a signal with empty clientTypes list when contact goes offline, or whether TelepathyQt should handle this on it's own. As I'm not much familiar with the code, the attached patch simply clears Tp::Contact::Private::mClientTypes list when contact's presence changes to offline.
(In reply to comment #0)
> When a contact goes offline it's clientTypes list is not updated (cleared)
> so it still contains "pc" or "mobile", but that's not true anymore.
I think this is a connection manager ("backend") bug: ClientTypesUpdated(handle, ) should be emitted. Client code shouldn't have to understand the relationship between client types and presence.
telepathy-gabble seems to be our only major CM with ClientTypes support, so I'm reassigning this bug there. Please clone this bug if you have seen this in other CMs.
Here is a regression test for Gabble if anyone wants to work on this. I had a quick look, but the presence/presence-cache code is a bit tangled.
diff --git a/tests/twisted/client-types.py b/tests/twisted/client-types.py
index 2eaeebe..62ea62e 100644
@@ -241,6 +241,13 @@ def test2(q, bus, conn, stream):
+ # both devices go offline
+ stream.send(make_presence(marco_pidgin, type='unavailable'))
+ q.expect('dbus-signal', signal='ClientTypesUpdated',
+ args=[handle, ['phone']])
+ stream.send(make_presence(marco_phone, type='unavailable'))
+ q.expect('dbus-signal', signal='ClientTypesUpdated', args=[handle, ])
def two_contacts_with_the_same_hash(q, bus, conn, stream, bare_jids):
contact1 = 'email@example.com'
contact2 = 'firstname.lastname@example.org'