mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 07:13:57 +02:00
Added reading and storing of the XMPP password of the current user.
This commit is contained in:
parent
9798767261
commit
07d3eb886a
2 changed files with 24 additions and 5 deletions
|
@ -12,21 +12,26 @@
|
|||
|
||||
DataServerAccountInfo::DataServerAccountInfo() :
|
||||
_accessToken(),
|
||||
_username()
|
||||
_username(),
|
||||
_xmppPassword()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DataServerAccountInfo::DataServerAccountInfo(const QJsonObject& jsonObject) :
|
||||
_accessToken(jsonObject),
|
||||
_username()
|
||||
_username(),
|
||||
_xmppPassword()
|
||||
{
|
||||
setUsername(jsonObject["user"].toObject()["username"].toString());
|
||||
QJsonObject userJSONObject = jsonObject["user"].toObject();
|
||||
setUsername(userJSONObject["username"].toString());
|
||||
setXMPPPassword(userJSONObject["xmpp_password"].toString());
|
||||
}
|
||||
|
||||
DataServerAccountInfo::DataServerAccountInfo(const DataServerAccountInfo& otherInfo) {
|
||||
_accessToken = otherInfo._accessToken;
|
||||
_username = otherInfo._username;
|
||||
_xmppPassword = otherInfo._xmppPassword;
|
||||
}
|
||||
|
||||
DataServerAccountInfo& DataServerAccountInfo::operator=(const DataServerAccountInfo& otherInfo) {
|
||||
|
@ -40,6 +45,7 @@ void DataServerAccountInfo::swap(DataServerAccountInfo& otherInfo) {
|
|||
|
||||
swap(_accessToken, otherInfo._accessToken);
|
||||
swap(_username, otherInfo._username);
|
||||
swap(_xmppPassword, otherInfo._xmppPassword);
|
||||
}
|
||||
|
||||
void DataServerAccountInfo::setUsername(const QString& username) {
|
||||
|
@ -50,12 +56,21 @@ void DataServerAccountInfo::setUsername(const QString& username) {
|
|||
}
|
||||
}
|
||||
|
||||
void DataServerAccountInfo::setXMPPPassword(const QString& xmppPassword)
|
||||
{
|
||||
if (_xmppPassword != xmppPassword) {
|
||||
_xmppPassword = xmppPassword;
|
||||
|
||||
qDebug() << "XMPP password changed to " << xmppPassword;
|
||||
}
|
||||
}
|
||||
|
||||
QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info) {
|
||||
out << info._accessToken << info._username;
|
||||
out << info._accessToken << info._username << info._xmppPassword;
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream& operator>>(QDataStream &in, DataServerAccountInfo& info) {
|
||||
in >> info._accessToken >> info._username;
|
||||
in >> info._accessToken >> info._username >> info._xmppPassword;
|
||||
return in;
|
||||
}
|
|
@ -25,6 +25,9 @@ public:
|
|||
|
||||
const QString& getUsername() const { return _username; }
|
||||
void setUsername(const QString& username);
|
||||
|
||||
const QString& getXMPPPassword() const { return _xmppPassword; }
|
||||
void setXMPPPassword(const QString& xmppPassword);
|
||||
|
||||
friend QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info);
|
||||
friend QDataStream& operator>>(QDataStream &in, DataServerAccountInfo& info);
|
||||
|
@ -33,6 +36,7 @@ private:
|
|||
|
||||
OAuthAccessToken _accessToken;
|
||||
QString _username;
|
||||
QString _xmppPassword;
|
||||
};
|
||||
|
||||
#endif /* defined(__hifi__DataServerAccountInfo__) */
|
||||
|
|
Loading…
Reference in a new issue