--- sbbs/sbbs3/ctrl/clientformunit.cpp 2018/04/24 16:39:34 1.1.1.1 +++ sbbs/sbbs3/ctrl/clientformunit.cpp 2018/04/24 16:40:53 1.1.1.2 @@ -1,12 +1,12 @@ /* Synchronet Control Panel (GUI Borland C++ Builder Project for Win32) */ -/* $Id: clientformunit.cpp,v 1.1.1.1 2018/04/24 16:39:34 root Exp $ */ +/* $Id: clientformunit.cpp,v 1.1.1.2 2018/04/24 16:40:53 root Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -41,8 +41,9 @@ #include // sprintf #include // closesocket #include "ClientFormUnit.h" +#include "sbbs.h" // filter_ip -void socket_open(BOOL open); +void socket_open(void*, BOOL open); //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" @@ -55,11 +56,6 @@ __fastcall TClientForm::TClientForm(TCom ListMutex=CreateMutex(NULL,false,NULL); } //--------------------------------------------------------------------------- -void __fastcall TClientForm::FormShow(TObject *Sender) -{ - MainForm->ViewClients->Checked=true; -} -//--------------------------------------------------------------------------- void __fastcall TClientForm::FormHide(TObject *Sender) { MainForm->ViewClients->Checked=false; @@ -96,8 +92,40 @@ void __fastcall TClientForm::CloseSocket State << isSelected; while(ListItem!=NULL) { - if(closesocket(atoi(ListItem->Caption.c_str()))==0) - socket_open(FALSE); + closesocket(atoi(ListItem->Caption.c_str())); + ListItem=ListView->GetNextItem(ListItem,sdAll,State); + } +} +//--------------------------------------------------------------------------- + +void __fastcall TClientForm::FilterIpMenuItemClick(TObject *Sender) +{ + char str[256]; + int res; + TListItem* ListItem; + TItemStates State; + + ListItem=ListView->Selected; + State << isSelected; + + while(ListItem!=NULL) { + + AnsiString prot = ListItem->SubItems->Strings[0]; + AnsiString username = ListItem->SubItems->Strings[1]; + AnsiString ip_addr = ListItem->SubItems->Strings[2]; + AnsiString hostname = ListItem->SubItems->Strings[3]; + + wsprintf(str,"Disallow future connections from %s" + ,ip_addr); + res=Application->MessageBox(str,"Filter IP?" + ,MB_YESNOCANCEL|MB_ICONQUESTION); + if(res==IDCANCEL) + break; + if(res==IDYES) + filter_ip(&MainForm->cfg,prot.c_str(),"abuse",hostname.c_str() + ,ip_addr.c_str(),username.c_str(),NULL); + if(ListView->Selected == NULL) + break; ListItem=ListView->GetNextItem(ListItem,sdAll,State); } }