|
From: Evgenii T. <evg...@us...> - 2014-06-07 11:48:27
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "emacs-jabber".
The branch, master has been updated
via 15ea34d2d8b7e6a83cdcd64a3aac13bb1c8452b7 (commit)
from b1cb3f7181f90abb5acbb37370e35cf91c7a4cdb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 15ea34d2d8b7e6a83cdcd64a3aac13bb1c8452b7
Author: Evgenii Terechkov <ev...@al...>
Date: Sat Jun 7 19:12:56 2014 +0800
Notifications alerts by Adam Sjøgren (as...@ko...)
diff --git a/Makefile.am b/Makefile.am
index ce47ac7..23daa88 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,6 +6,7 @@ AUTOMAKE_OPTIONS = 1.11
my_lisp_sources=fsm.el jabber-activity.el jabber-ahc-presence.el \
jabber-ahc.el jabber-alert.el jabber-autoaway.el jabber-avatar.el \
jabber-awesome.el jabber-ping.el jabber-libnotify.el jabber-console.el \
+jabber-notifications \
jabber-bookmarks.el jabber-browse.el jabber-chat.el \
jabber-chatbuffer.el jabber-chatstates.el jabber-compose.el \
jabber-conn.el jabber-core.el jabber-disco.el jabber-events.el \
diff --git a/jabber-notifications.el b/jabber-notifications.el
new file mode 100644
index 0000000..d947311
--- /dev/null
+++ b/jabber-notifications.el
@@ -0,0 +1,90 @@
+;; jabber-notifications.el - emacs-jabber interface to notifications.el
+
+;; Copyright (C) 2014 - Adam Sjøgren - as...@ko...
+;; Copyright (C) 2010 - Kirill A. Korinskiy - ca...@ca...
+;; Copyright (C) 2007 - Rodrigo Lazo - rla...@gm...
+
+;; 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 of the License, 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 this program; if not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+;; Built on jabber-libnotify.el.
+
+(eval-when-compile (require 'jabber-alert))
+(unless (string< emacs-version "24.1") ;notifications.el preset since Emacs 24.1
+ (require 'notifications)
+
+ (defcustom jabber-notifications-icon ""
+ "Icon to be used on the notification pop-up. Default is empty"
+ :type '(file :must-match t)
+ :group 'jabber-alerts)
+
+ (defcustom jabber-notifications-timeout nil
+ "Specifies the timeout of the pop up window in millisecond"
+ :type 'integer
+ :group 'jabber-alerts)
+
+ (defcustom jabber-notifications-message-header "Jabber message"
+ "Defines the header of the pop up."
+ :type 'string
+ :group 'jabber-alerts)
+
+ (defcustom jabber-notifications-app "Emacs Jabber"
+ "Defines the app of the pop up."
+ :type 'string
+ :group 'jabber-alerts)
+
+ (defcustom jabber-notifications-urgency "low"
+ "Urgency of message"
+ :type '(choice (const :tag "Low" "low")
+ (const :tag "Normal" "normal")
+ (const :tag "Critical" "critical"))
+ :group 'jabber-alerts)
+
+ (defun jabber-message-notifications (from buffer text title)
+ "Show a message through the notifications.el interface"
+ (let
+ ((body (or (jabber-escape-xml text) " "))
+ (head (jabber-escape-xml
+ (or title
+ (or jabber-notifications-message-header " ")
+ text)))
+ (avatar (get (jabber-jid-symbol from) 'avatar)))
+ (notifications-notify
+ :title title
+ :body body
+ :app-icon (or (and avatar (plist-get (cdr avatar) ':file)) jabber-notifications-icon)
+ :app-name jabber-notifications-app
+ :category "jabber.message"
+ :timeout jabber-notifications-timeout)))
+
+ (defun jabber-muc-notifications (nick group buffer text title)
+ "Show MUC message through the notifications.el interface"
+ (jabber-message-notifications group buffer (if nick (format "%s: %s" nick text) text) title)
+ )
+
+ (defun jabber-muc-notifications-personal (nick group buffer text title)
+ "Show personal MUC message through the notifications.el interface"
+ (if (jabber-muc-looks-like-personal-p text group)
+ (jabber-muc-notifications nick group buffer text title))
+ )
+
+ ;; jabber-*-notifications* requires "from" argument, so we cant use
+ ;; define-jabber-alert/define-personal-jabber-alert here and do the
+ ;; work by hand:
+ (pushnew 'jabber-message-notifications (get 'jabber-alert-message-hooks 'custom-options))
+ (pushnew 'jabber-muc-notifications (get 'jabber-alert-muc-hooks 'custom-options))
+ (pushnew 'jabber-muc-notifications-personal (get 'jabber-alert-muc-hooks 'custom-options))
+ )
+
+(provide 'jabber-notifications)
diff --git a/jabber.el b/jabber.el
index ca34584..55eec68 100644
--- a/jabber.el
+++ b/jabber.el
@@ -154,6 +154,7 @@ configure a Google Talk account like this:
(require 'jabber-osd)
(require 'jabber-awesome)
(require 'jabber-libnotify)
+(require 'jabber-notifications)
;;;###autoload
(defvar *jabber-current-status* nil
diff --git a/jabber.texi b/jabber.texi
index 07419e3..d85d5da 100644
--- a/jabber.texi
+++ b/jabber.texi
@@ -2090,6 +2090,11 @@ XOSD.@footnote{XOSD can be found at
@uref{http://www.ignavus.net/software.html}. You also need
@file{osd.el} from @uref{http://www.brockman.se/software/osd.el}.}
+@cindex notifications.el
+The @code{notifications} alerts send a message using Emacs built-in
+package @file{notifications.el}. Note that @file{notifications.el} first appear in
+Emacs 24.1, so they are disabled by default.
+
@cindex libnotify
@cindex notification-daemon
The @code{libnotify} alerts send a message onto your screen using
-----------------------------------------------------------------------
Summary of changes:
Makefile.am | 1 +
jabber-notifications.el | 90 +++++++++++++++++++++++++++++++++++++++++++++++
jabber.el | 1 +
jabber.texi | 5 +++
4 files changed, 97 insertions(+), 0 deletions(-)
create mode 100644 jabber-notifications.el
hooks/post-receive
--
emacs-jabber
|