From ccc394aa7971cac1530931357dae7aaf14299ef2 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Thu, 12 May 2011 14:29:23 +0100 Subject: message: store the TpMessage when created with one Signed-off-by: Jonny Lamb --- libempathy/empathy-message.c | 34 ++++++++++++++++++++++++++++++++++ libempathy/empathy-message.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c index 076a10053..64977e007 100644 --- a/libempathy/empathy-message.c +++ b/libempathy/empathy-message.c @@ -40,6 +40,7 @@ #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyMessage) typedef struct { + TpMessage *tp_message; TpChannelTextMessageType type; EmpathyContact *sender; EmpathyContact *receiver; @@ -73,6 +74,7 @@ enum { PROP_IS_BACKLOG, PROP_INCOMING, PROP_FLAGS, + PROP_TP_MESSAGE, }; static void @@ -153,6 +155,15 @@ empathy_message_class_init (EmpathyMessageClass *class) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, + PROP_TP_MESSAGE, + g_param_spec_object ("tp-message", + "TpMessage", + "The TpMessage of this message", + TP_TYPE_MESSAGE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | + G_PARAM_CONSTRUCT_ONLY)); + g_type_class_add_private (object_class, sizeof (EmpathyMessagePriv)); } @@ -181,6 +192,10 @@ empathy_message_finalize (GObject *object) g_object_unref (priv->receiver); } + if (priv->tp_message) { + g_object_unref (priv->tp_message); + } + g_free (priv->body); G_OBJECT_CLASS (empathy_message_parent_class)->finalize (object); @@ -221,6 +236,9 @@ message_get_property (GObject *object, case PROP_FLAGS: g_value_set_uint (value, priv->flags); break; + case PROP_TP_MESSAGE: + g_value_set_object (value, priv->tp_message); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; @@ -267,6 +285,9 @@ message_set_property (GObject *object, case PROP_FLAGS: priv->flags = g_value_get_uint (value); break; + case PROP_TP_MESSAGE: + priv->tp_message = g_value_dup_object (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; @@ -342,6 +363,18 @@ empathy_message_from_tpl_log_event (TplEvent *logevent) return retval; } +TpMessage * +empathy_message_get_tp_message (EmpathyMessage *message) +{ + EmpathyMessagePriv *priv; + + g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), NULL); + + priv = GET_PRIV (message); + + return priv->tp_message; +} + TpChannelTextMessageType empathy_message_get_tptype (EmpathyMessage *message) { @@ -634,6 +667,7 @@ empathy_message_new_from_tp_message (TpMessage *tp_msg, "flags", flags, "is-backlog", flags & TP_CHANNEL_TEXT_MESSAGE_FLAG_SCROLLBACK, "incoming", incoming, + "tp-message", tp_msg, NULL); priv = GET_PRIV (message); diff --git a/libempathy/empathy-message.h b/libempathy/empathy-message.h index 7508cb08e..52e45b6e2 100644 --- a/libempathy/empathy-message.h +++ b/libempathy/empathy-message.h @@ -59,6 +59,8 @@ EmpathyMessage * empathy_message_from_tpl_log_event (TplEvent EmpathyMessage * empathy_message_new_from_tp_message (TpMessage *tp_msg, gboolean incoming); +TpMessage * empathy_message_get_tp_message (EmpathyMessage *message); + TpChannelTextMessageType empathy_message_get_tptype (EmpathyMessage *message); EmpathyContact * empathy_message_get_sender (EmpathyMessage *message); void empathy_message_set_sender (EmpathyMessage *message, -- cgit v1.2.3 From cc5faf8b763d3b1ee5eb4a13525875707bb71217 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Thu, 12 May 2011 14:32:18 +0100 Subject: tp-chat: acknowledge messages using TpTextChannel API Signed-off-by: Jonny Lamb --- libempathy/empathy-tp-chat.c | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 72c6bebf0..e0ffe8e82 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -93,7 +93,7 @@ G_DEFINE_TYPE_WITH_CODE (EmpathyTpChat, empathy_tp_chat, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (EMPATHY_TYPE_CONTACT_LIST, tp_chat_iface_init)); -static void acknowledge_messages (EmpathyTpChat *chat, GArray *ids); +static void acknowledge_messages (EmpathyTpChat *chat, const GList *messages); static void tp_chat_set_delivery_status (EmpathyTpChat *self, @@ -1794,21 +1794,21 @@ empathy_tp_chat_get_pending_messages (EmpathyTpChat *chat) } static void -acknowledge_messages (EmpathyTpChat *chat, GArray *ids) { +acknowledge_messages (EmpathyTpChat *chat, + const GList *messages) { EmpathyTpChatPriv *priv = GET_PRIV (chat); - tp_cli_channel_type_text_call_acknowledge_pending_messages ( - priv->channel, -1, ids, tp_chat_async_cb, - "acknowledging received message", NULL, G_OBJECT (chat)); + tp_text_channel_ack_messages_async (TP_TEXT_CHANNEL (priv->channel), + messages, NULL, NULL); } void empathy_tp_chat_acknowledge_message (EmpathyTpChat *chat, EmpathyMessage *message) { EmpathyTpChatPriv *priv = GET_PRIV (chat); - GArray *message_ids; + GList *messages = NULL; GList *m; - guint id; + TpMessage *tp_msg; g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); g_return_if_fail (priv->ready); @@ -1816,12 +1816,10 @@ empathy_tp_chat_acknowledge_message (EmpathyTpChat *chat, if (!empathy_message_is_incoming (message)) goto out; - message_ids = g_array_sized_new (FALSE, FALSE, sizeof (guint), 1); - - id = empathy_message_get_id (message); - g_array_append_val (message_ids, id); - acknowledge_messages (chat, message_ids); - g_array_free (message_ids, TRUE); + tp_msg = empathy_message_get_tp_message (message); + messages = g_list_append (messages, tp_msg); + acknowledge_messages (chat, messages); + g_list_free (messages); out: m = g_queue_find (priv->pending_messages_queue, message); @@ -1837,19 +1835,14 @@ empathy_tp_chat_acknowledge_messages (EmpathyTpChat *chat, /* Copy messages as the messges list (probably is) our own */ GSList *msgs = g_slist_copy ((GSList *) messages); GSList *l; - guint length; - GArray *message_ids; + GList *messages_to_ack = NULL; g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); g_return_if_fail (priv->ready); - length = g_slist_length ((GSList *) messages); - - if (length == 0) + if (messages == NULL) return; - message_ids = g_array_sized_new (FALSE, FALSE, sizeof (guint), length); - for (l = msgs; l != NULL; l = g_slist_next (l)) { GList *m; @@ -1860,16 +1853,16 @@ empathy_tp_chat_acknowledge_messages (EmpathyTpChat *chat, g_queue_delete_link (priv->pending_messages_queue, m); if (empathy_message_is_incoming (message)) { - guint id = empathy_message_get_id (message); - g_array_append_val (message_ids, id); + TpMessage *tp_msg = empathy_message_get_tp_message (message); + messages_to_ack = g_list_append (messages_to_ack, tp_msg); } g_object_unref (message); } - if (message_ids->len > 0) - acknowledge_messages (chat, message_ids); + if (messages_to_ack != NULL) + acknowledge_messages (chat, messages_to_ack); - g_array_free (message_ids, TRUE); + g_list_free (messages_to_ack); g_slist_free (msgs); } -- cgit v1.2.3 From 11120f662d911b9a50aff7ba46804bcc7c587492 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Thu, 12 May 2011 14:33:16 +0100 Subject: message: stop storing pending-message-id We're storing the TpSignalledMessage for that nowadays. Signed-off-by: Jonny Lamb --- libempathy/empathy-message.c | 21 --------------------- libempathy/empathy-message.h | 2 -- 2 files changed, 23 deletions(-) diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c index 64977e007..25ec498ce 100644 --- a/libempathy/empathy-message.c +++ b/libempathy/empathy-message.c @@ -596,16 +596,6 @@ empathy_message_type_to_str (TpChannelTextMessageType type) } } -guint -empathy_message_get_id (EmpathyMessage *message) -{ - EmpathyMessagePriv *priv = GET_PRIV (message); - - g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), 0); - - return priv->id; -} - gboolean empathy_message_is_incoming (EmpathyMessage *message) { @@ -651,10 +641,8 @@ empathy_message_new_from_tp_message (TpMessage *tp_msg, gboolean incoming) { EmpathyMessage *message; - EmpathyMessagePriv *priv; gchar *body; TpChannelTextMessageFlags flags; - guint id; g_return_val_if_fail (TP_IS_MESSAGE (tp_msg), NULL); @@ -670,15 +658,6 @@ empathy_message_new_from_tp_message (TpMessage *tp_msg, "tp-message", tp_msg, NULL); - priv = GET_PRIV (message); - - /* FIXME: this is pretty low level, ideally we shouldn't have to use the - * ID directly but we don't use TpTextChannel's ack API everywhere yet. */ - id = tp_asv_get_uint32 (tp_message_peek (tp_msg, 0), - "pending-message-id", NULL); - - priv->id = id; - g_free (body); return message; } diff --git a/libempathy/empathy-message.h b/libempathy/empathy-message.h index 52e45b6e2..b20ceca16 100644 --- a/libempathy/empathy-message.h +++ b/libempathy/empathy-message.h @@ -77,8 +77,6 @@ gboolean empathy_message_should_highlight (EmpathyMessage TpChannelTextMessageType empathy_message_type_from_str (const gchar *type_str); const gchar * empathy_message_type_to_str (TpChannelTextMessageType type); -guint empathy_message_get_id (EmpathyMessage *message); - gboolean empathy_message_equal (EmpathyMessage *message1, EmpathyMessage *message2); TpChannelTextMessageFlags empathy_message_get_flags (EmpathyMessage *message); -- cgit v1.2.3 From 7740933e258c4afe279d08599232e057e1c2d338 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Thu, 12 May 2011 14:56:32 +0100 Subject: tp-chat: use ::pending-message-removed to update our pending queue Signed-off-by: Jonny Lamb --- libempathy/empathy-tp-chat.c | 54 ++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index e0ffe8e82..3d22bc17e 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -453,6 +453,35 @@ message_received_cb (TpTextChannel *channel, handle_incoming_message (chat, message, FALSE); } +static gboolean +find_pending_message_func (gconstpointer a, + gconstpointer b) +{ + EmpathyMessage *msg = (EmpathyMessage *) a; + TpMessage *message = (TpMessage *) b; + + if (empathy_message_get_tp_message (msg) == message) + return 0; + + return -1; +} + +static void +pending_message_removed_cb (TpTextChannel *channel, + TpMessage *message, + EmpathyTpChat *chat) +{ + EmpathyTpChatPriv *priv = GET_PRIV (chat); + GList *m; + + m = g_queue_find_custom (priv->pending_messages_queue, message, + find_pending_message_func); + g_assert (m != NULL); + + g_object_unref (m->data); + g_queue_delete_link (priv->pending_messages_queue, m); +} + static void message_sent_cb (TpTextChannel *channel, TpMessage *message, @@ -911,6 +940,8 @@ check_almost_ready (EmpathyTpChat *chat) tp_g_signal_connect_object (priv->channel, "message-received", G_CALLBACK (message_received_cb), chat, 0); + tp_g_signal_connect_object (priv->channel, "pending-message-removed", + G_CALLBACK (pending_message_removed_cb), chat, 0); list_pending_messages (chat); @@ -1807,34 +1838,25 @@ empathy_tp_chat_acknowledge_message (EmpathyTpChat *chat, EmpathyMessage *message) { EmpathyTpChatPriv *priv = GET_PRIV (chat); GList *messages = NULL; - GList *m; TpMessage *tp_msg; g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); g_return_if_fail (priv->ready); if (!empathy_message_is_incoming (message)) - goto out; + return; tp_msg = empathy_message_get_tp_message (message); messages = g_list_append (messages, tp_msg); acknowledge_messages (chat, messages); g_list_free (messages); - -out: - m = g_queue_find (priv->pending_messages_queue, message); - g_assert (m != NULL); - g_queue_delete_link (priv->pending_messages_queue, m); - g_object_unref (message); } void empathy_tp_chat_acknowledge_messages (EmpathyTpChat *chat, const GSList *messages) { EmpathyTpChatPriv *priv = GET_PRIV (chat); - /* Copy messages as the messges list (probably is) our own */ - GSList *msgs = g_slist_copy ((GSList *) messages); - GSList *l; + const GSList *l; GList *messages_to_ack = NULL; g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); @@ -1843,27 +1865,19 @@ empathy_tp_chat_acknowledge_messages (EmpathyTpChat *chat, if (messages == NULL) return; - for (l = msgs; l != NULL; l = g_slist_next (l)) { - GList *m; - + for (l = messages; l != NULL; l = g_slist_next (l)) { EmpathyMessage *message = EMPATHY_MESSAGE (l->data); - m = g_queue_find (priv->pending_messages_queue, message); - g_assert (m != NULL); - g_queue_delete_link (priv->pending_messages_queue, m); - if (empathy_message_is_incoming (message)) { TpMessage *tp_msg = empathy_message_get_tp_message (message); messages_to_ack = g_list_append (messages_to_ack, tp_msg); } - g_object_unref (message); } if (messages_to_ack != NULL) acknowledge_messages (chat, messages_to_ack); g_list_free (messages_to_ack); - g_slist_free (msgs); } void -- cgit v1.2.3 From 7412b7e93ee7106dc139365fb391e2f613c294ef Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Thu, 12 May 2011 16:24:43 +0100 Subject: tp-chat: add pending-message-removed signal Signed-off-by: Jonny Lamb --- libempathy/empathy-tp-chat.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 3d22bc17e..c83db01a1 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -84,6 +84,7 @@ enum { CHAT_STATE_CHANGED, PROPERTY_CHANGED, DESTROY, + PENDING_MESSAGE_REMOVED, LAST_SIGNAL }; @@ -480,6 +481,8 @@ pending_message_removed_cb (TpTextChannel *channel, g_object_unref (m->data); g_queue_delete_link (priv->pending_messages_queue, m); + + g_signal_emit (chat, signals[PENDING_MESSAGE_REMOVED], 0); } static void @@ -1663,6 +1666,16 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass) G_TYPE_NONE, 0); + signals[PENDING_MESSAGE_REMOVED] = + g_signal_new ("pending-message-removed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + g_type_class_add_private (object_class, sizeof (EmpathyTpChatPriv)); } -- cgit v1.2.3 From d36a313b26e957452fde60cac897791b0f6e4990 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Thu, 12 May 2011 16:47:59 +0100 Subject: chat: make nb_unread_messages incoming only and add a property so it can have change notification. Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-chat.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index b580812ac..019064a16 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -173,6 +173,7 @@ enum { PROP_SHOW_CONTACTS, PROP_SMS_CHANNEL, PROP_N_MESSAGES_SENDING, + PROP_NB_UNREAD_MESSAGES, }; static guint signals[LAST_SIGNAL] = { 0 }; @@ -219,6 +220,10 @@ chat_get_property (GObject *object, g_value_set_uint (value, empathy_chat_get_n_messages_sending (chat)); break; + case PROP_NB_UNREAD_MESSAGES: + g_value_set_uint (value, + empathy_chat_get_nb_unread_messages (chat)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; @@ -1271,7 +1276,10 @@ chat_message_received (EmpathyChat *chat, TP_CHANNEL_CHAT_STATE_ACTIVE, chat); - priv->unread_messages++; + if (empathy_message_is_incoming (message)) { + priv->unread_messages++; + } + g_signal_emit (chat, signals[NEW_MESSAGE], 0, message, pending); } @@ -1283,6 +1291,16 @@ chat_message_received_cb (EmpathyTpChat *tp_chat, chat_message_received (chat, message, FALSE); } +static void +chat_pending_message_removed_cb (EmpathyTpChat *tp_chat, + EmpathyChat *chat) +{ + EmpathyChatPriv *priv = GET_PRIV (chat); + + priv->unread_messages--; + g_object_notify (G_OBJECT (chat), "nb-unread-messages"); +} + static void chat_send_error_cb (EmpathyTpChat *tp_chat, const gchar *message_body, @@ -2871,6 +2889,8 @@ chat_finalize (GObject *object) chat_destroy_cb, chat); g_signal_handlers_disconnect_by_func (priv->tp_chat, chat_message_received_cb, chat); + g_signal_handlers_disconnect_by_func (priv->tp_chat, + chat_pending_message_removed_cb, chat); g_signal_handlers_disconnect_by_func (priv->tp_chat, chat_send_error_cb, chat); g_signal_handlers_disconnect_by_func (priv->tp_chat, @@ -3007,6 +3027,14 @@ empathy_chat_class_init (EmpathyChatClass *klass) 0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, + PROP_NB_UNREAD_MESSAGES, + g_param_spec_uint ("nb-unread-messages", + "Num Unread Messages", + "The number of unread messages", + 0, G_MAXUINT, 0, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + signals[COMPOSING] = g_signal_new ("composing", G_OBJECT_CLASS_TYPE (object_class), @@ -3546,6 +3574,9 @@ empathy_chat_set_tp_chat (EmpathyChat *chat, g_signal_connect (tp_chat, "message-received", G_CALLBACK (chat_message_received_cb), chat); + g_signal_connect (tp_chat, "pending-message-removed", + G_CALLBACK (chat_pending_message_removed_cb), + chat); g_signal_connect (tp_chat, "send-error", G_CALLBACK (chat_send_error_cb), chat); @@ -3876,7 +3907,6 @@ empathy_chat_messages_read (EmpathyChat *self) if (priv->tp_chat != NULL ) { empathy_tp_chat_acknowledge_all_messages (priv->tp_chat); } - priv->unread_messages = 0; empathy_chat_view_focus_toggled (self->view, TRUE); } -- cgit v1.2.3 From 4fd01bccdea76bdb929bae14a31d16327cd0a5aa Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Thu, 12 May 2011 16:49:24 +0100 Subject: chat-window: update tab when nb-unread-messages changes Signed-off-by: Jonny Lamb --- src/empathy-chat-window.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index be83f4a29..b9b2415cc 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -2281,6 +2281,9 @@ empathy_chat_window_add_chat (EmpathyChatWindow *window, g_signal_connect (chat, "notify::n-messages-sending", G_CALLBACK (chat_window_chat_notify_cb), NULL); + g_signal_connect (chat, "notify::nb-unread-messages", + G_CALLBACK (chat_window_chat_notify_cb), + NULL); chat_window_chat_notify_cb (chat); gtk_notebook_append_page_menu (GTK_NOTEBOOK (priv->notebook), child, label, popup_label); -- cgit v1.2.3 From e7afbce3f6925af7f3d43a443304f566a02d4942 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Thu, 12 May 2011 16:49:37 +0100 Subject: chat-window: also update chat window title when the chat updates Signed-off-by: Jonny Lamb --- src/empathy-chat-window.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index b9b2415cc..af94ddc77 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -794,6 +794,7 @@ chat_window_update_chat_tab (EmpathyChat *chat) static void chat_window_chat_notify_cb (EmpathyChat *chat) { + EmpathyChatWindow *window; EmpathyContact *old_remote_contact; EmpathyContact *remote_contact = NULL; @@ -820,6 +821,11 @@ chat_window_chat_notify_cb (EmpathyChat *chat) } chat_window_update_chat_tab (chat); + + window = chat_window_find_chat (chat); + if (window != NULL) { + chat_window_update (window, FALSE); + } } static void -- cgit v1.2.3 From bd0755be84f285e48272fb0b7ac154bad4be0902 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 11:22:22 +0100 Subject: adium: set x-empathy-message-id class in messageStyles Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-theme-adium.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 06410c528..c947c2897 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -638,6 +638,7 @@ theme_adium_append_message (EmpathyChatView *view, EmpathyThemeAdium *theme = EMPATHY_THEME_ADIUM (view); EmpathyThemeAdiumPriv *priv = GET_PRIV (theme); EmpathyContact *sender; + TpMessage *tp_msg; TpAccount *account; gchar *body_escaped; const gchar *body; @@ -759,6 +760,16 @@ theme_adium_append_message (EmpathyChatView *view, * %status% - See %status% in theme_adium_append_html () */ + /* x-empathy-message-id-* */ + tp_msg = empathy_message_get_tp_message (msg); + if (tp_msg != NULL) { + gchar *tmp = tp_escape_as_identifier ( + tp_message_get_token (tp_msg)); + g_string_append_printf (message_classes, + " x-empathy-message-id-%s", tmp); + g_free (tmp); + } + /* Define javascript function to use */ if (consecutive) { func = priv->allow_scrolling ? "appendNextMessage" : "appendNextMessageNoScroll"; -- cgit v1.2.3 From 5080aa2351deb6abe0aa1cc442fd1175f2eaa70e Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 11:25:06 +0100 Subject: adium: split removing unread markers into two functions Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-theme-adium.c | 60 ++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index c947c2897..1a213ff91 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -569,32 +569,10 @@ theme_adium_append_event_escaped (EmpathyChatView *view, } static void -theme_adium_remove_focus_marks (EmpathyThemeAdium *theme) +theme_adium_remove_focus_marks (EmpathyThemeAdium *theme, + WebKitDOMNodeList *nodes) { - EmpathyThemeAdiumPriv *priv = GET_PRIV (theme); - WebKitDOMDocument *dom; - WebKitDOMNodeList *nodes; guint i; - GError *error = NULL; - - if (!priv->has_unread_message) - return; - - priv->has_unread_message = FALSE; - - dom = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (theme)); - if (dom == NULL) { - return; - } - - /* Get all nodes with focus class */ - nodes = webkit_dom_document_query_selector_all (dom, ".focus", &error); - if (nodes == NULL) { - DEBUG ("Error getting focus nodes: %s", - error ? error->message : "No error"); - g_clear_error (&error); - return; - } /* Remove focus and firstFocus class */ for (i = 0; i < webkit_dom_node_list_get_length (nodes); i++) { @@ -631,6 +609,36 @@ theme_adium_remove_focus_marks (EmpathyThemeAdium *theme) } } +static void +theme_adium_remove_all_focus_marks (EmpathyThemeAdium *theme) +{ + EmpathyThemeAdiumPriv *priv = GET_PRIV (theme); + WebKitDOMDocument *dom; + WebKitDOMNodeList *nodes; + GError *error = NULL; + + if (!priv->has_unread_message) + return; + + priv->has_unread_message = FALSE; + + dom = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (theme)); + if (dom == NULL) { + return; + } + + /* Get all nodes with focus class */ + nodes = webkit_dom_document_query_selector_all (dom, ".focus", &error); + if (nodes == NULL) { + DEBUG ("Error getting focus nodes: %s", + error ? error->message : "No error"); + g_clear_error (&error); + return; + } + + theme_adium_remove_focus_marks (theme, nodes); +} + static void theme_adium_append_message (EmpathyChatView *view, EmpathyMessage *msg) @@ -788,7 +796,7 @@ theme_adium_append_message (EmpathyChatView *view, } /* remove all the unread marks when we are sending a message */ - theme_adium_remove_focus_marks (theme); + theme_adium_remove_all_focus_marks (theme); } else { /* in */ if (is_backlog) { @@ -946,7 +954,7 @@ theme_adium_focus_toggled (EmpathyChatView *view, priv->has_focus = has_focus; if (!priv->has_focus) { - theme_adium_remove_focus_marks (self); + theme_adium_remove_all_focus_marks (self); } } -- cgit v1.2.3 From 96345c97d9c3fc52b45ef5ce522ef2e4c94bca63 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 11:35:09 +0100 Subject: tp-chat: give ::pending-message-removed the message Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-chat.c | 1 + libempathy/empathy-tp-chat.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 019064a16..71e56203d 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1293,6 +1293,7 @@ chat_message_received_cb (EmpathyTpChat *tp_chat, static void chat_pending_message_removed_cb (EmpathyTpChat *tp_chat, + EmpathyMessage *message, EmpathyChat *chat) { EmpathyChatPriv *priv = GET_PRIV (chat); diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index c83db01a1..de15a968b 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -479,10 +479,10 @@ pending_message_removed_cb (TpTextChannel *channel, find_pending_message_func); g_assert (m != NULL); + g_signal_emit (chat, signals[PENDING_MESSAGE_REMOVED], 0, m->data); + g_object_unref (m->data); g_queue_delete_link (priv->pending_messages_queue, m); - - g_signal_emit (chat, signals[PENDING_MESSAGE_REMOVED], 0); } static void @@ -1672,9 +1672,9 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, + g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, - 0); + 1, EMPATHY_TYPE_MESSAGE); g_type_class_add_private (object_class, sizeof (EmpathyTpChatPriv)); } -- cgit v1.2.3 From 3329e947496629d8275ad68791d73c49d9fc820f Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 11:35:42 +0100 Subject: chat-view: add message_acknowledged vfunc Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-chat-view.c | 11 +++++++++++ libempathy-gtk/empathy-chat-view.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/libempathy-gtk/empathy-chat-view.c b/libempathy-gtk/empathy-chat-view.c index 097215cfd..43d89dd78 100644 --- a/libempathy-gtk/empathy-chat-view.c +++ b/libempathy-gtk/empathy-chat-view.c @@ -212,3 +212,14 @@ empathy_chat_view_focus_toggled (EmpathyChatView *view, } } +void +empathy_chat_view_message_acknowledged (EmpathyChatView *view, + EmpathyMessage *message) +{ + g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view)); + + if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->message_acknowledged) { + EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->message_acknowledged (view, message); + } +} + diff --git a/libempathy-gtk/empathy-chat-view.h b/libempathy-gtk/empathy-chat-view.h index 1af0721a3..73245c422 100644 --- a/libempathy-gtk/empathy-chat-view.h +++ b/libempathy-gtk/empathy-chat-view.h @@ -70,6 +70,8 @@ struct _EmpathyChatViewIface { void (*copy_clipboard) (EmpathyChatView *view); void (*focus_toggled) (EmpathyChatView *view, gboolean has_focus); + void (*message_acknowledged) (EmpathyChatView *view, + EmpathyMessage *message); }; GType empathy_chat_view_get_type (void) G_GNUC_CONST; @@ -101,6 +103,8 @@ void empathy_chat_view_highlight (EmpathyChatView *view, void empathy_chat_view_copy_clipboard (EmpathyChatView *view); void empathy_chat_view_focus_toggled (EmpathyChatView *view, gboolean has_focus); +void empathy_chat_view_message_acknowledged (EmpathyChatView *view, + EmpathyMessage *message); G_END_DECLS -- cgit v1.2.3 From c68050906fb6a3017ed9162fb14b4dcca78eba0a Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 15:12:54 +0100 Subject: chat: don't toggle visibility of the chat view on marking messages read It doesn't make sense, and it's a lie. It will also break showing unread message markers in the adium chat view. Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-chat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 71e56203d..3a57c8138 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -3905,11 +3905,9 @@ empathy_chat_messages_read (EmpathyChat *self) if (priv->retrieving_backlogs) return; - if (priv->tp_chat != NULL ) { + if (priv->tp_chat != NULL) { empathy_tp_chat_acknowledge_all_messages (priv->tp_chat); } - - empathy_chat_view_focus_toggled (self->view, TRUE); } /* Return TRUE if on of the contacts in this chat is composing */ -- cgit v1.2.3 From bd1d3bc265f617b0aa86bd80da28d64b50dcbbfb Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 15:14:54 +0100 Subject: adium: implement acknowledge_message to remove unread marker Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-theme-adium.c | 88 +++++++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 2 deletions(-) diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 1a213ff91..8b7f88065 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -61,6 +61,9 @@ typedef struct { guint pages_loading; /* Queue of GValue* containing an EmpathyMessage or string */ GQueue message_queue; + /* Queue of owned gchar* of message token to remove unread + * marker for when we lose focus. */ + GQueue acked_messages; GtkWidget *inspector_window; GSettings *gsettings_chat; gboolean has_focus; @@ -945,17 +948,92 @@ theme_adium_copy_clipboard (EmpathyChatView *view) webkit_web_view_copy_clipboard (WEBKIT_WEB_VIEW (view)); } +static void +theme_adium_remove_mark_from_message (EmpathyThemeAdium *self, + const gchar *token) +{ + WebKitDOMDocument *dom; + WebKitDOMNodeList *nodes; + gchar *class, *tmp; + GError *error = NULL; + + dom = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (self)); + if (dom == NULL) { + return; + } + + tmp = tp_escape_as_identifier (token); + class = g_strdup_printf (".x-empathy-message-id-%s", tmp); + g_free (tmp); + + /* Get all nodes with focus class */ + nodes = webkit_dom_document_query_selector_all (dom, class, &error); + g_free (class); + + if (nodes == NULL) { + DEBUG ("Error getting focus nodes: %s", + error ? error->message : "No error"); + g_clear_error (&error); + return; + } + + theme_adium_remove_focus_marks (self, nodes); +} + +static void +theme_adium_remove_acked_message_unread_mark_foreach (gpointer data, + gpointer user_data) +{ + EmpathyThemeAdium *self = user_data; + gchar *token = data; + + theme_adium_remove_mark_from_message (self, token); + g_free (token); +} + static void theme_adium_focus_toggled (EmpathyChatView *view, gboolean has_focus) { - EmpathyThemeAdium *self = (EmpathyThemeAdium *) view; EmpathyThemeAdiumPriv *priv = GET_PRIV (view); priv->has_focus = has_focus; if (!priv->has_focus) { - theme_adium_remove_all_focus_marks (self); + /* We've lost focus, so let's make sure all the acked + * messages have lost their unread marker. */ + g_queue_foreach (&priv->acked_messages, + theme_adium_remove_acked_message_unread_mark_foreach, + view); + g_queue_clear (&priv->acked_messages); + } +} + +static void +theme_adium_message_acknowledged (EmpathyChatView *view, + EmpathyMessage *message) +{ + EmpathyThemeAdium *self = (EmpathyThemeAdium *) view; + EmpathyThemeAdiumPriv *priv = GET_PRIV (view); + TpMessage *tp_msg; + + tp_msg = empathy_message_get_tp_message (message); + + if (tp_msg == NULL) { + return; } + + /* We only want to actually remove the unread marker if the + * view doesn't have focus. If we did it all the time we would + * never see the unread markers, ever! So, we'll queue these + * up, and when we lose focus, we'll remove the markers. */ + if (priv->has_focus) { + g_queue_push_tail (&priv->acked_messages, + g_strdup (tp_message_get_token (tp_msg))); + return; + } + + theme_adium_remove_mark_from_message (self, + tp_message_get_token (tp_msg)); } static void @@ -1078,6 +1156,7 @@ theme_adium_iface_init (EmpathyChatViewIface *iface) iface->highlight = theme_adium_highlight; iface->copy_clipboard = theme_adium_copy_clipboard; iface->focus_toggled = theme_adium_focus_toggled; + iface->message_acknowledged = theme_adium_message_acknowledged; } static void @@ -1143,6 +1222,11 @@ theme_adium_dispose (GObject *object) priv->inspector_window = NULL; } + if (priv->acked_messages.length > 0) { + g_queue_foreach (&priv->acked_messages, (GFunc) g_free, NULL); + g_queue_clear (&priv->acked_messages); + } + G_OBJECT_CLASS (empathy_theme_adium_parent_class)->dispose (object); } -- cgit v1.2.3 From 5af3e568a7048f1de84d9c5372973aeee87aff60 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 15:15:13 +0100 Subject: chat: call acknowledge_message on the chat view when it happens Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-chat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 3a57c8138..09bff03e3 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1298,6 +1298,9 @@ chat_pending_message_removed_cb (EmpathyTpChat *tp_chat, { EmpathyChatPriv *priv = GET_PRIV (chat); + empathy_chat_view_message_acknowledged (chat->view, + message); + priv->unread_messages--; g_object_notify (G_OBJECT (chat), "nb-unread-messages"); } -- cgit v1.2.3 From d44680728465f8bb4da6f6dd50694d04aadd1745 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 15:16:25 +0100 Subject: chat: ::notify for all changes to unread messages Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-chat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 09bff03e3..897127b28 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1278,6 +1278,7 @@ chat_message_received (EmpathyChat *chat, if (empathy_message_is_incoming (message)) { priv->unread_messages++; + g_object_notify (G_OBJECT (chat), "nb-unread-messages"); } g_signal_emit (chat, signals[NEW_MESSAGE], 0, message, pending); -- cgit v1.2.3 From 4d140c3a4e3c4629a72c3bf0ea7ca8b8ee48fb72 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 15:18:57 +0100 Subject: tp-chat: rename signal to message-acknowledged Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-chat.c | 12 ++++++------ libempathy/empathy-tp-chat.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 897127b28..09698bc72 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1293,9 +1293,9 @@ chat_message_received_cb (EmpathyTpChat *tp_chat, } static void -chat_pending_message_removed_cb (EmpathyTpChat *tp_chat, - EmpathyMessage *message, - EmpathyChat *chat) +chat_message_acknowledged_cb (EmpathyTpChat *tp_chat, + EmpathyMessage *message, + EmpathyChat *chat) { EmpathyChatPriv *priv = GET_PRIV (chat); @@ -2895,7 +2895,7 @@ chat_finalize (GObject *object) g_signal_handlers_disconnect_by_func (priv->tp_chat, chat_message_received_cb, chat); g_signal_handlers_disconnect_by_func (priv->tp_chat, - chat_pending_message_removed_cb, chat); + chat_message_acknowledged_cb, chat); g_signal_handlers_disconnect_by_func (priv->tp_chat, chat_send_error_cb, chat); g_signal_handlers_disconnect_by_func (priv->tp_chat, @@ -3579,8 +3579,8 @@ empathy_chat_set_tp_chat (EmpathyChat *chat, g_signal_connect (tp_chat, "message-received", G_CALLBACK (chat_message_received_cb), chat); - g_signal_connect (tp_chat, "pending-message-removed", - G_CALLBACK (chat_pending_message_removed_cb), + g_signal_connect (tp_chat, "message_acknowledged", + G_CALLBACK (chat_message_acknowledged_cb), chat); g_signal_connect (tp_chat, "send-error", G_CALLBACK (chat_send_error_cb), diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index de15a968b..1d3dca765 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -84,7 +84,7 @@ enum { CHAT_STATE_CHANGED, PROPERTY_CHANGED, DESTROY, - PENDING_MESSAGE_REMOVED, + MESSAGE_ACKNOWLEDGED, LAST_SIGNAL }; @@ -479,7 +479,7 @@ pending_message_removed_cb (TpTextChannel *channel, find_pending_message_func); g_assert (m != NULL); - g_signal_emit (chat, signals[PENDING_MESSAGE_REMOVED], 0, m->data); + g_signal_emit (chat, signals[MESSAGE_ACKNOWLEDGED], 0, m->data); g_object_unref (m->data); g_queue_delete_link (priv->pending_messages_queue, m); @@ -1666,8 +1666,8 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass) G_TYPE_NONE, 0); - signals[PENDING_MESSAGE_REMOVED] = - g_signal_new ("pending-message-removed", + signals[MESSAGE_ACKNOWLEDGED] = + g_signal_new ("message-acknowledged", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, -- cgit v1.2.3 From 46c85cbe83e943ce5b45fa8b66e19fe583f7d0ca Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 15:23:07 +0100 Subject: tp-chat: call acknowledge_message(s) directly Signed-off-by: Jonny Lamb --- libempathy/empathy-tp-chat.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 1d3dca765..1b45ec02a 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -94,8 +94,6 @@ G_DEFINE_TYPE_WITH_CODE (EmpathyTpChat, empathy_tp_chat, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (EMPATHY_TYPE_CONTACT_LIST, tp_chat_iface_init)); -static void acknowledge_messages (EmpathyTpChat *chat, const GList *messages); - static void tp_chat_set_delivery_status (EmpathyTpChat *self, const gchar *token, @@ -1837,20 +1835,10 @@ empathy_tp_chat_get_pending_messages (EmpathyTpChat *chat) return priv->pending_messages_queue->head; } -static void -acknowledge_messages (EmpathyTpChat *chat, - const GList *messages) { - EmpathyTpChatPriv *priv = GET_PRIV (chat); - - tp_text_channel_ack_messages_async (TP_TEXT_CHANNEL (priv->channel), - messages, NULL, NULL); -} - void empathy_tp_chat_acknowledge_message (EmpathyTpChat *chat, EmpathyMessage *message) { EmpathyTpChatPriv *priv = GET_PRIV (chat); - GList *messages = NULL; TpMessage *tp_msg; g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); @@ -1860,9 +1848,8 @@ empathy_tp_chat_acknowledge_message (EmpathyTpChat *chat, return; tp_msg = empathy_message_get_tp_message (message); - messages = g_list_append (messages, tp_msg); - acknowledge_messages (chat, messages); - g_list_free (messages); + tp_text_channel_ack_message_async (TP_TEXT_CHANNEL (priv->channel), + tp_msg, NULL, NULL); } void @@ -1887,8 +1874,10 @@ empathy_tp_chat_acknowledge_messages (EmpathyTpChat *chat, } } - if (messages_to_ack != NULL) - acknowledge_messages (chat, messages_to_ack); + if (messages_to_ack != NULL) { + tp_text_channel_ack_messages_async (TP_TEXT_CHANNEL (priv->channel), + messages_to_ack, NULL, NULL); + } g_list_free (messages_to_ack); } -- cgit v1.2.3 From 1c40d3370a1d2e1e98b1609377e0903a2ca40f6f Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 13 May 2011 15:50:38 +0100 Subject: adium: add comment explaining why we add x-empathy-mesage-id-* Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-theme-adium.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 8b7f88065..095d2058e 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -771,7 +771,11 @@ theme_adium_append_message (EmpathyChatView *view, * %status% - See %status% in theme_adium_append_html () */ - /* x-empathy-message-id-* */ + /* This is slightly a hack, but it's the only way to add + * arbitrary data to messages in the HTML. We add another + * class called "x-empathy-message-id-*" to the message. This + * way, we can remove the unread marker for this specific + * message later. */ tp_msg = empathy_message_get_tp_message (msg); if (tp_msg != NULL) { gchar *tmp = tp_escape_as_identifier ( -- cgit v1.2.3 From ec997377c0765b3d1619120c501433799740edba Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Mon, 16 May 2011 10:00:08 +0100 Subject: tp-chat: don't assert on not finding message Signed-off-by: Jonny Lamb --- libempathy/empathy-tp-chat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 1b45ec02a..670ac11af 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -475,7 +475,9 @@ pending_message_removed_cb (TpTextChannel *channel, m = g_queue_find_custom (priv->pending_messages_queue, message, find_pending_message_func); - g_assert (m != NULL); + + if (m == NULL) + return; g_signal_emit (chat, signals[MESSAGE_ACKNOWLEDGED], 0, m->data); -- cgit v1.2.3 From 9e1914959b7e26e82ca4042ad5f7f042cb5a34a2 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Tue, 17 May 2011 09:33:47 +0100 Subject: adium: set has_unread_message to FALSE when we think we've cleared them all Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-theme-adium.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 095d2058e..b62b017c9 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -1009,6 +1009,8 @@ theme_adium_focus_toggled (EmpathyChatView *view, theme_adium_remove_acked_message_unread_mark_foreach, view); g_queue_clear (&priv->acked_messages); + + priv->has_unread_message = FALSE; } } -- cgit v1.2.3