mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-27 04:09:24 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
7811c330db | |||
9bcd131e66 | |||
c791423dd5 | |||
80bdf38388 | |||
9d9cb32f4e | |||
87229bab13 |
@ -42,7 +42,7 @@ Accounts to one of the supported bridges
|
|||||||
# Installing
|
# Installing
|
||||||
## Binaries
|
## Binaries
|
||||||
Binaries can be found [here] (https://github.com/42wim/matterbridge/releases/)
|
Binaries can be found [here] (https://github.com/42wim/matterbridge/releases/)
|
||||||
* Latest stable release [v0.12.1](https://github.com/42wim/matterbridge/releases/latest)
|
* Latest stable release [v0.13.0](https://github.com/42wim/matterbridge/releases/latest)
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
Go 1.6+ is required. Make sure you have [Go](https://golang.org/doc/install) properly installed, including setting up your [GOPATH] (https://golang.org/doc/code.html#GOPATH)
|
Go 1.6+ is required. Make sure you have [Go](https://golang.org/doc/install) properly installed, including setting up your [GOPATH] (https://golang.org/doc/code.html#GOPATH)
|
||||||
|
@ -59,6 +59,7 @@ type Protocol struct {
|
|||||||
Protocol string //all protocols
|
Protocol string //all protocols
|
||||||
MessageQueue int // IRC, size of message queue for flood control
|
MessageQueue int // IRC, size of message queue for flood control
|
||||||
MessageDelay int // IRC, time in millisecond to wait between messages
|
MessageDelay int // IRC, time in millisecond to wait between messages
|
||||||
|
MessageLength int // IRC, max length of a message allowed
|
||||||
MessageFormat string // telegram
|
MessageFormat string // telegram
|
||||||
RemoteNickFormat string // all protocols
|
RemoteNickFormat string // all protocols
|
||||||
Server string // IRC,mattermost,XMPP,discord
|
Server string // IRC,mattermost,XMPP,discord
|
||||||
|
@ -46,6 +46,9 @@ func New(cfg config.Protocol, account string, c chan config.Message) *Birc {
|
|||||||
if b.Config.MessageQueue == 0 {
|
if b.Config.MessageQueue == 0 {
|
||||||
b.Config.MessageQueue = 30
|
b.Config.MessageQueue = 30
|
||||||
}
|
}
|
||||||
|
if b.Config.MessageLength == 0 {
|
||||||
|
b.Config.MessageLength = 400
|
||||||
|
}
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +114,9 @@ func (b *Birc) Send(msg config.Message) error {
|
|||||||
b.Command(&msg)
|
b.Command(&msg)
|
||||||
}
|
}
|
||||||
for _, text := range strings.Split(msg.Text, "\n") {
|
for _, text := range strings.Split(msg.Text, "\n") {
|
||||||
|
if len(text) > b.Config.MessageLength {
|
||||||
|
text = text[:b.Config.MessageLength] + " <message clipped>"
|
||||||
|
}
|
||||||
if len(b.Local) < b.Config.MessageQueue {
|
if len(b.Local) < b.Config.MessageQueue {
|
||||||
if len(b.Local) == b.Config.MessageQueue-1 {
|
if len(b.Local) == b.Config.MessageQueue-1 {
|
||||||
text = text + " <message clipped>"
|
text = text + " <message clipped>"
|
||||||
|
@ -89,9 +89,6 @@ func (b *Bslack) JoinChannel(channel string) error {
|
|||||||
|
|
||||||
func (b *Bslack) Send(msg config.Message) error {
|
func (b *Bslack) Send(msg config.Message) error {
|
||||||
flog.Debugf("Receiving %#v", msg)
|
flog.Debugf("Receiving %#v", msg)
|
||||||
if msg.Account == b.Account {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
nick := msg.Username
|
nick := msg.Username
|
||||||
message := msg.Text
|
message := msg.Text
|
||||||
channel := msg.Channel
|
channel := msg.Channel
|
||||||
|
@ -76,11 +76,11 @@ func (b *Btelegram) Send(msg config.Message) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
||||||
username := ""
|
|
||||||
text := ""
|
|
||||||
channel := ""
|
|
||||||
for update := range updates {
|
for update := range updates {
|
||||||
var message *tgbotapi.Message
|
var message *tgbotapi.Message
|
||||||
|
username := ""
|
||||||
|
channel := ""
|
||||||
|
text := ""
|
||||||
// handle channels
|
// handle channels
|
||||||
if update.ChannelPost != nil {
|
if update.ChannelPost != nil {
|
||||||
message = update.ChannelPost
|
message = update.ChannelPost
|
||||||
|
13
changelog.md
13
changelog.md
@ -1,3 +1,16 @@
|
|||||||
|
# v0.13.0
|
||||||
|
## New features
|
||||||
|
* irc: Limit message length. ```MessageLength=400```
|
||||||
|
Maximum length of message sent to irc server. If it exceeds <message clipped> will be add to the message.
|
||||||
|
* irc: Add NOPINGNICK option.
|
||||||
|
The string "{NOPINGNICK}" (case sensitive) will be replaced by the actual nick / username, but with a ZWSP inside the nick, so the irc user with the same nick won't get pinged.
|
||||||
|
See https://github.com/42wim/matterbridge/issues/175 for more information
|
||||||
|
|
||||||
|
## Bugfix
|
||||||
|
* slack: Fix sending to different channels on same account (slack). Closes #177
|
||||||
|
* telegram: Fix incorrect usernames being sent. Closes #181
|
||||||
|
|
||||||
|
|
||||||
# v0.12.1
|
# v0.12.1
|
||||||
## New features
|
## New features
|
||||||
* telegram: Add UseFirstName option (telegram). Closes #144
|
* telegram: Add UseFirstName option (telegram). Closes #144
|
||||||
|
@ -192,9 +192,10 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
originchannel := msg.Channel
|
originchannel := msg.Channel
|
||||||
|
origmsg := msg
|
||||||
for _, channel := range gw.DestChannelFunc(&msg, *dest) {
|
for _, channel := range gw.DestChannelFunc(&msg, *dest) {
|
||||||
// do not send to ourself
|
// do not send to ourself
|
||||||
if channel.ID == getChannelID(msg) {
|
if channel.ID == getChannelID(origmsg) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Debugf("Sending %#v from %s (%s) to %s (%s)", msg, msg.Account, originchannel, dest.Account, channel.Name)
|
log.Debugf("Sending %#v from %s (%s) to %s (%s)", msg, msg.Account, originchannel, dest.Account, channel.Name)
|
||||||
@ -233,6 +234,7 @@ func (gw *Gateway) modifyUsername(msg *config.Message, dest *bridge.Bridge) {
|
|||||||
if nick == "" {
|
if nick == "" {
|
||||||
nick = dest.Config.RemoteNickFormat
|
nick = dest.Config.RemoteNickFormat
|
||||||
}
|
}
|
||||||
|
nick = strings.Replace(nick, "{NOPINGNICK}", msg.Username[:1]+""+msg.Username[1:], -1)
|
||||||
nick = strings.Replace(nick, "{NICK}", msg.Username, -1)
|
nick = strings.Replace(nick, "{NICK}", msg.Username, -1)
|
||||||
nick = strings.Replace(nick, "{BRIDGE}", br.Name, -1)
|
nick = strings.Replace(nick, "{BRIDGE}", br.Name, -1)
|
||||||
nick = strings.Replace(nick, "{PROTOCOL}", br.Protocol, -1)
|
nick = strings.Replace(nick, "{PROTOCOL}", br.Protocol, -1)
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
version = "0.12.1"
|
version = "0.13.0"
|
||||||
githash string
|
githash string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -48,10 +48,15 @@ MessageDelay=1300
|
|||||||
|
|
||||||
#Maximum amount of messages to hold in queue. If queue is full
|
#Maximum amount of messages to hold in queue. If queue is full
|
||||||
#messages will be dropped.
|
#messages will be dropped.
|
||||||
#<clipped> will be add to the message that fills the queue.
|
#<message clipped> will be add to the message that fills the queue.
|
||||||
#OPTIONAL (default 30)
|
#OPTIONAL (default 30)
|
||||||
MessageQueue=30
|
MessageQueue=30
|
||||||
|
|
||||||
|
#Maximum length of message sent to irc server. If it exceeds
|
||||||
|
#<message clipped> will be add to the message.
|
||||||
|
#OPTIONAL (default 400)
|
||||||
|
MessageLength=400
|
||||||
|
|
||||||
#Nicks you want to ignore.
|
#Nicks you want to ignore.
|
||||||
#Messages from those users will not be sent to other bridges.
|
#Messages from those users will not be sent to other bridges.
|
||||||
#OPTIONAL
|
#OPTIONAL
|
||||||
@ -61,6 +66,7 @@ IgnoreNicks="ircspammer1 ircspammer2"
|
|||||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||||
#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge
|
#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge
|
||||||
|
#The string "{NOPINGNICK}" (case sensitive) will be replaced by the actual nick / username, but with a ZWSP inside the nick, so the irc user with the same nick won't get pinged. See https://github.com/42wim/matterbridge/issues/175 for more information
|
||||||
#OPTIONAL (default empty)
|
#OPTIONAL (default empty)
|
||||||
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user