nostr: add is_{read,write} helpers on requests
This will be handy in the future when we properly filter relay lists by RelayInfo
This commit is contained in:
@@ -16,4 +16,19 @@ enum NostrRequest {
|
|||||||
case subscribe(NostrSubscribe)
|
case subscribe(NostrSubscribe)
|
||||||
case unsubscribe(String)
|
case unsubscribe(String)
|
||||||
case event(NostrEvent)
|
case event(NostrEvent)
|
||||||
|
|
||||||
|
var is_write: Bool {
|
||||||
|
switch self {
|
||||||
|
case .subscribe:
|
||||||
|
return false
|
||||||
|
case .unsubscribe:
|
||||||
|
return false
|
||||||
|
case .event:
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var is_read: Bool {
|
||||||
|
return !is_write
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user