diff --git a/README.md b/README.md index aa30ed60..ded6e763 100644 --- a/README.md +++ b/README.md @@ -129,9 +129,10 @@ Search Scrollback ``` -/msg mattermost scrollback -e.g. /msg mattermost scrollback #bugs 100 shows the last 100 messages of #bugs +/msg mattermost scrollback #|| ``` +e.g. `/msg mattermost scrollback #bugs 100` shows the last 100 messages of *#bugs* +e.g. `/msg mattermost scrollback zdofdf1nctgsj87xgt6oco1a3w 0` shows all messages from the thread with root/parent *zdofdf1nctgsj87xgt6oco1a3w* Mark messages in a channel/from a user as read (when DisableAutoView is set). ``` diff --git a/matterircd.toml.example b/matterircd.toml.example index a95230c4..36023b8f 100644 --- a/matterircd.toml.example +++ b/matterircd.toml.example @@ -65,6 +65,10 @@ Insecure = false # #JoinOnly = ["#onlythischannel"] +# When set, all scrollback messages are shown in &messages rather than individual channels +# +#CollapseScrollback = false + #an array of channels that won't be joined on IRC. #regexp is supported #Messages that get sent to unjoined channels (but you're joined on mattermost) will diff --git a/mm-go-irckit/service.go b/mm-go-irckit/service.go index a5ecb79c..13c58364 100644 --- a/mm-go-irckit/service.go +++ b/mm-go-irckit/service.go @@ -416,13 +416,25 @@ func scrollback(u *User, toUser *User, args []string, service string) { } } - u.MsgUser(toUser, fmt.Sprintf("scrollback results shown in %s", search)) + if !u.v.GetBool(u.br.Protocol() + ".collapsescrollback") { //nolint:goconst + u.MsgUser(toUser, fmt.Sprintf("scrollback results shown in %s", search)) + } } func formatScrollbackMsg(u *User, channelID string, channel string, user *User, nick string, p *model.Post, msgText string) { ts := time.Unix(0, p.CreateAt*int64(time.Millisecond)) switch { + case (u.v.GetBool(u.br.Protocol()+".collapsescrollback") && strings.HasPrefix(channel, "#")): + threadMsgID := u.prefixContext(channelID, p.Id, p.RootId, "scrollback") + msg := u.formatContextMessage(ts.Format("2006-01-02 15:04"), threadMsgID, msgText) + nick += "/" + channel + u.Srv.Channel("&messages").SpoofMessage(nick, msg) + case u.v.GetBool(u.br.Protocol() + ".collapsescrollback"): + threadMsgID := u.prefixContext(channelID, p.Id, p.RootId, "scrollback") + msg := u.formatContextMessage(ts.Format("2006-01-02 15:04"), threadMsgID, msgText) + nick += "/" + channel + u.Srv.Channel("&messages").SpoofMessage(nick, msg) case (u.v.GetBool(u.br.Protocol()+".prefixcontext") || u.v.GetBool(u.br.Protocol()+".suffixcontext")) && strings.HasPrefix(channel, "#") && nick != systemUser: threadMsgID := u.prefixContext(channelID, p.Id, p.RootId, "scrollback") msg := u.formatContextMessage(ts.Format("2006-01-02 15:04"), threadMsgID, msgText)