Threepid seems to be pretty out of date, several missing endpoints.
Should also fix#3037, where we were still listening on the `/unstable`
prefix, while Element Web uses `/r0`
Adds some more checks in regards to power levels, uses a less heavy way
to get the membership of a user, avoids asking the database for the room
version, since it will be queried later. [skip ci]
This adds tests for `/profile`.
Also, as a first change in this regard, refactors the methods defined on
the `UserInternalAPI` to not use structs as the request/response
parameters.