GNOME Bugzilla – Bug 637151
Hide the user Individual from the contact list
Last modified: 2011-08-29 10:12:43 UTC
At the moment, folks always exposes an Individual which represents the current user (i.e. the owner of all the IM accounts). Empathy needs to hide this Individual from the contact list — more specifically, it needs to hide any of the Personas in the Individual which haven't been explicitly added to one of the user's rosters.
(In reply to comment #0) > ... more specifically, it needs to hide any of > the Personas in the Individual which haven't been explicitly added to one of > the user's rosters. Right. I'd like to make sure we can add ourselves if we want. That's how I do a lot of development testing.
So far, I've got something vaguely working by adding a new property to TpfPersona: is-in-contact-list. This is normally TRUE, but in the case that the persona is the TpConnection's self-handle, it's FALSE unless it's also found in the user's contact list. The intention with this is that Empathy can then filter out personas which have is-user as TRUE, but is-in-contact-list as FALSE. However, I'm finding it quite hard to make use of this in Empathy in a simple and efficient manner. Any implementation is going to have to connect to the is-in-contact-list notification signal on every persona in the user's FolksIndividual, and keep track of changes to the individual's set of personas, and the corresponding signal connections and disconnections. Before I go any further with this implementation, I was wondering if an alternative might be better. How about adding a GSettings key called “show-user” (or similar) which would normally be FALSE. When FALSE, Empathy would filter out all FolksIndividuals with is-user set to TRUE. When TRUE, however, Empathy wouldn't perform any of this filtering. Under the assumption that the only use case for adding oneself as a contact and showing the linked user's individual is for development and testing purposes, this would work. Developers could set the GSettings key to TRUE and see the FolksIndividual with is-user set to TRUE. Normal users would never see that FolksIndividual. However, if there are other use cases for adding oneself as a contact, this might not work. It'll mean that if someone has two accounts and they've added each account as a contact to the other account, none of those contacts will show up in Empathy unless the GSettings key is set to TRUE. Guillaume, Travis, Sjoerd; do you have any thoughts on this?
(In reply to comment #2) > So far, I've got something vaguely working by adding a new property to > TpfPersona: is-in-contact-list. This is normally TRUE, but in the case that the > persona is the TpConnection's self-handle, it's FALSE unless it's also found in > the user's contact list. > > The intention with this is that Empathy can then filter out personas which have > is-user as TRUE, but is-in-contact-list as FALSE. > > However, I'm finding it quite hard to make use of this in Empathy in a simple > and efficient manner. Any implementation is going to have to connect to the > is-in-contact-list notification signal on every persona in the user's > FolksIndividual, and keep track of changes to the individual's set of personas, > and the corresponding signal connections and disconnections. Yeah, it does seem a bit clunky, though I can't think of anything better off the top of my head. How are you making the distinction within the Telepathy backend? Is it (is self contact) && (in {stored} - {subscribe})? I vaguely recall that some CMs used to have an 'automatic' contact list that may have held the 'user-added' distinction. At any rate, that doesn't seem to exist now. > Before I go any further with this implementation, I was wondering if an > alternative might be better. How about adding a GSettings key called > “show-user” (or similar) which would normally be FALSE. When FALSE, Empathy > would filter out all FolksIndividuals with is-user set to TRUE. When TRUE, > however, Empathy wouldn't perform any of this filtering. > > Under the assumption that the only use case for adding oneself as a contact and > showing the linked user's individual is for development and testing purposes, > this would work. Developers could set the GSettings key to TRUE and see the > FolksIndividual with is-user set to TRUE. Normal users would never see that > FolksIndividual. > > However, if there are other use cases for adding oneself as a contact, this > might not work. It'll mean that if someone has two accounts and they've added > each account as a contact to the other account, none of those contacts will > show up in Empathy unless the GSettings key is set to TRUE. Guillaume, Travis, > Sjoerd; do you have any thoughts on this? I'm inclined against a GSettings key. Well before I was developing any IM software, I manually added myself to my contact lists. I'm not sure I used it much, and it think it may have just been because my IM client was bad at indicating whether accounts had successfully connected. At any rate, it wouldn't surprise me if people used self contacts to send themselves notes (the same way a lot of people email tasks and other notes to themselves). But more than that, I'd be concerned about the discoverability. If a regular user manually adds themselves to a contact list, they're going to expect themselves to show up (I'd argue, even more than they'd expect them to not show up if they didn't add them (this bug)) without needing to tweak (in)visible settings.
(In reply to comment #3) > How are you making the distinction within the Telepathy backend? > > Is it (is self contact) && (in {stored} - {subscribe})? Yeah. > I'm inclined against a GSettings key. Well before I was developing any IM > software, I manually added myself to my contact lists. I'm not sure I used it > much, and it think it may have just been because my IM client was bad at > indicating whether accounts had successfully connected. > > At any rate, it wouldn't surprise me if people used self contacts to send > themselves notes (the same way a lot of people email tasks and other notes to > themselves). > > But more than that, I'd be concerned about the discoverability. If a regular > user manually adds themselves to a contact list, they're going to expect > themselves to show up (I'd argue, even more than they'd expect them to not show > up if they didn't add them (this bug)) without needing to tweak (in)visible > settings. Good point. I'll see if I can find a better way to get this working the conventional way when I can find some time.
Created attachment 179602 [details] [review] Hide the user individual from the contact list http://git.collabora.co.uk/?p=user/pwith/empathy;a=shortlog;h=refs/heads/637151-hide-user Attempt #2. This depends on bug #640901, which adds some required API to libfolks-telepathy. This approach continues to store user individuals (and personas) which aren't in the contact list in EmpathyIndividualStore and EmpathyPersonaStore, but modifies the filtering which takes place whenever an individual or persona is displayed. The filtering has been factored out into empathy_folks_persona_is_interesting(), which is now called instead of just TPF_IS_PERSONA() to perform filtering in various places. This seems to work fairly well, and is fairly efficient.
Created attachment 179603 [details] [review] Hide the user individual from the contact list (updated) Whoops, missed a few TPF_IS_PERSONA() calls in the previous commit.
Review of attachment 179603 [details] [review]: Cool, just a small cosmectic change. Feel free to merge once folks has been released. Don't forget to bump the dep. :) ::: libempathy/empathy-utils.c @@ +860,3 @@ + /* We're not interested in user personas which haven't been added to the + * contact list (see bgo#637151). */ + if (folks_persona_get_is_user (persona) == TRUE && not need to explicitly check == TRUE or == FALSE.
The fix for bug #640901 has now been pushed, so as soon as we make a 0.3.5 release, this can be committed. I've pushed an updated branch with the change mentioned in comment #7 fixed, and with the whole thing rebased against today's master: http://git.collabora.co.uk/?p=user/pwith/empathy;a=shortlog;h=refs/heads/637151-hide-user-rebase1
Created attachment 180868 [details] [review] Hide the user individual from the contact list (updated again) http://git.collabora.co.uk/?p=user/pwith/empathy;a=shortlog;h=refs/heads/637151-hide-user-rebase2 Updated again, now including a bump of the libfolks dependency to 0.3.5. Rebased against today's master.
Review of attachment 180868 [details] [review]: ++; 2.34 and master please.
Pushed to master: commit 753a1862257d4c14fb2475a73ec08aeabdb7d907 Author: Philip Withnall <philip.withnall@collabora.co.uk> Date: Sat Jan 29 16:16:29 2011 +0000 Bug 637151 — Hide the user Individual from the contact list Generalise the mechanism used to determine whether a persona is to be displayed by Empathy to also take into account whether the persona is the user and, if so, whether they're in the contact list. This bumps the libfolks dependency to 0.3.5. Closes: bgo#637151 configure.ac | 2 +- .../empathy-individual-information-dialog.c | 2 +- libempathy-gtk/empathy-individual-menu.c | 8 +++--- libempathy-gtk/empathy-individual-store.c | 4 +- libempathy-gtk/empathy-individual-view.c | 21 +++++++++++++++--- libempathy-gtk/empathy-individual-widget.c | 20 +++++++++--------- libempathy-gtk/empathy-linking-dialog.c | 2 +- libempathy/empathy-contact.c | 4 +- libempathy/empathy-utils.c | 22 ++++++++++++++++++- libempathy/empathy-utils.h | 1 + 10 files changed, 59 insertions(+), 27 deletions(-) Pushed to gnome-2-34: commit 7365b5426c1e281f49bd67506c09ce76ffb67e2c Author: Philip Withnall <philip.withnall@collabora.co.uk> Date: Sat Jan 29 16:16:29 2011 +0000 Bug 637151 — Hide the user Individual from the contact list Generalise the mechanism used to determine whether a persona is to be displayed by Empathy to also take into account whether the persona is the user and, if so, whether they're in the contact list. This bumps the libfolks dependency to 0.3.5. Closes: bgo#637151 configure.ac | 2 +- libempathy-gtk/empathy-individual-dialogs.c | 2 +- .../empathy-individual-information-dialog.c | 2 +- libempathy-gtk/empathy-individual-menu.c | 8 +++--- libempathy-gtk/empathy-individual-store.c | 4 +- libempathy-gtk/empathy-individual-view.c | 19 ++++++++++++++-- libempathy-gtk/empathy-individual-widget.c | 20 +++++++++--------- libempathy-gtk/empathy-linking-dialog.c | 2 +- libempathy/empathy-contact.c | 4 +- libempathy/empathy-utils.c | 22 ++++++++++++++++++- libempathy/empathy-utils.h | 1 + 11 files changed, 59 insertions(+), 27 deletions(-)