From 9e096f31f8d4eddf5ee8198649363860ab1e3767 Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 28 Jun 2019 08:38:21 +0000 Subject: [PATCH] [Event] sendAgain with return and mark all sending events as error on start --- lib/src/Event.dart | 7 ++++--- lib/src/Store.dart | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/src/Event.dart b/lib/src/Event.dart index 696c5c39..dcc04b6e 100644 --- a/lib/src/Event.dart +++ b/lib/src/Event.dart @@ -170,10 +170,11 @@ class Event { } /// Try to send this event again. Only works with events of status -1. - Future sendAgain({String txid}) async { - if (status != -1) return; + Future sendAgain({String txid}) async { + if (status != -1) return null; remove(); - room.sendTextEvent(text, txid: txid); + final String eventID = await room.sendTextEvent(text, txid: txid); + return eventID; } @Deprecated("Use [client.store.getEventList(Room room)] instead!") diff --git a/lib/src/Store.dart b/lib/src/Store.dart index e108a4c8..a8271fad 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -69,6 +69,8 @@ class Store { } }); + await _db.rawUpdate("UPDATE Events SET status=-1 WHERE status=0"); + List list = await _db .rawQuery("SELECT * FROM Clients WHERE client=?", [client.clientName]); if (list.length == 1) {