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 (require 'riece-globals)
28 (require 'riece-channel)
30 (require 'riece-display)
32 (defun riece-naming-assert-join (user-name channel-name)
33 (if (riece-identity-equal-no-server user-name riece-real-nickname)
34 (riece-join-channel channel-name))
35 (riece-user-toggle-channel user-name channel-name t)
36 (riece-channel-toggle-user channel-name user-name t))
38 (defun riece-naming-assert-part (user-name channel-name)
39 (if (riece-identity-equal-no-server user-name riece-real-nickname)
41 (riece-part-channel channel-name)
42 (riece-forget-channel channel-name))
43 (riece-user-toggle-channel user-name channel-name nil)
44 (riece-channel-toggle-user channel-name user-name nil)
45 (riece-channel-toggle-operator channel-name user-name nil)
46 (riece-channel-toggle-speaker channel-name user-name nil)
47 (if (riece-identity-equal-safe user-name (riece-current-nickname))
48 (let* ((identity (riece-make-identity channel-name))
49 (pointer (riece-identity-member-safe
50 identity riece-current-channels)))
52 (setcar pointer nil))))))
54 (defun riece-naming-assert-rename (old-name new-name)
55 (if (riece-identity-equal-no-server old-name riece-real-nickname)
56 (setq riece-last-nickname riece-real-nickname
57 riece-real-nickname new-name))
58 (let* ((old (riece-get-user old-name))
59 (channels (riece-user-channels old))
62 (setq users (riece-channel-get-users (car channels))
63 pointer (member old-name users))
65 (setcar pointer new-name))
66 (setq users (riece-channel-get-operators (car channels))
67 pointer (member old-name users))
69 (setcar pointer new-name))
70 (setq users (riece-channel-get-speakers (car channels))
71 pointer (member old-name users))
73 (setcar pointer new-name))
74 (setq channels (cdr channels)))
75 (riece-rename-user old-name new-name)))
77 (provide 'riece-naming)