From b5698b175fda4f12db216264cf5fa98afb0ba2db Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 28 Jun 2019 08:10:30 +0200 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 696c5c3..dcc04b6 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 e108a4c..a8271fa 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) {