commit 45801f3e6c4adc9013b44901a605ce6c9d963fc1
parent 2d44f2744be5cb53933b23f34811b04f857a94ae
Author: William Casarin <jb55@jb55.com>
Date: Mon, 24 Jul 2023 13:08:55 -0700
ndb: rename NostrEvent to NostrEventOld
This facilitates the switch to NdbNote by allowing us to switch back and
forth to fix things.
Diffstat:
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/damus/Nostr/NostrEvent.swift b/damus/Nostr/NostrEvent.swift
@@ -20,7 +20,10 @@ enum ValidationResult: Decodable {
case bad_sig
}
-class NostrEvent: Codable, Identifiable, CustomStringConvertible, Equatable, Hashable, Comparable {
+//typealias NostrEvent = NdbNote
+typealias NostrEvent = NostrEventOld
+
+class NostrEventOld: Codable, Identifiable, CustomStringConvertible, Equatable, Hashable, Comparable {
// TODO: memory mapped db events
/*
private var note_data: UnsafeMutablePointer<ndb_note>
@@ -67,15 +70,15 @@ class NostrEvent: Codable, Identifiable, CustomStringConvertible, Equatable, Has
private var _event_refs: [EventRef]? = nil
var decrypted_content: String? = nil
private var _blocks: Blocks? = nil
- private lazy var inner_event: NostrEvent? = {
+ private lazy var inner_event: NostrEventOld? = {
return event_from_json(dat: self.content)
}()
- static func == (lhs: NostrEvent, rhs: NostrEvent) -> Bool {
+ static func == (lhs: NostrEventOld, rhs: NostrEventOld) -> Bool {
return lhs.id == rhs.id
}
- static func < (lhs: NostrEvent, rhs: NostrEvent) -> Bool {
+ static func < (lhs: NostrEventOld, rhs: NostrEventOld) -> Bool {
return lhs.created_at < rhs.created_at
}
@@ -96,7 +99,7 @@ class NostrEvent: Codable, Identifiable, CustomStringConvertible, Equatable, Has
}
}
-extension NostrEvent {
+extension NostrEventOld {
var is_textlike: Bool {
return kind == 1 || kind == 42 || kind == 30023
}
@@ -127,7 +130,7 @@ extension NostrEvent {
}
- func get_inner_event(cache: EventCache) -> NostrEvent? {
+ func get_inner_event(cache: EventCache) -> NostrEventOld? {
guard self.known_kind == .boost else {
return nil
}