update vendor
This commit is contained in:
parent
f2739ea81f
commit
a4ebf7dc12
|
@ -51,10 +51,10 @@ func (c *Config) receiving(packet xmpp.Packet) (xmpp.Packet, bool) {
|
||||||
payload := xmpp.DiscoInfo{
|
payload := xmpp.DiscoInfo{
|
||||||
Identity: identity,
|
Identity: identity,
|
||||||
Features: []xmpp.Feature{
|
Features: []xmpp.Feature{
|
||||||
{Var: "http://jabber.org/protocol/disco#info"},
|
{Var: xmpp.NSDiscoInfo},
|
||||||
{Var: "http://jabber.org/protocol/disco#item"},
|
{Var: xmpp.NSDiscoItems},
|
||||||
{Var: xmpp.NSSpaceXEP0184Receipt},
|
{Var: xmpp.NSMsgReceipts},
|
||||||
{Var: xmpp.NSSpaceXEP0333ChatMarkers},
|
{Var: xmpp.NSMsgChatMarkers},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
iq.AddPayload(&payload)
|
iq.AddPayload(&payload)
|
||||||
|
|
|
@ -24,6 +24,6 @@ func (a *Account) FileToXMPP(from string, msgID uint64, ext string, data []byte)
|
||||||
return msg, err
|
return msg, err
|
||||||
}
|
}
|
||||||
msg.Body = url
|
msg.Body = url
|
||||||
msg.X = &xmpp.MsgXOOB{URL: url}
|
msg.Extensions = append(msg.Extensions, xmpp.OOB{URL: url})
|
||||||
return msg, nil
|
return msg, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package threema
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"gosrc.io/xmpp"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,7 +19,8 @@ func TestFileToXMPP(t *testing.T) {
|
||||||
|
|
||||||
msg, err := a.FileToXMPP("", 1, "jpg", []byte("hallo"))
|
msg, err := a.FileToXMPP("", 1, "jpg", []byte("hallo"))
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
assert.Equal("a/1.jpg", msg.X.URL)
|
oob := msg.Extensions[0].(xmpp.OOB)
|
||||||
|
assert.Equal("a/1.jpg", oob.URL)
|
||||||
|
|
||||||
a.threema.httpUploadPath = "/gibt/es/nicht"
|
a.threema.httpUploadPath = "/gibt/es/nicht"
|
||||||
msg, err = a.FileToXMPP("", 1, "jpg", []byte("hallo"))
|
msg, err = a.FileToXMPP("", 1, "jpg", []byte("hallo"))
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (a *Account) receiver(out chan<- xmpp.Packet) {
|
||||||
|
|
||||||
func requestExtensions(xMSG *xmpp.Message) {
|
func requestExtensions(xMSG *xmpp.Message) {
|
||||||
xMSG.Extensions = append(xMSG.Extensions, xmpp.ReceiptRequest{})
|
xMSG.Extensions = append(xMSG.Extensions, xmpp.ReceiptRequest{})
|
||||||
xMSG.Extensions = append(xMSG.Extensions, xmpp.ChatMarkerMarkable{})
|
xMSG.Extensions = append(xMSG.Extensions, xmpp.Markable{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Account) receiving(receivedMessage o3.ReceivedMsg) (xmpp.Packet, error) {
|
func (a *Account) receiving(receivedMessage o3.ReceivedMsg) (xmpp.Packet, error) {
|
||||||
|
@ -89,8 +89,8 @@ func (a *Account) receiving(receivedMessage o3.ReceivedMsg) (xmpp.Packet, error)
|
||||||
|
|
||||||
if msg.Status() == o3.MSGDELIVERED {
|
if msg.Status() == o3.MSGDELIVERED {
|
||||||
if id, ok := a.deliveredMSG[msgID]; ok {
|
if id, ok := a.deliveredMSG[msgID]; ok {
|
||||||
xMSG.Extensions = append(xMSG.Extensions, xmpp.ReceiptReceived{Id: id})
|
xMSG.Extensions = append(xMSG.Extensions, xmpp.ReceiptReceived{ID: id})
|
||||||
xMSG.Extensions = append(xMSG.Extensions, xmpp.ChatMarkerReceived{Id: id})
|
xMSG.Extensions = append(xMSG.Extensions, xmpp.MarkReceived{ID: id})
|
||||||
delete(a.deliveredMSG, msgID)
|
delete(a.deliveredMSG, msgID)
|
||||||
} else {
|
} else {
|
||||||
log.Warnf("found not id in cache to announce received on xmpp side")
|
log.Warnf("found not id in cache to announce received on xmpp side")
|
||||||
|
@ -98,7 +98,7 @@ func (a *Account) receiving(receivedMessage o3.ReceivedMsg) (xmpp.Packet, error)
|
||||||
}
|
}
|
||||||
if msg.Status() == o3.MSGREAD {
|
if msg.Status() == o3.MSGREAD {
|
||||||
if id, ok := a.readedMSG[msgID]; ok {
|
if id, ok := a.readedMSG[msgID]; ok {
|
||||||
xMSG.Extensions = append(xMSG.Extensions, xmpp.ChatMarkerDisplayed{Id: id})
|
xMSG.Extensions = append(xMSG.Extensions, xmpp.MarkDisplayed{ID: id})
|
||||||
delete(a.readedMSG, msgID)
|
delete(a.readedMSG, msgID)
|
||||||
} else {
|
} else {
|
||||||
log.Warnf("found not id in cache to announce readed on xmpp side")
|
log.Warnf("found not id in cache to announce readed on xmpp side")
|
||||||
|
|
|
@ -147,7 +147,7 @@ func TestReceiveDeliveryReceipt(t *testing.T) {
|
||||||
xMSG, ok := p.(xmpp.Message)
|
xMSG, ok := p.(xmpp.Message)
|
||||||
assert.True(ok)
|
assert.True(ok)
|
||||||
rr := xMSG.Extensions[0].(xmpp.ReceiptReceived)
|
rr := xMSG.Extensions[0].(xmpp.ReceiptReceived)
|
||||||
assert.Equal("im4aeseeh1IbaQui", rr.Id)
|
assert.Equal("im4aeseeh1IbaQui", rr.ID)
|
||||||
|
|
||||||
// receiving delivered -> not in cache
|
// receiving delivered -> not in cache
|
||||||
p, err = a.receiving(o3.ReceivedMsg{
|
p, err = a.receiving(o3.ReceivedMsg{
|
||||||
|
@ -165,8 +165,8 @@ func TestReceiveDeliveryReceipt(t *testing.T) {
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
xMSG, ok = p.(xmpp.Message)
|
xMSG, ok = p.(xmpp.Message)
|
||||||
assert.True(ok)
|
assert.True(ok)
|
||||||
cmdd := xMSG.Extensions[0].(xmpp.ChatMarkerDisplayed)
|
cmdd := xMSG.Extensions[0].(xmpp.MarkDisplayed)
|
||||||
assert.Equal("im4aeseeh1IbaQui", cmdd.Id)
|
assert.Equal("im4aeseeh1IbaQui", cmdd.ID)
|
||||||
|
|
||||||
// receiving delivered -> not in cache
|
// receiving delivered -> not in cache
|
||||||
p, err = a.receiving(o3.ReceivedMsg{
|
p, err = a.receiving(o3.ReceivedMsg{
|
||||||
|
|
|
@ -24,13 +24,13 @@ func (a *Account) sending(to string, msg xmpp.Message) (o3.Message, error) {
|
||||||
readed := false
|
readed := false
|
||||||
for _, el := range msg.Extensions {
|
for _, el := range msg.Extensions {
|
||||||
switch ex := el.(type) {
|
switch ex := el.(type) {
|
||||||
case *xmpp.ReceiptReceived:
|
case xmpp.ReceiptReceived:
|
||||||
msgID = ex.Id
|
msgID = ex.ID
|
||||||
case *xmpp.ChatMarkerReceived:
|
case xmpp.MarkReceived:
|
||||||
msgID = ex.Id
|
msgID = ex.ID
|
||||||
case *xmpp.ChatMarkerDisplayed:
|
case xmpp.MarkDisplayed:
|
||||||
readed = true
|
readed = true
|
||||||
msgID = ex.Id
|
msgID = ex.ID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if msgID != "" {
|
if msgID != "" {
|
||||||
|
|
|
@ -34,7 +34,7 @@ func TestAccountSend(t *testing.T) {
|
||||||
err := a.Send("a", xmpp.Message{
|
err := a.Send("a", xmpp.Message{
|
||||||
PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"},
|
PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"},
|
||||||
Extensions: []xmpp.MsgExtension{
|
Extensions: []xmpp.MsgExtension{
|
||||||
&xmpp.ReceiptReceived{Id: "blub"},
|
xmpp.ReceiptReceived{ID: "blub"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
assert.Error(err)
|
assert.Error(err)
|
||||||
|
@ -51,7 +51,7 @@ func TestAccountSendingDeliviery(t *testing.T) {
|
||||||
msg, err := a.sending("a", xmpp.Message{
|
msg, err := a.sending("a", xmpp.Message{
|
||||||
PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"},
|
PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"},
|
||||||
Extensions: []xmpp.MsgExtension{
|
Extensions: []xmpp.MsgExtension{
|
||||||
&xmpp.ReceiptReceived{Id: "blub"},
|
xmpp.ReceiptReceived{ID: "blub"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
assert.Error(err)
|
assert.Error(err)
|
||||||
|
@ -61,7 +61,7 @@ func TestAccountSendingDeliviery(t *testing.T) {
|
||||||
msg, err = a.sending("a", xmpp.Message{
|
msg, err = a.sending("a", xmpp.Message{
|
||||||
PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"},
|
PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"},
|
||||||
Extensions: []xmpp.MsgExtension{
|
Extensions: []xmpp.MsgExtension{
|
||||||
&xmpp.ChatMarkerReceived{Id: "3"},
|
xmpp.MarkReceived{ID: "3"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
|
@ -73,7 +73,7 @@ func TestAccountSendingDeliviery(t *testing.T) {
|
||||||
msg, err = a.sending("a", xmpp.Message{
|
msg, err = a.sending("a", xmpp.Message{
|
||||||
PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"},
|
PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"},
|
||||||
Extensions: []xmpp.MsgExtension{
|
Extensions: []xmpp.MsgExtension{
|
||||||
&xmpp.ChatMarkerDisplayed{Id: "5"},
|
xmpp.MarkDisplayed{ID: "5"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit d0b7b1f864f0fd4651f8a92b92a341314ef7aa5b
|
Subproject commit 5477997a38b217c86c462c8bfa8d96c3b925c1f5
|
Reference in New Issue