Add gateway.inout config for bidirectional bridges. Closes #85
This commit is contained in:
parent
d5845ce900
commit
e0e1e4be80
|
@ -62,6 +62,7 @@ type Gateway struct {
|
||||||
Enable bool
|
Enable bool
|
||||||
In []Bridge
|
In []Bridge
|
||||||
Out []Bridge
|
Out []Bridge
|
||||||
|
InOut []Bridge
|
||||||
}
|
}
|
||||||
|
|
||||||
type SameChannelGateway struct {
|
type SameChannelGateway struct {
|
||||||
|
|
|
@ -57,7 +57,7 @@ func (gw *Gateway) AddBridge(cfg *config.Bridge) error {
|
||||||
|
|
||||||
func (gw *Gateway) Start() error {
|
func (gw *Gateway) Start() error {
|
||||||
gw.mapChannels()
|
gw.mapChannels()
|
||||||
for _, br := range append(gw.MyConfig.In, gw.MyConfig.Out...) {
|
for _, br := range append(gw.MyConfig.In, append(gw.MyConfig.InOut, gw.MyConfig.Out...)...) {
|
||||||
err := gw.AddBridge(&br)
|
err := gw.AddBridge(&br)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -92,6 +92,10 @@ func (gw *Gateway) mapChannels() error {
|
||||||
m[br.Account] = append(m[br.Account], br.Channel)
|
m[br.Account] = append(m[br.Account], br.Channel)
|
||||||
}
|
}
|
||||||
gw.ChannelsIn = m
|
gw.ChannelsIn = m
|
||||||
|
for _, br := range gw.MyConfig.InOut {
|
||||||
|
gw.ChannelsIn[br.Account] = append(gw.ChannelsIn[br.Account], br.Channel)
|
||||||
|
gw.ChannelsOut[br.Account] = append(gw.ChannelsOut[br.Account], br.Channel)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,7 @@ ShowJoinPart=false
|
||||||
#from [[gateway.in]] to.
|
#from [[gateway.in]] to.
|
||||||
#
|
#
|
||||||
#Most of the time [[gateway.in]] and [[gateway.out]] are the same if you
|
#Most of the time [[gateway.in]] and [[gateway.out]] are the same if you
|
||||||
#want bidirectional bridging.
|
#want bidirectional bridging. You can then use [[gateway.inout]]
|
||||||
#
|
#
|
||||||
|
|
||||||
[[gateway]]
|
[[gateway]]
|
||||||
|
@ -415,15 +415,15 @@ enable=true
|
||||||
#REQUIRED
|
#REQUIRED
|
||||||
channel="#testing"
|
channel="#testing"
|
||||||
|
|
||||||
[[gateway.in]]
|
|
||||||
account="mattermost.work"
|
|
||||||
channel="off-topic"
|
|
||||||
|
|
||||||
|
#[[gateway.out]] specifies the account and channels we will sent messages to.
|
||||||
[[gateway.out]]
|
[[gateway.out]]
|
||||||
account="irc.freenode"
|
account="irc.freenode"
|
||||||
channel="#testing"
|
channel="#testing"
|
||||||
|
|
||||||
[[gateway.out]]
|
#[[gateway.inout]] can be used when then channel will be used to receive from
|
||||||
|
#and send messages to
|
||||||
|
[[gateway.inout]]
|
||||||
account="mattermost.work"
|
account="mattermost.work"
|
||||||
channel="off-topic"
|
channel="off-topic"
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,10 @@ enable=true
|
||||||
account="irc.freenode"
|
account="irc.freenode"
|
||||||
channel="#testing"
|
channel="#testing"
|
||||||
|
|
||||||
[[gateway.in]]
|
|
||||||
account="mattermost.work"
|
|
||||||
channel="off-topic"
|
|
||||||
|
|
||||||
[[gateway.out]]
|
[[gateway.out]]
|
||||||
account="irc.freenode"
|
account="irc.freenode"
|
||||||
channel="#testing"
|
channel="#testing"
|
||||||
|
|
||||||
[[gateway.out]]
|
[[gateway.inout]]
|
||||||
account="mattermost.work"
|
account="mattermost.work"
|
||||||
channel="off-topic"
|
channel="off-topic"
|
||||||
|
|
Loading…
Reference in New Issue