|
|
|
@ -131,7 +131,7 @@ public final class PublicChatAPI : DotNetAPI {
|
|
|
|
|
print("[Loki] Couldn't parse message for public chat channel with ID: \(channel) on server: \(server) from: \(message).")
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
let servertTimestamp = UInt64(date.timeIntervalSince1970) * 1000
|
|
|
|
|
let serverTimestamp = UInt64(date.timeIntervalSince1970) * 1000
|
|
|
|
|
var profilePicture: PublicChatMessage.ProfilePicture? = nil
|
|
|
|
|
let displayName = user["name"] as? String ?? NSLocalizedString("Anonymous", comment: "")
|
|
|
|
|
if let userAnnotations = user["annotations"] as? [JSON], let profilePictureAnnotation = userAnnotations.first(where: { $0["type"] as? String == profilePictureType }),
|
|
|
|
@ -171,7 +171,7 @@ public final class PublicChatAPI : DotNetAPI {
|
|
|
|
|
width: width, height: height, caption: caption, url: url, linkPreviewURL: linkPreviewURL, linkPreviewTitle: linkPreviewTitle)
|
|
|
|
|
}
|
|
|
|
|
let result = PublicChatMessage(serverID: serverID, senderPublicKey: hexEncodedPublicKey, displayName: displayName, profilePicture: profilePicture,
|
|
|
|
|
body: body, type: publicChatMessageType, timestamp: timestamp, quote: quote, attachments: attachments, signature: signature, serverTimestamp: servertTimestamp)
|
|
|
|
|
body: body, type: publicChatMessageType, timestamp: timestamp, quote: quote, attachments: attachments, signature: signature, serverTimestamp: serverTimestamp)
|
|
|
|
|
guard result.hasValidSignature() else {
|
|
|
|
|
print("[Loki] Ignoring public chat message with invalid signature.")
|
|
|
|
|
return nil
|
|
|
|
|