move some stuff around, reply desc
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
32
damus/Models/Reply.swift
Normal file
32
damus/Models/Reply.swift
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user