Compare commits

...

2 Commits

3 changed files with 37 additions and 3 deletions

View File

@ -0,0 +1,27 @@
package xmpp
import (
"encoding/xml"
)
const (
NSChatStatesNotification = "http://jabber.org/protocol/chatstates"
)
// XEP-0085: Chat States Notification
type Active struct {
XMLName xml.Name `xml:"http://jabber.org/protocol/chatstates active"`
}
type Composing struct {
XMLName xml.Name `xml:"http://jabber.org/protocol/chatstates composing"`
}
type Paused struct {
XMLName xml.Name `xml:"http://jabber.org/protocol/chatstates paused"`
}
type Inactive struct {
XMLName xml.Name `xml:"http://jabber.org/protocol/chatstates inactive"`
}
type Gone struct {
XMLName xml.Name `xml:"http://jabber.org/protocol/chatstates gone"`
}

View File

@ -76,7 +76,14 @@ type Message struct {
Body string `xml:"body,omitempty"`
Thread string `xml:"thread,omitempty"`
Error *Error `xml:"error"`
Confir *Confirm `xml:"confirm"`
Confir *Confirm `xml:"confirm"` // XEP-0070
Active *Active `xml:"active"` // XEP-0085
Composing *Composing `xml:"composing"` // XEP-0085
Paused *Paused `xml:"paused"` // XEP-0085
Inactive *Inactive `xml:"inactive"` // XEP-0085
Gone *Gone `xml:"gone"` // XEP-0085
}
// XMPP <presence/> stanza.

View File

@ -195,12 +195,12 @@ func (x *XMPP) receiver() {
case "presence":
v = &Presence{}
default:
log.Fatal("Unexected element: %T %v", start, start)
log.Println("Error. Unexected element: %T %v", start, start)
}
err = x.stream.Decode(v, start)
if err != nil {
log.Fatal(err)
log.Println("Error. Failed to decode element. ", err)
}
filtered := false