expose cwtchPeer.Profile.AddMessageToContactTimeline() via StoreMessage()
the build was successful Details

This commit is contained in:
erinn 2020-10-03 16:09:47 -07:00
parent 4606489cca
commit b423f1e176
1 changed files with 8 additions and 4 deletions

View File

@ -50,6 +50,7 @@ type CwtchPeer interface {
InviteOnionToGroup(string, string) error
SendMessageToPeer(string, string) string
SendGetValToPeer(string, string, string)
StoreMessage(onion string, messageTxt string, sent time.Time)
SetContactAuthorization(string, model.Authorization) error
ProcessInvite(string, string) (string, error)
@ -566,6 +567,12 @@ func (cp *cwtchPeer) Shutdown() {
cp.queue.Shutdown()
}
func (cp *cwtchPeer) StoreMessage(onion string, messageTxt string, sent time.Time) {
cp.mutex.Lock()
cp.Profile.AddMessageToContactTimeline(onion, messageTxt, sent)
cp.mutex.Unlock()
}
// eventHandler process events from other subsystems
func (cp *cwtchPeer) eventHandler() {
for {
@ -583,10 +590,7 @@ func (cp *cwtchPeer) eventHandler() {
}
case event.NewMessageFromPeer: //event.TimestampReceived, event.RemotePeer, event.Data
ts, _ := time.Parse(time.RFC3339Nano, ev.Data[event.TimestampReceived])
cp.mutex.Lock()
cp.Profile.AddMessageToContactTimeline(ev.Data[event.RemotePeer], ev.Data[event.Data], ts)
cp.mutex.Unlock()
cp.StoreMessage(ev.Data[event.RemotePeer], ev.Data[event.Data], ts)
case event.PeerAcknowledgement:
cp.mutex.Lock()