summary refs log tree commit diff
path: root/synapse/federation/pdu_codec.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-11-03 13:06:58 +0000
committerErik Johnston <erik@matrix.org>2014-11-03 13:06:58 +0000
commitad6eacb3e9424902da9f83c8f106a4f0169c3108 (patch)
treeea58644dcf4e79d3379b1031f12a48713e7aee87 /synapse/federation/pdu_codec.py
parentFor now, don't store txn -> pdu mappings. (diff)
downloadsynapse-ad6eacb3e9424902da9f83c8f106a4f0169c3108.tar.xz
Rename PDU fields to match that of events.
Diffstat (limited to 'synapse/federation/pdu_codec.py')
-rw-r--r--synapse/federation/pdu_codec.py48
1 files changed, 2 insertions, 46 deletions
diff --git a/synapse/federation/pdu_codec.py b/synapse/federation/pdu_codec.py
index d4c896e163..5ec97a698e 100644
--- a/synapse/federation/pdu_codec.py
+++ b/synapse/federation/pdu_codec.py
@@ -31,39 +31,16 @@ class PduCodec(object):
         self.clock = hs.get_clock()
         self.hs = hs
 
-    def encode_event_id(self, local, domain):
-        return local
-
-    def decode_event_id(self, event_id):
-        e_id = self.hs.parse_eventid(event_id)
-        return event_id, e_id.domain
-
     def event_from_pdu(self, pdu):
         kwargs = {}
 
-        kwargs["event_id"] = self.encode_event_id(pdu.pdu_id, pdu.origin)
-        kwargs["room_id"] = pdu.context
-        kwargs["etype"] = pdu.pdu_type
-        kwargs["prev_events"] = [
-            (self.encode_event_id(i, o), s)
-            for i, o, s in pdu.prev_pdus
-        ]
-
-        if hasattr(pdu, "prev_state_id") and hasattr(pdu, "prev_state_origin"):
-            kwargs["prev_state"] = self.encode_event_id(
-                pdu.prev_state_id, pdu.prev_state_origin
-            )
+        kwargs["etype"] = pdu.type
 
         kwargs.update({
             k: v
             for k, v in pdu.get_full_dict().items()
             if k not in [
-                "pdu_id",
-                "context",
-                "pdu_type",
-                "prev_pdus",
-                "prev_state_id",
-                "prev_state_origin",
+                "type",
             ]
         })
 
@@ -72,33 +49,12 @@ class PduCodec(object):
     def pdu_from_event(self, event):
         d = event.get_full_dict()
 
-        d["pdu_id"], d["origin"] = self.decode_event_id(
-            event.event_id
-        )
-        d["context"] = event.room_id
-        d["pdu_type"] = event.type
-
-        if hasattr(event, "prev_events"):
-            def f(e, s):
-                i, o = self.decode_event_id(e)
-                return i, o, s
-            d["prev_pdus"] = [
-                f(e, s)
-                for e, s in event.prev_events
-            ]
-
-        if hasattr(event, "prev_state"):
-            d["prev_state_id"], d["prev_state_origin"] = (
-                self.decode_event_id(event.prev_state)
-            )
-
         if hasattr(event, "state_key"):
             d["is_state"] = True
 
         kwargs = copy.deepcopy(event.unrecognized_keys)
         kwargs.update({
             k: v for k, v in d.items()
-            if k not in ["event_id", "room_id", "type", "prev_events"]
         })
 
         if "origin_server_ts" not in kwargs: