From 08449325007875e9ef858481733ee3fbe1a4b2eb Mon Sep 17 00:00:00 2001 From: delthas Date: Wed, 21 Dec 2022 15:57:30 +0100 Subject: Implement /OPER Fixes: https://todo.sr.ht/~taiite/senpai/105 --- commands.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'commands.go') diff --git a/commands.go b/commands.go index 3428ff2..6fb501f 100644 --- a/commands.go +++ b/commands.go @@ -89,6 +89,14 @@ func init() { Desc: "change your nickname", Handle: commandDoNick, }, + "OPER": { + AllowHome: true, + MinArgs: 2, + MaxArgs: 2, + Usage: " ", + Desc: "log in to an operator account", + Handle: commandDoOper, + }, "MODE": { AllowHome: true, MaxArgs: maxArgsInfinite, @@ -420,6 +428,15 @@ func commandDoNick(app *App, args []string) (err error) { return } +func commandDoOper(app *App, args []string) (err error) { + s := app.CurrentSession() + if s == nil { + return errOffline + } + s.Oper(args[0], args[1]) + return +} + func commandDoMode(app *App, args []string) (err error) { _, target := app.win.CurrentBuffer() if len(args) > 0 && !strings.HasPrefix(args[0], "+") && !strings.HasPrefix(args[0], "-") { -- cgit v1.2.3