From 2513f0303a707bcccc09b54806725722edc150ce Mon Sep 17 00:00:00 2001 From: ycc Date: Sat, 6 Apr 2024 10:13:25 +0200 Subject: [PATCH] Refactor PrepareUserMessage function to store message after processing outbound user message, store is destructive for a usermessage --- client/helpers/messageHelper.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/helpers/messageHelper.go b/client/helpers/messageHelper.go index f2c3595..2b2b58b 100644 --- a/client/helpers/messageHelper.go +++ b/client/helpers/messageHelper.go @@ -20,8 +20,6 @@ func PrepareUserMessage(message string, srvuid string, peer_idx int, filelist [] return nil, "PrepareServerMessage : AddFile", err } } - // Store message - peer.StoreMessage(usermessage, filelist) // Prepare cyphered + packed user message packedMsg, err := peer.ProcessOutboundUserMessage(usermessage) if err != nil { @@ -33,5 +31,10 @@ func PrepareUserMessage(message string, srvuid string, peer_idx int, filelist [] if err != nil { return nil, "PrepareServerMessage : ProcessOutboundMessage", err } + // Store message + err = peer.StoreMessage(usermessage, filelist) + if err != nil { + return nil, "PrepareServerMessage : StoreMessage", err + } return data, "", nil }