telepathyClient: Support markup in the title of presence changes
Follow-up to commit 09717aae58
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
This commit is contained in:
parent
1224e959b6
commit
ed6af523cb
@ -557,21 +557,23 @@ Source.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setPresence: function(presence, message) {
|
setPresence: function(presence, message) {
|
||||||
let msg, shouldNotify;
|
let msg, shouldNotify, title;
|
||||||
|
|
||||||
|
title = GLib.markup_escape_text(this.title, -1);
|
||||||
|
|
||||||
if (presence == Telepathy.ConnectionPresenceType.AVAILABLE) {
|
if (presence == Telepathy.ConnectionPresenceType.AVAILABLE) {
|
||||||
msg = _("%s is online.").format(this.title);
|
msg = _("%s is online.").format(title);
|
||||||
shouldNotify = (this._presence == Telepathy.ConnectionPresenceType.OFFLINE);
|
shouldNotify = (this._presence == Telepathy.ConnectionPresenceType.OFFLINE);
|
||||||
} else if (presence == Telepathy.ConnectionPresenceType.OFFLINE ||
|
} else if (presence == Telepathy.ConnectionPresenceType.OFFLINE ||
|
||||||
presence == Telepathy.ConnectionPresenceType.EXTENDED_AWAY) {
|
presence == Telepathy.ConnectionPresenceType.EXTENDED_AWAY) {
|
||||||
presence = Telepathy.ConnectionPresenceType.OFFLINE;
|
presence = Telepathy.ConnectionPresenceType.OFFLINE;
|
||||||
msg = _("%s is offline.").format(this.title);
|
msg = _("%s is offline.").format(title);
|
||||||
shouldNotify = (this._presence != Telepathy.ConnectionPresenceType.OFFLINE);
|
shouldNotify = (this._presence != Telepathy.ConnectionPresenceType.OFFLINE);
|
||||||
} else if (presence == Telepathy.ConnectionPresenceType.AWAY) {
|
} else if (presence == Telepathy.ConnectionPresenceType.AWAY) {
|
||||||
msg = _("%s is away.").format(this.title);
|
msg = _("%s is away.").format(title);
|
||||||
shouldNotify = false;
|
shouldNotify = false;
|
||||||
} else if (presence == Telepathy.ConnectionPresenceType.BUSY) {
|
} else if (presence == Telepathy.ConnectionPresenceType.BUSY) {
|
||||||
msg = _("%s is busy.").format(this.title);
|
msg = _("%s is busy.").format(title);
|
||||||
shouldNotify = false;
|
shouldNotify = false;
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
@ -676,7 +678,7 @@ Notification.prototype = {
|
|||||||
|
|
||||||
appendPresence: function(text, asTitle) {
|
appendPresence: function(text, asTitle) {
|
||||||
if (asTitle)
|
if (asTitle)
|
||||||
this.update(text, null, { customContent: true });
|
this.update(text, null, { customContent: true, titleMarkup: true });
|
||||||
else
|
else
|
||||||
this.update(this.source.title, null, { customContent: true });
|
this.update(this.source.title, null, { customContent: true });
|
||||||
let label = this.addBody(text, true);
|
let label = this.addBody(text, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user