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 653116 - Display aliases in the Who column
Display aliases in the Who column
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Archives
3.1.x
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
Depends on:
Blocks:
 
 
Reported: 2011-06-21 16:56 UTC by Emilio Pozuelo Monfort
Modified: 2011-07-04 16:54 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Emilio Pozuelo Monfort 2011-06-21 16:56:05 UTC
The current code displays aliases in the Who column, but it doesn't work because it uses the aliases of the TplEntities, but _get_entities() returns entities with no alias set (since it doesn't parse the files).

So we need to convert the entities to EmpathyContacts, but empathy_contact_from_tpl_contact() overrides the contact alias with that from the TplEntity, and we don't want that here.

One option is to stop overriding the alias (which is probably wrong since it overrides it for everyone else using the same EmpathyContact). Then whoever wants to use the entity's alias can do so. I've briefly looked at the code and the only user of empathy_contact_from_tpl_contact() that would be affected is empathy_message_from_tpl_log_event(), which is used by the log window and by empathy-chat's backlog. For empathy-chat, it changes the way backlog is displayed to show the current alias of the contact, and not the one the logger has. E.g. if I open a chat with Jonny with current Empathy I get:

jonny.lamb@...: hello!

Which is the alias the logger has. But with a patched one I get:

Jonny Lamb: hello!

Which is Jonny's current alias.

This sounds like a good change to me.

The change in the history window is that instead of

Chat with jonny.lamb@...

We get

Chat with Jonny Lamb
jonny.lamb@...: Hello!

Which sounds fine too, because
a) We keep using the alias the user had when writing the message (so we could have something like "somebody: hello"; "s0m3b0dy: hey I have just changed my nick!")
b) We show the current alias for the contact in the summary (Chat / Call / whatever with $someone).

If those changes sound fine, I propose to apply my patches (branch following soon)
Comment 2 Nicolas Dufresne (ndufresne) 2011-06-21 17:19:07 UTC
Actually, in the case of backlog, we want the original alias to be displayed, this patch will break it.

My suggestion is to keep the code, but only do the alias replacement if the TplEntity::alias is not equal to the TplEntity::id:

if (strcmp(tpl_entity_get_identifier (entity), tpl_entity_get_alias (entity))
  {
    priv->alias = ...
  }
Comment 3 Emilio Pozuelo Monfort 2011-06-22 07:49:36 UTC
(In reply to comment #2)
> Actually, in the case of backlog, we want the original alias to be displayed,
> this patch will break it.
> 
> My suggestion is to keep the code, but only do the alias replacement if the
> TplEntity::alias is not equal to the TplEntity::id:
> 
> if (strcmp(tpl_entity_get_identifier (entity), tpl_entity_get_alias (entity))
>   {
>     priv->alias = ...
>   }

That would still break it in some cases, e.g. in my example above where Jonny's alias when we had that conversation was jonny.lamb@..., so the logger has id == alias. So with this patch, alias isn't overriden and thus my backlog gets "Jonny Lamb" instead of "jonny.lamb@...".

The only way I can think of solving this in all cases is to add another property to the EmpathyContact, "logger-alias" or something, and never override "alias". Then empathy-chat just needs to get "logger-alias" for the backlog. How does that sound?
Comment 4 Emilio Pozuelo Monfort 2011-06-22 09:20:43 UTC
http://cgit.collabora.com/git/user/pochu/empathy.git/log/?h=history-alias-653116 only changes the alias conditionally, but has the problem I've mentioned in comment #3.

http://cgit.collabora.com/git/user/pochu/empathy.git/log/?h=history-alias-653116-take-2 uses the logged-alias approach, but it's a bit ugly... It also would need to change the irc theme I guess, but I don't use that so I couldn't test it...
Comment 5 Nicolas Dufresne (ndufresne) 2011-06-22 14:06:30 UTC
I think the take-2 uses better rational, as we don't use a side effect to get the right thing displayed.

So I'd say ++ take 2.
Comment 6 Emilio Pozuelo Monfort 2011-06-23 08:48:14 UTC
I have rebased history-alias-653116-take-2 on top of master, amended two commits that didn't make sense to be splitted, and modified (and tested) the irc theme accordingly.

http://cgit.collabora.com/git/user/pochu/empathy.git/log/?h=history-alias-653116-take-2
Comment 7 Nicolas Dufresne (ndufresne) 2011-06-23 13:39:25 UTC
> + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

Logged alias shall be construct only

The rest looks good.
Comment 8 Emilio Pozuelo Monfort 2011-07-04 16:54:08 UTC
Fixed in master