Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 04faee0f2f1191ea63d87d82247250534e51c4af Author: patrickxia <octalc0de@aim.com> Date: Thu May 23 18:05:55 2024 +0000 Do not bridge CTCP commands other than ACTION (irc) (#2090) CTCP commands other than ACTION are designed for client-to-client interaction on IRC networks. Drop such messages when we receive them. Also get rid of a "CTCP_ACTION" handler in the handler registration. This 1) can't do anything (if anything, we wanted the string constant girc.CTCP_ACTION, which is "ACTION") 2) doesn't do anything in this context, because CTCP handlers are registered separately: https://github.com/lrstanley/girc/blob/f47717952bf9258e02eac14f1b9723bcf084e618/ctcp.go#L205 The PRIVMSG handler already listens to all CTCPs. Thanks to @lexande for the bug report (found on a live instance). diff --git a/bridge/irc/handlers.go b/bridge/irc/handlers.go index e5aa1fc..cb2cc85 100644 --- a/bridge/irc/handlers.go +++ b/bridge/irc/handlers.go @@ -1347 +1346 @@ func (b *Birc) handleNewConnection(client *girc.Client, event girc.Event) {   i.Handlers.Clear("INVITE")     i.Handlers.AddBg("PRIVMSG", b.handlePrivMsg) - i.Handlers.AddBg("CTCP_ACTION", b.handlePrivMsg)   i.Handlers.Add(girc.RPL_TOPICWHOTIME, b.handleTopicWhoTime)   i.Handlers.AddBg(girc.NOTICE, b.handleNotice)   i.Handlers.AddBg("JOIN", b.handleJoinPart) @@ -2067 +20511 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) {   b.Log.Debugf("== Receiving PRIVMSG: %s %s %#v", event.Source.Name, event.Last(), event)     // set action event - if event.IsAction() { + if ok, ctcp := event.IsCTCP(); ok { + if ctcp.Command != girc.CTCP_ACTION { + b.Log.Debugf("dropping user ctcp, command: %s", ctcp.Command) + return + }   rmsg.Event = config.EventUserAction   }