@@ -0,0 +1,1244 @@
+# -*- coding: utf-8 -*-%0A# Copyright 2014 OpenMarket Ltd%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#     http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0Afrom .room import RoomMemberEvent%0A%0Adef prune_event(event):%0A    %22%22%22 Prunes the given event of all keys we don't know about or think could%0A    potentially be dodgy.%0A%0A    This is used when we %22delete%22 an event. We want to remove all fields that%0A    the user has specified, but we do want to keep necessary information like%0A    type, state_key etc.%0A    %22%22%22%0A%0A    # Remove all extraneous fields.%0A    event.unrecognized_keys = %7B%7D%0A%0A    if event.type == RoomMemberEvent.TYPE:%0A        new_content = %7B%0A            %22membership%22: event.content%5B%22membership%22%5D%0A        %7D%0A    else:%0A        new_content = %7B%7D%0A%0A    event.content = new_content%0A%0A    return event%0A

Add prune_event method