2024-11-29 17:35:20 +00:00
|
|
|
import Foundation
|
|
|
|
import monalxmpp
|
|
|
|
|
|
|
|
struct Contact: Identifiable {
|
|
|
|
let ownerId: Int
|
|
|
|
let contactJid: String
|
2024-11-29 22:36:19 +00:00
|
|
|
private let nickname: String?
|
2024-11-29 17:35:20 +00:00
|
|
|
|
|
|
|
var id: String { contactJid }
|
|
|
|
|
2024-11-29 22:36:19 +00:00
|
|
|
var name: String {
|
|
|
|
nickname ?? contactJid
|
|
|
|
}
|
|
|
|
|
2024-11-29 17:35:20 +00:00
|
|
|
init?(_ obj: MLContact) {
|
|
|
|
ownerId = obj.accountID.intValue
|
|
|
|
contactJid = obj.contactJid
|
2024-11-29 22:36:19 +00:00
|
|
|
nickname = obj.nickName
|
2024-11-29 17:35:20 +00:00
|
|
|
}
|
|
|
|
}
|