diff options
Diffstat (limited to 'xmpp/handlers.go')
-rw-r--r-- | xmpp/handlers.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go index 945f119..be53189 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -230,7 +230,7 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) { } else { toJid, err := stanza.NewJid(msg.To) if err == nil && toJid.Bare() == gatewayJid && (strings.HasPrefix(msg.Body, "/") || strings.HasPrefix(msg.Body, "!")) { - response := session.ProcessTransportCommand(msg.Body, resource) + response, _ := session.ProcessTransportCommand(msg.Body, resource) if response != "" { gateway.SendServiceMessage(msg.From, response, component) } @@ -862,10 +862,18 @@ func handleSetQueryCommand(s xmpp.Sender, iq *stanza.IQ, command *stanza.Command } var response string + var success bool if toOk { - response, _ = session.ProcessChatCommand(toId, cmdString) + response, _, success = session.ProcessChatCommand(toId, cmdString) } else { - response = session.ProcessTransportCommand(cmdString, resource) + response, success = session.ProcessTransportCommand(cmdString, resource) + } + + var noteType string + if success { + noteType = stanza.CommandNoteTypeInfo + } else { + noteType = stanza.CommandNoteTypeErr } answer.Payload = &stanza.Command{ @@ -874,7 +882,7 @@ func handleSetQueryCommand(s xmpp.Sender, iq *stanza.IQ, command *stanza.Command Status: stanza.CommandStatusCompleted, CommandElement: &stanza.Note{ Text: response, - Type: stanza.CommandNoteTypeInfo, + Type: noteType, }, } |