Moved Code base to new location, added in aforementioned DCC code

This commit is contained in:
Brendan Walker
2002-12-03 03:19:51 +00:00
parent 2969a13de4
commit 28cd1793ee
10 changed files with 123 additions and 2768 deletions
+4 -1
View File
@@ -520,6 +520,9 @@ bool CIrcDCCServer::Start(
//Create a file transfer dialog //Create a file transfer dialog
m_pSendFileDialog = new CSendFileDialog(AfxGetMainWnd()); m_pSendFileDialog = new CSendFileDialog(AfxGetMainWnd());
if ( !m_pSendFileDialog->Create(IDD_FILEXFER, AfxGetMainWnd()) )
return false;
m_pSendFileDialog->m_BytesSent = "0 bytes"; m_pSendFileDialog->m_BytesSent = "0 bytes";
m_pSendFileDialog->m_ProgressFile.SetRange(0, 100); m_pSendFileDialog->m_ProgressFile.SetRange(0, 100);
m_pSendFileDialog->m_ProgressFile.SetPos(0); m_pSendFileDialog->m_ProgressFile.SetPos(0);
@@ -586,7 +589,7 @@ void CIrcDCCServer::DoThreadRecv()
m_pSendFileDialog->m_XferStatus = "Recieving File..."; m_pSendFileDialog->m_XferStatus = "Recieving File...";
//Create a file to write incoming data to //Create a file to write incoming data to
CString filename = m_directory+"\\"+m_fileName; CString filename = m_directory+m_fileName;
FILE* fp = fopen(filename, "wb"); FILE* fp = fopen(filename, "wb");
if ( !fp ) return; if ( !fp ) return;
-1
View File
@@ -37,7 +37,6 @@
#define IDC_XFERSTATUS 1022 #define IDC_XFERSTATUS 1022
#define IDC_TOFROM 1023 #define IDC_TOFROM 1023
#define IDC_SENTRECVD 1024 #define IDC_SENTRECVD 1024
#define IDD_DIRECTORY 1536
// Next default values for new objects // Next default values for new objects
// //
Binary file not shown.
File diff suppressed because it is too large Load Diff
+29 -28
View File
@@ -31,54 +31,55 @@ RSC=rc.exe
!IF "$(CFG)" == "smlobby - Win32 Release" !IF "$(CFG)" == "smlobby - Win32 Release"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release" # PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release" # PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 6
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release" # PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release" # PROP Intermediate_Dir "Release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "smlobby - Win32 Debug" !ELSEIF "$(CFG)" == "smlobby - Win32 Debug"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug" # PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug" # PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 6
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug" # PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # ADD LINK32 ws2_32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF !ENDIF
@@ -99,10 +100,6 @@ SOURCE=.\CrossThreadsMessagingDevice.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\DirectoryDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\EditChat.cpp SOURCE=.\EditChat.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -119,10 +116,6 @@ SOURCE=.\smlobby.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\smlobby.rc
# End Source File
# Begin Source File
SOURCE=.\smlobbyDlg.cpp SOURCE=.\smlobbyDlg.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -147,10 +140,6 @@ SOURCE=.\CrossThreadsMessagingDevice.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\DirectoryDialog.h
# End Source File
# Begin Source File
SOURCE=.\EditChat.h SOURCE=.\EditChat.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -159,6 +148,10 @@ SOURCE=.\irc.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\resource2.h
# End Source File
# Begin Source File
SOURCE=.\SendFileDialog.h SOURCE=.\SendFileDialog.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -181,6 +174,14 @@ SOURCE=.\StdAfx.h
# Begin Group "Resource Files" # Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\smlobby.ico
# End Source File
# Begin Source File
SOURCE=.\res\smlobby.rc2
# End Source File
# End Group # End Group
# End Target # End Target
# End Project # End Project
Binary file not shown.
Binary file not shown.
-29
View File
@@ -138,35 +138,6 @@ BEGIN
LTEXT "",IDC_XFERSTATUS,43,117,77,36 LTEXT "",IDC_XFERSTATUS,43,117,77,36
END END
IDD_DIRECTORY DIALOG DISCARDABLE 109, 35, 165, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Open"
FONT 8, "Helv"
BEGIN
LTEXT "File &Name:",1090,168,0,76,10
EDITTEXT 1152,168,10,90,12,ES_AUTOHSCROLL | ES_OEMCONVERT
LISTBOX 1120,168,26,90,68,LBS_SORT | LBS_OWNERDRAWFIXED |
LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_VSCROLL |
WS_TABSTOP
LTEXT "&Directories:",-1,7,6,92,9
LTEXT "",1088,7,18,92,9,SS_NOPREFIX
LISTBOX 1121,7,32,92,68,LBS_SORT | LBS_OWNERDRAWFIXED |
LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_VSCROLL |
WS_TABSTOP
LTEXT "List Files of &Type:",1089,168,98,90,9
COMBOBOX 1136,168,108,90,36,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
WS_BORDER | WS_VSCROLL | WS_TABSTOP
LTEXT "Dri&ves:",1091,7,104,92,9
COMBOBOX 1137,7,114,92,68,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED |
CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,105,6,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,105,24,50,14,WS_GROUP
PUSHBUTTON "&Help",1038,105,46,50,14,WS_GROUP
CONTROL "&Read Only",1040,"Button",BS_AUTOCHECKBOX | WS_GROUP |
WS_TABSTOP,105,68,50,12
END
#ifndef _MAC #ifndef _MAC
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
+43 -19
View File
@@ -12,11 +12,7 @@ static char THIS_FILE[] = __FILE__;
#endif #endif
#pragma comment(lib, "wsock32.lib")
#include "ConnectDlg.h" #include "ConnectDlg.h"
#include "DirectoryDialog.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -270,9 +266,8 @@ bool CSmlobbyDlg::OnIrc_NICK(const CIrcMessage* pmsg)
bool CSmlobbyDlg::OnIrc_PRIVMSG(const CIrcMessage* pmsg) bool CSmlobbyDlg::OnIrc_PRIVMSG(const CIrcMessage* pmsg)
{ {
//See if were being sent a DCC command //See if were being sent a DCC command
//STIL UNDER DEVELOPMENT! if (OnIrc_DCC_RECV(pmsg))
//if (OnIrc_DCC_RECV(pmsg)) return true;
// return true;
UpdateChatMessages( pmsg ); UpdateChatMessages( pmsg );
@@ -301,24 +296,15 @@ bool CSmlobbyDlg::OnIrc_DCC_RECV(const CIrcMessage *pmsg)
return false; return false;
//Open a dialog box so user can decide where to save file //Open a dialog box so user can decide where to save file
CDirectoryDialog DirDlg(FALSE, NULL, NULL, OFN_SHOWHELP | OFN_HIDEREADONLY | CString pathname = SelectFolder();
OFN_OVERWRITEPROMPT | OFN_ENABLETEMPLATE, NULL,
NULL);
DirDlg.m_ofn.hInstance = AfxGetInstanceHandle();
DirDlg.m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DIRECTORY);
if ( IDOK != DirDlg.DoModal())
return false;
//We now have enough info to fire off a thread which downloads the file //We now have enough info to fire off a thread which downloads the file
CIrcDCCServer DCCServer; CIrcDCCServer DCCServer;
CString filename(szFilename); CString filename(szFilename);
CString partner(pmsg->prefix.sNick.c_str()); CString partner(pmsg->prefix.sNick.c_str());
//DCCServer.Start(filename, DirDlg.GetPathName(), partner, DCCServer.Start(filename, pathname, partner, ulPartnerIP, uiPartnerPort,
// ulPartnerIP, uiPartnerPort, ulFileSize, FILE_XFER_RATE); ulFileSize, FILE_XFER_RATE);
DCCServer.Start(filename, "C:", partner,
ulPartnerIP, uiPartnerPort, ulFileSize, FILE_XFER_RATE);
return true; return true;
} }
@@ -626,3 +612,41 @@ bool CSmlobbyDlg::IsUniqueGameName(const CString GameName)
return true; return true;
} }
CString CSmlobbyDlg::SelectFolder()
{
char szTitle[] = "Select a Folder";
char szDisplayName[MAX_PATH] = "";
char szPath[MAX_PATH] = "";
BROWSEINFO bi;
szPath[0] = '\0';
bi.hwndOwner = m_hWnd; // Handle of the owner window
bi.pidlRoot = NULL; // Desktop folder is used
bi.lpszTitle = szTitle; // Title of the dialog box
bi.pszDisplayName = szDisplayName; // Buffer for selected folder name
bi.ulFlags = BIF_RETURNONLYFSDIRS; // Only returns file system directories
bi.lpfn = NULL;
bi.lParam = 0;
LPITEMIDLIST pItemIDList = SHBrowseForFolder(&bi);
if (pItemIDList) {
if (SHGetPathFromIDList(pItemIDList, szPath)) {
SetWindowText(szPath);
}
// Avoid memory leaks by deleting the PIDL using the shell's task allocator
IMalloc* pMalloc;
if (SHGetMalloc(&pMalloc) != NOERROR) {
TRACE("Failed to get pointer to shells task allocator");
return CString(szPath);
}
pMalloc->Free(pItemIDList);
if (pMalloc)
pMalloc->Release();
}
return CString(szPath);
}
+1 -1
View File
@@ -76,8 +76,8 @@ protected:
virtual void OnIrcDisconnected(); virtual void OnIrcDisconnected();
void UpdateChatMessages( const CIrcMessage* p ); void UpdateChatMessages( const CIrcMessage* p );
bool IsUniqueGameName(const CString GameName); bool IsUniqueGameName(const CString GameName);
CString SelectFolder();
}; };
//{{AFX_INSERT_LOCATION}} //{{AFX_INSERT_LOCATION}}