mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-26 17:49:23 +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
|
||||
## Binaries
|
||||
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
|
||||
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
|
||||
MessageQueue int // IRC, size of message queue for flood control
|
||||
MessageDelay int // IRC, time in millisecond to wait between messages
|
||||
MessageLength int // IRC, max length of a message allowed
|
||||
MessageFormat string // telegram
|
||||
RemoteNickFormat string // all protocols
|
||||
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 {
|
||||
b.Config.MessageQueue = 30
|
||||
}
|
||||
if b.Config.MessageLength == 0 {
|
||||
b.Config.MessageLength = 400
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
@ -111,6 +114,9 @@ func (b *Birc) Send(msg config.Message) error {
|
||||
b.Command(&msg)
|
||||
}
|
||||
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-1 {
|
||||
text = text + " <message clipped>"
|
||||
|
@ -89,9 +89,6 @@ func (b *Bslack) JoinChannel(channel string) error {
|
||||
|
||||
func (b *Bslack) Send(msg config.Message) error {
|
||||
flog.Debugf("Receiving %#v", msg)
|
||||
if msg.Account == b.Account {
|
||||
return nil
|
||||
}
|
||||
nick := msg.Username
|
||||
message := msg.Text
|
||||
channel := msg.Channel
|
||||
|
@ -76,11 +76,11 @@ func (b *Btelegram) Send(msg config.Message) error {
|
||||
}
|
||||
|
||||
func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
||||
username := ""
|
||||
text := ""
|
||||
channel := ""
|
||||
for update := range updates {
|
||||
var message *tgbotapi.Message
|
||||
username := ""
|
||||
channel := ""
|
||||
text := ""
|
||||
// handle channels
|
||||
if update.ChannelPost != nil {
|
||||
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
|
||||
## New features
|
||||
* telegram: Add UseFirstName option (telegram). Closes #144
|
||||
|
@ -192,9 +192,10 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) {
|
||||
return
|
||||
}
|
||||
originchannel := msg.Channel
|
||||
origmsg := msg
|
||||
for _, channel := range gw.DestChannelFunc(&msg, *dest) {
|
||||
// do not send to ourself
|
||||
if channel.ID == getChannelID(msg) {
|
||||
if channel.ID == getChannelID(origmsg) {
|
||||
continue
|
||||
}
|
||||
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 == "" {
|
||||
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, "{BRIDGE}", br.Name, -1)
|
||||
nick = strings.Replace(nick, "{PROTOCOL}", br.Protocol, -1)
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
version = "0.12.1"
|
||||
version = "0.13.0"
|
||||
githash string
|
||||
)
|
||||
|
||||
|
@ -48,10 +48,15 @@ MessageDelay=1300
|
||||
|
||||
#Maximum amount of messages to hold in queue. If queue is full
|
||||
#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)
|
||||
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.
|
||||
#Messages from those users will not be sent to other bridges.
|
||||
#OPTIONAL
|
||||
@ -61,6 +66,7 @@ IgnoreNicks="ircspammer1 ircspammer2"
|
||||
#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 "{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)
|
||||
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
||||
|
||||
|
Reference in New Issue
Block a user