From b66315290cf80b090f1b66eef021c811d1ea0b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Mon, 31 Jan 2011 21:24:31 +0100 Subject: Escape XML tags in FreeDesktop notifications. Resolves: #756 diff --git a/Swift/QtUI/FreeDesktopNotifier.cpp b/Swift/QtUI/FreeDesktopNotifier.cpp index e027043..6db1da1 100644 --- a/Swift/QtUI/FreeDesktopNotifier.cpp +++ b/Swift/QtUI/FreeDesktopNotifier.cpp @@ -31,6 +31,11 @@ void FreeDesktopNotifier::showMessage(Type type, const String& subject, const St return; } + QString body = P2QSTRING(description); + body = body.replace("&", "&"); + body = body.replace("<", "<"); + body = body.replace(">", ">"); + int timeout = (type == IncomingMessage || type == SystemMessage) ? DEFAULT_MESSAGE_NOTIFICATION_TIMEOUT_SECONDS : DEFAULT_STATUS_NOTIFICATION_TIMEOUT_SECONDS; QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "", "Notify"); @@ -42,7 +47,7 @@ void FreeDesktopNotifier::showMessage(Type type, const String& subject, const St msg << quint32(0); // ID of previous notification to replace msg << imageScaler.getScaledImage(picture, 48).string().c_str(); // Icon to display msg << P2QSTRING(subject); // Summary / Header of the message to display - msg << P2QSTRING(description); // Body of the message to display + msg << body; // Body of the message to display msg << actions; // Actions from which the user may choose msg << hints; // Hints to the server displaying the message msg << qint32(timeout*1000); // Timeout in milliseconds -- cgit v0.10.2-6-g49f6