Adds missing methods to display as Public message

This commit is contained in:
Vitor Pamplona
2025-08-06 18:09:14 -04:00
parent 52ac0c184d
commit 23b3ff9fe8

View File

@@ -28,6 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.core.any
import com.vitorpamplona.quartz.nip01Core.hints.PubKeyHintProvider
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
import com.vitorpamplona.quartz.nip10Notes.BaseNoteEvent
import com.vitorpamplona.quartz.nip19Bech32.entities.NProfile
import com.vitorpamplona.quartz.nip19Bech32.pubKeyHints
import com.vitorpamplona.quartz.nip19Bech32.pubKeys
import com.vitorpamplona.quartz.nip31Alts.alt
@@ -59,6 +60,15 @@ class PublicMessageEvent(
fun groupKeySet() = tags.mapNotNullTo(mutableSetOf(this.pubKey), ReceiverTag::parseKey)
fun groupKeySetWithoutOwner() = tags.mapNotNullTo(mutableSetOf(), ReceiverTag::parseKey) - this.pubKey
fun groupAsNProfileList(toRemove: Set<HexKey>) =
group().joinToString {
NProfile.create(it.pubKey, it.relayHint)
}
fun chatroomKey(user: HexKey) = groupKeySet() - user
companion object {
const val KIND = 24
const val ALT_DESCRIPTION = "Public Message"