summaryrefslogtreecommitdiff
path: root/commands.go
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2022-12-21 15:57:30 +0100
committerdelthas <delthas@dille.cc>2022-12-21 15:57:38 +0100
commit08449325007875e9ef858481733ee3fbe1a4b2eb (patch)
tree2b10f620ddf1f235fdc2593affefc0a714372709 /commands.go
parentBump go-libnp (diff)
Implement /OPER
Fixes: https://todo.sr.ht/~taiite/senpai/105
Diffstat (limited to 'commands.go')
-rw-r--r--commands.go17
1 files changed, 17 insertions, 0 deletions
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: "<username> <password>",
+ 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], "-") {