feat: add k tag to gift wraps and process only chat message rumors #30

Merged
reya merged 3 commits from only-nip17 into master 2026-04-10 02:41:21 +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)); 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 // Check if the rumor has a recipient
if rumor.tags.is_empty() { if rumor.tags.is_empty() {
let signal = let signal =

View File

@@ -400,6 +400,10 @@ impl Room {
.await? .await?
.into_iter() .into_iter()
.filter_map(|event| UnsignedEvent::from_json(&event.content).ok()) .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) .sorted_by_key(|message| message.created_at)
.collect(); .collect();
@@ -598,7 +602,8 @@ async fn send_gift_wrap<T>(
where where
T: NostrSigner + 'static, 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 // Determine the receiver public key based on the config
let receiver = match config { let receiver = match config {