]> git.eshelyaron.com Git - emacs.git/commitdiff
Rename erc-notifications.el to erc-desktop-notifications.el
authorJulien Danjou <julien@danjou.info>
Thu, 4 Oct 2012 13:11:49 +0000 (15:11 +0200)
committerJulien Danjou <julien@danjou.info>
Thu, 4 Oct 2012 13:11:49 +0000 (15:11 +0200)
* erc-desktop-notifications.el: Rename from erc-notifications to
avoid clash with 8+3 filename format and erc-notify.el.

lisp/erc/ChangeLog
lisp/erc/erc-desktop-notifications.el [new file with mode: 0644]
lisp/erc/erc-notifications.el [deleted file]

index 348765036ea0e90c9e2e9f946d87ad041898a391..3558a8a90b5131216d3d63d74f9dbdd0366439bb 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-04  Julien Danjou  <julien@danjou.info>
+
+       * erc-desktop-notifications.el: Rename from erc-notifications to
+       avoid clash with 8+3 filename format and erc-notify.el.
+
 2012-09-25  Chong Yidong  <cyd@gnu.org>
 
        * erc.el (erc-send-command): Use define-obsolete-function-alias.
diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el
new file mode 100644 (file)
index 0000000..57b93f4
--- /dev/null
@@ -0,0 +1,90 @@
+;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions
+
+;; Copyright (C) 2012 Free Software Foundation, Inc.
+
+;; Author: Julien Danjou <julien@danjou.info>
+;; Keywords: comm
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs 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 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs 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.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This implements notifications using `notifications-notify' on
+;; PRIVMSG received and on public nickname mentions.
+
+;;; Code:
+
+(require 'erc)
+(require 'xml)
+(require 'notifications)
+(require 'erc-match)
+(require 'dbus)
+
+(defgroup erc-notifications nil
+  "Send notifications on PRIVMSG or mentions."
+  :group 'erc)
+
+(defvar erc-notifications-last-notification nil
+  "Last notification id.")
+
+(defcustom erc-notifications-icon nil
+  "Icon to use for notification."
+  :group 'erc-notifications
+  :type 'file)
+
+(defun erc-notifications-notify (nick msg)
+  "Notify that NICK send some MSG.
+This will replace the last notification sent with this function."
+  (dbus-ignore-errors
+    (setq erc-notifications-last-notification
+          (notifications-notify :title (xml-escape-string nick)
+                                :body (xml-escape-string msg)
+                                :replaces-id erc-notifications-last-notification
+                                :app-icon erc-notifications-icon))))
+
+(defun erc-notifications-PRIVMSG (proc parsed)
+  (let ((nick (car (erc-parse-user (erc-response.sender parsed))))
+        (target (car (erc-response.command-args parsed)))
+        (msg (erc-response.contents parsed)))
+    (when (and (erc-current-nick-p target)
+               (not (and (boundp 'erc-track-exclude)
+                         (member nick erc-track-exclude)))
+               (not (erc-is-message-ctcp-and-not-action-p msg)))
+      (erc-notifications-notify nick msg)))
+  ;; Return nil to continue processing by ERC
+  nil)
+
+(defun erc-notifications-notify-on-match (match-type nickuserhost msg)
+  (when (eq match-type 'current-nick)
+    (let ((nick (nth 0 (erc-parse-user nickuserhost))))
+      (unless (or (string-match-p "^Server:" nick)
+                  (when (boundp 'erc-track-exclude)
+                    (member nick erc-track-exclude)))
+        (erc-notifications-notify nick msg)))))
+
+;;;###autoload(autoload 'erc-notifications-mode "erc-desktop-notifications" "" t)
+(define-erc-module notifications nil
+  "Send notifications on private message reception and mentions."
+  ;; Enable
+  ((add-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG)
+   (add-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match))
+  ;; Disable
+  ((remove-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG)
+   (remove-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match)))
+
+(provide 'erc-desktop-notifications)
+
+;;; erc-desktop-notifications.el ends here
diff --git a/lisp/erc/erc-notifications.el b/lisp/erc/erc-notifications.el
deleted file mode 100644 (file)
index 4faffc9..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-;; erc-notifications.el -- Send notification on PRIVMSG or mentions
-
-;; Copyright (C) 2012 Free Software Foundation, Inc.
-
-;; Author: Julien Danjou <julien@danjou.info>
-;; Keywords: comm
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs 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 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs 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.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This implements notifications using `notifications-notify' on
-;; PRIVMSG received and on public nickname mentions.
-
-;;; Code:
-
-(require 'erc)
-(require 'xml)
-(require 'notifications)
-(require 'erc-match)
-(require 'dbus)
-
-(defgroup erc-notifications nil
-  "Send notifications on PRIVMSG or mentions."
-  :group 'erc)
-
-(defvar erc-notifications-last-notification nil
-  "Last notification id.")
-
-(defcustom erc-notifications-icon nil
-  "Icon to use for notification."
-  :group 'erc-notifications
-  :type 'file)
-
-(defun erc-notifications-notify (nick msg)
-  "Notify that NICK send some MSG.
-This will replace the last notification sent with this function."
-  (dbus-ignore-errors
-    (setq erc-notifications-last-notification
-          (notifications-notify :title (xml-escape-string nick)
-                                :body (xml-escape-string msg)
-                                :replaces-id erc-notifications-last-notification
-                                :app-icon erc-notifications-icon))))
-
-(defun erc-notifications-PRIVMSG (proc parsed)
-  (let ((nick (car (erc-parse-user (erc-response.sender parsed))))
-        (target (car (erc-response.command-args parsed)))
-        (msg (erc-response.contents parsed)))
-    (when (and (erc-current-nick-p target)
-               (not (and (boundp 'erc-track-exclude)
-                         (member nick erc-track-exclude)))
-               (not (erc-is-message-ctcp-and-not-action-p msg)))
-      (erc-notifications-notify nick msg)))
-  ;; Return nil to continue processing by ERC
-  nil)
-
-(defun erc-notifications-notify-on-match (match-type nickuserhost msg)
-  (when (eq match-type 'current-nick)
-    (let ((nick (nth 0 (erc-parse-user nickuserhost))))
-      (unless (or (string-match-p "^Server:" nick)
-                  (when (boundp 'erc-track-exclude)
-                    (member nick erc-track-exclude)))
-        (erc-notifications-notify nick msg)))))
-
-;;;###autoload(autoload 'erc-notifications-mode "erc-notifications" "" t)
-(define-erc-module notifications nil
-  "Send notifications on private message reception and mentions."
-  ;; Enable
-  ((add-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG)
-   (add-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match))
-  ;; Disable
-  ((remove-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG)
-   (remove-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match)))
-
-(provide 'erc-notifications)
-
-;;; erc-notifications.el ends here