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
|
||||
In []Bridge
|
||||
Out []Bridge
|
||||
InOut []Bridge
|
||||
}
|
||||
|
||||
type SameChannelGateway struct {
|
||||
|
|
|
@ -57,7 +57,7 @@ func (gw *Gateway) AddBridge(cfg *config.Bridge) error {
|
|||
|
||||
func (gw *Gateway) Start() error {
|
||||
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)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -92,6 +92,10 @@ func (gw *Gateway) mapChannels() error {
|
|||
m[br.Account] = append(m[br.Account], br.Channel)
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -383,7 +383,7 @@ ShowJoinPart=false
|
|||
#from [[gateway.in]] to.
|
||||
#
|
||||
#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]]
|
||||
|
@ -415,15 +415,15 @@ enable=true
|
|||
#REQUIRED
|
||||
channel="#testing"
|
||||
|
||||
[[gateway.in]]
|
||||
account="mattermost.work"
|
||||
channel="off-topic"
|
||||
|
||||
#[[gateway.out]] specifies the account and channels we will sent messages to.
|
||||
[[gateway.out]]
|
||||
account="irc.freenode"
|
||||
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"
|
||||
channel="off-topic"
|
||||
|
||||
|
|
|
@ -19,14 +19,10 @@ enable=true
|
|||
account="irc.freenode"
|
||||
channel="#testing"
|
||||
|
||||
[[gateway.in]]
|
||||
account="mattermost.work"
|
||||
channel="off-topic"
|
||||
|
||||
[[gateway.out]]
|
||||
account="irc.freenode"
|
||||
channel="#testing"
|
||||
|
||||
[[gateway.out]]
|
||||
[[gateway.inout]]
|
||||
account="mattermost.work"
|
||||
channel="off-topic"
|
||||
|
|
Loading…
Reference in New Issue