This commit is contained in:
fmodf 2024-07-02 09:22:28 +02:00
parent 9329cd3ab5
commit a4ccd9af0d
2 changed files with 7 additions and 5 deletions

View file

@ -167,7 +167,7 @@ final class DatabaseMiddleware {
promise(.success(.databaseAction(.storeMessageFailed(reason: L10n.Global.Error.genericDbError))))
return
}
guard message.contentType != .typing else {
guard message.contentType != .typing, message.body != nil else {
promise(.success(.empty))
return
}

View file

@ -109,11 +109,13 @@ final class XMPPService: ObservableObject {
completion(false)
return
}
let message = Martin.Message()
message.to = JID(to)
message.body = message.body
guard let chat = client.module(MessageModule.self).chatManager.chat(for: client.context, with: BareJID(to)) else {
completion(false)
return
}
client.context.writer.write(message) { res in
let msg = chat.createMessage(text: message.body ?? "??", id: message.id)
chat.send(message: msg) { res in
switch res {
case .success:
completion(true)