[gnome-shell] telepathyClient: Support markup in the title of presence changes



commit ed6af523cb6d7d81c2f728a11af4ea992277cc65
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Feb 13 23:13:07 2011 -0500

    telepathyClient: Support markup in the title of presence changes
    
    Follow-up to commit 09717aae58978b2467835495e1f5d842099eaf67 so
    title changes also support markup instead of the ugly "<i></i>"
    status.
    
    Additionally, make sure to escape the contact's title as that
    may accidentally contain unsafe markup or characters.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642209

 js/ui/telepathyClient.js |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js
index 21e29ba..440b5e5 100644
--- a/js/ui/telepathyClient.js
+++ b/js/ui/telepathyClient.js
@@ -557,21 +557,23 @@ Source.prototype = {
     },
 
     setPresence: function(presence, message) {
-        let msg, shouldNotify;
+        let msg, shouldNotify, title;
+
+        title = GLib.markup_escape_text(this.title, -1);
 
         if (presence == Telepathy.ConnectionPresenceType.AVAILABLE) {
-            msg = _("%s is online.").format(this.title);
+            msg = _("%s is online.").format(title);
             shouldNotify = (this._presence == Telepathy.ConnectionPresenceType.OFFLINE);
         } else if (presence == Telepathy.ConnectionPresenceType.OFFLINE ||
                    presence == Telepathy.ConnectionPresenceType.EXTENDED_AWAY) {
             presence = Telepathy.ConnectionPresenceType.OFFLINE;
-            msg = _("%s is offline.").format(this.title);
+            msg = _("%s is offline.").format(title);
             shouldNotify = (this._presence != Telepathy.ConnectionPresenceType.OFFLINE);
         } else if (presence == Telepathy.ConnectionPresenceType.AWAY) {
-            msg = _("%s is away.").format(this.title);
+            msg = _("%s is away.").format(title);
             shouldNotify = false;
         } else if (presence == Telepathy.ConnectionPresenceType.BUSY) {
-            msg = _("%s is busy.").format(this.title);
+            msg = _("%s is busy.").format(title);
             shouldNotify = false;
         } else
             return;
@@ -676,7 +678,7 @@ Notification.prototype = {
 
     appendPresence: function(text, asTitle) {
         if (asTitle)
-            this.update(text, null, { customContent: true });
+            this.update(text, null, { customContent: true, titleMarkup: true });
         else
             this.update(this.source.title, null, { customContent: true });
         let label = this.addBody(text, true);



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