Initial Commit
[packages] / xemacs-packages / zenirc / src / zenirc-signal.el
1 ;;; zenirc-signal.el --- Fancy signal formatting for ZenIRC
2
3 ;; Copyright (C) 1993, 1994 Ben A. Mesander
4 ;; Copyright (C) 1998 Per Persson
5
6 ;; Author: Mark Bailen <msbailen@msbdcolka.cr.usgs.gov>
7 ;;         Ben A. Mesander <ben@gnu.ai.mit.edu>
8 ;; Maintainer: pp@sno.pp.se
9 ;; Keywords: extensions
10 ;; Created: 1993/06/03
11
12 ;; This program is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16 ;;
17 ;; This program is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ;; GNU General Public License for more details.
21 ;;
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with this program; if not, you can either send email to this
24 ;; program's maintainer or write to: The Free Software Foundation,
25 ;; Inc.; 675 Massachusetts Avenue; Cambridge, MA 02139, USA.
26
27 ;;; Commentary:
28
29 ;; This code detects if the message that triggered the signal was
30 ;; a PRIVMSG, and if so, formats it differently. Otherwise, it calls
31 ;; the regular zenirc-signal-hook subroutine(s).
32
33 ;;; Code:
34
35 (require 'zenirc)
36
37 (defun zenirc-signal-privmsg (proc msg)
38   (let ((pmsg (zenirc-parse-server-message msg)))
39     (cond ((string= "PRIVMSG" (aref pmsg 0))
40            (zenirc-message nil "[%s] %s->%s: %s"
41                            (buffer-name)
42                            (zenirc-run-hook 'zenirc-format-nickuserhost-hook
43                                             (aref pmsg 1))
44                            (aref pmsg 2)
45                            (aref pmsg 3))
46            (setq zenirc-run-next-hook nil)))))
47
48 (provide 'zenirc-signal)
49
50 (zenirc-add-hook 'zenirc-signal-hook 'zenirc-signal-privmsg)
51
52 ;; zenirc-signal.el ends here