another.im-ios/Monal/another.im/XMPP/Models/Chat.swift
2024-11-29 18:35:20 +01:00

28 lines
617 B
Swift

import Foundation
import monalxmpp
struct Chat: Identifiable {
let accountId: Int
let participantJid: String
let participantName: String?
var id: String {
"\(accountId)_\(participantJid)"
}
var name: String {
if let participantName, !participantName.isEmpty {
return participantName
} else {
return participantJid
}
}
init?(_ obj: MLContact) {
guard let accId = obj.accountID as? Int else { return nil }
accountId = accId
participantJid = obj.contactJid
participantName = obj.nickName
}
}