This commit is contained in:
Mickael Remond 2018-01-22 23:33:16 +01:00
parent adb14260f0
commit 57cc0a25ac
No known key found for this signature in database
GPG Key ID: E6F6045D79965AA3
2 changed files with 5 additions and 5 deletions

View File

@ -7,8 +7,8 @@ import (
) )
func main() { func main() {
component := MyComponent{Name: "MQTT Component", Category: "gateway", Type: "mqtt"} component := MyComponent{Name: "Facebook Gateway", Category: "gateway", Type: "facebook"}
component.xmpp = &xmpp.Component{Host: "mqtt.localhost", Secret: "mypass"} component.xmpp = &xmpp.Component{Host: "facebook.localhost", Secret: "mypass"}
component.xmpp.Connect("localhost:8888") component.xmpp.Connect("localhost:8888")
for { for {
@ -29,12 +29,12 @@ func main() {
default: default:
fmt.Println("ignoring iq packet", inner) fmt.Println("ignoring iq packet", inner)
xerror := xmpp.Err{ xError := xmpp.Err{
Code: 501, Code: 501,
Reason: "feature-not-implemented", Reason: "feature-not-implemented",
Type: "cancel", Type: "cancel",
} }
reply := p.MakeError(xerror) reply := p.MakeError(xError)
component.xmpp.Send(&reply) component.xmpp.Send(&reply)
} }
default: default:

2
iq.go
View File

@ -135,7 +135,7 @@ func (x Err) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error) {
start.Attr = append(start.Attr, code, typ) start.Attr = append(start.Attr, code, typ)
err = e.EncodeToken(start) err = e.EncodeToken(start)
// Subtags // SubTags
// Reason // Reason
if x.Reason != "" { if x.Reason != "" {
reason := xml.Name{Space: "urn:ietf:params:xml:ns:xmpp-stanzas", Local: x.Reason} reason := xml.Name{Space: "urn:ietf:params:xml:ns:xmpp-stanzas", Local: x.Reason}