From bc59c98f096f7d01cbccf98d4fdd9c3f0385e896 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Sat, 18 Sep 2021 23:29:44 -0400 Subject: [PATCH] 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 afeeeb0ba22..fa240f68b4e 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 1f39644f759..5afe302daa9 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 -- 2.39.5