[polari] room: Use nick matching to filter out mentions from self



commit ad9398380902e923980bec3cdabb0387192bfe52
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Jul 9 02:16:33 2016 +0200

    room: Use nick matching to filter out mentions from self
    
    We do not want to highlight mentions in messages we sent ourselves.
    To filter those out, we currently compare the message's :sender
    property with the connection's :self-contact. This is another case
    where our message highlighting is tied to being connected, so in
    order to enable us to highlight mentions in logs as well, try to
    match the sender's :alias property against the self-nick instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768613

 src/lib/polari-room.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/src/lib/polari-room.c b/src/lib/polari-room.c
index 24f7e99..73ae3fd 100644
--- a/src/lib/polari-room.c
+++ b/src/lib/polari-room.c
@@ -165,8 +165,7 @@ polari_room_should_highlight_message (PolariRoom *room,
                                       TpMessage *message)
 {
   PolariRoomPrivate *priv;
-  TpConnection *conn;
-  TpContact *self;
+  TpContact *sender;
   char *text;
   gboolean result = FALSE;
 
@@ -174,15 +173,11 @@ polari_room_should_highlight_message (PolariRoom *room,
 
   priv = room->priv;
 
-  if (!priv->channel)
-    return FALSE;
   if (priv->type != TP_HANDLE_TYPE_ROOM)
     return FALSE;
 
-  conn = tp_channel_get_connection (room->priv->channel);
-  self = tp_connection_get_self_contact (conn);
-
-  if (tp_signalled_message_get_sender (message) == self)
+  sender = tp_signalled_message_get_sender (message);
+  if (match_self_nick (room, tp_contact_get_alias (sender)))
     return FALSE;
 
   text = tp_message_to_text (message, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]