diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-04-27 06:52:20 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-06-09 19:34:55 +0800 |
commit | baf7517f523381054f85810f0b2d4e20fe05e491 (patch) | |
tree | e90506e19eb479c3bb84c80ad28e5e8f0c595789 /libempathy-gtk | |
parent | 7c9bdd521147ee2f11c3f88de8f1c17c83fc2508 (diff) | |
download | gsoc2013-empathy-baf7517f523381054f85810f0b2d4e20fe05e491.tar gsoc2013-empathy-baf7517f523381054f85810f0b2d4e20fe05e491.tar.gz gsoc2013-empathy-baf7517f523381054f85810f0b2d4e20fe05e491.tar.bz2 gsoc2013-empathy-baf7517f523381054f85810f0b2d4e20fe05e491.tar.lz gsoc2013-empathy-baf7517f523381054f85810f0b2d4e20fe05e491.tar.xz gsoc2013-empathy-baf7517f523381054f85810f0b2d4e20fe05e491.tar.zst gsoc2013-empathy-baf7517f523381054f85810f0b2d4e20fe05e491.zip |
LogWindow: group MUC events properly
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index e786f164d..01155b892 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -555,6 +555,34 @@ entity_equal (TplEntity *a, tpl_entity_get_identifier (b)); } +static gboolean +is_same_confroom (TplEvent *e1, + TplEvent *e2) +{ + TplEntity *sender1 = tpl_event_get_sender (e1); + TplEntity *receiver1 = tpl_event_get_receiver (e1); + TplEntity *sender2 = tpl_event_get_sender (e2); + TplEntity *receiver2 = tpl_event_get_receiver (e2); + TplEntity *room1, *room2; + + if (tpl_entity_get_entity_type (sender1) == TPL_ENTITY_ROOM) + room1 = sender1; + else if (tpl_entity_get_entity_type (receiver1) == TPL_ENTITY_ROOM) + room1 = receiver1; + else + return FALSE; + + if (tpl_entity_get_entity_type (sender2) == TPL_ENTITY_ROOM) + room2 = sender2; + else if (tpl_entity_get_entity_type (receiver2) == TPL_ENTITY_ROOM) + room2 = receiver2; + else + return FALSE; + + return g_str_equal (tpl_entity_get_identifier (room1), + tpl_entity_get_identifier (room1)); +} + static TplEntity * event_get_target (TplEvent *event) { @@ -596,7 +624,8 @@ model_is_parent (GtkTreeModel *model, if (is_toplevel && G_OBJECT_TYPE (event) == G_OBJECT_TYPE (stored_event) && account_equal (account, tpl_event_get_account (event)) && - entity_equal (target, event_get_target (event))) + (entity_equal (target, event_get_target (event)) || + is_same_confroom (event, stored_event))) { gtk_tree_model_iter_nth_child (model, &child, iter, gtk_tree_model_iter_n_children (model, iter) - 1); |