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{
Identity: identity,
Features: []xmpp.Feature{
{Var: "http://jabber.org/protocol/disco#info"},
{Var: "http://jabber.org/protocol/disco#item"},
{Var: xmpp.NSDiscoInfo},
{Var: xmpp.NSDiscoItems},
},
}
iq.AddPayload(&payload)

4
iq.go
View File

@ -318,8 +318,8 @@ type DiscoItem struct {
}
func init() {
typeRegistry.MapExtension(PKTIQ, xml.Name{"http://jabber.org/protocol/disco#info", "query"}, DiscoInfo{})
typeRegistry.MapExtension(PKTIQ, xml.Name{"http://jabber.org/protocol/disco#items", "query"}, DiscoItems{})
typeRegistry.MapExtension(PKTIQ, xml.Name{NSDiscoInfo, "query"}, DiscoInfo{})
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:xmpp:iot:control", "set"}, ControlSet{})
}

View File

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

View File

@ -7,6 +7,8 @@ Support for:
- XEP-0333 - Chat Markers: https://xmpp.org/extensions/xep-0333.html
*/
const NSMsgChatMarkers = "urn:xmpp:chat-markers:0"
type Markable struct {
MsgExtension
XMLName xml.Name `xml:"urn:xmpp:chat-markers:0 markable"`
@ -31,8 +33,8 @@ type MarkAcknowledged struct {
}
func init() {
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:chat-markers:0", "markable"}, Markable{})
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:chat-markers:0", "received"}, MarkReceived{})
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:chat-markers:0", "displayed"}, MarkDisplayed{})
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:chat-markers:0", "acknowledged"}, MarkAcknowledged{})
typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgChatMarkers, "markable"}, Markable{})
typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgChatMarkers, "received"}, MarkReceived{})
typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgChatMarkers, "displayed"}, MarkDisplayed{})
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
*/
const NSMsgReceipts = "urn:xmpp:receipts"
// Used on outgoing message, to tell the recipient that you are requesting a message receipt / ack.
type ReceiptRequest struct {
MsgExtension
@ -20,6 +22,6 @@ type ReceiptReceived struct {
}
func init() {
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:receipts", "request"}, ReceiptRequest{})
typeRegistry.MapExtension(PKTMessage, xml.Name{"urn:xmpp:receipts", "received"}, ReceiptReceived{})
typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgReceipts, "request"}, ReceiptRequest{})
typeRegistry.MapExtension(PKTMessage, xml.Name{NSMsgReceipts, "received"}, ReceiptReceived{})
}