Make demo component generic

This commit is contained in:
Mickael Remond 2018-01-26 12:37:27 +01:00
parent bb1621364a
commit 24b8d7da3d
No known key found for this signature in database
GPG key ID: E6F6045D79965AA3

View file

@ -6,16 +6,9 @@ import (
"fluux.io/xmpp" "fluux.io/xmpp"
) )
const (
localUser = "admin@localhost"
)
// TODO add webserver listener to support receiving message from facebook and replying
// Message will get to define localhost user and be routed only from local user
func main() { func main() {
component := MyComponent{Name: "Facebook Gateway", Category: "gateway", Type: "facebook"} component := MyComponent{Name: "Test Component", Category: "gateway", Type: "service"}
component.xmpp = &xmpp.Component{Host: "facebook.localhost", Secret: "mypass"} component.xmpp = &xmpp.Component{Host: "service.localhost", Secret: "mypass"}
component.xmpp.Connect("localhost:8888") component.xmpp.Connect("localhost:8888")
for { for {
@ -97,7 +90,7 @@ func DiscoItems(c MyComponent, attrs xmpp.PacketAttrs, items *xmpp.DiscoItems) {
if items.Node == "" { if items.Node == "" {
payload = xmpp.DiscoItems{ payload = xmpp.DiscoItems{
Items: []xmpp.DiscoItem{ Items: []xmpp.DiscoItem{
{Name: "test node", JID: "facebook.localhost", Node: "node1"}, {Name: "test node", JID: "service.localhost", Node: "node1"},
}, },
} }
} }