コード例 #1
2
void CALifeMonsterMovementManager::update					()
{
	switch (path_type()) {
		case MovementManager::ePathTypeGamePath : {
			detail().update	();
			break;
		};
		case MovementManager::ePathTypePatrolPath : {
			patrol().update	();

			detail().target	(
				patrol().target_game_vertex_id(),
				patrol().target_level_vertex_id(),
				patrol().target_position()
			);

			detail().update	();

			break;
		};
		case MovementManager::ePathTypeNoPath : {
			break;
		};
		default : NODEFAULT;
	};
}
コード例 #2
0
ファイル: PrePostProcessor.cpp プロジェクト: sanderjo/nzbget
void PrePostProcessor::DeleteCleanup(NzbInfo* nzbInfo)
{
	if (nzbInfo->GetCleanupDisk() ||
		nzbInfo->GetDeleteStatus() == NzbInfo::dsDupe)
	{
		// download was cancelled, deleting already downloaded files from disk
		for (CompletedFile& completedFile: nzbInfo->GetCompletedFiles())
		{
			BString<1024> fullFileName("%s%c%s", nzbInfo->GetDestDir(), PATH_SEPARATOR, completedFile.GetFilename());
			if (FileSystem::FileExists(fullFileName))
			{
				detail("Deleting file %s", completedFile.GetFilename());
				FileSystem::DeleteFile(fullFileName);
			}
		}

		// delete .out.tmp-files
		DirBrowser dir(nzbInfo->GetDestDir());
		while (const char* filename = dir.Next())
		{
			int len = strlen(filename);
			if (len > 8 && !strcmp(filename + len - 8, ".out.tmp"))
			{
				BString<1024> fullFilename("%s%c%s", nzbInfo->GetDestDir(), PATH_SEPARATOR, filename);
				detail("Deleting file %s", filename);
				FileSystem::DeleteFile(fullFilename);
			}
		}

		// delete old directory (if empty)
		FileSystem::DeleteDirectory(nzbInfo->GetDestDir());
	}
}
コード例 #3
0
bool stalker_movement_manager_obstacles::simulate_path_navigation	()
{
	Fvector							current_position = object().Position();
	Fvector							previous_position = current_position;
	u32								current_travel_point = 0;
	while (!detail().completed(current_position,!detail().state_patrol_path(),current_travel_point)) {
		m_static_obstacles.on_before_query	();
		m_static_obstacles.query			(current_position,previous_position);
		
		if (!m_static_obstacles.process_query(false)) {
			m_last_fail_time		= Device.dwTimeGlobal;
			m_failed_to_build_path	= true;
			restore_current_state	();
			return					(false);
		}

		if (m_static_obstacles.need_path_to_rebuild())
			return					(false);

//		float						dist_to_target;
//		Fvector						dir_to_target;
//		float						distance;
//		current_position			= path_position(1.f,current_position,check_time_delta,current_travel_point,distance,dist_to_target,dir_to_target);
		previous_position			= current_position;
		current_position			= predict_position(check_time_delta,current_position,current_travel_point,1.f);
	}

	return							(true);
}
コード例 #4
0
void CMovementManager::move_along_path	(CPHMovementControl *movement_control, Fvector &dest_position, float time_delta)
{
	START_PROFILE("Build Path/Move Along Path")
	VERIFY(movement_control);
	Fvector				motion;
	dest_position		= object().Position();

	float				precision = 0.5f;
	
	
	// Если нет движения по пути
	if (	!enabled() || 
			!actual()  ||
//			path_completed() || 
			detail().path().empty() ||
			detail().completed(dest_position,true) || 
			(detail().curr_travel_point_index() >= detail().path().size() - 1) ||
			fis_zero(old_desirable_speed())
		)
	{
		m_speed			= 0.f;
		

		DBG_PH_MOVE_CONDITIONS( if(ph_dbg_draw_mask.test(phDbgNeverUseAiPhMove)){movement_control->SetPosition(dest_position);movement_control->DisableCharacter();})
		if(movement_control->IsCharacterEnabled()) {
コード例 #5
0
ファイル: NntpServer.cpp プロジェクト: sanderjo/nzbget
void NntpProcessor::Run()
{
	m_connection->SetSuppressErrors(false);

#ifndef DISABLE_TLS
	if (m_secureCert && !m_connection->StartTls(false, m_secureCert, m_secureKey))
	{
		error("Could not establish secure connection to nntp-client: Start TLS failed");
		return;
	}
#endif

	info("[%i] Incoming connection from: %s", m_id, m_connection->GetHost() );
	m_connection->WriteLine("200 Welcome (NServ)\r\n");

	CharBuffer buf(1024);
	int bytesRead = 0;
	while (CString line = m_connection->ReadLine(buf, 1024, &bytesRead))
	{
		line.TrimRight();
		detail("[%i] Received: %s", m_id, *line);

		if (!strncasecmp(line, "ARTICLE ", 8))
		{
			m_messageid = line + 8;
			m_sendHeaders = true;
			ServArticle();
		}
		else if (!strncasecmp(line, "BODY ", 5))
		{
			m_messageid = line + 5;
			m_sendHeaders = false;
			ServArticle();
		}
		else if (!strncasecmp(line, "GROUP ", 6))
		{
			m_connection->WriteLine(CString::FormatStr("211 0 0 0 %s\r\n", line + 7));
		}
		else if (!strncasecmp(line, "AUTHINFO ", 9))
		{
			m_connection->WriteLine("281 Authentication accepted\r\n");
		}
		else if (!strcasecmp(line, "QUIT"))
		{
			detail("[%i] Closing connection", m_id);
			m_connection->WriteLine("205 Connection closing\r\n");
			break;
		}
		else
		{
			warn("[%i] Unknown command: %s", m_id, *line);
			m_connection->WriteLine("500 Unknown command\r\n");
		}
	}

	m_connection->SetGracefull(true);
	m_connection->Disconnect();
}
コード例 #6
0
void stalker_movement_manager_obstacles::restore_current_state		()
{
	if (!m_saved_state)
		return;

	m_level_path.swap				(level_path_path());
	m_detail_path.swap				(detail().path());
	detail().m_current_travel_point	= m_detail_current_index;
#ifdef DEBUG
	m_detail_key_points.swap		(detail().key_points());
#endif // DEBUG
	detail().last_patrol_point		(m_detail_last_patrol_point);
	m_saved_current_iteration.swap	(m_static_obstacles.current_iteration());
}
コード例 #7
0
//
// Database timeouts
// @@@ Incomplete and not satisfactory
//
void timeouts()
{
	printf("* Database timeout locks test\n");
    CssmAllocator &alloc = CssmAllocator::standard();
	ClientSession ss(alloc, alloc);
    
    DLDbIdentifier dbId1(ssuid, "/tmp/one", NULL);
    DLDbIdentifier dbId2(ssuid, "/tmp/two", NULL);
	DBParameters initialParams1 = { 4, false };	// 4 seconds timeout
	DBParameters initialParams2 = { 8, false };	// 8 seconds timeout
    
	// credential to set keychain passphrase
    AutoCredentials pwCred(alloc);
    StringData password("mumbojumbo");
    pwCred += TypedList(alloc, CSSM_SAMPLE_TYPE_KEYCHAIN_CHANGE_LOCK,
        new(alloc) ListElement(CSSM_SAMPLE_TYPE_PASSWORD),
        new(alloc) ListElement(password));
    
	DbHandle db1 = ss.createDb(dbId1, &pwCred, NULL, initialParams1);
	DbHandle db2 = ss.createDb(dbId2, &pwCred, NULL, initialParams2);
	detail("Databases created");
    
    // generate a key
	const CssmCryptoData seed(StringData("rain tonight"));
	FakeContext genContext(CSSM_ALGCLASS_KEYGEN, CSSM_ALGID_DES,
		&::Context::Attr(CSSM_ATTRIBUTE_KEY_LENGTH, 64),
		&::Context::Attr(CSSM_ATTRIBUTE_SEED, seed),
		NULL);
    KeyHandle key;
    CssmKey::Header header;
    ss.generateKey(db1, genContext, CSSM_KEYUSE_ENCRYPT | CSSM_KEYUSE_DECRYPT,
        CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_PERMANENT,
        /*cred*/NULL, NULL, key, header);
    ss.generateKey(db2, genContext, CSSM_KEYUSE_ENCRYPT | CSSM_KEYUSE_DECRYPT,
        CSSM_KEYATTR_RETURN_REF | CSSM_KEYATTR_PERMANENT,
        /*cred*/NULL, NULL, key, header);
	detail("Keys generated and stored");
	
	// credential to provide keychain passphrase
    AutoCredentials pwCred2(alloc);
    pwCred += TypedList(alloc, CSSM_SAMPLE_TYPE_KEYCHAIN_LOCK,
        new(alloc) ListElement(CSSM_SAMPLE_TYPE_PASSWORD),
        new(alloc) ListElement(password));

	//@@@ incomplete
	ss.releaseDb(db1);
	ss.releaseDb(db2);
}
コード例 #8
0
ファイル: Script.cpp プロジェクト: nzbget/nzbget
void ScriptController::AddMessage(Message::EKind kind, const char* text)
{
	switch (kind)
	{
		case Message::mkDetail:
			detail("%s", text);
			break;

		case Message::mkInfo:
			info("%s", text);
			break;

		case Message::mkWarning:
			warn("%s", text);
			break;

		case Message::mkError:
			error("%s", text);
			break;

		case Message::mkDebug:
			debug("%s", text);
			break;
	}
}
コード例 #9
0
int main() {
	Database *db = Database::getInstance();
	Session *session = Session::getInstance();

	while (FCGI_Accept() >= 0) {
		Json::FastWriter fw; 
		Json::Value root;
		string result("fail");
		string detail("");
		session->sessionInit();
		vector<unordered_map<string,string> >   query_result;
		if(session->checkSession() == false){
			detail = detail + "unlogin";

		}else{

			char query_buf[1024] = {0};
			string user_id;
			user_id = session->getValue("user_id");

<<<<<<< HEAD
			snprintf(query_buf,sizeof(query_buf),"select b.no_id, b.type, a.user_id, a.username, b.additional_message, b.created_time from users a INNER JOIN (select * from notification  where rece_id = %d and state = 0) b on a.user_id = b.rece_id union  select b.no_id, b.type, b.send_id, a.username, b.additional_message, b.created_time from users a INNER JOIN (select * from notification  where send_id = %d and state = 1) b on a.user_id = b.send_id",atoi(user_id.c_str()),atoi(user_id.c_str()));
=======
			snprintf(query_buf,sizeof(query_buf),"(SELECT no_id,type,send_id,notification.state,username,nickname,created_time,additional_message FROM notification inner join users on users.user_id=send_id where rece_id=%d and notification.state=0) union (SELECT no_id,type,rece_id as send_id,notification.state,username,nickname,created_time,additional_message FROM notification inner join users on users.user_id=rece_id where send_id=%d and notification.state=1)",atoi(user_id.c_str()),atoi(user_id.c_str()));
>>>>>>> 637973e20ec3876ad1a721cb4a71526d24d68c4f
コード例 #10
0
void ArchiveListItem::setArchive(ArchivePtr archive)
{
    _archive = archive;

    connect(_archive.data(), &Archive::changed, this, &ArchiveListItem::update,
            QUEUED);

    _ui.nameLabel->setText(_archive->name());
    _ui.nameLabel->setToolTip(_archive->name());
    QString detail(_archive->timestamp().toString(Qt::DefaultLocaleLongDate));
    if(_archive->sizeTotal() != 0)
    {
        QString size = Utils::humanBytes(_archive->sizeTotal(), _useSIPrefixes,
                                         FIELD_WIDTH);
        detail.prepend(size + "  ");
    }
    _ui.detailLabel->setText(detail);
    _ui.detailLabel->setToolTip(_archive->archiveStats());

    if(_archive->jobRef().isEmpty())
    {
        _ui.jobButton->hide();
        _ui.horizontalLayout->removeWidget(_ui.jobButton);
        _ui.archiveButton->show();
        _widget->removeAction(_ui.actionGoToJob);
    }
    else
    {
        _ui.archiveButton->hide();
        _ui.horizontalLayout->removeWidget(_ui.archiveButton);
        _ui.jobButton->show();
        _widget->insertAction(_ui.actionRestore, _ui.actionGoToJob);
    }
}
コード例 #11
0
ファイル: pictoAction.cpp プロジェクト: erebe/Tabula_rasa
void PictoAction::updateDimension()
{/*{{{*/
     qreal posAncre;
     pos_ = labels_.at( 1 )->width() + 30;

     if( detail() ) {
          posAncre = ( labels_.at( 1 )->width() / 2 ) + 15;

          if( emptyDetail_ || ( !emptyDetail_ && !labels_.at( 0 )->isEmpty() ) ) {
               pos_ += labels_.at( 0 )->width() + 35;
               posAncre =  labels_.at( 0 )->width() + 50
                           + ( labels_.at( 1 )->width() / 2 );
          }

          if( emptyDetail_ || ( !emptyDetail_ && !labels_.at( 2 )->isEmpty() ) ) {
               pos_ += labels_.at( 2 )->width() + 35;
          }

     } else {
          posAncre = ( labels_.at( 1 )->width() / 2 ) + 15;
     }

     posBottomAnchor_.setX( posAncre );
     posUpAnchor_.setX( posAncre );
     updateLink();
}/*}}}*/
コード例 #12
0
ファイル: main.cpp プロジェクト: clee/runcible
int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    QString filename("unknown");
    if (argc == 2) {
        filename = argv[1];
    }

    RWindow window;
    QBoxLayout *layout = qobject_cast<QBoxLayout *>(window.layout());

    QLabel heading("Could not open file.");
    heading.setFont(QFont("Liberation Serif", 30));
    layout->addWidget(&heading);

    layout->addStrut(8);

    QLabel detail(
        QString("The file %1 is of an unrecognized type and cannot be opened.")
        .arg(runcible::quote(filename)));
    detail.setFont(QFont("Liberation Serif", 12));
    detail.setWordWrap(true);
    layout->addWidget(&detail);

    layout->addStretch(1);

    QObject::connect(&window, SIGNAL(back()), &app, SLOT(quit()));

    window.showMessage("How unfortunate.");
    window.showMaximized();

    return app.exec();
}
コード例 #13
0
void CountProducerWidget::loadPreset(Mlt::Properties& p)
{
    if (!p.get("direction") || !p.get("style")) return;
    int index = -1;

    index = ui->directionCombo->findData(QVariant(p.get("direction")));
    ui->directionCombo->setCurrentIndex(index);

    index = ui->styleCombo->findData(QVariant(p.get("style")));
    ui->styleCombo->setCurrentIndex(index);

    index = ui->soundCombo->findData(QVariant(p.get("sound")));
    ui->soundCombo->setCurrentIndex(index);

    index = ui->backgroundCombo->findData(QVariant(p.get("background")));
    ui->backgroundCombo->setCurrentIndex(index);

    ui->dropCheckBox->setChecked(p.get("drop"));

    ui->durationSpinBox->setValue(p.get_int("length"));

    if (m_producer) {
        m_producer->set("direction", p.get("direction"));
        m_producer->set("style", p.get("style"));
        m_producer->set("sound", p.get("sound"));
        m_producer->set("background", p.get("background"));
        m_producer->set("drop", p.get("drop"));
        setLength(producer(), ui->durationSpinBox->value());
        m_producer->set(kShotcutDetailProperty, detail().toUtf8().constData());
        emit producerChanged(producer());
    }
}
コード例 #14
0
QT_BEGIN_NAMESPACE_ORGANIZER

/*!
    \class QOrganizerTodoOccurrence
    \brief The QOrganizerTodoOccurrence class provides an occurrence of a task which should be completed
    \inmodule QtOrganizer
    \ingroup organizer-items

    A todo occurrence is a specific instance of a todo item.  An occurrence
    which is retrieved from a manager may not actually be persisted in that
    manager (for example, it may be generated automatically from the
    recurrence rule of the parent todo stored in the manager), in which case
    it will have a zero-id and differ from the parent todo only in its start
    date.  Alternatively, it may be persisted in the manager (that is, the
    client has saved the occurrence previously) where it is stored as an exception
    to its parent todo.
 */

/*!
    Sets the date time at which the task should be started to \a startDateTime.  For all-day tasks,
    the time part can be set to any valid value.
 */
void QOrganizerTodoOccurrence::setStartDateTime(const QDateTime &startDateTime)
{
    QOrganizerTodoTime ttr = detail(QOrganizerItemDetail::TypeTodoTime);
    ttr.setStartDateTime(startDateTime);
    saveDetail(&ttr);
}
コード例 #15
0
ファイル: dsp_block.cpp プロジェクト: wwwgitcom/dsp-eagle
 void dsp_switch_block::switch_to(int from, int to)
 {
     dsp_buffer_reader_ptr from_reader = detail()->input(from);
     dsp_block_ptr to_block = cast_to_block_ptr( m_down_streams[to].dst().block() );
     to_block->detail()->set_input(m_down_streams[to].dst().port(), from_reader);
     m_link = to_block;
 }
コード例 #16
0
ファイル: LCDbTest.cpp プロジェクト: drkvogel/retrasst
void LCDbTest::addMachineDef( const LQuery & defs )
{
	MachineDef detail( defs );
	if( detail.getSampleType().empty() || detail.getSampleType() == "." )
		detail.setSampleType( sampleType );
	machineDefs.insert( detail );
}
コード例 #17
0
QT_BEGIN_NAMESPACE_ORGANIZER

/*!
    \class QOrganizerEventOccurrence
    \brief The QOrganizerEventOccurrence class provides an occurrence of an event.
    \inmodule QtOrganizer
    \ingroup organizer-items

    An event occurrence is where the occurrence differs from the generating
    event in some way.  An occurrence which is retrieved from a manager may not
    actually be persisted in that manager (for example, it may be generated
    automatically from the recurrence rule of the parent event stored in the
    manager), in which case it will have a zero-id and differ from the parent
    event only in its start date. Alternatively, it may be persisted in the
    manager (that is, the client has saved the occurrence previously) where it
    is stored as an exception to its parent event.
 */

/*!
    Sets the start date time of the event occurrence to \a startDateTime.
    For all-day events, the time part is meaningless.
 */
void QOrganizerEventOccurrence::setStartDateTime(const QDateTime &startDateTime)
{
    QOrganizerEventTime etr = detail(QOrganizerItemDetail::TypeEventTime);
    etr.setStartDateTime(startDateTime);
    saveDetail(&etr);
}
コード例 #18
0
//
// Ad-hoc test area.
// Used for whatever is needed at the moment...
//
void adhoc()
{
	printf("* Ad-hoc test sequence (now what does it do *this* time?)\n");
	
	Cssm cssm1;
	Cssm cssm2;
	cssm1->init();
	cssm2->init();
	
	{
		Module m1(gGuidAppleCSP, cssm1);
		Module m2(gGuidAppleCSP, cssm2);
		CSP r1(m1);
		CSP r2(m2);
		
		Digest d1(r1, CSSM_ALGID_SHA1);
		Digest d2(r2, CSSM_ALGID_SHA1);
		
		StringData foo("foo de doo da blech");
		DataBuffer<30> digest1, digest2;
		d1.digest(foo, digest1);
		d2.digest(foo, digest2);
		if (digest1 == digest2)
			detail("Digests verify");
		else
			error("Digests mismatch");
	}
	
	cssm1->terminate();
	cssm2->terminate();
}
コード例 #19
0
ファイル: plugin2.cpp プロジェクト: Distrotech/qtpim
 void documentProcessed(const QVersitDocument& document,
                        QContact* contact)
 {
     Q_UNUSED(document)
     QContactDetail detail(QContactDetail::TypeExtendedDetail);
     detail.setValue(0, 2);
     contact->saveDetail(&detail);
 }
コード例 #20
0
ファイル: plugin3.cpp プロジェクト: KDE/android-qt-mobility
 void documentProcessed(const QVersitDocument& document,
                        QContact* contact)
 {
     Q_UNUSED(document)
     QContactDetail detail("TestDetail");
     detail.setValue("Plugin", 3);
     contact->saveDetail(&detail);
 }
コード例 #21
0
/*!
    Sets the percentage of progress completed on the task described
    by the todo occurrence item to \a percentage. Note that the given
    \a percentage must be between 0 and 100, otherwise ignored.
 */
void QOrganizerTodoOccurrence::setProgressPercentage(int percentage)
{
    if (percentage >= 0 && percentage <= 100) {
        QOrganizerTodoProgress tp = detail(QOrganizerItemDetail::TypeTodoProgress);
        tp.setPercentageComplete(percentage);
        saveDetail(&tp);
    }
}
コード例 #22
0
void CountProducerWidget::on_styleCombo_activated(int /*index*/)
{
    if (m_producer) {
        m_producer->set("style", currentStyle().toLatin1().constData());
        m_producer->set(kShotcutDetailProperty, detail().toUtf8().constData());
        emit producerChanged(producer());
    }
}
コード例 #23
0
void stalker_movement_manager_obstacles::save_current_state		()
{
	m_saved_state					= false;

	if (level_path().path().empty())
		return;

	if (level_path().path().back() != level_path_builder().dest_vertex_id())
		return;

	if (detail().path().empty())
		return;

	if (detail().dest_vertex_id() != level_path_builder().dest_vertex_id())
		return;

	m_saved_state					= true;
	m_level_path.swap				(level_path_path());
	m_detail_current_index			= detail().path().empty() ? u32(-1) : detail().curr_travel_point_index();
	m_detail_path.swap				(detail().path());
#ifdef DEBUG
	m_detail_key_points.swap		(detail().key_points());
#endif // DEBUG
	m_detail_last_patrol_point		= detail().last_patrol_point();
	m_saved_current_iteration.copy	(m_static_obstacles.current_iteration());
}
コード例 #24
0
ファイル: PrePostProcessor.cpp プロジェクト: Bootz/nzbget
void PrePostProcessor::NZBDeleted(DownloadQueue* pDownloadQueue, NZBInfo* pNZBInfo)
{
	if (g_pOptions->GetDeleteCleanupDisk() && pNZBInfo->GetCleanupDisk())
	{
		// download was cancelled, deleting already downloaded files from disk
		for (NZBInfo::Files::reverse_iterator it = pNZBInfo->GetCompletedFiles()->rbegin(); it != pNZBInfo->GetCompletedFiles()->rend(); it++)
		{
			char* szFilename = *it;
			if (Util::FileExists(szFilename))
			{
				detail("Deleting file %s", Util::BaseFileName(szFilename));
				remove(szFilename);
			}
		}

		// delete .out.tmp-files and _brokenlog.txt
		DirBrowser dir(pNZBInfo->GetDestDir());
		while (const char* szFilename = dir.Next())
		{
			int iLen = strlen(szFilename);
			if ((iLen > 8 && !strcmp(szFilename + iLen - 8, ".out.tmp")) || !strcmp(szFilename, "_brokenlog.txt"))
			{
				char szFullFilename[1024];
				snprintf(szFullFilename, 1024, "%s%c%s", pNZBInfo->GetDestDir(), PATH_SEPARATOR, szFilename);
				szFullFilename[1024-1] = '\0';

				detail("Deleting file %s", szFilename);
				remove(szFullFilename);
			}
		}
	
		// delete old directory (if empty)
		if (Util::DirEmpty(pNZBInfo->GetDestDir()))
		{
			rmdir(pNZBInfo->GetDestDir());
		}

		if (g_pOptions->GetNzbCleanupDisk())
		{
			DeleteQueuedFile(pNZBInfo->GetQueuedFilename());
		}
	}

	NZBCompleted(pDownloadQueue, pNZBInfo, true);
}
コード例 #25
0
ファイル: BinRpc.cpp プロジェクト: Bootz/nzbm
void WriteLogBinCommand::Execute()
{
	SNZBWriteLogRequest WriteLogRequest;
	if (!ReceiveRequest(&WriteLogRequest, sizeof(WriteLogRequest)))
	{
		return;
	}

	char* pRecvBuffer = (char*)malloc(ntohl(WriteLogRequest.m_iTrailingDataLength) + 1);
	char* pBufPtr = pRecvBuffer;

	// Read from the socket until nothing remains
	int iResult = 0;
	int NeedBytes = ntohl(WriteLogRequest.m_iTrailingDataLength);
	pRecvBuffer[NeedBytes] = '\0';
	while (NeedBytes > 0)
	{
		iResult = recv(m_iSocket, pBufPtr, NeedBytes, 0);
		// Did the recv succeed?
		if (iResult <= 0)
		{
			error("invalid request");
			break;
		}
		pBufPtr += iResult;
		NeedBytes -= iResult;
	}

	if (NeedBytes == 0)
	{
		bool OK = true;
		switch ((Message::EKind)ntohl(WriteLogRequest.m_iKind))
		{
			case Message::mkDetail:
				detail(pRecvBuffer);
				break;
			case Message::mkInfo:
				info(pRecvBuffer);
				break;
			case Message::mkWarning:
				warn(pRecvBuffer);
				break;
			case Message::mkError:
				error(pRecvBuffer);
				break;
			case Message::mkDebug:
				debug(pRecvBuffer);
				break;
			default:
				OK = false;
		}
		SendBoolResponse(OK, OK ? "Message added to log" : "Invalid message-kind");
	}

	free(pRecvBuffer);
}
コード例 #26
0
ファイル: InferredType.cpp プロジェクト: caiolima/webkit
void InferredType::makeTopSlow(VM& vm, PropertyName propertyName)
{
    Descriptor oldType;
    {
        ConcurrentJSLocker locker(m_lock);
        oldType = descriptor(locker);
        if (!set(locker, vm, Top))
            return;
    }

    InferredTypeFireDetail detail(this, propertyName.uid(), oldType, Top, JSValue());
    m_watchpointSet.fireAll(vm, detail);
}
コード例 #27
0
Mlt::Producer* CountProducerWidget::newProducer(Mlt::Profile& profile)
{
    Mlt::Producer* p = new Mlt::Producer(profile, "count:");
    p->set("direction", currentDirection().toLatin1().constData());
    p->set("style", currentStyle().toLatin1().constData());
    p->set("sound", currentSound().toLatin1().constData());
    p->set("background", currentBackground().toLatin1().constData());
    p->set("drop", ui->dropCheckBox->isChecked());
    setLength(p, ui->durationSpinBox->value());
    p->set(kShotcutCaptionProperty, ui->nameLabel->text().toUtf8().constData());
    p->set(kShotcutDetailProperty, detail().toUtf8().constData());
    return p;
}
コード例 #28
0
ファイル: PrePostProcessor.cpp プロジェクト: Bootz/nzbget
void PrePostProcessor::NZBCompleted(DownloadQueue* pDownloadQueue, NZBInfo* pNZBInfo, bool bSaveQueue)
{
	if (g_pOptions->GetKeepHistory() > 0)
	{
		//remove old item for the same NZB
		for (HistoryList::iterator it = pDownloadQueue->GetHistoryList()->begin(); it != pDownloadQueue->GetHistoryList()->end(); it++)
		{
			HistoryInfo* pHistoryInfo = *it;
			if (pHistoryInfo->GetNZBInfo() == pNZBInfo)
			{
				delete pHistoryInfo;
				pDownloadQueue->GetHistoryList()->erase(it);
				break;
			}
		}

		HistoryInfo* pHistoryInfo = new HistoryInfo(pNZBInfo);
		pHistoryInfo->SetTime(time(NULL));
		pDownloadQueue->GetHistoryList()->push_front(pHistoryInfo);

		// park files
		int iParkedFiles = 0;
		int index = 0;
		for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); )
		{
			FileInfo* pFileInfo = *it;
			if (pFileInfo->GetNZBInfo() == pNZBInfo && !pFileInfo->GetDeleted())
			{
				detail("Park file %s", pFileInfo->GetFilename());
				g_pQueueCoordinator->DiscardDiskFile(pFileInfo);
				pDownloadQueue->GetFileQueue()->erase(it);
				pDownloadQueue->GetParkedFiles()->push_back(pFileInfo);
				it = pDownloadQueue->GetFileQueue()->begin() + index;
				iParkedFiles++;
			}
			else
			{
				it++;
				index++;
			}
		}
		pNZBInfo->SetParkedFileCount(iParkedFiles);

		if (bSaveQueue)
		{
			SaveQueue(pDownloadQueue);
		}

		info("Collection %s added to history", pNZBInfo->GetName());
	}
}
コード例 #29
0
void HistoryCoordinator::AddToHistory(DownloadQueue* pDownloadQueue, NZBInfo* pNZBInfo)
{
	//remove old item for the same NZB
	for (HistoryList::iterator it = pDownloadQueue->GetHistory()->begin(); it != pDownloadQueue->GetHistory()->end(); it++)
	{
		HistoryInfo* pHistoryInfo = *it;
		if (pHistoryInfo->GetNZBInfo() == pNZBInfo)
		{
			delete pHistoryInfo;
			pDownloadQueue->GetHistory()->erase(it);
			break;
		}
	}

	HistoryInfo* pHistoryInfo = new HistoryInfo(pNZBInfo);
	pHistoryInfo->SetTime(time(NULL));
	pDownloadQueue->GetHistory()->push_front(pHistoryInfo);
	pDownloadQueue->GetQueue()->Remove(pNZBInfo);

	if (pNZBInfo->GetDeleteStatus() == NZBInfo::dsNone)
	{
		// park files and delete files marked for deletion
		int iParkedFiles = 0;
		for (FileList::iterator it = pNZBInfo->GetFileList()->begin(); it != pNZBInfo->GetFileList()->end(); )
		{
			FileInfo* pFileInfo = *it;
			if (!pFileInfo->GetDeleted())
			{
				detail("Parking file %s", pFileInfo->GetFilename());
				g_pQueueCoordinator->DiscardDiskFile(pFileInfo);
				iParkedFiles++;
				it++;
			}
			else
			{
				// since we removed pNZBInfo from queue we need to take care of removing file infos marked for deletion
				pNZBInfo->GetFileList()->erase(it);
				delete pFileInfo;
				it = pNZBInfo->GetFileList()->begin() + iParkedFiles;
			}
		}
		pNZBInfo->SetParkedFileCount(iParkedFiles);
	}
	else
	{
		pNZBInfo->GetFileList()->Clear();
	}

	pNZBInfo->PrintMessage(Message::mkInfo, "Collection %s added to history", pNZBInfo->GetName());
}
コード例 #30
0
//
// Blob tests.
// Encodes and decodes Db and Key blobs and all that jazz.
//
void blobs()
{
	printf("* Database blob encryption test\n");
	ClientSession ss(CssmAllocator::standard(), CssmAllocator::standard());
	
	DbTester db1(ss, "/tmp/one", NULL, 60, true);
	DbTester db2(ss, "/tmp/two", NULL, 30, false);
	
	// encode db1, purge it, decode it again
	CssmData dbBlob;
	ss.encodeDb(db1, dbBlob);
	DbHandle db1a = ss.decodeDb(db1.dbId, &nullCred, dbBlob);
	ss.releaseDb(db1);
	if (db1 == db1a)
		detail("REUSED DB HANDLE ON DECODEDB (probably wrong)");
	DBParameters savedParams;
	ss.getDbParameters(db1a, savedParams);
	assert(savedParams.idleTimeout == db1.params.idleTimeout);
	assert(savedParams.lockOnSleep == db1.params.lockOnSleep);
	detail("Database encode/decode passed");
	
	// make sure the old handle isn't valid anymore
	try {
		ss.getDbParameters(db1, savedParams);
		printf("OLD DATABASE HANDLE NOT PURGED (possibly wrong)\n");
	} catch (const CssmCommonError &err) {
		detail(err, "old DB handle rejected");
	}
    
    // open db1 a second time (so now there's two db handles for db1)
    DbHandle db1b = ss.decodeDb(db1.dbId, &nullCred, dbBlob);
    
    // release both db1 handles and db2
    ss.releaseDb(db1a);
    ss.releaseDb(db1b);
    ss.releaseDb(db2);
}