support kind 42 chat messages
Changelog-Added: Support kind 42 chat messages (ArcadeCity). Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -86,6 +86,7 @@ class HomeModel: ObservableObject {
|
||||
}
|
||||
|
||||
switch kind {
|
||||
case .chat: fallthrough
|
||||
case .text:
|
||||
handle_text_event(sub_id: sub_id, ev)
|
||||
case .contacts:
|
||||
|
||||
@@ -279,7 +279,7 @@ func post_to_event(post: NostrPost, privkey: String, pubkey: String) -> NostrEve
|
||||
let post_blocks = parse_post_blocks(content: post.content)
|
||||
let post_tags = make_post_tags(post_blocks: post_blocks, tags: tags)
|
||||
let content = render_blocks(blocks: post_tags.blocks)
|
||||
let new_ev = NostrEvent(content: content, pubkey: pubkey, kind: 1, tags: post_tags.tags)
|
||||
let new_ev = NostrEvent(content: content, pubkey: pubkey, kind: post.kind.rawValue, tags: post_tags.tags)
|
||||
new_ev.calculate_id()
|
||||
new_ev.sign(privkey: privkey)
|
||||
return new_ev
|
||||
|
||||
@@ -8,8 +8,21 @@
|
||||
import Foundation
|
||||
|
||||
struct NostrPost {
|
||||
let kind: NostrKind
|
||||
let content: String
|
||||
let references: [ReferencedId]
|
||||
|
||||
init (content: String, references: [ReferencedId]) {
|
||||
self.content = content
|
||||
self.references = references
|
||||
self.kind = .text
|
||||
}
|
||||
|
||||
init (content: String, references: [ReferencedId], kind: NostrKind) {
|
||||
self.content = content
|
||||
self.references = references
|
||||
self.kind = kind
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: parse nostr:{e,p}:pubkey uris as well
|
||||
|
||||
Reference in New Issue
Block a user