Add 'origin' key to events

This commit is contained in:
Erik Johnston 2014-11-03 11:32:42 +00:00
parent 82a6b83524
commit 0a8b026ccf

View file

@ -69,6 +69,10 @@ class EventFactory(object):
kwargs["type"] = etype kwargs["type"] = etype
if "event_id" not in kwargs: if "event_id" not in kwargs:
kwargs["event_id"] = self.create_event_id() 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: if "origin_server_ts" not in kwargs:
kwargs["origin_server_ts"] = int(self.clock.time_msec()) kwargs["origin_server_ts"] = int(self.clock.time_msec())