Modification because of un-golang fix names in lib go-xmpp.
This commit is contained in:
parent
8384410023
commit
ea4f78e23b
|
|
@ -51,8 +51,8 @@ func (confirmation *Confirmation) SendConfirmation() {
|
||||||
func (confirmation *Confirmation) askViaIQ() {
|
func (confirmation *Confirmation) askViaIQ() {
|
||||||
stanzaID++
|
stanzaID++
|
||||||
stanzaIDstr := strconv.Itoa(stanzaID)
|
stanzaIDstr := strconv.Itoa(stanzaID)
|
||||||
m := xmpp.Iq{Type: xmpp.IQTypeGet, To: confirmation.JID, From: jid.Full(), Id: stanzaIDstr}
|
m := xmpp.IQ{Type: xmpp.IQTypeGet, To: confirmation.JID, From: jid.Full(), ID: stanzaIDstr}
|
||||||
confirm := &xmpp.Confirm{Id: confirmation.Transaction, Method: confirmation.Method, URL: confirmation.Domain}
|
confirm := &xmpp.Confirm{ID: confirmation.Transaction, Method: confirmation.Method, URL: confirmation.Domain}
|
||||||
m.PayloadEncode(confirm)
|
m.PayloadEncode(confirm)
|
||||||
WaitIqMessages[stanzaIDstr] = confirmation
|
WaitIqMessages[stanzaIDstr] = confirmation
|
||||||
comp.Out <- m
|
comp.Out <- m
|
||||||
|
|
@ -65,7 +65,7 @@ func (confirmation *Confirmation) askViaMessage() {
|
||||||
m := xmpp.Message{From: jid.Full(), To: confirmation.JID, Type: xmpp.MessageTypeNormal}
|
m := xmpp.Message{From: jid.Full(), To: confirmation.JID, Type: xmpp.MessageTypeNormal}
|
||||||
m.Thread = xmpp.SessionID()
|
m.Thread = xmpp.SessionID()
|
||||||
confirmation.setBodies(&m)
|
confirmation.setBodies(&m)
|
||||||
m.Confirm = &xmpp.Confirm{Id: confirmation.Transaction, Method: confirmation.Method, URL: confirmation.Domain}
|
m.Confirm = &xmpp.Confirm{ID: confirmation.Transaction, Method: confirmation.Method, URL: confirmation.Domain}
|
||||||
|
|
||||||
log.Printf("%sSend message %v", LogInfo, m)
|
log.Printf("%sSend message %v", LogInfo, m)
|
||||||
WaitMessageAnswers[confirmation.Transaction] = confirmation
|
WaitMessageAnswers[confirmation.Transaction] = confirmation
|
||||||
|
|
|
||||||
14
xmpp/xmpp.go
14
xmpp/xmpp.go
|
|
@ -95,7 +95,7 @@ func mainXMPP() {
|
||||||
case *xmpp.Message:
|
case *xmpp.Message:
|
||||||
confirm := v.Confirm
|
confirm := v.Confirm
|
||||||
if confirm != nil {
|
if confirm != nil {
|
||||||
confirmation := WaitMessageAnswers[confirm.Id]
|
confirmation := WaitMessageAnswers[confirm.ID]
|
||||||
processConfirm(v, confirmation)
|
processConfirm(v, confirmation)
|
||||||
} else {
|
} else {
|
||||||
// If body is the confirmation id, it will be considerated as accepted.
|
// If body is the confirmation id, it will be considerated as accepted.
|
||||||
|
|
@ -109,7 +109,7 @@ func mainXMPP() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case *xmpp.Iq:
|
case *xmpp.IQ:
|
||||||
switch v.PayloadName().Space {
|
switch v.PayloadName().Space {
|
||||||
case xmpp.NSDiscoInfo:
|
case xmpp.NSDiscoInfo:
|
||||||
execDisco(v)
|
execDisco(v)
|
||||||
|
|
@ -131,12 +131,12 @@ func mainXMPP() {
|
||||||
case xmpp.NSHTTPAuth:
|
case xmpp.NSHTTPAuth:
|
||||||
confirm := &xmpp.Confirm{}
|
confirm := &xmpp.Confirm{}
|
||||||
v.PayloadDecode(confirm)
|
v.PayloadDecode(confirm)
|
||||||
confirmation := WaitIqMessages[v.Id]
|
confirmation := WaitIqMessages[v.ID]
|
||||||
processConfirm(v, confirmation)
|
processConfirm(v, confirmation)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Handle reply iq that doesn't contain HTTP-Auth namespace
|
// Handle reply iq that doesn't contain HTTP-Auth namespace
|
||||||
confirmation := WaitIqMessages[v.Id]
|
confirmation := WaitIqMessages[v.ID]
|
||||||
processConfirm(v, confirmation)
|
processConfirm(v, confirmation)
|
||||||
|
|
||||||
if confirmation == nil {
|
if confirmation == nil {
|
||||||
|
|
@ -154,7 +154,7 @@ func mainXMPP() {
|
||||||
|
|
||||||
func processConfirm(x interface{}, confirmation *Confirmation) {
|
func processConfirm(x interface{}, confirmation *Confirmation) {
|
||||||
mes, mesOK := x.(*xmpp.Message)
|
mes, mesOK := x.(*xmpp.Message)
|
||||||
iq, iqOK := x.(*xmpp.Iq)
|
iq, iqOK := x.(*xmpp.IQ)
|
||||||
|
|
||||||
if confirmation != nil {
|
if confirmation != nil {
|
||||||
if mesOK && mes.Error != nil {
|
if mesOK && mes.Error != nil {
|
||||||
|
|
@ -195,7 +195,7 @@ func must(v interface{}, err error) interface{} {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func execDisco(iq *xmpp.Iq) {
|
func execDisco(iq *xmpp.IQ) {
|
||||||
log.Printf("%sDisco Feature", LogInfo)
|
log.Printf("%sDisco Feature", LogInfo)
|
||||||
|
|
||||||
discoInfoReceived := &xmpp.DiscoItems{}
|
discoInfoReceived := &xmpp.DiscoItems{}
|
||||||
|
|
@ -226,7 +226,7 @@ func execDisco(iq *xmpp.Iq) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func execDiscoCommand(iq *xmpp.Iq) {
|
func execDiscoCommand(iq *xmpp.IQ) {
|
||||||
log.Printf("%sAd-Hoc Command", LogInfo)
|
log.Printf("%sAd-Hoc Command", LogInfo)
|
||||||
reply := iq.Response(xmpp.IQTypeResult)
|
reply := iq.Response(xmpp.IQTypeResult)
|
||||||
discoItem := &xmpp.DiscoItems{Node: xmpp.NodeAdHocCommand}
|
discoItem := &xmpp.DiscoItems{Node: xmpp.NodeAdHocCommand}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue