diff options
Diffstat (limited to 'avatar.cpp')
-rw-r--r-- | avatar.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -62,6 +62,11 @@ QImage Avatar::get(int width, int height, notifier_t notifier) const return d->get({width, height}, notifier); } +QString Avatar::mediaId() const +{ + return d->_url.authority() + d->_url.path(); +} + QImage Avatar::Private::get(QSize size, Avatar::notifier_t notifier) const { // FIXME: Alternating between longer-width and longer-height requests @@ -113,6 +118,13 @@ bool Avatar::updateUrl(const QUrl& newUrl) if (newUrl == d->_url) return false; + // FIXME: Make it a library-wide constant and maybe even make the URL checker + // a Connection(?) method. + if (newUrl.scheme() != "mxc" || newUrl.path().count('/') != 1) + { + qCWarning(MAIN) << "Malformed avatar URL:" << newUrl.toDisplayString(); + return false; + } d->_url = newUrl; d->_valid = false; return true; |