1 ;;; riece-notify.el --- display notification on status area
2 ;; Copyright (C) 1998-2008 Daiki Ueno
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
6 ;; Keywords: IRC, riece
8 ;; This file is part of Riece.
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
27 ;; NOTE: This is an add-on module for Riece.
31 (require 'riece-message)
32 (eval-when-compile (require 'riece-keyword))
35 (defconst riece-notify-description "Display notification on status area.")
37 (defun riece-notify-keyword-notify-function (keyword message)
38 (riece--notify (format "%s: %s"
39 (riece-format-identity (riece-message-speaker message))
40 (riece-message-text message))))
42 (defun riece--notify (string)
44 :session "org.freedesktop.Notifications"
45 "/org/freedesktop/Notifications"
46 "org.freedesktop.Notifications" "Notify"
47 "GNU Emacs" ;; Application name.
48 0 ;; No replacement of other notifications.
50 "Notification summary" ;; Summary.
51 (encode-coding-string string 'utf-8) ;; Body.
52 '(:array) ;; No actions (empty array of strings).
53 '(:array :signature "{sv}") ;; No hints
54 ;; (empty array of dictionary entries).
55 ':int32 -1) ;; Default timeout.
58 (defun riece-notify-requires ()
61 (defun riece-notify-insinuate ()
62 (add-hook 'riece-keyword-notify-functions
63 'riece-notify-keyword-notify-function))
65 (defun riece-notify-uninstall ()
66 (remove-hook 'riece-keyword-notify-functions
67 'riece-notify-keyword-notify-function))
69 (provide 'riece-notify)
71 ;;; riece-notify.el ends here