From 9c91a89f00135228fd193e1afdb29cb11239f74f Mon Sep 17 00:00:00 2001 From: erinn Date: Thu, 15 Oct 2020 22:39:57 -0700 Subject: [PATCH] testing new message id id-ea --- peer/cwtch_peer.go | 5 ++++- server/app/main.go | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index 9f46acf..d9ec40f 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -418,12 +418,15 @@ func (cp *cwtchPeer) SendMessageToGroupTracked(groupid string, message string) ( func (cp *cwtchPeer) SendMessageToPeer(onion string, message string) string { event := event.NewEvent(event.SendMessageToPeer, map[event.Field]string{event.RemotePeer: onion, event.Data: message}) - cp.eventBus.Publish(event) cp.mutex.Lock() + contact, _ := cp.Profile.GetContact(onion) + event.EventID = strconv.Itoa(contact.Timeline.Len()) cp.Profile.AddSentMessageToContactTimeline(onion, message, time.Now(), event.EventID) cp.mutex.Unlock() + cp.eventBus.Publish(event) + return event.EventID } diff --git a/server/app/main.go b/server/app/main.go index 518ac1d..b9e72a6 100644 --- a/server/app/main.go +++ b/server/app/main.go @@ -57,6 +57,7 @@ func main() { os.MkdirAll("tordir/tor",0700) tor.NewTorrc().WithHashedPassword(base64.StdEncoding.EncodeToString(key)).WithControlPort(controlPort).Build("./tordir/tor/torrc") acn, err := tor.NewTorACNWithAuth("tordir", "", controlPort, tor.HashedPasswordAuthenticator{Password: base64.StdEncoding.EncodeToString(key)}) + if err != nil { log.Errorf("\nError connecting to Tor: %v\n", err) os.Exit(1) @@ -77,7 +78,7 @@ func main() { if err != nil { panic(err) } - fmt.Printf("%v", "torv3"+base64.StdEncoding.EncodeToString(invite)) + fmt.Printf("%v\n", "torv3"+base64.StdEncoding.EncodeToString(invite)) bundle := server.KeyBundle().Serialize() log.Infof("Server Config: server:%s", base64.StdEncoding.EncodeToString(bundle))