Upgrade to go-xmpp version with multiple command elements support
This commit is contained in:
parent
249c942fc2
commit
e94a646e19
5
go.mod
5
go.mod
|
@ -4,6 +4,7 @@ go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/dgraph-io/badger/v4 v4.1.0
|
github.com/dgraph-io/badger/v4 v4.1.0
|
||||||
|
github.com/google/uuid v1.1.1
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/santhosh-tekuri/jsonschema v1.2.4
|
github.com/santhosh-tekuri/jsonschema v1.2.4
|
||||||
github.com/sirupsen/logrus v1.4.2
|
github.com/sirupsen/logrus v1.4.2
|
||||||
|
@ -23,7 +24,6 @@ require (
|
||||||
github.com/golang/protobuf v1.3.2 // indirect
|
github.com/golang/protobuf v1.3.2 // indirect
|
||||||
github.com/golang/snappy v0.0.3 // indirect
|
github.com/golang/snappy v0.0.3 // indirect
|
||||||
github.com/google/flatbuffers v1.12.1 // indirect
|
github.com/google/flatbuffers v1.12.1 // indirect
|
||||||
github.com/google/uuid v1.1.1 // indirect
|
|
||||||
github.com/klauspost/compress v1.12.3 // indirect
|
github.com/klauspost/compress v1.12.3 // indirect
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
|
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
|
||||||
go.opencensus.io v0.22.5 // indirect
|
go.opencensus.io v0.22.5 // indirect
|
||||||
|
@ -33,5 +33,6 @@ require (
|
||||||
nhooyr.io/websocket v1.6.5 // indirect
|
nhooyr.io/websocket v1.6.5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace gosrc.io/xmpp => dev.narayana.im/narayana/go-xmpp v0.0.0-20240131013505-18c46e6c59fd
|
replace gosrc.io/xmpp => dev.narayana.im/narayana/go-xmpp v0.0.0-20240512132113-6725c3862314
|
||||||
|
|
||||||
replace github.com/zelenin/go-tdlib => dev.narayana.im/narayana/go-tdlib v0.0.0-20240124222245-b4c12addb061
|
replace github.com/zelenin/go-tdlib => dev.narayana.im/narayana/go-tdlib v0.0.0-20240124222245-b4c12addb061
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -9,6 +9,8 @@ dev.narayana.im/narayana/go-xmpp v0.0.0-20220524203317-306b4ff58e8f h1:6249ajbMj
|
||||||
dev.narayana.im/narayana/go-xmpp v0.0.0-20220524203317-306b4ff58e8f/go.mod h1:L3NFMqYOxyLz3JGmgFyWf7r9htE91zVGiK40oW4RwdY=
|
dev.narayana.im/narayana/go-xmpp v0.0.0-20220524203317-306b4ff58e8f/go.mod h1:L3NFMqYOxyLz3JGmgFyWf7r9htE91zVGiK40oW4RwdY=
|
||||||
dev.narayana.im/narayana/go-xmpp v0.0.0-20240131013505-18c46e6c59fd h1:+UW+E7JjI88aH4beDn1cw6D8rs1I061hN91HU4Y4pT8=
|
dev.narayana.im/narayana/go-xmpp v0.0.0-20240131013505-18c46e6c59fd h1:+UW+E7JjI88aH4beDn1cw6D8rs1I061hN91HU4Y4pT8=
|
||||||
dev.narayana.im/narayana/go-xmpp v0.0.0-20240131013505-18c46e6c59fd/go.mod h1:L3NFMqYOxyLz3JGmgFyWf7r9htE91zVGiK40oW4RwdY=
|
dev.narayana.im/narayana/go-xmpp v0.0.0-20240131013505-18c46e6c59fd/go.mod h1:L3NFMqYOxyLz3JGmgFyWf7r9htE91zVGiK40oW4RwdY=
|
||||||
|
dev.narayana.im/narayana/go-xmpp v0.0.0-20240512132113-6725c3862314 h1:29/NjOGOUDceO73Hk4Nj4uVa1je8MULJlsDSvKxSN/k=
|
||||||
|
dev.narayana.im/narayana/go-xmpp v0.0.0-20240512132113-6725c3862314/go.mod h1:L3NFMqYOxyLz3JGmgFyWf7r9htE91zVGiK40oW4RwdY=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/agnivade/wasmbrowsertest v0.3.1/go.mod h1:zQt6ZTdl338xxRaMW395qccVE2eQm0SjC/SDz0mPWQI=
|
github.com/agnivade/wasmbrowsertest v0.3.1/go.mod h1:zQt6ZTdl338xxRaMW395qccVE2eQm0SjC/SDz0mPWQI=
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
|
|
@ -749,13 +749,20 @@ func handleSetQueryCommand(s xmpp.Sender, iq *stanza.IQ, command *stanza.Command
|
||||||
|
|
||||||
var cmdString string
|
var cmdString string
|
||||||
var cmdType telegram.CommandType
|
var cmdType telegram.CommandType
|
||||||
form, formOk := command.CommandElement.(*stanza.Form)
|
var form *stanza.Form
|
||||||
|
for _, ce := range command.CommandElements {
|
||||||
|
fo, formOk := ce.(*stanza.Form)
|
||||||
|
if formOk {
|
||||||
|
form = fo
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
if toOk {
|
if toOk {
|
||||||
cmdType = telegram.CommandTypeChat
|
cmdType = telegram.CommandTypeChat
|
||||||
} else {
|
} else {
|
||||||
cmdType = telegram.CommandTypeTransport
|
cmdType = telegram.CommandTypeTransport
|
||||||
}
|
}
|
||||||
if formOk {
|
if form != nil {
|
||||||
// just for the case the client messed the order somehow
|
// just for the case the client messed the order somehow
|
||||||
sort.Slice(form.Fields, func(i int, j int) bool {
|
sort.Slice(form.Fields, func(i int, j int) bool {
|
||||||
iField := form.Fields[i]
|
iField := form.Fields[i]
|
||||||
|
@ -847,7 +854,7 @@ func handleSetQueryCommand(s xmpp.Sender, iq *stanza.IQ, command *stanza.Command
|
||||||
SessionId: command.Node,
|
SessionId: command.Node,
|
||||||
Node: command.Node,
|
Node: command.Node,
|
||||||
Status: stanza.CommandStatusExecuting,
|
Status: stanza.CommandStatusExecuting,
|
||||||
CommandElement: &form,
|
CommandElements: []stanza.CommandElement{&form},
|
||||||
}
|
}
|
||||||
log.Debugf("form: %#v", form)
|
log.Debugf("form: %#v", form)
|
||||||
} else {
|
} else {
|
||||||
|
@ -887,10 +894,12 @@ func handleSetQueryCommand(s xmpp.Sender, iq *stanza.IQ, command *stanza.Command
|
||||||
SessionId: command.Node,
|
SessionId: command.Node,
|
||||||
Node: command.Node,
|
Node: command.Node,
|
||||||
Status: stanza.CommandStatusCompleted,
|
Status: stanza.CommandStatusCompleted,
|
||||||
CommandElement: &stanza.Note{
|
CommandElements: []stanza.CommandElement{
|
||||||
|
&stanza.Note{
|
||||||
Text: response,
|
Text: response,
|
||||||
Type: noteType,
|
Type: noteType,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue