better reply descriptions

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-04-18 13:17:34 -07:00
parent 8cc3edf195
commit 9b79b46601
4 changed files with 54 additions and 9 deletions

View File

@@ -130,7 +130,26 @@ class NostrEvent: Codable, Identifiable {
public var referenced_ids: [ReferencedId] {
return get_referenced_ids(key: "e")
}
public var reply_description: ([String], Int) {
var c = 0
var ns: [String] = []
var i = tags.count - 1
while i >= 0 {
let tag = tags[i]
if tag.count >= 2 && tag[0] == "p" {
c += 1
if ns.count < 3 {
ns.append(tag[1])
}
}
i -= 1
}
return (ns, c)
}
public var referenced_pubkeys: [ReferencedId] {
return get_referenced_ids(key: "p")
}