Exemplo n.º 1
0
Arquivo: MSN.cpp Projeto: ModeenF/Caya
void MSNP::closingConnection(MSN::Connection* conn)
{
	// TODO there should be a class that provide those
	// strings, also in prevision of the localization support
	if (conn->sock == fMainConnection->sock) {
		BString content(fUsername.c_str());
		content << " has logged out!";
		_Notify(B_INFORMATION_NOTIFICATION, "Disconnected",
			content.String());
	}

	printf ("MSNP::closingConnection : connection with socket %d\n", (int)conn->sock);
	int x;
	int count = 0;
	count = fSwitchboardList.CountItems();
	// TODO use libmsn methods to retrieve the switchboard
	if (count != 0) {
		for (x = 0; x < count; x++) {
			if (fSwitchboardList.ItemAt(x)->second->sock == conn->sock) {
				fSwitchboardList.RemoveItemAt(x);
				break;
			}
		}
	}
}
Exemplo n.º 2
0
void
CaptureView::KeyDown(const char* bytes, int32 numBytes)
{
	if ((::modifiers() & (B_CONTROL_KEY | B_SHIFT_KEY | B_OPTION_KEY
			| B_COMMAND_KEY)) != (B_COMMAND_KEY | B_CONTROL_KEY))
		return;

	uint32 location = kNowhere;

	switch (bytes[0]) {
		case '1':
			location = kLeftEdge;
			break;
		case '2':
			location = kRightEdge;
			break;
		case '3':
			location = kTopEdge;
			break;
		case '4':
			location = kBottomEdge;
			break;
	}

	if (location != kNowhere)
		_Notify(location, _CurrentTeam());
}
Exemplo n.º 3
0
void
CaptureView::MouseMoved(BPoint point, uint32 transit,
	const BMessage* dragMessage)
{
	ConvertToScreen(&point);

	if (fMovedOutWhat != 0 && !fMovedOutFrame.Contains(point))
		_SendMovedOutNotification();

	uint32 modifiers = ::modifiers();
	if ((modifiers & fModifierMask) == 0) {
		_UpdateLast(point);
		return;
	}

	// TODO: we will need to iterate over all existing screens to find the
	// right one!
	BScreen screen;
	BRect screenFrame = screen.Frame();

	uint32 location = kNowhere;
	if (point.x <= screenFrame.left && fLastPoint.x > screenFrame.left)
		location = kLeftEdge;
	else if (point.x >= screenFrame.right && fLastPoint.x < screenFrame.right)
		location = kRightEdge;
	else if (point.y <= screenFrame.top && fLastPoint.y > screenFrame.top)
		location = kTopEdge;
	else if (point.y >= screenFrame.bottom && fLastPoint.y < screenFrame.bottom)
		location = kBottomEdge;

	if (location != kNowhere)
		_Notify(location, fLastTeam);

	_UpdateLast(point);
}
Exemplo n.º 4
0
status_t
AIMProtocol::LogOff()
{
	fOnline = false;
	imcomm_delete_handle_now(fIMCommHandle);
	BString content(fUsername);
	content << " has logged out!";
	_Notify(B_INFORMATION_NOTIFICATION, "Disconnected",
			content.String());

	return B_OK;
}
Exemplo n.º 5
0
	virtual status_t Delete(AttributeHandlerContext* context)
	{
		// notify if not done yet
		status_t error = _Notify(context);

		// notify done
		if (error == B_OK)
			error = context->packageContentHandler->HandleEntryDone(&fEntry);
		else
			context->packageContentHandler->HandleEntryDone(&fEntry);

		delete this;
		return error;
	}
Exemplo n.º 6
0
status_t
AIMProtocol::A_LogOn()
{
    int ret = imcomm_im_signon(fIMCommHandle, fUsername, fPassword);
    if (ret == IMCOMM_RET_OK) {
		fIMCommThread = spawn_thread(WaitForData, "imcomm receiver",
			B_LOW_PRIORITY, this);
		resume_thread(fIMCommThread);

		BString content(fUsername);
		content << " has logged in!";
		_Notify(B_INFORMATION_NOTIFICATION, "Connected",
		content.String());

		fOnline = true;

		return B_OK;
	}

	return B_ERROR;
}
Exemplo n.º 7
0
Arquivo: MSN.cpp Projeto: ModeenF/Caya
void MSNP::connectionReady(MSN::Connection * conn)
{
	fLogged = true;

	BMessage msg(IM_MESSAGE);
	msg.AddInt32("im_what", IM_OWN_STATUS_SET);
	msg.AddString("protocol", kProtocolSignature);
	msg.AddInt32("status", CAYA_ONLINE);
	fServerMsgr->SendMessage(&msg);

	BMessage serverBased(IM_MESSAGE);
	serverBased.AddInt32("im_what", IM_CONTACT_LIST);
	serverBased.AddString("protocol", kProtocolSignature);

	int end = fBuddyList.CountItems();
	int x;
	for (x=0; x != end; x++) {
		MSN::Buddy contact = fBuddyList.ItemAt(x);
		if (contact.lists & MSN::LST_AL) {
			serverBased.AddString("id", contact.userName.c_str());
		}
	}
	fServerMsgr->SendMessage(&serverBased);

	for (x=0; x != end; x++) {
		MSN::Buddy contact = fBuddyList.ItemAt(x);
		if (contact.lists & MSN::LST_AL) {
			SendContactInfo(contact);
		}
	}

	BString content(fUsername.c_str());
	content << " has logged in!";
	_Notify(B_INFORMATION_NOTIFICATION, "Connected",
		content.String());

	fMainConnection->setState(MSN::STATUS_AVAILABLE, fClientID);
}
Exemplo n.º 8
0
status_t
MediaWindow::_InitMedia(bool first)
{
	status_t err = B_OK;
	BMediaRoster* roster = BMediaRoster::Roster(&err);

	if (first && err != B_OK) {
		BAlert* alert = new BAlert("start_media_server",
			B_TRANSLATE("Could not connect to the media server.\n"
				"Would you like to start it ?"),
			B_TRANSLATE("Quit"),
			B_TRANSLATE("Start media server"), NULL,
			B_WIDTH_AS_USUAL, B_WARNING_ALERT);
		alert->SetShortcut(0, B_ESCAPE);
		if (alert->Go() == 0)
			return B_ERROR;

		_Notify(0, B_TRANSLATE("Starting media server" B_UTF8_ELLIPSIS));

		Show();

		launch_media_server();
	}

	Lock();

	bool isVideoSelected = true;
	if (!first && fListView->ItemAt(0) != NULL
		&& fListView->ItemAt(0)->IsSelected())
		isVideoSelected = false;

	if (!first || (first && err) )
		_Notify(1, B_TRANSLATE("Ready for use" B_UTF8_ELLIPSIS));

	while (fListView->CountItems() > 0)
		delete fListView->RemoveItem((int32)0);
	_EmptyNodeLists();

	// Grab Media Info
	_FindNodes();

	// Add video nodes first. They might have an additional audio
	// output or input, but still should be listed as video node.
	_AddNodeItems(fVideoOutputs, MediaListItem::VIDEO_TYPE);
	_AddNodeItems(fVideoInputs, MediaListItem::VIDEO_TYPE);
	_AddNodeItems(fAudioOutputs, MediaListItem::AUDIO_TYPE);
	_AddNodeItems(fAudioInputs, MediaListItem::AUDIO_TYPE);

	fAudioView->AddOutputNodes(fAudioOutputs);
	fAudioView->AddInputNodes(fAudioInputs);
	fVideoView->AddOutputNodes(fVideoOutputs);
	fVideoView->AddInputNodes(fVideoInputs);

	// build our list view
	DeviceListItem* audio = new DeviceListItem(B_TRANSLATE("Audio settings"),
		MediaListItem::AUDIO_TYPE);
	fListView->AddItem(audio);

	MidiListItem* midi = new MidiListItem(B_TRANSLATE("MIDI Settings"));
	fListView->AddItem(midi);

	MediaListItem* video = new DeviceListItem(B_TRANSLATE("Video settings"),
		MediaListItem::VIDEO_TYPE);
	fListView->AddItem(video);

	MediaListItem* mixer = new AudioMixerListItem(B_TRANSLATE("Audio mixer"));
	fListView->AddItem(mixer);

	fListView->SortItems(&MediaListItem::Compare);
	_UpdateListViewMinWidth();

	// Set default nodes for our setting views
	media_node defaultNode;
	dormant_node_info nodeInfo;
	int32 outputID;
	BString outputName;

	if (roster->GetAudioInput(&defaultNode) == B_OK) {
		roster->GetDormantNodeFor(defaultNode, &nodeInfo);
		fAudioView->SetDefaultInput(&nodeInfo);
			// this causes our listview to be updated as well
	}

	if (roster->GetAudioOutput(&defaultNode, &outputID, &outputName) == B_OK) {
		roster->GetDormantNodeFor(defaultNode, &nodeInfo);
		fAudioView->SetDefaultOutput(&nodeInfo);
		fAudioView->SetDefaultChannel(outputID);
			// this causes our listview to be updated as well
	}

	if (roster->GetVideoInput(&defaultNode) == B_OK) {
		roster->GetDormantNodeFor(defaultNode, &nodeInfo);
		fVideoView->SetDefaultInput(&nodeInfo);
			// this causes our listview to be updated as well
	}

	if (roster->GetVideoOutput(&defaultNode) == B_OK) {
		roster->GetDormantNodeFor(defaultNode, &nodeInfo);
		fVideoView->SetDefaultOutput(&nodeInfo);
			// this causes our listview to be updated as well
	}

	if (first)
		fListView->Select(fListView->IndexOf(mixer));
	else if (isVideoSelected)
		fListView->Select(fListView->IndexOf(video));
	else
		fListView->Select(fListView->IndexOf(audio));

	Unlock();

	return B_OK;
}
Exemplo n.º 9
0
void
MediaWindow::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case ML_INIT_MEDIA:
			_InitMedia(false);
			break;
		case ML_RESTART_MEDIA_SERVER:
		{
			thread_id thread = spawn_thread(&MediaWindow::_RestartMediaServices,
				"restart_thread", B_NORMAL_PRIORITY, this);
			if (thread < 0)
				fprintf(stderr, "couldn't create restart thread\n");
			else
				resume_thread(thread);
			break;
		}
		case B_MEDIA_WEB_CHANGED:
		case ML_SELECTED_NODE:
		{
			PRINT_OBJECT(*message);

			MediaListItem* item = static_cast<MediaListItem*>(
					fListView->ItemAt(fListView->CurrentSelection()));
			if (item == NULL)
				break;

			fCurrentNode.SetTo(NULL);
			_ClearParamView();
			item->AlterWindow(this);
			break;
		}
		case B_SOME_APP_LAUNCHED:
		{
			PRINT_OBJECT(*message);

			BString mimeSig;
			if (message->FindString("be:signature", &mimeSig) == B_OK
				&& (mimeSig == "application/x-vnd.Be.addon-host"
					|| mimeSig == "application/x-vnd.Be.media-server")) {
				_Notify(0.75, B_TRANSLATE("Starting media server"
					B_UTF8_ELLIPSIS));
			}
			break;
		}
		case B_SOME_APP_QUIT:
		{
			PRINT_OBJECT(*message);
			BString mimeSig;
			if (message->FindString("be:signature", &mimeSig) == B_OK) {
				if (mimeSig == "application/x-vnd.Be.addon-host"
					|| mimeSig == "application/x-vnd.Be.media-server") {
					BMediaRoster* roster = BMediaRoster::CurrentRoster();
					if (roster != NULL && roster->Lock())
						roster->Quit();
				}
			}
			break;
		}
		default:
			BWindow::MessageReceived(message);
			break;
	}
}
Exemplo n.º 10
0
BOOL CLocalFileDownload::Fetch( INT nCorrurent/*=0*/ )
{
	m_bStopped = FALSE;
	
	try
	{
		CFileInStream fin(m_strUrl);
		if(!fin.Create())
		{
			m_errCode = DLLER_SERVER_FILENOTFOUND;
			return FALSE;
		}

		CString strTmpFile;
		strTmpFile.Format(_T("%s%s"), m_strFilePath, _T(".tc"));
		CAtlFile file;	
		if( FAILED( file.Create(strTmpFile, GENERIC_WRITE, FILE_SHARE_WRITE, CREATE_ALWAYS) ) )
		{
			m_errCode = DLERR_CREATEFILE;
			return FALSE;
		}
		
		m_errCode = DLERR_SUCCESS;
		m_FileInfo.Reset(fin.GetFileSize(), 0, TRUE);
		m_DownStat.OnDownBegin();
		
		int64 lastDownloaded = 0, downloadedPercent = m_FileInfo.fileSize/100;

		const int nBufferSize = 1024;
		BYTE *pBuffer = new BYTE[nBufferSize];
		while(!m_bStopped)
		{
			DWORD dwReaded = 0;
			fin.Read(pBuffer, nBufferSize, &dwReaded);
			if(dwReaded==0)
				break;
			
			DWORD dwWrited = 0;
			if( FAILED(file.Write(pBuffer, dwReaded, &dwWrited)) || dwWrited!=dwReaded)
			{
				m_errCode = DLERR_WRITEFILE;
				break;
			}

			m_FileInfo.fileDownloaded += dwReaded;			
			if((m_FileInfo.fileDownloaded-lastDownloaded) > downloadedPercent)
			{
				m_DownStat.OnDownData(GetTickCount(), (m_FileInfo.fileDownloaded-lastDownloaded));
				lastDownloaded = m_FileInfo.fileDownloaded;
				_Notify(ProcessState_ReceiveData);
			}
		}
		fin.CloseFile();
		file.Close();
		SAFE_DELETE_ARRAY(pBuffer);
		m_DownStat.OnDownEnd();
		
		if(m_FileInfo.fileDownloaded==m_FileInfo.fileSize)
		{
			MoveFileEx(strTmpFile, m_strFilePath, MOVEFILE_REPLACE_EXISTING);
			m_errCode = DLERR_SUCCESS;
		}
		else
		{
			DeleteFile(strTmpFile);
			m_errCode = DLLER_NETWORK;
		}
	}
	catch (...)
	{
		m_errCode = DLERR_WRITEFILE;
	}
	return DLERR_SUCCESS==m_errCode;
}
Exemplo n.º 11
0
ProcessState CDownload::_StartSegments( CRequestPool &request_pool, CHttpAsyncInPtr http )
{
	ProcessState state = ProcessState_Idle;
	CString		strTmpFile = m_strFilePath + DOWNLOAD_TEMP_FILE_SUFFIX;
	CString		strTmpInfoFile = m_strFilePath + DOWNLOAD_TEMP_FILE_INFO_SUFFIX;
	
	// 防止 _kt & _kti 文件不同时存在 
	if(PathFileExists(strTmpInfoFile) && !PathFileExists(strTmpFile))
	{
		DeleteFile(strTmpFile);
		DeleteFile(strTmpInfoFile);
	}
	
	CSegmentPool segment_pool(m_strFilePath);
	m_FileInfo = http->GetRemoteFileInfo();
	m_FileInfo.fileDownloaded = segment_pool.Init(m_FileInfo, m_nCocurrent);
	MYTRACE(_T("BeginDownload :%s -> %s (%I64d Bytes / %I64d )\r\n"), m_locationPool.GetMainUrl(), m_strFilePath, m_FileInfo.fileDownloaded, m_FileInfo.fileSize);
	

	if(m_FileInfo.fileDownloaded==0 && PathFileExists(strTmpFile))
	{
		DeleteFile(strTmpFile);
		DeleteFile(strTmpInfoFile);
	}
	
	CFileStream fs(strTmpFile);	
	if (!fs.Create())
	{
		MYTRACE(_T("Create File Error : %s\r\n"), m_strFilePath);
		m_errCode = DLERR_CREATEFILE;
		state = ProcessState_Failed;
	}
	else
	{
		if (m_FileInfo.fileSize > 0)
			fs.SetLength(m_FileInfo.fileSize);

		// run all segements 
		BOOL first = TRUE;
		for(int i=0; i<m_nCocurrent; ++i)
		{
			SegmentPtr s = NULL;
			if(first)
			{
				s = segment_pool.GetNextSegment(NULL);
				if(!s) break;

				s->instream = http;
				if(s->currentposition>0)
					s->instream->OpenRange(s->currentposition, s->endposition);
				else if(s->endposition>0) // 
					s->instream->ModifyRange(0, s->endposition);
				s->instream->SetFileSizeExpect(m_FileInfo.fileSize);
				first = FALSE;
			}
			else
			{
				CString strUrl;
				if( !m_locationPool.Get(strUrl) )
					break;
				else
				{
					UrlInfo urlinfo;
					CrackUrl(strUrl, urlinfo);

					s = segment_pool.GetNextSegment(NULL);
					if(!s) break;

					CHttpAsyncInPtr h = request_pool.Get();
					h->Open(&urlinfo, s->currentposition, s->endposition, m_FileInfo.fileSize);
					s->instream = h;
				}
			}
			if( s )
				segment_pool.NotifySegmentToRunning(s); 
		}

		if(first)
		{
			state = ProcessState_Finished;
		}
		else
		{
			// read and run 
			m_downStat.OnDownBegin();
			m_dwTmLastDownloadProgess = GetTickCount();
			m_iInitialDownloaded = m_FileInfo.fileDownloaded;

			INT nTriesFromNoData = 0;
			DWORD dwLastFailStartTime = m_dwTmLastDownloadProgess;
			HANDLE *hWaits = new HANDLE[1+m_nCocurrent];			
			while(segment_pool.hasRunning() || segment_pool.hasQueuing()) 
			{
				ZeroMemory( hWaits, sizeof(HANDLE)*(1+m_nCocurrent) );
				hWaits[0] = m_hStopEvent;

				SegmentPtrs &runnings = segment_pool.GetRunningSegments();
				for(size_t i=0; i<runnings.size(); ++i)
				{
					ATLASSERT(runnings[i]->instream->GetWaitHandle());
					hWaits[i+1] = runnings[i]->instream->GetWaitHandle();
				}
				DWORD dwWaitRet = WAIT_FAILED;
				//dwWaitRet = WaitForMultipleObjects(1+runnings.size(), hWaits, FALSE, INFINITE);
				dwWaitRet = WaitForMultipleObjects(1+runnings.size(), hWaits, FALSE, 1000);	// 1s for start failed segments !! 

				DWORD dwTimeNow = GetTickCount();
				m_downStat.OnDownData(dwTimeNow, 0);


				BOOL bSegmentIsDone = FALSE;
				if (WAIT_FAILED == dwWaitRet )
				{
					m_errCode = DLERR_INTERNAL;
					state = ProcessState_Failed;
					break;
				}
				else if (WAIT_OBJECT_0 == dwWaitRet)
				{
					state = ProcessState_UserCanceled;
					m_errCode = DLLER_USER_CANCEL;
					break;
				}
				else if (WAIT_TIMEOUT == dwWaitRet)
				{
					;
				}
				else
				{
					BOOL bGotData = FALSE;
					int ret = _ProcessSegment(request_pool, segment_pool, dwWaitRet, fs, bGotData );
					if(ret<0)
						state = ProcessState_Failed;
					else if(ret>0)
						bSegmentIsDone = TRUE;
					if(bGotData) // Reset on received data  
						nTriesFromNoData = 0;
				}

				if( (dwTimeNow-m_dwTmLastDownloadProgess)>DOWNLOAD_PROGRESS_REPORT_INTERVAL )
				{
					_Notify(ProcessState_ReceiveData);
					m_dwTmLastDownloadProgess = dwTimeNow;
				}

				// Restart error !! 
				if((dwTimeNow-dwLastFailStartTime)>DOWNLOAD_FAIL_RETRY_INTERVAL)
				{
					if(segment_pool.GetRunningSegments().size()<m_nCocurrent && segment_pool.hasQueuing())
					{
						dwLastFailStartTime = dwTimeNow;
						CString strUrl;
						if( m_locationPool.Get(strUrl) )
						{
							UrlInfo urlinfo;
							CrackUrl(strUrl, urlinfo);
							SegmentPtr s = segment_pool.GetNextSegment(NULL);
							if(s)
							{
								CHttpAsyncInPtr h = request_pool.Get();
								h->Open(&urlinfo, s->currentposition, s->endposition, m_FileInfo.fileSize);
								s->instream = h;
								segment_pool.NotifySegmentToRunning(s);
							}
						}							
						++ nTriesFromNoData;

					}
				}

				// check if all parts is done
				if(bSegmentIsDone && !segment_pool.hasRunning())
				{
					if(segment_pool.hasQueuing())
					{
						MYTRACE(_T("- All Parts Finished, %d Segments Failed, reach max try '%d' \r\n"), segment_pool.GetQueueSegments().size(), nTriesFromNoData);						
						if(nTriesFromNoData>DOWNLOAD_MAINURL_MAXRETYR)
						{
							state = ProcessState_Failed;
							m_errCode = DLLER_SEGENT_ERROR;
							break;
						}
					}
					else
					{
						MYTRACE(_T("- All Parts Finished \r\n"));
						state = ProcessState_Finished;
						break;
					}
				}
			}
			SAFE_DELETE_ARRAY(hWaits);
		}
		fs.CloseFile();
		//
		if(state==ProcessState_Finished)
		{
			CSegmentInfoFile(m_strFilePath).Unlink();
			MoveFileEx(m_strFilePath + DOWNLOAD_TEMP_FILE_SUFFIX, m_strFilePath, MOVEFILE_REPLACE_EXISTING);
		}
		else if(m_FileInfo.fileSize>0)
			CSegmentInfoFile(m_strFilePath).Save(m_FileInfo.fileSize, m_FileInfo.fileDownloaded, segment_pool.GetSegments());	
	}
	request_pool.Cleanup();
	m_downStat.OnDownEnd();
	return state;
}
Exemplo n.º 12
0
unsigned int CDownload::_RunThreadFun_()
{
	CRequestPool request_pool;
	CPubConfig::T_ProxySetting proxyconfig;
	CPubConfig pubconfig;
	pubconfig.LoadProxyConfig(proxyconfig);
	request_pool.SetProxyConfig(proxyconfig);

	CString strUrl = m_locationPool.GetMainUrl();
	UrlInfo urlinfo;
	CrackUrl( strUrl, urlinfo );
	
	CHttpAsyncInPtr http = request_pool.Get();
	m_state = ProcessState_Idle;
	if (http->Open(&urlinfo))
	{
		while(TRUE)
		{
			HANDLE hWaits[2] = {m_hStopEvent, http->GetWaitHandle()};
			DWORD dwWaitRet = WAIT_FAILED;
			dwWaitRet = WaitForMultipleObjects(2, hWaits, FALSE, INFINITE);
			
			if (WAIT_FAILED == dwWaitRet )
			{
				m_state = ProcessState_Failed;
				m_errCode = DLLER_INTERNAL_WAIT_OBJ;
				break;
			}
			else if (WAIT_OBJECT_0 == dwWaitRet)
			{
				m_state = ProcessState_UserCanceled;
				m_errCode = DLLER_USER_CANCEL;
				break;
			}
			else if (WAIT_TIMEOUT == dwWaitRet)
			{
				// check running queue each second !!!! 
				// start failed segment !!! if has valid main url !!! 
				//TODO
				;
			}
			else
			{
				EAsyncInState st = http->Process();
				if(st==EAsync_Finished||st==EAsync_Failed)
				{
					m_state = ProcessState_Failed;
					m_errCode = DLLER_SERVER_FILENOTFOUND;
					break;
				}
				else if(st==EAsync_Opened)
				{
					m_state = ProcessState_BeginReceiveData;
					break;
				}
			}
		}
		
		// 开始分批下载 
		if (ProcessState_BeginReceiveData == m_state)
		{
			m_state = _StartSegments(request_pool, http);
		}
	}
	request_pool.Cleanup();

#ifdef _DEBUG
	CString strCheckSum;
	try
	{
		strCheckSum = CMD5Checksum::GetMD5( m_strFilePath );
	}
	catch (...)
	{
		strCheckSum = _T("ERROR");
		m_errCode = DLLER_INTERNAL_CHECKMD5;
	}
	MYTRACE(_T("DOWNLOAD %s -> %s [%s] : %d - Downloaded/Content-Length: %I64d/%I64d  AvSpeed:%I64d(CO:%d) TimeUsed:%d\r\n"), 
		m_locationPool.m_strMainUrl, m_strFilePath, strCheckSum \
		, m_state, m_FileInfo.fileDownloaded-m_iInitialDownloaded, m_FileInfo.fileSize, m_downStat.AverageSpeed(), m_nCocurrent, m_downStat.TimeUsed());
#endif 

	_Notify( m_state );
	return 0;
}
Exemplo n.º 13
0
	virtual status_t HandleAttribute(AttributeHandlerContext* context,
		uint8 id, const AttributeValue& value, AttributeHandler** _handler)
	{
		switch (id) {
			case B_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY:
			{
				status_t error = _Notify(context);
				if (error != B_OK)
					return error;

//TRACE("%*sentry \"%s\"\n", fLevel * 2, "", value.string);
				if (_handler != NULL) {
					return EntryAttributeHandler::Create(context, &fEntry,
						value.string, *_handler);
				}
				return B_OK;
			}

			case B_HPKG_ATTRIBUTE_ID_FILE_TYPE:
				return _SetFileType(context, value.unsignedInt);

			case B_HPKG_ATTRIBUTE_ID_FILE_PERMISSIONS:
				fEntry.SetPermissions(value.unsignedInt);
				return B_OK;

			case B_HPKG_ATTRIBUTE_ID_FILE_USER:
			case B_HPKG_ATTRIBUTE_ID_FILE_GROUP:
				// TODO:...
				break;

			case B_HPKG_ATTRIBUTE_ID_FILE_ATIME:
				fEntry.SetAccessTime(value.unsignedInt);
				return B_OK;

			case B_HPKG_ATTRIBUTE_ID_FILE_MTIME:
				fEntry.SetModifiedTime(value.unsignedInt);
				return B_OK;

			case B_HPKG_ATTRIBUTE_ID_FILE_CRTIME:
				fEntry.SetCreationTime(value.unsignedInt);
				return B_OK;

			case B_HPKG_ATTRIBUTE_ID_FILE_ATIME_NANOS:
				fEntry.SetAccessTimeNanos(value.unsignedInt);
				return B_OK;

			case B_HPKG_ATTRIBUTE_ID_FILE_MTIME_NANOS:
				fEntry.SetModifiedTimeNanos(value.unsignedInt);
				return B_OK;

			case B_HPKG_ATTRIBUTE_ID_FILE_CRTIM_NANOS:
				fEntry.SetCreationTimeNanos(value.unsignedInt);
				return B_OK;

			case B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE:
			{
				status_t error = _Notify(context);
				if (error != B_OK)
					return error;

				if (_handler != NULL) {
					*_handler = new(std::nothrow) AttributeAttributeHandler(
						&fEntry, value.string);
					if (*_handler == NULL)
						return B_NO_MEMORY;
					return B_OK;
				} else {
					BPackageEntryAttribute attribute(value.string);
					return context->packageContentHandler->HandleEntryAttribute(
						&fEntry, &attribute);
				}
			}

			case B_HPKG_ATTRIBUTE_ID_DATA:
				return set_package_data_from_attribute_value(value,
					fEntry.Data());

			case B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH:
				fEntry.SetSymlinkPath(value.string);
				return B_OK;
		}

		return AttributeHandler::HandleAttribute(context, id, value, _handler);
	}