aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 372e90cf0..d9a72d3e9 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -93,6 +93,8 @@ typedef struct {
GtkWidget *label_topic;
GtkWidget *contact_list_view;
GtkWidget *info_bar_vbox;
+
+ guint unread_messages;
} EmpathyChatPriv;
typedef struct {
@@ -1074,6 +1076,7 @@ chat_message_received (EmpathyChat *chat, EmpathyMessage *message)
TP_CHANNEL_CHAT_STATE_ACTIVE,
chat);
+ priv->unread_messages++;
g_signal_emit (chat, signals[NEW_MESSAGE], 0, message);
}
@@ -2801,3 +2804,23 @@ empathy_chat_is_room (EmpathyChat *chat)
return (priv->handle_type == TP_HANDLE_TYPE_ROOM);
}
+guint
+empathy_chat_get_nb_unread_messages (EmpathyChat *self)
+{
+ EmpathyChatPriv *priv = GET_PRIV (self);
+
+ g_return_val_if_fail (EMPATHY_IS_CHAT (self), FALSE);
+
+ return priv->unread_messages;
+}
+
+/* called when the messages have been read by user */
+void
+empathy_chat_messages_read (EmpathyChat *self)
+{
+ EmpathyChatPriv *priv = GET_PRIV (self);
+
+ g_return_if_fail (EMPATHY_IS_CHAT (self));
+
+ priv->unread_messages = 0;
+}