~samwhited/xmpp

ref: b2f3a9a952493ffcf467eafa59803c27fa099e2d xmpp/oob/oob.go -rw-r--r-- 1.3 KiB
b2f3a9a9Sam Whited xmpp: make SendElement safe for concurrent use 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2017 The Mellium Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.

// Package oob implements XEP-0066: Out of Band Data.
package oob // import "mellium.im/xmpp/oob"

import (
	"encoding/xml"

	"mellium.im/xmpp/stanza"
)

// OOB namespaces provided as a convenience.
const (
	NS      = `jabber:x:oob`
	NSQuery = `jabber:iq:oob`
)

// IQ represents an OOB data query; for instance:
//
//     <iq type='set'
//         from='feste@example.net/asegasd'
//         to='malvolio@jabber.org/apkjase'
//         id='asiepjg'>
//       <query xmlns='jabber:iq:oob'>
//         <url>https://xmpp.org/images/promo/xmpp_server_guide_2017.pdf</url>
//         <desc>XMPP Server Setup Guide 2017</desc>
//       </query>
//     </iq>
type IQ struct {
	stanza.IQ
	Query Query
}

// Query represents an OOB data node that might be placed in an IQ stanza.
type Query struct {
	XMLName xml.Name `xml:"jabber:iq:oob query"`
	URL     string   `xml:"url"`
	Desc    string   `xml:"desc,omitempty"`
}

// Data represents an OOB data node that might be placed in a message or
// presence stanza.
type Data struct {
	XMLName xml.Name `xml:"jabber:x:oob x"`
	URL     string   `xml:"url"`
	Desc    string   `xml:"desc,omitempty"`
}