diff options
author | Kegan Dougal <kegan@matrix.org> | 2015-01-29 09:27:16 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2015-01-29 09:27:16 +0000 |
commit | 2a4fda7b88cf91db8de2e524df162153d3f27094 (patch) | |
tree | d52e3116c73d2f6da43bc54e646f5de7e3891f81 /synapse/api | |
parent | Also edit the filter column on the delta SQL (diff) | |
download | synapse-2a4fda7b88cf91db8de2e524df162153d3f27094.tar.xz |
Add filtering.filter_events function, with stub passes_filter function.
Diffstat (limited to 'synapse/api')
-rw-r--r-- | synapse/api/filtering.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py index 6c7a73b6d5..d7ba6510ee 100644 --- a/synapse/api/filtering.py +++ b/synapse/api/filtering.py @@ -34,6 +34,21 @@ class Filtering(object): # replace_user_filter at some point? There's no REST API specified for # them however + def passes_filter(self, filter_json, event): + """Check if the event passes through the filter. + + Args: + filter_json(dict): The filter specification + event(Event): The event to check + Returns: + True if the event passes through the filter. + """ + return True + + def filter_events(self, events, user, filter_id): + filter_json = self.get_user_filter(user, filter_id) + return [e for e in events if self.passes_filter(filter_json, e)] + def _check_valid_filter(self, user_filter): """Check if the provided filter is valid. |