From 7fbb016bd6cd46bc0beabcfa6f8dcf66b630eb34 Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 29 May 2003 08:27:48 +0000 Subject: [PATCH] * 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. --- lisp/ChangeLog | 5 +++++ lisp/riece-commands.el | 46 ++++++++++++++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e69de29..55cd77d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -0,0 +1,5 @@ +2003-05-29 Daiki Ueno + + * 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. diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index ea07bd9..6b84c48 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -161,25 +161,39 @@ (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 -- 1.7.10.4