mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-24 23:45:19 +00:00
Merge branch 'main' into gossip-graph
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
package com.bitchat.android.nostr
|
||||||
|
|
||||||
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GeohashConversationRegistry
|
||||||
|
* - Global, thread-safe registry of conversationKey (e.g., "nostr_<pub16>") -> source geohash
|
||||||
|
* - Enables routing geohash DMs from anywhere by providing the correct geohash identity
|
||||||
|
*/
|
||||||
|
object GeohashConversationRegistry {
|
||||||
|
private val map = ConcurrentHashMap<String, String>()
|
||||||
|
|
||||||
|
fun set(convKey: String, geohash: String) {
|
||||||
|
if (geohash.isNotEmpty()) map[convKey] = geohash
|
||||||
|
}
|
||||||
|
|
||||||
|
fun get(convKey: String): String? = map[convKey]
|
||||||
|
|
||||||
|
fun snapshot(): Map<String, String> = map.toMap()
|
||||||
|
|
||||||
|
fun clear() = map.clear()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user