Create a named device on login

This commit is contained in:
Konstantinos Sideris 2017-05-30 14:28:04 +03:00
parent f81909d34b
commit 0f72808858

View file

@ -34,10 +34,22 @@ LoginRequest::LoginRequest(QString username, QString password)
QByteArray LoginRequest::serialize() noexcept QByteArray LoginRequest::serialize() noexcept
{ {
#if defined(Q_OS_MAC)
QString initialDeviceName("nheko on Mac OS");
#elif defined(Q_OS_LINUX)
QString initialDeviceName("nheko on Linux");
#elif defined(Q_OS_WIN)
QString initialDeviceName("nheko on Windows");
#else
QString initialDeviceName("nheko");
#endif
QJsonObject body{ QJsonObject body{
{"type", "m.login.password"}, {"type", "m.login.password"},
{"user", user_}, {"user", user_},
{"password", password_}}; {"password", password_},
{"initial_device_display_name", initialDeviceName},
};
return QJsonDocument(body).toJson(QJsonDocument::Compact); return QJsonDocument(body).toJson(QJsonDocument::Compact);
} }