Minor cleanup

This commit is contained in:
Mickael Remond 2018-02-13 22:07:15 +01:00
parent 24b8d7da3d
commit d6bedfb033
No known key found for this signature in database
GPG key ID: E6F6045D79965AA3
3 changed files with 6 additions and 2 deletions

View file

@ -10,7 +10,7 @@ import (
"time" "time"
) )
// Client is the main structure use to connect as a client on an XMPP // Client is the main structure used to connect as a client on an XMPP
// server. // server.
type Client struct { type Client struct {
// Store user defined options // Store user defined options

View file

@ -41,10 +41,13 @@ func main() {
reply := p.MakeError(xError) reply := p.MakeError(xError)
component.xmpp.Send(&reply) component.xmpp.Send(&reply)
} }
case xmpp.Message: case xmpp.Message:
fmt.Println("Received message:", p.Body) fmt.Println("Received message:", p.Body)
case xmpp.Presence: case xmpp.Presence:
fmt.Println("Received presence:", p.Type) fmt.Println("Received presence:", p.Type)
default: default:
fmt.Println("ignoring packet:", packet) fmt.Println("ignoring packet:", packet)
} }

3
iq.go
View file

@ -10,7 +10,7 @@ import (
) )
/* /*
TODO support ability to put Raw payload TODO support ability to put Raw payload inside IQ
*/ */
// ============================================================================ // ============================================================================
@ -45,6 +45,7 @@ func (x *Err) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
} }
} }
// Check subelements to extract error text and reason (from local namespace).
for { for {
t, err := d.Token() t, err := d.Token()
if err != nil { if err != nil {