move some stuff around, reply desc

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-05-08 10:45:24 -07:00
parent 8896d19f40
commit 151c79dd98
5 changed files with 198 additions and 165 deletions

32
damus/Models/Reply.swift Normal file
View File

@@ -0,0 +1,32 @@
//
// Reply.swift
// damus
//
// Created by William Casarin on 2022-05-08.
//
import Foundation
struct ReplyDesc {
let pubkeys: [String]
let others: Int
}
func make_reply_description(_ tags: [[String]]) -> ReplyDesc {
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 < 2 {
ns.append(tag[1])
}
}
i -= 1
}
return ReplyDesc(pubkeys: ns, others: c)
}