1 ;;; riece-mode.el --- functions for manipulating channel/user modes
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 (defun riece-parse-modes (string)
30 (while (and (string-match "[-+]\\([^-+ ]*\\) *" string start)
31 (= (match-beginning 0) start))
32 (let ((toggle (eq (aref string start) ?+))
33 (modes (string-to-list (match-string 1 string))))
34 (setq start (match-end 0))
36 (if (and (string-match "\\([^-+][^ ]*\\) *" string start)
37 (= (match-beginning 0) start))
38 (setq start (match-end 0)
39 result (cons (list (riece-make-mode
40 (car modes) (match-string 1 string))
43 (setq result (cons (list (riece-make-mode (car modes))
46 (setq modes (cdr modes)))))
49 (defun riece-mode-assoc (flag modes)
50 "Return a mode object matched with FLAG in MODES."
53 (if (eq flag (riece-mode-flag (car modes)))
54 (throw 'found (car modes)))
55 (setq modes (cdr modes)))))
57 (defun riece-make-mode (flag &optional parameter)
58 "Make an instance of mode object.
59 Arguments are appropriate to the flag and the parameter."
60 (vector flag parameter))
62 (defun riece-mode-flag (mode)
63 "Return the flag of MODE."
66 (defun riece-mode-parameter (mode)
67 "Return the parameter of MODE."
72 ;;; riece-mode.el ends here