From a4ebf7dc12c8557d17442ddce31687dd03374327 Mon Sep 17 00:00:00 2001 From: Martin/Geno Date: Wed, 5 Jun 2019 04:30:00 +0200 Subject: [PATCH] update vendor --- component/receiver.go | 8 ++++---- component/threema/file.go | 2 +- component/threema/file_test.go | 5 ++++- component/threema/receive.go | 8 ++++---- component/threema/receive_test.go | 6 +++--- component/threema/send.go | 12 ++++++------ component/threema/send_test.go | 8 ++++---- vendor/gosrc.io/xmpp | 2 +- 8 files changed, 27 insertions(+), 24 deletions(-) diff --git a/component/receiver.go b/component/receiver.go index f567108..20dfd61 100644 --- a/component/receiver.go +++ b/component/receiver.go @@ -51,10 +51,10 @@ func (c *Config) receiving(packet xmpp.Packet) (xmpp.Packet, bool) { payload := xmpp.DiscoInfo{ Identity: identity, Features: []xmpp.Feature{ - {Var: "http://jabber.org/protocol/disco#info"}, - {Var: "http://jabber.org/protocol/disco#item"}, - {Var: xmpp.NSSpaceXEP0184Receipt}, - {Var: xmpp.NSSpaceXEP0333ChatMarkers}, + {Var: xmpp.NSDiscoInfo}, + {Var: xmpp.NSDiscoItems}, + {Var: xmpp.NSMsgReceipts}, + {Var: xmpp.NSMsgChatMarkers}, }, } iq.AddPayload(&payload) diff --git a/component/threema/file.go b/component/threema/file.go index a2ff6a7..70f00c3 100644 --- a/component/threema/file.go +++ b/component/threema/file.go @@ -24,6 +24,6 @@ func (a *Account) FileToXMPP(from string, msgID uint64, ext string, data []byte) return msg, err } msg.Body = url - msg.X = &xmpp.MsgXOOB{URL: url} + msg.Extensions = append(msg.Extensions, xmpp.OOB{URL: url}) return msg, nil } diff --git a/component/threema/file_test.go b/component/threema/file_test.go index c8851b4..0d67734 100644 --- a/component/threema/file_test.go +++ b/component/threema/file_test.go @@ -3,6 +3,8 @@ package threema import ( "testing" + "gosrc.io/xmpp" + "github.com/stretchr/testify/assert" ) @@ -17,7 +19,8 @@ func TestFileToXMPP(t *testing.T) { msg, err := a.FileToXMPP("", 1, "jpg", []byte("hallo")) 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" msg, err = a.FileToXMPP("", 1, "jpg", []byte("hallo")) diff --git a/component/threema/receive.go b/component/threema/receive.go index 2790cb2..bbade52 100644 --- a/component/threema/receive.go +++ b/component/threema/receive.go @@ -35,7 +35,7 @@ func (a *Account) receiver(out chan<- xmpp.Packet) { func requestExtensions(xMSG *xmpp.Message) { 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) { @@ -89,8 +89,8 @@ func (a *Account) receiving(receivedMessage o3.ReceivedMsg) (xmpp.Packet, error) if msg.Status() == o3.MSGDELIVERED { if id, ok := a.deliveredMSG[msgID]; ok { - xMSG.Extensions = append(xMSG.Extensions, xmpp.ReceiptReceived{Id: id}) - xMSG.Extensions = append(xMSG.Extensions, xmpp.ChatMarkerReceived{Id: id}) + xMSG.Extensions = append(xMSG.Extensions, xmpp.ReceiptReceived{ID: id}) + xMSG.Extensions = append(xMSG.Extensions, xmpp.MarkReceived{ID: id}) delete(a.deliveredMSG, msgID) } else { 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 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) } else { log.Warnf("found not id in cache to announce readed on xmpp side") diff --git a/component/threema/receive_test.go b/component/threema/receive_test.go index 225b73e..2a2e53e 100644 --- a/component/threema/receive_test.go +++ b/component/threema/receive_test.go @@ -147,7 +147,7 @@ func TestReceiveDeliveryReceipt(t *testing.T) { xMSG, ok := p.(xmpp.Message) assert.True(ok) rr := xMSG.Extensions[0].(xmpp.ReceiptReceived) - assert.Equal("im4aeseeh1IbaQui", rr.Id) + assert.Equal("im4aeseeh1IbaQui", rr.ID) // receiving delivered -> not in cache p, err = a.receiving(o3.ReceivedMsg{ @@ -165,8 +165,8 @@ func TestReceiveDeliveryReceipt(t *testing.T) { assert.NoError(err) xMSG, ok = p.(xmpp.Message) assert.True(ok) - cmdd := xMSG.Extensions[0].(xmpp.ChatMarkerDisplayed) - assert.Equal("im4aeseeh1IbaQui", cmdd.Id) + cmdd := xMSG.Extensions[0].(xmpp.MarkDisplayed) + assert.Equal("im4aeseeh1IbaQui", cmdd.ID) // receiving delivered -> not in cache p, err = a.receiving(o3.ReceivedMsg{ diff --git a/component/threema/send.go b/component/threema/send.go index 0c95c74..42e9428 100644 --- a/component/threema/send.go +++ b/component/threema/send.go @@ -24,13 +24,13 @@ func (a *Account) sending(to string, msg xmpp.Message) (o3.Message, error) { readed := false for _, el := range msg.Extensions { switch ex := el.(type) { - case *xmpp.ReceiptReceived: - msgID = ex.Id - case *xmpp.ChatMarkerReceived: - msgID = ex.Id - case *xmpp.ChatMarkerDisplayed: + case xmpp.ReceiptReceived: + msgID = ex.ID + case xmpp.MarkReceived: + msgID = ex.ID + case xmpp.MarkDisplayed: readed = true - msgID = ex.Id + msgID = ex.ID } } if msgID != "" { diff --git a/component/threema/send_test.go b/component/threema/send_test.go index 7e09ca1..6ebbdae 100644 --- a/component/threema/send_test.go +++ b/component/threema/send_test.go @@ -34,7 +34,7 @@ func TestAccountSend(t *testing.T) { err := a.Send("a", xmpp.Message{ PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"}, Extensions: []xmpp.MsgExtension{ - &xmpp.ReceiptReceived{Id: "blub"}, + xmpp.ReceiptReceived{ID: "blub"}, }, }) assert.Error(err) @@ -51,7 +51,7 @@ func TestAccountSendingDeliviery(t *testing.T) { msg, err := a.sending("a", xmpp.Message{ PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"}, Extensions: []xmpp.MsgExtension{ - &xmpp.ReceiptReceived{Id: "blub"}, + xmpp.ReceiptReceived{ID: "blub"}, }, }) assert.Error(err) @@ -61,7 +61,7 @@ func TestAccountSendingDeliviery(t *testing.T) { msg, err = a.sending("a", xmpp.Message{ PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"}, Extensions: []xmpp.MsgExtension{ - &xmpp.ChatMarkerReceived{Id: "3"}, + xmpp.MarkReceived{ID: "3"}, }, }) assert.NoError(err) @@ -73,7 +73,7 @@ func TestAccountSendingDeliviery(t *testing.T) { msg, err = a.sending("a", xmpp.Message{ PacketAttrs: xmpp.PacketAttrs{From: "a@example.org"}, Extensions: []xmpp.MsgExtension{ - &xmpp.ChatMarkerDisplayed{Id: "5"}, + xmpp.MarkDisplayed{ID: "5"}, }, }) assert.NoError(err) diff --git a/vendor/gosrc.io/xmpp b/vendor/gosrc.io/xmpp index d0b7b1f..5477997 160000 --- a/vendor/gosrc.io/xmpp +++ b/vendor/gosrc.io/xmpp @@ -1 +1 @@ -Subproject commit d0b7b1f864f0fd4651f8a92b92a341314ef7aa5b +Subproject commit 5477997a38b217c86c462c8bfa8d96c3b925c1f5