1 ;;; riece-naming.el --- toplevel naming management
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 (eval-when-compile (require 'riece-inlines))
29 (require 'riece-globals)
30 (require 'riece-channel)
32 (require 'riece-display)
34 (defun riece-naming-assert-join (user-name channel-name)
35 (if (string-equal-ignore-case user-name riece-real-nickname)
36 (riece-join-channel channel-name))
37 (riece-user-toggle-channel user-name channel-name t)
38 (riece-channel-toggle-user channel-name user-name t))
40 (defun riece-naming-assert-part (user-name channel-name)
41 (if (string-equal-ignore-case user-name riece-real-nickname)
43 (riece-part-channel channel-name)
44 (riece-forget-channel channel-name))
45 (riece-user-toggle-channel user-name channel-name nil)
46 (riece-channel-toggle-user channel-name user-name nil)
47 (riece-channel-toggle-operator channel-name user-name nil)
48 (riece-channel-toggle-speaker channel-name user-name nil)
49 (if (riece-identity-equal user-name (riece-current-nickname))
50 (let* ((identity (riece-make-identity channel-name))
51 (pointer (riece-identity-member
52 identity riece-current-channels)))
54 (setcar pointer nil))))))
56 (defun riece-naming-assert-rename (old-name new-name)
57 (if (string-equal-ignore-case old-name riece-real-nickname)
58 (setq riece-last-nickname riece-real-nickname
59 riece-real-nickname new-name))
60 (let* ((old (riece-get-user old-name))
61 (channels (riece-user-channels old))
64 (setq users (riece-channel-get-users (car channels))
65 pointer (member old-name users))
67 (setcar pointer new-name))
68 (setq users (riece-channel-get-operators (car channels))
69 pointer (member old-name users))
71 (setcar pointer new-name))
72 (setq users (riece-channel-get-speakers (car channels))
73 pointer (member old-name users))
75 (setcar pointer new-name))
76 (setq channels (cdr channels)))
77 (riece-rename-user old-name new-name)))
79 (provide 'riece-naming)