damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 1da0a8ee52a401a310037c36d4dee6ed2bf0a45d
parent 23aab6710a9a3e60217c1bf010877e07e34cedd2
Author: William Casarin <jb55@jb55.com>
Date:   Tue,  9 May 2023 18:38:07 -0700

nostr: add is_{read,write} helpers on requests

This will be handy in the future when we properly filter relay lists by
RelayInfo

Diffstat:
Mdamus/Nostr/NostrRequest.swift | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/damus/Nostr/NostrRequest.swift b/damus/Nostr/NostrRequest.swift @@ -16,4 +16,19 @@ enum NostrRequest { case subscribe(NostrSubscribe) case unsubscribe(String) 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 + } }