After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 627402 - Support marking FolksPersonas as "me"
Support marking FolksPersonas as "me"
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: libfolks
git master
Other Linux
: Normal enhancement
: gnome-3.0
Assigned To: folks-maint
folks-maint
Depends on: 626725
Blocks:
 
 
Reported: 2010-08-19 18:12 UTC by Philip Withnall
Modified: 2010-09-21 09:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Squashed diff of the 627402-is-user branch (14.03 KB, patch)
2010-08-23 16:45 UTC, Philip Withnall
needs-work Details | Review
Squashed diff of the 627402-is-user-rebase1 branch (15.69 KB, patch)
2010-08-31 15:21 UTC, Philip Withnall
needs-work Details | Review
Squashed diff of the 627402-is-user-attempt2 branch (16.28 KB, patch)
2010-09-06 14:55 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2010-08-19 18:12:34 UTC
libfolks needs to have some way of indicating that an Individual and its Personas are the user, since various things should be handled differently for them (such as setting aliases). The user's Individual should probably also be shown differently in UIs.
Comment 1 Philip Withnall 2010-08-23 16:45:18 UTC
Created attachment 168567 [details] [review]
Squashed diff of the 627402-is-user branch

http://git.collabora.co.uk/?p=user/pwith/folks;a=shortlog;h=refs/heads/627402-is-user

Note that this branch is based on http://git.collabora.co.uk/?p=user/pwith/folks;a=shortlog;h=refs/heads/626725-personas-changed, since it makes some changes to the IndividualAggregator.
Comment 2 Travis Reitter 2010-08-27 16:54:30 UTC
Review of attachment 168567 [details] [review]:

IndividualAggregator.link_personas() needs to use a foreach(...) for iterating the personas list. Currently the lambda function tries to throw an error, which is invalid (since the lambda's type doesn't throw an error).

Other than that, the code looks fine, but I hit a number of bogus favorites warnings when running Empathy on top of this; eg,

TelepathyBackend-WARNING **: tpf-persona-store.vala:260: unknown persona 'user4@localhost' in favourites list

(it's normally a valid favorite).
Comment 3 Philip Withnall 2010-08-31 15:21:56 UTC
Created attachment 169170 [details] [review]
Squashed diff of the 627402-is-user-rebase1 branch

http://git.collabora.co.uk/?p=user/pwith/folks;a=shortlog;h=refs/heads/627402-is-user-rebase1
Comment 4 Travis Reitter 2010-09-03 15:20:10 UTC
Review of attachment 169170 [details] [review]:

It looks like Tpf.PersonaStore.self_contact isn't defined:

tpf-persona-store.vala:263.17-263.33: error: The name `self_contact' does not exist in the context of `Tpf.PersonaStore'
               (this.self_contact != null && this.handle_persona_map.size > 1)))
Comment 5 Travis Reitter 2010-09-03 15:28:57 UTC
Review of attachment 169170 [details] [review]:

Disregard previous review; acquire ++
Comment 6 Travis Reitter 2010-09-03 18:49:55 UTC
Review of attachment 169170 [details] [review]:

Actually, I used the branch a little longer and hit this:
==================================

Core:ERROR:individual.c:1390:_folks_individual_set_personas: assertion failed: (folks_persona_get_is_user (p) == self->priv->_is_user)
[Thread 0x7fffe60e1710 (LWP 16835) exited]
[Thread 0x7fffe4cd1710 (LWP 16837) exited]

Program received signal SIGABRT, Aborted.
0x00007fffed011175 in *__GI_raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64	../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
	in ../nptl/sysdeps/unix/sysv/linux/raise.c
(gdb) bt
  • #0 *__GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #1 *__GI_abort
    at abort.c line 92
  • #2 g_assertion_message
  • #3 g_assertion_message_expr
    at gtestutils.c line 1369
  • #4 _folks_individual_set_personas
    at individual.c line 1390
  • #5 folks_individual_set_personas
    at individual.c line 1790
  • #6 folks_individual_construct
    at individual.c line 633
  • #7 _lambda16_
    at individual-aggregator.c line 1150
  • #8 __lambda16__gfunc
    at individual-aggregator.c line 1167
  • #9 g_list_foreach
    at glist.c line 917
  • #10 folks_individual_aggregator_add_personas
    at individual-aggregator.c line 1194
  • #11 folks_individual_aggregator_personas_changed_cb
    at individual-aggregator.c line 1309
  • #12 _folks_individual_aggregator_personas_changed_cb_folks_persona_store_personas_changed
    at individual-aggregator.c line 736
  • #13 g_cclosure_user_marshal_VOID__POINTER_POINTER_STRING_OBJECT_ENUM
    at persona-store.c line 450
  • #14 g_closure_invoke
    at gclosure.c line 766
  • #15 signal_emit_unlocked_R
    at gsignal.c line 3252
  • #16 g_signal_emit_valist
    at gsignal.c line 2983
  • #17 g_signal_emit_by_name
    at gsignal.c line 3077
  • #18 tpf_persona_store_add_new_personas_from_contacts
    at tpf-persona-store.c line 2671
  • #19 tpf_persona_store_create_personas_from_channel_handles_async_co
    at tpf-persona-store.c line 2319
  • #20 get_contacts_by_handle_cb
    at tp-lowlevel.c line 153
  • #21 contacts_context_continue
    at contact.c line 1298
  • #22 contacts_got_attributes
    at contact.c line 3011
  • #23 connection_got_contact_attributes
    at connection-handles.c line 730
  • #24 _tp_cli_connection_interface_contacts_invoke_callback_get_contact_attributes
    at _gen/tp-cli-connection-body.h line 7702
  • #25 tp_proxy_pending_call_idle_invoke
    at proxy-methods.c line 153
  • #26 g_main_dispatch
    at gmain.c line 2119
  • #27 g_main_context_dispatch
    at gmain.c line 2672
  • #28 g_main_context_iterate
    at gmain.c line 2750
  • #29 g_main_loop_run
    at gmain.c line 2958
  • #30 IA__gtk_main
    at gtkmain.c line 1237
  • #31 main
    at empathy.c line 548

Comment 7 Philip Withnall 2010-09-06 14:55:52 UTC
Created attachment 169580 [details] [review]
Squashed diff of the 627402-is-user-attempt2 branch

http://git.collabora.co.uk/?p=user/pwith/folks;a=shortlog;h=refs/heads/627402-is-user-attempt2

This second attempt changes the guarantees provided by the branch slightly. Previously, the branch was only allowing Personas with Persona.is_user == Individual.is_user to link to a given Individual. This resulted in all the contacts for user accounts being linked together, but not (for example) being linked to contacts for each account as added to another account.

The branch now takes the approach that Personas with Persona.is_user == true are still explicitly linked to IndividualAggregator.user, but there's nothing preventing other Personas from being linked to this Individual (either by the user adding links, or implicitly due to sharing an e-mail address or something).

The quirk with this approach is that the user's link-local XMPP contact will now be linked, which is fine from a security point of view, but doesn't quite fit in with the policy that link-local XMPP accounts aren't linked at all. I don't think this is a problem though, since Empathy will most likely hide the Individual with Individual.is_user == true.

However, that introduces a different problem: if the Individual with Individual.is_user == true is hidden, people will no longer be able to add themselves as contacts (e.g. on a different account) and talk to themselves (they won't show up in their own contact list, because the contact will be implicitly linked with IndividualAggregator.user and subsequently hidden). I'm not sure this is much to be concerned about.
Comment 8 Philip Withnall 2010-09-06 15:30:35 UTC
(In reply to comment #7)
> However, that introduces a different problem: if the Individual with
> Individual.is_user == true is hidden, people will no longer be able to add
> themselves as contacts (e.g. on a different account) and talk to themselves
> (they won't show up in their own contact list, because the contact will be
> implicitly linked with IndividualAggregator.user and subsequently hidden). I'm
> not sure this is much to be concerned about.

After some discussion on IRC, this is something to be concerned about, since quite a few people use this “feature” to send themselves files, or test things. A fairly simple solution which shouldn't complicate Empathy's code too much is just to filter out all Personas where Persona.is_user == true from Empathy (probably in the EmpathyIndividualManager). In the case that this filters out all Personas from an Individual, the Individual is ignored. This should happen without any extra work, as we already do this for Individuals which (e.g.) only contain a Kf.Persona.
Comment 9 Philip Withnall 2010-09-13 13:54:42 UTC
(Mass changing milestones; please search for this phrase to delete the bug spam.)
Comment 10 Travis Reitter 2010-09-20 17:06:02 UTC
Review of attachment 169580 [details] [review]:

Second patch, in tpf-persona-store.vala:

+              ((this.self_contact == null &&

this.self_contact isn't defined at this point, so it looks like this was a slightly skewed re-base. Not worth fixing, just noting.

In the final patch,

+                  warning ("Failed to create persona from contact '%s' (%p)",

It'd be nice to make this "Failed to create self persona[...]" to make it a distinct warning.

+   * @since 0.1.17

There are several of these throughout; they should be changed to @since 0.3.0.

After those changes, please merge.
Comment 11 Philip Withnall 2010-09-21 09:22:55 UTC
commit 95a282dc35afcaea7534bde0fff2831d25957f83
Author: Philip Withnall <philip.withnall@collabora.co.uk>
Date:   Mon Aug 23 17:26:35 2010 +0100

    Support the Persona.is_user property in the telepathy backend
    
    Closes: bgo#627402

 NEWS                                          |    3 +
 backends/telepathy/lib/tpf-persona-store.vala |   72 ++++++++++++++++++++++++-
 backends/telepathy/lib/tpf-persona.vala       |    6 ++-
 folks/persona-store.vala                      |    8 +++
 4 files changed, 86 insertions(+), 3 deletions(-)

commit 0457ec58cc8ee691ed3ed568a147af4a3a83a294
Author: Philip Withnall <philip.withnall@collabora.co.uk>
Date:   Mon Aug 23 17:26:18 2010 +0100

    Support the Persona.is_user property in the key-file backend
    
    Helps: bgo#627402

 backends/key-file/kf-persona.vala |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

commit 61322635e38d64130d7333ab366aa5e32a4c73a8
Author: Philip Withnall <philip.withnall@collabora.co.uk>
Date:   Mon Sep 6 13:49:31 2010 +0100

    Implicitly trust Personas which are marked as being the user
    
    We assume that the backend is in complete control of its user accounts, so
    we can fully trust Personas which have Persona.is_user == true.
    Helps: bgo#627402

 folks/individual.vala |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

commit 24732788143198877b528dcf06f147a77ee2b7e7
Author: Philip Withnall <philip.withnall@collabora.co.uk>
Date:   Mon Aug 23 16:31:49 2010 +0100

    Add a "user" property to the IndividualAggregator
    
    This contains the Individual representing the user who owns all the relevant
    accounts in each backend. This also changes the linking code so that Personas
    with is_user == true are always linked, and only ever linked to other Personas
    with is_user == true (i.e. Personas are always linked to Personas with like
    is_user values). This ensures that there's only ever one Individual with
    is_user == true. Helps: bgo#627402

 NEWS                                          |    1 +
 backends/telepathy/lib/tpf-persona-store.vala |   10 ++++++-
 folks/individual-aggregator.vala              |   34 +++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 2 deletions(-)

commit a124e5c7cfffd3896e51f708d52eb0a16f795d7a
Author: Philip Withnall <philip.withnall@collabora.co.uk>
Date:   Mon Aug 23 16:11:08 2010 +0100

    Add an "is-user" property to Individual and Persona
    
    This is true iff the Individual or Persona is the owner of the relevant
    accounts. Helps: bgo#627402

 NEWS                  |    2 ++
 folks/individual.vala |   41 +++++++++++++++++++++++++++++++++++++++++
 folks/persona.vala    |   10 ++++++++++
 3 files changed, 53 insertions(+), 0 deletions(-)

commit 78d808e6771cd2395bca6aa47c3b2f28391e129b
Author: Philip Withnall <philip.withnall@collabora.co.uk>
Date:   Tue Aug 31 15:19:31 2010 +0100

    Use foreach{} rather than .foreach() in IndividualAggregator.link_personas()

 folks/individual-aggregator.vala |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)