1 ;;; riece-xface.el --- display X-Face in user list buffer
2 ;; Copyright (C) 1998-2003 Daiki Ueno
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
6 ;; Keywords: IRC, riece
8 ;; This file is part of Riece.
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)
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.
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.
27 ;; To use, add the following line to your ~/.riece/init.el:
28 ;; (add-to-list 'riece-addons 'riece-xface)
32 (require 'riece-identity)
33 (require 'riece-globals)
34 (require 'riece-display)
37 (defvar riece-xface-enabled nil)
39 (defconst riece-xface-description
40 "Display X-Face in user list buffer")
42 (defvar lsdb-insert-x-face-function)
44 (defun riece-xface-update-user-list-buffer ()
45 (if riece-xface-enabled
46 (riece-scan-property-region
47 'riece-identity (point-min)(point-max)
49 (let ((records (riece-lsdb-lookup-records (get-text-property
50 start 'riece-identity)))
54 (setq xface (nth 1 (assq 'x-face (car records)))
55 records (cdr records)))
57 (not (eq (char-after end) ? )))
58 (let ((inhibit-read-only t)
62 (funcall lsdb-insert-x-face-function xface))))))))
64 (defun riece-xface-requires ()
67 (defun riece-xface-insinuate ()
68 (add-hook 'riece-user-list-mode-hook
70 (add-hook 'riece-update-buffer-functions
71 'riece-xface-update-user-list-buffer t t))))
73 (defun riece-xface-enable ()
74 (setq riece-xface-enabled t)
75 (if riece-current-channel
76 (riece-emit-signal 'user-list-changed riece-current-channel)))
78 (defun riece-xface-disable ()
79 (setq riece-xface-enabled nil)
80 (if riece-current-channel
81 (riece-emit-signal 'user-list-changed riece-current-channel)))
83 (provide 'riece-xface)
85 ;;; riece-xface.el ends here