void AccessConfig::assign(const AccessConfig& s) { setUsername (s.getUsername() ); setPassword (s.getPassword() ); setSyncURL (s.getSyncURL() ); setProxyHost(s.getProxyHost()); setProxyPort(s.getProxyPort()); setUserAgent(s.getUserAgent()); setProxyUsername(s.getProxyUsername()); setProxyPassword(s.getProxyPassword()); setBeginSync(s.getBeginSync()); setEndSync(s.getEndSync()); setFirstTimeSyncMode(s.getFirstTimeSyncMode()); setServerAuthRequired(s.getServerAuthRequired()); setClientAuthType(s.getClientAuthType()); setServerAuthType(s.getServerAuthType()); setServerPWD(s.getServerPWD()); setServerID(s.getServerID()); setServerNonce(s.getServerNonce()); setClientNonce(s.getClientNonce()); setMaxMsgSize(s.getMaxMsgSize()); setReadBufferSize(s.getReadBufferSize()); setCheckConn(s.getCheckConn()); setResponseTimeout(s.getResponseTimeout()); setCompression(s.getCompression()); dirty = s.getDirty(); }
ServerProperties::ServerProperties(SyncServer *syncServer, QWidget *parent): KDialog(parent), m_syncServer(syncServer) { QWidget *widget = new QWidget(this); ui.setupUi(widget); setMainWidget(widget); setSyncUrl(syncServer->syncUrl()); setUsername(syncServer->username()); setPassword(syncServer->password()); ui.cbRecurrance->setCurrentIndex(syncServer->autoSyncRecurrance()); ui.groupBox->setChecked(syncServer->autoSyncEnabled()); connect(ui.cbRecurrance, SIGNAL(currentIndexChanged(int)), SLOT(recurranceChanged())); connect(ui.groupBox, SIGNAL(clicked(bool)), SLOT(recurranceChanged())); connect(ui.leSyncUrl, SIGNAL(textChanged(QString)), SLOT(checkForComplete())); recurranceChanged(); checkForComplete(); for(int i = 0; i < 60; i++){ ui.cbHourlyMinute->addItem(QString::number(i)); } ui.cbHourlyMinute->setCurrentIndex(syncServer->autoSyncMinute()); ui.teDailyTime->setTime(syncServer->autoSyncTime()); ui.cbWeeklyDay->setCurrentIndex(qMin(syncServer->autoSyncDay() - 1, 6)); // Qt::DayOfWeek starts at 1 ui.teWeeklyTime->setTime(syncServer->autoSyncTime()); ui.cbMonthlyDay->setCurrentIndex(syncServer->autoSyncDay() - 1); // Days start at 1 ui.teMonthlyTime->setTime(syncServer->autoSyncTime()); }
// Parameter-Konstruktor CDatabase_Connection::CDatabase_Connection(string user, string password, string DB, string Host, int Port) { try { mysql_init(&my); LoadDefaults(); setUsername(user); setPassword(password); setDB(DB); setHost(Host); setPort(Port); this->connected = false; this->initialised = false; } catch(...) { cerr << "An unexpected error occured in function 'Default-Constructor'!" << endl; } }
void SIPAccount::setAccountDetails (std::map<std::string, std::string> details) { // Account setting common to SIP and IAX setAlias (details[CONFIG_ACCOUNT_ALIAS]); setType (details[CONFIG_ACCOUNT_TYPE]); setUsername (details[USERNAME]); setHostname (details[HOSTNAME]); setEnabled ( (details[CONFIG_ACCOUNT_ENABLE] == "true")); setRingtonePath (details[CONFIG_RINGTONE_PATH]); setRingtoneEnabled ( (details[CONFIG_RINGTONE_ENABLED] == "true")); setMailBox (details[CONFIG_ACCOUNT_MAILBOX]); // SIP specific account settings // general sip settings setDisplayName (details[DISPLAY_NAME]); setServiceRoute (details[ROUTESET]); setLocalInterface (details[LOCAL_INTERFACE]); setPublishedSameasLocal (details[PUBLISHED_SAMEAS_LOCAL] == "true"); setPublishedAddress (details[PUBLISHED_ADDRESS]); setLocalPort (atoi (details[LOCAL_PORT].c_str())); setPublishedPort (atoi (details[PUBLISHED_PORT].c_str())); setStunServer (details[STUN_SERVER]); setStunEnabled (details[STUN_ENABLE] == "true"); setDtmfType ( (details[ACCOUNT_DTMF_TYPE] == "overrtp") ? OVERRTP : SIPINFO); setResolveOnce (details[CONFIG_ACCOUNT_RESOLVE_ONCE] == "true"); setRegistrationExpire (details[CONFIG_ACCOUNT_REGISTRATION_EXPIRE]); setUseragent (details[USERAGENT]); // srtp settings setSrtpEnable (details[SRTP_ENABLE] == "true"); setSrtpFallback (details[SRTP_RTP_FALLBACK] == "true"); setZrtpDisplaySas (details[ZRTP_DISPLAY_SAS] == "true"); setZrtpDiaplaySasOnce (details[ZRTP_DISPLAY_SAS_ONCE] == "true"); setZrtpNotSuppWarning (details[ZRTP_NOT_SUPP_WARNING] == "true"); setZrtpHelloHash (details[ZRTP_HELLO_HASH] == "true"); setSrtpKeyExchange (details[SRTP_KEY_EXCHANGE]); // TLS settings // The TLS listener is unique and globally defined through IP2IP_PROFILE if (_accountID == IP2IP_PROFILE) setTlsListenerPort (atoi (details[TLS_LISTENER_PORT].c_str())); setTlsEnable (details[TLS_ENABLE]); setTlsCaListFile (details[TLS_CA_LIST_FILE]); setTlsCertificateFile (details[TLS_CERTIFICATE_FILE]); setTlsPrivateKeyFile (details[TLS_PRIVATE_KEY_FILE]); setTlsPassword (details[TLS_PASSWORD]); setTlsMethod (details[TLS_METHOD]); setTlsCiphers (details[TLS_CIPHERS]); setTlsServerName (details[TLS_SERVER_NAME]); setTlsVerifyServer (details[TLS_VERIFY_SERVER] == "true"); setTlsVerifyClient (details[TLS_VERIFY_CLIENT] == "true"); setTlsRequireClientCertificate (details[TLS_REQUIRE_CLIENT_CERTIFICATE] == "true"); setTlsNegotiationTimeoutSec (details[TLS_NEGOTIATION_TIMEOUT_SEC]); setTlsNegotiationTimeoutMsec (details[TLS_NEGOTIATION_TIMEOUT_MSEC]); }
void Authenticator::fromUserInfo(const std::string& userInfo) { std::string username; std::string password; extractCredentials(userInfo, username, password); setUsername(username); setPassword(password); }
void UsernameLineEdit::sParse() { if(!_parsed) { _parsed = true; setUsername(text()); } }
void Profile::loadData(QSettings* settings) { settings->beginGroup("Profile"); setUsername(settings->value("username").toString()); this->setUUID(settings->value("UUID").toUuid()); settings->endGroup(); }
void Authenticator::fromURI(const http::URL& uri) { std::string username; std::string password; extractCredentials(uri, username, password); setUsername(username); setPassword(password); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setApplicationName("QDL"); app.setApplicationVersion(VERSION_NUMBER); app.setWindowIcon(QIcon::fromTheme("qdl2")); app.setQuitOnLastWindowClosed(false); const QStringList args = app.arguments(); if (args.contains("--log")) { Logger::setVerbosity(10); } QScopedPointer<Categories> categories(Categories::instance()); QScopedPointer<ClipboardUrlModel> clipboard(ClipboardUrlModel::instance()); QScopedPointer<DecaptchaPluginManager> decaptchaManager(DecaptchaPluginManager::instance()); QScopedPointer<Qdl> qdl(Qdl::instance()); QScopedPointer<RecaptchaPluginManager> recaptchaManager(RecaptchaPluginManager::instance()); QScopedPointer<ServicePluginManager> serviceManager(ServicePluginManager::instance()); QScopedPointer<Settings> settings(Settings::instance()); QScopedPointer<TransferModel> transfers(TransferModel::instance()); QScopedPointer<UrlCheckModel> checker(UrlCheckModel::instance()); QScopedPointer<UrlRetrievalModel> retriever(UrlRetrievalModel::instance()); QScopedPointer<WebServer> server(WebServer::instance()); clipboard.data()->setEnabled(Settings::clipboardMonitorEnabled()); server.data()->setPort(Settings::webInterfacePort()); server.data()->setUsername(Settings::webInterfaceUsername()); server.data()->setPassword(Settings::webInterfacePassword()); server.data()->setAuthenticationEnabled(Settings::webInterfaceAuthenticationEnabled()); decaptchaManager.data()->load(); recaptchaManager.data()->load(); serviceManager.data()->load(); clipboard.data()->restore(); transfers.data()->restore(); if (Settings::webInterfaceEnabled()) { server.data()->start(); } if (!args.contains("--nogui")) { Qdl::showWindow(); } QObject::connect(settings.data(), SIGNAL(clipboardMonitorEnabledChanged(bool)), clipboard.data(), SLOT(setEnabled(bool))); QObject::connect(settings.data(), SIGNAL(webInterfaceAuthenticationEnabledChanged(bool)), server.data(), SLOT(setAuthenticationEnabled(bool))); QObject::connect(settings.data(), SIGNAL(webInterfaceUsernameChanged(QString)), server.data(), SLOT(setUsername(QString))); QObject::connect(settings.data(), SIGNAL(webInterfacePasswordChanged(QString)), server.data(), SLOT(setPassword(QString))); QObject::connect(settings.data(), SIGNAL(webInterfacePortChanged(int)), server.data(), SLOT(setPort(int))); QObject::connect(settings.data(), SIGNAL(webInterfaceEnabledChanged(bool)), server.data(), SLOT(setRunning(bool))); return app.exec(); }
void DailymotionComment::loadComment(const QVariantMap &comment) { setBody(comment.value("message").toString()); setDate(QDateTime::fromTime_t(comment.value("created_time").toLongLong()).toString("dd MMM yyyy")); setId(comment.value("id").toString()); setThumbnailUrl(comment.value("owner.avatar_60_url").toString()); setUserId(comment.value("owner.id").toString()); setUsername(comment.value("owner.screenname").toString()); setVideoId(comment.value("video.id").toString()); }
QXmppSaslServer::Response QXmppSaslServerDigestMd5::respond(const QByteArray &request, QByteArray &response) { if (m_step == 0) { QMap<QByteArray, QByteArray> output; output["nonce"] = m_nonce; if (!realm().isEmpty()) output["realm"] = realm().toUtf8(); output["qop"] = "auth"; output["charset"] = "utf-8"; output["algorithm"] = "md5-sess"; m_step++; response = QXmppSaslDigestMd5::serializeMessage(output); return Challenge; } else if (m_step == 1) { const QMap<QByteArray, QByteArray> input = QXmppSaslDigestMd5::parseMessage(request); const QByteArray realm = input.value("realm"); const QByteArray digestUri = input.value("digest-uri"); if (input.value("qop") != "auth") { warning("QXmppSaslServerDigestMd5 : Invalid quality of protection"); return Failed; } setUsername(QString::fromUtf8(input.value("username"))); if (password().isEmpty() && passwordDigest().isEmpty()) return InputNeeded; m_nc = input.value("nc"); m_cnonce = input.value("cnonce"); if (!password().isEmpty()) { m_secret = QCryptographicHash::hash( username().toUtf8() + ":" + realm + ":" + password().toUtf8(), QCryptographicHash::Md5); } else { m_secret = passwordDigest(); } if (input.value("response") != calculateDigest("AUTHENTICATE", digestUri, m_secret, m_nonce, m_cnonce, m_nc)) return Failed; QMap<QByteArray, QByteArray> output; output["rspauth"] = calculateDigest(QByteArray(), digestUri, m_secret, m_nonce, m_cnonce, m_nc); m_step++; response = QXmppSaslDigestMd5::serializeMessage(output); return Challenge; } else if (m_step == 2) { m_step++; response = QByteArray(); return Succeeded; } else { warning("QXmppSaslServerDigestMd5 : Invalid step"); return Failed; } }
void HTTPCredentials::fromURI(const URI& uri) { std::string username; std::string password; extractCredentials(uri, username, password); setUsername(username); setPassword(password); // TODO: Reset digest state? }
gloox::Client* RoboRoboFactory::CreateClient() { auto client = new gloox::Client("city.gov"); client->setUsername("robo"); client->setPassword("abcd"); client->setServer("centosxmpp.westeurope.cloudapp.azure.com"); client->disableRoster(); return client; }
void PluginPlaylist::loadPlaylist(const QString &service, const QVariantMap &playlist) { setService(service); setDate(playlist.value("date").toString()); setDescription(playlist.value("description").toString()); setId(playlist.value("id").toString()); setLargeThumbnailUrl(playlist.value("largeThumbnailUrl").toString()); setThumbnailUrl(playlist.value("thumbnailUrl").toString()); setTitle(playlist.value("title").toString()); setUserId(playlist.value("userId").toString()); setUsername(playlist.value("username").toString()); setVideoCount(playlist.value("videoCount").toInt()); }
JabberChangePassword::JabberChangePassword(const QString &jid, const QString &newPassword, JabberRegisterExtension *registerExtension, QObject *parent) : QObject{parent} { auto registerIq = QXmppRegisterIq{}; registerIq.setPassword(newPassword); registerIq.setType(QXmppIq::Type::Set); registerIq.setUsername(Jid::parse(jid).node()); m_id = registerIq.id(); registerExtension->sendRegisterIq(registerIq); connect(registerExtension, SIGNAL(registerIqReceived(QXmppRegisterIq)), this, SLOT(registerIqReceived(QXmppRegisterIq))); }
LoginDialog::LoginDialog(const int &_passwordField, QWidget *parent): QDialog(parent), checkGLayout(new QGridLayout(this)), username(new QLineEdit(this)), password(new QLineEdit(this)), login(new QPushButton("Login")), cancel(new QPushButton("Cancel")) { populateAll(_passwordField); setLayout(checkGLayout); QObject::connect(username, SIGNAL(textChanged(QString)), this, SLOT(setUsername(QString))); QObject::connect(password, SIGNAL(textChanged(QString)), this, SLOT(setPassword(QString))); QObject::connect(login, SIGNAL(clicked()), this, SLOT(accept())); QObject::connect(cancel, SIGNAL(clicked()), this, SLOT(close())); }
StandardFeed::StandardFeed(const QSqlRecord& record) : Feed(record) { setEncoding(record.value(FDS_DB_ENCODING_INDEX).toString()); setPasswordProtected(record.value(FDS_DB_PROTECTED_INDEX).toBool()); setUsername(record.value(FDS_DB_USERNAME_INDEX).toString()); if (record.value(FDS_DB_PASSWORD_INDEX).toString().isEmpty()) { setPassword(record.value(FDS_DB_PASSWORD_INDEX).toString()); } else { setPassword(TextFactory::decrypt(record.value(FDS_DB_PASSWORD_INDEX).toString())); } setAutoUpdateType(static_cast<Feed::AutoUpdateType>(record.value(FDS_DB_UPDATE_TYPE_INDEX).toInt())); setAutoUpdateInitialInterval(record.value(FDS_DB_UPDATE_INTERVAL_INDEX).toInt()); m_networkError = QNetworkReply::NoError; }
void PluginVideo::loadVideo(const QString &service, const QVariantMap &video) { setService(service); setDate(video.value("date").toString()); setDescription(video.value("description").toString()); setDownloadable(video.value("downloadable", true).toBool()); setDuration(video.value("duration").toString()); setId(video.value("id").toString()); setLargeThumbnailUrl(video.value("largeThumbnailUrl").toString()); setStreamUrl(video.value("streamUrl").toString()); setThumbnailUrl(video.value("thumbnailUrl").toString()); setTitle(video.value("title").toString()); setUrl(video.value("url").toString()); setUserId(video.value("userId").toString()); setUsername(video.value("username").toString()); setViewCount(video.value("viewCount").toLongLong()); }
void ShellRunner::createRunOptions(QWidget *parent) { //TODO: for multiple runners? //TODO: sync palette on theme changes ShellConfig *configWidget = new ShellConfig(config(), parent); QPalette pal = configWidget->palette(); Plasma::Theme *theme = new Plasma::Theme(this); pal.setColor(QPalette::Normal, QPalette::Window, theme->color(Plasma::Theme::BackgroundColor)); pal.setColor(QPalette::Normal, QPalette::WindowText, theme->color(Plasma::Theme::TextColor)); configWidget->setPalette(pal); connect(configWidget->m_ui.cbRunAsOther, SIGNAL(clicked(bool)), this, SLOT(setRunAsOtherUser(bool))); connect(configWidget->m_ui.cbRunInTerminal, SIGNAL(clicked(bool)), this, SLOT(setRunInTerminal(bool))); connect(configWidget->m_ui.leUsername, SIGNAL(textChanged(QString)), this, SLOT(setUsername(QString))); connect(configWidget->m_ui.lePassword, SIGNAL(textChanged(QString)), this, SLOT(setPassword(QString))); }
Profile::Profile(const QString &username) : _username(), _uuid(), _lastDomain(), _lastPosition(0.0, 0.0, 0.0), _lastOrientationSend(0) { if (!username.isEmpty()) { setUsername(username); // we've been given a new username, ask the data-server for profile DataServerClient::getValueForKeyAndUserString(DataServerKey::UUID, getUserString(), this); // send our current domain server to the data-server updateDomain(NodeList::getInstance()->getDomainHostname()); } }
void QtUMSendFile::init(const QString & contactId,const QString & userName,const QString & md5,const QString & contactIdUploadFile,const QString & senderName) { setContactId(contactId); setUsername(userName); setMd5(md5); setContactIdUploadFile(contactIdUploadFile); setSenderName(senderName); Config & config = ConfigManager::getInstance().getCurrentConfig(); QString address = QString::fromStdString(config.getSendFileUrl()); address = address+QString("?username=%1&userkey=%2&recipient=%3&uid=%4").arg(_userName).arg(_md5).arg(_contactIdUploadFile).arg(_uuid); _ui->webView->setUrl(QUrl(address)); }
int SafetConfiguration::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = SafetXmlObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; #ifndef QT_NO_PROPERTIES if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = id(); break; case 1: *reinterpret_cast< QString*>(_v) = connectstring(); break; case 2: *reinterpret_cast< QString*>(_v) = hostname(); break; case 3: *reinterpret_cast< QString*>(_v) = databasename(); break; case 4: *reinterpret_cast< QString*>(_v) = username(); break; case 5: *reinterpret_cast< QString*>(_v) = driver(); break; } _id -= 6; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setId(*reinterpret_cast< QString*>(_v)); break; case 1: setConnectstring(*reinterpret_cast< QString*>(_v)); break; case 2: setHostname(*reinterpret_cast< QString*>(_v)); break; case 3: setDatabasename(*reinterpret_cast< QString*>(_v)); break; case 4: setUsername(*reinterpret_cast< QString*>(_v)); break; case 5: setDriver(*reinterpret_cast< QString*>(_v)); break; } _id -= 6; } else if (_c == QMetaObject::ResetProperty) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 6; } #endif // QT_NO_PROPERTIES return _id; }
void User::fromJson(nlohmann::json& val) { if(val.find("id") != val.end()) { setId(val.at("id")); } if(val.find("username") != val.end()) { setUsername(val.at("username")); } if(val.find("firstName") != val.end()) { setFirstName(val.at("firstName")); } if(val.find("lastName") != val.end()) { setLastName(val.at("lastName")); } if(val.find("email") != val.end()) { setEmail(val.at("email")); } if(val.find("password") != val.end()) { setPassword(val.at("password")); } if(val.find("phone") != val.end()) { setPhone(val.at("phone")); } if(val.find("userStatus") != val.end()) { setUserStatus(val.at("userStatus")); } }
void QtUMFax::init(const QString & faxNumber,const QString & userName,const QString & md5,const QString & contactId,const QString & senderName) { setPhoneNumber(faxNumber); setContactId(contactId); setUsername(userName); setRecipient(senderName); setUserKey(md5); Config & config = ConfigManager::getInstance().getCurrentConfig(); QString address = QString::fromStdString(config.getSendFaxUrl()); if(_contactId!=_phoneNumber){ address = address+QString("?username=%1&userkey=%2&recipient=%3&phonenumber=%4").arg(_userName).arg(_userKey).arg(_recepient).arg(_phoneNumber); }else{ address = address+QString("?username=%1&userkey=%2&phonenumber=%3").arg(_userName).arg(_userKey).arg(_phoneNumber); } _ui->webView->setUrl(QUrl(address)); }
QXmppSaslServer::Response QXmppSaslServerPlain::respond(const QByteArray &request, QByteArray &response) { if (m_step == 0) { if (request.isEmpty()) { response = QByteArray(); return Challenge; } QList<QByteArray> auth = request.split('\0'); if (auth.size() != 3) { warning("QXmppSaslServerPlain : Invalid input"); return Failed; } setUsername(QString::fromUtf8(auth[1])); setPassword(QString::fromUtf8(auth[2])); m_step++; response = QByteArray(); return InputNeeded; } else { warning("QXmppSaslServerPlain : Invalid step"); return Failed; } }
Smb4KPasswordDialog::Smb4KPasswordDialog(Smb4KBasicNetworkItem* networkItem, const QMap<QString,QString> &knownLogins, QWidget* parent) : KPasswordDialog(parent, KPasswordDialog::ShowUsernameLine) { m_item = networkItem; switch (m_item->type()) { case Host: { Smb4KHost *host = static_cast<Smb4KHost *>(m_item); if (host) { setUsername(host->login()); setPassword(host->password()); setPrompt(i18n("<qt>Please enter a username and a password for the host <b>%1</b>.</qt>", host->hostName())); } else { // Do nothing } break; } case Share: { Smb4KShare *share = static_cast<Smb4KShare *>(m_item); if (share) { // Enter authentication information into the dialog if (!knownLogins.isEmpty()) { setKnownLogins(knownLogins); } else { setUsername(share->login()); setPassword(share->password()); } if (!share->isHomesShare()) { setPrompt(i18n("<qt>Please enter a username and a password for the share <b>%1</b>.</qt>", share->unc())); } else { setPrompt(i18n("<qt>Please enter a username and a password for the share <b>%1</b>.</qt>", share->homeUNC())); } } else { // Do nothing } break; } default: { break; } } connect(this, SIGNAL(gotUsernameAndPassword(QString,QString,bool)), SLOT(slotGotUsernameAndPassword(QString,QString,bool))); }
int AppSettings::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 13) qt_static_metacall(this, _c, _id, _a); _id -= 13; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = token(); break; case 1: *reinterpret_cast< QUrl*>(_v) = address(); break; case 2: *reinterpret_cast< QString*>(_v) = email(); break; case 3: *reinterpret_cast< QString*>(_v) = username(); break; case 4: *reinterpret_cast< QString*>(_v) = password(); break; case 5: *reinterpret_cast< QString*>(_v) = userid(); break; } _id -= 6; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setToken(*reinterpret_cast< QString*>(_v)); break; case 1: setAddress(*reinterpret_cast< QUrl*>(_v)); break; case 2: setEmail(*reinterpret_cast< QString*>(_v)); break; case 3: setUsername(*reinterpret_cast< QString*>(_v)); break; case 4: setPassword(*reinterpret_cast< QString*>(_v)); break; case 5: setUserid(*reinterpret_cast< QString*>(_v)); break; } _id -= 6; } else if (_c == QMetaObject::ResetProperty) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 6; } #endif // QT_NO_PROPERTIES return _id; }
/** * @brief Initializes the core, must be called before anything else */ void Core::start() { bool isNewProfile = profile.isNewProfile(); if (isNewProfile) { qDebug() << "Creating a new profile"; makeTox(QByteArray()); setStatusMessage(tr("Toxing on qTox")); setUsername(profile.getName()); } else { qDebug() << "Loading user profile"; QByteArray savedata = profile.loadToxSave(); if (savedata.isEmpty()) { emit failedToStart(); return; } makeTox(savedata); } qsrand(time(nullptr)); if (!tox) { ready = true; GUI::setEnabled(true); return; } // set GUI with user and statusmsg QString name = getUsername(); if (!name.isEmpty()) emit usernameSet(name); QString msg = getStatusMessage(); if (!msg.isEmpty()) emit statusMessageSet(msg); QString id = getSelfId().toString(); if (!id.isEmpty()) emit idSet(id); // TODO: This is a backwards compatibility check, // once most people have been upgraded away from the old HistoryKeeper, remove this if (Nexus::getProfile()->isEncrypted()) checkEncryptedHistory(); loadFriends(); tox_callback_friend_request(tox, onFriendRequest, this); tox_callback_friend_message(tox, onFriendMessage, this); tox_callback_friend_name(tox, onFriendNameChange, this); tox_callback_friend_typing(tox, onFriendTypingChange, this); tox_callback_friend_status_message(tox, onStatusMessageChanged, this); tox_callback_friend_status(tox, onUserStatusChanged, this); tox_callback_friend_connection_status(tox, onConnectionStatusChanged, this); tox_callback_friend_read_receipt(tox, onReadReceiptCallback, this); tox_callback_group_invite(tox, onGroupInvite, this); tox_callback_group_message(tox, onGroupMessage, this); tox_callback_group_namelist_change(tox, onGroupNamelistChange, this); tox_callback_group_title(tox, onGroupTitleChange, this); tox_callback_group_action(tox, onGroupAction, this); tox_callback_file_chunk_request(tox, CoreFile::onFileDataCallback, this); tox_callback_file_recv(tox, CoreFile::onFileReceiveCallback, this); tox_callback_file_recv_chunk(tox, CoreFile::onFileRecvChunkCallback, this); tox_callback_file_recv_control(tox, CoreFile::onFileControlCallback, this); QPixmap pic = profile.loadAvatar(); if (!pic.isNull() && !pic.size().isEmpty()) { QByteArray data; QBuffer buffer(&data); buffer.open(QIODevice::WriteOnly); pic.save(&buffer, "PNG"); buffer.close(); setAvatar(data); } else { qDebug() << "Self avatar not found, will broadcast empty avatar to friends"; setAvatar({}); } ready = true; // If we created a new profile earlier, // now that we're ready save it and ONLY THEN broadcast the new ID. // This is useful for e.g. the profileForm that searches for saves. if (isNewProfile) { profile.saveToxSave(); emit idSet(getSelfId().toString()); } if (isReady()) GUI::setEnabled(true); process(); // starts its own timer av->start(); }
//END APIQA int main(int argc, char **argv) { struct timeval time_interval; RsslError error; fd_set useRead; fd_set useExcept; fd_set useWrt; int selRet; char errTxt[256]; RsslBuffer errorText = {255, (char*)errTxt}; RsslRet retval = 0; RsslInProgInfo inProg = RSSL_INIT_IN_PROG_INFO; int i; RsslInitializeExOpts initOpts = RSSL_INIT_INITIALIZE_EX_OPTS; time_t currentTime; #ifdef _WIN32 int rcvBfrSize = 65535; int sendBfrSize = 65535; #endif snprintf(srvrHostname, 128, "%s", defaultSrvrHostname); snprintf(srvrPortNo, 128, "%s", defaultSrvrPortNo); snprintf(serviceName, 128, "%s", defaultServiceName); snprintf(interfaceName, 128, "%s", defaultInterface); setUsername((char *)""); setAuthenticationToken((char *)""); setAuthenticationExtended((char *)""); setApplicationId((char *)""); snprintf(proxyHostname, 128, "%s", defaultProxyHost); snprintf(proxyPort, 128, "%s", defaultProxyPort); /* Check usage and retrieve operating parameters */ if (argc == 1) /* use default operating parameters */ { snprintf(itemName, 128, "%s", defaultItemName); /* add item name in market price handler */ addMarketPriceItemName(itemName, RSSL_FALSE); mpItemReq = RSSL_TRUE; printf("\nUsing default operating parameters...\n\n"); printf("srvrHostname: %s\n", srvrHostname); printf("srvrPortNo: %s\n", srvrPortNo); printf("serviceName: %s\n", serviceName); printf("itemName: %s\n", itemName); printf("connType: %d\n", connType); } else if (argc > 1) /* all operating parameters entered by user */ { i = 1; while(i < argc) { if(strcmp("-libsslName", argv[i]) == 0) { i += 2; snprintf(libsslName, 128, "%s", argv[i-1]); initOpts.jitOpts.libsslName = libsslName; } //APIQA else if (strcmp("-reissueDir", argv[i]) == 0) { printf("Found -reissueDir "); _initialDirFilter = atoi(argv[++i]); printf("%d ", _initialDirFilter); _reissueDirFilter = atoi(argv[++i]); printf("%d\n", _reissueDirFilter); setDirectoryFilter(_initialDirFilter, _reissueDirFilter); break; } else if (strcmp("-reissueDict", argv[i]) == 0) { printf("Found -reissueDict "); _initialDictFilter = atoi(argv[++i]); printf("%d ", _initialDictFilter); _reissueDictFilter = atoi(argv[++i]); printf("%d\n", _reissueDictFilter); setDictionaryFilter(_initialDictFilter, _reissueDictFilter); break; } else if (strcmp("-xmlTrace", argv[i]) == 0) { xmlTrace = RSSL_TRUE; ++i; } else if (strcmp("-loadDictFromFile", argv[i]) == 0) { _loadDictFromFile = RSSL_TRUE; ++i; } else if (strcmp("-reissueQos", argv[i]) == 0) { _reissueQos = RSSL_TRUE; _qosRate = atoi(argv[++i]); _qosTimeliness = atoi(argv[++i]); printf("\nReissueQoS for rate = %d and timeline = %d\n", _qosRate, _qosTimeliness); setReissueQos(_qosRate, _qosTimeliness); break; } else if (strcmp("-reissueQosAndWorstQos", argv[i]) == 0) { _reissueQosAndWorstQos = RSSL_TRUE; _qosRate = atoi(argv[++i]); _qosTimeliness = atoi(argv[++i]); _worstQosRate = atoi(argv[++i]); _worstQosTimeliness = atoi(argv[++i]); printf("\nReissueQoS for rate = %d and timeline = %d\n", _qosRate, _qosTimeliness); printf("ReissueWorstQos QoS for worstRate = %d and worstTimeliness = %d\n", _worstQosRate, _worstQosTimeliness); setReissueQosAndWorstQos(_qosRate, _qosTimeliness, _worstQosRate, _worstQosTimeliness); break; } else if (strcmp("-sendGenericMsgOnLogin", argv[i]) == 0) { _sendGenMsgOnLogin = RSSL_TRUE; break; } else if (strcmp("-sendGenericMsgOnDirectory", argv[i]) == 0) { _sendGenMsgOnDirectory = RSSL_TRUE; break; } else if (strcmp("-requestDict", argv[i]) == 0) { _initialDictFilter = atoi(argv[++i]); break; } else if (strcmp("-requestDir", argv[i]) == 0) { _initialDirFilter = atoi(argv[++i]); break; } else if (strcmp("-reissueServiceId", argv[i]) == 0) { _changeServiceId = atoi(argv[++i]); printf("\nReissueServiceId to service ID = %d\n", _changeServiceId); setReissueChangeServiceName(_changeServiceId); break; } else if (strcmp("-privateStreamForItemReq", argv[i]) == 0) { setPriviateStream(); ++i; } else if (strcmp("-requestSameKeyWithDiffStreamId", argv[i]) == 0) { setReqSameKeyWithDiffStreamId(); snprintf(itemName, 128, "%s", defaultItemName); addMarketPriceItemName(itemName, RSSL_FALSE); break; } else if (strcmp("-specificServiceId", argv[i]) == 0) { setSpecificServiceId(atoi(argv[++i])); ++i; } else if (strcmp("-sendDirReqWithoutLogin", argv[i]) == 0) { _sendDirReqWithoutLogin = RSSL_TRUE; ++i; } else if (strcmp("-sendDictReqWithoutLogin", argv[i]) == 0) { _sendDictReqWithoutLogin = RSSL_TRUE; ++i; } else if (strcmp("-sendItemReqWithoutLogin", argv[i]) == 0) { _sendItemReqWithoutLogin = RSSL_TRUE; ++i; } //END APIQA else if(strcmp("-libcryptoName", argv[i]) == 0) { i += 2; snprintf(libcryptoName, 128, "%s", argv[i-1]); initOpts.jitOpts.libcryptoName = libcryptoName; } else if(strcmp("-uname", argv[i]) == 0) { i += 2; setUsername(argv[i-1]); } else if(strcmp("-at", argv[i]) == 0) { i += 2; setAuthenticationToken(argv[i-1]); } else if(strcmp("-ax", argv[i]) == 0) { i += 2; setAuthenticationExtended(argv[i-1]); } else if(strcmp("-aid", argv[i]) == 0) { i += 2; setApplicationId(argv[i-1]); } else if(strcmp("-h", argv[i]) == 0) { i += 2; snprintf(srvrHostname, 128, "%s", argv[i-1]); } else if(strcmp("-p", argv[i]) == 0) { i += 2; snprintf(srvrPortNo, 128, "%s", argv[i-1]); } else if(strcmp("-ph", argv[i]) == 0) { i += 2; snprintf(proxyHostname, 128, "%s", argv[i-1]); } else if(strcmp("-pp", argv[i]) == 0) { i += 2; snprintf(proxyPort, 128, "%s", argv[i-1]); } else if(strcmp("-s", argv[i]) == 0) { i += 2; snprintf(serviceName, 128, "%s", argv[i-1]); } else if (strcmp("-c", argv[i]) == 0) { i += 1; if (0 == strcmp(argv[i], "socket") || 0 == strcmp(argv[i], "0")) connType = RSSL_CONN_TYPE_SOCKET; else if (0 == strcmp(argv[i], "http") || 0 == strcmp(argv[i], "2")) connType = RSSL_CONN_TYPE_HTTP; else if (0 == strcmp(argv[i], "encrypted") || 0 == strcmp(argv[i], "1")) connType = RSSL_CONN_TYPE_ENCRYPTED; else if (0 == strcmp(argv[i], "reliableMCast") || 0 == strcmp(argv[i], "4")) connType = RSSL_CONN_TYPE_RELIABLE_MCAST; else { connType = (RsslConnectionTypes)atoi(argv[i]); } i += 1; } else if (strcmp("-yc", argv[i]) == 0) { i += 2; /* add item name in yield curve handler */ addYieldCurveItemName(argv[i-1], RSSL_FALSE); ycItemReq = RSSL_TRUE; } else if(strcmp("-mp", argv[i]) == 0) { i += 2; /* add item name in market price handler */ addMarketPriceItemName(argv[i-1], RSSL_FALSE); mpItemReq = RSSL_TRUE; } else if(strcmp("-mbo", argv[i]) == 0) { i += 2; /* add item name in market by order handler */ addMarketByOrderItemName(argv[i-1], RSSL_FALSE); mboItemReq = RSSL_TRUE; } else if(strcmp("-mbp", argv[i]) == 0) { i += 2; /* add item name in market by price handler */ addMarketByPriceItemName(argv[i-1], RSSL_FALSE); mbpItemReq = RSSL_TRUE; } else if(strcmp("-sl", argv[i]) == 0) { i++; slReq = RSSL_TRUE; /* check the rest of the command line arguments */ if(i != argc) { /* check to see if next strings is the symbol list name */ if(!(strncmp("-", argv[i], 1))) { /* user didn't specifiy name */ setSymbolListInfo(RSSL_FALSE, slReq); } else { i++; setSymbolListName(argv[i-1]); setSymbolListInfo(RSSL_TRUE, slReq); } } else { /* no more command line arguments, so user didn't specifiy SL name */ setSymbolListInfo(RSSL_FALSE, slReq); } } else if(strcmp("-view", argv[i]) == 0) { i++; setViewRequest(); } else if (strcmp("-post", argv[i]) == 0) { i++; onPostEnabled = RSSL_TRUE; enableOnstreamPost(); } else if (strcmp("-x", argv[i]) == 0) { i++; xmlTrace = RSSL_TRUE; snprintf(traceOutputFile, 128, "RsslConsumer\0"); } else if (strcmp("-td", argv[i]) == 0) { i++; showTransportDetails = RSSL_TRUE; } else if (strcmp("-offpost", argv[i]) == 0) { i++; offPostEnabled = RSSL_TRUE; } else if(strcmp("-snapshot", argv[i]) == 0) { i++; setMPSnapshotRequest(); setMBOSnapshotRequest(); setMBPSnapshotRequest(); setSLSnapshotRequest(); setYCSnapshotRequest(); } else if(strcmp("-mpps", argv[i]) == 0) { i += 2; /* add item name in market price handler */ addMarketPriceItemName(argv[i-1], RSSL_TRUE); mpItemReq = RSSL_TRUE; } else if(strcmp("-mbops", argv[i]) == 0) { i += 2; /* add item name in market by order handler */ addMarketByOrderItemName(argv[i-1], RSSL_TRUE); mboItemReq = RSSL_TRUE; } else if(strcmp("-mbpps", argv[i]) == 0) { i += 2; /* add item name in market by price handler */ addMarketByPriceItemName(argv[i-1], RSSL_TRUE); mbpItemReq = RSSL_TRUE; } else if (strcmp("-ycps", argv[i]) == 0) { i += 2; /* add item name in yield curve handler */ addYieldCurveItemName(argv[i-1], RSSL_TRUE); ycItemReq = RSSL_TRUE; } else if(strcmp("-runtime", argv[i]) == 0) { i += 2; timeToRun = atoi(argv[i-1]); } else { printf("Error: Unrecognized option: %s\n\n", argv[i]); printf("Usage: %s or\n%s [-uname <LoginUsername>] [-h <SrvrHostname>] [-p <SrvrPortNo>] [-c <ConnType>] [-s <ServiceName>] [-view] [-post] [-offpost] [-snapshot] [-sl [<SymbolList Name>]] [-mp|-mpps <MarketPrice ItemName>] [-mbo|-mbops <MarketByOrder ItemName>] [-mbp|-mbpps <MarketByPrice ItemName>] [-runtime <seconds>] [-td]\n", argv[0], argv[0]); printf("\n -mp or -mpps For each occurance, requests item using Market Price domain. (-mpps for private stream)\n"); printf("\n -mbo or -mbops For each occurance, requests item using Market By Order domain. (-mbops for private stream)\n"); printf("\n -mbp or -mbpps For each occurance, requests item using Market By Price domain. (-mbpps for private stream)\n"); printf("\n -yc or -ycps For each occurance, requests item using Yield Curve domain. (-ycps for private stream)\n"); printf("\n -view specifies each request using a basic dynamic view.\n"); printf("\n -post specifies that the application should attempt to send post messages on the first requested Market Price item (i.e., on-stream)\n"); printf("\n -offpost specifies that the application should attempt to send post messages on the login stream (i.e., off-stream)\n"); printf("\n -snapshot specifies each request using non-streaming.\n"); printf("\n -sl requests symbol list using Symbol List domain. (symbol list name optional)\n"); printf("\n -td prints out additional transport details from rsslReadEx() and rsslWriteEx() function calls \n"); printf("\n -x provides an XML trace of messages.\n"); printf("\n -at Specifies the Authentication Token. If this is present, the login user name type will be RDM_LOGIN_USER_AUTHN_TOKEN.\n"); printf("\n -ax Specifies the Authentication Extended information.\n"); printf("\n -aid Specifies the Application ID.\n"); printf("\n -runtime adjusts the time the application runs.\n"); //APIQA printf("-sendGenericMsgOnLogin\n"); printf("-sendGenericMsgOnDirectory\n"); printf("-requestDict <verbosity>\n"); printf("-requestDir <filters>\n"); printf("-reissueServiceId <service ID>\n"); printf("-reissueDir <initial filter> <reissue filter>\n"); printf("-reissueDict <initial filter> <reissue filter>\n"); printf("-reissueQos <rate> <timeliness>\n"); printf("-reissueQosAndWorstQos <rate> <timeliness> <worstRate> <worstTimeliness>\n"); printf("\nRate value definition\n\t- rate == 0 then RSSL_QOS_RATE_TICK_BY_TICK\n\t- rate == -1 then RSSL_QOS_RATE_JIT_CONFLATED\n\t- if 0 < rate <= 65535, RSSL_QOS_RATE_TIME_CONFLATED using the rate for rateInfo\n"); printf("\nTimeliness value definition\n\t- timeliness == 0 then RSSL_QOS_TIME_REALTIME\n\t- timeliness == -1 then RSSL_QOS_TIME_DELAYED_UNKNOWN\n\t- if 0 < timeliness <= 65535, RSSL_QOS_TIME_DELAYED using the timelines for timeInfo"); //END APIQA #ifdef _WIN32 /* WINDOWS: wait for user to enter something before exiting */ printf("\nPress Enter or Return key to exit application:"); getchar(); #endif exit(RSSL_RET_FAILURE); } } //APIQA setDirectoryFilter(_initialDirFilter, _reissueDirFilter); setDictionaryFilter(_initialDictFilter, _reissueDictFilter); //END APIQA printf("Proxy host: %s\n", proxyHostname); printf("Proxy port: %s\n", proxyPort); printf("\nInput arguments...\n\n"); printf("Using Connection Type = %d\n", connType); printf("srvrHostname: %s\n", srvrHostname); printf("srvrPortNo: %s\n", srvrPortNo); printf("serviceName: %s\n", serviceName); /* if no items were requested but a command line was specified, use the default item */ if (!mpItemReq && !mboItemReq && !mbpItemReq && !slReq && !ycItemReq) { snprintf(itemName, 128, "%s", defaultItemName); /* add item name in market price handler */ addMarketPriceItemName(itemName, RSSL_FALSE); mpItemReq = RSSL_TRUE; } /* this application requires at least one market price item to be requested for on-stream posting to be performed */ if (onPostEnabled && !mpItemReq) { printf("\nPosting will not be performed as no Market Price items were requested\n"); onPostEnabled = RSSL_FALSE; } } /* set service name in directory handler */ setServiceName(serviceName); /* load dictionary */ //APIQA //loadDictionary(); if (_loadDictFromFile) { loadDictionary(); } //APIQA /* Initialize RSSL */ /* RSSL_LOCK_NONE is used since this is a single threaded application. */ if (rsslInitializeEx(&initOpts, &error) != RSSL_RET_SUCCESS) { printf("rsslInitialize(): failed <%s>\n", error.text); /* WINDOWS: wait for user to enter something before exiting */ #ifdef _WIN32 printf("\nPress Enter or Return key to exit application:"); getchar(); #endif exit(RSSL_RET_FAILURE); } FD_ZERO(&readfds); FD_ZERO(&exceptfds); FD_ZERO(&wrtfds); /* Initialize run-time */ initRuntime(); /* this is the main loop */ while(1) { /* this is the connection recovery loop */ while(shouldRecoverConnection) { /* Connect to RSSL server */ printf("\nAttempting to connect to server %s:%s...\n", srvrHostname, srvrPortNo); if ((rsslConsumerChannel = connectToRsslServer(connType, &error)) == NULL) { printf("Unable to connect to RSSL server: <%s>\n",error.text); } else { FD_SET(rsslConsumerChannel->socketId, &readfds); FD_SET(rsslConsumerChannel->socketId, &wrtfds); FD_SET(rsslConsumerChannel->socketId, &exceptfds); } if (rsslConsumerChannel != NULL && rsslConsumerChannel->state == RSSL_CH_STATE_ACTIVE) shouldRecoverConnection = RSSL_FALSE; /* Wait for channel to become active. This finalizes the three-way handshake. */ while (rsslConsumerChannel != NULL && rsslConsumerChannel->state != RSSL_CH_STATE_ACTIVE) { useRead = readfds; useWrt = wrtfds; useExcept = exceptfds; /* Set a timeout value if the provider accepts the connection, but does not initialize it */ time_interval.tv_sec = 60; time_interval.tv_usec = 0; selRet = select(FD_SETSIZE, &useRead, &useWrt, &useExcept, &time_interval); /* select has timed out, close the channel and attempt to reconnect */ if(selRet == 0) { printf("\nChannel initialization has timed out, attempting to reconnect...\n"); FD_CLR(rsslConsumerChannel->socketId, &readfds); FD_CLR(rsslConsumerChannel->socketId, &exceptfds); if (FD_ISSET(rsslConsumerChannel->socketId, &wrtfds)) FD_CLR(rsslConsumerChannel->socketId, &wrtfds); recoverConnection(); } else /* Received a response from the provider. */ if(selRet > 0 && (FD_ISSET(rsslConsumerChannel->socketId, &useRead) || FD_ISSET(rsslConsumerChannel->socketId, &useWrt) || FD_ISSET(rsslConsumerChannel->socketId, &useExcept))) { if (rsslConsumerChannel->state == RSSL_CH_STATE_INITIALIZING) { FD_CLR(rsslConsumerChannel->socketId,&wrtfds); if ((retval = rsslInitChannel(rsslConsumerChannel, &inProg, &error)) < RSSL_RET_SUCCESS) { printf("\nchannelInactive fd="SOCKET_PRINT_TYPE" <%s>\n", rsslConsumerChannel->socketId,error.text); recoverConnection(); break; } else { switch (retval) { case RSSL_RET_CHAN_INIT_IN_PROGRESS: if (inProg.flags & RSSL_IP_FD_CHANGE) { printf("\nChannel In Progress - New FD: "SOCKET_PRINT_TYPE" Old FD: "SOCKET_PRINT_TYPE"\n",rsslConsumerChannel->socketId, inProg.oldSocket ); FD_CLR(inProg.oldSocket,&readfds); FD_CLR(inProg.oldSocket,&exceptfds); FD_SET(rsslConsumerChannel->socketId,&readfds); FD_SET(rsslConsumerChannel->socketId,&exceptfds); FD_SET(rsslConsumerChannel->socketId,&wrtfds); } else { printf("\nChannel "SOCKET_PRINT_TYPE" In Progress...\n", rsslConsumerChannel->socketId); //Sleep(1000); } break; case RSSL_RET_SUCCESS: { RsslChannelInfo chanInfo; printf("\nChannel "SOCKET_PRINT_TYPE" Is Active\n" ,rsslConsumerChannel->socketId); /* reset should recover connection flag */ shouldRecoverConnection = RSSL_FALSE; /* if device we connect to supports connected component versioning, * also display the product version of what this connection is to */ if ((retval = rsslGetChannelInfo(rsslConsumerChannel, &chanInfo, &error)) >= RSSL_RET_SUCCESS) { RsslUInt32 i; for (i = 0; i < chanInfo.componentInfoCount; i++) { printf("Connected to %s device.\n", chanInfo.componentInfo[i]->componentVersion.data); } } } break; default: printf("\nBad return value fd="SOCKET_PRINT_TYPE" <%s>\n", rsslConsumerChannel->socketId,error.text); cleanUpAndExit(); break; } } } } else if(selRet < 0) { printf("\nSelect error.\n"); cleanUpAndExit(); } handleRuntime(); } /* sleep before trying again */ if (shouldRecoverConnection) { for(i = 0; i < CONSUMER_CONNECTION_RETRY_TIME; ++i) { #ifdef _WIN32 Sleep(1000); #else sleep(1); #endif handleRuntime(); } } } /* WINDOWS: change size of send/receive buffer since it's small by default */ #ifdef _WIN32 if (rsslIoctl(rsslConsumerChannel, RSSL_SYSTEM_WRITE_BUFFERS, &sendBfrSize, &error) != RSSL_RET_SUCCESS) { printf("rsslIoctl(): failed <%s>\n", error.text); } if (rsslIoctl(rsslConsumerChannel, RSSL_SYSTEM_READ_BUFFERS, &rcvBfrSize, &error) != RSSL_RET_SUCCESS) { printf("rsslIoctl(): failed <%s>\n", error.text); } #endif /* Initialize ping handler */ initPingHandler(rsslConsumerChannel); /* Send login request message */ isLoginReissue = RSSL_FALSE; //APIQA /*if (sendLoginRequest(rsslConsumerChannel, "rsslConsumer", RSSL_CONSUMER, &loginSuccessCallBack) != RSSL_RET_SUCCESS) { cleanUpAndExit(); }*/ if (!_sendDirReqWithoutLogin && !_sendDictReqWithoutLogin && !_sendItemReqWithoutLogin) { if (sendLoginRequest(rsslConsumerChannel, "rsslConsumer", RSSL_CONSUMER, &loginSuccessCallBack) != RSSL_RET_SUCCESS) { cleanUpAndExit(); } } else { printf("FALSE\n"); if (_sendDirReqWithoutLogin) { sendSourceDirectoryRequest(rsslConsumerChannel, _sendGenMsgOnDirectory); } else if (_sendDictReqWithoutLogin) { sendDictionaryRequest(rsslConsumerChannel, "RWFFld", FIELD_DICTIONARY_STREAM_ID, _initialDictFilter); sendDictionaryRequest(rsslConsumerChannel, "RWFEnum", ENUM_TYPE_DICTIONARY_STREAM_ID, _initialDictFilter); } else if (_sendItemReqWithoutLogin) { printf("Sending MP REQUEST\n"); sendMarketPriceItemRequests(rsslConsumerChannel); } } //END APIQA /* this is the message processing loop */ while(1) { useRead = readfds; useExcept = exceptfds; useWrt = wrtfds; time_interval.tv_sec = 1; time_interval.tv_usec = 0; /* Call select() to check for any messages */ selRet = select(FD_SETSIZE,&useRead, &useWrt,&useExcept,&time_interval); if (selRet < 0) /* no messages received, continue */ { #ifdef _WIN32 if (WSAGetLastError() == WSAEINTR) continue; #else if (errno == EINTR) { continue; } #endif } else if (selRet > 0) /* messages received, read from channel */ { if ((rsslConsumerChannel != NULL) && (rsslConsumerChannel->socketId != -1)) { if ((FD_ISSET(rsslConsumerChannel->socketId, &useRead)) || (FD_ISSET(rsslConsumerChannel->socketId, &useExcept))) { if (readFromChannel(rsslConsumerChannel) != RSSL_RET_SUCCESS) recoverConnection(); } /* flush for write file descriptor and active state */ if (rsslConsumerChannel != NULL && FD_ISSET(rsslConsumerChannel->socketId, &useWrt) && rsslConsumerChannel->state == RSSL_CH_STATE_ACTIVE) { if ((retval = rsslFlush(rsslConsumerChannel, &error)) < RSSL_RET_SUCCESS) { printf("rsslFlush() failed with return code %d - <%s>\n", retval, error.text); } else if (retval == RSSL_RET_SUCCESS) { /* clear write fd */ FD_CLR(rsslConsumerChannel->socketId, &wrtfds); } } } } /* break out of message processing loop if should recover connection */ if (shouldRecoverConnection == RSSL_TRUE) { printf("Recovering connection in 5 seconds\n"); connectionRecovery = RSSL_TRUE; #ifdef _WIN32 Sleep(5000); #else sleep(5); #endif break; } /* Handle pings */ handlePings(rsslConsumerChannel); /* Handle run-time */ handleRuntime(); if (onPostEnabled || offPostEnabled) { /* if configured to post, send post messages if its time */ /* Handle Post */ if (handlePosts(rsslConsumerChannel, connectionRecovery) != RSSL_RET_SUCCESS) recoverConnection(); connectionRecovery = RSSL_FALSE; } if ((currentTime = time(NULL)) < 0) { printf("time() failed.\n"); } // send login reissue if login reissue time has passed if (canSendLoginReissue == RSSL_TRUE && currentTime >= (RsslInt)loginReissueTime) { isLoginReissue = RSSL_TRUE; if (sendLoginRequest(rsslConsumerChannel, "rsslConsumer", RSSL_CONSUMER, &loginSuccessCallBack) != RSSL_RET_SUCCESS) { printf("Login reissue failed\n"); } else { printf("Login reissue sent\n"); } canSendLoginReissue = RSSL_FALSE; } } } }
TeachingAssistant::TeachingAssistant(QString fName, QString lName, QString uName) { setFirstName(fName); setLastName(lName); setUsername(uName); }