aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go.mod5
-rw-r--r--go.sum2
-rw-r--r--xmpp/handlers.go33
3 files changed, 26 insertions, 14 deletions
diff --git a/go.mod b/go.mod
index fe7aeb4..4eb2643 100644
--- a/go.mod
+++ b/go.mod
@@ -4,6 +4,7 @@ go 1.19
require (
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/santhosh-tekuri/jsonschema v1.2.4
github.com/sirupsen/logrus v1.4.2
@@ -23,7 +24,6 @@ require (
github.com/golang/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.3 // 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/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
go.opencensus.io v0.22.5 // indirect
@@ -33,5 +33,6 @@ require (
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
diff --git a/go.sum b/go.sum
index f5e218f..82e391a 100644
--- a/go.sum
+++ b/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-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-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/agnivade/wasmbrowsertest v0.3.1/go.mod h1:zQt6ZTdl338xxRaMW395qccVE2eQm0SjC/SDz0mPWQI=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
diff --git a/xmpp/handlers.go b/xmpp/handlers.go
index 1a47c10..2615290 100644
--- a/xmpp/handlers.go
+++ b/xmpp/handlers.go
@@ -749,13 +749,20 @@ func handleSetQueryCommand(s xmpp.Sender, iq *stanza.IQ, command *stanza.Command
var cmdString string
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 {
cmdType = telegram.CommandTypeChat
} else {
cmdType = telegram.CommandTypeTransport
}
- if formOk {
+ if form != nil {
// just for the case the client messed the order somehow
sort.Slice(form.Fields, func(i int, j int) bool {
iField := form.Fields[i]
@@ -844,10 +851,10 @@ func handleSetQueryCommand(s xmpp.Sender, iq *stanza.IQ, command *stanza.Command
Fields: fields,
}
answer.Payload = &stanza.Command{
- SessionId: command.Node,
- Node: command.Node,
- Status: stanza.CommandStatusExecuting,
- CommandElement: &form,
+ SessionId: command.Node,
+ Node: command.Node,
+ Status: stanza.CommandStatusExecuting,
+ CommandElements: []stanza.CommandElement{&form},
}
log.Debugf("form: %#v", form)
} else {
@@ -884,12 +891,14 @@ func handleSetQueryCommand(s xmpp.Sender, iq *stanza.IQ, command *stanza.Command
}
answer.Payload = &stanza.Command{
- SessionId: command.Node,
- Node: command.Node,
- Status: stanza.CommandStatusCompleted,
- CommandElement: &stanza.Note{
- Text: response,
- Type: noteType,
+ SessionId: command.Node,
+ Node: command.Node,
+ Status: stanza.CommandStatusCompleted,
+ CommandElements: []stanza.CommandElement{
+ &stanza.Note{
+ Text: response,
+ Type: noteType,
+ },
},
}