From 5619a75b05f932bd45c8eb7b32b6db5d1dbfaf93 Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 14 Jun 2019 00:42:55 +0200 Subject: [PATCH 1/4] Fix regression in autojoining with legacy tokens (slack). Fixes #651 (#848) --- bridge/slack/legacy.go | 4 +++- bridge/slack/slack.go | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bridge/slack/legacy.go b/bridge/slack/legacy.go index 0c9f5ba4..5c2eca20 100644 --- a/bridge/slack/legacy.go +++ b/bridge/slack/legacy.go @@ -13,7 +13,9 @@ type BLegacy struct { } func NewLegacy(cfg *bridge.Config) bridge.Bridger { - return &BLegacy{Bslack: newBridge(cfg)} + b := &BLegacy{Bslack: newBridge(cfg)} + b.legacy = true + return b } func (b *BLegacy) Connect() error { diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 36b74b99..2aaa2cb1 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -32,6 +32,7 @@ type Bslack struct { channels *channels users *users + legacy bool } const ( @@ -151,6 +152,18 @@ func (b *Bslack) JoinChannel(channel config.ChannelInfo) error { return nil } + // try to join a channel when in legacy + if b.legacy { + _, err := b.sc.JoinChannel(channel.Name) + if err != nil { + switch err.Error() { + case "name_taken", "restricted_action": + case "default": + return err + } + } + } + b.channels.populateChannels(false) channelInfo, err := b.channels.getChannel(channel.Name) @@ -163,7 +176,8 @@ func (b *Bslack) JoinChannel(channel config.ChannelInfo) error { channel.Name = channelInfo.Name } - if !channelInfo.IsMember { + // we can't join a channel unless we are using legacy tokens #651 + if !channelInfo.IsMember && !b.legacy { return fmt.Errorf("slack integration that matterbridge is using is not member of channel '%s', please add it manually", channelInfo.Name) } return nil From 6e8f535e8b60697606dbec78340a955642c7f0a4 Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 14 Jun 2019 00:44:31 +0200 Subject: [PATCH 2/4] Fix logic (xmpp) --- bridge/xmpp/xmpp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go index 586ef183..8257b7de 100644 --- a/bridge/xmpp/xmpp.go +++ b/bridge/xmpp/xmpp.go @@ -332,5 +332,5 @@ func (b *Bxmpp) skipMessage(message xmpp.Chat) bool { } // skip delayed messages - return !message.Stamp.IsZero() || time.Since(message.Stamp).Minutes() > 5 + return !message.Stamp.IsZero() && time.Since(message.Stamp).Minutes() > 5 } From 7a3bb0e55cd7c11807d23024a66faec40d39e20a Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 13 Jun 2019 19:10:43 -0400 Subject: [PATCH 3/4] Verify TLS against JID domain, not the host. (xmpp) (#834) Partially fixes #820. A full fix requires patching https://github.com/matterbridge/go-xmpp to use DNS SRV records. --- bridge/xmpp/xmpp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go index 8257b7de..2376d60c 100644 --- a/bridge/xmpp/xmpp.go +++ b/bridge/xmpp/xmpp.go @@ -100,7 +100,7 @@ func (b *Bxmpp) Send(msg config.Message) (string, error) { func (b *Bxmpp) createXMPP() error { tc := &tls.Config{ - ServerName: strings.Split(b.GetString("Server"), ":")[0], + ServerName: strings.Split(b.GetString("Jid"), "@")[1], InsecureSkipVerify: b.GetBool("SkipTLSVerify"), // nolint: gosec } options := xmpp.Options{ From f06e9b5605ee0bc75314b76059b8f5edd1d73974 Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 14 Jun 2019 01:36:55 +0200 Subject: [PATCH 4/4] Release v1.15.0 --- README.md | 2 +- changelog.md | 28 ++++++++++++++++++++++++++++ matterbridge.go | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bce9f807..a824fc2c 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ See https://github.com/42wim/matterbridge/wiki ## Installing ### Binaries -* Latest stable release [v1.14.4](https://github.com/42wim/matterbridge/releases/latest) +* Latest stable release [v1.15.0](https://github.com/42wim/matterbridge/releases/latest) * Development releases (follows master) can be downloaded [here](https://dl.bintray.com/42wim/nightly/) ### Packages diff --git a/changelog.md b/changelog.md index 1c27beed..4673eba3 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,31 @@ +# v1.15.0 +## New features +* Add scripting (tengo) support for every outgoing message (#806) + See https://github.com/42wim/matterbridge/wiki/Settings#tengo and + https://github.com/42wim/matterbridge/wiki/Settings#outmessage for more information +* Add tengo support to RemoteNickFormat (#793) + See https://github.com/42wim/matterbridge/wiki/Settings#remotenickformat-2 +* Deprecated `Message` under `[tengo]` to `InMessage` + +## Enhancements +* general: Forward only user-typing messages if supported by protocol (#832) +* general: updated wiki with all possible settings: https://github.com/42wim/matterbridge/wiki/Settings +* tengo: Add msg event to tengo +* xmpp: Verify TLS against JID domain, not the host. (xmpp) (#834) +* xmpp: Allow messages with timestamp (xmpp). Fixes #835 (#847) +* irc: Add verbose IRC joins/parts (ident@host) (#805) + See https://github.com/42wim/matterbridge/wiki/Settings#verbosejoinpart +* rocketchat: Add useraction support (rocketchat). Closes #772 (#794) + +## Bugfix +* slack: Fix regression in autojoining with legacy tokens (slack). Fixes #651 (#848) +* xmpp: Revert xmpp to orig behaviour. Closes #844 +* whatsapp: Update github.com/Rhymen/go-whatsapp vendor. Fixes #843 +* mattermost: Update channels of all teams (mattermost) + +This release couldn't exist without the following contributors: +@42wim, @Helcaraxan, @chotaire, @qaisjp, @dajohi, @kousu + # v1.14.4 ## Bugfix diff --git a/matterbridge.go b/matterbridge.go index f4ec96ad..8badefdf 100644 --- a/matterbridge.go +++ b/matterbridge.go @@ -15,7 +15,7 @@ import ( ) var ( - version = "1.15.0-dev" + version = "1.15.0" githash string flagConfig = flag.String("conf", "matterbridge.toml", "config file")