[polari] room: Highlight more nick variants



commit 925ae67277e64f1e1b62391648da9b1ccec2b859
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Sep 17 13:13:09 2015 +0200

    room: Highlight more nick variants
    
    We have been stripping trailing 'garbage' like trailing underscores since
    commit cc7042fa268c, which solved getting highlights for the regular nick
    after reconnecting as nick+'_'. However the nick is also used frequently
    to convey status - 'nick-away', 'nick|bbl', 'nick_office' - which is not
    covered by the current approach. To include those variants in highlighting,
    match up to the first non-alphanumeric character (rather than the last
    alphanumeric one).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755133

 src/lib/polari-room.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/lib/polari-room.c b/src/lib/polari-room.c
index 180d05e..f23daa8 100644
--- a/src/lib/polari-room.c
+++ b/src/lib/polari-room.c
@@ -271,13 +271,13 @@ update_self_nick (PolariRoom *room)
   self = tp_connection_get_self_contact (conn);
 
   nick = tp_contact_get_alias (self);
-  len = strlen (nick);
-  do
-    if (g_ascii_isalnum (nick[len - 1]))
-        break;
-  while (--len > 0);
+  for (len = 0; g_ascii_isalnum(nick[len]); len++)
+    ;
 
-  priv->self_nick = g_strndup (nick, len);
+  if (len > 0)
+    priv->self_nick = g_strndup (nick, len);
+  else
+    priv->self_nick = g_strdup (nick);
 }
 
 static void


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