from riece-inlines.el; renamed from scandinavian-downcase.
(riece-identity-equal-no-server): Moved from riece-inlines.el;
renamed from scandinavian-equal-ignore-case.
(riece-identity-equal-no-server-safe): New function.
(riece-identity-member-no-server): Moved from riece-inlines.el;
renamed from scandinavian-member-ignore-case.
(riece-identity-member-no-server-safe): New function.
* riece-inlines.el: Removed.
* COMPILE (riece-modules): Remove riece-inlines.
* Makefile.am (EXTRA_DIST): Remove riece-inlines.el.
'(riece-globals
riece-options
riece-version
- riece-inlines
riece-coding
riece-complete
2003-06-03 Daiki Ueno <ueno@unixuser.org>
+ * riece-identity.el (riece-identity-canonicalize-prefix): Moved
+ from riece-inlines.el; renamed from scandinavian-downcase.
+ (riece-identity-equal-no-server): Moved from riece-inlines.el;
+ renamed from scandinavian-equal-ignore-case.
+ (riece-identity-equal-no-server-safe): New function.
+ (riece-identity-member-no-server): Moved from riece-inlines.el;
+ renamed from scandinavian-member-ignore-case.
+ (riece-identity-member-no-server-safe): New function.
+
+ * riece-inlines.el: Removed.
+ * COMPILE (riece-modules): Remove riece-inlines.
+ * Makefile.am (EXTRA_DIST): Remove riece-inlines.el.
+
+2003-06-03 Daiki Ueno <ueno@unixuser.org>
+
* riece-rdcc.el (riece-rdcc-sentinel): Don't call delete-process
explicitly.
* riece-ndcc.el: Don't call delete-process explicitly.
riece-channel.el riece-coding.el riece-commands.el riece-compat.el \
riece-complete.el riece-display.el riece-emacs.el riece-filter.el \
riece-globals.el riece-handle.el riece-highlight.el riece-identity.el \
- riece-inlines.el riece-message.el riece-misc.el riece-naming.el \
+ riece-message.el riece-misc.el riece-naming.el \
riece-options.el riece-server.el riece-user.el riece-version.el \
riece-xemacs.el riece.el \
riece-ctcp.el riece-url.el riece-unread.el \
;;; Code:
-(eval-when-compile (require 'riece-inlines)) ;scandinavian-downcase
-
(require 'riece-options)
(require 'riece-identity)
(defun riece-find-channel (name)
"Get a channel object named NAME from the server buffer."
(riece-with-server-buffer
- (let ((symbol (intern-soft (scandinavian-downcase
+ (let ((symbol (intern-soft (riece-identity-canonicalize-prefix
(riece-identity-prefix name))
riece-obarray)))
(if symbol
(defun riece-forget-channel (name)
(riece-with-server-buffer
- (let ((symbol (intern-soft (scandinavian-downcase
+ (let ((symbol (intern-soft (riece-identity-canonicalize-prefix
(riece-identity-prefix name)))))
(when symbol
(makunbound symbol)
(defun riece-get-channel (name)
(riece-with-server-buffer
- (let ((symbol (intern-soft (scandinavian-downcase
+ (let ((symbol (intern-soft (riece-identity-canonicalize-prefix
(riece-identity-prefix name))
riece-obarray)))
(if symbol
(symbol-value symbol)
- (set (intern (scandinavian-downcase
+ (set (intern (riece-identity-canonicalize-prefix
(riece-identity-prefix name))
riece-obarray)
(riece-make-channel))))))
"Select the next channel."
(interactive)
(when (> (length riece-current-channels) 1)
- (let ((pointer (cdr (scandinavian-member-ignore-case
+ (let ((pointer (cdr (riece-identity-member-no-server
riece-current-channel
riece-current-channels))))
(while (and pointer
"Select the previous channel."
(interactive)
(when (> (length riece-current-channels) 1)
- (let ((pointer (scandinavian-member-ignore-case
+ (let ((pointer (riece-identity-member-no-server
riece-current-channel
riece-current-channels))
(start riece-current-channels)
(while channels
(riece-naming-assert-join user (car channels))
;;XXX
- (if (scandinavian-equal-ignore-case user riece-real-nickname)
+ (if (riece-identity-equal-no-server user riece-real-nickname)
(riece-switch-to-channel (riece-make-identity (car channels))))
(let ((buffer (cdr (riece-identity-assoc
(riece-make-identity (car channels))
(pointer channels)
(message (car (riece-split-parameters string))))
;; If you are quitting, no need to cleanup.
- (unless (scandinavian-equal-ignore-case user riece-real-nickname)
+ (unless (riece-identity-equal-no-server user riece-real-nickname)
;; You were talking with the user.
(if (riece-identity-member (riece-make-identity user)
riece-current-channels)
ident2
(riece-make-identity ident2))))
+(defun riece-identity-canonicalize-prefix (prefix)
+ "Canonicalize identity PREFIX.
+This function downcases PREFIX first, then does special treatment for
+Scandinavian alphabets.
+
+RFC2812, 2.2 \"Character codes\" says:
+ Because of IRC's Scandinavian origin, the characters {}|^ are
+ considered to be the lower case equivalents of the characters []\~,
+ respectively. This is a critical issue when determining the
+ equivalence of two nicknames or channel names."
+ (let* ((result (downcase prefix))
+ (length (length result))
+ (index 0))
+ (while (< index length)
+ (if (eq (aref result index) ?\[)
+ (aset result index ?{)
+ (if (eq (aref result index) ?\])
+ (aset result index ?})
+ (if (eq (aref result index) ?\\)
+ (aset result index ?|)
+ (if (eq (aref result index) ?~)
+ (aset result index ?^)))))
+ (setq index (1+ index)))
+ result))
+
+(defun riece-identity-equal-no-server (prefix1 prefix2)
+ "Return t, if IDENT1 and IDENT2 is equal without server."
+ (equal (riece-identity-canonicalize-prefix prefix1)
+ (riece-identity-canonicalize-prefix prefix2)))
+
+(defun riece-identity-equal-no-server-safe (prefix1 prefix2)
+ "Return t, if IDENT1 and IDENT2 is equal without server.
+The only difference with `riece-identity-no-server', this function removes
+server name before comparison."
+ (equal (riece-identity-canonicalize-prefix
+ (riece-identity-prefix prefix1))
+ (riece-identity-canonicalize-prefix
+ (riece-identity-prefix prefix2))))
+
(defun riece-identity-member (elt list)
"Return non-nil if an identity ELT is an element of LIST."
(catch 'found
(throw 'found list)
(setq list (cdr list))))))
+(defun riece-identity-member-no-server (elt list)
+ "Return non-nil if an identity ELT is an element of LIST.
+The only difference with `riece-identity-member', this function doesn't
+take server names into account."
+ (catch 'found
+ (while list
+ (if (and (stringp (car list))
+ (riece-identity-equal-no-server (car list) elt))
+ (throw 'found list)
+ (setq list (cdr list))))))
+
+(defun riece-identity-member-no-server-safe (elt list)
+ "Return non-nil if an identity ELT is an element of LIST.
+The only difference with `riece-identity-member-no-server', this function uses
+`riece-identity-equal-no-server-safe' for comparison."
+ (catch 'found
+ (while list
+ (if (and (stringp (car list))
+ (riece-identity-equal-no-server-safe (car list) elt))
+ (throw 'found list)
+ (setq list (cdr list))))))
+
(defun riece-identity-assoc (elt alist)
"Return non-nil if an identity ELT matches the car of an element of ALIST."
(catch 'found
+++ /dev/null
-;;; riece-inlines.el --- inline functions
-;; Copyright (C) 1998-2003 Daiki Ueno
-
-;; Author: Daiki Ueno <ueno@unixuser.org>
-;; Created: 1998-09-28
-;; Keywords: IRC, riece
-
-;; This file is part of Riece.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; 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.
-
-;;; Commentary:
-
-;; RFC2812, 2.2 "Character codes" says:
-;; Because of IRC's Scandinavian origin, the characters {}|^ are
-;; considered to be the lower case equivalents of the characters []\~,
-;; respectively. This is a critical issue when determining the
-;; equivalence of two nicknames or channel names.
-
-;;; Code:
-
-(defsubst scandinavian-downcase (string)
- (let* ((result (downcase string))
- (length (length result))
- (index 0))
- (while (< index length)
- (if (eq (aref result index) ?\[)
- (aset result index ?{)
- (if (eq (aref result index) ?\])
- (aset result index ?})
- (if (eq (aref result index) ?\\)
- (aset result index ?|)
- (if (eq (aref result index) ?~)
- (aset result index ?^)))))
- (setq index (1+ index)))
- result))
-
-(defsubst scandinavian-equal-ignore-case (s1 s2)
- (string-equal (scandinavian-downcase s1) (scandinavian-downcase s2)))
-
-(defsubst scandinavian-member-ignore-case (thing list)
- (catch 'found
- (while list
- (if (and (stringp (car list))
- (scandinavian-equal-ignore-case (car list) thing))
- (throw 'found list)
- (setq list (cdr list))))))
-
-(provide 'riece-inlines)
-
-;;; riece-inlines.el ends here
(require 'riece-display)
(defun riece-naming-assert-join (user-name channel-name)
- (if (scandinavian-equal-ignore-case user-name riece-real-nickname)
+ (if (riece-identity-equal-no-server user-name riece-real-nickname)
(riece-join-channel channel-name))
(riece-user-toggle-channel user-name channel-name t)
(riece-channel-toggle-user channel-name user-name t))
(defun riece-naming-assert-part (user-name channel-name)
- (if (scandinavian-equal-ignore-case user-name riece-real-nickname)
+ (if (riece-identity-equal-no-server user-name riece-real-nickname)
(progn
(riece-part-channel channel-name)
(riece-forget-channel channel-name))
(setcar pointer nil))))))
(defun riece-naming-assert-rename (old-name new-name)
- (if (scandinavian-equal-ignore-case old-name riece-real-nickname)
+ (if (riece-identity-equal-no-server old-name riece-real-nickname)
(setq riece-last-nickname riece-real-nickname
riece-real-nickname new-name))
(let* ((old (riece-get-user old-name))
;;; Code:
-(eval-when-compile (require 'riece-inlines)) ;scandinavian-downcase
-
(require 'riece-identity)
(defconst riece-user-regexp
(defun riece-find-user (name)
"Get a user object named NAME from the server buffer."
(riece-with-server-buffer
- (let ((symbol (intern-soft (scandinavian-downcase
+ (let ((symbol (intern-soft (riece-identity-canonicalize-prefix
(riece-identity-prefix name))
riece-obarray)))
(if symbol
(defun riece-forget-user (name)
(riece-with-server-buffer
- (let ((symbol (intern-soft (scandinavian-downcase
+ (let ((symbol (intern-soft (riece-identity-canonicalize-prefix
(riece-identity-prefix name)))))
(when symbol
(makunbound symbol)
(defun riece-rename-user (old-name new-name)
(riece-with-server-buffer
- (unless (equal (scandinavian-downcase
+ (unless (equal (riece-identity-canonicalize-prefix
(riece-identity-prefix old-name))
- (scandinavian-downcase
+ (riece-identity-canonicalize-prefix
(riece-identity-prefix new-name)))
- (let ((symbol (intern-soft (scandinavian-downcase
+ (let ((symbol (intern-soft (riece-identity-canonicalize-prefix
(riece-identity-prefix old-name))
riece-obarray)))
(when symbol
- (set (intern (scandinavian-downcase
+ (set (intern (riece-identity-canonicalize-prefix
(riece-identity-prefix new-name))
riece-obarray)
(symbol-value symbol))
(defun riece-get-user (name)
(riece-with-server-buffer
- (let ((symbol (intern-soft (scandinavian-downcase
+ (let ((symbol (intern-soft (riece-identity-canonicalize-prefix
(riece-identity-prefix name))
riece-obarray)))
(if symbol
(symbol-value symbol)
- (set (intern (scandinavian-downcase
+ (set (intern (riece-identity-canonicalize-prefix
(riece-identity-prefix name)) riece-obarray)
(riece-make-user))))))