Preparation for messageeventmodel.

This commit is contained in:
Black Hat
2018-03-05 19:11:55 +08:00
parent 9b4fa0d8c6
commit fe57008564
6 changed files with 39 additions and 15 deletions

View File

@@ -11,20 +11,24 @@ Controller::~Controller() {
}
void Controller::login(QString home, QString user, QString pass) {
if(home.isEmpty()) home = "matrix.org";
if(!isLogin) {
if(home.isEmpty()) home = "matrix.org";
qDebug() << "UserID:" << userID;
qDebug() << "Token:" << token;
qDebug() << "Home:" << home;
qDebug() << "User:" << user;
qDebug() << "Pass:" << pass;
qDebug() << "UserID:" << userID;
qDebug() << "Token:" << token;
qDebug() << "Home:" << home;
qDebug() << "User:" << user;
qDebug() << "Pass:" << pass;
if(!userID.isEmpty() && !token.isEmpty()) {
qDebug() << "Using token.";
m_connection->connectWithToken(userID, token, "");
} else if(!user.isEmpty() && !pass.isEmpty()) {
qDebug() << "Using given credential.";
m_connection->connectToServer("@"+user+":"+home, pass, "");
if(!userID.isEmpty() && !token.isEmpty()) {
qDebug() << "Using token.";
m_connection->connectWithToken(userID, token, "");
} else if(!user.isEmpty() && !pass.isEmpty()) {
qDebug() << "Using given credential.";
m_connection->connectToServer("@"+user+":"+home, pass, "");
}
} else {
qDebug() << "You are already logged in.";
}
}