25 lines
491 B
Swift
25 lines
491 B
Swift
import Foundation
|
|
import monalxmpp
|
|
|
|
struct Contact: Identifiable {
|
|
let ownerId: Int
|
|
let contactJid: String
|
|
private let nickname: String?
|
|
|
|
var id: String { contactJid }
|
|
|
|
var name: String {
|
|
if let nickname {
|
|
nickname.isEmpty ? contactJid : nickname
|
|
} else {
|
|
contactJid
|
|
}
|
|
}
|
|
|
|
init?(_ obj: MLContact) {
|
|
ownerId = obj.accountID.intValue
|
|
contactJid = obj.contactJid
|
|
nickname = obj.nickName
|
|
}
|
|
}
|