summaryrefslogtreecommitdiff
path: root/lisp/erc/erc-desktop-notifications.el
diff options
context:
space:
mode:
authorDario Gjorgjevski <dario.gjorgjevski@gmail.com>2020-09-13 16:49:00 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-09-13 16:49:00 +0200
commit2bd41321a6d9f6b478dd73aa9a2ea32709e57b32 (patch)
tree94e1b56650a565b2fe8d47bc01fa4618db45db2f /lisp/erc/erc-desktop-notifications.el
parentdef34a20766ea5179afd5e5ed090a2b86fcccb5e (diff)
downloademacs-2bd41321a6d9f6b478dd73aa9a2ea32709e57b32.tar.gz
Make ERC desktop notifications lenient to invalid XML characters
* lisp/xml.el (xml-invalid-characters-re): New constant. * lisp/erc/erc-desktop-notifications.el (erc-notifications-notify): Strip IRC control codes and invalid XML characters before notifying (bug#43328).
Diffstat (limited to 'lisp/erc/erc-desktop-notifications.el')
-rw-r--r--lisp/erc/erc-desktop-notifications.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el
index 1e65f8f4275..3a9a4a4bac6 100644
--- a/lisp/erc/erc-desktop-notifications.el
+++ b/lisp/erc/erc-desktop-notifications.el
@@ -31,6 +31,7 @@
(require 'erc)
(require 'xml)
(require 'notifications)
+(require 'erc-goodies)
(require 'erc-match)
(require 'dbus)
@@ -62,12 +63,12 @@ This will replace the last notification sent with this function."
;; setting the current buffer to the existing query buffer)
(dbus-ignore-errors
(setq erc-notifications-last-notification
- (let ((channel (if privp (erc-get-buffer nick) (current-buffer))))
+ (let* ((channel (if privp (erc-get-buffer nick) (current-buffer)))
+ (title (format "%s in %s" (xml-escape-string nick t) channel))
+ (body (xml-escape-string (erc-controls-strip msg) t)))
(notifications-notify :bus erc-notifications-bus
- :title (format "%s in %s"
- (xml-escape-string nick)
- channel)
- :body (xml-escape-string msg)
+ :title title
+ :body body
:replaces-id erc-notifications-last-notification
:app-icon erc-notifications-icon
:actions '("default" "Switch to buffer")