Merge branch 'master' into oauth
Conflicts: xmpp/confirmation.go
This commit is contained in:
commit
600117e9b2
|
|
@ -96,8 +96,8 @@ func (confirmation *Confirmation) SendConfirmation() {
|
|||
func (confirmation *Confirmation) askViaIQ() {
|
||||
stanzaID++
|
||||
stanzaIDstr := strconv.Itoa(stanzaID)
|
||||
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}
|
||||
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}
|
||||
m.PayloadEncode(confirm)
|
||||
WaitIqMessages[stanzaIDstr] = confirmation
|
||||
comp.Out <- m
|
||||
|
|
@ -110,7 +110,7 @@ func (confirmation *Confirmation) askViaMessage() {
|
|||
m := xmpp.Message{From: jid.Full(), To: confirmation.JID, Type: xmpp.MessageTypeNormal}
|
||||
m.Thread = xmpp.SessionID()
|
||||
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)
|
||||
WaitMessageAnswers[confirmation.Transaction] = confirmation
|
||||
|
|
|
|||
14
xmpp/xmpp.go
14
xmpp/xmpp.go
|
|
@ -95,7 +95,7 @@ func mainXMPP() {
|
|||
case *xmpp.Message:
|
||||
confirm := v.Confirm
|
||||
if confirm != nil {
|
||||
confirmation := WaitMessageAnswers[confirm.Id]
|
||||
confirmation := WaitMessageAnswers[confirm.ID]
|
||||
processConfirm(v, confirmation)
|
||||
} else {
|
||||
// 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 {
|
||||
case xmpp.NSDiscoInfo:
|
||||
execDisco(v)
|
||||
|
|
@ -131,12 +131,12 @@ func mainXMPP() {
|
|||
case xmpp.NSHTTPAuth:
|
||||
confirm := &xmpp.Confirm{}
|
||||
v.PayloadDecode(confirm)
|
||||
confirmation := WaitIqMessages[v.Id]
|
||||
confirmation := WaitIqMessages[v.ID]
|
||||
processConfirm(v, confirmation)
|
||||
|
||||
default:
|
||||
// Handle reply iq that doesn't contain HTTP-Auth namespace
|
||||
confirmation := WaitIqMessages[v.Id]
|
||||
confirmation := WaitIqMessages[v.ID]
|
||||
processConfirm(v, confirmation)
|
||||
|
||||
if confirmation == nil {
|
||||
|
|
@ -154,7 +154,7 @@ func mainXMPP() {
|
|||
|
||||
func processConfirm(x interface{}, confirmation *Confirmation) {
|
||||
mes, mesOK := x.(*xmpp.Message)
|
||||
iq, iqOK := x.(*xmpp.Iq)
|
||||
iq, iqOK := x.(*xmpp.IQ)
|
||||
|
||||
if confirmation != nil {
|
||||
if mesOK && mes.Error != nil {
|
||||
|
|
@ -195,7 +195,7 @@ func must(v interface{}, err error) interface{} {
|
|||
return v
|
||||
}
|
||||
|
||||
func execDisco(iq *xmpp.Iq) {
|
||||
func execDisco(iq *xmpp.IQ) {
|
||||
log.Printf("%sDisco Feature", LogInfo)
|
||||
|
||||
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)
|
||||
reply := iq.Response(xmpp.IQTypeResult)
|
||||
discoItem := &xmpp.DiscoItems{Node: xmpp.NodeAdHocCommand}
|
||||
|
|
|
|||
Loading…
Reference in New Issue