diff --git a/xmpp/xmpp.go b/xmpp/xmpp.go index 1473e8c..dcde633 100644 --- a/xmpp/xmpp.go +++ b/xmpp/xmpp.go @@ -5,7 +5,7 @@ import ( "github.com/astaxie/beego" "github.com/astaxie/beego/logs" - "git.kingpenguin.tk/chteufleur/go-xmpp.git" + "git.kingpenguin.tk/chteufleur/go-xmpp.git/src/xmpp" "git.kingpenguin.tk/chteufleur/datahouse.git/models" "git.kingpenguin.tk/chteufleur/datahouse.git/models/relay" "git.kingpenguin.tk/chteufleur/datahouse.git/models/variables" @@ -79,7 +79,7 @@ func mainXMPP() { case *xmpp.Iq: // TODO check if the caller has privilege to ask switch v.PayloadName().Space { - case xmpp.NsDiscoItems: + case xmpp.NSDiscoItems: execDiscoCommand(v) case xmpp.NodeAdHocCommand: @@ -104,7 +104,7 @@ func SendPresence(status, tpye, message string) { func execDiscoCommand(iq *xmpp.Iq) { log.Info("Discovery item iq received") - reply := iq.Response(xmpp.IqTypeResult) + reply := iq.Response(xmpp.IQTypeResult) discoItem := &xmpp.DiscoItems{Node: xmpp.NodeAdHocCommand} relays := relay.GetAllRelay() @@ -133,11 +133,11 @@ func execCommandAdHoc(iq *xmpp.Iq) { if descriptionRelais == "" { descriptionRelais = relais.Mac } - if adHoc.SessionId == "" && adHoc.Action == xmpp.ActionAdHocExecute { + if adHoc.SessionID == "" && adHoc.Action == xmpp.ActionAdHocExecute { // First step in the command if relais.Id != 0 { - reply := iq.Response(xmpp.IqTypeResult) - cmd := &xmpp.AdHocCommand{Node: adHoc.Node, Status: xmpp.StatusAdHocExecute, SessionId: xmpp.SessionId()/*+";"+relais.Mac*/} + reply := iq.Response(xmpp.IQTypeResult) + cmd := &xmpp.AdHocCommand{Node: adHoc.Node, Status: xmpp.StatusAdHocExecute, SessionID: xmpp.SessionID()/*+";"+relais.Mac*/} cmdXForm := &xmpp.AdHocXForm{Type: xmpp.TypeAdHocForm, Title: "Commande relais "+descriptionRelais} field := &xmpp.AdHocField{Var: "command", Label: "Commande a executer", Type: "list-single"} @@ -156,8 +156,8 @@ func execCommandAdHoc(iq *xmpp.Iq) { err := relais.Toggle() - reply := iq.Response(xmpp.IqTypeResult) - cmd := &xmpp.AdHocCommand{Node: adHoc.Node, Status: xmpp.StatusAdHocCompleted, SessionId: adHoc.SessionId} + reply := iq.Response(xmpp.IQTypeResult) + cmd := &xmpp.AdHocCommand{Node: adHoc.Node, Status: xmpp.StatusAdHocCompleted, SessionID: adHoc.SessionID} cmdXForm := &xmpp.AdHocXForm{Type: xmpp.TypeAdHocResult, Title: "Commande relais "+descriptionRelais} cmd.XForm = *cmdXForm @@ -174,8 +174,8 @@ func execCommandAdHoc(iq *xmpp.Iq) { client.Out <- reply } else if adHoc.Action == xmpp.ActionAdHocCancel { // command canceled - reply := iq.Response(xmpp.IqTypeResult) - cmd := &xmpp.AdHocCommand{Node: adHoc.Node, Status: xmpp.StatusAdHocCanceled, SessionId: adHoc.SessionId} + reply := iq.Response(xmpp.IQTypeResult) + cmd := &xmpp.AdHocCommand{Node: adHoc.Node, Status: xmpp.StatusAdHocCanceled, SessionID: adHoc.SessionID} reply.PayloadEncode(cmd) client.Out <- reply }