diff options
Diffstat (limited to 'bridge')
-rw-r--r-- | bridge/api/api.go | 7 | ||||
-rw-r--r-- | bridge/discord/discord.go | 7 | ||||
-rw-r--r-- | bridge/gitter/gitter.go | 3 | ||||
-rw-r--r-- | bridge/helper/helper.go | 5 | ||||
-rw-r--r-- | bridge/irc/irc.go | 38 | ||||
-rw-r--r-- | bridge/matrix/matrix.go | 9 | ||||
-rw-r--r-- | bridge/mattermost/mattermost.go | 3 | ||||
-rw-r--r-- | bridge/sshchat/sshchat.go | 5 | ||||
-rw-r--r-- | bridge/telegram/html.go | 3 | ||||
-rw-r--r-- | bridge/xmpp/xmpp.go | 7 |
10 files changed, 49 insertions, 38 deletions
diff --git a/bridge/api/api.go b/bridge/api/api.go index 54eea4a7..28c57106 100644 --- a/bridge/api/api.go +++ b/bridge/api/api.go @@ -2,14 +2,15 @@ package api import ( "encoding/json" + "net/http" + "sync" + "time" + "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" "github.com/labstack/echo" "github.com/labstack/echo/middleware" "github.com/zfjagann/golang-ring" - "net/http" - "sync" - "time" ) type Api struct { diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go index ef4e5ca6..81f0cbe3 100644 --- a/bridge/discord/discord.go +++ b/bridge/discord/discord.go @@ -3,13 +3,14 @@ package bdiscord import ( "bytes" "fmt" + "regexp" + "strings" + "sync" + "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/helper" "github.com/bwmarrin/discordgo" - "regexp" - "strings" - "sync" ) type Bdiscord struct { diff --git a/bridge/gitter/gitter.go b/bridge/gitter/gitter.go index faa86e5a..f47ca7ea 100644 --- a/bridge/gitter/gitter.go +++ b/bridge/gitter/gitter.go @@ -2,11 +2,12 @@ package bgitter import ( "fmt" + "strings" + "github.com/42wim/go-gitter" "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/helper" - "strings" ) type Bgitter struct { diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go index c4ac0ae2..a3f4255c 100644 --- a/bridge/helper/helper.go +++ b/bridge/helper/helper.go @@ -3,12 +3,13 @@ package helper import ( "bytes" "fmt" - "github.com/42wim/matterbridge/bridge/config" - log "github.com/sirupsen/logrus" "io" "net/http" "strings" "time" + + "github.com/42wim/matterbridge/bridge/config" + log "github.com/sirupsen/logrus" ) func DownloadFile(url string) (*[]byte, error) { diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index 4919c85d..fe1e0d3b 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -4,14 +4,6 @@ import ( "bytes" "crypto/tls" "fmt" - "github.com/42wim/matterbridge/bridge" - "github.com/42wim/matterbridge/bridge/config" - "github.com/42wim/matterbridge/bridge/helper" - "github.com/dfordsoft/golib/ic" - "github.com/lrstanley/girc" - "github.com/paulrosania/go-charset/charset" - _ "github.com/paulrosania/go-charset/data" - "github.com/saintfish/chardet" "hash/crc32" "io" "io/ioutil" @@ -22,6 +14,15 @@ import ( "strings" "time" "unicode/utf8" + + "github.com/42wim/matterbridge/bridge" + "github.com/42wim/matterbridge/bridge/config" + "github.com/42wim/matterbridge/bridge/helper" + "github.com/dfordsoft/golib/ic" + "github.com/lrstanley/girc" + "github.com/paulrosania/go-charset/charset" + _ "github.com/paulrosania/go-charset/data" + "github.com/saintfish/chardet" ) type Birc struct { @@ -114,18 +115,19 @@ func (b *Birc) Connect() error { go func() { for { if err := i.Connect(); err != nil { - b.Log.Errorf("error: %s", err) - b.Log.Info("reconnecting in 30 seconds...") - time.Sleep(30 * time.Second) - i.Handlers.Clear(girc.RPL_WELCOME) - i.Handlers.Add(girc.RPL_WELCOME, func(client *girc.Client, event girc.Event) { - b.Remote <- config.Message{Username: "system", Text: "rejoin", Channel: "", Account: b.Account, Event: config.EVENT_REJOIN_CHANNELS} - // set our correct nick on reconnect if necessary - b.Nick = event.Source.Name - }) + b.Log.Errorf("disconnect: error: %s", err) } else { - return + b.Log.Info("disconnect: client requested quit") } + + b.Log.Info("reconnecting in 30 seconds...") + time.Sleep(30 * time.Second) + i.Handlers.Clear(girc.RPL_WELCOME) + i.Handlers.Add(girc.RPL_WELCOME, func(client *girc.Client, event girc.Event) { + b.Remote <- config.Message{Username: "system", Text: "rejoin", Channel: "", Account: b.Account, Event: config.EVENT_REJOIN_CHANNELS} + // set our correct nick on reconnect if necessary + b.Nick = event.Source.Name + }) } }() b.i = i diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go index ed3d5bf2..95ba6b42 100644 --- a/bridge/matrix/matrix.go +++ b/bridge/matrix/matrix.go @@ -3,14 +3,15 @@ package bmatrix import ( "bytes" "fmt" - "github.com/42wim/matterbridge/bridge" - "github.com/42wim/matterbridge/bridge/config" - "github.com/42wim/matterbridge/bridge/helper" - matrix "github.com/matterbridge/gomatrix" "mime" "regexp" "strings" "sync" + + "github.com/42wim/matterbridge/bridge" + "github.com/42wim/matterbridge/bridge/config" + "github.com/42wim/matterbridge/bridge/helper" + matrix "github.com/matterbridge/gomatrix" ) type Bmatrix struct { diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index ae5d9db7..14c71af4 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -3,13 +3,14 @@ package bmattermost import ( "errors" "fmt" + "strings" + "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/helper" "github.com/42wim/matterbridge/matterclient" "github.com/42wim/matterbridge/matterhook" "github.com/rs/xid" - "strings" ) type Bmattermost struct { diff --git a/bridge/sshchat/sshchat.go b/bridge/sshchat/sshchat.go index 6e879e84..846a9081 100644 --- a/bridge/sshchat/sshchat.go +++ b/bridge/sshchat/sshchat.go @@ -2,13 +2,14 @@ package bsshchat import ( "bufio" + "io" + "strings" + "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/helper" "github.com/shazow/ssh-chat/sshd" log "github.com/sirupsen/logrus" - "io" - "strings" ) type Bsshchat struct { diff --git a/bridge/telegram/html.go b/bridge/telegram/html.go index 5e7bdc72..85547d7b 100644 --- a/bridge/telegram/html.go +++ b/bridge/telegram/html.go @@ -2,8 +2,9 @@ package btelegram import ( "bytes" - "github.com/russross/blackfriday" "html" + + "github.com/russross/blackfriday" ) type customHTML struct { diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go index cb0da1b2..0e2d951c 100644 --- a/bridge/xmpp/xmpp.go +++ b/bridge/xmpp/xmpp.go @@ -2,14 +2,15 @@ package bxmpp import ( "crypto/tls" + "strings" + "time" + "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/helper" "github.com/jpillora/backoff" - "github.com/rs/xid" "github.com/matterbridge/go-xmpp" - "strings" - "time" + "github.com/rs/xid" ) type Bxmpp struct { |