diff --git a/bindings/client_test.go b/bindings/client_test.go index 059477ba783d9e4fa385d0077cca519586d21cf0..5537028f60297571a42bdfd86542e6ab3847823c 100644 --- a/bindings/client_test.go +++ b/bindings/client_test.go @@ -402,7 +402,7 @@ func TestLoginLogout(t *testing.T) { type MockListener bool -func (m *MockListener) Hear(msg Message, isHeardElsewhere bool) { +func (m *MockListener) Hear(msg Message, isHeardElsewhere bool, i ...interface{}) { *m = true } @@ -442,6 +442,7 @@ func TestListen(t *testing.T) { Sender: id.ZeroID, Receiver: client.client.GetCurrentUser(), }) + time.Sleep(time.Second) if !listener { t.Error("Message not received") } diff --git a/bindings/interfaces.go b/bindings/interfaces.go index 6b60841eb2ba4374c2d8e548f066dd8fc9bb74e3..88ea9ad7fc85743d066bb2e68a5da0b4b0a7f8de 100644 --- a/bindings/interfaces.go +++ b/bindings/interfaces.go @@ -60,7 +60,7 @@ type storageProxy struct { // gets a message of the type that the registerer specified at registration // time. type Listener interface { - Hear(msg Message, isHeardElsewhere bool) + Hear(msg Message, isHeardElsewhere bool, i ...interface{}) } // Translate a bindings listener to a switchboard listener @@ -70,9 +70,9 @@ type listenerProxy struct { proxy Listener } -func (lp *listenerProxy) Hear(msg switchboard.Item, isHeardElsewhere bool) { +func (lp *listenerProxy) Hear(msg switchboard.Item, isHeardElsewhere bool, i ...interface{}) { msgInterface := &parse.BindingsMessageProxy{Proxy: msg.(*parse.Message)} - lp.proxy.Hear(msgInterface, isHeardElsewhere) + lp.proxy.Hear(msgInterface, isHeardElsewhere, i) } // Interface used to receive a callback on searching for a user diff --git a/bots/bots.go b/bots/bots.go index 8433deeb1c51ce460c30e4eebf005f33e3cb5c0d..b40537aa4beba5ad0f60caa04fff2a2ab57e600b 100644 --- a/bots/bots.go +++ b/bots/bots.go @@ -21,7 +21,7 @@ var UdbID *id.User type channelResponseListener chan string -func (l *channelResponseListener) Hear(msg switchboard.Item, isHeardElsewhere bool) { +func (l *channelResponseListener) Hear(msg switchboard.Item, isHeardElsewhere bool, i ...interface{}) { m := msg.(*parse.Message) *l <- string(m.Body) } @@ -36,7 +36,7 @@ var nicknameResponseListener channelResponseListener type nickReqListener struct{} // Nickname listener simply replies with message containing user's nick -func (l *nickReqListener) Hear(msg switchboard.Item, isHeardElsewhere bool) { +func (l *nickReqListener) Hear(msg switchboard.Item, isHeardElsewhere bool, i ...interface{}) { m := msg.(*parse.Message) nick := session.GetCurrentUser().Username resp := parse.Pack(&parse.TypedBody{ diff --git a/cmd/root.go b/cmd/root.go index f08c5310bee4999a0be299ce97184ad47a6f6ace..a6fa1266df87df67f5c8c8c16bbdd29cb298269b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -298,7 +298,7 @@ type FallbackListener struct { MessagesReceived int64 } -func (l *FallbackListener) Hear(item switchboard.Item, isHeardElsewhere bool) { +func (l *FallbackListener) Hear(item switchboard.Item, isHeardElsewhere bool, i ...interface{}) { if !isHeardElsewhere { message := item.(*parse.Message) sender, ok := user.Users.GetUser(message.Sender) @@ -319,7 +319,7 @@ type TextListener struct { MessagesReceived int64 } -func (l *TextListener) Hear(item switchboard.Item, isHeardElsewhere bool) { +func (l *TextListener) Hear(item switchboard.Item, isHeardElsewhere bool, i ...interface{}) { message := item.(*parse.Message) globals.Log.INFO.Println("Hearing a text message") result := cmixproto.TextMessage{} diff --git a/go.mod b/go.mod index f217ab3cb507a6241381d5c3decd0b5afd2050bd..62e7b5e5810434e2c50c83f28935c54de6669c0f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 github.com/golang/protobuf v1.3.2 - github.com/google/go-cmp v0.3.1 // indirect + github.com/google/go-cmp v0.4.0 // indirect github.com/gopherjs/gopherjs v0.0.0-20191106031601-ce3c9ade29de // indirect github.com/kr/pretty v0.2.0 // indirect github.com/pelletier/go-toml v1.6.0 // indirect @@ -18,10 +18,10 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.6.1 gitlab.com/elixxir/comms v0.0.0-20200106224700-3bc86e95b8af - gitlab.com/elixxir/crypto v0.0.0-20191121235352-86d305a9b253 - gitlab.com/elixxir/primitives v0.0.0-20200106183011-a68f1e6f188e + gitlab.com/elixxir/crypto v0.0.0-20200108005412-8159c60663f9 + gitlab.com/elixxir/primitives v0.0.0-20200108174340-0922447aec92 golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876 - golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e // indirect + golang.org/x/sys v0.0.0-20200107162124-548cf772de50 // indirect google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb // indirect gopkg.in/ini.v1 v1.51.1 // indirect ) diff --git a/go.sum b/go.sum index 1287b15d0618a2d4b19901abfc0ca566cd7bfd9c..ddd63b23b12166ca6f8aeab922b655411bfae4e1 100644 --- a/go.sum +++ b/go.sum @@ -46,8 +46,8 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20191106031601-ce3c9ade29de h1:F7WD09S8QB4LrkEpka0dFPLSotH11HRpCsLIbIcJ7sU= @@ -151,12 +151,14 @@ gitlab.com/elixxir/comms v0.0.0-20200106224700-3bc86e95b8af h1:hZ+d9TGonv2zMagpb gitlab.com/elixxir/comms v0.0.0-20200106224700-3bc86e95b8af/go.mod h1:bH0nMPs7YUZHQH0A6xEJ1MgKS5AUpowLJ7ONdm5pO58= gitlab.com/elixxir/crypto v0.0.0-20191121235352-86d305a9b253 h1:BqgqJ0mLANRjhAFLvGAcB5AWdgAnFZhsGx0qTk5G+3Y= gitlab.com/elixxir/crypto v0.0.0-20191121235352-86d305a9b253/go.mod h1:+46Zj/NE6JEkXExYnzdvvDokPpDbA+fJsRszvrezK9k= +gitlab.com/elixxir/crypto v0.0.0-20200108005412-8159c60663f9 h1:MJ87g3yMIvA9MTDMojuqaw1tCxU6LIKzxMaH3oEiP4M= +gitlab.com/elixxir/crypto v0.0.0-20200108005412-8159c60663f9/go.mod h1:+46Zj/NE6JEkXExYnzdvvDokPpDbA+fJsRszvrezK9k= gitlab.com/elixxir/primitives v0.0.0-20191028233752-882c08b8f095 h1:fnRh0PUwgy0qlWM7xMdk2w5MXh7gvQ0v/xyedn2gbcY= gitlab.com/elixxir/primitives v0.0.0-20191028233752-882c08b8f095/go.mod h1:+UiRRWzNpl/WoWUuQtJSoimfXImJAJ5lrrmg0pQKY3g= gitlab.com/elixxir/primitives v0.0.0-20191204001459-cef5ed720564 h1:j1kZiLtgYa3tg2SoWsr4zZAbVgOGXod4cZmRjBDA0sw= gitlab.com/elixxir/primitives v0.0.0-20191204001459-cef5ed720564/go.mod h1:swJHS06bt83wWmif/6cyNkhQAsAEU+PuNMUWNzCqCZU= -gitlab.com/elixxir/primitives v0.0.0-20200106183011-a68f1e6f188e h1:c1awQPAR/wAxqSPMCTboWs8RBEE+ENuMgKnCTfjuX+o= -gitlab.com/elixxir/primitives v0.0.0-20200106183011-a68f1e6f188e/go.mod h1:g9v3S34ZUeqGRiOTV7esByK8a5TovJ3YgTv/328ny6w= +gitlab.com/elixxir/primitives v0.0.0-20200108174340-0922447aec92 h1:2+gzW9Fy2JIaKlirX+db4+X+Pip36Dt6Z5fC1XYF958= +gitlab.com/elixxir/primitives v0.0.0-20200108174340-0922447aec92/go.mod h1:g9v3S34ZUeqGRiOTV7esByK8a5TovJ3YgTv/328ny6w= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -168,6 +170,7 @@ golang.org/x/crypto v0.0.0-20191028145041-f83a4685e152 h1:ZC1Xn5A1nlpSmQCIva4bZ3 golang.org/x/crypto v0.0.0-20191028145041-f83a4685e152/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f h1:kz4KIr+xcPUsI3VMoqWfPMvtnJ6MGfiVwsWSVzphMO4= golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876 h1:sKJQZMuxjOAR/Uo2LBfU90onWEf1dF4C+0hPJCc9Mpc= golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -201,9 +204,10 @@ golang.org/x/sys v0.0.0-20191028164358-195ce5e7f934 h1:u/E0NqCIWRDAo9WCFo6Ko49nj golang.org/x/sys v0.0.0-20191028164358-195ce5e7f934/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191118133127-cf1e2d577169/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191218084908-4a24b4065292 h1:Y8q0zsdcgAd+JU8VUA8p8Qv2YhuY9zevDG2ORt5qBUI= golang.org/x/sys v0.0.0-20191218084908-4a24b4065292/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e h1:LwyF2AFISC9nVbS6MgzsaQNSUsRXI49GS+YQ5KX/QH0= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200107162124-548cf772de50 h1:YvQ10rzcqWXLlJZ3XCUoO25savxmscf4+SC+ZqiCHhA= +golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= @@ -216,10 +220,13 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20191216205247-b31c10ee225f h1:0RYv5T9ZdroAqqfM2taEB0nJrArv0X1JpIdgUmY4xg8= google.golang.org/genproto v0.0.0-20191216205247-b31c10ee225f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb h1:ADPHZzpzM4tk4V4S5cnCrr5SwzvlrPRmqqCuJDB8UTs= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= diff --git a/rekey/rekey.go b/rekey/rekey.go index c0f60a59d65f5a09d5d34d0eda50e3ffeb47b542..c67d42a8ec215cb4fba3930c7c794d9e21e0b33e 100644 --- a/rekey/rekey.go +++ b/rekey/rekey.go @@ -34,7 +34,7 @@ type rekeyTriggerListener struct { err error } -func (l *rekeyTriggerListener) Hear(msg switchboard.Item, isHeardElsewhere bool) { +func (l *rekeyTriggerListener) Hear(msg switchboard.Item, isHeardElsewhere bool, i ...interface{}) { m := msg.(*parse.Message) partner := m.GetRecipient() globals.Log.DEBUG.Printf("Received RekeyTrigger message for user %v", *partner) @@ -51,7 +51,7 @@ type rekeyListener struct { err error } -func (l *rekeyListener) Hear(msg switchboard.Item, isHeardElsewhere bool) { +func (l *rekeyListener) Hear(msg switchboard.Item, isHeardElsewhere bool, i ...interface{}) { m := msg.(*parse.Message) partner := m.GetSender() partnerPubKey := m.GetPayload() @@ -73,7 +73,7 @@ type rekeyConfirmListener struct { err error } -func (l *rekeyConfirmListener) Hear(msg switchboard.Item, isHeardElsewhere bool) { +func (l *rekeyConfirmListener) Hear(msg switchboard.Item, isHeardElsewhere bool, i ...interface{}) { m := msg.(*parse.Message) partner := m.GetSender() baseKeyHash := m.GetPayload() diff --git a/rekey/rekey_test.go b/rekey/rekey_test.go index 603db5645313817b19b0b919346e744c62d682ff..c0767b8ea56c36aebbd87dff228abbf77f324019 100644 --- a/rekey/rekey_test.go +++ b/rekey/rekey_test.go @@ -176,7 +176,7 @@ func TestRekeyTrigger(t *testing.T) { Receiver: partnerID, } session.GetSwitchboard().Speak(msg) - + time.Sleep(time.Second) // Check that error occurred in rekeytrigger for repeated message if rekeyTriggerList.err == nil { t.Errorf("RekeyTrigger should have returned error") @@ -199,7 +199,7 @@ func TestRekeyConfirm(t *testing.T) { Receiver: session.GetCurrentUser().User, } session.GetSwitchboard().Speak(msg) - + time.Sleep(time.Second) // Check that error occurred in RekeyConfirm when hash is wrong if rekeyConfirmList.err == nil { t.Errorf("RekeyConfirm should have returned error") @@ -218,7 +218,7 @@ func TestRekeyConfirm(t *testing.T) { Receiver: session.GetCurrentUser().User, } session.GetSwitchboard().Speak(msg) - + time.Sleep(time.Second) // Check no error occurred in rekeyConfirm processing if rekeyConfirmList.err != nil { t.Errorf("RekeyConfirm returned error: %v", rekeyConfirmList.err.Error()) @@ -244,7 +244,7 @@ func TestRekeyConfirm(t *testing.T) { Receiver: session.GetCurrentUser().User, } session.GetSwitchboard().Speak(msg) - + time.Sleep(time.Second) // Check that error occurred in RekeyConfirm for repeated message if rekeyConfirmList.err == nil { t.Errorf("RekeyConfirm should have returned error") @@ -345,7 +345,7 @@ func TestRekey_Errors(t *testing.T) { Receiver: session.GetCurrentUser().User, } session.GetSwitchboard().Speak(msg) - + time.Sleep(time.Second) // Check error occurred on Rekey if rekeyList.err == nil { t.Errorf("Rekey should have returned error")