Merge pull request 'feat: add k tag to gift wraps and process only chat message rumors' (#30) from only-nip17 into master

Reviewed-on: #30
This commit was merged in pull request #30.
This commit is contained in:
reya
2026-04-10 02:41:20 +00:00
2 changed files with 13 additions and 1 deletions

View File

@@ -253,6 +253,13 @@ impl ChatRegistry {
event_map.insert(rumor.id.unwrap(), (event.id, dekey));
}
if rumor.kind != Kind::PrivateDirectMessage
|| rumor.kind != Kind::Custom(15)
{
log::info!("Rumor is not releated to NIP17");
continue;
}
// Check if the rumor has a recipient
if rumor.tags.is_empty() {
let signal =

View File

@@ -400,6 +400,10 @@ impl Room {
.await?
.into_iter()
.filter_map(|event| UnsignedEvent::from_json(&event.content).ok())
.filter(|event| {
// Only process private direct messages and file messages
event.kind == Kind::PrivateDirectMessage || event.kind == Kind::Custom(15)
})
.sorted_by_key(|message| message.created_at)
.collect();
@@ -598,7 +602,8 @@ async fn send_gift_wrap<T>(
where
T: NostrSigner + 'static,
{
let mut extra_tags = vec![];
let k_tag = Tag::custom(TagKind::k(), vec!["14"]);
let mut extra_tags = vec![k_tag];
// Determine the receiver public key based on the config
let receiver = match config {