2017-12-14 21:30:07 +01:00
|
|
|
package messages
|
|
|
|
|
2018-02-10 13:34:42 +01:00
|
|
|
import (
|
|
|
|
"encoding/xml"
|
|
|
|
|
|
|
|
"dev.sum7.eu/genofire/yaja/model"
|
|
|
|
)
|
2017-12-14 21:30:07 +01:00
|
|
|
|
|
|
|
type IQType string
|
|
|
|
|
|
|
|
const (
|
|
|
|
IQTypeGet IQType = "get"
|
|
|
|
IQTypeSet IQType = "set"
|
|
|
|
IQTypeResult IQType = "result"
|
|
|
|
IQTypeError IQType = "error"
|
|
|
|
)
|
|
|
|
|
|
|
|
// IQ element - info/query
|
2018-02-07 19:32:11 +01:00
|
|
|
type IQClient struct {
|
2018-02-10 13:34:42 +01:00
|
|
|
XMLName xml.Name `xml:"jabber:client iq"`
|
|
|
|
From *model.JID `xml:"from,attr"`
|
|
|
|
ID string `xml:"id,attr"`
|
|
|
|
To *model.JID `xml:"to,attr"`
|
|
|
|
Type IQType `xml:"type,attr"`
|
|
|
|
Error *ErrorClient `xml:"error"`
|
|
|
|
Bind *Bind
|
|
|
|
Ping *Ping
|
|
|
|
PrivateQuery *IQPrivateQuery
|
|
|
|
PrivateRegister *IQPrivateRegister
|
|
|
|
// Any hasn't matched element
|
|
|
|
Other []XMLElement `xml:",any"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Ping struct {
|
|
|
|
XMLName xml.Name `xml:"urn:xmpp:ping ping"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type IQPrivateQuery struct {
|
|
|
|
XMLName xml.Name `xml:"jabber:iq:private query"`
|
|
|
|
Body []byte `xml:",innerxml"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type IQPrivateRegister struct {
|
|
|
|
XMLName xml.Name `xml:"jabber:iq:register query"`
|
|
|
|
Instructions string `xml:"instructions"`
|
|
|
|
Username string `xml:"username"`
|
|
|
|
Password string `xml:"password"`
|
2017-12-14 21:30:07 +01:00
|
|
|
}
|