diff options
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index b01cabed5..eaeab9d12 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -605,13 +605,25 @@ model_is_parent (GtkTreeModel *model, } static const gchar * -get_contact_alias_for_message (EmpathyMessage *message) +get_contact_alias_for_message (EmpathyMessage *message, + TplEvent *event) { EmpathyContact *sender, *receiver; + TplEntity *ent_sender, *ent_receiver; sender = empathy_message_get_sender (message); receiver = empathy_message_get_receiver (message); + ent_sender = tpl_event_get_sender (event); + ent_receiver = tpl_event_get_receiver (event); + + /* If this is a MUC, we want to show "Chat with <room>". */ + if (tpl_entity_get_entity_type (ent_sender) == TPL_ENTITY_ROOM) + return tpl_entity_get_alias (ent_sender); + if (ent_receiver && + tpl_entity_get_entity_type (ent_receiver) == TPL_ENTITY_ROOM) + return tpl_entity_get_alias (ent_receiver); + if (empathy_contact_is_user (sender)) return empathy_contact_get_alias (receiver); @@ -656,7 +668,7 @@ get_parent_iter_for_message (TplEvent *event, C_("A date with the time", "%A, %e %B %Y %X")); body = g_markup_printf_escaped (_("Chat with %s"), - get_contact_alias_for_message (message)); + get_contact_alias_for_message (message, event)); gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_set (store, &iter, |