@@ -120,27 +120,22 @@ func make_contact_relays(_ relays: [RelayDescriptor]) -> [String: RelayInfo] {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: tests for this
|
||||
func is_friend_event(_ ev: NostrEvent, our_pubkey: String, friends: Set<String>) -> Bool
|
||||
{
|
||||
if ev.pubkey == our_pubkey {
|
||||
if !friends.contains(ev.pubkey) {
|
||||
return false
|
||||
}
|
||||
|
||||
if !ev.is_reply {
|
||||
return true
|
||||
}
|
||||
|
||||
if friends.contains(ev.pubkey) {
|
||||
return true
|
||||
}
|
||||
|
||||
if ev.is_reply {
|
||||
// show our replies?
|
||||
if ev.pubkey == our_pubkey {
|
||||
// show our replies?
|
||||
for pk in ev.referenced_pubkeys {
|
||||
if friends.contains(pk.ref_id) {
|
||||
return true
|
||||
}
|
||||
for pk in ev.referenced_pubkeys {
|
||||
if friends.contains(pk.ref_id) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user