X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Friece-user.el;h=c780e61de5d0d0ea6aa423cdc74d159d76c6031a;hb=bf3cea82e421d7bc2b717780c4d30805899847c0;hp=8a3f9747d674821289c1536a16cfba6cc6b87f75;hpb=ce31ecd481aadab99d158271dc360dc4d33d8af8;p=riece diff --git a/lisp/riece-user.el b/lisp/riece-user.el index 8a3f974..c780e61 100644 --- a/lisp/riece-user.el +++ b/lisp/riece-user.el @@ -18,39 +18,44 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Code: (require 'riece-identity) (require 'riece-mode) +(require 'riece-cache) ;;; User object: (defun riece-find-user (name) "Get a user object named NAME from the server buffer." + (riece-cache-get riece-user-cache name) (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name) - riece-obarray))) - (if symbol - (symbol-value symbol)))) + riece-user-obarray))) + (if symbol + (symbol-value symbol)))) (defun riece-forget-user (name) + (riece-cache-delete riece-user-cache name) (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)))) (when symbol (makunbound symbol) - (unintern (symbol-name symbol) riece-obarray)))) + (unintern (symbol-name symbol) riece-user-obarray)))) (defun riece-rename-user (old-name new-name) + (riece-cache-delete riece-user-cache old-name) + (riece-cache-set riece-user-cache 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-obarray))) + riece-user-obarray))) (when symbol (set (intern (riece-identity-canonicalize-prefix new-name) - riece-obarray) + riece-user-obarray) (symbol-value symbol)) (makunbound symbol) - (unintern (symbol-name symbol) riece-obarray))))) + (unintern (symbol-name symbol) riece-user-obarray))))) (defun riece-make-user (channels user-at-host modes away operator) "Make an instance of user object. @@ -60,11 +65,14 @@ away status, respectively." (defun riece-get-user (name) (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name) - riece-obarray))) + riece-user-obarray))) (if symbol - (symbol-value symbol) + (progn + (riece-cache-get riece-user-cache name) + (symbol-value symbol)) + (riece-cache-set riece-user-cache name name) (set (intern (riece-identity-canonicalize-prefix name) - riece-obarray) + riece-user-obarray) (riece-make-user nil nil nil nil nil))))) (defun riece-user-channels (user)