This site is for P2P development and test software ONLY!

Clear Banlist Button

UploadListCtrl.cpp

add this code:

#include "Clientlist.h"




search after:

void CUploadListCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point)



look after this code:

ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_FIND, GetResString(IDS_FIND), _T("Search"));



add under it:

ClientMenu.AppendMenu(MF_STRING | (client ? MF_ENABLED : MF_GRAYED), MP_CLEARBANS, _T("Clear Banlist"),_T("STOP"));




search after:

BOOL CUploadListCtrl::OnCommand(WPARAM wParam, LPARAM /*lParam*/)



look after this code:

case MP_BOOT:
if (client->GetKadPort())
Kademlia::CKademlia::Bootstrap(ntohl(client->GetIP()), client->GetKadPort());
break;



add under it:

case MP_CLEARBANS:
theApp.clientlist->ClearBanList(); theApp.emuledlg->transferwnd->ShowQueueCount(theApp.uploadqueue->GetWaitingUserCount());
break;



MenuCmds.h


add at the end of the defines:

#define MP_CLEARBANS 15000




ClientList.cpp

add this code at end of file:

void CClientList::ClearBanList()
{
int i=0;
POSITION pos = m_bannedList.GetStartPosition();
uint32 nKey;
uint32 dwBantime;
while (pos != NULL)
{
m_bannedList.GetNextAssoc( pos, nKey, dwBantime );
RemoveBannedClient(nKey);
i++;
}
}



ClientList.h

Search after:

void DeleteAll();



add under it:

void ClearBanList();

0 comments:

发表评论