1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00
Commit Graph

37 Commits

Author SHA1 Message Date
Richard van der Hoff
e25112ad35 Fix exceptions when dealing with redactions
When we got a redaction event, we were adding the entire (circular) MatrixEvent
object for the redaction to the redacted event, which would then cause
exceptions down the line (particularly when dealing with gappy timelines).

We should only be adding the raw event.

Fixes (hopefully) https://github.com/vector-im/vector-web/issues/1389.
2016-08-30 14:30:12 +01:00
Richard van der Hoff
1159e0911f support for unpacking megolm keys
This is incredibly hacky at the moment, pending the arrival of ephemeral
events, but it kinda works.
2016-08-22 18:24:46 +01:00
Richard van der Hoff
32fa51818b Make encryption asynchronous
We're going to need to send out a load of messages to distribute the megolm
keys; as a first step, deal with the asynchronicity this will require.
2016-08-19 16:18:33 +01:00
Richard van der Hoff
2e4a8f4fa5 Change how MatrixEvent manages encrypted events
Make `MatrixEvent.event` contain the *encrypted* event, and keep the plaintext
payload in a separate `_clearEvent` property.

This achieves several aims:

* means that we have a record of the actual object which was received over
  the wire, which can be shown by clients for 'view source'.

* makes sent and received encrypted MatrixEvents more consistent (previously
  sent ones had `encryptedType` and `encryptedContent` properties, whereas
  received ones threw away the ciphertext).

* Avoids having to make two MatrixEvents in the receive path, and copying
  fields from one to the other.

*Hopefully* most clients have followed the advice given in the jsdoc of not
relying on MatrixEvent.event to get at events. If they haven't, I guess they'll
break in the face of encrypted events.

(The pushprocessor didn't follow this advice, so needed some tweaks.)
2016-06-09 18:23:54 +01:00
Richard van der Hoff
60519c4e6b client: add isEventSenderVerified()
Add a method which allows applications to check if the sender of an event is on
the list of verified senders.
2016-06-08 17:20:26 +01:00
Richard van der Hoff
02be0f659a Support for cancelling pending events
Implement client.cancelPendingEvent which will cancel queued or not_sent events
2016-03-17 22:15:46 +00:00
Richard van der Hoff
3c6bd4774d Refactor transmitted-messages code
This is some preparatory work for fixing up the problems with te timeline
ordering of unsent messages
(https://github.com/vector-im/vector-web/issues/1120). The functional changes
here should be minimal (bar an extra `Room.localEchoUpdated` when the local
echo is first added to the timeline).

Give `MatrixClient.sendEvent` its own entry point `Room.addPendingMessage`
instead of pushing it through `addEventsToTimeline`; this considerably
simplifies the implementation of the latter and also means that we can contain
the `_txnId` ming to MatrixClient.

Move the code which deals with a successful `/send` response from
`MatrixClient` into `Room.updatePendingEvent`, since it involves fiddling with
the innards of the Room.

Also adds a new EventStatus 'SENT' for events which have been successfully sent
but whose remote echo we still haven't received.
2016-03-17 14:26:36 +00:00
Matthew Hodgson
de864c489a make sure we show display names & avatars on parts, and use the right type of content for displaynames for member events in general. fixes https://github.com/vector-im/vector-web/issues/1140 and https://github.com/vector-im/vector-web/issues/873 and a bunch more 2016-03-16 17:32:47 +00:00
Matthew Hodgson
f35409700a Revert "make sure we show display names & avatars on parts, and use the right…" 2016-03-16 14:49:29 +00:00
Matthew Hodgson
98b0cf2560 make sure we show display names & avatars on parts, and use the right type of content for displaynames for member events in general. fixes https://github.com/vector-im/vector-web/issues/1140 and https://github.com/vector-im/vector-web/issues/873 and a bunch more 2016-03-16 13:51:55 +00:00
Richard van der Hoff
ab0a06eea7 More delinting 2016-02-16 16:19:32 +00:00
Richard van der Hoff
6a6db36088 delintificate 2016-02-16 16:14:45 +00:00
Richard van der Hoff
4c6d0a5128 Redactions: only remove the keys that are specced for removal 2016-02-16 16:03:18 +00:00
Richard van der Hoff
5eff278454 Keep redacted events in the timeline
Everything gets confused when we remove events from timelines, so keep
redacted events in there, and mark them as redacted instead.
2016-02-16 12:05:13 +00:00
Kegan Dougal
51fe73bc27 Return v2 prev_content when calling getPrevContent() 2016-01-11 17:15:52 +00:00
Matthew Hodgson
446faed9b5 copyrights please... 2016-01-07 04:15:38 +00:00
Kegan Dougal
fcf1abb185 Use v2 transaction IDs to suppress dupes without linear scans of the timeline! 2015-12-14 11:35:50 +00:00
Kegan Dougal
fc6ce20e14 Check unsigned.age for getAge() for v2. Don't spam SYNCING emissions. 2015-12-14 10:27:53 +00:00
Kegan Dougal
243bdd78f4 Handle presence key in /sync 2015-12-09 16:09:47 +00:00
Mark Haines
ae8e01839e Add flag for indicating if an event was encrypted 2015-07-22 11:57:34 +01:00
Mark Haines
6dae0ef327 Fix the local echo for encrypted events by sending a single event with different content and event type for the wire vs local display 2015-07-21 14:19:24 +01:00
David Baker
753a11ab7f Move push actions method to the client 2015-07-01 14:09:34 +01:00
David Baker
c82b2049eb prefix internal var with underscrore 2015-06-29 16:34:33 +01:00
David Baker
53f2f156ca Fix linting errors 2015-06-29 16:09:07 +01:00
David Baker
083a0980eb javascript function syntax #3... 2015-06-29 15:57:20 +01:00
David Baker
1be02a3c3c Port over push rule eveluator from the angular SDK and make it available on MatrixEvent 2015-06-29 15:53:23 +01:00
Kegan Dougal
3c4bda8580 Add MatrixScheduler.removeEventFromQueue/getQueueForEvent and QUEUED state.
This is to allow the UI to show "queued" on events as well as allow the
removal of events in the queue.
2015-06-26 09:52:52 +01:00
Kegan Dougal
d151ac49f2 Mark events which fail to send. 2015-06-18 09:32:04 +01:00
Kegan Dougal
8e6eb35dfe Implement local echo.
Mark events being sent via the status property. Update CHANGELOG.
2015-06-17 17:42:12 +01:00
Kegan Dougal
8a844d59ec Get historical display names working on messages.
Accessed via MatrixEvent.sender property. Deep copy the list of state events
from initial sync for old/current RoomState so updating the .sender property
doesn't affect both of them. Reverse the insertion of initial sync MatrixEvents
so state diverges to *earlier* points in time. Add a 'forwardLooking' property
to MatrixEvent to determine which out of 'content' and 'prev_content' entities
should take into account e.g. when determining display names. Finally, always
create new RoomMembers when they are updated in order to prevent corrupting
(read: sharing the same member object) the MatrixEvent.sender property of
existing events in the timeline.
2015-06-12 14:21:24 +01:00
Kegan Dougal
3061b95afe Add getPrevContent function and mark it's situational presence. 2015-06-12 11:26:33 +01:00
Kegan Dougal
a2257aeb0b Move getFriendlyDisplayName to RoomMember class. Add more utlity functions. 2015-06-08 12:21:23 +01:00
Kegan Dougal
7ce3a781f3 Add Room, RoomState and RoomMember classes. 2015-06-08 11:47:15 +01:00
Kegan Dougal
6f4b600c0b Appease closure linter. 2015-06-05 14:54:06 +01:00
Kegan Dougal
02064bac8a Recombine initialSync/event high-level logic with HTTP API calls. 2015-06-05 13:30:11 +01:00
Kegan Dougal
051f3c42b7 Add more jsdoc. 2015-06-04 17:08:40 +01:00
Kegan Dougal
d1e51de7ec Split out matrix.js into different files. Glue things back.
Added a models directory. Added store, http-api and client files. Slowly
transitioning to the architecture outlined in SYJS-5.
2015-06-03 17:55:12 +01:00