]> git.eshelyaron.com Git - emacs.git/commitdiff
Add new '/opme' and '/deopme' convenience ERC commands
authorAmin Bandali <bandali@gnu.org>
Sun, 19 Sep 2021 03:29:44 +0000 (23:29 -0400)
committerAmin Bandali <bandali@gnu.org>
Sun, 19 Sep 2021 03:37:37 +0000 (23:37 -0400)
* 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
lisp/erc/erc.el

index afeeeb0ba2285603b7f196a2fdd60127663d6b70..fa240f68b4ef47b70ea453d09dba8a7139c769d5 100644 (file)
--- 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
 
 ---
index 1f39644f759106e44d4aef28a48d3fb0a431c672..5afe302daa93c1dfe38b952f169f550e3298bd39 100644 (file)
@@ -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