void QFbMessenger::networkGetBasicInformationAnswer(bool error, QJsonValue data){ if(error){ emit loginResponse(true, __func__); this->setConnected(false); return; } emit loginResponse(false, __func__); this->setConnected(true); }
void Rcon::handleReceive(const boost::system::error_code& error, std::size_t bytes_received) { if (!error) { rcon_socket.recv_buffer[bytes_received] = '\0'; switch(rcon_socket.recv_buffer[7]) { case 0x00: loginResponse(); break; case 0x01: serverResponse(bytes_received); break; case 0x02: chatMessage(bytes_received); break; }; } else { logger->info("Rcon: UDP handleReceive Error: {0}", error.message()); timerKeepAlive(0); { std::lock_guard<std::mutex> lock(rcon_socket.mutex); rcon_socket.socket->close(); } if (auto_reconnect) { timerReconnect(5); } } }
void QFbMessenger::networkLoginAnswer(bool error, QString desc){ if(error){ emit loginResponse(true, __func__); this->setConnected(false); return; } this->network.getBasicInformation(); }
void QFbMessenger::networkInitAnswer(bool error, QString desc){ if(error){ emit loginResponse(true, __func__); this->setConnected(false); return; } this->network.login(this->email, this->pass); }
void QFbMessenger::login(){ QHash<QString, QString> configurationValues = this->storage->getConfigurationValues(); QList<QString> keys = configurationValues.keys(); for(QList<QString>::const_iterator it=keys.begin(); it!=keys.end(); it++) this->network.setConfigurationValue(*it, configurationValues[*it]); // TODO: test connection? this->setConnected(true); emit loginResponse(false, __func__); }
void DigitallyImported::login() { if (job) { job->deleteLater(); job=0; } QNetworkRequest req(constAuthUrl); addAuthHeader(req); job=NetworkAccessManager::self()->postFormData(req, "username="******"&password="+QUrl::toPercentEncoding(password)); connect(job, SIGNAL(finished()), SLOT(loginResponse())); }
void RemoteClient::doLogin() { setStatus(StatusLoggingIn); Command_Login cmdLogin; cmdLogin.set_user_name(userName.toStdString()); cmdLogin.set_password(password.toStdString()); PendingCommand *pend = prepareSessionCommand(cmdLogin); connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(loginResponse(Response))); sendCommand(pend); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); setWindowIcon(QIcon(":icon.ico")); MainWindow::appPath = qApp->applicationDirPath(); loadStyle(); // member initialization dockWidget = new DockWidget; calWidget = new BrowserWidget; crmWidget = new BrowserWidget; toolBar = new QToolBar(tr("Aktionen")); accountList = new AccountList(this); contactList = new ContactList(this); mainLayout = new QStackedLayout(); settings = SugarSettings::getInstance(); settingsDialog = new SettingsDialog; addDockWidget(Qt::BottomDockWidgetArea, dockWidget); dockWidget->hide(); accountList->hide(); calWidget->setAddress(QUrl(settings->calendarUrl)); crmWidget->setAddress(QUrl(settings->crmUrl)); mainLayout->addWidget(accountList); mainLayout->addWidget(contactList); //mainLayout->addWidget(projectList); mainLayout->addWidget(calWidget); mainLayout->addWidget(crmWidget); mainLayout->addWidget(settingsDialog); toolBar->setIconSize(QSize(14, 14)); toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolBar->setMovable(false); QAction *accountsAct = new QAction(QIcon(":accounts.png"), tr("Firmen"), this); QAction *contactsAct = new QAction(QIcon(":contacts.png"), tr("Kontakte"), this); QAction *projectsAct = new QAction(QIcon(":projects.png"), tr("Projekte"), this); openCalAct = new QAction(QIcon(":calendar.png"), tr("Kalender"), this); openCrmAct = new QAction(QIcon(":calendar.png"), tr("SugarCrm"), this); addAccountAct = new QAction(QIcon(":add-account.png"), tr("Neue Firma"), this); QAction *addContactAct = new QAction(QIcon(":add-contact.png"), tr("Neuer Kontakt"), this); QAction *addProjectAct = new QAction(QIcon(":add-project.png"), tr("Neues Projekt"), this); QAction *addTaskAct = new QAction(QIcon(":add-task.png"), tr("Neue Aufgabe"), this); pressViewAct = new QAction(QIcon(":news.png"), tr("Pressekontakte"), this); connect(addAccountAct, SIGNAL(triggered()), this, SLOT(addAccount())); connect(openCalAct, SIGNAL(triggered()), this, SLOT(displayCalendar())); connect(openCrmAct, SIGNAL(triggered()), this, SLOT(displayCrm())); //connect(pressViewAct, SIGNAL(triggered()), // this, SLOT(displayPressList())); connect(accountsAct, SIGNAL(triggered()), this, SLOT(displayAccounts())); connect(contactsAct, SIGNAL(triggered()), this, SLOT(displayContacts())); toolBar->addWidget(new QLabel(tr("Ansichten"))); toolBar->addAction(accountsAct); toolBar->addAction(contactsAct); toolBar->addAction(projectsAct); toolBar->addAction(openCalAct); toolBar->addAction(openCrmAct); toolBar->addWidget(new QLabel(tr("Aktionen"))); // TODO: fix this toolBar->addAction(addAccountAct); toolBar->addAction(addContactAct); toolBar->addAction(addProjectAct); toolBar->addAction(addTaskAct); //toolBar->addAction(pressViewAct); addToolBar(Qt::LeftToolBarArea, toolBar); toolBar->hide(); QPushButton *loginBtn = new QPushButton(QIcon(":login.png"), tr("Login"), this); connect(loginBtn, SIGNAL(pressed()), this, SLOT(login())); QGridLayout *l = new QGridLayout(this); QWidget *c = new QWidget(this); QWidget *w = new QWidget(this); l->addWidget(loginBtn, 1, 1, Qt::AlignCenter); c->setLayout(l); mainLayout->addWidget(c); mainLayout->setCurrentWidget(c); w->setLayout(mainLayout); setCentralWidget(w); // initialize dialogs loadingDialog = new LoadingDialog(this); loginDialog = new LoginDialog(this); loadingDialog->setVisible(false); loginDialog->setVisible(false); crm = SugarCrm::getInstance(); accountModel = AccountModel::getInstance(); contactModel = ContactModel::getInstance(); accountsFilterModel = new AccountProxyModel(this); contactsFilterModel = new ContactProxyModel(this); //filterModel = new AccountProxyModel(this); //filterModel->setSourceModel(accountModel); accountsFilterModel->setSourceModel(accountModel); contactsFilterModel->setSourceModel(contactModel); restoreGeometry(settings->windowGeometry); // QML display //centerView = new QmlView(this); //centerView->setUrl(QUrl("SugarCrm.qml")); //centerView->setAttribute(Qt::WA_OpaquePaintEvent); //centerView->setAttribute(Qt::WA_NoSystemBackground); //centerView->setFocus(); //contx = centerView->rootContext(); //contx->addDefaultObject(this); //contx->setContextProperty("qmlViewer", this); //contx->setContextProperty("accountModel", proxyModel); // connecting ui actions connect(ui->actionLogin, SIGNAL(triggered()), this, SLOT(login())); connect(ui->actionEinstellungen, SIGNAL(triggered()), this, SLOT(displaySettings())); connect(ui->actionLogout, SIGNAL(triggered()), qApp, SLOT(quit())); connect(ui->actionServer_Zeit, SIGNAL(triggered()), crm, SLOT(getServerTime())); connect(ui->actionSugarFlavor, SIGNAL(triggered()), crm, SLOT(getSugarFlavor())); connect(ui->actionReloadStyle, SIGNAL(triggered()), this, SLOT(loadStyle())); connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui->actionWebsite, SIGNAL(triggered()), this, SLOT(openProjectHomepage())); connect(ui->actionSpenden, SIGNAL(triggered()), this, SLOT(openDonationWebsite())); connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanup())); // DEBUG XML COMMUNICATION //connect(crm, SIGNAL(sendingMessage(QString)), // this, SLOT(debug(QString))); //connect(crm->trans, SIGNAL(newSoapMessage(QString)), // this, SLOT(debug(QString))); connect(crm, SIGNAL(unknownAction(QString)), this, SLOT(unknownAction(QString))); // login response connect(crm, SIGNAL(loginFailed()), this, SLOT(loginResponse())); connect(crm, SIGNAL(loginSuccessful()), this, SLOT(loginResponse())); // soap error handling // TODO: improve! connect(crm, SIGNAL(returnedFaultyMessage(QString)), loadingDialog, SLOT(hide())); connect(crm, SIGNAL(returnedFaultyMessage(QString)), this, SLOT(setStatusMsg(QString))); connect(accountModel, SIGNAL(dataReady()), this, SLOT(displayAccounts())); //TODO: change this when it works //setCentralWidget(centerView); //centerView->execute(); //rootComponent = centerView->root(); //QVariant *tmp = new QVariant(contx->property("authView")); //QmlComponent authComponent((QObject *) tmp); // centerView->engine(), QUrl("content/AuthView.qml")); //authView = authComponent.create(contx); //qDebug() << authView->dynamicPropertyN(); //connect(rootComponent, SIGNAL(loggingIn()), // this, SLOT(login())); //connect(rootComponent, SIGNAL(searching()), // this, SLOT(doSearch())); /*connect(accountModel, SIGNAL(dataReady()), this, SLOT(assignData())); connect(this, SIGNAL(listReady()), rootComponent, SLOT(displayAccounts()));*/ //connect(accountModel, SIGNAL(dataReady()), // rootComponent, SLOT(displayAccounts())); setStatusMsg(tr("Bereit"), 2500); }
void pthread_talk(int connectfd, struct sockaddr_in cli_addr) { char sendBuffer[bufsize]; char recvBuffer[bufsize]; char _cli_addr[bufsize]; strcpy(_cli_addr, inet_ntoa(cli_addr.sin_addr)); int _cli_port = ntohs(cli_addr.sin_port); int ret; while (1) { ret = recvPackage(&connectfd, recvBuffer, bufsize); if (ret != 0) { cJSON *function = cJSON_Parse(recvBuffer); int header = cJSON_GetObjectItem(function, "header")->valueint; if (header == 0) cJSON_AddStringToObject(function, "ipaddress", _cli_addr); printf("%d\n", header); switch (header) { case LOGIN_REQUEST: loginResponse(function, sendBuffer); break; case LOGOUT_REQUEST: logoutResponse(function, sendBuffer); break; case GETFRIEND_REQUEST: getfriendResponse(function, sendBuffer); break; case ADDFRIEND_REQUEST: addfriendResponse(function, sendBuffer); break; case GETIP_REQUEST: getipResponse(function, sendBuffer); break; case GETGROUP_REQUEST: getgroupResponse(function, sendBuffer); break; case ADDGROUP_REQUEST: addgroupResponse(function, sendBuffer); break; case SEARCH_REQUEST: searchResponse(function, sendBuffer); break; case SAVELOG_REQUEST: savelogResponse(function, sendBuffer); break; case UPDATE_REQUEST: updateResponse(function, sendBuffer); break; case IMALIVE_REQUEST: imaliveResponse(function, sendBuffer); break; default: defaultResponse(function, sendBuffer); break; } sendMessage(&connectfd, sendBuffer, strlen(sendBuffer) + 1); } } close(connectfd); }
/** login takes username, password tries to login with previous remembered user, thus, password can be empty will also try and utilize blob **/ void SpotifySession::login( const QString& username, const QString& password, const QByteArray& blob ) { if ( m_loggedIn && m_username == username && m_password == password ) { /// Always relogin when ever credentials change qDebug() << "Asked to log in with same username and pw that we are already logged in with, ignoring login"; /// Send response, and notifyAllreadyLoggedin, this will make config gui to stop "loading", and refetch all playlists emit loginResponse( true, "Logged in" ); emit notifyAllreadyLoggedin(); return; } if( m_username != username && m_loggedIn ) { // qDebug() << "We were previously logged in with a different user, so notify client of difference!"; emit userChanged(); } m_username = username; m_password = password; char reloginname[256]; sp_error error; int ok = sp_session_remembered_user( m_session, reloginname, sizeof(reloginname) ); if( ok != -1 && QString::fromUtf8( reloginname, strlen(reloginname) ) == m_username.toUtf8() ) { if ( sp_session_relogin(m_session) == SP_ERROR_NO_CREDENTIALS) { qDebug() << "No stored credentials tryin blob"; } else { qDebug() << "Logging in as remembered user"; return; } } else { // Forget last user if( ok == -1 ) qDebug() << " Relogin username was truncated or an error occured... Logging in with credentials"; else qDebug() << "Forgetting last user!" << QString::fromUtf8( reloginname, strlen( reloginname ) ) << m_username; sp_session_forget_me(m_session); } if( !m_username.isEmpty() && ( !m_password.isEmpty() || !blob.isEmpty() ) ) { /// @note: If current state is not logged out, logout this session /// and relogin in callback /// @note2: We can be logged out, but the session is still connected to accesspoint /// Wait for that to. if( sp_session_connectionstate(m_session) != SP_CONNECTION_STATE_LOGGED_OUT || m_loggedIn) { qDebug() << Q_FUNC_INFO << "SpotifySession asked to relog in! Logging out"; m_relogin = true; m_blob = blob; logout( true ); return; } qDebug() << Q_FUNC_INFO << "Logging in with username:"******" and is " << ( blob.isEmpty() ? "not" : "" ) << "using blob"; #if SPOTIFY_API_VERSION >= 12 error = sp_session_login(m_session, m_username.toUtf8(), m_password.toUtf8(), 1, blob.isEmpty() ? NULL : blob.constData() ); if( error != SP_ERROR_OK ) emit loginResponse( false, sp_error_message( error ) ); #elif SPOTIFY_API_VERSION >= 11 sp_session_login(m_session, m_username.toUtf8(), m_password.toUtf8(), 1, blob.isEmpty() ? NULL : blob.constData() ); #else sp_session_login(m_session, m_username.toUtf8(), m_password.toUtf8(), 1); #endif } else { qDebug() << "No username, password or blob provided!"; /// TODO: need a way to prompt for password if fail to login as remebered on startup /// If auth widget is not visual, we should promt user for re-entering creds emit loginResponse( false, "Failed to authenticate credentials." ); } }