@@ -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
|
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
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if friends.contains(ev.pubkey) {
|
// show our replies?
|
||||||
return true
|
for pk in ev.referenced_pubkeys {
|
||||||
}
|
if friends.contains(pk.ref_id) {
|
||||||
|
|
||||||
if ev.is_reply {
|
|
||||||
// show our replies?
|
|
||||||
if ev.pubkey == our_pubkey {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
for pk in ev.referenced_pubkeys {
|
|
||||||
if friends.contains(pk.ref_id) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user