aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-17 17:11:25 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-17 17:11:25 +0900
commitc1049d374a3c6d79750c57d2e1751d440df3d8cc (patch)
tree44ff770f6a1896e7e4b5ccf3ab851eebd2847e31
parent1ae42237adcc5486e526ff3a9e93d0901940a74b (diff)
downloadlibquotient-c1049d374a3c6d79750c57d2e1751d440df3d8cc.tar.gz
libquotient-c1049d374a3c6d79750c57d2e1751d440df3d8cc.zip
Fixed a blunder leading to users not having names
If all users suddenly don't have names, update to this commit, delete your cache and run again. Issue since 2bf912d6e6ddd9ff81a92ff28ac8c4c1d8f2d7e1.
-rw-r--r--user.cpp10
-rw-r--r--user.h2
2 files changed, 7 insertions, 5 deletions
diff --git a/user.cpp b/user.cpp
index 7caf54e2..171d6d6c 100644
--- a/user.cpp
+++ b/user.cpp
@@ -80,11 +80,13 @@ QString User::name() const
return d->name;
}
-void User::setName(const QString& newName)
+void User::updateName(const QString& newName)
{
const auto oldName = name();
- if (d->name != oldName)
+ if (d->name != newName)
{
+ qCDebug(MAIN) << "Renaming" << id()
+ << "from" << oldName << "to" << newName;
d->name = newName;
emit nameChanged(this, oldName);
}
@@ -93,7 +95,7 @@ void User::setName(const QString& newName)
void User::rename(const QString& newName)
{
auto job = d->connection->callApi<SetDisplayNameJob>(id(), newName);
- connect(job, &BaseJob::success, this, [=] { setName(newName); });
+ connect(job, &BaseJob::success, this, [=] { updateName(newName); });
}
QString User::displayname() const
@@ -164,7 +166,7 @@ void User::processEvent(Event* event)
d->bridged = match.captured(1);
newName.truncate(match.capturedStart(0));
}
- setName(newName);
+ updateName(newName);
if( d->avatarUrl != e->avatarUrl() )
{
d->avatarUrl = e->avatarUrl();
diff --git a/user.h b/user.h
index cf7d4e0a..79a6f5db 100644
--- a/user.h
+++ b/user.h
@@ -67,7 +67,7 @@ namespace QMatrixClient
void avatarChanged(User* user);
private slots:
- void setName(const QString& newName);
+ void updateName(const QString& newName);
private:
class Private;