notifier: Escape ampersands in notification body
The One True notification daemon will not display notification body text if it includes an ampersand. To prevent this, ampersands must be XML-escaped.master
parent
50cb3090dc
commit
94b12315f1
|
@ -73,18 +73,22 @@ namespace MpdNotify {
|
||||||
|
|
||||||
private void send_notification(string summary, string? body = null,
|
private void send_notification(string summary, string? body = null,
|
||||||
string? icon = null, int timeout = 2000) {
|
string? icon = null, int timeout = 2000) {
|
||||||
|
string thebody = null;
|
||||||
|
if (body != null) {
|
||||||
|
thebody = body.replace("&", "&");
|
||||||
|
}
|
||||||
if (notif == null) {
|
if (notif == null) {
|
||||||
if (Notify.is_initted()) {
|
if (Notify.is_initted()) {
|
||||||
Notify.uninit();
|
Notify.uninit();
|
||||||
}
|
}
|
||||||
Notify.init("mpdnotify");
|
Notify.init("mpdnotify");
|
||||||
notif = new Notify.Notification(summary, body, icon);
|
notif = new Notify.Notification(summary, thebody, icon);
|
||||||
notif.set_timeout(timeout);
|
notif.set_timeout(timeout);
|
||||||
notif.closed.connect(() => {
|
notif.closed.connect(() => {
|
||||||
notif = null;
|
notif = null;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
notif.update(summary, body, icon);
|
notif.update(summary, thebody, icon);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
notif.show();
|
notif.show();
|
||||||
|
|
Loading…
Reference in New Issue