Skip to content

Commit bea1bbf

Browse files
authored
add missing file (#392)
1 parent 998ee60 commit bea1bbf

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.bitchat.android.nostr
2+
3+
import java.util.concurrent.ConcurrentHashMap
4+
5+
/**
6+
* GeohashConversationRegistry
7+
* - Global, thread-safe registry of conversationKey (e.g., "nostr_<pub16>") -> source geohash
8+
* - Enables routing geohash DMs from anywhere by providing the correct geohash identity
9+
*/
10+
object GeohashConversationRegistry {
11+
private val map = ConcurrentHashMap<String, String>()
12+
13+
fun set(convKey: String, geohash: String) {
14+
if (geohash.isNotEmpty()) map[convKey] = geohash
15+
}
16+
17+
fun get(convKey: String): String? = map[convKey]
18+
19+
fun snapshot(): Map<String, String> = map.toMap()
20+
21+
fun clear() = map.clear()
22+
}

0 commit comments

Comments
 (0)