Files
damus/damus/Models/Reply.swift
William Casarin 151c79dd98 move some stuff around, reply desc
Signed-off-by: William Casarin <jb55@jb55.com>
2022-05-08 10:45:24 -07:00

33 lines
582 B
Swift

//
// 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)
}