void vmsHttpFlvTrafficAnalyzer::FindDialogsByUniqueUrlWordsMatch2(LPCSTR pszSomeUrl, const HTTPDLGLIST &vDlgs, HTTPDLGLIST &vResult)
{
	LOGFN ("vmsHttpFlvTrafficAnalyzer::FindDialogsByUniqueUrlWordsMatch2");

	assert (pszSomeUrl != NULL);
	
	vResult.clear ();
	
	if (!pszSomeUrl)
		return;
	
	vector <string> vWords;
	vmsUrlWords::ExtractWords2 (pszSomeUrl, vWords);
	if (vWords.empty ())
		return;
	
	string strWords;
	
	for (size_t i = 0; i < vWords.size (); i++)
	{
		strWords += vWords [i];
		strWords += ' ';
	}
	
	FindDialogsByUniqueUrlWordsMatch (strWords.c_str (), vDlgs, vResult);
}
void vmsHttpFlvTrafficAnalyzer::FindDialogsByFileUrlMatch(LPCSTR pszSrcText, const HTTPDLGLIST &vDlgs, HTTPDLGLIST &vResult)
{
	
	
	
	assert (pszSrcText != NULL && *pszSrcText != 0);
	
	vResult.clear ();
	
	int iDlgFound = -1;
	
	for (size_t iDlg = 0; iDlg < vDlgs.size (); iDlg++)
	{
		string strFileUrl; vmsHttpHelper::ExtractFileUrl (vDlgs [iDlg]->strRequestUrl.c_str (),
			strFileUrl);
		if (strFileUrl.empty ())
			continue;
		if (strstr (pszSrcText, strFileUrl.c_str ()) != NULL)
		{
			if (iDlgFound == -1)
			{
				iDlgFound = iDlg;
			}
			else if (vDlgs [iDlgFound]->strRequestUrl != vDlgs [iDlg]->strRequestUrl)
			{
				iDlgFound = -1;
				break;
			}
		}
	}
	
	if (iDlgFound != -1)
		vResult.push_back (vDlgs [iDlgFound]);
}
void vmsHttpFlvTrafficAnalyzer::FindDialogsByUniqueUrlWordsMatch(LPCSTR pszSwfContext, const HTTPDLGLIST &vDlgs, HTTPDLGLIST &vResult)
{
	LOGFN ("vmsHttpFlvTrafficAnalyzer::FindDialogsByUniqueUrlWordsMatch");

	vResult.clear ();
	
	vector < vector <string> > vvUniqueWords;
	vmsWinSockHttpTrafficAnalyzer::FindUniqueUrlWords (vDlgs, vvUniqueWords);
	
	assert (vvUniqueWords.size () == vDlgs.size ());
	
	for (size_t iDlg = 0; iDlg < vvUniqueWords.size (); iDlg++)
	{
		vector <string> &vWords = vvUniqueWords [iDlg];
		if (vWords.empty ())
			continue;
		for (size_t iW = 0; iW < vWords.size (); iW++)
		{
			if (strstr (pszSwfContext, vWords [iW].c_str ()) != NULL)
			{
				vResult.push_back (vDlgs [iDlg]);
				LOG ("Unique url word \"%s\" is containing in source text", vWords [iW].c_str ());
				LOG ("|-dialog url-%s", vDlgs [iDlg]->strRequestUrl.c_str ());
				break;
			}
		}
	}
}
void vmsHttpFlvTrafficAnalyzer::FindDialogsByUrlExactMatch(LPCSTR pszSrcText, const HTTPDLGLIST &vDlgs, HTTPDLGLIST &vResult)
{
	assert (pszSrcText != NULL && *pszSrcText != 0);
	
	vResult.clear ();
	
	string strTmp;
	
	for (size_t i = 0; i < vDlgs.size (); i++)
	{
		HTTPDLG pDlg = vDlgs [i];
		LPCSTR pszFlvUrl = pDlg->strRequestUrl.c_str ();
		if (pszFlvUrl [pDlg->strRequestUrl.length ()-1] == '&')
		{
			strTmp.assign (pszFlvUrl, pDlg->strRequestUrl.length ()-1);
			pszFlvUrl = strTmp.c_str ();
		}
		if (strstr (pszSrcText, pszFlvUrl))
			vResult.push_back (pDlg);
	}
}