4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 21:19:22 +00:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Wim
d9ff0b72fa Release 0.7.1 2016-11-20 17:28:56 +01:00
Wim
8c83eb03c7 Update documentation. Prepare release 2016-11-20 17:27:48 +01:00
Wim
e28649b592 Remove callbacks after being called. Fixes #88 (irc) 2016-11-20 17:20:52 +01:00
Wim
e4e822ef6a Fix !users command for irc. Closes #78. 2016-11-14 00:10:55 +01:00
Wim
69d6f4b2da Remove double username modify. Fixes #77 2016-11-13 23:50:12 +01:00
Wim
f7e22983a5 Release 0.7.0 2016-11-12 22:43:24 +01:00
Wim
cac9fb838c Update documentation 2016-11-12 22:41:56 +01:00
5 changed files with 26 additions and 37 deletions

View File

@ -1,8 +1,4 @@
# matterbridge # matterbridge
:warning: Look at [README-0.6.md] (https://github.com/42wim/matterbridge/blob/master/README-0.6.md) for the documentation of the current stable.
The information below is about the develop version.
Simple bridge between mattermost, IRC, XMPP, Gitter, Slack and Discord Simple bridge between mattermost, IRC, XMPP, Gitter, Slack and Discord
* Relays public channel messages between multiple mattermost, IRC, XMPP, Gitter, Slack and Discord. Pick and mix. * Relays public channel messages between multiple mattermost, IRC, XMPP, Gitter, Slack and Discord. Pick and mix.
@ -15,7 +11,7 @@ Look at [matterbridge.toml.sample] (https://github.com/42wim/matterbridge/blob/m
Look at [matterbridge.toml.simple] (https://github.com/42wim/matterbridge/blob/master/matterbridge.toml.simple) for a simple example. Look at [matterbridge.toml.simple] (https://github.com/42wim/matterbridge/blob/master/matterbridge.toml.simple) for a simple example.
## Changelog ## Changelog
Since v0.7.0-dev the configuration has changed. More details in [changelog.md] (https://github.com/42wim/matterbridge/blob/master/changelog.md) Since v0.7.0 the configuration has changed. More details in [changelog.md] (https://github.com/42wim/matterbridge/blob/master/changelog.md)
## Requirements ## Requirements
Accounts to one of the supported bridges Accounts to one of the supported bridges
@ -34,12 +30,14 @@ 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.3.0+ [v0.6.1](https://github.com/42wim/matterircd/releases/tag/v0.6.1) * 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.0.0-3.2.0 [v0.5.0](https://github.com/42wim/matterircd/releases/tag/v0.5.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)
## Compatibility ## Compatibility
### Mattermost ### Mattermost
* Matterbridge v0.6.1 works with mattermost 3.3.0 and higher [3.3.0 release](https://github.com/mattermost/platform/releases/tag/v3.3.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.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)

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,4 +1,19 @@
# v0.7-dev # 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
## New features
* Supports mattermost v3.5.0
# 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.7.0-dev" var version = "0.7.1"
func init() { func init() {
log.SetFormatter(&log.TextFormatter{FullTimestamp: true}) log.SetFormatter(&log.TextFormatter{FullTimestamp: true})