* [patch] two more commands
@ 2006-04-21 23:34 Xavier Maillard
0 siblings, 0 replies; only message in thread
From: Xavier Maillard @ 2006-04-21 23:34 UTC (permalink / raw)
Hello,
Just a quick and small patch to add these two functions in rcirc.
===File /tmp/ChangeLog======================================
2006-04-21 Xavier Maillard <zedek@gnu.org>
* rcirc.el (rcirc-cmd-op, rcirc-cmd-deop): New commands
(rcirc-cmd-me) : use dufn-rcirc-command macro to stay consistent
(rcirc-cmd-ctcp): ditto
============================================================
===File /tmp/rcirc-op.diff==================================
--- /tmp/rcirc.el.orig 2006-04-21 20:29:14.000000000 +0200
+++ /tmp/rcirc.el 2006-04-22 01:30:51.000000000 +0200
@@ -648,6 +648,8 @@
(define-key rcirc-mode-map (kbd "C-c C-d") 'rcirc-cmd-mode)
(define-key rcirc-mode-map (kbd "C-c C-m") 'rcirc-cmd-msg)
(define-key rcirc-mode-map (kbd "C-c C-r") 'rcirc-cmd-nick) ; rename
+(define-key rcirc-mode-map (kbd "C-c C-D") 'rcirc-cmd-deop)
+(define-key rcirc-mode-map (kbd "C-c C-O") 'rcirc-cmd-op)
(define-key rcirc-mode-map (kbd "C-c C-o") 'rcirc-cmd-oper)
(define-key rcirc-mode-map (kbd "C-c C-p") 'rcirc-cmd-part)
(define-key rcirc-mode-map (kbd "C-c C-q") 'rcirc-cmd-query)
@@ -1726,7 +1728,7 @@
(mapconcat 'identity (cdr arglist) " "))))
(rcirc-send-string process (concat "KICK " target " " argstring))))
-(defun rcirc-cmd-ctcp (args &optional process target)
+(defun-rcirc-command ctcp (args &optional process target)
(if (string-match "^\\([^ ]+\\)\\s-+\\(.+\\)$" args)
(let ((target (match-string 1 args))
(request (match-string 2 args)))
@@ -1736,7 +1738,7 @@
(rcirc-print process (rcirc-nick process) "ERROR" nil
"usage: /ctcp NICK REQUEST")))
-(defun rcirc-cmd-me (args &optional process target)
+(defun-rcirc-command me (args &optional process target)
(rcirc-send-string process (format "PRIVMSG %s :\C-aACTION %s\C-a"
target args)))
@@ -1758,6 +1760,27 @@
"*" "")))
rcirc-ignore-list " ")))
+(defun-rcirc-command op (nicks)
+ "Send OP for `nicks' or `rcirc-nick' if empty.
+Limitation: in its interactive form, you can only op one nick."
+ (interactive (list (completing-read "Op nick: "
+ (with-rcirc-server-buffer rcirc-nick-table))))
+ (if (string= "" nicks) (setq nicks rcirc-nick))
+ (dolist (nick (split-string nicks " "))
+ (rcirc-send-string process
+ (format "ChanServ OP %s %s" target nick))))
+
+(defun-rcirc-command deop (nicks)
+ "Send DE-OP for `nicks' or `rcirc-nick' if empty.
+Limitation: in its interactive form, you can only de-op one nick."
+ (interactive (list (completing-read "De-op nick: "
+ (with-rcirc-server-buffer rcirc-nick-table))))
+ (if (string= "" nicks)
+ (setq nicks (concat "-" rcirc-nick))
+ (setq nicks (concat "-" (mapconcat 'identity (split-string
+ nicks) " -"))))
+ (rcirc-cmd-op nicks))
+
\f
(defun rcirc-message-leader (sender face)
"Return a string with SENDER propertized with FACE."
============================================================
I already have assignments for Emacs. Feel free to incorporate/comment/etc ...
Regards,
Xavier
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-04-21 23:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-21 23:34 [patch] two more commands Xavier Maillard
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).