More bug fixes

This commit is contained in:
Erik Johnston 2014-12-08 14:50:48 +00:00
parent ba3d1e2fc0
commit ee3df06183
5 changed files with 20 additions and 13 deletions

View file

@ -713,7 +713,7 @@ class _TransactionQueue(object):
# table and we'll get back to it later.
destinations = set(destinations)
destinations.remove(self.server_name)
destinations.discard(self.server_name)
logger.debug("Sending to: %s", str(destinations))

View file

@ -88,10 +88,6 @@ class BaseHandler(object):
prev_state = ret
if builder.is_state():
prev_state = yield self.store.add_event_hashes(
prev_state
)
builder.prev_state = prev_state
yield self.auth.add_auth_events(builder, context)

View file

@ -137,6 +137,18 @@ class MessageHandler(BaseHandler):
def handle_event(self, event_dict):
builder = self.event_builder_factory.new(event_dict)
if builder.type == EventTypes.Member:
membership = builder.content.get("membership", None)
if membership == Membership.JOIN:
joinee = self.hs.parse_userid(builder.state_key)
# If event doesn't include a display name, add one.
yield self.distributor.fire(
"collect_presencelike_data",
joinee,
builder.content
)
event, context = yield self._create_new_client_event(
builder=builder,
)

View file

@ -187,6 +187,7 @@ class RoomCreationHandler(BaseHandler):
creation_event = create(
etype=RoomCreateEvent.TYPE,
content={"creator": creator.to_string()},
state_key="",
)
join_event = create(
@ -406,11 +407,6 @@ class RoomMemberHandler(BaseHandler):
# room_id = RoomID.from_string(event.room_id, self.hs)
room_id = event.room_id
# If event doesn't include a display name, add one.
yield self.distributor.fire(
"collect_presencelike_data", joinee, event.content
)
# XXX: We don't do an auth check if we are doing an invite
# join dance for now, since we're kinda implicitly checking
# that we are allowed to join when we decide whether or not we
@ -524,7 +520,6 @@ class RoomMemberHandler(BaseHandler):
context,
extra_users=[target_user],
suppress_auth=(not do_auth),
do_invite_host=do_invite_host,
)

View file

@ -149,7 +149,7 @@ class StateHandler(object):
if event.is_state():
ret = yield self.resolve_state_groups(
[e for e, _ in event.prev_events],
event_type=event.event_type,
event_type=event.type,
state_key=event.state_key,
)
else:
@ -200,7 +200,11 @@ class StateHandler(object):
prev_state = state.get((event_type, state_key), None)
if prev_state:
prev_state = prev_state.event_id
defer.returnValue((name, state, [prev_state]))
prev_states = [prev_state]
else:
prev_states = []
defer.returnValue((name, state, prev_states))
state = {}
for group, g_state in state_groups.items():