diff options
author | msglm <msglm@techchud.xyz> | 2023-10-27 07:08:25 -0500 |
---|---|---|
committer | msglm <msglm@techchud.xyz> | 2023-10-27 07:08:25 -0500 |
commit | 032a7e0c1188d3507b8d9a9571f2446a43cf775b (patch) | |
tree | 2bd38c01bc7761a6195e426082ce7191ebc765a1 /gateway | |
parent | 56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 (diff) | |
download | matterbridge-msglm-032a7e0c1188d3507b8d9a9571f2446a43cf775b.tar.gz matterbridge-msglm-032a7e0c1188d3507b8d9a9571f2446a43cf775b.tar.bz2 matterbridge-msglm-032a7e0c1188d3507b8d9a9571f2446a43cf775b.zip |
apply https://github.com/42wim/matterbridge/pull/1864v1.26.0+0.1.0
Diffstat (limited to 'gateway')
-rw-r--r-- | gateway/bridgemap/bmatrix.go | 1 | ||||
-rw-r--r-- | gateway/gateway.go | 5 | ||||
-rw-r--r-- | gateway/router.go | 15 |
3 files changed, 17 insertions, 4 deletions
diff --git a/gateway/bridgemap/bmatrix.go b/gateway/bridgemap/bmatrix.go index e1d761eb..2b0510bb 100644 --- a/gateway/bridgemap/bmatrix.go +++ b/gateway/bridgemap/bmatrix.go @@ -8,4 +8,5 @@ import ( func init() { FullMap["matrix"] = bmatrix.New + UserTypingSupport["matrix"] = struct{}{} } diff --git a/gateway/gateway.go b/gateway/gateway.go index a2d572be..04f0f117 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -323,11 +323,12 @@ func (gw *Gateway) ignoreFilesComment(extra map[string][]interface{}, igMessages return false } -func (gw *Gateway) modifyUsername(msg *config.Message, dest *bridge.Bridge) string { +func (gw *Gateway) ModifyUsername(msg *config.Message, dest *bridge.Bridge) string { if dest.GetBool("StripNick") { re := regexp.MustCompile("[^a-zA-Z0-9]+") msg.Username = re.ReplaceAllString(msg.Username, "") } + nick := dest.GetString("RemoteNickFormat") // loop to replace nicks @@ -462,7 +463,7 @@ func (gw *Gateway) SendMessage( msg.Channel = channel.Name msg.Avatar = gw.modifyAvatar(rmsg, dest) - msg.Username = gw.modifyUsername(rmsg, dest) + msg.Username = gw.ModifyUsername(rmsg, dest) // exclude file delete event as the msg ID here is the native file ID that needs to be deleted if msg.Event != config.EventFileDelete { diff --git a/gateway/router.go b/gateway/router.go index a0d5f402..d7df1225 100644 --- a/gateway/router.go +++ b/gateway/router.go @@ -75,7 +75,7 @@ func (r *Router) Start() error { r.logger.Infof("Starting bridge: %s ", br.Account) err := br.Connect() if err != nil { - e := fmt.Errorf("Bridge %s failed to start: %v", br.Account, err) + e := fmt.Errorf("bridge %s failed to initialize: %v", br.Account, err) if r.disableBridge(br, e) { continue } @@ -83,12 +83,23 @@ func (r *Router) Start() error { } err = br.JoinChannels() if err != nil { - e := fmt.Errorf("Bridge %s failed to join channel: %v", br.Account, err) + e := fmt.Errorf("bridge %s failed to join channel: %v", br.Account, err) if r.disableBridge(br, e) { continue } return e } + + if starter, ok := br.Bridger.(bridge.BridgerWithChannelDependency); ok { + err = starter.Start() + if err != nil { + e := fmt.Errorf("bridge %s failed to start: %v", br.Account, err) + if r.disableBridge(br, e) { + continue + } + return e + } + } } // remove unused bridges for _, gw := range r.Gateways { |