This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
thrempp/component/config.go

35 lines
534 B
Go
Raw Normal View History

2019-06-01 04:38:35 +02:00
package component
import (
"gosrc.io/xmpp"
)
type Config struct {
Type string
Host string
Connection string
Secret string
2019-06-06 21:20:51 +02:00
XMPPDebug bool `toml:"xmpp_debug"`
2019-06-01 04:38:35 +02:00
Special map[string]interface{}
xmpp *xmpp.Component
comp Component
}
func (c *Config) Start() error {
c.xmpp = &xmpp.Component{Host: c.Host, Secret: c.Secret}
err := c.xmpp.Connect(c.Connection)
if err != nil {
return err
}
out, err := c.comp.Connect()
if err != nil {
return err
}
go c.sender(out)
go c.receiver()
return nil
}