Skip to content

Commit

Permalink
r29
Browse files Browse the repository at this point in the history
  • Loading branch information
SkinVista committed Jul 1, 2019
1 parent c81346e commit 2478e9e
Show file tree
Hide file tree
Showing 112 changed files with 1,068 additions and 1,120 deletions.
18 changes: 10 additions & 8 deletions Envy/BTClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ CString CBTClient::GetUserAgentAzureusStyle(LPCSTR pszVendor)
Vendors[ L"BE" ] = L"BareTorrent";
Vendors[ L"BF" ] = L"Bitflu";
Vendors[ L"BG" ] = L"BTG";
// Vendors[ L"BI" ] = L"BI";
// Vendors[ L"BL" ] = L"BL";
Vendors[ L"BM" ] = L"BitsMagnet";
Vendors[ L"BO" ] = L"BitsOnWheels";
Expand Down Expand Up @@ -661,7 +662,7 @@ CString CBTClient::GetUserAgentAzureusStyle(LPCSTR pszVendor)
Vendors[ L"PC" ] = L"CacheLogic";
Vendors[ L"PD" ] = L"Pando";
Vendors[ L"PE" ] = L"PeerProject";
Vendors[ L"PP" ] = L"PeerProject"; // Unused
// Vendors[ L"PP" ] = L"PeerProject"; // Unused
Vendors[ L"PT" ] = L"PHPTracker";
Vendors[ L"pX" ] = L"pHoeniX";
Vendors[ L"qB" ] = L"qBittorrent";
Expand Down Expand Up @@ -690,6 +691,7 @@ CString CBTClient::GetUserAgentAzureusStyle(LPCSTR pszVendor)
Vendors[ L"TT" ] = L"TuoTu";
Vendors[ L"TI" ] = L"Tixati";
Vendors[ L"TX" ] = L"Tixati";
// Vendors[ L"tT" ] = L"tT";
Vendors[ L"UL" ] = L"uLeecher";
Vendors[ L"UE" ] = L"\x00B5Torrent Embed";
Vendors[ L"UM" ] = L"\x00B5Torrent Mac";
Expand Down Expand Up @@ -731,19 +733,19 @@ CString CBTClient::GetUserAgentAzureusStyle(LPCSTR pszVendor)
}

// Parse versioning schemes
int nCount = CountOf(strUserAgent, L"%c", 5);
const int nChars = CountOf( strUserAgent, L"%c", 4 );

if ( nCount == 0 && (TCHAR)pszVendor[5] > '0' ) // Default 0.0.0.0
if ( nChars == 0 && (TCHAR)pszVendor[5] > '0' && (TCHAR)pszVendor[5] < 'B' ) // Default 0.0.0.0
strUserAgent.Format( L"%s %c.%c.%c.%c", (LPCTSTR)strUserAgent, (TCHAR)pszVendor[2], (TCHAR)pszVendor[3], (TCHAR)pszVendor[4], (TCHAR)pszVendor[5] );
else if ( nCount == 0 ) // Default 0.0.0
else if ( nChars == 0 ) // Default 0.0.0
strUserAgent.Format( L"%s %c.%c.%c", (LPCTSTR)strUserAgent, (TCHAR)pszVendor[2], (TCHAR)pszVendor[3], (TCHAR)pszVendor[4] );
else if ( nCount >= 4 )
else if ( nChars >= 4 )
strUserAgent.Format( (LPCTSTR)strUserAgent, (TCHAR)pszVendor[2], (TCHAR)pszVendor[3], (TCHAR)pszVendor[4], (TCHAR)pszVendor[5] );
else if ( nCount == 3 )
else if ( nChars == 3 )
strUserAgent.Format( (LPCTSTR)strUserAgent, (TCHAR)pszVendor[2], (TCHAR)pszVendor[3], (TCHAR)pszVendor[4] );
else if ( nCount == 2 )
else if ( nChars == 2 )
strUserAgent.Format( (LPCTSTR)strUserAgent, (TCHAR)pszVendor[2], (TCHAR)pszVendor[3] );
else if ( nCount == 1 )
else if ( nChars == 1 )
strUserAgent.Format( (LPCTSTR)strUserAgent, (TCHAR)pszVendor[2] );

return strUserAgent;
Expand Down
2 changes: 1 addition & 1 deletion Envy/BTTrackerRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ CBTTrackerRequest::CBTTrackerRequest(CDownload* pDownload, BTTrackerEvent nEvent
{
// Note: Some trackers ignore this value and take the IP the request came from. (Usually the same)
m_sURL += L"&ip=";
m_sURL += inet_ntoa( Network.m_pHost.sin_addr );
m_sURL += CString( inet_ntoa( Network.m_pHost.sin_addr ) );
}
}

Expand Down
6 changes: 1 addition & 5 deletions Envy/Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,11 +813,7 @@ BOOL CConnection::SendMyAddress()
if ( Network.IsListening() )
{
// Compose header text
CString strHeader;
strHeader.Format(
L"Listen-IP: %s:%hu\r\n", // Make it like "Listen-IP: 67.176.34.172:6346\r\n"
(LPCTSTR)CString( inet_ntoa( Network.m_pHost.sin_addr ) ), // Insert the IP address like "67.176.34.172"
htons( Network.m_pHost.sin_port ) ); // Our port number in big endian
CString strHeader = L"Listen-IP: " + Network.m_sAddress + L"\r\n";

// Print the line into the bottom of the output buffer
Write( strHeader ); // It will be sent to the remote computer on the next write
Expand Down
15 changes: 8 additions & 7 deletions Envy/CtrlCoolTip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void CCoolTipCtrl::Hide()
ShowWindow( SW_HIDE );
ModifyStyleEx( WS_EX_LAYERED, 0 );
m_bVisible = FALSE;
GetCursorPos( &m_pOpen );
GetCursorPos( &m_ptOpen );
}

if ( m_bTimer )
Expand All @@ -105,7 +105,7 @@ void CCoolTipCtrl::Hide()
}
}

void CCoolTipCtrl::ShowImpl(bool bChanged)
void CCoolTipCtrl::ShowImpl(bool bChanged /*False*/)
{
if ( m_pbEnable != NULL && *m_pbEnable == false )
return;
Expand All @@ -122,9 +122,9 @@ void CCoolTipCtrl::ShowImpl(bool bChanged)

Hide();
}
else if ( point != m_pOpen )
else if ( point != m_ptOpen )
{
m_pOpen = point;
m_ptOpen = point;
m_tOpen = GetTickCount() + Settings.Interface.TipDelay;

if ( ! m_bTimer )
Expand All @@ -144,11 +144,11 @@ void CCoolTipCtrl::ShowImpl(bool bChanged)
if ( ! OnPrepare() )
return;

CRect rc( m_pOpen.x + TIP_OFFSET_X, m_pOpen.y + TIP_OFFSET_Y, 0, 0 );
CRect rc( m_ptOpen.x + TIP_OFFSET_X, m_ptOpen.y + TIP_OFFSET_Y, 0, 0 );
rc.right = rc.left + m_sz.cx + TIP_MARGIN * 2;
rc.bottom = rc.top + m_sz.cy + TIP_MARGIN * 2;

HMONITOR hMonitor = MonitorFromPoint( m_pOpen, MONITOR_DEFAULTTONEAREST );
HMONITOR hMonitor = MonitorFromPoint( m_ptOpen, MONITOR_DEFAULTTONEAREST );

MONITORINFO oMonitor = {0};
oMonitor.cbSize = sizeof( MONITORINFO );
Expand Down Expand Up @@ -416,6 +416,7 @@ void CCoolTipCtrl::OnTimer(UINT_PTR /*nIDEvent*/)

if ( ! WindowFromPointBelongsToOwner( point ) )
{
m_tOpen = 0;
if ( m_bVisible )
Hide();
return;
Expand All @@ -424,7 +425,7 @@ void CCoolTipCtrl::OnTimer(UINT_PTR /*nIDEvent*/)
if ( ! m_bVisible && m_tOpen && GetTickCount() >= m_tOpen )
{
m_tOpen = 0;
if ( point == m_pOpen || m_hAltWnd != NULL )
if ( point == m_ptOpen || m_hAltWnd != NULL )
ShowImpl();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Envy/CtrlCoolTip.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CCoolTipCtrl : public CWnd
HWND m_hAltWnd;
BOOL m_bTimer;
DWORD m_tOpen;
CPoint m_pOpen;
CPoint m_ptOpen;
CSize m_sz;

void ShowImpl(bool bChanged = false);
Expand Down
16 changes: 9 additions & 7 deletions Envy/CtrlDownloadTip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,23 @@ void CDownloadTipCtrl::OnCalcSize(CDC* pDC)

void CDownloadTipCtrl::OnShow()
{
if ( m_pGraph ) delete m_pGraph;
delete m_pGraph;

m_pGraph = CreateLineGraph();
m_pItem = new CGraphItem( 0, 1.0f, RGB( 0, 0, 0xFF ) );
m_pGraph->AddItem( m_pItem );

CSingleLock pLock( &Transfers.m_pSection );
if ( SafeLock( pLock ) )
TrackerRequests.Request( m_pDownload, BTE_TRACKER_SCRAPE, 0, this );
// pLock.Unlock();
if ( m_pDownload && m_pDownload->IsTorrent() )
{
CSingleLock pLock( &Transfers.m_pSection );
if ( SafeLock( pLock ) )
TrackerRequests.Request( m_pDownload, BTE_TRACKER_SCRAPE, 0, this );
}
}

void CDownloadTipCtrl::OnHide()
{
if ( m_pGraph ) delete m_pGraph;
delete m_pGraph;
m_pGraph = NULL;
m_pItem = NULL;
}
Expand Down Expand Up @@ -1021,7 +1023,7 @@ void CDownloadTipCtrl::OnTrackerEvent(bool bSuccess, LPCTSTR /*pszReason*/, LPCT

//m_nRequest = 0; // Need no cancel

if ( ! bSuccess )
if ( ! bSuccess || ! m_pDownload )
return;

DWORD nComplete = pEvent->GetComplete(); // ->m_nSeeders
Expand Down
Loading

0 comments on commit 2478e9e

Please sign in to comment.