diff options
author | Erik Johnston <erikj@jki.re> | 2018-11-05 13:35:15 +0000 |
---|---|---|
committer | Amber Brown <hawkowl@atleastfornow.net> | 2018-11-06 00:35:15 +1100 |
commit | bc80b3f454aa9b9ca8bc710ff502b83892ac0a91 (patch) | |
tree | da9af91ab5640b0124800a885a8f24767e2e54c7 /synapse/events | |
parent | Set the encoding to UTF8 in the default logconfig (#4138) (diff) | |
download | synapse-bc80b3f454aa9b9ca8bc710ff502b83892ac0a91.tar.xz |
Add helpers for getting prev and auth events (#4139)
* Add helpers for getting prev and auth events This is in preparation for allowing the event format to change between room versions.
Diffstat (limited to 'synapse/events')
-rw-r--r-- | synapse/events/__init__.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index 12f1eb0a3e..84c75495d5 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -159,6 +159,24 @@ class EventBase(object): def keys(self): return six.iterkeys(self._event_dict) + def prev_event_ids(self): + """Returns the list of prev event IDs. The order matches the order + specified in the event, though there is no meaning to it. + + Returns: + list[str]: The list of event IDs of this event's prev_events + """ + return [e for e, _ in self.prev_events] + + def auth_event_ids(self): + """Returns the list of auth event IDs. The order matches the order + specified in the event, though there is no meaning to it. + + Returns: + list[str]: The list of event IDs of this event's auth_events + """ + return [e for e, _ in self.auth_events] + class FrozenEvent(EventBase): def __init__(self, event_dict, internal_metadata_dict={}, rejected_reason=None): |