Example #1
0
void CUserMeetingDlg::OnCancel()
{
	if (AfxMessageBox(IDS_QUITPROMPT, MB_OKCANCEL | MB_ICONQUESTION | MB_DEFBUTTON2) != IDOK) return;
	
	CXMLElement* pXML = new CXMLElement( NULL, ISyncDataView );
	pXML->AddAttribute( "method", "update" );
	
	CXMLElement* pSync = pXML->AddElement( "table_name" );
	pSync->SetValue( "xmeetingroomlist" );
	
	pSync = pXML->AddElement( "column_name" );
	pSync->SetValue( "set xmeetingused = '0'" );
	
	CString str;
	str.Format( "xmeetingroomfee = '%s'", Network.m_xUserId );
	
	pSync = pXML->AddElement( "search_condition" );
	pSync->SetValue( (LPCTSTR)str );
	
	Network.SendPacket( new CSyncDataView( pXML ) );
	delete pXML;
#if 1
	pXML = new CXMLElement( NULL, ISyncHostFile );
	pXML->AddAttribute( "method", "bye" );
	
	Network.SendPacket( new CSyncHostFile(pXML) );
	delete pXML;
#endif
	
	CDialog::OnCancel();
}
Example #2
0
void CMonitorWnd::JoinMonitor(BOOL bJoined)
{
	CXMLElement* pXML = new CXMLElement( NULL, ISyncOrderRelation );
	pXML->AddAttribute( "method", "monitor" );
	
	if ( ! bJoined ) pXML->AddAttribute( "leave" );
	
	Network.SendPacket( new CSyncOrderRelation(pXML) );
	delete pXML;
}
Example #3
0
void CUserMeetingDlg::OnOK()
{
	CXMLElement* pXML = new CXMLElement( NULL, ISyncDataView );
	pXML->AddAttribute( "method", "update" );
	
	CXMLElement* pSync = pXML->AddElement( "table_name" );
	pSync->SetValue( "xmeetingroomlist" );
	
	CString str;
	str.Format( "set xmeetingused = '1', xmeetingroomfee = '%s'", Network.m_xUserId );
	
	pSync = pXML->AddElement( "column_name" );
	pSync->SetValue( (LPCTSTR)str );
#if 0
	str.Format( "xmeetingroomcode in (select top 1 xmeetingroomcode"
		" from xmeetingroomlist where xmeetingused!='1' and xmeetingroomcode"
		" not in (select xmeetingroomcode from xmeetingroom))" );
#else
	str.Format( "xmeetingroomcode in (select top 1 xmeetingroomcode"
		" from xmeetingroomlist where xmeetingused!='1')" );
#endif
	
	pSync = pXML->AddElement( "search_condition" );
	pSync->SetValue( (LPCTSTR)str );
	
	Network.SendPacket( new CSyncDataView( pXML ) );
	delete pXML;
#if 0
	pXML = new CXMLElement( NULL, ISyncHostFile );
	pXML->AddAttribute( "method", "meeting" );
	
	Network.SendPacket( new CSyncHostFile( pXML ) );
	delete pXML;
#else
	pXML = new CXMLElement( NULL, ISyncHostFile );
	pXML->AddAttribute( "method", "talk" );
	
	Network.SendPacket( new CSyncHostFile(pXML) );
	delete pXML;
#endif
	GetDlgItem( IDOK )->EnableWindow( FALSE );
	
	CGraphRender*& pRenderer = m_pRenderer;
	if ( ! pRenderer ) pRenderer = new CGraphRender( Network.m_xUserId );
	
	CDatagrams* pDatagram = Datagrams.SeekNext(Payload_Alaw);
	pRenderer->RenderPreview( PreviewPayload(PayloadMask_Audio), NULL, (DWORD)pDatagram );
	
	SetTimer( 1, 6000, NULL );
	PostMessage( WM_TIMER, 1 );
}
Example #4
0
CXMLElement* CPlayerWnd::CreateXML()
{
	WORD nVersion[4];
	theApp.GetVersionNumber( nVersion );
	
	CString strVersion;
	strVersion.Format( _T("%i.%i.%i.%i"),
		nVersion[0], nVersion[1], nVersion[2], nVersion[3] );
	
	CXMLElement* pXML = new CXMLElement( NULL, _T("CallCenter") );
	pXML->AddAttribute( _T("Author"), _T("Honglt") );
	pXML->AddAttribute( _T("Version"), strVersion );
	
	return pXML;
}
Example #5
0
BOOL CChannel::JoinTalk(LPCTSTR xRemoteId, LPCTSTR xCallerId)
{
	ASSERT( IsConnected() );
	
	CXMLElement* pXML = new CXMLElement( NULL, ISyncHostLink );
	pXML->AddAttribute( "method", "dial" );
	
	CXMLElement* pSync = pXML->AddElement( "RemoteId" );
	pSync->SetValue( xRemoteId );
	
	if ( xCallerId && _tcslen(xCallerId) )
	{
		pSync = pXML->AddElement( "CallerId" );
		pSync->SetValue( xCallerId );
	}
	
	SendPacket( new CSyncHostLink(pXML) );
	delete pXML;
	
	m_bNavigated = TRUE;
	m_tNavigated = GetTickCount();

	CopyMemory( m_xCallType, CA_TALK, MAX_CALLTYPE );
	
	return TRUE;
}
Example #6
0
void CGroupingDlg::OnSyncOrderRelation()
{
	CXMLElement* pXML = new CXMLElement( NULL, ISyncDataView );
	pXML->AddAttribute( "method", "select" );
	
	CXMLElement* pSync = pXML->AddElement( "column_expression" );
	pSync->SetValue( "a.xphone, a.xname, a.xgroupnum, b.xgroupname" );
	
	pSync = pXML->AddElement( "table_name" );
	pSync->SetValue( "from xphonemeetinggroupmore a"
		" inner join xphonemeetinggroup b on a.xjsjbh=b.xjsjbh"
			" and a.xgroupnum=b.xgroupnum" );
	
	CString str;
	str.Format( "a.xjsjbh in (select xjsjbh from xuser_info "
				"where xphone = '%s')", Network.m_xUserId );
	
	pSync = pXML->AddElement( "search_condition" );
	pSync->SetValue( (LPCTSTR)str );
	
	Network.SendPacket( new CSyncDataView(pXML) );
	delete pXML; pXML = NULL;
	
	if ( ! Network.CallWorker( &pXML, INFINITE ) )
	{
		OnSyncDataViewResp( pXML );
		//pXML->Delete();
	}
}
Example #7
0
BOOL CGroupingDlg::CreateGroup(LPCTSTR lpszName, CXMLElement* pParent)
{
	CXMLElement* pXML = new CXMLElement( NULL, ISyncDataView );
	pXML->AddAttribute( "method", "insert into" );
	
	CXMLElement* pSync = pXML->AddElement( "table_name" );
	pSync->SetValue( "xphonemeetinggroup" );
	
	CString str;
	str.Format( "(xjsjbh, xgroupnum, xgroupname)"
				" select a.xjsjbh, isnull(max(b.xgroupnum),0)+1, '%s' from xuser_info a"
				" left join xphonemeetinggroup b on b.xjsjbh = a.xjsjbh"
				" where a.xphone='%s'"
#if 0
				" group by a.xjsjbh", lpszName, Network.m_xUserId );
#else
				" and '%s' not in (select xgroupname from xphonemeetinggroup"
					" where xjsjbh in (select xjsjbh from xuser_info where xphone='%s'))"
				" group by a.xjsjbh", lpszName, Network.m_xUserId, lpszName, Network.m_xUserId );
#endif
	
	pSync = pXML->AddElement( "column_name" );
	pSync->SetValue( (LPCTSTR)str );
	
	Network.SendPacket( new CSyncDataView( pXML ) ); delete pXML;
	
	m_wndGroup.SetItemDataPtr( m_wndGroup.AddString( lpszName ), pParent );
	m_wndList.DeleteAllItems();
	
	return TRUE;
}
Example #8
0
BOOL CGroupingDlg::ProcessInsert(CXMLElement* pParent, LPCTSTR lpszMethod)
{
	CXMLElement* pXML = new CXMLElement( NULL, ISyncDataView );
	pXML->AddAttribute( "method", lpszMethod );
	
	CXMLElement* pSync = pXML->AddElement( "table_name" );
	pSync->SetValue( "xphonemeetinggroupmore" );
	
	CString str;
	str.Format( "(xjsjbh,xgroupnum,xphone,xname,xgrouprow)"
				" select a.xjsjbh,a.xgroupnum,'%s','%s',isnull(max(b.xgrouprow),0)+1"
				" from xphonemeetinggroup a"
				" left join xphonemeetinggroupmore b on b.xjsjbh=a.xjsjbh and a.xgroupnum=b.xgroupnum"
				" where a.xgroupname = '%s' and a.xjsjbh in"
					" (select xjsjbh from xuser_info where xphone='%s')"
				" group by a.xjsjbh,a.xgroupnum",
				pParent->GetAttributeValue( _T("xphone") ),
				pParent->GetAttributeValue( _T("xname") ),
				pParent->GetAttributeValue( _T("xgroupname") ),
				Network.m_xUserId );

	pSync = pXML->AddElement( "column_name" );
	pSync->SetValue( (LPCTSTR)str );
	
	Network.SendPacket( new CSyncDataView( pXML ) ); delete pXML;
	
	return TRUE;
}
Example #9
0
BOOL CGroupingDlg::ProcessUpdate(CXMLElement* pParent, LPCTSTR lpszMethod)
{
	CXMLElement* pXML = new CXMLElement( NULL, ISyncDataView );
	pXML->AddAttribute( "method", lpszMethod );
	
	CXMLElement* pSync = pXML->AddElement( "table_name" );
	pSync->SetValue( "xphonemeetinggroupmore" );
	
	CXMLElement* pMap = pParent->GetFirstElement();
	ASSERT( pMap != NULL );
	
	CString str;
	FormatUpdate( pMap, str );
	
	pSync = pXML->AddElement( "column_name" );
	pSync->SetValue( "set " + str );
	
	str.Format( "xjsjbh in (select xjsjbh from xuser_info"
				" where xphone='%s')", Network.m_xUserId );
	FormatMapping( pParent, str );
	
	pSync = pXML->AddElement( "search_condition" );
	pSync->SetValue( (LPCTSTR)str );
	
	Network.SendPacket( new CSyncDataView( pXML ) ); delete pXML;
	
	return TRUE;
}
Example #10
0
int WINAPI XLoginHost(LPCTSTR xUserId, LPCTSTR xPassword, BOOL bTestor)
{
	CSingleLock pLock( &Network.m_pSection, TRUE );
	
	CXMLElement* pXML = new CXMLElement( NULL, ISyncOrderRelation );
	pXML->AddAttribute( "method", "login" );
	
	if ( bTestor ) pXML->AddAttribute( "operator" );
	
	CXMLElement* pSync = pXML->AddElement( "UserId" );
	pSync->SetValue( xUserId );
	
	CString strValue;
	int nLength	= CalcHashBytes( strValue.GetBuffer(32), xPassword );
	strValue.ReleaseBuffer( nLength );
	
	pSync = pXML->AddElement( "Hashing" );
	pSync->SetValue( strValue );
	
	Network.SendPacket( new CSyncOrderRelation(pXML) );
	delete pXML; pXML = NULL;
	
	Network.SetUserId( xUserId );
	pLock.Unlock();
	
	int nResult = Network.CallWorker( &pXML );
	if ( ! nResult ) nResult = ParseMatch( pXML, "Welcome" );
	
	pXML->Delete();
	if ( nResult ) {XDisconnect(); return nResult;}
	
	// Datagrams
	
	SOCKADDR_IN	pHost;
	CopyMemory( &pHost, &Network.m_pHost, sizeof(pHost) );
	
	CDatagrams* pDatagram = &Datagrams;
	pHost.sin_port = pDatagram->m_pHost.sin_port;
	pDatagram->JoinMirror( &pHost, Network.m_xUserId );
	
	pDatagram = pDatagram->m_pNext;
	pHost.sin_port = pDatagram->m_pHost.sin_port;
	pDatagram->JoinMirror( &pHost, Network.m_xUserId );
	
	return nResult;
}
Example #11
0
BOOL CRelatedSearch::RunSearchForAlbum()
{
	if ( ! CanSearchForAlbum() ) return FALSE;
	CQuerySearchPtr pSearch = new CQuerySearch();
	pSearch->m_pSchema	= m_pSchema ? m_pSchema : SchemaCache.Get( CSchema::uriAudio );
	pSearch->m_pXML		= pSearch->m_pSchema->Instantiate();
	CXMLElement* pXML	= pSearch->m_pXML->AddElement( pSearch->m_pSchema->m_sSingular );
	pXML->AddAttribute( _T("album"), Tokenise( m_pXML->GetAttributeValue( _T("album") ) ) );
	return CQuerySearch::OpenWindow( pSearch ) != NULL;
}
Example #12
0
void CUserChannel::OnHandshake()
{
	CXMLElement* pXML = new CXMLElement( NULL, ISyncOrderRelation );
	pXML->AddAttribute( "method", "home" );
	
	SendPacket( new CSyncOrderRelation(pXML) );
	delete pXML; pXML = NULL;
	
	CChannel::OnHandshake();
}
BOOL CRelatedSearch::RunSearchForSeries()
{
	if ( ! CanSearchForSeries() ) return FALSE;
	CQuerySearch* pSearch = new CQuerySearch();
	pSearch->m_pSchema	= m_pSchema ? m_pSchema : SchemaCache.Get( CSchema::uriVideo );
	pSearch->m_pXML		= pSearch->m_pSchema->Instantiate();
	CXMLElement* pXML	= pSearch->m_pXML->AddElement( pSearch->m_pSchema->m_sSingular );
	pXML->AddAttribute( _T("series"), Tokenise( m_pXML->GetAttributeValue( _T("series") ) ) );
	return pSearch->OpenWindow() != NULL;
}
Example #14
0
void CGroupingDlg::AddMethod(CXMLElement* pXML, LPCTSTR pszMethod, CXMLElement* pXMLSwap)
{
	if ( ! m_pXMLMethod ) m_pXMLMethod = new CXMLElement;
	
	CXMLElement* pSync = m_pXMLMethod->AddElement( _T("SyncOrder") );
	pSync->AddAttribute( _T("method"), pszMethod );
	
	CXMLElement* pMap = pSync->AddElement( pXML->Clone() );
	if ( pXMLSwap ) pMap->AddElement( pXMLSwap );
}
void CFavouritesProfilePage::OnOK()
{
	UpdateData();

	if ( CXMLElement* pBookmarks = MyProfile.GetXML( _T("bookmarks"), TRUE ) )
	{
		pBookmarks->DeleteAllElements();

		for ( int nItem = 0 ; nItem < m_wndList.GetItemCount() ; nItem++ )
		{
			CXMLElement* pBookmark = pBookmarks->AddElement( _T("bookmark") );
			pBookmark->AddAttribute( _T("title"), m_wndList.GetItemText( nItem, 0 ) );
			pBookmark->AddAttribute( _T("url"), m_wndList.GetItemText( nItem, 1 ) );
		}

		if ( pBookmarks->GetElementCount() == 0 ) pBookmarks->Delete();
	}

	CSettingsPage::OnOK();
}
Example #16
0
void CChannel::OnDropped(int nError)
{
	CXMLElement* pXML = new CXMLElement( NULL, "FaultResp" );
	
	CString strValue;
	strValue.Format( "%i", nError );
	
	pXML->AddAttribute( "faultcode", strValue );
	theApp.m_pMainWnd->SendMessage( WM_SYNCNOTIFY, GetCurrentThreadId(), (LPARAM)pXML );
	
	delete pXML;
}
Example #17
0
void CUserMeetingDlg::OnTimer(UINT nIDEvent) 
{
	CXMLElement* pXML = new CXMLElement( NULL, ISyncDataView );
	pXML->AddAttribute( "method", "select" );
	
	CXMLElement* pSync = pXML->AddElement( "column_expression" );
	pSync->SetValue( "xmeetingphone, xmeetingphonestate=case"
					" when xmeetingphonestate='0' then '等待'"
					" when xmeetingphonestate='1' then '呼叫'"
					" when xmeetingphonestate='2' then '在线'"
					" else '其他' end" );
	
	pSync = pXML->AddElement( "table_name" );
	pSync->SetValue( "from xmeetingroom" );
	
	CString str;
	str.Format( "xmeetingroomcode=(select xmeetingroomcode"
		" from xmeetingroomlist where xmeetingroomfee='%s' and xmeetingused='1')", Network.m_xUserId );
	
	pSync = pXML->AddElement( "search_condition" );
	pSync->SetValue( (LPCTSTR)str );
	
	Network.SendPacket( new CSyncDataView(pXML) );
	delete pXML; pXML = NULL;
	
	if ( Network.CallWorker( &pXML, INFINITE ) ) return;
	
	int nItem = 0;
	POSITION posNext = pXML->GetElementIterator();
	for ( POSITION pos = posNext ; pos ; pos = posNext )
	{
		CXMLElement* pSync = pXML->GetNextElement( posNext );
		
		CString strDebug = pSync->GetAttributeValue( "xmeetingphone" );
		if ( m_wndList.GetItemText(nItem, 0).CompareNoCase( strDebug ) )
		{
			m_wndList.DeleteItem( nItem );
			posNext = pos; continue;
		}
		
		CString strValue = pSync->GetAttributeValue( "xmeetingphonestate" );
		m_wndList.SetItemText( nItem, 2, strValue );
		
		nItem++;
	}
	for ( ; nItem < m_wndList.GetItemCount(); nItem )
	{
		m_wndList.DeleteItem( nItem );
	}
	
	pXML->Delete();
}
Example #18
0
void CGroupingDlg::OnEndLabelEditList(LV_DISPINFO* pNotify, LRESULT* pResult)
{
	static LPCTSTR pszInfo[] = { _T("xphone"), _T("xname") };
	
	if ( pNotify->item.pszText && *pNotify->item.pszText )
	{
		m_wndList.SetItemText( pNotify->item.iItem, m_pHitInfo.iSubItem, pNotify->item.pszText );
		m_pEdit.UnsubclassWindow();
		
		CXMLElement* pXML = (CXMLElement*)pNotify->item.lParam; if ( ! pXML )
		{
			pXML = new CXMLElement( NULL, _T("SyncOrder") );
			pXML->AddAttribute( pszInfo[m_pHitInfo.iSubItem], pNotify->item.pszText );
			
			CString strValue;
			m_wndGroup.GetWindowText( strValue );
			
			strValue.TrimLeft(); strValue.TrimRight();
			ASSERT( ! strValue.IsEmpty() );
			
			pXML->AddAttribute( _T("xgroupname"), strValue );
			
			m_pXML->AddElement( pXML );
			AddMethod( pXML, METHOD_INSERT );
		}
		else
		{
			CXMLElement* pXMLSwap = new CXMLElement( NULL, _T("SyncOrder") );
			pXMLSwap->AddAttribute( pszInfo[m_pHitInfo.iSubItem], pNotify->item.pszText );
			
			AddMethod( pXML, METHOD_UPDATE, pXMLSwap );
			pXML->AddAttribute( pszInfo[m_pHitInfo.iSubItem], pNotify->item.pszText );
		}
		
		m_wndList.SetItemData( pNotify->item.iItem, (DWORD)pXML );
	}
	
	*pResult = 0;
}
Example #19
0
void CPlayProfilePage::OnAdd() 
{
	int nItem = m_wndList.GetNextItem( -1, LVNI_SELECTED );
	CXMLElement* pXML = ( nItem != -1 ) ? (CXMLElement*)m_wndList.GetItemData(nItem) : NULL;
	
	if ( pXML ) pXML = pXML->Clone();
	else pXML = new CXMLElement( NULL, _T("Album") );
	
	if ( pXML = m_pXML->AddElement( pXML ) )
	{
		CString strValue;
		m_wndClass.GetWindowText( strValue );
		
		pXML->SetName( strValue.CompareNoCase("子类") == 0 ? _T("Album") : _T("Play") );
		
		m_wndKey.GetWindowText( strValue );
		pXML->AddAttribute( _T("ID"), strValue );
		
		int nItem = m_wndList.InsertItem( LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, m_wndList.GetItemCount(),
			strValue, 0, 0, pXML->IsNamed( "Album" ) ? 23 : 24, (LPARAM)pXML );
		
		m_wndName.GetWindowText( strValue );
		pXML->AddAttribute( _T("Play"), strValue );
		m_wndList.SetItemText( nItem, 1, strValue );
		
		m_wndClass.GetWindowText( strValue );
		pXML->AddAttribute( _T("Class"), strValue );
		
		m_wndHost.GetWindowText( strValue );
		pXML->AddAttribute( _T("Host"), strValue );
		m_wndList.SetItemText( nItem, 2, strValue );
		
		m_wndAdmin.GetWindowText( strValue );
		pXML->AddAttribute( _T("Admin"), strValue );
		
		//m_wndGroup.GetWindowText( strValue );
		//pXML->AddAttribute( _T("Group"), strValue );
	}
}
Example #20
0
void CNetworkWnd::OnSyncOrderRelation()
{
	CXMLElement* pXML = new CXMLElement( NULL, ISyncOrderRelation );
	pXML->AddAttribute( "method", "home" );
	
	Network.SendPacket( new CSyncOrderRelation(pXML) );
	delete pXML; pXML = NULL;
	
	if ( ! Network.CallWorker( &pXML ) )
	{
		OnSyncOrderRelation( pXML );
		pXML->Delete();
	}
}
Example #21
0
BOOL CNetworkMonitorBox::ProcessXML(POSITION posNext)
{
	CXMLElement* pXML = Profiles.FindProcess( NULL, posNext );
	if ( pXML == NULL ) return FALSE;
	
	CSingleLock pLock( &Network.m_pSection, TRUE );
	
	CString strValue = pXML->GetAttributeValue( "Host" );
	
	if ( CChannel* pChannel = Network.FindChannel( strValue ) )
	{
		if ( pChannel->m_hSocket == INVALID_SOCKET && pChannel->TimeOut( 60 * 1000 ) ) 
		{
			CXMLAttribute* pAttri = pXML->GetAttribute( "Retry" );
			if ( ! pAttri ) pAttri = pXML->AddAttribute( "Retry" );
			
			if ( _ttoi( pAttri->GetValue() ) >= 2 )
			{
				AlarmToShortMessage( (LPCTSTR)strValue );
				strValue = pXML->GetAttributeValue( _T("Path") );
				RestartMachine( (LPCTSTR)strValue );
				
				pXML->DeleteAttribute( "Retry" );
			}
			else
			{
				strValue.Format( "%i", _ttoi( pAttri->GetValue() ) + 1 );
				pAttri->SetValue( (LPCTSTR)strValue );
				
				pChannel->LinkRestart();
				pChannel->m_tConnected	= GetTickCount();
			}
		}
		else
		if ( pChannel->IsConnected() )
		{
			pXML->DeleteAttribute( "Retry" );
		}
	}
	else
	{
		CChannel* pChannel = new CSentryChannel( pXML );
		Network.SetChannel( pChannel );
		
		pChannel->LinkRestart();
	}
	
	if ( posNext ) return ProcessXML( posNext );
	return TRUE;
}
Example #22
0
void CGProfile::Create()
{
	// Generate new Gnutella GUID
	Hashes::Guid tmp;
	VERIFY( SUCCEEDED( CoCreateGuid( reinterpret_cast< GUID* > ( &tmp[0] ) ) ) );

	VERIFY( tmp.validate() );
	oGUID = tmp;

	CXMLElement* pGnutella = m_pXML->GetElementByName( L"gnutella", TRUE );
	VERIFY( pGnutella->AddAttribute( L"guid", tmp.toString() ) );

	CreateBT();
}
Example #23
0
void CGProfile::CreateBT()
{
	// Convert Gnutella GUID (128 bits) to BitTorrent GUID (160 bits)
	Hashes::BtGuid tmp_bt;
	CopyMemory( &tmp_bt[0], &((Hashes::Guid)oGUID)[0], ((Hashes::Guid)oGUID).byteCount );
	for ( size_t nByte = ((Hashes::Guid)oGUID).byteCount; nByte < tmp_bt.byteCount; nByte++ )
		tmp_bt[ nByte ] = GetRandomNum( 0ui8, _UI8_MAX );

	VERIFY( tmp_bt.validate() );
	oGUIDBT = tmp_bt;

	CXMLElement* pBitTorrent = m_pXML->GetElementByName( L"bittorrent", TRUE );
	VERIFY( pBitTorrent->AddAttribute( L"guid", tmp_bt.toString() ) );
}
CG2Packet* CLocalSearch::AlbumToPacket(CAlbumFolder* pFolder)
{
	if ( pFolder == NULL ) return NULL;

	if ( pFolder->m_pSchema != NULL && pFolder->m_pSchema->m_bPrivate ) return NULL;
	if ( pFolder->GetSharedCount() == 0 ) return NULL;

	CG2Packet* pPacket = CG2Packet::New( "VF", TRUE );

	if ( pFolder->m_pSchema != NULL )
	{
		CXMLElement* pXML = pFolder->m_pSchema->Instantiate( TRUE );

		if ( pFolder->m_pXML != NULL )
		{
			pXML->AddElement( pFolder->m_pXML->Clone() );
		}
		else
		{
			CXMLElement* pBody = pXML->AddElement( pFolder->m_pSchema->m_sSingular );
			pBody->AddAttribute( pFolder->m_pSchema->GetFirstMemberName(), pFolder->m_sName );
		}

		CString strXML = pXML->ToString();
		delete pXML;

		pPacket->WritePacket( "MD", pPacket->GetStringLen( strXML ) );
		pPacket->WriteString( strXML, FALSE );
	}

	for ( POSITION pos = pFolder->GetFolderIterator() ; pos ; )
	{
		if ( CG2Packet* pChild = AlbumToPacket( pFolder->GetNextFolder( pos ) ) )
		{
			pPacket->WritePacket( pChild );
			pChild->Release();
		}
	}

	pPacket->WritePacket( "FILES", pFolder->GetFileCount() * 4 );

	for ( POSITION pos = pFolder->GetFileIterator() ; pos ; )
	{
		CLibraryFile* pFile = pFolder->GetNextFile( pos );
		pPacket->WriteLongBE( pFile->m_nIndex );
	}

	return pPacket;
}
Example #25
0
CXMLElement* CSecurity::ToXML(BOOL bRules)
{
	CXMLElement* pXML = new CXMLElement( NULL, _T("security") );
	pXML->AddAttribute( _T("xmlns"), CSecurity::xmlns );

	if ( bRules )
	{
		for ( POSITION pos = GetIterator() ; pos ; )
		{
			pXML->AddElement( GetNext( pos )->ToXML() );
		}
	}

	return pXML;
}
Example #26
0
BOOL CChannel::LeaveTalk()
{
	if ( ! IsNavigated() ) return TRUE;;
	
	CXMLElement* pXML = new CXMLElement( NULL, ISyncHostLink );
	pXML->AddAttribute( "method", "bye" );
	
	SendPacket( new CSyncHostLink(pXML) );
	delete pXML;
	
	m_bNavigated = FALSE;
	m_tNavigated = GetTickCount();
	
	CopyMemory( m_xCallType, CA_IDLE, MAX_CALLTYPE );
	
	return TRUE;
}
Example #27
0
CXMLElement* CHisReport::FindToday(BOOL bCreate)
{
    CXMLElement* pXML = FindToday();
    if ( pXML || ! bCreate ) return pXML;

    WORD nYear, nMonth, nDay;
    CTime tt = CTime::GetCurrentTime();
    nYear = tt.GetYear();
    nMonth = tt.GetMonth();
    nDay = tt.GetDay();

    CString strValue;

    strValue.Format( _T("%d年%d月%d日"), nYear, nMonth, nDay );
    pXML = m_pXML->AddElement( _T("History") );
    pXML->AddAttribute( _T("Date"), (LPCTSTR)strValue );

    return pXML;
}
Example #28
0
BOOL CRulerSettingsPage::EditXML() 
{
	CString strValue;
	CXMLElement* pXML = NULL;
	CXMLAttribute* pAttri = NULL;
	
	if ( pXML = m_pXML->GetElementByName( _T("BlackList"), TRUE ) )
	{
		pXML->DeleteAllElements();

		for ( int nItem = 0; nItem < m_wndExtList.GetCount(); nItem++ )
		{
			m_wndExtList.GetLBText( nItem, strValue );
			CXMLElement* pMap = pXML->AddElement( _T("Map") );
			pMap->AddAttribute( _T("ID"), strValue );
		}
	}

	return TRUE;
}
CXMLElement* CBitziDownloader::ImportData(CSchema* pSchema)
{
	CXMLElement* pRoot	= pSchema->Instantiate( TRUE );
	CXMLElement* pXML	= pRoot->AddElement( pSchema->m_sSingular );
	int nCount = 0;

	for ( POSITION pos = pSchema->m_pBitziMap.GetHeadPosition() ; pos ; )
	{
		CSchemaBitzi* pMap = (CSchemaBitzi*)pSchema->m_pBitziMap.GetNext( pos );

		CString strValue = LookupValue( pMap->m_sFrom );
		if ( strValue.IsEmpty() ) continue;

		if ( pMap->m_nFactor )
		{
			double nValue;

			if ( _stscanf( strValue, _T("%lf"), &nValue ) == 1 )
			{
				nValue *= pMap->m_nFactor;

				if ( nValue == (double)( (int)nValue ) )
				{
					strValue.Format( _T("%i"), (int)nValue );
				}
				else
				{
					strValue.Format( _T("%f"), nValue );
				}
			}
		}

		pXML->AddAttribute( pMap->m_sTo, strValue );
		nCount++;
	}

	if ( nCount ) return pRoot;
	delete pRoot;

	return NULL;
}
Example #30
0
void CUserMeetingDlg::PutIntoPhone(LPCTSTR lpszPhone, LPCTSTR lpszName)
{
	int nItem = m_wndList.InsertItem( m_wndList.GetItemCount(), lpszPhone );
	m_wndList.SetItemText( nItem, 1, lpszName );
	
	CXMLElement* pXML = new CXMLElement( NULL, ISyncDataView );
	pXML->AddAttribute( "method", "insert into" );
	
	CXMLElement* pSync = pXML->AddElement( "table_name" );
	pSync->SetValue( "xmeetingroom" );
	
	CString str;
	str.Format( "(xmeetingroomcode, xmeetingphone)"
				" select xmeetingroomcode, '%s' from xmeetingroomlist"
				" where xmeetingused='1' and xmeetingroomfee = '%s'", lpszPhone, Network.m_xUserId );
	
	pSync = pXML->AddElement( "column_name" );
	pSync->SetValue( (LPCTSTR)str );
	
	Network.SendPacket( new CSyncDataView( pXML ) );
	delete pXML;
}