riece-addon-modules
riece-addon
riece-ruby
+ riece-lru
riece-mode
;; riece-identity -+-> riece-channel
2005-11-18 Daiki Ueno <ueno@unixuser.org>
+ * riece-user.el: Require 'riece-lru.
+ (riece-find-user): Increase priority of given username in
+ riece-user-lru.
+ (riece-forget-user): Remove given username from riece-user-lru.
+ (riece-rename-user): Rename given username in riece-user-lru.
+ (riece-get-user): Register given username in riece-user-lru (if
+ is being added to riece-user-obarray.)
+
+ * riece-server.el: Require 'riece-lru.
+ (riece-reset-process-buffer): Initialize riece-user-lru.
+
+ * riece-options.el (riece-user-lru-max-size): New user option.
+ * riece-misc.el: Require 'riece-lru.
+ (riece-get-users-on-server): Get usernames from riece-user-lru.
+
+ * riece-globals.el (riece-user-lru): New variable.
+ * COMPILE (riece-modules): Added riece-lru.
+
* riece-lru.el: New file.
* riece-develop.el: New file.
(defvar riece-coding-system nil
"Coding system for process I/O.
Local to the server buffers.")
+(defvar riece-user-lru nil
+ "LRU cache of usernames.
+Local to the server buffers.")
;;; Variables local to the channel buffers:
(defvar riece-freeze nil
(defun riece-lru-get-node (map key)
(let ((symbol (intern-soft key (riece-lru-map-hash-obarray map)))
- previous next first last node)
+ previous next last node)
(when symbol
(setq node (symbol-value symbol)
previous (riece-lru-node-previous node)
next (riece-lru-node-next node)
- first (riece-lru-map-first map)
last (riece-lru-map-last map))
(if previous
(riece-lru-node-set-next previous next))
(riece-lru-node-set-next (riece-lru-map-last map) node)
(riece-lru-node-set-previous node (riece-lru-map-last map))))
(riece-lru-map-set-last map node))))
+
+(provide 'riece-lru)
\ No newline at end of file
(require 'riece-server)
(require 'riece-user)
(require 'riece-mode)
+(require 'riece-lru)
(defun riece-get-buffer-create (name &optional init-major-mode)
(let ((buffer (get-buffer name)))
(setq identities
(cons (riece-make-identity (symbol-name user) server-name)
identities)))
- riece-user-obarray)
+ (riece-lru-map-hash-obarray riece-user-lru))
identities)))
(defun riece-get-channels-on-server (server-name)
:type 'function
:group 'riece-server)
+(defcustom riece-user-lru-max-size 512
+ "Maximum size of LRU cache of usernames."
+ :type 'integer
+ :group 'riece-server)
+
(defcustom riece-channel-buffer-mode t
"When non-nil, Riece will display a channel buffer."
:type 'boolean
(require 'riece-coding) ;riece-default-coding-system
(require 'riece-identity)
(require 'riece-compat)
+(require 'riece-lru)
(eval-and-compile
(defvar riece-server-keyword-map
(make-local-variable 'riece-channel-obarray)
(setq riece-channel-obarray (make-vector riece-channel-obarray-size 0))
(make-local-variable 'riece-coding-system)
+ (make-local-variable 'riece-user-lru)
+ (setq riece-user-lru (riece-make-lru riece-user-lru-max-size))
(buffer-disable-undo)
(erase-buffer)))
(require 'riece-identity)
(require 'riece-mode)
+(require 'riece-lru)
;;; User object:
(defun riece-find-user (name)
"Get a user object named NAME from the server buffer."
+ (riece-lru-get riece-user-lru name)
(let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)
riece-user-obarray)))
- (if symbol
- (symbol-value symbol))))
+ (if symbol
+ (symbol-value symbol))))
(defun riece-forget-user (name)
+ (riece-lru-delete riece-user-lru name)
(let ((symbol (intern-soft (riece-identity-canonicalize-prefix name))))
(when symbol
(makunbound symbol)
(unintern (symbol-name symbol) riece-user-obarray))))
(defun riece-rename-user (old-name new-name)
+ (riece-lru-delete riece-user-lru old-name)
+ (riece-lru-set riece-user-lru new-name new-name)
(unless (equal (riece-identity-canonicalize-prefix old-name)
(riece-identity-canonicalize-prefix new-name))
(let ((symbol (intern-soft (riece-identity-canonicalize-prefix old-name)
riece-user-obarray)))
(if symbol
(symbol-value symbol)
+ (riece-lru-set riece-user-lru name name)
(set (intern (riece-identity-canonicalize-prefix name)
riece-user-obarray)
(riece-make-user nil nil nil nil nil)))))