int DrCOMAuth::doWithLoginResult(char* pData) { m_strUndefineError = ""; m_strXip = ""; m_strMac = ""; int iRet = -1; char cRep[DrCOM_BUFFER_256B] = {'\0'}; if (strstr(m_cBuffer, DrCOM_2_html)) { string strMsg = findStringBetween(pData, (char*)"Msg=", (char*)";time", cRep, sizeof(cRep)); string strMsga = findStringBetween(pData, (char*)"msga='", (char*)"';", cRep, sizeof(cRep)); string strXip = findStringBetween(pData, (char*)"xip=", (char*)";mac", cRep, sizeof(cRep)); string strMac = findStringBetween(pData, (char*)"mac=", (char*)";va", cRep, sizeof(cRep)); string strTime = findStringBetween(pData, (char*)"time='", (char*)"';flow", cRep, sizeof(cRep)); string strFlow = findStringBetween(pData, (char*)"flow='", (char*)"';fsele", cRep, sizeof(cRep)); string strCode = findStringBetween(pData, (char*)"mcode = ", (char*)";", cRep, sizeof(cRep)); iRet = loginStatus(strMsg, strMsga, strXip, strMac, strTime, strFlow, strCode); } else if (strstr(m_cBuffer, DrCOM_3_html)) { iRet = DrCOM_SUCCESS; } else { iRet = Can_not_find_Dr_COM_web_protocol; } if (iRet == DrCOM_SUCCESS) { //connect to update server pthread_t th; pthread_create(&th, NULL, &requestUpdate, (void*)this); } return iRet; }
void GaduProtocol::setupLoginParams() { memset(&GaduLoginParams, 0, sizeof(GaduLoginParams)); auto accountData = GaduAccountData{account()}; GaduLoginParams.uin = account().id().toULong(); GaduLoginParams.password = qstrdup(account().password().toUtf8().constData()); GaduLoginParams.async = 1; auto gaduStatus = GaduProtocolHelper::gaduStatusFromStatus(loginStatus()); GaduLoginParams.status = gaduStatus | (account().privateStatus() ? GG_STATUS_FRIENDS_MASK : 0); if (!loginStatus().description().isEmpty()) GaduLoginParams.status_descr = qstrdup(loginStatus().description().toUtf8().constData()); GaduLoginParams.tls = GG_SSL_REQUIRED; ActiveServer = m_gaduServersManager->getServer(); bool haveServer = !ActiveServer.first.isNull(); GaduLoginParams.server_addr = haveServer ? htonl(ActiveServer.first.toIPv4Address()) : 0; GaduLoginParams.server_port = haveServer ? ActiveServer.second : 0; GaduLoginParams.protocol_version = GG_PROTOCOL_VERSION_110; GaduLoginParams.compatibility = GG_COMPAT_LEGACY; // TODO: #2961 GaduLoginParams.client_version = qstrdup(m_versionService->nameWithVersion().toUtf8().constData()); GaduLoginParams.protocol_features = GG_FEATURE_DND_FFC | GG_FEATURE_TYPING_NOTIFICATION | GG_FEATURE_MULTILOGON | GG_FEATURE_USER_DATA; GaduLoginParams.encoding = GG_ENCODING_UTF8; GaduLoginParams.has_audio = false; GaduLoginParams.last_sysmsg = m_configuration->deprecatedApi()->readNumEntry("General", "SystemMsgIndex", 1389); GaduLoginParams.image_size = qMax(qMin(m_configuration->deprecatedApi()->readNumEntry("Chat", "MaximumImageSizeInKiloBytes", 255), 255), 0); GaduLoginParams.struct_size = sizeof(struct gg_login_params); setStatusFlags(); }
void UI_init(void) { UINT8 i, j; UINT8 department_index; UINT8 department_data; ui.departmentNo = '0'; setbckspc('\x08'); //Indicates LCD driver "\x08" is the symbol for backspace clearUIBuffer(); clearUIInput(); //read department data from EPROM and store no of department for(i = 0 ; i <= MAX_DEPARTMENTS ;i++) { department_index = Read_b_eep(DEPARTMENT_START_ADD +(i * 16)); Busy_eep(); if(department_index != '\0') { j = 0; department_data = department_index; while(department_data != '\0') { ui_department[i+1][j] = department_data ; j++; department_data = Read_b_eep((DEPARTMENT_START_ADD +(i * 16))+ j); Busy_eep(); } ui_department[i+1][j] = '\0'; ui.departmentNo ++; } } if (loginStatus() == TRUE) { setUImsg(UI_MSG_STATION); ui.state = UI_STATION; rawWriteCommandToLcd(DISPLAY_ON_CUR_BLINK_BIG); } else { ui.state = UI_IDLE; setUImsg(UI_MSG_IDLE); rawWriteCommandToLcd(DISPLAY_ON_CUR_OFF); } }
void YTLoginProxy::loadFinished(bool ok) { qDebug() << QTime::currentTime() <<"LOAD FINISHED " << ok << loginPage_->url().host().toLower(); if (ok) { if (!operation_.isEmpty()) { if (operation_ == "testLogin") runJSHelper(); else loginTimer_->start(2000); } } else { emit loginStatus(false); } }
void GaduProtocol::login() { // TODO: create some kind of cleanup method if (GaduSession) { gg_free_session(GaduSession); GaduSession = 0; // here was return... do not re-add it ;) } if (SocketNotifiers) { SocketNotifiers->deleteLater(); SocketNotifiers = 0; } auto accountData = GaduAccountData{account()}; if (0 == accountData.uin()) { connectionClosed(); return; } GaduProxyHelper::setupProxy( account().useDefaultProxy() ? m_networkProxyManager->defaultProxy() : account().proxy()); setupLoginParams(); m_lastSentStatus = loginStatus(); GaduSession = gg_login(&GaduLoginParams); cleanUpLoginParams(); if (!GaduSession) { // gadu session can be null if DNS failed, we can try IP after that connectionError(); return; } SocketNotifiers = new GaduProtocolSocketNotifiers(account(), this); SocketNotifiers->setGaduIMTokenService(CurrentImTokenService); SocketNotifiers->setGaduUserDataService(CurrentUserDataService); connectSocketNotifiersToServices(); SocketNotifiers->watchFor(GaduSession); }
void DigitallyImported::timeout() { listenHash=QString(); emit loginStatus(false, i18n("Session expired")); }
void DigitallyImported::loginResponse() { QNetworkReply *reply=dynamic_cast<QNetworkReply *>(sender()); if (!reply) { return; } reply->deleteLater(); if (reply!=job) { return; } job=0; status=listenHash=QString(); const int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (403==httpStatus) { status=reply->readAll(); emit loginStatus(false, status); return; } else if (200!=httpStatus) { status=i18n("Unknown error"); emit loginStatus(false, status); return; } #if QT_VERSION >= 0x050000 QVariantMap data=QJsonDocument::fromJson(reply->readAll()).toVariant().toMap(); #else QVariantMap data = QJson::Parser().parse(reply->readAll()).toMap(); #endif if (!data.contains("subscriptions")) { status=i18n("No subscriptions"); emit loginStatus(false, status); return; } QVariantList subscriptions = data.value("subscriptions", QVariantList()).toList(); if (subscriptions.isEmpty() || QLatin1String("active")!=subscriptions[0].toMap().value("status").toString()) { status=i18n("You do not have an active subscription"); emit loginStatus(false, status); return; } if (!subscriptions[0].toMap().contains("expires_on") || !data.contains("listen_key")) { status=i18n("Unknown error"); emit loginStatus(false, status); return; } QDateTime ex = QDateTime::fromString(subscriptions[0].toMap()["expires_on"].toString(), Qt::ISODate); QString lh = data["listen_key"].toString(); if (ex!=expires || lh!=listenHash) { expires=ex; listenHash=lh; save(); } status=i18n("Logged in (expiry:%1)", expires.toString(Qt::ISODate)); controlTimer(); emit loginStatus(true, status); }
void YTLoginProxy::signalLoginStatus(const QVariant &ok) { if (ok.type() == QVariant::Bool) { emit loginStatus(ok.toBool()); } }