1 ;;; zenirc-yow-filter.el --- neutralize yowage
3 ;; Copyright (C) 1997 Noah S. Friedman
5 ;; Author: Noah Friedman <friedman@prep.ai.mit.edu>
6 ;; Maintainer: friedman@prep.ai.mit.edu
7 ;; Keywords: zenirc, extensions, oink, yow
10 ;; $Id: zenirc-yow-filter.el,v 1.1.1.1 1998-10-07 11:21:31 jareth Exp $
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)
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.
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.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
29 ;; I estimate that loading this file grows emacs' permanent
30 ;; heap by about 650K.
36 (or (boundp 'yow-vector)
40 (defconst zenirc-yow-filter-table nil)
42 (defun zenirc-yow-filter-table-snarf (&optional file)
43 (let ((table (make-vector 509 0))
45 (and (boundp 'yow-file)
47 (concat data-directory "yow.lines")))
48 (buf (generate-new-buffer " *Yow!*"))
51 (goto-char (point-min))
53 (skip-chars-forward " \t\n\r\f")
55 (intern (buffer-substring (prog1
57 (search-forward "\0"))
63 (setq buffer-undo-list t)
64 (insert-file-contents yowfile)
66 (delete-region (point-min) (point))
67 (while (re-search-forward "\n" nil t)
70 (goto-char (point-min))
71 (while (re-search-forward "[ \t\n\r\f]+" nil t)
77 (defun zenirc-yow-filter (proc parsedmsg)
78 (or zenirc-yow-filter-table
79 (setq zenirc-yow-filter-table (zenirc-yow-filter-table-snarf)))
80 (cond ((intern-soft (aref parsedmsg 3) zenirc-yow-filter-table)
81 (and zenirc-debug-ignore
82 (zenirc-message proc 'debug (format "Ignored: %s" parsedmsg)))
83 (setq zenirc-run-next-hook nil))))
85 (zenirc-add-hook 'zenirc-server-PRIVMSG-hook 'zenirc-yow-filter)
86 (zenirc-add-hook 'zenirc-server-NOTICE-hook 'zenirc-yow-filter)
88 (provide 'zenirc-yow-filter)
90 ;;; zenirc-yow-filter.el ends here.