This commit is contained in:
fmodf 2024-08-18 17:04:18 +02:00
parent 7df723e62d
commit ac09086eaa
2 changed files with 9 additions and 10 deletions

View file

@ -138,13 +138,15 @@ extension Client {
} }
func requestArchivedMessages(for roster: Roster) async { func requestArchivedMessages(for roster: Roster) async {
if !discoManager.features.map({ $0.xep }).contains("XEP-0313") { print(roster)
return
} // if !discoManager.features.map({ $0.xep }).contains("XEP-0313") {
let module = connection.module(MessageArchiveManagementModule.self) // return
let endDate = Date() // }
let startDate = Calendar.current.date(byAdding: .day, value: -Const.mamRequestDaysLength, to: endDate) ?? Date() // let module = connection.module(MessageArchiveManagementModule.self)
let response = try? await module.queryItems(componentJid: JID(credentials.bareJid), with: JID(roster.bareJid), start: startDate, end: endDate, queryId: UUID().uuidString) // let endDate = Date()
// let startDate = Calendar.current.date(byAdding: .day, value: -Const.mamRequestDaysLength, to: endDate) ?? Date()
// let response = try? await module.queryItems(componentJid: JID(credentials.bareJid), with: JID(roster.bareJid), start: startDate, end: endDate, queryId: UUID().uuidString)
} }
} }

View file

@ -18,9 +18,6 @@ final class ConversationStore: ObservableObject {
self.client = client self.client = client
self.roster = roster self.roster = roster
subscribe() subscribe()
Task {
await client.requestArchivedMessages(for: roster)
}
} }
} }