From ed6af523cb6d7d81c2f728a11af4ea992277cc65 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 13 Feb 2011 23:13:07 -0500 Subject: [PATCH] telepathyClient: Support markup in the title of presence changes Follow-up to commit 09717aae58978b2467835495e1f5d842099eaf67 so title changes also support markup instead of the ugly "" 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 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js index 21e29bab8..440b5e58d 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);