Chat reform:
- use consistently package_id to model belonging of a chat object to a particular package instead of the context_id
- set context_id to the package_id, as was already the case in practice, for permission checking
- make sure package_id exists and set it to the context_id in case it doesn't to handle legacy installations