Fix broken tests

This commit is contained in:
Mickael Remond 2018-01-15 12:52:28 +01:00
parent b3c11fb151
commit 20c2c44941
No known key found for this signature in database
GPG Key ID: E6F6045D79965AA3
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ func main() {
switch p := packet.(type) {
case xmpp.IQ:
switch inner := p.Payload.(type) {
switch inner := p.Payload[0].(type) {
case *xmpp.Node:
fmt.Printf("%q\n", inner)

View File

@ -63,7 +63,7 @@ func processMessage(client *xmpp.Client, p *mpg123.Player, packet *xmpp.Message)
}
func processIq(client *xmpp.Client, p *mpg123.Player, packet *xmpp.IQ) {
switch payload := packet.Payload.(type) {
switch payload := packet.Payload[0].(type) {
// We support IOT Control IQ
case *iot.ControlSet:
var url string
@ -76,7 +76,7 @@ func processIq(client *xmpp.Client, p *mpg123.Player, packet *xmpp.IQ) {
playSCURL(p, url)
setResponse := new(iot.ControlSetResponse)
reply := xmpp.IQ{PacketAttrs: xmpp.PacketAttrs{To: packet.From, Type: "result", Id: packet.Id}, Payload: setResponse}
reply := xmpp.IQ{PacketAttrs: xmpp.PacketAttrs{To: packet.From, Type: "result", Id: packet.Id}, Payload: []xmpp.IQPayload{setResponse}}
client.Send(reply.XMPPFormat())
// TODO add Soundclound artist / title retrieval
sendUserTune(client, "Radiohead", "Spectre")