another.im-ios/Monal/another.im/XMPP/Models/Chat.swift
2024-11-29 23:36:19 +01:00

28 lines
624 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 contact = Contact(obj) else { return nil }
accountId = contact.ownerId
participantJid = contact.contactJid
participantName = contact.name
}
}