Skip to content

Commit

Permalink
Lan mode ready for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
swabby committed Sep 30, 2002
1 parent 93d6d08 commit b294829
Show file tree
Hide file tree
Showing 29 changed files with 38 additions and 221 deletions.
21 changes: 6 additions & 15 deletions AutNetworkSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,11 @@ void CAutNetworkSink::OnPacketIncoming(int NodeID, VARIANT* packet, int size, in
byte* bArray;
SafeArrayAccessData(psa, reinterpret_cast<void**> (&bArray));

byte* bPacket = new byte[size];
for(int i = 0; i < psa->rgsabound->cElements; i++)
bPacket[i] = bArray[i];

SafeArrayUnaccessData(psa);

for(int i = 0; i < m_pDoc->m_pViewStatistics.size(); i++)
((CViewStatistics*) CWnd::FromHandle(m_pDoc->m_pViewStatistics[i]))->OnPacketIncoming(NodeID, (packet_Header*) bPacket, size, ErrorCode, Local);
((CViewStatistics*) CWnd::FromHandle(m_pDoc->m_pViewStatistics[i]))->OnPacketIncoming(NodeID, (packet_Header*) bArray, size, ErrorCode, Local);

delete [] bPacket;
SafeArrayUnaccessData(psa);

}

void CAutNetworkSink::OnPacketOutgoing(int NodeID, VARIANT* packet, int size, bool Local)
Expand All @@ -123,16 +118,12 @@ void CAutNetworkSink::OnPacketOutgoing(int NodeID, VARIANT* packet, int size, bo
byte* bArray;
SafeArrayAccessData(psa, reinterpret_cast<void**> (&bArray));

byte* bPacket = new byte[size];
for(int i = 0; i < psa->rgsabound->cElements; i++)
bPacket[i] = bArray[i];

SafeArrayUnaccessData(psa);

for(int i = 0; i < m_pDoc->m_pViewStatistics.size(); i++)
((CViewStatistics*) CWnd::FromHandle(m_pDoc->m_pViewStatistics[i]))->OnPacketOutgoing(NodeID, (packet_Header*) bPacket, size, Local);
((CViewStatistics*) CWnd::FromHandle(m_pDoc->m_pViewStatistics[i]))->OnPacketOutgoing(NodeID, (packet_Header*) bArray, size, Local);

delete [] bPacket;
SafeArrayUnaccessData(psa);

}


34 changes: 2 additions & 32 deletions AutPrefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,6 @@ class CAutPrefs : public COleDispatchDriver
{
SetProperty(0xb, VT_I4, propVal);
}
unsigned char GetNetworkModel()
{
unsigned char result;
GetProperty(0x10, VT_UI1, (void*)&result);
return result;
}
void SetNetworkModel(unsigned char propVal)
{
SetProperty(0x10, VT_UI1, propVal);
}
BOOL GetSuperNodeAble()
{
BOOL result;
Expand Down Expand Up @@ -176,13 +166,13 @@ class CAutPrefs : public COleDispatchDriver
{
SetProperty(0x13, VT_UI4, propVal);
}
BOOL GetLan()
BOOL GetLanMode()
{
BOOL result;
GetProperty(0x14, VT_BOOL, (void*)&result);
return result;
}
void SetLan(BOOL propVal)
void SetLanMode(BOOL propVal)
{
SetProperty(0x14, VT_BOOL, propVal);
}
Expand All @@ -196,26 +186,6 @@ class CAutPrefs : public COleDispatchDriver
{
SetProperty(0x15, VT_BSTR, propVal);
}
BOOL GetInternalUpdate()
{
BOOL result;
GetProperty(0x16, VT_BOOL, (void*)&result);
return result;
}
void SetInternalUpdate(BOOL propVal)
{
SetProperty(0x16, VT_BOOL, propVal);
}
CString GetInternalUpdateAddr()
{
CString result;
GetProperty(0x17, VT_BSTR, (void*)&result);
return result;
}
void SetInternalUpdateAddr(CString propVal)
{
SetProperty(0x17, VT_BSTR, propVal);
}
BOOL GetBehindFirewall()
{
BOOL result;
Expand Down
4 changes: 2 additions & 2 deletions ChatControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void CChatControl::StopIdentd()
void CChatControl::GetConnect()
{
// Test for internet connection
if(m_autPrefs->GetNetworkModel() != NETWORK_PRIVATE && !m_InetTested)
if(!m_autPrefs->GetLanMode() && !m_InetTested)
{
CWinThread* pThread = AfxBeginThread(TestInetThread, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
AssignThreadToCPU(pThread, CPU_0);
Expand All @@ -161,7 +161,7 @@ void CChatControl::GetConnect()
return;
}

if(m_autPrefs->GetNetworkModel() == NETWORK_PRIVATE)
if(m_autPrefs->GetLanMode())
{
if(m_pPrefs->m_InternalIRC)
{
Expand Down
11 changes: 0 additions & 11 deletions ChatControl.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#if !defined(AFX_CHATCONTROL_H__25344301_2067_11D5_ACF2_00A0CC533D52__INCLUDED_)
#define AFX_CHATCONTROL_H__25344301_2067_11D5_ACF2_00A0CC533D52__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CGnucleusDoc;
class CAutPrefs;
Expand Down Expand Up @@ -69,8 +63,3 @@ class CChatControl : public CAsyncSocket
//}}AFX_MSG
};


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CHATCONTROL_H__25344301_2067_11D5_ACF2_00A0CC533D52__INCLUDED_)
12 changes: 0 additions & 12 deletions ChatIdentd.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#if !defined(AFX_CHATIDENTD_H__18331C82_2611_11D5_ACF2_00A0CC533D52__INCLUDED_)
#define AFX_CHATIDENTD_H__18331C82_2611_11D5_ACF2_00A0CC533D52__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CChatControl;

Expand Down Expand Up @@ -37,9 +31,3 @@ class CChatIdentd : public CAsyncSocket

byte m_pBuff[6000];
};


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CHATIDENTD_H__18331C82_2611_11D5_ACF2_00A0CC533D52__INCLUDED_)
8 changes: 0 additions & 8 deletions ChatRoom.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#if !defined(AFX_CHATROOM_H__E84CB1C1_21E7_11D5_ACF2_00A0CC533D52__INCLUDED_)
#define AFX_CHATROOM_H__E84CB1C1_21E7_11D5_ACF2_00A0CC533D52__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CChatControl;
class CChatServer;
Expand Down Expand Up @@ -41,5 +35,3 @@ class CChatRoom
CChatControl* m_pChat;
CChatServer* m_pServer;
};

#endif // !defined(AFX_CHATROOM_H__E84CB1C1_21E7_11D5_ACF2_00A0CC533D52__INCLUDED_)
11 changes: 0 additions & 11 deletions ChatServer.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#if !defined(AFX_CHATSERVER_H__25344302_2067_11D5_ACF2_00A0CC533D52__INCLUDED_)
#define AFX_CHATSERVER_H__25344302_2067_11D5_ACF2_00A0CC533D52__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#define COLOR_RED 0x000000FF
Expand Down Expand Up @@ -234,9 +229,3 @@ class CChatServer : public CAsyncSocket
byte m_pExtra[4096];
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CHATSERVER_H__25344302_2067_11D5_ACF2_00A0CC533D52__INCLUDED_)
5 changes: 0 additions & 5 deletions ConnectAdvanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ BOOL CConnectAdvanced::OnInitDialog()
{
CPropertyPage::OnInitDialog();

if(m_pDoc->m_autPrefs->GetNetworkModel() != NETWORK_PRIVATE)
{
m_ebHost.SetWindowText("router.limewire.com");
m_ebPort.SetWindowText("6346");
}

// Connected Nodes listbox
CRect rect;
Expand Down
2 changes: 1 addition & 1 deletion ConnectBasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void CConnectBasic::OnTimer(UINT nIDEvent)
{
int MinConnects = 0;

if(m_pDoc->m_autPrefs->GetLan())
if(m_pDoc->m_autPrefs->GetLanMode())
m_stcConnect.SetWindowText("Connected to the " + m_pDoc->m_autPrefs->GetLanName() + " Network");
else
m_stcConnect.SetWindowText("Connected to the Gnutella Network");
Expand Down
11 changes: 0 additions & 11 deletions FrameBrowser.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#if !defined(AFX_FRAMEBROWSER_H__F051CA62_38F6_11D5_ACF2_00A0CC533D52__INCLUDED_)
#define AFX_FRAMEBROWSER_H__F051CA62_38F6_11D5_ACF2_00A0CC533D52__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#include "GnuMdiChildWnd.h"

Expand Down Expand Up @@ -33,8 +27,3 @@ class CFrameBrowser : public CGnuMdiChildWnd
afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
};


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FRAMEBROWSER_H__F051CA62_38F6_11D5_ACF2_00A0CC533D52__INCLUDED_)
10 changes: 0 additions & 10 deletions FrameChat.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#if !defined(AFX_FRAMECHAT_H__2EC15A22_1AF9_11D5_ACF2_00A0CC533D52__INCLUDED_)
#define AFX_FRAMECHAT_H__2EC15A22_1AF9_11D5_ACF2_00A0CC533D52__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#include "GnuMdiChildWnd.h"
Expand All @@ -30,8 +25,3 @@ class CFrameChat : public CGnuMdiChildWnd
afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
};


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FRAMECHAT_H__2EC15A22_1AF9_11D5_ACF2_00A0CC533D52__INCLUDED_)
2 changes: 1 addition & 1 deletion FrameMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ int CFrameMain::OnCreate(LPCREATESTRUCT lpCreateStruct)


// Tray Icon
if(m_autPrefs->GetNetworkModel() == NETWORK_INTERNET)
if(m_autPrefs->GetLanMode())
{
m_TrayIconOn = IDR_TRAYON;
m_TrayIconOff = IDR_TRAYOFF;
Expand Down
11 changes: 0 additions & 11 deletions FrameMain.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#if !defined(AFX_FRAMEMAIN_H__24A0CEC8_881B_11D4_ACF2_00A0CC533D52__INCLUDED_)
#define AFX_FRAMEMAIN_H__24A0CEC8_881B_11D4_ACF2_00A0CC533D52__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CGnucleusApp;
class CGnucleusDoc;
Expand Down Expand Up @@ -127,8 +121,3 @@ class CFrameMain : public CMDIFrameWnd
DECLARE_MESSAGE_MAP()
};


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FRAMEMAIN_H__24A0CEC8_881B_11D4_ACF2_00A0CC533D52__INCLUDED_)
18 changes: 0 additions & 18 deletions Gnucleus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,24 +198,6 @@ BOOL CGnucleusApp::InitInstance()
SendMessage(m_pMainWnd->m_hWnd, WM_COMMAND, ID_WINDOW_CASCADE, NULL);


// Display Start Page for LAN
if(m_pDoc->m_autPrefs->GetNetworkModel() == NETWORK_PRIVATE && !m_Min)
{
CFrameBrowser* HelpPage = pMainFrame->OpenBrowser(m_pDoc->m_RunPath + "Help\\index.htm");

if(HelpPage)
{
RECT MainWin;
AfxGetMainWnd()->GetWindowRect(&MainWin);

int y = (MainWin.bottom - MainWin.top) / 2 - 200,
x = (MainWin.right - MainWin.left) / 2 - 175;

HelpPage->MoveWindow(x, y, 350, 400);
}
}


return true;
}

Expand Down
14 changes: 0 additions & 14 deletions Gnucleus.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
#if !defined(AFX_GNUCLEUS_H__24A0CEC4_881B_11D4_ACF2_00A0CC533D52__INCLUDED_)
#define AFX_GNUCLEUS_H__24A0CEC4_881B_11D4_ACF2_00A0CC533D52__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif


#include "resource.h" // main symbols
Expand Down Expand Up @@ -67,8 +58,3 @@ class CMyCmdLineInfo : public CCommandLineInfo
bool m_Minimize;
};


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_GNUCLEUS_H__24A0CEC4_881B_11D4_ACF2_00A0CC533D52__INCLUDED_)
1 change: 1 addition & 0 deletions Gnucleus.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Global
{B41712E7-6E7A-4707-9D65-DAB07A52F26C}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
DPBuild = 5
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
Expand Down
8 changes: 4 additions & 4 deletions GnucleusDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ CGnucleusDoc::CGnucleusDoc(CGnucleusApp* pApp)


// Load web caches
if(m_autPrefs->GetNetworkModel() == NETWORK_PRIVATE)
if(m_autPrefs->GetLanMode())
m_autCache->LoadWebCache(m_RunPath + "LanWebCache.net");
else
{
Expand All @@ -146,7 +146,7 @@ CGnucleusDoc::CGnucleusDoc(CGnucleusApp* pApp)


// Display LAN setup dialog
if(m_autPrefs->GetNetworkModel() == NETWORK_PRIVATE)
if(m_autPrefs->GetLanMode())
if(!m_pApp->m_Min)
{
CNetSetup NetSetup(this);
Expand All @@ -163,7 +163,7 @@ CGnucleusDoc::CGnucleusDoc(CGnucleusApp* pApp)


// Connect to chat
if(m_autPrefs->GetNetworkModel() == NETWORK_PRIVATE && m_pChat->m_pPrefs->m_InternalIRC)
if(m_autPrefs->GetLanMode() && m_pChat->m_pPrefs->m_InternalIRC)
m_pChat->GetConnect();


Expand Down Expand Up @@ -328,7 +328,7 @@ CGnucleusDoc::~CGnucleusDoc()


// Save web caches
if(m_autPrefs->GetNetworkModel() == NETWORK_PRIVATE)
if(m_autPrefs->GetLanMode())
m_autCache->SaveWebCache(m_RunPath + "LanWebCache.net");
else
{
Expand Down
2 changes: 2 additions & 0 deletions PrefConnectScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ BOOL CPrefConnectScreen::OnApply()

m_autPrefs->SetScreenedNodes(&vaNodes);

VariantClear(&vaNodes);

return CPropertyPage::OnApply();
}

Expand Down
2 changes: 2 additions & 0 deletions PrefConnectServers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ BOOL CPrefConnectServers::OnApply()

m_autPrefs->SetHostServers(&vaNodes);

VariantClear(&vaNodes);

return CPropertyPage::OnApply();
}

Expand Down
Loading

0 comments on commit b294829

Please sign in to comment.