diff --git a/lib/src/room.dart b/lib/src/room.dart index 0fe2081d..71137c97 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -646,14 +646,13 @@ class Room { threadRootEventId: threadRootEventId, threadLastEventId: threadLastEventId); } - + final eventContent = getEventContentFromMsgText( message: message, parseMarkdown: parseMarkdown, msgtype: msgtype, ); - return sendEvent( - eventContent, + return sendEvent(eventContent, txid: txid, inReplyTo: inReplyTo, editEventId: editEventId, @@ -783,6 +782,7 @@ class Room { String? editEventId, String? threadRootEventId, String? threadLastEventId, + DateTime? sentDate, }) async { // Create new transaction id final String messageID; @@ -854,7 +854,6 @@ class Room { content['formatted_body'] = '* ${content['formatted_body']}'; } } - final sentDate = DateTime.now(); final syncUpdate = SyncUpdate( nextBatch: '', rooms: RoomsUpdate( @@ -867,7 +866,7 @@ class Room { type: type, eventId: messageID, senderId: client.userID!, - originServerTs: sentDate, + originServerTs: sentDate ?? DateTime.now(), unsigned: { messageSendingStatusKey: EventStatus.sending.intValue, 'transaction_id': messageID, @@ -1022,9 +1021,11 @@ class Room { } /// Call the Matrix API to invite a user to this room. - Future invite(String userID, { + Future invite( + String userID, { String reason = 'Welcome', - }) => client.inviteUser(id, userID, reason: reason); + }) => + client.inviteUser(id, userID, reason: reason); /// Request more previous events from the server. [historyCount] defines how much events should /// be received maximum. When the request is answered, [onHistoryReceived] will be triggered **before**