Skip to content

Commit

Permalink
nostr: add TagKind::Client variant
Browse files Browse the repository at this point in the history
Closes #576

Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Sep 26, 2024
1 parent 0f30637 commit c114b3a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

### Added

* nostr: add `TagKind::Client` variant ([Yuki Kishimoto])
* relay-builder: add `LocalRelay` and `RelayBuilder` ([Yuki Kishimoto])
* relay-builder: allow to serve local relay as hidden service ([Yuki Kishimoto])
* relay-builder: allow to set number of max connections allowed ([Yuki Kishimoto])
Expand Down
6 changes: 6 additions & 0 deletions bindings/nostr-ffi/src/event/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ pub enum TagKind {
Encrypted,
Request,
Word,
/// Client
///
/// <https://github.com/nostr-protocol/nips/blob/master/89.md>
Client,
Unknown {
unknown: String,
},
Expand Down Expand Up @@ -170,6 +174,7 @@ impl<'a> From<tag::TagKind<'a>> for TagKind {
tag::TagKind::Encrypted => Self::Encrypted,
tag::TagKind::Request => Self::Request,
tag::TagKind::Word => Self::Word,
tag::TagKind::Client => Self::Client,
tag::TagKind::Custom(unknown) => Self::Unknown {
unknown: unknown.to_string(),
},
Expand Down Expand Up @@ -223,6 +228,7 @@ impl<'a> From<TagKind> for tag::TagKind<'a> {
TagKind::Encrypted => Self::Encrypted,
TagKind::Request => Self::Request,
TagKind::Word => Self::Word,
TagKind::Client => Self::Client,
TagKind::Unknown { unknown } => Self::Custom(Cow::Owned(unknown)),
}
}
Expand Down
6 changes: 6 additions & 0 deletions crates/nostr/src/event/tag/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ pub enum TagKind<'a> {
Request,
/// Word
Word,
/// Client
///
/// <https://github.com/nostr-protocol/nips/blob/master/89.md>
Client,
/// Custom tag kind
Custom(Cow<'a, str>),
}
Expand Down Expand Up @@ -166,6 +170,7 @@ impl<'a> fmt::Display for TagKind<'a> {
Self::Encrypted => write!(f, "encrypted"),
Self::Request => write!(f, "request"),
Self::Word => write!(f, "word"),
Self::Client => write!(f, "client"),
Self::Custom(tag) => write!(f, "{tag}"),
}
}
Expand Down Expand Up @@ -216,6 +221,7 @@ impl<'a> From<&'a str> for TagKind<'a> {
"encrypted" => Self::Encrypted,
"request" => Self::Request,
"word" => Self::Word,
"client" => Self::Client,
k => match SingleLetterTag::from_str(k) {
Ok(s) => Self::SingleLetter(s),
Err(..) => Self::Custom(Cow::Borrowed(k)),
Expand Down

0 comments on commit c114b3a

Please sign in to comment.