Moves from RelationshipStatus to ContactCard as per NIP update
This commit is contained in:
@@ -50,7 +50,7 @@ import com.vitorpamplona.quartz.experimental.nip95.header.FileStorageHeaderEvent
|
|||||||
import com.vitorpamplona.quartz.experimental.nns.NNSEvent
|
import com.vitorpamplona.quartz.experimental.nns.NNSEvent
|
||||||
import com.vitorpamplona.quartz.experimental.profileGallery.ProfileGalleryEntryEvent
|
import com.vitorpamplona.quartz.experimental.profileGallery.ProfileGalleryEntryEvent
|
||||||
import com.vitorpamplona.quartz.experimental.publicMessages.PublicMessageEvent
|
import com.vitorpamplona.quartz.experimental.publicMessages.PublicMessageEvent
|
||||||
import com.vitorpamplona.quartz.experimental.relationshipStatus.RelationshipStatusEvent
|
import com.vitorpamplona.quartz.experimental.relationshipStatus.ContactCardEvent
|
||||||
import com.vitorpamplona.quartz.experimental.zapPolls.PollNoteEvent
|
import com.vitorpamplona.quartz.experimental.zapPolls.PollNoteEvent
|
||||||
import com.vitorpamplona.quartz.nip01Core.checkSignature
|
import com.vitorpamplona.quartz.nip01Core.checkSignature
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent
|
import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent
|
||||||
@@ -1085,7 +1085,7 @@ object LocalCache : ILocalCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun consume(
|
fun consume(
|
||||||
event: RelationshipStatusEvent,
|
event: ContactCardEvent,
|
||||||
relay: NormalizedRelayUrl?,
|
relay: NormalizedRelayUrl?,
|
||||||
wasVerified: Boolean,
|
wasVerified: Boolean,
|
||||||
) = consumeBaseReplaceable(event, relay, wasVerified)
|
) = consumeBaseReplaceable(event, relay, wasVerified)
|
||||||
@@ -2812,7 +2812,7 @@ object LocalCache : ILocalCache {
|
|||||||
is PeopleListEvent -> consume(event, relay, wasVerified)
|
is PeopleListEvent -> consume(event, relay, wasVerified)
|
||||||
is PollNoteEvent -> consume(event, relay, wasVerified)
|
is PollNoteEvent -> consume(event, relay, wasVerified)
|
||||||
is ReactionEvent -> consume(event, relay, wasVerified)
|
is ReactionEvent -> consume(event, relay, wasVerified)
|
||||||
is RelationshipStatusEvent -> consume(event, relay, wasVerified)
|
is ContactCardEvent -> consume(event, relay, wasVerified)
|
||||||
is RelaySetEvent -> consume(event, relay, wasVerified)
|
is RelaySetEvent -> consume(event, relay, wasVerified)
|
||||||
is ReportEvent -> consume(event, relay, wasVerified)
|
is ReportEvent -> consume(event, relay, wasVerified)
|
||||||
is RepostEvent -> consume(event, relay, wasVerified)
|
is RepostEvent -> consume(event, relay, wasVerified)
|
||||||
|
|||||||
+2
-2
@@ -22,7 +22,7 @@ package com.vitorpamplona.amethyst.service.relayClient.reqCommand.user.watchers
|
|||||||
|
|
||||||
import com.vitorpamplona.amethyst.model.LocalCache
|
import com.vitorpamplona.amethyst.model.LocalCache
|
||||||
import com.vitorpamplona.amethyst.service.relays.SincePerRelayMap
|
import com.vitorpamplona.amethyst.service.relays.SincePerRelayMap
|
||||||
import com.vitorpamplona.quartz.experimental.relationshipStatus.RelationshipStatusEvent
|
import com.vitorpamplona.quartz.experimental.relationshipStatus.ContactCardEvent
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||||
import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent
|
import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter
|
import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter
|
||||||
@@ -35,7 +35,7 @@ val UserMetadataForKeyKinds =
|
|||||||
listOf(
|
listOf(
|
||||||
MetadataEvent.KIND,
|
MetadataEvent.KIND,
|
||||||
StatusEvent.KIND,
|
StatusEvent.KIND,
|
||||||
RelationshipStatusEvent.KIND,
|
ContactCardEvent.KIND,
|
||||||
AdvertisedRelayListEvent.KIND,
|
AdvertisedRelayListEvent.KIND,
|
||||||
ChatMessageRelayListEvent.KIND,
|
ChatMessageRelayListEvent.KIND,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import com.vitorpamplona.quartz.experimental.nip95.header.FileStorageHeaderEvent
|
|||||||
import com.vitorpamplona.quartz.experimental.nns.NNSEvent
|
import com.vitorpamplona.quartz.experimental.nns.NNSEvent
|
||||||
import com.vitorpamplona.quartz.experimental.profileGallery.ProfileGalleryEntryEvent
|
import com.vitorpamplona.quartz.experimental.profileGallery.ProfileGalleryEntryEvent
|
||||||
import com.vitorpamplona.quartz.experimental.publicMessages.PublicMessageEvent
|
import com.vitorpamplona.quartz.experimental.publicMessages.PublicMessageEvent
|
||||||
import com.vitorpamplona.quartz.experimental.relationshipStatus.RelationshipStatusEvent
|
import com.vitorpamplona.quartz.experimental.relationshipStatus.ContactCardEvent
|
||||||
import com.vitorpamplona.quartz.experimental.zapPolls.PollNoteEvent
|
import com.vitorpamplona.quartz.experimental.zapPolls.PollNoteEvent
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||||
@@ -272,7 +272,7 @@ class EventFactory {
|
|||||||
ProxyRelayListEvent.KIND -> ProxyRelayListEvent(id, pubKey, createdAt, tags, content, sig)
|
ProxyRelayListEvent.KIND -> ProxyRelayListEvent(id, pubKey, createdAt, tags, content, sig)
|
||||||
PublicMessageEvent.KIND -> PublicMessageEvent(id, pubKey, createdAt, tags, content, sig)
|
PublicMessageEvent.KIND -> PublicMessageEvent(id, pubKey, createdAt, tags, content, sig)
|
||||||
ReactionEvent.KIND -> ReactionEvent(id, pubKey, createdAt, tags, content, sig)
|
ReactionEvent.KIND -> ReactionEvent(id, pubKey, createdAt, tags, content, sig)
|
||||||
RelationshipStatusEvent.KIND -> RelationshipStatusEvent(id, pubKey, createdAt, tags, content, sig)
|
ContactCardEvent.KIND -> ContactCardEvent(id, pubKey, createdAt, tags, content, sig)
|
||||||
RelayAuthEvent.KIND -> RelayAuthEvent(id, pubKey, createdAt, tags, content, sig)
|
RelayAuthEvent.KIND -> RelayAuthEvent(id, pubKey, createdAt, tags, content, sig)
|
||||||
RelaySetEvent.KIND -> RelaySetEvent(id, pubKey, createdAt, tags, content, sig)
|
RelaySetEvent.KIND -> RelaySetEvent(id, pubKey, createdAt, tags, content, sig)
|
||||||
ReportEvent.KIND -> ReportEvent(id, pubKey, createdAt, tags, content, sig)
|
ReportEvent.KIND -> ReportEvent(id, pubKey, createdAt, tags, content, sig)
|
||||||
|
|||||||
+6
-6
@@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.nip51Lists.encryption.PrivateTagsInContent
|
|||||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
class RelationshipStatusEvent(
|
class ContactCardEvent(
|
||||||
id: HexKey,
|
id: HexKey,
|
||||||
pubKey: HexKey,
|
pubKey: HexKey,
|
||||||
createdAt: Long,
|
createdAt: Long,
|
||||||
@@ -49,9 +49,9 @@ class RelationshipStatusEvent(
|
|||||||
|
|
||||||
fun summary() = tags.firstNotNullOfOrNull(SummaryTag::parse)
|
fun summary() = tags.firstNotNullOfOrNull(SummaryTag::parse)
|
||||||
|
|
||||||
companion object {
|
companion object Companion {
|
||||||
const val KIND = 30382
|
const val KIND = 30382
|
||||||
const val ALT = "Relationship Status"
|
const val ALT = "Contact Card"
|
||||||
|
|
||||||
suspend fun create(
|
suspend fun create(
|
||||||
targetUser: HexKey,
|
targetUser: HexKey,
|
||||||
@@ -59,9 +59,9 @@ class RelationshipStatusEvent(
|
|||||||
summary: String? = null,
|
summary: String? = null,
|
||||||
signer: NostrSigner,
|
signer: NostrSigner,
|
||||||
createdAt: Long = TimeUtils.now(),
|
createdAt: Long = TimeUtils.now(),
|
||||||
publicInitializer: TagArrayBuilder<RelationshipStatusEvent>.() -> Unit = {},
|
publicInitializer: TagArrayBuilder<ContactCardEvent>.() -> Unit = {},
|
||||||
privateInitializer: TagArrayBuilder<RelationshipStatusEvent>.() -> Unit = {},
|
privateInitializer: TagArrayBuilder<ContactCardEvent>.() -> Unit = {},
|
||||||
): RelationshipStatusEvent {
|
): ContactCardEvent {
|
||||||
val publicTags =
|
val publicTags =
|
||||||
tagArray {
|
tagArray {
|
||||||
alt(ALT)
|
alt(ALT)
|
||||||
+3
-3
@@ -25,8 +25,8 @@ import com.vitorpamplona.quartz.experimental.relationshipStatus.tags.RankTag
|
|||||||
import com.vitorpamplona.quartz.experimental.relationshipStatus.tags.SummaryTag
|
import com.vitorpamplona.quartz.experimental.relationshipStatus.tags.SummaryTag
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||||
|
|
||||||
fun TagArrayBuilder<RelationshipStatusEvent>.rank(rank: Int) = add(RankTag.assemble(rank))
|
fun TagArrayBuilder<ContactCardEvent>.rank(rank: Int) = add(RankTag.assemble(rank))
|
||||||
|
|
||||||
fun TagArrayBuilder<RelationshipStatusEvent>.petName(name: String) = add(PetNameTag.assemble(name))
|
fun TagArrayBuilder<ContactCardEvent>.petName(name: String) = add(PetNameTag.assemble(name))
|
||||||
|
|
||||||
fun TagArrayBuilder<RelationshipStatusEvent>.summary(summary: String) = add(SummaryTag.assemble(summary))
|
fun TagArrayBuilder<ContactCardEvent>.summary(summary: String) = add(SummaryTag.assemble(summary))
|
||||||
|
|||||||
Reference in New Issue
Block a user