* riece-commands.el (riece-command-invite): Don't accept channel
authorueno <ueno>
Thu, 29 May 2003 08:27:48 +0000 (08:27 +0000)
committerueno <ueno>
Thu, 29 May 2003 08:27:48 +0000 (08:27 +0000)
argument; throw an error when user is not on a channel.
(riece-command-kick): New command.

lisp/ChangeLog
lisp/riece-commands.el

index e69de29..55cd77d 100644 (file)
@@ -0,0 +1,5 @@
+2003-05-29  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-commands.el (riece-command-invite): Don't accept channel
+       argument; throw an error when user is not on a channel.
+       (riece-command-kick): New command.
index ea07bd9..6b84c48 100644 (file)
                             (riece-identity-prefix riece-current-channel)
                             topic)))
 
-(defun riece-command-invite (&optional user channel)
+(defun riece-command-invite (user)
   (interactive
-   (let ((completion-ignore-case t)
-        user channel)
-     (if current-prefix-arg
-        (setq channel
-              (completing-read
-               "Channel: "
-               (mapcar #'list riece-current-channels))))
+   (let ((completion-ignore-case t))
+     (unless (and riece-current-channel
+                 (riece-channel-p riece-current-channel))
+       (error "Not on a channel"))
      (list (completing-read
            "User: "
-           (mapcar #'list (riece-get-users-on-server)))
-          channel)))
-  (if channel
-      (riece-send-string (format "INVITE %s %s\r\n"
-                                user (riece-identity-prefix channel)))
-    (riece-send-string (format "INVITE %s %s\r\n"
-                              user (riece-identity-prefix
-                                    riece-current-channel)))))
+           (mapcar #'list (riece-get-users-on-server))))))
+  (riece-send-string (format "INVITE %s %s\r\n"
+                            user (riece-identity-prefix
+                                  riece-current-channel))))
+
+(defun riece-command-kick (user &optional message)
+  (interactive
+   (let ((completion-ignore-case t))
+     (unless (and riece-current-channel
+                 (riece-channel-p riece-current-channel))
+       (error "Not on a channel"))
+     (list (completing-read
+           "User: "
+           (mapcar #'list (riece-channel-get-users
+                           riece-current-channel)))
+          (if current-prefix-arg
+              (read-string "Message: ")))))
+  (riece-send-string
+   (if message
+       (format "KICK %s %s :%s\r\n"
+              (riece-identity-prefix riece-current-channel)
+              user message)
+     (format "KICK %s %s\r\n"
+            (riece-identity-prefix riece-current-channel)
+            user))))
 
 (defun riece-command-change-mode (channel change)
   (interactive