mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-26 04:21:38 +00:00
Update xmpp vendor
This commit is contained in:
parent
e4ec27c5e2
commit
4ef32103ca
67
vendor/github.com/mattn/go-xmpp/xmpp.go
generated
vendored
67
vendor/github.com/mattn/go-xmpp/xmpp.go
generated
vendored
@ -536,12 +536,13 @@ func (c *Client) IsEncrypted() bool {
|
|||||||
|
|
||||||
// Chat is an incoming or outgoing XMPP chat message.
|
// Chat is an incoming or outgoing XMPP chat message.
|
||||||
type Chat struct {
|
type Chat struct {
|
||||||
Remote string
|
Remote string
|
||||||
Type string
|
Type string
|
||||||
Text string
|
Text string
|
||||||
Roster Roster
|
Roster Roster
|
||||||
Other []string
|
Other []string
|
||||||
Stamp time.Time
|
OtherElem []XMLElement
|
||||||
|
Stamp time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
type Roster []Contact
|
type Roster []Contact
|
||||||
@ -584,11 +585,12 @@ func (c *Client) Recv() (stanza interface{}, err error) {
|
|||||||
v.Delay.Stamp,
|
v.Delay.Stamp,
|
||||||
)
|
)
|
||||||
chat := Chat{
|
chat := Chat{
|
||||||
Remote: v.From,
|
Remote: v.From,
|
||||||
Type: v.Type,
|
Type: v.Type,
|
||||||
Text: v.Body,
|
Text: v.Body,
|
||||||
Other: v.Other,
|
Other: v.OtherStrings(),
|
||||||
Stamp: stamp,
|
OtherElem: v.Other,
|
||||||
|
Stamp: stamp,
|
||||||
}
|
}
|
||||||
return chat, nil
|
return chat, nil
|
||||||
case *clientQuery:
|
case *clientQuery:
|
||||||
@ -600,6 +602,12 @@ func (c *Client) Recv() (stanza interface{}, err error) {
|
|||||||
case *clientPresence:
|
case *clientPresence:
|
||||||
return Presence{v.From, v.To, v.Type, v.Show, v.Status}, nil
|
return Presence{v.From, v.To, v.Type, v.Show, v.Status}, nil
|
||||||
case *clientIQ:
|
case *clientIQ:
|
||||||
|
if bytes.Equal(v.Query, []byte(`<ping xmlns='urn:xmpp:ping'/>`)) {
|
||||||
|
err := c.SendResultPing(v.ID, v.From)
|
||||||
|
if err != nil {
|
||||||
|
return Chat{}, err
|
||||||
|
}
|
||||||
|
}
|
||||||
return IQ{ID: v.ID, From: v.From, To: v.To, Type: v.Type, Query: v.Query}, nil
|
return IQ{ID: v.ID, From: v.From, To: v.To, Type: v.Type, Query: v.Query}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -714,11 +722,46 @@ type clientMessage struct {
|
|||||||
Thread string `xml:"thread"`
|
Thread string `xml:"thread"`
|
||||||
|
|
||||||
// Any hasn't matched element
|
// Any hasn't matched element
|
||||||
Other []string `xml:",any"`
|
Other []XMLElement `xml:",any"`
|
||||||
|
|
||||||
Delay Delay `xml:"delay"`
|
Delay Delay `xml:"delay"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *clientMessage) OtherStrings() []string {
|
||||||
|
a := make([]string, len(m.Other))
|
||||||
|
for i, e := range m.Other {
|
||||||
|
a[i] = e.String()
|
||||||
|
}
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
|
||||||
|
type XMLElement struct {
|
||||||
|
XMLName xml.Name
|
||||||
|
InnerXML string `xml:",innerxml"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *XMLElement) String() string {
|
||||||
|
r := bytes.NewReader([]byte(e.InnerXML))
|
||||||
|
d := xml.NewDecoder(r)
|
||||||
|
var buf bytes.Buffer
|
||||||
|
for {
|
||||||
|
tok, err := d.Token()
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
switch v := tok.(type) {
|
||||||
|
case xml.StartElement:
|
||||||
|
err = d.Skip()
|
||||||
|
case xml.CharData:
|
||||||
|
_, err = buf.Write(v)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buf.String()
|
||||||
|
}
|
||||||
|
|
||||||
type Delay struct {
|
type Delay struct {
|
||||||
Stamp string `xml:"stamp,attr"`
|
Stamp string `xml:"stamp,attr"`
|
||||||
}
|
}
|
||||||
|
6
vendor/github.com/mattn/go-xmpp/xmpp_ping.go
generated
vendored
6
vendor/github.com/mattn/go-xmpp/xmpp_ping.go
generated
vendored
@ -25,3 +25,9 @@ func (c *Client) PingS2S(fromServer, toServer string) error {
|
|||||||
xmlEscape(fromServer), xmlEscape(toServer))
|
xmlEscape(fromServer), xmlEscape(toServer))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) SendResultPing(id, toServer string) error {
|
||||||
|
_, err := fmt.Fprintf(c.conn, "<iq type='result' to='%s' id='%s'/>",
|
||||||
|
xmlEscape(toServer), xmlEscape(id))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
2
vendor/manifest
vendored
2
vendor/manifest
vendored
@ -113,7 +113,7 @@
|
|||||||
"importpath": "github.com/mattn/go-xmpp",
|
"importpath": "github.com/mattn/go-xmpp",
|
||||||
"repository": "https://github.com/mattn/go-xmpp",
|
"repository": "https://github.com/mattn/go-xmpp",
|
||||||
"vcs": "git",
|
"vcs": "git",
|
||||||
"revision": "e44d1877bb457f5c3991903e9934a31e55c3a2ad",
|
"revision": "f4550b5399387339df5ce4c3f88c1ef85333bdd5",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user