Compare commits
2 Commits
6859516f81
...
dacdc4ac04
| Author | SHA1 | Date |
|---|---|---|
|
|
dacdc4ac04 | |
|
|
97363908e1 |
|
|
@ -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"`
|
||||||
|
}
|
||||||
|
|
@ -76,7 +76,14 @@ type Message struct {
|
||||||
Body string `xml:"body,omitempty"`
|
Body string `xml:"body,omitempty"`
|
||||||
Thread string `xml:"thread,omitempty"`
|
Thread string `xml:"thread,omitempty"`
|
||||||
Error *Error `xml:"error"`
|
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.
|
// XMPP <presence/> stanza.
|
||||||
|
|
|
||||||
|
|
@ -195,12 +195,12 @@ func (x *XMPP) receiver() {
|
||||||
case "presence":
|
case "presence":
|
||||||
v = &Presence{}
|
v = &Presence{}
|
||||||
default:
|
default:
|
||||||
log.Fatal("Unexected element: %T %v", start, start)
|
log.Println("Error. Unexected element: %T %v", start, start)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = x.stream.Decode(v, start)
|
err = x.stream.Decode(v, start)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Println("Error. Failed to decode element. ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
filtered := false
|
filtered := false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue