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/mattermost/mattermost.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'bridge/mattermost') diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index 63f38dc5..9dc0cebb 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -55,6 +55,14 @@ func New(cfg *config.Config, c chan config.Message) *Bmattermost { b.Remote = c b.Plus = cfg.General.Plus b.mmMap = make(map[string]string) + return b +} + +func (b *Bmattermost) Command(cmd string) string { + return "" +} + +func (b *Bmattermost) Connect() error { if !b.Plus { b.mh = matterhook.New(b.Config.Mattermost.URL, matterhook.Config{InsecureSkipVerify: b.Config.Mattermost.SkipTLSVerify, @@ -67,7 +75,7 @@ func New(cfg *config.Config, c chan config.Message) *Bmattermost { flog.mm.Infof("Trying login %s (team: %s) on %s", b.Config.Mattermost.Login, b.Config.Mattermost.Team, b.Config.Mattermost.Server) err := b.mc.Login() if err != nil { - flog.mm.Fatal("Can not connect", err) + return err } flog.mm.Info("Login ok") b.mc.JoinChannel(b.Config.Mattermost.Channel) @@ -77,11 +85,7 @@ func New(cfg *config.Config, c chan config.Message) *Bmattermost { go b.mc.WsReceiver() } go b.handleMatter() - return b -} - -func (b *Bmattermost) Command(cmd string) string { - return "" + return nil } func (b *Bmattermost) Name() string { -- cgit v1.2.3