Initial revision
[riece] / lisp / riece-000.el
1 ;;; riece-000.el --- handlers for 000 replies
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., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Code:
26
27 (eval-when-compile (require 'riece-inlines))
28
29 (require 'riece-misc)
30 (require 'riece-filter)                 ;riece-default-handle-message
31 (require 'riece-version)
32
33 (eval-when-compile
34   (autoload 'riece-default-handle-numeric-reply "riece-filter"))
35 (defun riece-handle-default-000-message (prefix number name string)
36   (setq riece-nick-accepted 'ok)
37   (riece-default-handle-numeric-reply
38    riece-info-prefix prefix number name string))
39
40 (defun riece-handle-001-message (prefix number name string)
41   "RPL_WELCOME \"Welcome to the Internet Relay Network <nick>!<user>@<host>\""
42   (setq riece-real-server-name prefix
43         riece-real-nickname name
44         riece-real-userhost nil)
45   (riece-send-string (format "USERHOST %s\r\n" riece-real-nickname))
46   (riece-insert-info
47    (list riece-dialogue-buffer riece-others-buffer)
48    (concat (substring string 1) "\n")))
49
50 (defun riece-handle-004-message (prefix number name string)
51   "RPL_MYINFO \"<umodes> <chnlmodes>\""
52   (if (string-match "^[^ ]+ +[^ ]+ +\\([^ ]+\\) +" string)
53       (setq riece-supported-user-modes
54             (string-to-list (match-string 1 string))
55             riece-supported-channel-modes
56             (string-to-list (substring string (match-end 0))))
57     (riece-insert-info
58      (list riece-dialogue-buffer riece-others-buffer)
59      (concat string "\n"))))
60
61 (provide 'riece-000)
62
63 ;;; riece-000.el ends here