fetch following contacts if we are missing any
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -18,6 +18,26 @@ func insert_uniq<T: Equatable>(xs: inout [T], new_x: T) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func insert_uniq_by_pubkey(events: inout [NostrEvent], new_ev: NostrEvent, cmp: (NostrEvent, NostrEvent) -> Bool) -> Bool {
|
||||
var i: Int = 0
|
||||
|
||||
for event in events {
|
||||
// don't insert duplicate events
|
||||
if new_ev.pubkey == event.pubkey {
|
||||
return false
|
||||
}
|
||||
|
||||
if cmp(new_ev, event) {
|
||||
events.insert(new_ev, at: i)
|
||||
return true
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
|
||||
events.append(new_ev)
|
||||
return true
|
||||
}
|
||||
|
||||
func insert_uniq_sorted_event(events: inout [NostrEvent], new_ev: NostrEvent, cmp: (NostrEvent, NostrEvent) -> Bool) -> Bool {
|
||||
var i: Int = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user