summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-03-18 15:32:57 +0100
committerWim <wim@42.be>2017-03-18 15:34:19 +0100
commiteddc691fc9e8ced74a33d3c4cbd568c2728fe6f1 (patch)
treeae2845c25509aed237e19a3161036f6a29127cd9
parentdeb2d7194dbe9f9555749acd8b4e540393c77e03 (diff)
downloadmatterbridge-msglm-eddc691fc9e8ced74a33d3c4cbd568c2728fe6f1.tar.gz
matterbridge-msglm-eddc691fc9e8ced74a33d3c4cbd568c2728fe6f1.tar.bz2
matterbridge-msglm-eddc691fc9e8ced74a33d3c4cbd568c2728fe6f1.zip
Join rooms not already joined by the bot (gitter). See #135
-rw-r--r--bridge/gitter/gitter.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/bridge/gitter/gitter.go b/bridge/gitter/gitter.go
index ae9ef021..b5beac40 100644
--- a/bridge/gitter/gitter.go
+++ b/bridge/gitter/gitter.go
@@ -52,11 +52,14 @@ func (b *Bgitter) Disconnect() error {
}
func (b *Bgitter) JoinChannel(channel string) error {
- room := channel
- roomID := b.getRoomID(room)
- if roomID == "" {
+ roomID, err := b.c.GetRoomId(channel)
+ if err != nil {
return fmt.Errorf("Could not find roomID for %v. Please create the room on gitter.im", channel)
}
+ room, err := b.c.GetRoom(roomID)
+ if err != nil {
+ b.Rooms = append(b.Rooms, *room)
+ }
user, err := b.c.GetUser()
if err != nil {
return err
@@ -84,7 +87,7 @@ func (b *Bgitter) JoinChannel(channel string) error {
flog.Errorf("connection with gitter closed for room %s", room)
}
}
- }(stream, room)
+ }(stream, room.Name)
return nil
}