Thumbnail

rani/matterbridge.git

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

commit 4366ce620e1abb5b15c0135bb57425ece1669ff8 Author: selfhoster1312 <selfhoster1312@kl.netlib.re> Date: Mon Sep 08 18:14:06 2025 +0000 meta: go fmt ./... diff --git a/bridge/matrix/helpers.go b/bridge/matrix/helpers.go index 5a91f74..6ad1fbe 100644 --- a/bridge/matrix/helpers.go +++ b/bridge/matrix/helpers.go @@ -1236 +1237 @@ func (b *Bmatrix) cacheDisplayName(mxid string, displayName string) string {  }    // handleError converts errors into httpError. +//  //nolint:exhaustivestruct  func handleError(err error) *httpError {   var mErr matrix.HTTPError diff --git a/bridge/slack/handlers.go b/bridge/slack/handlers.go index 2424442..3ddacfd 100644 --- a/bridge/slack/handlers.go +++ b/bridge/slack/handlers.go @@ -18919 +18919 @@ func (b *Bslack) filesCached(files []slack.File) bool {  // handleMessageEvent handles the message events. Together with any called sub-methods,  // this method implements the following event processing pipeline:  // -// 1. Check if the message should be ignored. -// NOTE: This is not actually part of the method below but is done just before it -// is called via the 'skipMessageEvent()' method. -// 2. Populate the Matterbridge message that will be sent to the router based on the -// received event and logic that is common to all events that are not skipped. -// 3. Detect and handle any message that is "status" related (think join channel, etc.). -// This might result in an early exit from the pipeline and passing of the -// pre-populated message to the Matterbridge router. -// 4. Handle the specific case of messages that edit existing messages depending on -// configuration. -// 5. Handle any attachments of the received event. -// 6. Check that the Matterbridge message that we end up with after at the end of the -// pipeline is valid before sending it to the Matterbridge router. +// 1. Check if the message should be ignored. +// NOTE: This is not actually part of the method below but is done just before it +// is called via the 'skipMessageEvent()' method. +// 2. Populate the Matterbridge message that will be sent to the router based on the +// received event and logic that is common to all events that are not skipped. +// 3. Detect and handle any message that is "status" related (think join channel, etc.). +// This might result in an early exit from the pipeline and passing of the +// pre-populated message to the Matterbridge router. +// 4. Handle the specific case of messages that edit existing messages depending on +// configuration. +// 5. Handle any attachments of the received event. +// 6. Check that the Matterbridge message that we end up with after at the end of the +// pipeline is valid before sending it to the Matterbridge router.  func (b *Bslack) handleMessageEvent(ev *slack.MessageEvent) (*config.Message, error) {   rmsg, err := b.populateReceivedMessage(ev)   if err != nil { diff --git a/gateway/bridgemap/api.go b/gateway/bridgemap/api.go index a8b6e61..b602811 100644 --- a/gateway/bridgemap/api.go +++ b/gateway/bridgemap/api.go @@ -13 +14 @@ +//go:build !noapi  // +build !noapi    package bridgemap diff --git a/gateway/bridgemap/bdiscord.go b/gateway/bridgemap/bdiscord.go index 92b14ac..81c4ff7 100644 --- a/gateway/bridgemap/bdiscord.go +++ b/gateway/bridgemap/bdiscord.go @@ -13 +14 @@ +//go:build !nodiscord  // +build !nodiscord    package bridgemap diff --git a/gateway/bridgemap/birc.go b/gateway/bridgemap/birc.go index 9e2bc33..9ce2eba 100644 --- a/gateway/bridgemap/birc.go +++ b/gateway/bridgemap/birc.go @@ -13 +14 @@ +//go:build !noirc  // +build !noirc    package bridgemap diff --git a/gateway/bridgemap/bkeybase.go b/gateway/bridgemap/bkeybase.go index 5dcdcda..92ff894 100644 --- a/gateway/bridgemap/bkeybase.go +++ b/gateway/bridgemap/bkeybase.go @@ -13 +14 @@ +//go:build !nokeybase  // +build !nokeybase    package bridgemap diff --git a/gateway/bridgemap/bmatrix.go b/gateway/bridgemap/bmatrix.go index e1d761e..9b299f7 100644 --- a/gateway/bridgemap/bmatrix.go +++ b/gateway/bridgemap/bmatrix.go @@ -13 +14 @@ +//go:build !nomatrix  // +build !nomatrix    package bridgemap diff --git a/gateway/bridgemap/bmattermost.go b/gateway/bridgemap/bmattermost.go index 3f0f044..8a80e32 100644 --- a/gateway/bridgemap/bmattermost.go +++ b/gateway/bridgemap/bmattermost.go @@ -13 +14 @@ +//go:build !nomattermost  // +build !nomattermost    package bridgemap diff --git a/gateway/bridgemap/bmsteams.go b/gateway/bridgemap/bmsteams.go index 56da211..e43c1d9 100644 --- a/gateway/bridgemap/bmsteams.go +++ b/gateway/bridgemap/bmsteams.go @@ -13 +14 @@ +//go:build !nomsteams  // +build !nomsteams    package bridgemap diff --git a/gateway/bridgemap/bmumble.go b/gateway/bridgemap/bmumble.go index 7b9241f..2b9c93b 100644 --- a/gateway/bridgemap/bmumble.go +++ b/gateway/bridgemap/bmumble.go @@ -13 +14 @@ +//go:build !nomumble  // +build !nomumble    package bridgemap diff --git a/gateway/bridgemap/bnctalk.go b/gateway/bridgemap/bnctalk.go index c194392..b675725 100644 --- a/gateway/bridgemap/bnctalk.go +++ b/gateway/bridgemap/bnctalk.go @@ -13 +14 @@ +//go:build !nonctalk  // +build !nonctalk    package bridgemap diff --git a/gateway/bridgemap/brocketchat.go b/gateway/bridgemap/brocketchat.go index 6af4e8d..ad173a4 100644 --- a/gateway/bridgemap/brocketchat.go +++ b/gateway/bridgemap/brocketchat.go @@ -13 +14 @@ +//go:build !norocketchat  // +build !norocketchat    package bridgemap diff --git a/gateway/bridgemap/bslack.go b/gateway/bridgemap/bslack.go index fdea80c..a4dd6a5 100644 --- a/gateway/bridgemap/bslack.go +++ b/gateway/bridgemap/bslack.go @@ -13 +14 @@ +//go:build !noslack  // +build !noslack    package bridgemap diff --git a/gateway/bridgemap/bsshchat.go b/gateway/bridgemap/bsshchat.go index 14d4228..650c2a6 100644 --- a/gateway/bridgemap/bsshchat.go +++ b/gateway/bridgemap/bsshchat.go @@ -13 +14 @@ +//go:build !nosshchat  // +build !nosshchat    package bridgemap diff --git a/gateway/bridgemap/bsteam.go b/gateway/bridgemap/bsteam.go index c265473..706e626 100644 --- a/gateway/bridgemap/bsteam.go +++ b/gateway/bridgemap/bsteam.go @@ -13 +14 @@ +//go:build !nosteam  // +build !nosteam    package bridgemap diff --git a/gateway/bridgemap/btelegram.go b/gateway/bridgemap/btelegram.go index ec0bbe6..dbff2bc 100644 --- a/gateway/bridgemap/btelegram.go +++ b/gateway/bridgemap/btelegram.go @@ -13 +14 @@ +//go:build !notelegram  // +build !notelegram    package bridgemap diff --git a/gateway/bridgemap/bvk.go b/gateway/bridgemap/bvk.go index ea3de19..f049622 100644 --- a/gateway/bridgemap/bvk.go +++ b/gateway/bridgemap/bvk.go @@ -13 +14 @@ +//go:build !novk  // +build !novk    package bridgemap diff --git a/gateway/bridgemap/bwhatsapp.go b/gateway/bridgemap/bwhatsapp.go index e7b72b0..d808c81 100644 --- a/gateway/bridgemap/bwhatsapp.go +++ b/gateway/bridgemap/bwhatsapp.go @@ -15 +15 @@ -// +build !nowhatsapp -// +build !whatsappmulti +//go:build !nowhatsapp && !whatsappmulti +// +build !nowhatsapp,!whatsappmulti    package bridgemap   diff --git a/gateway/bridgemap/bwhatsappmulti.go b/gateway/bridgemap/bwhatsappmulti.go index 055c6da..2e098e2 100644 --- a/gateway/bridgemap/bwhatsappmulti.go +++ b/gateway/bridgemap/bwhatsappmulti.go @@ -13 +14 @@ +//go:build whatsappmulti  // +build whatsappmulti    package bridgemap diff --git a/gateway/bridgemap/bxmpp.go b/gateway/bridgemap/bxmpp.go index 6988a7d..aa60938 100644 --- a/gateway/bridgemap/bxmpp.go +++ b/gateway/bridgemap/bxmpp.go @@ -13 +14 @@ +//go:build !noxmpp  // +build !noxmpp    package bridgemap diff --git a/gateway/bridgemap/bzulip.go b/gateway/bridgemap/bzulip.go index 967f0dd..f3105c6 100644 --- a/gateway/bridgemap/bzulip.go +++ b/gateway/bridgemap/bzulip.go @@ -13 +14 @@ +//go:build !nozulip  // +build !nozulip    package bridgemap diff --git a/internal/bindata.go b/internal/bindata.go index 6529571..6ea509a 100644 --- a/internal/bindata.go +++ b/internal/bindata.go @@ -47 +46 @@    package internal   -  import (   "bytes"   "compress/gzip" @@ -377 +366 @@ func bindataRead(data []byte, name string) ([]byte, error) {   return buf.Bytes(), nil  }   -  type asset struct {   bytes []byte   info fileInfoEx @@ -8017 +7817 @@ func (fi bindataFileInfo) Sys() interface{} {    var _bindataTengoOutmessagetengo = []byte(   "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x91\x3d\x8f\xda\x40\x10\x86\xfb\xfd\x15\x13\x37\xb1\x2d\x07\xe7\xa3" + - "\xb3\x64\x59\x11\x45\x94\x2e\x8a\x92\x0a\xd0\xb1\xac\x07\x33\xd2\x7a\xc7\x1a\x8f\x31\x88\xe3\xbf\x9f\xcc\x01\x47" + - "\x7f\xc5\x75\xef\xae\x9e\x9d\x77\x1f\x4d\x9e\x9a\xbd\x15\xb2\x1b\x8f\x3d\xd8\xbd\x25\x3f\x45\x30\x82\xb6\xfe\xc2" + - "\xc1\x1f\x0b\x43\xe1\xa7\x73\x3c\x04\xcd\x80\xc2\x1f\x61\x65\xc7\x7e\xca\xf3\x9d\x0d\x01\x2f\xf1\x97\x55\x1c\xed" + - "\xd1\xf0\xa0\x77\x98\x07\x7d\xa3\x79\xd0\x3b\xce\x83\xde\xf8\xd7\x9e\x51\x48\xb1\x30\x6d\xdf\xfc\xc3\x83\x66\xd0" + - "\xf6\xcd\xff\x1e\x25\xd8\x16\x4d\x9a\x1b\xa3\x78\x50\x28\x4a\xa0\xb6\x63\xd1\x38\x9a\xce\x51\x62\x4c\x9e\x43\xaf" + - "\x42\x1d\x90\x38\x70\xec\x59\xfa\xe9\x8e\xb6\x30\xe2\x67\x41\x08\xac\xd0\x63\xa8\x29\x34\xa0\x0c\x36\x5c\xc0\x8d" + - "\x50\xdd\x20\x8c\x78\x7d\xac\x3b\x84\xdf\x7f\xe7\xb7\x01\xb4\x7d\xd0\x84\xb2\x84\x88\xc4\x45\x70\x32\x00\x00\x82" + - "\xd3\x3f\xa6\xfe\x99\xe0\x93\xe3\xb6\x23\x8f\xf1\x7a\x79\xf8\xfa\x23\xae\x8a\x65\x7d\xfa\x96\x7d\x3f\xc7\x55\x91" + - "\x5d\x63\x52\x25\xd5\xf3\x62\x51\xb8\xa0\xe2\x8b\xd5\x6a\x9d\x5c\xc6\x5c\x4d\x4b\xc1\x99\x60\xe7\xad\xc3\xf8\x26" + - "\x1f\x45\x89\x39\x9b\xf7\x6b\xe4\x29\x6d\x1f\x57\x00\x9f\x3e\xc6\x24\xcd\xcd\x4b\x00\x00\x00\xff\xff\x40\xb8\x54" + - "\xb8\x64\x02\x00\x00") + "\xb3\x64\x59\x11\x45\x94\x2e\x8a\x92\x0a\xd0\xb1\xac\x07\x33\xd2\x7a\xc7\x1a\x8f\x31\x88\xe3\xbf\x9f\xcc\x01\x47" + + "\x7f\xc5\x75\xef\xae\x9e\x9d\x77\x1f\x4d\x9e\x9a\xbd\x15\xb2\x1b\x8f\x3d\xd8\xbd\x25\x3f\x45\x30\x82\xb6\xfe\xc2" + + "\xc1\x1f\x0b\x43\xe1\xa7\x73\x3c\x04\xcd\x80\xc2\x1f\x61\x65\xc7\x7e\xca\xf3\x9d\x0d\x01\x2f\xf1\x97\x55\x1c\xed" + + "\xd1\xf0\xa0\x77\x98\x07\x7d\xa3\x79\xd0\x3b\xce\x83\xde\xf8\xd7\x9e\x51\x48\xb1\x30\x6d\xdf\xfc\xc3\x83\x66\xd0" + + "\xf6\xcd\xff\x1e\x25\xd8\x16\x4d\x9a\x1b\xa3\x78\x50\x28\x4a\xa0\xb6\x63\xd1\x38\x9a\xce\x51\x62\x4c\x9e\x43\xaf" + + "\x42\x1d\x90\x38\x70\xec\x59\xfa\xe9\x8e\xb6\x30\xe2\x67\x41\x08\xac\xd0\x63\xa8\x29\x34\xa0\x0c\x36\x5c\xc0\x8d" + + "\x50\xdd\x20\x8c\x78\x7d\xac\x3b\x84\xdf\x7f\xe7\xb7\x01\xb4\x7d\xd0\x84\xb2\x84\x88\xc4\x45\x70\x32\x00\x00\x82" + + "\xd3\x3f\xa6\xfe\x99\xe0\x93\xe3\xb6\x23\x8f\xf1\x7a\x79\xf8\xfa\x23\xae\x8a\x65\x7d\xfa\x96\x7d\x3f\xc7\x55\x91" + + "\x5d\x63\x52\x25\xd5\xf3\x62\x51\xb8\xa0\xe2\x8b\xd5\x6a\x9d\x5c\xc6\x5c\x4d\x4b\xc1\x99\x60\xe7\xad\xc3\xf8\x26" + + "\x1f\x45\x89\x39\x9b\xf7\x6b\xe4\x29\x6d\x1f\x57\x00\x9f\x3e\xc6\x24\xcd\xcd\x4b\x00\x00\x00\xff\xff\x40\xb8\x54" + + "\xb8\x64\x02\x00\x00")    func bindataTengoOutmessagetengoBytes() ([]byte, error) {   return bindataRead( @@ -998 +976 @@ func bindataTengoOutmessagetengoBytes() ([]byte, error) {   )  }   - -  func bindataTengoOutmessagetengo() (*asset, error) {   bytes, err := bindataTengoOutmessagetengoBytes()   if err != nil { @@ -10811 +10411 @@ func bindataTengoOutmessagetengo() (*asset, error) {   }     info := bindataFileInfo{ - name: "tengo/outmessage.tengo", - size: 612, + name: "tengo/outmessage.tengo", + size: 612,   md5checksum: "", - mode: os.FileMode(420), - modTime: time.Unix(1555622139, 0), + mode: os.FileMode(420), + modTime: time.Unix(1555622139, 0),   }     a := &asset{bytes: bytes, info: info} @@ -12012 +1169 @@ func bindataTengoOutmessagetengo() (*asset, error) {   return a, nil  }   - -//  // Asset loads and returns the asset for the given name.  // It returns an error if the asset could not be found or  // could not be loaded. -//  func Asset(name string) ([]byte, error) {   cannonicalName := strings.Replace(name, "\\", "/", -1)   if f, ok := _bindata[cannonicalName]; ok { @@ -13811 +1319 @@ func Asset(name string) ([]byte, error) {   return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}  }   -//  // MustAsset is like Asset but panics when Asset would return an error.  // It simplifies safe initialization of global variables.  // nolint: deadcode -//  func MustAsset(name string) []byte {   a, err := Asset(name)   if err != nil { @@ -15210 +1438 @@ func MustAsset(name string) []byte {   return a  }   -//  // AssetInfo loads and returns the asset info for the given name.  // It returns an error if the asset could not be found or could not be loaded. -//  func AssetInfo(name string) (os.FileInfo, error) {   cannonicalName := strings.Replace(name, "\\", "/", -1)   if f, ok := _bindata[cannonicalName]; ok { @@ -16810 +1578 @@ func AssetInfo(name string) (os.FileInfo, error) {   return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}  }   -//  // AssetNames returns the names of the assets.  // nolint: deadcode -//  func AssetNames() []string {   names := make([]string, 0, len(_bindata))   for name := range _bindata { @@ -18028 +16726 @@ func AssetNames() []string {   return names  }   -//  // _bindata is a table, holding each asset generator, mapped to its name. -//  var _bindata = map[string]func() (*asset, error){   "tengo/outmessage.tengo": bindataTengoOutmessagetengo,  }   -//  // AssetDir returns the file names below a certain  // directory embedded in the file by go-bindata.  // For example if you run go-bindata on data/... and data contains the  // following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png +// +// data/ +// foo.txt +// img/ +// a.png +// b.png +//  // then AssetDir("data") would return []string{"foo.txt", "img"}  // AssetDir("data/img") would return []string{"a.png", "b.png"}  // AssetDir("foo.txt") and AssetDir("notexist") would return an error  // AssetDir("") will return []string{"data"}. -//  func AssetDir(name string) ([]string, error) {   node := _bintree   if len(name) != 0 { @@ -21118 +19618 @@ func AssetDir(name string) ([]string, error) {   node = node.Children[p]   if node == nil {   return nil, &os.PathError{ - Op: "open", + Op: "open",   Path: name, - Err: os.ErrNotExist, + Err: os.ErrNotExist,   }   }   }   }   if node.Func != nil {   return nil, &os.PathError{ - Op: "open", + Op: "open",   Path: name, - Err: os.ErrNotExist, + Err: os.ErrNotExist,   }   }   rv := make([]string, 0, len(node.Children)) @@ -2327 +2176 @@ func AssetDir(name string) ([]string, error) {   return rv, nil  }   -  type bintree struct {   Func func() (*asset, error)   Children map[string]*bintree diff --git a/matterhook/matterhook.go b/matterhook/matterhook.go index 6b03643..b989d25 100644 --- a/matterhook/matterhook.go +++ b/matterhook/matterhook.go @@ -14 +14 @@ -//Package matterhook provides interaction with mattermost incoming/outgoing webhooks +// Package matterhook provides interaction with mattermost incoming/outgoing webhooks  package matterhook    import (