4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 18:59:24 +00:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Wim
681e9bd269 Release 0.8.1 2016-11-20 17:34:26 +01:00
Wim
b3c11b584f Update documentation. Prepare release 2016-11-20 17:33:36 +01:00
Wim
07a560b2f5 Remove callbacks after being called. Fixes #88 (irc) 2016-11-20 17:21:21 +01:00
Wim
02bd136040 Fix !users command for irc. Closes #78. 2016-11-14 00:11:54 +01:00
Wim
2d1316e32c Remove double username modify. Fixes #77 2016-11-13 23:50:25 +01:00
Wim
11def2edc0 Update documentation 2016-11-12 23:09:57 +01:00
Wim
65bffb8735 Release v0.8.0 2016-11-12 22:39:53 +01:00
5 changed files with 20 additions and 35 deletions

View File

@ -30,17 +30,16 @@ docker run -ti -v /tmp/matterbridge.toml:/matterbridge.toml 42wim/matterbridge
## binaries ## binaries
Binaries can be found [here] (https://github.com/42wim/matterbridge/releases/) Binaries can be found [here] (https://github.com/42wim/matterbridge/releases/)
* For use with mattermost 3.5.0+ [v0.8.0](https://github.com/42wim/matterircd/releases/tag/v0.8.0) * For use with mattermost 3.5.0+ [v0.8.1](https://github.com/42wim/matterircd/releases/tag/v0.8.1)
* For use with mattermost 3.3.0 - 3.4.0 [v0.7.0](https://github.com/42wim/matterircd/releases/tag/v0.7.0) * For use with mattermost 3.3.0 - 3.4.0 [v0.7.1](https://github.com/42wim/matterircd/releases/tag/v0.7.1)
* For use with mattermost 3.0.0 - 3.2.0 [v0.5.0](https://github.com/42wim/matterircd/releases/tag/v0.5.0) (not maintained anymore) * For use with mattermost 3.0.0 - 3.2.0 [v0.5.0](https://github.com/42wim/matterircd/releases/tag/v0.5.0) (not maintained anymore)
## Compatibility ## Compatibility
### Mattermost ### Mattermost
* Matterbridge v0.8.0 works with mattermost 3.5.0+ [3.5.0 release](https://github.com/mattermost/platform/releases/tag/v3.5.0) * Matterbridge v0.8.1 works with mattermost 3.5.0+ [3.5.0 release](https://github.com/mattermost/platform/releases/tag/v3.5.0)
* Matterbridge v0.7.0 works with mattermost 3.3.0 - 3.4.0 [3.4.0 release](https://github.com/mattermost/platform/releases/tag/v3.4.0) * Matterbridge v0.7.1 works with mattermost 3.3.0 - 3.4.0 [3.4.0 release](https://github.com/mattermost/platform/releases/tag/v3.4.0)
* Matterbridge v0.5.0 works with mattermost 3.0.0 - 3.2.0 [3.2.0 release](https://github.com/mattermost/platform/releases/tag/v3.2.0) * Matterbridge v0.5.0 works with mattermost 3.0.0 - 3.2.0 [3.2.0 release](https://github.com/mattermost/platform/releases/tag/v3.2.0)
#### Webhooks version #### Webhooks version
* Configured incoming/outgoing [webhooks](https://www.mattermost.org/webhooks/) on your mattermost instance. * Configured incoming/outgoing [webhooks](https://www.mattermost.org/webhooks/) on your mattermost instance.

View File

@ -55,9 +55,9 @@ func New(cfg config.Protocol, origin string, c chan config.Message) *Birc {
func (b *Birc) Command(msg *config.Message) string { func (b *Birc) Command(msg *config.Message) string {
switch msg.Text { switch msg.Text {
case "!users": case "!users":
b.i.AddCallback(ircm.RPL_NAMREPLY, b.storeNames)
b.i.AddCallback(ircm.RPL_ENDOFNAMES, b.endNames) b.i.AddCallback(ircm.RPL_ENDOFNAMES, b.endNames)
b.i.SendRaw("NAMES " + msg.Channel) b.i.SendRaw("NAMES " + msg.Channel)
b.i.ClearCallback(ircm.RPL_ENDOFNAMES)
} }
return "" return ""
} }
@ -160,6 +160,8 @@ func (b *Birc) endNames(event *irc.Event) {
b.Remote <- config.Message{Username: b.Nick, Text: b.formatnicks(b.names[channel], continued), Channel: channel, b.Remote <- config.Message{Username: b.Nick, Text: b.formatnicks(b.names[channel], continued), Channel: channel,
Origin: b.origin, Protocol: b.protocol, FullOrigin: b.FullOrigin()} Origin: b.origin, Protocol: b.protocol, FullOrigin: b.FullOrigin()}
b.names[channel] = nil b.names[channel] = nil
b.i.ClearCallback(ircm.RPL_NAMREPLY)
b.i.ClearCallback(ircm.RPL_ENDOFNAMES)
} }
func (b *Birc) handleNewConnection(event *irc.Event) { func (b *Birc) handleNewConnection(event *irc.Event) {
@ -169,7 +171,6 @@ func (b *Birc) handleNewConnection(event *irc.Event) {
i.AddCallback("PRIVMSG", b.handlePrivMsg) i.AddCallback("PRIVMSG", b.handlePrivMsg)
i.AddCallback("CTCP_ACTION", b.handlePrivMsg) i.AddCallback("CTCP_ACTION", b.handlePrivMsg)
i.AddCallback(ircm.RPL_TOPICWHOTIME, b.handleTopicWhoTime) i.AddCallback(ircm.RPL_TOPICWHOTIME, b.handleTopicWhoTime)
i.AddCallback(ircm.RPL_NAMREPLY, b.storeNames)
i.AddCallback(ircm.NOTICE, b.handleNotice) i.AddCallback(ircm.NOTICE, b.handleNotice)
//i.AddCallback(ircm.RPL_MYINFO, func(e *irc.Event) { flog.Infof("%s: %s", e.Code, strings.Join(e.Arguments[1:], " ")) }) //i.AddCallback(ircm.RPL_MYINFO, func(e *irc.Event) { flog.Infof("%s: %s", e.Code, strings.Join(e.Arguments[1:], " ")) })
i.AddCallback("PING", func(e *irc.Event) { i.AddCallback("PING", func(e *irc.Event) {

View File

@ -1,9 +1,19 @@
# v0.8 # v0.8.1
## Bugfix
* general: when using samechannelgateway NickFormat get doubled by the NICK #77
* irc: fix !users command #78
# v0.8.0
Release because of breaking mattermost API changes Release because of breaking mattermost API changes
## New features ## New features
* Supports mattermost v3.5.0 * Supports mattermost v3.5.0
# v0.7 # v0.7.1
## Bugfix
* general: when using samechannelgateway NickFormat get doubled by the NICK #77
* irc: fix !users command #78
# v0.7.0
## Breaking config changes from 0.6 to 0.7 ## Breaking config changes from 0.6 to 0.7
Matterbridge now uses TOML configuration (https://github.com/toml-lang/toml) Matterbridge now uses TOML configuration (https://github.com/toml-lang/toml)
See matterbridge.toml.sample for an example See matterbridge.toml.sample for an example

View File

@ -4,7 +4,6 @@ import (
"github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/config"
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
"strings"
) )
type SameChannelGateway struct { type SameChannelGateway struct {
@ -62,7 +61,6 @@ func (gw *SameChannelGateway) handleMessage(msg config.Message, dest bridge.Brid
if msg.FullOrigin == dest.FullOrigin() { if msg.FullOrigin == dest.FullOrigin() {
return return
} }
gw.modifyMessage(&msg, dest)
log.Debugf("Sending %#v from %s (%s) to %s (%s)", msg, msg.FullOrigin, msg.Channel, dest.FullOrigin(), msg.Channel) log.Debugf("Sending %#v from %s (%s) to %s (%s)", msg, msg.FullOrigin, msg.Channel, dest.FullOrigin(), msg.Channel)
err := dest.Send(msg) err := dest.Send(msg)
if err != nil { if err != nil {
@ -70,29 +68,6 @@ func (gw *SameChannelGateway) handleMessage(msg config.Message, dest bridge.Brid
} }
} }
func setNickFormat(msg *config.Message, format string) {
if format == "" {
msg.Username = msg.Protocol + "." + msg.Origin + "-" + msg.Username + ": "
return
}
msg.Username = strings.Replace(format, "{NICK}", msg.Username, -1)
msg.Username = strings.Replace(msg.Username, "{BRIDGE}", msg.Origin, -1)
msg.Username = strings.Replace(msg.Username, "{PROTOCOL}", msg.Protocol, -1)
}
func (gw *SameChannelGateway) modifyMessage(msg *config.Message, dest bridge.Bridge) {
switch dest.Protocol() {
case "irc":
setNickFormat(msg, gw.Config.IRC[dest.Origin()].RemoteNickFormat)
case "mattermost":
setNickFormat(msg, gw.Config.Mattermost[dest.Origin()].RemoteNickFormat)
case "slack":
setNickFormat(msg, gw.Config.Slack[dest.Origin()].RemoteNickFormat)
case "discord":
setNickFormat(msg, gw.Config.Discord[dest.Origin()].RemoteNickFormat)
}
}
func (gw *SameChannelGateway) validChannel(channel string) bool { func (gw *SameChannelGateway) validChannel(channel string) bool {
for _, c := range gw.Channels { for _, c := range gw.Channels {
if c == channel { if c == channel {

View File

@ -9,7 +9,7 @@ import (
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
) )
var version = "0.9.0-dev" var version = "0.8.1"
func init() { func init() {
log.SetFormatter(&log.TextFormatter{FullTimestamp: true}) log.SetFormatter(&log.TextFormatter{FullTimestamp: true})