|
|
|
@ -224,9 +224,9 @@ func (handshakeDecoder) decode(p *xml.Decoder, se xml.StartElement) (Handshake,
|
|
|
|
|
// depending on the context.
|
|
|
|
|
type Delegation struct {
|
|
|
|
|
MsgExtension
|
|
|
|
|
XMLName xml.Name `xml:"urn:xmpp:delegation:1 delegation"`
|
|
|
|
|
Forwarded Forwarded // This is used in iq to wrap delegated iqs
|
|
|
|
|
Delegated Delegated // This is used in a message to confirm delegated namespace
|
|
|
|
|
XMLName xml.Name `xml:"urn:xmpp:delegation:1 delegation"`
|
|
|
|
|
Forwarded *Forwarded // This is used in iq to wrap delegated iqs
|
|
|
|
|
Delegated *Delegated // This is used in a message to confirm delegated namespace
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *Delegation) Namespace() string {
|
|
|
|
@ -234,10 +234,33 @@ func (d *Delegation) Namespace() string {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Forwarded struct {
|
|
|
|
|
XMLName xml.Name `xml:"urn:xmpp:forward:0 forwarded"`
|
|
|
|
|
IQ IQ
|
|
|
|
|
Message Message
|
|
|
|
|
Presence Presence
|
|
|
|
|
XMLName xml.Name `xml:"urn:xmpp:forward:0 forwarded"`
|
|
|
|
|
Stanza Packet
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UnmarshalXML is a custom unmarshal function used by xml.Unmarshal to
|
|
|
|
|
// transform generic XML content into hierarchical Node structure.
|
|
|
|
|
func (f *Forwarded) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
|
|
|
|
// Check subelements to extract required field as boolean
|
|
|
|
|
for {
|
|
|
|
|
t, err := d.Token()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch tt := t.(type) {
|
|
|
|
|
|
|
|
|
|
case xml.StartElement:
|
|
|
|
|
if packet, err := decodeClient(d, tt); err == nil {
|
|
|
|
|
f.Stanza = packet
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case xml.EndElement:
|
|
|
|
|
if tt == start.End() {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Delegated struct {
|
|
|
|
|