From 87255ab944a8a37436ba53f3d84f730f564da827 Mon Sep 17 00:00:00 2001 From: Haw Loeung Date: Fri, 8 Sep 2023 15:29:34 +1000 Subject: [PATCH] Add missing event to prefixContext() calls for easier debugging --- mm-go-irckit/server_commands.go | 6 +++--- mm-go-irckit/service.go | 8 ++++---- mm-go-irckit/userbridge.go | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mm-go-irckit/server_commands.go b/mm-go-irckit/server_commands.go index 0c33e8b8..08a1c535 100644 --- a/mm-go-irckit/server_commands.go +++ b/mm-go-irckit/server_commands.go @@ -402,7 +402,7 @@ func CmdPrivMsg(s Server, u *User, msg *irc.Message) error { u.saveLastViewedAt(ch.ID()) if u.v.GetBool(u.br.Protocol()+".prefixcontext") || u.v.GetBool(u.br.Protocol()+".suffixcontext") { - u.prefixContext(ch.ID(), msgID, "", "") + u.prefixContext(ch.ID(), msgID, "", "posted_self") } return nil @@ -447,7 +447,7 @@ func CmdPrivMsg(s Server, u *User, msg *irc.Message) error { u.saveLastViewedAt(toUser.User) if u.v.GetBool(u.br.Protocol()+".prefixcontext") || u.v.GetBool(u.br.Protocol()+".suffixcontext") { - u.prefixContext(toUser.User, msgID, "", "") + u.prefixContext(toUser.User, msgID, "", "posted_self") } default: @@ -662,7 +662,7 @@ func threadMsgChannelUser(u *User, msg *irc.Message, channelID string, toUser bo u.saveLastViewedAt(channelID) if u.v.GetBool(u.br.Protocol()+".prefixcontext") || u.v.GetBool(u.br.Protocol()+".suffixcontext") { - u.prefixContext(channelID, msgID, "", "") + u.prefixContext(channelID, msgID, threadID, "posted_self") } return true diff --git a/mm-go-irckit/service.go b/mm-go-irckit/service.go index 4acceaa0..974602ea 100644 --- a/mm-go-irckit/service.go +++ b/mm-go-irckit/service.go @@ -341,14 +341,14 @@ func scrollback(u *User, toUser *User, args []string, service string) { for _, post := range strings.Split(p.Message, "\n") { switch { // nolint:dupl case (u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost" || u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost+post") && strings.HasPrefix(args[0], "#") && nick != "system": - threadMsgID := u.prefixContext("", p.Id, p.RootId, "") + threadMsgID := u.prefixContext("", p.Id, p.RootId, "scrollback") scrollbackMsg := u.formatContextMessage(ts.Format("2006-01-02 15:04"), threadMsgID, post) spoof(nick, scrollbackMsg) case strings.HasPrefix(args[0], "#"): scrollbackMsg := "[" + ts.Format("2006-01-02 15:04") + "] " + post spoof(nick, scrollbackMsg) case u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost" || u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost+post": - threadMsgID := u.prefixContext("", p.Id, p.RootId, "") + threadMsgID := u.prefixContext("", p.Id, p.RootId, "scrollback") scrollbackMsg := u.formatContextMessage(ts.Format("2006-01-02 15:04"), threadMsgID, post) u.MsgSpoofUser(scrollbackUser, nick, scrollbackMsg) default: @@ -365,11 +365,11 @@ func scrollback(u *User, toUser *User, args []string, service string) { fileMsg := "download file - " + fname switch { // nolint:dupl case (u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost" || u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost+post") && strings.HasPrefix(args[0], "#"): - threadMsgID := u.prefixContext("", p.Id, p.RootId, "") + threadMsgID := u.prefixContext("", p.Id, p.RootId, "scrollback_file") scrollbackMsg := u.formatContextMessage(ts.Format("2006-01-02 15:04"), threadMsgID, fileMsg) spoof(nick, scrollbackMsg) case u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost" || u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost+post": - threadMsgID := u.prefixContext("", p.Id, p.RootId, "") + threadMsgID := u.prefixContext("", p.Id, p.RootId, "scrollback_file") scrollbackMsg := u.formatContextMessage(ts.Format("2006-01-02 15:04"), threadMsgID, fileMsg) u.MsgSpoofUser(scrollbackUser, nick, scrollbackMsg) case strings.HasPrefix(args[0], "#"): diff --git a/mm-go-irckit/userbridge.go b/mm-go-irckit/userbridge.go index a27a0746..3119d35a 100644 --- a/mm-go-irckit/userbridge.go +++ b/mm-go-irckit/userbridge.go @@ -323,7 +323,7 @@ func (u *User) handleFileEvent(event *bridge.FileEvent) { for _, fname := range event.Files { fileMsg := "download file - " + fname.Name if u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost" || u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost+post" { - threadMsgID := u.prefixContext(event.ChannelID, event.MessageID, event.ParentID, "") + threadMsgID := u.prefixContext(event.ChannelID, event.MessageID, event.ParentID, "posted_file") fileMsg = u.formatContextMessage("", threadMsgID, fileMsg) } @@ -716,7 +716,7 @@ func (u *User) addUserToChannelWorker(channels <-chan *bridge.ChannelInfo, throt replayMsg := fmt.Sprintf("[%s] %s", ts.Format("15:04"), post) if (u.v.GetBool(u.br.Protocol()+".prefixcontext") || u.v.GetBool(u.br.Protocol()+".suffixcontext")) && (u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost" || u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost+post") && nick != systemUser { - threadMsgID := u.prefixContext("", p.Id, p.RootId, "") + threadMsgID := u.prefixContext("", p.Id, p.RootId, "replay") replayMsg = u.formatContextMessage(ts.Format("15:04"), threadMsgID, post) } spoof(nick, replayMsg) @@ -729,7 +729,7 @@ func (u *User) addUserToChannelWorker(channels <-chan *bridge.ChannelInfo, throt for _, fname := range u.br.GetFileLinks(p.FileIds) { fileMsg := "download file - " + fname if u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost" || u.v.GetString(u.br.Protocol()+".threadcontext") == "mattermost+post" { - threadMsgID := u.prefixContext("", p.Id, p.RootId, "") + threadMsgID := u.prefixContext("", p.Id, p.RootId, "replay_file") fileMsg = u.formatContextMessage(ts.Format("15:04"), threadMsgID, fileMsg) } spoof(nick, fileMsg)