summaryrefslogtreecommitdiff
path: root/commands.go
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2021-10-31 17:21:12 +0100
committerHubert Hirtz <hubert@hirtz.pm>2021-10-31 19:06:46 +0100
commit9336f9788ae063c2aa089018ff9de2fed481c280 (patch)
treeef87cb7a9305361babe2037754caa8e0f0616f2c /commands.go
parentDon't show notifications when receiving a message from self (diff)
/mode: default channel to the current channel
Diffstat (limited to 'commands.go')
-rw-r--r--commands.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/commands.go b/commands.go
index 08b7187..1dd5cd0 100644
--- a/commands.go
+++ b/commands.go
@@ -76,9 +76,9 @@ func init() {
},
"MODE": {
AllowHome: true,
- MinArgs: 2,
+ MinArgs: 1,
MaxArgs: 5, // <channel> <flags> <limit> <user> <ban mask>
- Usage: "<nick/channel> <flags> [args]",
+ Usage: "[<nick/channel>] <flags> [args]",
Desc: "change channel or user modes",
Handle: commandDoMode,
},
@@ -359,6 +359,11 @@ func commandDoNick(app *App, args []string) (err error) {
}
func commandDoMode(app *App, args []string) (err error) {
+ if strings.HasPrefix(args[0], "+") || strings.HasPrefix(args[0], "-") {
+ // if we do eg /MODE +P, automatically insert the current channel: /MODE #<current-chan> +P
+ _, channel := app.win.CurrentBuffer()
+ args = append([]string{channel}, args...)
+ }
channel := args[0]
flags := args[1]
modeArgs := args[2:]