File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ package stanza
2
+
3
+ import (
4
+ "encoding/xml"
5
+ )
6
+
7
+ // XEP-0070: Verifying HTTP Requests via XMPP
8
+ type ConfirmPayload struct {
9
+ XMLName xml.Name `xml:"http://jabber.org/protocol/http-auth confirm"`
10
+ ID string `xml:"id,attr"`
11
+ Method string `xml:"method,attr"`
12
+ URL string `xml:"url,attr"`
13
+ }
14
+
15
+ func (c ConfirmPayload ) Namespace () string {
16
+ return c .XMLName .Space
17
+ }
18
+
19
+ func (c ConfirmPayload ) GetSet () * ResultSet {
20
+ return nil
21
+ }
22
+
23
+ // ---------------
24
+ // Builder helpers
25
+
26
+ // Confirm builds a default confirm payload
27
+ func (iq * IQ ) Confirm () * ConfirmPayload {
28
+ d := ConfirmPayload {
29
+ XMLName : xml.Name {Space : "http://jabber.org/protocol/http-auth" , Local : "confirm" },
30
+ }
31
+ iq .Payload = & d
32
+ return & d
33
+ }
34
+
35
+ // Set all confirm info
36
+ func (v * ConfirmPayload ) SetConfirm (id , method , url string ) * ConfirmPayload {
37
+ v .ID = id
38
+ v .Method = method
39
+ v .URL = url
40
+ return v
41
+ }
42
+
43
+ func init () {
44
+ TypeRegistry .MapExtension (PKTMessage ,
45
+ xml.Name {Space : "http://jabber.org/protocol/http-auth" , Local : "confirm" },
46
+ ConfirmPayload {})
47
+ TypeRegistry .MapExtension (PKTIQ ,
48
+ xml.Name {Space : "http://jabber.org/protocol/http-auth" , Local : "confirm" },
49
+ ConfirmPayload {})
50
+ }
You can’t perform that action at this time.
0 commit comments