* riece-url.el (riece-url-regexp): Accept ";".
[riece] / lisp / riece-ignore.el
1 ;;; riece-ignore.el --- ignore user
2 ;; Copyright (C) 1998-2004 Daiki Ueno
3
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Created: 1998-09-28
6 ;; Keywords: IRC, riece
7
8 ;; This file is part of Riece.
9
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Commentary:
26
27 ;; To use, add the following line to your ~/.riece/init.el:
28 ;; (add-to-list 'riece-addons 'riece-ignore)
29
30 ;;; Code:
31
32 (require 'riece-signal)
33 (require 'riece-identity)
34 (require 'riece-message)
35
36 (defvar riece-ignored-user nil)
37
38 (defun riece-ignore-by-user (user)
39   (interactive
40    (let ((completion-ignore-case t))
41      (list (riece-completing-read-identity
42             "User: "
43             (riece-get-users-on-server (riece-current-server-name))))))
44   (setq riece-ignored-user (cons user riece-ignored-user))
45   (riece-connect-signal
46    'user-renamed
47    (lambda (signal handback)
48      (let ((pointer (riece-identity-member (car (riece-signal-args signal))
49                                            riece-ignored-user)))
50        (if pointer
51            (setcar pointer (nth 1 (riece-signal-args signal))))))))
52
53 (defun riece-ignore-message-filter (message)
54   (unless (riece-identity-member (riece-message-speaker message)
55                                  riece-ignored-user)
56     message))
57
58 (defvar riece-command-mode-map)
59 (defun riece-ignore-insinuate ()
60   (add-hook 'riece-message-filter-functions 'riece-ignore-message-filter)
61   (define-key riece-command-mode-map
62     "\C-ck" 'riece-ignore-by-user))
63
64 (provide 'riece-ignore)
65
66 ;;; riece-ignore.el ends here