aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-theme-boxes.c
diff options
context:
space:
mode:
authorFelix Kaser <f.kaser@gmx.net>2010-04-07 19:19:08 +0800
committerFelix Kaser <f.kaser@gmx.net>2010-04-08 19:24:40 +0800
commit77fd33616f44a907342651a5a2d7e326ad5ccf55 (patch)
tree3cb092e8b291d166a0044325f409f11f687ed6d6 /libempathy-gtk/empathy-theme-boxes.c
parentc92e1b6631677972dbd25b1164d00ea983340fee (diff)
downloadgsoc2013-empathy-77fd33616f44a907342651a5a2d7e326ad5ccf55.tar
gsoc2013-empathy-77fd33616f44a907342651a5a2d7e326ad5ccf55.tar.gz
gsoc2013-empathy-77fd33616f44a907342651a5a2d7e326ad5ccf55.tar.bz2
gsoc2013-empathy-77fd33616f44a907342651a5a2d7e326ad5ccf55.tar.lz
gsoc2013-empathy-77fd33616f44a907342651a5a2d7e326ad5ccf55.tar.xz
gsoc2013-empathy-77fd33616f44a907342651a5a2d7e326ad5ccf55.tar.zst
gsoc2013-empathy-77fd33616f44a907342651a5a2d7e326ad5ccf55.zip
group messages only if the delay is short
messages from the same sender should not be grouped when the delay between two messages is too long (5min). fixes bug #604475
Diffstat (limited to 'libempathy-gtk/empathy-theme-boxes.c')
-rw-r--r--libempathy-gtk/empathy-theme-boxes.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-theme-boxes.c b/libempathy-gtk/empathy-theme-boxes.c
index e6a606de1..3a600a81d 100644
--- a/libempathy-gtk/empathy-theme-boxes.c
+++ b/libempathy-gtk/empathy-theme-boxes.c
@@ -41,6 +41,9 @@
#define MARGIN 4
#define HEADER_PADDING 2
+/* "Join" consecutive messages with timestamps within five minutes */
+#define MESSAGE_JOIN_PERIOD 5*60
+
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyThemeBoxes)
typedef struct {
gboolean show_avatars;
@@ -200,18 +203,23 @@ theme_boxes_maybe_append_header (EmpathyThemeBoxes *theme,
GtkTextTagTable *table;
GtkTextTag *tag;
GString *str_obj;
+ gboolean consecutive;
contact = empathy_message_get_sender (msg);
name = empathy_contact_get_name (contact);
last_contact = empathy_chat_text_view_get_last_contact (view);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (theme));
+ time_ = empathy_message_get_timestamp (msg);
+ consecutive = (time_ - empathy_chat_text_view_get_last_timestamp (view)
+ < MESSAGE_JOIN_PERIOD);
DEBUG ("Maybe add fancy header");
- /* Only insert a header if the previously inserted block is not the same
- * as this one.
+ /* Only insert a header if
+ * - the previously inserted block is not the same as this one.
+ * - the delay between two messages is lower then MESSAGE_JOIN_PERIOD
*/
- if (empathy_contact_equal (last_contact, contact)) {
+ if (empathy_contact_equal (last_contact, contact) && consecutive) {
return;
}
@@ -259,7 +267,6 @@ theme_boxes_maybe_append_header (EmpathyThemeBoxes *theme,
g_free (str);
/* Add the message receive time */
- time_ = empathy_message_get_timestamp (msg);
tmp = empathy_time_to_string_local (time_,
EMPATHY_TIME_FORMAT_DISPLAY_SHORT);
str = g_strdup_printf ("<i>%s</i>", tmp);