mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-12-25 18:45:41 +00:00
Update go-xmpp dependency (#2151)
This commit is contained in:
parent
a89267943c
commit
65d78e38af
2
.github/workflows/development.yml
vendored
2
.github/workflows/development.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: latest
|
||||
args: "-v --new-from-rev HEAD~5"
|
||||
args: "-v --new-from-rev HEAD~5 --timeout=5m"
|
||||
test-build-upload:
|
||||
strategy:
|
||||
matrix:
|
||||
|
6
go.mod
6
go.mod
@ -21,7 +21,7 @@ require (
|
||||
github.com/labstack/echo/v4 v4.12.0
|
||||
github.com/lrstanley/girc v0.0.0-20240519163535-a518c5b87a79
|
||||
github.com/matterbridge/Rocket.Chat.Go.SDK v0.0.0-20211016222428-79310a412696
|
||||
github.com/matterbridge/go-xmpp v0.0.0-20211030125215-791a06c5f1be
|
||||
github.com/matterbridge/go-xmpp v0.0.0-20240523230155-7154bfeb76e8
|
||||
github.com/matterbridge/gomatrix v0.0.0-20220411225302-271e5088ea27
|
||||
github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75
|
||||
github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba
|
||||
@ -150,6 +150,4 @@ require (
|
||||
|
||||
//replace github.com/matrix-org/gomatrix => github.com/matterbridge/gomatrix v0.0.0-20220205235239-607eb9ee6419
|
||||
|
||||
go 1.21
|
||||
|
||||
toolchain go1.22.3
|
||||
go 1.22.0
|
||||
|
4
go.sum
4
go.sum
@ -968,8 +968,8 @@ github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kN
|
||||
github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho=
|
||||
github.com/matterbridge/Rocket.Chat.Go.SDK v0.0.0-20211016222428-79310a412696 h1:pmPKkN3RJM9wVMZidR99epzK0+gatQiqVtvP1FacZcQ=
|
||||
github.com/matterbridge/Rocket.Chat.Go.SDK v0.0.0-20211016222428-79310a412696/go.mod h1:c6MxwqHD+0HvtAJjsHMIdPCiAwGiQwPRPTp69ACMg8A=
|
||||
github.com/matterbridge/go-xmpp v0.0.0-20211030125215-791a06c5f1be h1:zlirT+LngOJ60G6FVzI87DljGZLUnfNzmXja61EjtYM=
|
||||
github.com/matterbridge/go-xmpp v0.0.0-20211030125215-791a06c5f1be/go.mod h1:ECDRehsR9TYTKCAsRS8/wLeOk6UUqDydw47ln7wG41Q=
|
||||
github.com/matterbridge/go-xmpp v0.0.0-20240523230155-7154bfeb76e8 h1:UkpezVlW6/j4qB2FSsz4na2FfZUbIDMAblpjw0Cgqcg=
|
||||
github.com/matterbridge/go-xmpp v0.0.0-20240523230155-7154bfeb76e8/go.mod h1:Vl95jJ8rOBCHUR++A1n6nM5sMk1oHcwInsaxRTR9NM4=
|
||||
github.com/matterbridge/gomatrix v0.0.0-20220411225302-271e5088ea27 h1:9XSppnbvvReVom+wphkeF4lbhuT6vCYIdyzpwFtW89c=
|
||||
github.com/matterbridge/gomatrix v0.0.0-20220411225302-271e5088ea27/go.mod h1:/x38AoZf70fK9yZ5gs3BNCaF7/J4QEo4ZpwtLjX95eQ=
|
||||
github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75 h1:GslZKF7lW7oSisycGLpxPO+TnKJuA4VZuTWIfYZrClc=
|
||||
|
2
vendor/github.com/matterbridge/go-xmpp/README.md
generated
vendored
2
vendor/github.com/matterbridge/go-xmpp/README.md
generated
vendored
@ -3,4 +3,4 @@ go-xmpp
|
||||
|
||||
go xmpp library (original was written by russ cox )
|
||||
|
||||
[Documentation](https://godoc.org/github.com/mattn/go-xmpp)
|
||||
[Documentation](https://godoc.org/github.com/xmppo/go-xmpp)
|
||||
|
1193
vendor/github.com/matterbridge/go-xmpp/xmpp.go
generated
vendored
1193
vendor/github.com/matterbridge/go-xmpp/xmpp.go
generated
vendored
File diff suppressed because it is too large
Load Diff
18
vendor/github.com/matterbridge/go-xmpp/xmpp_information_query.go
generated
vendored
18
vendor/github.com/matterbridge/go-xmpp/xmpp_information_query.go
generated
vendored
@ -5,12 +5,14 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const IQTypeGet = "get"
|
||||
const IQTypeSet = "set"
|
||||
const IQTypeResult = "result"
|
||||
const (
|
||||
IQTypeGet = "get"
|
||||
IQTypeSet = "set"
|
||||
IQTypeResult = "result"
|
||||
)
|
||||
|
||||
func (c *Client) Discovery() (string, error) {
|
||||
// use getCookie for a pseudo random id.
|
||||
// use UUIDv4 for a pseudo random id.
|
||||
reqID := strconv.FormatUint(uint64(getCookie()), 10)
|
||||
return c.RawInformationQuery(c.jid, c.domain, reqID, IQTypeGet, XMPPNS_DISCO_ITEMS, "")
|
||||
}
|
||||
@ -34,14 +36,14 @@ func (c *Client) DiscoverEntityItems(jid string) (string, error) {
|
||||
|
||||
// RawInformationQuery sends an information query request to the server.
|
||||
func (c *Client) RawInformationQuery(from, to, id, iqType, requestNamespace, body string) (string, error) {
|
||||
const xmlIQ = "<iq from='%s' to='%s' id='%s' type='%s'><query xmlns='%s'>%s</query></iq>"
|
||||
_, err := fmt.Fprintf(c.conn, xmlIQ, xmlEscape(from), xmlEscape(to), id, iqType, requestNamespace, body)
|
||||
const xmlIQ = "<iq from='%s' to='%s' id='%s' type='%s'><query xmlns='%s'>%s</query></iq>\n"
|
||||
_, err := fmt.Fprintf(c.stanzaWriter, xmlIQ, xmlEscape(from), xmlEscape(to), id, iqType, requestNamespace, body)
|
||||
return id, err
|
||||
}
|
||||
|
||||
// rawInformation send a IQ request with the payload body to the server
|
||||
func (c *Client) RawInformation(from, to, id, iqType, body string) (string, error) {
|
||||
const xmlIQ = "<iq from='%s' to='%s' id='%s' type='%s'>%s</iq>"
|
||||
_, err := fmt.Fprintf(c.conn, xmlIQ, xmlEscape(from), xmlEscape(to), id, iqType, body)
|
||||
const xmlIQ = "<iq from='%s' to='%s' id='%s' type='%s'>%s</iq>\n"
|
||||
_, err := fmt.Fprintf(c.stanzaWriter, xmlIQ, xmlEscape(from), xmlEscape(to), id, iqType, body)
|
||||
return id, err
|
||||
}
|
||||
|
96
vendor/github.com/matterbridge/go-xmpp/xmpp_muc.go
generated
vendored
96
vendor/github.com/matterbridge/go-xmpp/xmpp_muc.go
generated
vendored
@ -25,7 +25,7 @@ const (
|
||||
|
||||
// Send sends room topic wrapped inside an XMPP message stanza body.
|
||||
func (c *Client) SendTopic(chat Chat) (n int, err error) {
|
||||
return fmt.Fprintf(c.conn, "<message to='%s' type='%s' xml:lang='en'>"+"<subject>%s</subject></message>",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<message to='%s' type='%s' xml:lang='en'>"+"<subject>%s</subject></message>\n",
|
||||
xmlEscape(chat.Remote), xmlEscape(chat.Type), xmlEscape(chat.Text))
|
||||
}
|
||||
|
||||
@ -33,10 +33,10 @@ func (c *Client) JoinMUCNoHistory(jid, nick string) (n int, err error) {
|
||||
if nick == "" {
|
||||
nick = c.jid
|
||||
}
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s'>"+
|
||||
"<history maxchars='0'/></x>\n"+
|
||||
"</presence>",
|
||||
"<history maxchars='0'/></x>"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC)
|
||||
}
|
||||
|
||||
@ -47,34 +47,34 @@ func (c *Client) JoinMUC(jid, nick string, history_type, history int, history_da
|
||||
}
|
||||
switch history_type {
|
||||
case NoHistory:
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
"<x xmlns='%s' />\n"+
|
||||
"</presence>",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s' />"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC)
|
||||
case CharHistory:
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
"<x xmlns='%s'>\n"+
|
||||
"<history maxchars='%d'/></x>\n"+
|
||||
"</presence>",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s'>"+
|
||||
"<history maxchars='%d'/></x>"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC, history)
|
||||
case StanzaHistory:
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
"<x xmlns='%s'>\n"+
|
||||
"<history maxstanzas='%d'/></x>\n"+
|
||||
"</presence>",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s'>"+
|
||||
"<history maxstanzas='%d'/></x>"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC, history)
|
||||
case SecondsHistory:
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
"<x xmlns='%s'>\n"+
|
||||
"<history seconds='%d'/></x>\n"+
|
||||
"</presence>",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s'>"+
|
||||
"<history seconds='%d'/></x>"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC, history)
|
||||
case SinceHistory:
|
||||
if history_date != nil {
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
"<x xmlns='%s'>\n"+
|
||||
"<history since='%s'/></x>\n"+
|
||||
"</presence>",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s'>"+
|
||||
"<history since='%s'/></x>"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC, history_date.Format(time.RFC3339))
|
||||
}
|
||||
}
|
||||
@ -88,40 +88,40 @@ func (c *Client) JoinProtectedMUC(jid, nick string, password string, history_typ
|
||||
}
|
||||
switch history_type {
|
||||
case NoHistory:
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
"<x xmlns='%s'>\n"+
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s'>"+
|
||||
"<password>%s</password>"+
|
||||
"</x>\n"+
|
||||
"</presence>",
|
||||
"</x>"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC, xmlEscape(password))
|
||||
case CharHistory:
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
"<x xmlns='%s'>\n"+
|
||||
"<password>%s</password>\n"+
|
||||
"<history maxchars='%d'/></x>\n"+
|
||||
"</presence>",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s'>"+
|
||||
"<password>%s</password>"+
|
||||
"<history maxchars='%d'/></x>"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC, xmlEscape(password), history)
|
||||
case StanzaHistory:
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
"<x xmlns='%s'>\n"+
|
||||
"<password>%s</password>\n"+
|
||||
"<history maxstanzas='%d'/></x>\n"+
|
||||
"</presence>",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s'>"+
|
||||
"<password>%s</password>"+
|
||||
"<history maxstanzas='%d'/></x>"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC, xmlEscape(password), history)
|
||||
case SecondsHistory:
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
"<x xmlns='%s'>\n"+
|
||||
"<password>%s</password>\n"+
|
||||
"<history seconds='%d'/></x>\n"+
|
||||
"</presence>",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s'>"+
|
||||
"<password>%s</password>"+
|
||||
"<history seconds='%d'/></x>"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC, xmlEscape(password), history)
|
||||
case SinceHistory:
|
||||
if history_date != nil {
|
||||
return fmt.Fprintf(c.conn, "<presence to='%s/%s'>\n"+
|
||||
"<x xmlns='%s'>\n"+
|
||||
"<password>%s</password>\n"+
|
||||
"<history since='%s'/></x>\n"+
|
||||
"</presence>",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence to='%s/%s'>"+
|
||||
"<x xmlns='%s'>"+
|
||||
"<password>%s</password>"+
|
||||
"<history since='%s'/></x>"+
|
||||
"</presence>\n",
|
||||
xmlEscape(jid), xmlEscape(nick), nsMUC, xmlEscape(password), history_date.Format(time.RFC3339))
|
||||
}
|
||||
}
|
||||
@ -130,6 +130,6 @@ func (c *Client) JoinProtectedMUC(jid, nick string, password string, history_typ
|
||||
|
||||
// xep-0045 7.14
|
||||
func (c *Client) LeaveMUC(jid string) (n int, err error) {
|
||||
return fmt.Fprintf(c.conn, "<presence from='%s' to='%s' type='unavailable' />",
|
||||
return fmt.Fprintf(c.stanzaWriter, "<presence from='%s' to='%s' type='unavailable' />\n",
|
||||
c.jid, xmlEscape(jid))
|
||||
}
|
||||
|
14
vendor/github.com/matterbridge/go-xmpp/xmpp_ping.go
generated
vendored
14
vendor/github.com/matterbridge/go-xmpp/xmpp_ping.go
generated
vendored
@ -11,23 +11,23 @@ func (c *Client) PingC2S(jid, server string) error {
|
||||
if server == "" {
|
||||
server = c.domain
|
||||
}
|
||||
_, err := fmt.Fprintf(c.conn, "<iq from='%s' to='%s' id='c2s1' type='get'>\n"+
|
||||
"<ping xmlns='urn:xmpp:ping'/>\n"+
|
||||
"</iq>",
|
||||
_, err := fmt.Fprintf(c.stanzaWriter, "<iq from='%s' to='%s' id='c2s1' type='get'>"+
|
||||
"<ping xmlns='urn:xmpp:ping'/>"+
|
||||
"</iq>\n",
|
||||
xmlEscape(jid), xmlEscape(server))
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Client) PingS2S(fromServer, toServer string) error {
|
||||
_, err := fmt.Fprintf(c.conn, "<iq from='%s' to='%s' id='s2s1' type='get'>\n"+
|
||||
"<ping xmlns='urn:xmpp:ping'/>\n"+
|
||||
"</iq>",
|
||||
_, err := fmt.Fprintf(c.stanzaWriter, "<iq from='%s' to='%s' id='s2s1' type='get'>"+
|
||||
"<ping xmlns='urn:xmpp:ping'/>"+
|
||||
"</iq>\n",
|
||||
xmlEscape(fromServer), xmlEscape(toServer))
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Client) SendResultPing(id, toServer string) error {
|
||||
_, err := fmt.Fprintf(c.conn, "<iq type='result' to='%s' id='%s'/>",
|
||||
_, err := fmt.Fprintf(c.stanzaWriter, "<iq type='result' to='%s' id='%s'/>\n",
|
||||
xmlEscape(toServer), xmlEscape(id))
|
||||
return err
|
||||
}
|
||||
|
5
vendor/github.com/matterbridge/go-xmpp/xmpp_pubsub.go
generated
vendored
5
vendor/github.com/matterbridge/go-xmpp/xmpp_pubsub.go
generated
vendored
@ -22,11 +22,6 @@ type clientPubsubItems struct {
|
||||
Items []clientPubsubItem `xml:"item"`
|
||||
}
|
||||
|
||||
type clientPubsub struct {
|
||||
XMLName xml.Name `xml:"pubsub"`
|
||||
Items clientPubsubItems `xml:"items"`
|
||||
}
|
||||
|
||||
type clientPubsubEvent struct {
|
||||
XMLName xml.Name `xml:"event"`
|
||||
XMLNS string `xml:"xmlns,attr"`
|
||||
|
11
vendor/github.com/matterbridge/go-xmpp/xmpp_subscription.go
generated
vendored
11
vendor/github.com/matterbridge/go-xmpp/xmpp_subscription.go
generated
vendored
@ -5,16 +5,21 @@ import (
|
||||
)
|
||||
|
||||
func (c *Client) ApproveSubscription(jid string) {
|
||||
fmt.Fprintf(c.conn, "<presence to='%s' type='subscribed'/>",
|
||||
fmt.Fprintf(c.stanzaWriter, "<presence to='%s' type='subscribed'/>\n",
|
||||
xmlEscape(jid))
|
||||
}
|
||||
|
||||
func (c *Client) RevokeSubscription(jid string) {
|
||||
fmt.Fprintf(c.conn, "<presence to='%s' type='unsubscribed'/>",
|
||||
fmt.Fprintf(c.stanzaWriter, "<presence to='%s' type='unsubscribed'/>\n",
|
||||
xmlEscape(jid))
|
||||
}
|
||||
|
||||
func (c *Client) RetrieveSubscription(jid string) {
|
||||
fmt.Fprintf(c.conn, "<presence to='%s' type='unsubscribe'/>\n",
|
||||
xmlEscape(jid))
|
||||
}
|
||||
|
||||
func (c *Client) RequestSubscription(jid string) {
|
||||
fmt.Fprintf(c.conn, "<presence to='%s' type='subscribe'/>",
|
||||
fmt.Fprintf(c.stanzaWriter, "<presence to='%s' type='subscribe'/>\n",
|
||||
xmlEscape(jid))
|
||||
}
|
||||
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -209,8 +209,8 @@ github.com/magiconair/properties
|
||||
github.com/matterbridge/Rocket.Chat.Go.SDK/models
|
||||
github.com/matterbridge/Rocket.Chat.Go.SDK/realtime
|
||||
github.com/matterbridge/Rocket.Chat.Go.SDK/rest
|
||||
# github.com/matterbridge/go-xmpp v0.0.0-20211030125215-791a06c5f1be
|
||||
## explicit
|
||||
# github.com/matterbridge/go-xmpp v0.0.0-20240523230155-7154bfeb76e8
|
||||
## explicit; go 1.21.5
|
||||
github.com/matterbridge/go-xmpp
|
||||
# github.com/matterbridge/gomatrix v0.0.0-20220411225302-271e5088ea27
|
||||
## explicit; go 1.17
|
||||
|
Loading…
Reference in New Issue
Block a user