]> git.0d.be Git - empathy.git/commitdiff
EmpathyChat: include should_highlight in ::new-message
authorWill Thompson <will@willthompson.co.uk>
Wed, 18 Jan 2012 16:03:00 +0000 (16:03 +0000)
committerWill Thompson <will@willthompson.co.uk>
Wed, 18 Jan 2012 17:47:25 +0000 (17:47 +0000)
This allows EmpathyChatWindow to use this rather than calling
empathy_message_should_highlight() itself.

libempathy-gtk/empathy-chat.c
src/empathy-chat-window.c

index c8ef248096998a40c0f0266a6f06644be2666a15..267cdca2ae10a3ac860ceac7de8bddfaf1b3ba54 100644 (file)
@@ -1413,7 +1413,8 @@ chat_message_received (EmpathyChat *chat,
                        g_object_notify (G_OBJECT (chat), "nb-unread-messages");
                }
 
-               g_signal_emit (chat, signals[NEW_MESSAGE], 0, message, pending);
+               g_signal_emit (chat, signals[NEW_MESSAGE], 0, message, pending,
+                              should_highlight);
        }
 
        /* We received a message so the contact is no longer
@@ -3299,6 +3300,14 @@ empathy_chat_class_init (EmpathyChatClass *klass)
                              G_TYPE_NONE,
                              1, G_TYPE_BOOLEAN);
 
+       /**
+        * EmpathyChat::new-message:
+        * @self: the #EmpathyChat
+        * @message: the new message
+        * @pending: whether the message was in the pending queue when @self
+        *  was created
+        * @should_highlight: %TRUE if the message mentions the local user
+        */
        signals[NEW_MESSAGE] =
                g_signal_new ("new-message",
                              G_OBJECT_CLASS_TYPE (object_class),
@@ -3307,7 +3316,7 @@ empathy_chat_class_init (EmpathyChatClass *klass)
                              NULL, NULL,
                              g_cclosure_marshal_generic,
                              G_TYPE_NONE,
-                             2, EMPATHY_TYPE_MESSAGE, G_TYPE_BOOLEAN);
+                             3, EMPATHY_TYPE_MESSAGE, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
 
        signals[PART_COMMAND_ENTERED] =
                        g_signal_new ("part-command-entered",
index 1bb9de4aa012adc4f757aef158f262a9a0d38dbe..3e197796d9c55e0facbc602929cb1fbc56ffedbb 100644 (file)
@@ -1437,6 +1437,7 @@ static void
 chat_window_new_message_cb (EmpathyChat       *chat,
                            EmpathyMessage    *message,
                            gboolean pending,
+                           gboolean should_highlight,
                            EmpathyChatWindow *window)
 {
        EmpathyChatWindowPriv *priv;
@@ -1496,7 +1497,7 @@ chat_window_new_message_cb (EmpathyChat       *chat,
                if (chatroom != NULL && empathy_chatroom_is_always_urgent (chatroom)) {
                        needs_urgency = TRUE;
                } else {
-                       needs_urgency = empathy_message_should_highlight (message);
+                       needs_urgency = should_highlight;
                }
        } else {
                needs_urgency = TRUE;