diff options
-rw-r--r-- | commands.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/commands.go b/commands.go index 4e534c1..701fe4b 100644 --- a/commands.go +++ b/commands.go @@ -89,6 +89,14 @@ func init() { Desc: "part a channel", Handle: commandDoPart, }, + "QUERY": { + AllowHome: true, + MinArgs: 1, + MaxArgs: 1, + Usage: "[nick]", + Desc: "opens a buffer to a user", + Handle: commandDoQuery, + }, "QUIT": { AllowHome: true, MaxArgs: 1, @@ -410,6 +418,18 @@ func commandDoPart(app *App, args []string) (err error) { return nil } +func commandDoQuery(app *App, args []string) (err error) { + netID, _ := app.win.CurrentBuffer() + s := app.sessions[netID] + target := args[0] + if s.IsChannel(target) { + return fmt.Errorf("cannot query a channel, use JOIN instead") + } + i, _ := app.win.AddBuffer(netID, "", target) + app.win.JumpBufferIndex(i) + return nil +} + func commandDoQuit(app *App, args []string) (err error) { reason := "" if 0 < len(args) { |