ReadMessage fix
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-03-29 16:18:24 +01:00
parent 8300a699a3
commit bdfa8c7bb1

View File

@ -167,7 +167,7 @@ func ReadMessage(messageFilename string, detachFilesStoragePath string) ([]strin
} }
} }
return messagesOverview, filenames, "", nil
} }
// fmt.Println("have read fromServerMessage, will unmarshal packed") // fmt.Println("have read fromServerMessage, will unmarshal packed")
@ -180,40 +180,35 @@ func ReadMessage(messageFilename string, detachFilesStoragePath string) ([]strin
// fmt.Println("Destination:", packedMessage.Destination) // fmt.Println("Destination:", packedMessage.Destination)
// fmt.Println("Payload lengh:", len(packedMessage.Pay ""load)) // fmt.Println("Payload lengh:", len(packedMessage.Pay ""load))
// server invitation finalize or more ? // server invitation finalize or more ?
/* /*
if fromServerMessage.Invitation != nil { if fromServerMessage.Invitation != nil {
fmt.Println("Invitation from:", fromServerMessage.Invitation.From) fmt.Println("Invitation from:", fromServerMessage.Invitation.From)
// find the peer with that lookup key // find the peer with that lookup key
// todo get from invitation id // todo get from invitation id
//! FOLOWING statement is WRONG ! //! FOLOWING statement is WRONG !
peer := client.GetConfig().GetIdentity().Peers.GetFromPublicKey(fromServerMessage.Invitation.From) peer := client.GetConfig().GetIdentity().Peers.GetFromPublicKey(fromServerMessage.Invitation.From)
if peer == nil { if peer == nil {
return nil, nil, "ReadMessage: GetFromPublicKey", errors.New("no visible peer for that message") return nil, nil, "ReadMessage: GetFromPublicKey", errors.New("no visible peer for that message")
} }
peer.ContactPublicKey = fromServerMessage.Invitation.From peer.ContactPublicKey = fromServerMessage.Invitation.From
str, _ := json.Marshal(peer) str, _ := json.Marshal(peer)
fmt.Println("Peer:", string(str)) fmt.Println("Peer:", string(str))
// invitation message // invitation message
var receivedContactCard meowlib.ContactCard var receivedContactCard meowlib.ContactCard
err := proto.Unmarshal(fromServerMessage.Invitation.Payload, &receivedContactCard) err := proto.Unmarshal(fromServerMessage.Invitation.Payload, &receivedContactCard)
if err != nil { if err != nil {
return "", "ReadMessage: Unmarshal ContactCard", err return "", "ReadMessage: Unmarshal ContactCard", err
} }
err = client.GetConfig().GetIdentity().FinalizeInvitation(&receivedContactCard) err = client.GetConfig().GetIdentity().FinalizeInvitation(&receivedContactCard)
if err != nil { if err != nil {
return "", "ReadMessage: FinalizeInvitation", err return "", "ReadMessage: FinalizeInvitation", err
} }
result["invitation finalized"] = peer.Name result["invitation finalized"] = peer.Name
*/
}
}*/
// message // message
// including list of detached files // including list of detached files
val, err := json.Marshal(result) return messagesOverview, filenames, "", nil
if err != nil {
return "", "ReadMessage: json.Marshal", err
}
os.Remove(messageFilename)
return string(val), "", nil
} }