X-Git-Url: https://cgit.sxemacs.org/?p=riece;a=blobdiff_plain;f=lisp%2Friece-xface.el;h=1ec50665633b23fabc0b2805d79915f4b50a80b1;hp=29a71ad4ecd557f3a7fe3ee2f8adfc670794c2b8;hb=9a40faf27d1ddc378072d9a78dae747f44fc757a;hpb=076c383dda1e8e9aabe5a215222a79057b296bc7 diff --git a/lisp/riece-xface.el b/lisp/riece-xface.el index 29a71ad..1ec5066 100644 --- a/lisp/riece-xface.el +++ b/lisp/riece-xface.el @@ -34,26 +34,32 @@ (require 'riece-display) (require 'riece-lsdb) +(defvar riece-xface-enabled nil) + +(defconst riece-xface-description + "Display X-Face in user list buffer") + (defvar lsdb-insert-x-face-function) (defun riece-xface-update-user-list-buffer () - (riece-scan-property-region - 'riece-identity (point-min)(point-max) - (lambda (start end) - (let ((records (riece-lsdb-lookup-records (get-text-property - start 'riece-identity))) - xface) - (while (and records - (null xface)) - (setq xface (nth 1 (assq 'x-face (car records))) - records (cdr records))) - (if (and xface - (not (eq (char-after end) ? ))) - (let ((inhibit-read-only t) - buffer-read-only) - (goto-char end) - (insert " ") - (funcall lsdb-insert-x-face-function xface))))))) + (if riece-xface-enabled + (riece-scan-property-region + 'riece-identity (point-min)(point-max) + (lambda (start end) + (let ((records (riece-lsdb-lookup-records (get-text-property + start 'riece-identity))) + xface) + (while (and records + (null xface)) + (setq xface (nth 1 (assq 'x-face (car records))) + records (cdr records))) + (if (and xface + (not (eq (char-after end) ? ))) + (let ((inhibit-read-only t) + buffer-read-only) + (goto-char end) + (insert " ") + (funcall lsdb-insert-x-face-function xface)))))))) (defun riece-xface-requires () '(riece-lsdb)) @@ -64,6 +70,16 @@ (add-hook 'riece-update-buffer-functions 'riece-xface-update-user-list-buffer t t)))) +(defun riece-xface-enable () + (setq riece-xface-enabled t) + (if riece-current-channel + (riece-emit-signal 'user-list-changed riece-current-channel))) + +(defun riece-xface-disable () + (setq riece-xface-enabled nil) + (if riece-current-channel + (riece-emit-signal 'user-list-changed riece-current-channel))) + (provide 'riece-xface) ;;; riece-xface.el ends here