Apply namespace fixes from #33

This commit is contained in:
Mickael Remond 2019-06-05 08:51:21 +02:00
parent f034b74b54
commit 80d8d6d231
No known key found for this signature in database
GPG key ID: E6F6045D79965AA3
5 changed files with 16 additions and 12 deletions

View file

@ -80,8 +80,8 @@ func DiscoResult(c MyComponent, attrs xmpp.PacketAttrs, info *xmpp.DiscoInfo) {
payload := xmpp.DiscoInfo{ payload := xmpp.DiscoInfo{
Identity: identity, Identity: identity,
Features: []xmpp.Feature{ Features: []xmpp.Feature{
{Var: "http://jabber.org/protocol/disco#info"}, {Var: xmpp.NSDiscoInfo},
{Var: "http://jabber.org/protocol/disco#item"}, {Var: xmpp.NSDiscoItems},
}, },
} }
iq.AddPayload(&payload) iq.AddPayload(&payload)

4
iq.go
View file

@ -318,8 +318,8 @@ type DiscoItem struct {
} }
func init() { func init() {
typeRegistry.MapExtension(PKTIQ, xml.Name{"http://jabber.org/protocol/disco#info", "query"}, DiscoInfo{}) typeRegistry.MapExtension(PKTIQ, xml.Name{NSDiscoInfo, "query"}, DiscoInfo{})
typeRegistry.MapExtension(PKTIQ, xml.Name{"http://jabber.org/protocol/disco#items", "query"}, DiscoItems{}) typeRegistry.MapExtension(PKTIQ, xml.Name{NSDiscoItems, "query"}, DiscoItems{})
typeRegistry.MapExtension(PKTIQ, xml.Name{"urn:ietf:params:xml:ns:xmpp-bind", "bind"}, BindBind{}) typeRegistry.MapExtension(PKTIQ, xml.Name{"urn:ietf:params:xml:ns:xmpp-bind", "bind"}, BindBind{})
typeRegistry.MapExtension(PKTIQ, xml.Name{"urn:xmpp:iot:control", "set"}, ControlSet{}) typeRegistry.MapExtension(PKTIQ, xml.Name{"urn:xmpp:iot:control", "set"}, ControlSet{})
} }

View file

@ -43,8 +43,8 @@ func TestGenerateIq(t *testing.T) {
Type: "mqtt", Type: "mqtt",
}, },
Features: []xmpp.Feature{ Features: []xmpp.Feature{
{Var: "http://jabber.org/protocol/disco#info"}, {Var: xmpp.NSDiscoInfo},
{Var: "http://jabber.org/protocol/disco#item"}, {Var: xmpp.NSDiscoItems},
}, },
} }
iq.AddPayload(&payload) iq.AddPayload(&payload)

View file

@ -7,6 +7,8 @@ Support for:
- XEP-0333 - Chat Markers: https://xmpp.org/extensions/xep-0333.html - XEP-0333 - Chat Markers: https://xmpp.org/extensions/xep-0333.html
*/ */
const NSMsgChatMarkers = "urn:xmpp:chat-markers:0"
type Markable struct { type Markable struct {
MsgExtension MsgExtension
XMLName xml.Name `xml:"urn:xmpp:chat-markers:0 markable"` XMLName xml.Name `xml:"urn:xmpp:chat-markers:0 markable"`
@ -31,8 +33,8 @@ type MarkAcknowledged struct {
} }
func init() { func init() {
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:chat-markers:0", "markable"}, Markable{}) typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgChatMarkers, "markable"}, Markable{})
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:chat-markers:0", "received"}, MarkReceived{}) typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgChatMarkers, "received"}, MarkReceived{})
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:chat-markers:0", "displayed"}, MarkDisplayed{}) typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgChatMarkers, "displayed"}, MarkDisplayed{})
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:chat-markers:0", "acknowledged"}, MarkAcknowledged{}) typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgChatMarkers, "acknowledged"}, MarkAcknowledged{})
} }

View file

@ -7,6 +7,8 @@ Support for:
- XEP-0184 - Message Delivery Receipts: https://xmpp.org/extensions/xep-0184.html - XEP-0184 - Message Delivery Receipts: https://xmpp.org/extensions/xep-0184.html
*/ */
const NSMsgReceipts = "urn:xmpp:receipts"
// Used on outgoing message, to tell the recipient that you are requesting a message receipt / ack. // Used on outgoing message, to tell the recipient that you are requesting a message receipt / ack.
type ReceiptRequest struct { type ReceiptRequest struct {
MsgExtension MsgExtension
@ -20,6 +22,6 @@ type ReceiptReceived struct {
} }
func init() { func init() {
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:receipts", "request"}, ReceiptRequest{}) typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgReceipts, "request"}, ReceiptRequest{})
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:receipts", "received"}, ReceiptReceived{}) typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgReceipts, "received"}, ReceiptReceived{})
} }