bool Noun::isLocal() const { if ( context() && context()->isClient() ) return userId() == context()->user()->userId(); return userId() == 0; }
// A registered player property changed (KGame framework function). Store this property // in the score object for the GUI. void KWin4Player::slotPlayerPropertyChanged(KGamePropertyBase *prop, KPlayer * /*player*/) { if (!mStatus) return ; if (!isActive()) return ; if (prop->id()==KGamePropertyBase::IdName) { mStatus->setPlayerName(name(), userId()); } else if (prop->id()==mAllWin.id()) { mStatus->setWins(mAllWin, userId()); } else if (prop->id()==mAllRemis.id()) { mStatus->setRemis(mAllRemis, userId()); } else if (prop->id()==mAllLost.id()) { mStatus->setLosses(mAllLost, userId()); } else if (prop->id()==mAllBrk.id()) { mStatus->setBreaks(mAllBrk, userId()); } }
/** * Read from xml */ void Node::readByXml (xmlNode * cur_node) { for (xmlAttr * props = cur_node->properties; props; props = props->next) { if ( xmlStrEqual( props->name, xmlCharStrdup("id"))) { setUserId( strtoul( ( const char *)( props->children->content), NULL, 0)); if (userId() > graph->maxNodeId()) graph->setMaxNodeId( userId()); } } }
void Canvas::drawPoint(const QPoint &point) { LayerPointer l = layers.selectedLayer(); if(l.isNull() || l->isLocked() || l->isHided()){ setCursor(Qt::ForbiddenCursor); return; } // setCursor(Qt::CrossCursor); updateCursor(brush_->width()); brush_->setSurface(l->imagePtr()); brush_->start(point); int rad = (brush_->width() / 2) + 2; update(QRect(lastPoint, point).normalized() .adjusted(-rad, -rad, +rad, +rad)); QVariantMap point_j; point_j.insert("x", point.x()); point_j.insert("y", point.y()); QVariantMap map; map.insert("brush", QVariant(brushInfo())); map.insert("layer", QVariant(currentLayer())); map.insert("point", QVariant(point_j)); map.insert("userid", QVariant(userId())); QVariantMap bigMap; bigMap.insert("info", map); bigMap.insert("action", "drawpoint"); QByteArray tmp = toJson(QVariant(bigMap)); emit sendData(tmp); }
QNetworkReply::NetworkError OwnCloudNetworkFactory::triggerFeedUpdate(int feed_id) { if (userId().isEmpty()) { // We need to get user ID first. OwnCloudUserResponse info = userInfo(); if (lastError() != QNetworkReply::NoError) { return lastError(); } else { // We have new user ID, set it up. setUserId(info.userId()); } } // Now, we can trigger the update. QByteArray raw_output; NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_urlFeedsUpdate.arg(userId(), QString::number(feed_id)), qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(), QByteArray(), QString(), raw_output, QNetworkAccessManager::GetOperation, true, m_authUsername, m_authPassword, true); if (network_reply.first != QNetworkReply::NoError) { qWarning("ownCloud: Feeds update failed with error %d.", network_reply.first); } return (m_lastError = network_reply.first); }
void Canvas::drawLineTo(const QPoint &endPoint) { LayerPointer l = layers.selectedLayer(); if(l.isNull() || l->isLocked() || l->isHided()){ setCursor(Qt::ForbiddenCursor); return; } // setCursor(Qt::CrossCursor); updateCursor(brush_->width()); brush_->setSurface(l->imagePtr()); brush_->lineTo(endPoint); update(); QVariantMap start_j; start_j.insert("x", this->lastPoint.x()); start_j.insert("y", this->lastPoint.y()); QVariantMap end_j; end_j.insert("x", endPoint.x()); end_j.insert("y", endPoint.y()); QVariantMap map; map.insert("brush", QVariant(brushInfo())); map.insert("start", QVariant(start_j)); map.insert("end", QVariant(end_j)); map.insert("layer", QVariant(currentLayer())); map.insert("userid", QVariant(userId())); QVariantMap bigMap; bigMap.insert("info", map); bigMap.insert("action", "drawline"); QByteArray tmp = toJson(QVariant(bigMap)); emit sendData(tmp); }
void GetSelectedContacts(FacebookProto *proto, MCONTACT hItem, HWND hwndList, std::vector<facebook_user*> *contacts) { if (hItem == NULL) hItem = (MCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); while (hItem) { if (IsHContactGroup(hItem)) { MCONTACT hItemT = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); if (hItemT) GetSelectedContacts(proto, hItemT, hwndList, contacts); } else { if (SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { facebook_user *fu = new facebook_user(); ptrA userId(proto->getStringA(hItem, FACEBOOK_KEY_ID)); if (userId) fu->user_id = userId; ptrT realName(proto->getTStringA(hItem, FACEBOOK_KEY_NICK)); if (realName) fu->real_name = _T2A(realName); contacts->push_back(fu); } } hItem = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); } }
void CreateAccountDialog::accept() { if (userId().isEmpty()) { QMessageBox::critical(this, "", tr("Please enter user id")); return; } if (password().isEmpty()) { QMessageBox::critical(this, "", tr("Please enter user password")); return; } // enableControls(false); // m_createAccount.createAccount(userId(), password(), ""); }
bool AuthSession::validateSelf(const MTPUser &user) { if (user.type() != mtpc_user || !user.c_user().is_self() || user.c_user().vid.v != userId()) { LOG(("Auth Error: wrong self user received.")); App::logOutDelayed(); return false; } return true; }
QVariantMap User::toMap() const { QVariantMap map; map["userId"] = userId(); map["password"] = password(); return map; }
void NounShip::addIncoming( NounProjectile * a_pProj ) { if ( userId() == 0 && isLocal() ) { m_Incoming.push( a_pProj ); m_bIncoming = true; } }
QString WelcomeDialog::password() const { QString strPassword = ui->editPassword->text(); if (!m_users.value(userId()).compare(strPassword)) return ::WizDecryptPassword(strPassword); else return strPassword; }
void Dailymotion::setUserId(const QString &id) { if (id != userId()) { QSettings().setValue("Dailymotion/userId", id); subscriptionCache.ids.clear(); subscriptionCache.filters.clear(); subscriptionCache.hasMore = true; emit userIdChanged(); } }
// TODO Rewrite login so that it does not use an object for a parameter. +callback? // assumes {userId: 'user name', password: '******', server: 'server', database: 'database' } // returns a database reference static v8::Handle<Value> Login(const Arguments& args) { v8::HandleScope scope; LOGINREC *login; DBPROCESS *dbconn; REQ_OBJ_ARG(0, connArgs); /* Allocate a login params structure */ if ((login = dblogin()) == FAIL) { return v8::ThrowException(v8::Exception::Error(v8::String::New("FreeTDS cannot initialize dblogin() structure."))); } // fill out the login params v8::Local<v8::String> userIdKey = v8::String::New("userId"); if(connArgs->Has(userIdKey)){ String::AsciiValue userId(connArgs->Get(userIdKey)); DBSETLUSER(login, *userId); } v8::Local<v8::String> passwordKey = v8::String::New("password"); if(connArgs->Has(passwordKey)){ String::AsciiValue password(connArgs->Get(passwordKey)); DBSETLPWD(login, *password); } // set the application name to node-freetds to help with profiling etc DBSETLAPP(login, "node-freetds"); v8::Local<v8::String> serverKey = v8::String::New("server"); if(!connArgs->Has(serverKey)){ dbloginfree(login); return v8::ThrowException(v8::Exception::Error(v8::String::New("The server name was not provided"))); } String::AsciiValue serverName(connArgs->Get(serverKey)); /* Now connect to the DB Server */ if ((dbconn = dbopen(login, *serverName)) == NULL) { dbloginfree(login); return v8::ThrowException(v8::Exception::Error(v8::String::New("FreeTDS cannot initialize dblogin() structure."))); } v8::Local<v8::String> dbKey = v8::String::New("database"); if(connArgs->Has(dbKey)){ String::AsciiValue database(connArgs->Get(dbKey)); /* Now switch to the correct database */ if ((dbuse(dbconn, *database)) == FAIL) { dbloginfree(login); return v8::ThrowException(v8::Exception::Error(v8::String::New("FreeTDS could not switch to the database"))); } } // free the login struct because we don't need it anymore dbloginfree(login); // wrap the dbconn so that we can persist it from the JS side return v8::External::Wrap(dbconn); }
bool Dailymotion::hasScope(const QString &scope) const { if (userId().isEmpty()) { return false; } QSqlQuery query = getDatabase().exec(QString("SELECT scopes FROM dailymotionAccounts WHERE userId = '%1'") .arg(userId())); if (query.lastError().isValid()) { qDebug() << "Dailymotion::hasScope: database error:" << query.lastError().text(); return false; } if ((query.record().count() > 0) && (query.next())) { return query.value(0).toString().contains(scope); } return false; }
QString Dailymotion::refreshToken() const { if (userId().isEmpty()) { return QString(); } QSqlQuery query = getDatabase().exec(QString("SELECT refreshToken FROM dailymotionAccounts WHERE userId = '%1'") .arg(userId())); if (query.lastError().isValid()) { qDebug() << "Dailymotion::refreshToken: database error:" << query.lastError().text(); return QString(); } if ((query.record().count() > 0) && (query.next())) { return query.value(0).toString(); } return QString(); }
void WelcomeDialog::accept() { if (userId().isEmpty()) { QMessageBox::critical(this, "", tr("Please enter user id")); return; } if (password().isEmpty()) { QMessageBox::critical(this, "", tr("Please enter user password")); return; } enableControls(false); m_verifyAccount.resetProxy(); m_verifyAccount.verifyAccount(userId(), password()); }
void NounShip::initializeUnits() { // make sure all units onboard are friendly for(int i=0;i<childCount();i++) if ( WidgetCast<NounUnit>( child(i) ) ) { ((NounUnit *)child(i))->setTeamId( teamId() ); ((NounUnit *)child(i))->setUserId( userId() ); } }
bool Event::operator == ( const Event& other ) const { return ( other.id() == id() && other.installationId() == installationId() && other.taskId() == taskId() && other.comment() == comment() && other.startDateTime() == startDateTime() && other.endDateTime() == endDateTime() && other.userId() == userId() && other.reportId() == reportId() ); }
void WelcomeDialog::updateUserSettings() { CWizSettings settings(::WizGetDataStorePath() + "wiznote.ini"); // set current login user as default user. settings.SetString("Users", "DefaultUser", userId()); CWizUserSettings userSettings(userId()); if(ui->checkAutoLogin->checkState() == Qt::Checked) { userSettings.setAutoLogin(true); } else { userSettings.setAutoLogin(false); } if(ui->checkRememberMe->checkState() == Qt::Checked) { userSettings.setPassword(::WizEncryptPassword(password())); } else { userSettings.setPassword(); } }
void Dailymotion::setRefreshToken(const QString &token) { QSqlQuery query = getDatabase().exec(QString("UPDATE dailymotionAccounts SET refreshToken = '%1' WHERE userId = '%2'") .arg(token).arg(userId())); if (query.lastError().isValid()) { qDebug() << "Dailymotion::setRefreshToken: database error:" << query.lastError().text(); } else { emit accessTokenChanged(); } #ifdef CUTETUBE_DEBUG qDebug() << "Dailymotion::setRefreshToken" << token; #endif }
void DlgGroupChat::updateMemberInfo(std::shared_ptr<List_GroupMember> ptrMemberList) { //更新列表信息; //删除以前的信息; m_listboxMembers.ResetContent(); //添加信息; auto itBegin = ptrMemberList->begin(); int nIndex = -1; while (itBegin != ptrMemberList->end()) { #ifdef UNICODE CA2W temp(itBegin->nick_name().c_str()); CString userId(temp); #else //MultiByteToWideChar CString userId(itBegin->nick_name().c_str()); #endif nIndex = m_listboxMembers.AddString(userId); if (nIndex >= 0) m_listboxMembers.SetItemDataPtr(nIndex, &*itBegin); ++itBegin; } }
QDomElement Event::toXml( QDomDocument document ) const { QDomElement element = document.createElement( EventElement ); element.setAttribute( EventIdAttribute, QString().setNum( id() ) ); element.setAttribute( EventInstallationIdAttribute, QString().setNum( installationId() ) ); element.setAttribute( EventTaskIdAttribute, QString().setNum( taskId() ) ); element.setAttribute( EventUserIdAttribute, QString().setNum( userId() ) ); element.setAttribute( EventReportIdAttribute, QString().setNum( reportId() ) ); if ( m_start.isValid() ) { element.setAttribute( EventStartAttribute, m_start.toString( Qt::ISODate ) ); } if ( m_end.isValid() ) { element.setAttribute( EventEndAttribute, m_end.toString( Qt::ISODate ) ); } if ( !comment().isEmpty() ) { QDomText commentText = document.createTextNode( comment() ); element.appendChild( commentText ); } return element; }
void UpdateManager::downloadUpdater() { std::string fileName; std::string address; if (!_versionConfDownloaded) { fileName = string("version.conf"); std::string currentVersion = getCurrentVersion(); string userId(readConfValue("user-id", "")); address = "http://d-jon.com/downloads/version.php?version=" + currentVersion;// readConfValue("version-file", ""); address = address.append("&userId=" + userId); } fileName = *getTempDir() + "/" + fileName; _file = new QFile(QString(fileName.c_str())); if (_file->exists()) { _file->remove(); } QUrl url(address.c_str()); _manager->get(QNetworkRequest(url)); _downloading = true; }
VLR* getLASzipVLR(std::vector<VLR*> const& vlrs) { std::string userId("laszip encoded"); uint16_t recordId(22204); for(size_t i = 0; i < vlrs.size(); ++i) { VLR* vlr = vlrs[i]; std::string const& uid = vlr->userId; uint16_t rid = vlr->recordId; // // std::cout << "VLR recordId: " << rid << std::endl; // std::cout << "VLR userid: '" << uid <<"'"<< std::endl; // std::cout << "uid size" << uid.size() << std::endl; // // std::cout << "uid equal: " << boost::iequals(uid, userId) << std::endl; // std::cout << "rid equal: " << (rid == recordId) << std::endl; if (uid == userId && rid == recordId) return vlr; } return 0; }
void NounShip::updateFireCheck() { if ( userId() == 0 && isLocal() && m_Command == ENGAGE && m_CommandTarget.valid() ) { dword nNextFireCheck = m_nLastFireCheck + (CHECK_FIRE_INTERVAL * TICKS_PER_SECOND); if ( tick() > nNextFireCheck ) { m_nLastFireCheck = tick(); m_pLastFireTarget = m_CommandTarget; m_fLastFireDistance = (m_CommandTarget->worldPosition() - worldPosition()).magnitude(); CollisionInfo info; if ( checkForCollision( m_CommandTarget, &info, false ) ) { if ( WidgetCast<NounShip>( info.m_pCollide ) == NULL || isFriend( info.m_pCollide ) ) m_bWeaponsFree = false; // something is in the way, no firing unless it's a enemy ship .. else m_bWeaponsFree = true; } else m_bWeaponsFree = true; // no collision, allow firing... } } }
bool CFriends::RequestUserInformation(SteamID steamIDUser, bool requireNameOnly) { CSteamID userId(steamIDUser); return friends->RequestUserInformation(userId, requireNameOnly); }
void Noun::privateChat( const char * pChat ) { if ( userId() != 0 ) Verb::Ref( new VerbChat( this, Verb::PRIVATE, pChat ) ); }
bool CFriends::IsClanChatAdmin(SteamID steamIDClanChat, SteamID steamIDUser) { CSteamID clanId(steamIDClanChat); CSteamID userId(steamIDUser); return friends->IsClanChatAdmin(clanId, userId); }
/** * \brief Function to treat the Stop file transfer options * \param options the object which contains the Stop file transfers options values * \param sqlRequest the sql data base request * \return raises an exception on error */ void FileTransferServer::processOptions(const FMS_Data::StopTransferOptions& options, std::string& sqlRequest) { std::string transferId(options.getTransferId()),machineName(options.getFromMachineId()),userId(options.getUserId()); //To check if the transferId is defined if (transferId.size() != 0) { if (transferId.compare("all")!=0 && transferId.compare("ALL")!=0){ //To check the transfer Id FileTransferServer::checkTransferId(options.getTransferId()); //To add the transferId on the request FileTransferServer::addOptionRequest("transferId", options.getTransferId(), sqlRequest); } } //To check if the fromMachineId is defined if (machineName.size() != 0) { sqlRequest.append(" and (sourceMachineId='"+FileTransferServer::getDatabaseInstance()->escapeData(machineName)+"'"+" or destinationMachineId='"+FileTransferServer::getDatabaseInstance()->escapeData(machineName)+"')"); } //Creation of the object user UserServer userServer = UserServer(msessionServer); userServer.init(); //To check if the userId is defined if (userId.size() != 0) { if (!userServer.isAdmin()) { UMSVishnuException e (ERRCODE_NO_ADMIN); throw e; } if (userId.compare("all")!=0 && userId.compare("ALL")!=0){ //To check the user Id FileTransferServer::checkUserId(options.getUserId()); //To add the userId on the request FileTransferServer::addOptionRequest("userId", userId, sqlRequest); } } else { FileTransferServer::addOptionRequest("userId", userServer.getData().getUserId(), sqlRequest); } }