Fix -- user list buffer not updating when parts are hidden.
[riece] / lisp / riece-000.el
1 ;;; riece-000.el --- handlers for 000 replies -*- lexical-binding: t -*-
2 ;; Copyright (C) 1998-2003 Daiki Ueno
3
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Created: 1998-09-28
6 ;; Keywords: IRC, riece
7
8 ;; This file is part of Riece.
9
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)
13 ;; any later version.
14
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.
19
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., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
24
25 ;;; Code:
26
27 (require 'riece-misc)
28 (require 'riece-version)
29 (require 'riece-commands)               ;riece-command-join
30
31 (eval-when-compile
32   (autoload 'riece-default-handle-numeric-reply "riece-handle"))
33 (defun riece-handle-default-000-message (prefix number name string)
34   (setq riece-nick-accepted 'ok)
35   (riece-default-handle-numeric-reply
36    riece-info-prefix prefix number name string))
37
38 (defun riece-handle-001-message (prefix _number name string)
39   "RPL_WELCOME \"Welcome to the Internet Relay Network <nick>!<user>@<host>\""
40   (if riece-real-server-name
41       (error (riece-mcat "Already registered")))
42   (setq riece-real-server-name prefix
43         riece-real-nickname name
44         riece-real-userhost nil)
45   ;; Before sending USERHOST, register myself with riece-obarray
46   ;; because it may take some time.
47   (riece-get-user name)
48   (riece-send-string (format "USERHOST %s\r\n" riece-real-nickname))
49   (riece-insert-info
50    (list riece-dialogue-buffer riece-others-buffer)
51    (concat (substring string 1) "\n"))
52   (if (equal riece-server-name "")
53       (message (riece-mcat "Logging in to IRC server...done"))
54     (message (riece-mcat "Logging in to %s...done") riece-server-name))
55   (run-hooks 'riece-after-login-hook)
56   (let ((channel-list riece-startup-channel-list)
57         entry identity)
58     (while channel-list
59       (unless (listp (setq entry (car channel-list)))
60         (setq entry (list (car channel-list))))
61       (if (equal (riece-identity-server
62                   (setq identity (riece-parse-identity (car entry))))
63                  riece-server-name)
64           (riece-command-join-channel identity (nth 1 entry)))
65       (setq channel-list (cdr channel-list)))))
66
67 (defun riece-handle-004-message (_prefix _number _name string)
68   "RPL_MYINFO \"<umodes> <chnlmodes>\""
69   (if (string-match "^[^ ]+ +[^ ]+ +\\([^ ]+\\) +" string)
70       (setq riece-supported-user-modes
71             (string-to-list (match-string 1 string))
72             riece-supported-channel-modes
73             (string-to-list (substring string (match-end 0))))
74     (riece-insert-info
75      (list riece-dialogue-buffer riece-others-buffer)
76      (concat string "\n"))))
77
78 (provide 'riece-000)
79
80 ;;; riece-000.el ends here