mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-26 22:25:19 +00:00
turn off default relays
This commit is contained in:
@@ -188,7 +188,7 @@ class NostrGeohashService(
|
|||||||
nostrRelayManager.sendEventToGeohash(
|
nostrRelayManager.sendEventToGeohash(
|
||||||
event = event,
|
event = event,
|
||||||
geohash = channel.geohash,
|
geohash = channel.geohash,
|
||||||
includeDefaults = true,
|
includeDefaults = false,
|
||||||
nRelays = 5
|
nRelays = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -551,7 +551,7 @@ class NostrGeohashService(
|
|||||||
handler = { event ->
|
handler = { event ->
|
||||||
handleUnifiedGeohashEvent(event, geohash)
|
handleUnifiedGeohashEvent(event, geohash)
|
||||||
},
|
},
|
||||||
includeDefaults = true,
|
includeDefaults = false,
|
||||||
nRelays = 5
|
nRelays = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -882,7 +882,7 @@ class NostrGeohashService(
|
|||||||
handler = { event ->
|
handler = { event ->
|
||||||
handleUnifiedGeohashEvent(event, channel.channel.geohash)
|
handleUnifiedGeohashEvent(event, channel.channel.geohash)
|
||||||
},
|
},
|
||||||
includeDefaults = true,
|
includeDefaults = false,
|
||||||
nRelays = 5
|
nRelays = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -909,7 +909,7 @@ class NostrGeohashService(
|
|||||||
handler = { giftWrap ->
|
handler = { giftWrap ->
|
||||||
handleGeohashDmEvent(giftWrap, channel.channel.geohash, dmIdentity)
|
handleGeohashDmEvent(giftWrap, channel.channel.geohash, dmIdentity)
|
||||||
},
|
},
|
||||||
includeDefaults = true,
|
includeDefaults = false,
|
||||||
nRelays = 5
|
nRelays = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class NostrRelayManager private constructor() {
|
|||||||
/**
|
/**
|
||||||
* Compute and connect to relays for a given geohash (nearest + optional defaults), cache the mapping.
|
* Compute and connect to relays for a given geohash (nearest + optional defaults), cache the mapping.
|
||||||
*/
|
*/
|
||||||
fun ensureGeohashRelaysConnected(geohash: String, nRelays: Int = 5, includeDefaults: Boolean = true) {
|
fun ensureGeohashRelaysConnected(geohash: String, nRelays: Int = 5, includeDefaults: Boolean = false) {
|
||||||
try {
|
try {
|
||||||
val nearest = RelayDirectory.closestRelaysForGeohash(geohash, nRelays)
|
val nearest = RelayDirectory.closestRelaysForGeohash(geohash, nRelays)
|
||||||
val selected = if (includeDefaults) {
|
val selected = if (includeDefaults) {
|
||||||
@@ -163,7 +163,7 @@ class NostrRelayManager private constructor() {
|
|||||||
filter: NostrFilter,
|
filter: NostrFilter,
|
||||||
id: String = generateSubscriptionId(),
|
id: String = generateSubscriptionId(),
|
||||||
handler: (NostrEvent) -> Unit,
|
handler: (NostrEvent) -> Unit,
|
||||||
includeDefaults: Boolean = true,
|
includeDefaults: Boolean = false,
|
||||||
nRelays: Int = 5
|
nRelays: Int = 5
|
||||||
): String {
|
): String {
|
||||||
ensureGeohashRelaysConnected(geohash, nRelays, includeDefaults)
|
ensureGeohashRelaysConnected(geohash, nRelays, includeDefaults)
|
||||||
@@ -185,7 +185,7 @@ class NostrRelayManager private constructor() {
|
|||||||
/**
|
/**
|
||||||
* Send an event specifically to a geohash's relays (+ optional defaults).
|
* Send an event specifically to a geohash's relays (+ optional defaults).
|
||||||
*/
|
*/
|
||||||
fun sendEventToGeohash(event: NostrEvent, geohash: String, includeDefaults: Boolean = true, nRelays: Int = 5) {
|
fun sendEventToGeohash(event: NostrEvent, geohash: String, includeDefaults: Boolean = false, nRelays: Int = 5) {
|
||||||
ensureGeohashRelaysConnected(geohash, nRelays, includeDefaults)
|
ensureGeohashRelaysConnected(geohash, nRelays, includeDefaults)
|
||||||
val relayUrls = getRelaysForGeohash(geohash)
|
val relayUrls = getRelaysForGeohash(geohash)
|
||||||
if (relayUrls.isEmpty()) {
|
if (relayUrls.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user