summaryrefslogtreecommitdiffstats
path: root/bridge/xmpp/xmpp.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-08-15 23:16:07 +0200
committerWim <wim@42.be>2016-08-20 18:08:57 +0200
commit889b6debc4f339975076668b6ab7d85f7dd08922 (patch)
tree04ca8ee5be4ecb7f87f28e46e81045a9df1d3b25 /bridge/xmpp/xmpp.go
parent9cb3413d9c79730fc3b61bfdef6b2c9a2003a383 (diff)
downloadmatterbridge-msglm-889b6debc4f339975076668b6ab7d85f7dd08922.tar.gz
matterbridge-msglm-889b6debc4f339975076668b6ab7d85f7dd08922.tar.bz2
matterbridge-msglm-889b6debc4f339975076668b6ab7d85f7dd08922.zip
Add Connect() to Bridger interface
Diffstat (limited to 'bridge/xmpp/xmpp.go')
-rw-r--r--bridge/xmpp/xmpp.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go
index 32cf999b..5d10f9bd 100644
--- a/bridge/xmpp/xmpp.go
+++ b/bridge/xmpp/xmpp.go
@@ -17,8 +17,6 @@ type Bxmpp struct {
}
type FancyLog struct {
- irc *log.Entry
- mm *log.Entry
xmpp *log.Entry
}
@@ -31,27 +29,29 @@ type Message struct {
var flog FancyLog
func init() {
- flog.irc = log.WithFields(log.Fields{"module": "irc"})
- flog.mm = log.WithFields(log.Fields{"module": "mattermost"})
flog.xmpp = log.WithFields(log.Fields{"module": "xmpp"})
}
func New(config *config.Config, c chan config.Message) *Bxmpp {
b := &Bxmpp{}
b.xmppMap = make(map[string]string)
- var err error
b.Config = config
b.Remote = c
+ return b
+}
+
+func (b *Bxmpp) Connect() error {
+ var err error
flog.xmpp.Info("Trying XMPP connection")
b.xc, err = b.createXMPP()
if err != nil {
flog.xmpp.Debugf("%#v", err)
- panic("xmpp failure")
+ return err
}
flog.xmpp.Info("Connection succeeded")
b.setupChannels()
go b.handleXmpp()
- return b
+ return nil
}
func (b *Bxmpp) Name() string {