summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-11-03 11:32:42 +0000
committerErik Johnston <erik@matrix.org>2014-11-03 11:32:42 +0000
commit0a8b026ccf2d2472bb14303eaf5af8b8cf0efa5d (patch)
treed2632896457056ece09f3f291dcb1f76264e4ccc
parentDon't assume event has hashes key already (diff)
downloadsynapse-0a8b026ccf2d2472bb14303eaf5af8b8cf0efa5d.tar.xz
Add 'origin' key to events
-rw-r--r--synapse/api/events/factory.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/api/events/factory.py b/synapse/api/events/factory.py
index 750096c618..9134c82eff 100644
--- a/synapse/api/events/factory.py
+++ b/synapse/api/events/factory.py
@@ -69,6 +69,10 @@ class EventFactory(object):
         kwargs["type"] = etype
         if "event_id" not in kwargs:
             kwargs["event_id"] = self.create_event_id()
+            kwargs["origin"] = self.hs.hostname
+        else:
+            ev_id = self.hs.parse_eventid(kwargs["event_id"])
+            kwargs["origin"] = ev_id.domain
 
         if "origin_server_ts" not in kwargs:
             kwargs["origin_server_ts"] = int(self.clock.time_msec())