'Check member event changes for any profile changes and update the
database if there are.'

@defer.inlineCallbacks
def _handle_profile_change(self, user_id, room_id, prev_event_id, event_id):

    if ((not prev_event_id) or (not event_id)):
        return
    prev_event = (yield self.store.get_event(prev_event_id, allow_none=True))
    event = (yield self.store.get_event(event_id, allow_none=True))
    if ((not prev_event) or (not event)):
        return
    if (event.membership != Membership.JOIN):
        return
    prev_name = prev_event.content.get('displayname')
    new_name = event.content.get('displayname')
    prev_avatar = prev_event.content.get('avatar_url')
    new_avatar = event.content.get('avatar_url')
    if ((prev_name != new_name) or (prev_avatar != new_avatar)):
        (yield self.store.update_profile_in_user_dir(user_id, new_name, new_avatar, room_id))
