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)))) promise(.success(.databaseAction(.storeMessageFailed(reason: L10n.Global.Error.genericDbError))))
return return
} }
guard message.contentType != .typing else { guard message.contentType != .typing, message.body != nil else {
promise(.success(.empty)) promise(.success(.empty))
return return
} }

View file

@ -109,11 +109,13 @@ final class XMPPService: ObservableObject {
completion(false) completion(false)
return return
} }
let message = Martin.Message() guard let chat = client.module(MessageModule.self).chatManager.chat(for: client.context, with: BareJID(to)) else {
message.to = JID(to) completion(false)
message.body = message.body 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 { switch res {
case .success: case .success:
completion(true) completion(true)