'Generates the rooms portion of the sync response. Populates the
`sync_result_builder` with the result.
Args:
sync_result_builder(SyncResultBuilder)
account_data_by_room(dict): Dictionary of per room account data
Returns:
Deferred(tuple): Returns a 2-tuple of
`(newly_joined_rooms, newly_joined_users)`'

@defer.inlineCallbacks
def _generate_sync_entry_for_rooms(self, sync_result_builder, account_data_by_room):

    user_id = sync_result_builder.sync_config.user.to_string()
    block_all_room_ephemeral = ((sync_result_builder.since_token is None) and sync_result_builder.sync_config.filter_collection.blocks_all_room_ephemeral())
    if block_all_room_ephemeral:
        ephemeral_by_room = {}
    else:
        (now_token, ephemeral_by_room) = (yield self.ephemeral_by_room(sync_result_builder.sync_config, now_token=sync_result_builder.now_token, since_token=sync_result_builder.since_token))
        sync_result_builder.now_token = now_token
    since_token = sync_result_builder.since_token
    if (not sync_result_builder.full_state):
        if (since_token and (not ephemeral_by_room) and (not account_data_by_room)):
            have_changed = (yield self._have_rooms_changed(sync_result_builder))
            if (not have_changed):
                tags_by_room = (yield self.store.get_updated_tags(user_id, since_token.account_data_key))
                if (not tags_by_room):
                    logger.debug('no-oping    sync')
                    defer.returnValue(([], []))
    ignored_account_data = (yield self.store.get_global_account_data_by_type_for_user('m.ignored_user_list', user_id=user_id))
    if ignored_account_data:
        ignored_users = ignored_account_data.get('ignored_users', {}).keys()
    else:
        ignored_users = frozenset()
    if since_token:
        res = (yield self._get_rooms_changed(sync_result_builder, ignored_users))
        (room_entries, invited, newly_joined_rooms) = res
        tags_by_room = (yield self.store.get_updated_tags(user_id, since_token.account_data_key))
    else:
        res = (yield self._get_all_rooms(sync_result_builder, ignored_users))
        (room_entries, invited, newly_joined_rooms) = res
        tags_by_room = (yield self.store.get_tags_for_user(user_id))
    def handle_room_entries(room_entry):
        return self._generate_room_entry(sync_result_builder, ignored_users, room_entry, ephemeral=ephemeral_by_room.get(room_entry.room_id, []), tags=tags_by_room.get(room_entry.room_id), account_data=account_data_by_room.get(room_entry.room_id, {}), always_include=sync_result_builder.full_state)
    (yield concurrently_execute(handle_room_entries, room_entries, 10))
    sync_result_builder.invited.extend(invited)
    newly_joined_users = set()
    if since_token:
        for joined_sync in sync_result_builder.joined:
            it = itertools.chain(joined_sync.timeline.events, joined_sync.state.values())
            for event in it:
                if (event.type == EventTypes.Member):
                    if (event.membership == Membership.JOIN):
                        newly_joined_users.add(event.state_key)
    defer.returnValue((newly_joined_rooms, newly_joined_users))
