diff options
Diffstat (limited to 'xmpp')
-rw-r--r-- | xmpp/component.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/xmpp/component.go b/xmpp/component.go index 036bc3c..fcef91b 100644 --- a/xmpp/component.go +++ b/xmpp/component.go @@ -2,6 +2,7 @@ package xmpp import ( "dev.narayana.im/narayana/telegabber/config" + "dev.narayana.im/narayana/telegabber/persistence" "dev.narayana.im/narayana/telegabber/telegram" "gosrc.io/xmpp" @@ -10,11 +11,13 @@ import ( var jid *xmpp.Jid var tgConf config.TelegramConfig var sessions map[string]telegram.Client +var db persistence.SessionsYamlDB // NewComponent starts a new component and wraps it in // a stream manager that you should start yourself func NewComponent(conf config.XMPPConfig, tc config.TelegramConfig) (*xmpp.StreamManager, error) { var err error + jid, err = xmpp.NewJid(conf.Jid) if err != nil { return nil, err @@ -23,6 +26,11 @@ func NewComponent(conf config.XMPPConfig, tc config.TelegramConfig) (*xmpp.Strea tgConf = tc sessions = make(map[string]telegram.Client) + db, err = persistence.LoadSessions(conf.Db) + if err != nil { + return nil, err + } + options := xmpp.ComponentOptions{ Address: conf.Host + ":" + conf.Port, Domain: conf.Jid, |