quotient-im / libQuotient

A Qt library to write cross-platform clients for Matrix
https://quotient-im.github.io/libQuotient/
GNU Lesser General Public License v2.1
132 stars 56 forks source link

Fix authenticated media #784

Closed TobiasFella closed 3 weeks ago

sonarcloud[bot] commented 4 weeks ago

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

TobiasFella commented 4 weeks ago

Yeah, pulling the Connection in there is a bit terrible. I did it this way because then we're already prepared for a future where access tokens change at runtime (refresh tokens, OIDC), but i guess we do need to push the token in there directly

KitsuneRal commented 4 weeks ago

The control point for tokens (ConnectionData::setToken()) is already there anyway, and ConnectionData can push the token down to NAM, every time the token is updated. It can even store the token in NAM, with ConnectionData::accessToken() retrieving it from there (with tiny loss of efficiency vs. tiny win of memory).

TobiasFella commented 3 weeks ago

right, that's nicer. I've updated the patch