diff options
Diffstat (limited to '')
-rw-r--r-- | commands.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/commands.go b/commands.go index 10ae19e..03e999a 100644 --- a/commands.go +++ b/commands.go @@ -167,6 +167,13 @@ func init() { Desc: "remove effect of a ban from the user", Handle: commandDoUnban, }, + "SEARCH": { + AllowHome: true, + MaxArgs: 1, + Usage: "<text>", + Desc: "searches messages in a target", + Handle: commandDoSearch, + }, } } @@ -579,6 +586,21 @@ func commandDoUnban(app *App, args []string) (err error) { return nil } +func commandDoSearch(app *App, args []string) (err error) { + if len(args) == 0 { + app.win.CloseOverlay() + return nil + } + text := args[0] + netID, channel := app.win.CurrentBuffer() + s := app.sessions[netID] + if s == nil { + return errOffline + } + s.Search(channel, text) + 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) |