From 889b6debc4f339975076668b6ab7d85f7dd08922 Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 15 Aug 2016 23:16:07 +0200 Subject: Add Connect() to Bridger interface --- bridge/xmpp/xmpp.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bridge/xmpp') 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 { -- cgit v1.2.3