summaryrefslogtreecommitdiff
path: root/commands.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands.go')
-rw-r--r--commands.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/commands.go b/commands.go
index 6a30f5f..a548092 100644
--- a/commands.go
+++ b/commands.go
@@ -121,6 +121,14 @@ func init() {
Desc: "switch to the buffer containing a substring",
Handle: commandDoBuffer,
},
+ "INVITE": {
+ AllowHome: true,
+ MinArgs: 1,
+ MaxArgs: 2,
+ Usage: "<name> [channel]",
+ Desc: "invite someone to a channel",
+ Handle: commandDoInvite,
+ },
}
}
@@ -383,6 +391,18 @@ func commandDoTopic(app *App, args []string) (err error) {
return
}
+func commandDoInvite(app *App, args []string) (err error) {
+ nick := args[0]
+ channel := app.win.CurrentBuffer()
+ if len(args) == 2 {
+ channel = args[1]
+ } else if channel == Home {
+ return fmt.Errorf("cannot invite to home")
+ }
+ app.s.Invite(nick, channel)
+ return nil
+}
+
// implemented from https://golang.org/src/strings/strings.go?s=8055:8085#L310
func fieldsN(s string, n int) []string {
s = strings.TrimSpace(s)