From 3e3b1031d4bdbac3d3b75ed30404d153a007833e Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 8 Sep 2008 08:21:25 +0000 Subject: [PATCH] * riece-notify.el: New add-on. * riece-addon-modules.el (riece-addon-modules): Add riece-notify (commented). * Makefile.am (EXTRA_DIST): Add riece-notify.el. --- lisp/ChangeLog | 7 +++++ lisp/Makefile.am | 1 + lisp/riece-addon-modules.el | 4 ++- lisp/riece-notify.el | 71 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 lisp/riece-notify.el diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c683f50..9799954 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2008-09-08 Daiki Ueno + + * riece-notify.el: New add-on. + * riece-addon-modules.el (riece-addon-modules): Add + riece-notify (commented). + * Makefile.am (EXTRA_DIST): Add riece-notify.el. + 2008-08-25 TAKAHASHI Kaoru * riece-commands.el (riece-command-enter-message): Fix behavior at diff --git a/lisp/Makefile.am b/lisp/Makefile.am index f96a937..66268d3 100644 --- a/lisp/Makefile.am +++ b/lisp/Makefile.am @@ -20,6 +20,7 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \ riece-kakasi.el riece-foolproof.el riece-yank.el riece-toolbar.el \ riece-eval.el riece-google.el riece-keepalive.el riece-eval-ruby.el \ riece-shrink-buffer.el riece-xfaceb.el riece-epg.el riece-twitter.el \ + riece-notify.el \ url-riece.el \ riece-command-previous-channel.xpm riece-command-next-channel.xpm \ riece-command-configure-windows.xpm riece-command-list-addons.xpm \ diff --git a/lisp/riece-addon-modules.el b/lisp/riece-addon-modules.el index 017cc3a..d9500e1 100644 --- a/lisp/riece-addon-modules.el +++ b/lisp/riece-addon-modules.el @@ -56,6 +56,8 @@ (riece-mcat "Use Riece only on the minibuffer.")) ;;; (cons 'riece-ndcc ;;; (riece-mcat "DCC file sending protocol support (written in elisp.)")) +;;; (cons 'riece-notify +;;; (riece-mcat "Display notification on status area.")) (cons 'riece-rdcc (riece-mcat "DCC file sending protocol support (written in Ruby.)")) (cons 'riece-shrink-buffer @@ -77,4 +79,4 @@ (cons 'riece-yank (riece-mcat "Enter the element of kill-ring.")))) -(provide 'riece-addon-modules) \ No newline at end of file +(provide 'riece-addon-modules) diff --git a/lisp/riece-notify.el b/lisp/riece-notify.el new file mode 100644 index 0000000..dc223e2 --- /dev/null +++ b/lisp/riece-notify.el @@ -0,0 +1,71 @@ +;;; riece-notify.el --- display notification on status area +;; Copyright (C) 1998-2008 Daiki Ueno + +;; Author: Daiki Ueno +;; Created: 1998-09-28 +;; Keywords: IRC, riece + +;; This file is part of Riece. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; NOTE: This is an add-on module for Riece. + +;;; Code: + +(require 'riece-message) +(eval-when-compile (require 'riece-keyword)) +(require 'dbus) + +(defconst riece-notify-description "Display notification on status area.") + +(defun riece-notify-keyword-notify-function (keyword message) + (riece--notify (format "%s: %s" + (riece-format-identity (riece-message-speaker message)) + (riece-message-text message)))) + +(defun riece--notify (string) + (dbus-call-method + :session "org.freedesktop.Notifications" + "/org/freedesktop/Notifications" + "org.freedesktop.Notifications" "Notify" + "GNU Emacs" ;; Application name. + 0 ;; No replacement of other notifications. + "" ;; No icon. + "Notification summary" ;; Summary. + (encode-coding-string string 'utf-8) ;; Body. + '(:array) ;; No actions (empty array of strings). + '(:array :signature "{sv}") ;; No hints + ;; (empty array of dictionary entries). + ':int32 -1) ;; Default timeout. + ) + +(defun riece-notify-requires () + '(riece-keyword)) + +(defun riece-notify-insinuate () + (add-hook 'riece-keyword-notify-functions + 'riece-notify-keyword-notify-function)) + +(defun riece-notify-uninstall () + (remove-hook 'riece-keyword-notify-functions + 'riece-notify-keyword-notify-function)) + +(provide 'riece-notify) + +;;; riece-notify.el ends here -- 1.7.10.4