Changeset View
Changeset View
Standalone View
Standalone View
src/ruqolacore/ddpapi/ddpclient.cpp
Show First 20 Lines • Show All 875 Lines • ▼ Show 20 Line(s) | |||||
876 | 876 | | |||
877 | quint64 DDPClient::loadHistory(const QJsonArray ¶ms) | 877 | quint64 DDPClient::loadHistory(const QJsonArray ¶ms) | ||
878 | { | 878 | { | ||
879 | return method(QStringLiteral("loadHistory"), QJsonDocument(params), process_backlog); | 879 | return method(QStringLiteral("loadHistory"), QJsonDocument(params), process_backlog); | ||
880 | } | 880 | } | ||
881 | 881 | | |||
882 | void DDPClient::login() | 882 | void DDPClient::login() | ||
883 | { | 883 | { | ||
884 | if (!mRocketChatAccount->settings()->password().isEmpty()) { | 884 | if (!mRocketChatAccount->settings()->authToken().isEmpty() && !mRocketChatAccount->settings()->tokenExpired()) { | ||
885 | m_attemptedPasswordLogin = true; | ||||
886 | QJsonObject json; | ||||
887 | json[QStringLiteral("resume")] = mRocketChatAccount->settings()->authToken(); | ||||
888 | m_loginJob = method(QStringLiteral("login"), QJsonDocument(json)); | ||||
889 | } else if (!mRocketChatAccount->settings()->password().isEmpty()) { | ||||
885 | // If we have a password and we couldn't log in, let's stop here | 890 | // If we have a password and we couldn't log in, let's stop here | ||
886 | if (m_attemptedPasswordLogin) { | 891 | if (m_attemptedPasswordLogin) { | ||
887 | setLoginStatus(LoginFailed); | 892 | setLoginStatus(LoginFailed); | ||
888 | return; | 893 | return; | ||
889 | } | 894 | } | ||
mlaurent: else if (...) no ? | |||||
890 | m_attemptedPasswordLogin = true; | 895 | m_attemptedPasswordLogin = true; | ||
891 | 896 | | |||
892 | //m_loginJob = login(mRocketChatAccount->settings()->userName(), mRocketChatAccount->settings()->password()); | 897 | //m_loginJob = login(mRocketChatAccount->settings()->userName(), mRocketChatAccount->settings()->password()); | ||
893 | if (mRocketChatAccount->defaultAuthenticationInterface()) { | 898 | if (mRocketChatAccount->defaultAuthenticationInterface()) { | ||
894 | mRocketChatAccount->defaultAuthenticationInterface()->login(); | 899 | mRocketChatAccount->defaultAuthenticationInterface()->login(); | ||
895 | } else { | 900 | } else { | ||
896 | qCWarning(RUQOLA_DDPAPI_LOG) <<"No plugins loaded. Please verify your installation."; | 901 | qCWarning(RUQOLA_DDPAPI_LOG) <<"No plugins loaded. Please verify your installation."; | ||
897 | setLoginStatus(FailedToLoginPluginProblem); | 902 | setLoginStatus(FailedToLoginPluginProblem); | ||
898 | } | 903 | } | ||
899 | } else if (!mRocketChatAccount->settings()->authToken().isEmpty() && !mRocketChatAccount->settings()->tokenExpired()) { | | |||
900 | m_attemptedPasswordLogin = true; | | |||
901 | QJsonObject json; | | |||
902 | json[QStringLiteral("resume")] = mRocketChatAccount->settings()->authToken(); | | |||
903 | m_loginJob = method(QStringLiteral("login"), QJsonDocument(json)); | | |||
904 | } else { | 904 | } else { | ||
905 | setLoginStatus(LoginFailed); | 905 | setLoginStatus(LoginFailed); | ||
906 | } | 906 | } | ||
907 | } | 907 | } | ||
908 | 908 | | |||
909 | void DDPClient::onWSConnected() | 909 | void DDPClient::onWSConnected() | ||
910 | { | 910 | { | ||
911 | qCDebug(RUQOLA_DDPAPI_LOG) << "Websocket connected at URL" << mUrl; | 911 | qCDebug(RUQOLA_DDPAPI_LOG) << "Websocket connected at URL" << mUrl; | ||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |
else if (...) no ?