Bug 40933

Summary: Too many MembersChanged(Detailed) signals when connecting
Product: Telepathy Reporter: Marco Barisione <marco.barisione>
Component: tp-glibAssignee: Marco Barisione <marco.barisione>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: git master   
Hardware: Other   
OS: All   
URL: http://cgit.collabora.com/git/user/bari/telepathy-glib.git/log/?h=initial-members-changed
Whiteboard:
i915 platform: i915 features:

Description Marco Barisione 2011-09-16 03:49:32 UTC
Currently telepathy-glib emits one MembersChanged signal and one MembersChangedDetailed signal per contact in the subscribe list.
Comment 1 Marco Barisione 2011-09-16 03:53:56 UTC
This branch fixes the problem by distinguishing when a contact appears in our contact list because it's already there when we connect (so we group the contacts and emit the signal with actor=0) and when contacts appear later because they accepted our subscription request.

Another possible solution is to not emit the signal at all when connecting. I looked into that, but I think that the fix looks more like a hack with little gain (emitting one MembersChanged and one MembersChangedDetailed signal is not a problem).
Comment 2 Simon McVittie 2011-09-16 04:09:51 UTC
> + tp_group_mixin_change_members (sub_chan, "", sub, NULL, NULL, NULL, 100,
> + TP_CHANNEL_GROUP_CHANGE_REASON_NONE);

s/100/0/ (the actor)

> + if (interface == TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP &&
> + msg_type == DBUS_MESSAGE_TYPE_SIGNAL &&
> + g_strcmp0 (member, "MembersChanged") == 0)

dbus_message_is_signal() is ideal for low-level filters like this

Other than that, looks good to me.
Comment 3 Will Thompson 2011-09-16 04:15:41 UTC
+  tp_group_mixin_change_members (sub_chan, "", sub, NULL, NULL, NULL, 100,

Actor 100? :O

The rest of this is just nit-picking

+  closure = g_slice_new0 (MembersChangedClosure);

You don't need to slice-allocate the struct, you could just stick it on the stack. I don't really care though.

+      g_assert (lookup_contact (self, members[i]) == NULL);

g_assert_cmpstr for future reference. :)

+  /* Now put it online and wait for contact list state move to success */

“wait for the contact list state to move”
Comment 4 Marco Barisione 2011-09-16 13:35:30 UTC
100 was an interesting typo :-O

> +      g_assert (lookup_contact (self, members[i]) == NULL);
> 
> g_assert_cmpstr for future reference. :)

Er... it's not a string :)

I fixed the things you suggested to change and pushed to master.

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.