'Encode the archived rooms in a sync result
Args:
rooms (list[synapse.handlers.sync.ArchivedSyncResult]): list of
sync results for rooms this user is joined to
time_now(int): current time - used as a baseline for age
calculations
token_id(int): ID of the user\'s auth token - used for namespacing
of transaction IDs
event_fields(list<str>): List of event fields to include. If empty,
all fields will be returned.
Returns:
dict[str, dict[str, object]]: The invited rooms list, in our
response format'

def encode_archived(self, rooms, time_now, token_id, event_fields):

    joined = {}
    for room in rooms:
        joined[room.room_id] = self.encode_room(room, time_now, token_id, joined=False, only_fields=event_fields)
    return joined
