emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master bc59c98: Add new '/opme' and '/deopme' convenience ERC commands


From: Amin Bandali
Subject: master bc59c98: Add new '/opme' and '/deopme' convenience ERC commands
Date: Sat, 18 Sep 2021 23:45:35 -0400 (EDT)

branch: master
commit bc59c98f096f7d01cbccf98d4fdd9c3f0385e896
Author: Amin Bandali <bandali@gnu.org>
Commit: Amin Bandali <bandali@gnu.org>

    Add new '/opme' and '/deopme' convenience ERC commands
    
    * lisp/erc/erc.el (erc-cmd-OPME, erc-cmd-DEOPME): Add convenience
    commands for setting and unsetting the operator status on the current
    nick in the current channel.  'erc-cmd-OPME' relies on ChanServ for
    obtaining the operator status (see doc string for more details).
    
    * etc/NEWS: Announce the addition of the commands.
---
 etc/NEWS        |  5 +++++
 lisp/erc/erc.el | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index afeeeb0..fa240f6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2736,6 +2736,11 @@ declared obsolete and rewritten as 
'erc-track-select-mode-line-face',
 with different expected arguments (the current and old faces are now
 separated) and clearer documentation.
 
+*** Add '/opme' and '/deopme' convenience commands.
+The new '/opme' convenience command asks ChanServ to set the operator
+status for the current nick in the current channel, and '/deopme'
+unsets it.
+
 ** xwidget-webkit mode
 
 ---
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 1f39644..5afe302 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -3803,6 +3803,24 @@ the message given by REASON."
                              (mapconcat #'identity people " ")))
     t))
 
+(defun erc-cmd-OPME ()
+  "Ask ChanServ to op the current nick in the current channel.
+
+This command assumes a ChanServ (channel service) available on
+the IRC network which accepts an \"op\" command that takes the
+channel name and the user's nick, and that the current nick is
+allowed to become an operator in the current channel (typically
+means that the user has a +o flag in the channel's access list)."
+  (erc-message "PRIVMSG"
+               (format "ChanServ op %s %s"
+                       (erc-default-target)
+                       (erc-current-nick))
+               nil))
+
+(defun erc-cmd-DEOPME ()
+  "Deop the current nick in the current channel."
+  (erc-cmd-DEOP (erc-current-nick)))
+
 (defun erc-cmd-TIME (&optional line)
   "Request the current time and date from the current server."
   (cond



reply via email to

[Prev in Thread] Current Thread [Next in Thread]