aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvdrfan <vdrfan@svn>2009-10-19 15:52:31 +0000
committervdrfan <vdrfan@svn>2009-10-19 15:52:31 +0000
commitc3c1fb9aa59cc34fb5187ca8a6877b672b2cee2b (patch)
treef564eda6e8665f65eb83ec49ba9cb4fb3ce11f1d
parent3ab4c04a3b27b0d5c6e5006557fe669ae1fd7db5 (diff)
cleanup: removed old legacy _XBOX and HAS_FTP_SERVER code
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23852 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--xbmc/Application.cpp105
-rw-r--r--xbmc/Application.h3
-rw-r--r--xbmc/Autorun.h1
-rw-r--r--xbmc/FileSystem/File.cpp5
-rw-r--r--xbmc/FileSystem/FileHD.cpp10
-rw-r--r--xbmc/FileSystem/FileZip.cpp2
-rw-r--r--xbmc/FileSystem/VirtualDirectory.cpp4
-rw-r--r--xbmc/GUISettings.cpp11
-rw-r--r--xbmc/GUIWindowSettingsCategory.cpp91
-rw-r--r--xbmc/GUIWindowSettingsCategory.h2
-rw-r--r--xbmc/Settings.cpp7
-rw-r--r--xbmc/Util.cpp434
-rw-r--r--xbmc/Util.h13
-rw-r--r--xbmc/utils/Network.cpp6
14 files changed, 0 insertions, 694 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index e238dd4359..6df0e7a0b9 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -117,9 +117,6 @@
#include "lib/libGoAhead/XBMChttp.h"
#include "lib/libGoAhead/WebServer.h"
#endif
-#ifdef HAS_FTP_SERVER
-#include "lib/libfilezilla/xbfilezilla.h"
-#endif
#ifdef HAS_TIME_SERVER
#include "utils/Sntp.h"
#endif
@@ -1113,7 +1110,6 @@ HRESULT CApplication::Initialize()
g_guiSettings.SetString("network.subnet", "255.255.255.0");
g_guiSettings.SetString("network.gateway", "192.168.0.1");
g_guiSettings.SetString("network.dns", "192.168.0.1");
- g_guiSettings.SetBool("servers.ftpserver", true);
g_guiSettings.SetBool("servers.webserver", false);
g_guiSettings.SetBool("locale.timeserver", false);
}
@@ -1372,67 +1368,6 @@ void CApplication::StopWebServer(bool bWait)
#endif
}
-void CApplication::StartFtpServer()
-{
-#ifdef HAS_FTP_SERVER
- if ( g_guiSettings.GetBool("servers.ftpserver") && m_network.IsAvailable() )
- {
- CLog::Log(LOGNOTICE, "XBFileZilla: Starting...");
- if (!m_pFileZilla)
- {
- CStdString xmlpath = "special://xbmc/system/";
- // if user didn't upgrade properly,
- // check whether UserData/FileZilla Server.xml exists
- if (CFile::Exists(g_settings.GetUserDataItem("FileZilla Server.xml")))
- xmlpath = g_settings.GetUserDataFolder();
-
- // check file size and presence
- CFile xml;
- if (xml.Open(xmlpath+"FileZilla Server.xml") && xml.GetLength() > 0)
- {
- m_pFileZilla = new CXBFileZilla(_P(xmlpath));
- m_pFileZilla->Start(false);
- }
- else
- {
- // 'FileZilla Server.xml' does not exist or is corrupt,
- // falling back to ftp emergency recovery mode
- CLog::Log(LOGNOTICE, "XBFileZilla: 'FileZilla Server.xml' is missing or is corrupt!");
- CLog::Log(LOGNOTICE, "XBFileZilla: Starting ftp emergency recovery mode");
- StartFtpEmergencyRecoveryMode();
- }
- xml.Close();
- }
- }
-#endif
-}
-
-void CApplication::StopFtpServer()
-{
-#ifdef HAS_FTP_SERVER
- if (m_pFileZilla)
- {
- CLog::Log(LOGINFO, "XBFileZilla: Stopping...");
-
- std::vector<SXFConnection> mConnections;
- std::vector<SXFConnection>::iterator it;
-
- m_pFileZilla->GetAllConnections(mConnections);
-
- for(it = mConnections.begin();it != mConnections.end();it++)
- {
- m_pFileZilla->CloseConnection(it->mId);
- }
-
- m_pFileZilla->Stop();
- delete m_pFileZilla;
- m_pFileZilla = NULL;
-
- CLog::Log(LOGINFO, "XBFileZilla: Stopped");
- }
-#endif
-}
-
void CApplication::StartTimeServer()
{
#ifdef HAS_TIME_SERVER
@@ -4453,11 +4388,6 @@ void CApplication::CheckShutdown()
if (IsPlaying()) // is something playing?
resetTimer = true;
-#ifdef HAS_FTP_SERVER
- if (m_pFileZilla && m_pFileZilla->GetNoConnections() != 0) // is FTP active ?
- resetTimer = true;
-#endif
-
if (pMusicScan && pMusicScan->IsScanning()) // music scanning?
resetTimer = true;
@@ -5362,41 +5292,6 @@ bool CApplication::ProcessAndStartPlaylist(const CStdString& strPlayList, CPlayL
return false;
}
-void CApplication::StartFtpEmergencyRecoveryMode()
-{
-#ifdef HAS_FTP_SERVER
- m_pFileZilla = new CXBFileZilla(NULL);
- m_pFileZilla->Start();
-
- // Default settings
- m_pFileZilla->mSettings.SetMaxUsers(0);
- m_pFileZilla->mSettings.SetWelcomeMessage("XBMC emergency recovery console FTP.");
-
- // default user
- CXFUser* pUser;
- m_pFileZilla->AddUser("xbox", pUser);
- pUser->SetPassword("xbox");
- pUser->SetShortcutsEnabled(false);
- pUser->SetUseRelativePaths(false);
- pUser->SetBypassUserLimit(false);
- pUser->SetUserLimit(0);
- pUser->SetIPLimit(0);
- pUser->AddDirectory("/", XBFILE_READ | XBFILE_WRITE | XBFILE_DELETE | XBFILE_APPEND | XBDIR_DELETE | XBDIR_CREATE | XBDIR_LIST | XBDIR_SUBDIRS | XBDIR_HOME);
- pUser->AddDirectory("C:\\", XBFILE_READ | XBFILE_WRITE | XBFILE_DELETE | XBFILE_APPEND | XBDIR_DELETE | XBDIR_CREATE | XBDIR_LIST | XBDIR_SUBDIRS);
- pUser->AddDirectory("D:\\", XBFILE_READ | XBDIR_LIST | XBDIR_SUBDIRS);
- pUser->AddDirectory("E:\\", XBFILE_READ | XBFILE_WRITE | XBFILE_DELETE | XBFILE_APPEND | XBDIR_DELETE | XBDIR_CREATE | XBDIR_LIST | XBDIR_SUBDIRS);
- pUser->AddDirectory("Q:\\", XBFILE_READ | XBFILE_WRITE | XBFILE_DELETE | XBFILE_APPEND | XBDIR_DELETE | XBDIR_CREATE | XBDIR_LIST | XBDIR_SUBDIRS);
- //Add. also Drive F/G
- if (CIoSupport::DriveExists('F')){
- pUser->AddDirectory("F:\\", XBFILE_READ | XBFILE_WRITE | XBFILE_DELETE | XBFILE_APPEND | XBDIR_DELETE | XBDIR_CREATE | XBDIR_LIST | XBDIR_SUBDIRS);
- }
- if (CIoSupport::DriveExists('G')){
- pUser->AddDirectory("G:\\", XBFILE_READ | XBFILE_WRITE | XBFILE_DELETE | XBFILE_APPEND | XBDIR_DELETE | XBDIR_CREATE | XBDIR_LIST | XBDIR_SUBDIRS);
- }
- pUser->CommitChanges();
-#endif
-}
-
void CApplication::SaveCurrentFileSettings()
{
if (m_itemCurrentFile->IsVideo())
diff --git a/xbmc/Application.h b/xbmc/Application.h
index 8a315f4f6d..56f573adc3 100644
--- a/xbmc/Application.h
+++ b/xbmc/Application.h
@@ -98,8 +98,6 @@ public:
void StopServices();
void StartWebServer();
void StopWebServer(bool bWait);
- void StartFtpServer();
- void StopFtpServer();
void StartTimeServer();
void StopTimeServer();
void StartUPnP();
@@ -345,7 +343,6 @@ protected:
bool ProcessJoystickEvent(const std::string& joystickName, int button, bool isAxis, float fAmount);
- void StartFtpEmergencyRecoveryMode();
float NavigationIdleTime();
void CheckForTitleChange();
static bool AlwaysProcess(const CAction& action);
diff --git a/xbmc/Autorun.h b/xbmc/Autorun.h
index eeea6f4932..e56dd0682a 100644
--- a/xbmc/Autorun.h
+++ b/xbmc/Autorun.h
@@ -49,7 +49,6 @@ public:
void HandleAutorun();
static void ExecuteAutorun(bool bypassSettings = false, bool ignoreplaying=false);
protected:
- static void ExecuteXBE(const CStdString &xbeFile);
static void RunCdda();
static void RunMedia(bool bypassSettings = false);
static bool RunDisc(DIRECTORY::IDirectory* pDir, const CStdString& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings = false);
diff --git a/xbmc/FileSystem/File.cpp b/xbmc/FileSystem/File.cpp
index fe52de0642..182a93f5b3 100644
--- a/xbmc/FileSystem/File.cpp
+++ b/xbmc/FileSystem/File.cpp
@@ -182,11 +182,6 @@ bool CFile::Cache(const CStdString& strFileName, const CStdString& strDest, XFIL
/* larger then 1 meg, let's do rendering async */
// Async render cannot be done in SDL builds because of the resulting ThreadMessage deadlock
// we should call CAsyncFileCopy::Copy() instead.
-#if defined(_XBOX)
- if( file.GetLength() > 1024*1024 )
- helper = new CAsyncFileCallback(pCallback, pContext);
-#endif
-
// 128k is optimal for xbox
int iBufferSize = 128 * 1024;
diff --git a/xbmc/FileSystem/FileHD.cpp b/xbmc/FileSystem/FileHD.cpp
index 6955a187ed..370d63d19e 100644
--- a/xbmc/FileSystem/FileHD.cpp
+++ b/xbmc/FileSystem/FileHD.cpp
@@ -152,16 +152,6 @@ bool CFileHD::OpenForWrite(const CURL& url, bool bOverWrite)
// make sure it's a legal FATX filename (we are writing to the harddisk)
CStdString strPath = GetLocal(url);
-#ifdef HAS_FTP_SERVER
- if (g_guiSettings.GetBool("servers.ftpautofatx")) // allow overriding
- {
- CStdString strPathOriginal = strPath;
- CUtil::GetFatXQualifiedPath(strPath);
- if (strPathOriginal != strPath)
- CLog::Log(LOGINFO,"CFileHD::OpenForWrite: WARNING: Truncated filename %s %s", strPathOriginal.c_str(), strPath.c_str());
- }
-#endif
-
#ifdef _WIN32
CStdStringW strWPath;
g_charsetConverter.utf8ToW(strPath, strWPath, false);
diff --git a/xbmc/FileSystem/FileZip.cpp b/xbmc/FileSystem/FileZip.cpp
index dbbe0b6512..e28f628ccb 100644
--- a/xbmc/FileSystem/FileZip.cpp
+++ b/xbmc/FileSystem/FileZip.cpp
@@ -26,10 +26,8 @@
#include <sys/stat.h>
#ifndef __GNUC__
-#ifndef _XBOX
#pragma comment (lib,"../../xbmc/lib/zlib/zlib.lib")
#endif
-#endif
#define ZIP_CACHE_LIMIT 4*1024*1024
diff --git a/xbmc/FileSystem/VirtualDirectory.cpp b/xbmc/FileSystem/VirtualDirectory.cpp
index 90d0e4f4ef..a9f66c22d7 100644
--- a/xbmc/FileSystem/VirtualDirectory.cpp
+++ b/xbmc/FileSystem/VirtualDirectory.cpp
@@ -216,12 +216,8 @@ void CVirtualDirectory::GetSources(VECSOURCES &shares) const
// add our plug n play shares
if (m_allowNonLocalSources)
- {
g_mediaManager.GetRemovableDrives(shares);
- CUtil::AutoDetectionGetSource(shares);
- }
-
#ifdef HAS_DVD_DRIVE
// and update our dvd share
for (unsigned int i = 0; i < shares.size(); ++i)
diff --git a/xbmc/GUISettings.cpp b/xbmc/GUISettings.cpp
index e222a315f1..d6fded85a0 100644
--- a/xbmc/GUISettings.cpp
+++ b/xbmc/GUISettings.cpp
@@ -547,16 +547,6 @@ void CGUISettings::Initialize()
#endif
AddCategory(6, "servers", 14036);
-#if defined(HAS_FTP_SERVER) || defined (HAS_WEB_SERVER)
-#ifdef HAS_FTP_SERVER
- AddBool(1, "servers.ftpserver", 167, true);
- AddString(3,"servers.ftpserverpassword",1246, "xbox", EDIT_CONTROL_HIDDEN_INPUT, true, 1246);
- AddBool(4, "servers.ftpautofatx", 771, true);
- AddString(2,"servers.ftpserveruser", 1245, "xbox", SPIN_CONTROL_TEXT);
-#endif
-#if defined(HAS_FTP_SERVER) && defined(HAS_WEB_SERVER)
- AddSeparator(5, "servers.sep1");
-#endif
#ifdef HAS_WEB_SERVER
AddBool(6, "servers.webserver", 263, false);
#ifdef _LINUX
@@ -567,7 +557,6 @@ void CGUISettings::Initialize()
AddString(8,"servers.webserverusername",1048, "xbmc", EDIT_CONTROL_INPUT);
AddString(9,"servers.webserverpassword",733, "", EDIT_CONTROL_HIDDEN_INPUT, true, 733);
#endif
-#endif
AddCategory(6, "smb", 1200);
AddString(1, "smb.username", 1203, "", EDIT_CONTROL_INPUT, true, 1203);
diff --git a/xbmc/GUIWindowSettingsCategory.cpp b/xbmc/GUIWindowSettingsCategory.cpp
index 9b99208ab0..59b500d0a8 100644
--- a/xbmc/GUIWindowSettingsCategory.cpp
+++ b/xbmc/GUIWindowSettingsCategory.cpp
@@ -246,13 +246,6 @@ bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
g_charsetConverter.reset();
-#ifdef _XBOX
- CStdString strKeyboardLayoutConfigurationPath;
- strKeyboardLayoutConfigurationPath.Format("special://xbmc/language/%s/keyboardmap.xml", m_strNewLanguage.c_str());
- CLog::Log(LOGINFO, "load keyboard layout configuration info file: %s", strKeyboardLayoutConfigurationPath.c_str());
- g_keyboardLayoutConfiguration.Load(strKeyboardLayoutConfigurationPath);
-#endif
-
CStdString strLanguagePath;
strLanguagePath.Format("special://xbmc/language/%s/strings.xml", m_strNewLanguage.c_str());
g_localizeStrings.Load(strLanguagePath);
@@ -861,10 +854,6 @@ void CGUIWindowSettingsCategory::CreateSettings()
{
FillInStartupWindow(pSetting);
}
- else if (strSetting.Equals("servers.ftpserveruser"))
- {
- FillInFTPServerUser(pSetting);
- }
else if (strSetting.Equals("videoplayer.externaldvdplayer"))
{
CSettingString *pSettingString = (CSettingString *)pSetting;
@@ -1130,11 +1119,6 @@ void CGUIWindowSettingsCategory::UpdateSettings()
CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("system.autotemperature"));
}
- else if (strSetting.Equals("servers.ftpserveruser") || strSetting.Equals("servers.ftpserverpassword"))
- {
- CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
- pControl->SetEnabled(g_guiSettings.GetBool("servers.ftpserver"));
- }
else if (strSetting.Equals("servers.webserverusername"))
{
CGUIEditControl *pControl = (CGUIEditControl *)GetControl(pSettingControl->GetID());
@@ -1872,22 +1856,6 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC
}
#endif
#endif
- else if (strSetting.Equals("servers.ftpserver"))
- {
- g_application.StopFtpServer();
- if (g_guiSettings.GetBool("servers.ftpserver"))
- g_application.StartFtpServer();
- }
- else if (strSetting.Equals("servers.ftpserverpassword"))
- {
- SetFTPServerUserPass();
- }
- else if (strSetting.Equals("servers.ftpserveruser"))
- {
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
- g_guiSettings.SetString("servers.ftpserveruser", pControl->GetCurrentLabel());
- }
-
else if ( strSetting.Equals("servers.webserver") || strSetting.Equals("servers.webserverport") ||
strSetting.Equals("servers.webserverusername") || strSetting.Equals("servers.webserverpassword"))
{
@@ -3358,65 +3326,6 @@ void CGUIWindowSettingsCategory::FillInScreenSavers(CSetting *pSetting)
pControl->SetValue(iCurrentScr);
}
-void CGUIWindowSettingsCategory::FillInFTPServerUser(CSetting *pSetting)
-{
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
- pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
- pControl->Clear();
- pControl->SetShowRange(true);
-
-#ifdef HAS_FTP_SERVER
- int iDefaultFtpUser = 0;
-
- CStdString strFtpUser1; int iUserMax;
- // Get FTP XBOX Users and list them !
- if (CUtil::GetFTPServerUserName(0, strFtpUser1, iUserMax))
- {
- for (int i = 0; i < iUserMax; i++)
- {
- if (CUtil::GetFTPServerUserName(i, strFtpUser1, iUserMax))
- pControl->AddLabel(strFtpUser1.c_str(), i);
- if (strFtpUser1.ToLower() == "xbox") iDefaultFtpUser = i;
- }
- pControl->SetValue(iDefaultFtpUser);
- CUtil::GetFTPServerUserName(iDefaultFtpUser, strFtpUser1, iUserMax);
- g_guiSettings.SetString("servers.ftpserveruser", strFtpUser1.c_str());
- pControl->Update();
- }
- else { //Set "None" if there is no FTP User found!
- pControl->AddLabel(g_localizeStrings.Get(231).c_str(), 0);
- pControl->SetValue(0);
- pControl->Update();
- }
-#endif
-}
-bool CGUIWindowSettingsCategory::SetFTPServerUserPass()
-{
-#ifdef HAS_FTP_SERVER
- // TODO: Read the FileZilla Server XML and Set it here!
- // Get GUI USER and pass and set pass to FTP Server
- CStdString strFtpUserName, strFtpUserPassword;
- strFtpUserName = g_guiSettings.GetString("servers.ftpserveruser");
- strFtpUserPassword = g_guiSettings.GetString("servers.ftpserverpassword");
- if(strFtpUserPassword.size()!=0)
- {
- if (CUtil::SetFTPServerUserPassword(strFtpUserName, strFtpUserPassword))
- {
- // todo! ERROR check! if something goes wrong on SetPW!
- // PopUp OK and Display: FTP Server Password was set succesfull!
- CGUIDialogOK::ShowAndGetInput(728, 0, 1247, 0);
- }
- return true;
- }
- else
- {
- // PopUp OK and Display: FTP Server Password is empty! Try Again!
- CGUIDialogOK::ShowAndGetInput(728, 0, 12358, 0);
- }
-#endif
- return true;
-}
-
void CGUIWindowSettingsCategory::FillInRegions(CSetting *pSetting)
{
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
diff --git a/xbmc/GUIWindowSettingsCategory.h b/xbmc/GUIWindowSettingsCategory.h
index 07ae126b7c..31e22701da 100644
--- a/xbmc/GUIWindowSettingsCategory.h
+++ b/xbmc/GUIWindowSettingsCategory.h
@@ -56,11 +56,9 @@ protected:
void FillInVSyncs(CSetting *pSetting);
void FillInScreenSavers(CSetting *pSetting);
void FillInRegions(CSetting *pSetting);
- void FillInFTPServerUser(CSetting *pSetting);
void FillInStartupWindow(CSetting *pSetting);
void FillInViewModes(CSetting *pSetting, int windowID);
void FillInSortMethods(CSetting *pSetting, int windowID);
- bool SetFTPServerUserPass();
void FillInSkinThemes(CSetting *pSetting);
void FillInSkinColors(CSetting *pSetting);
diff --git a/xbmc/Settings.cpp b/xbmc/Settings.cpp
index 67bb658c55..af31a19d09 100644
--- a/xbmc/Settings.cpp
+++ b/xbmc/Settings.cpp
@@ -1006,13 +1006,6 @@ bool CSettings::LoadProfile(int index)
CLog::Log(LOGINFO, "load language info file:%s", strLangInfoPath.c_str());
g_langInfo.Load(strLangInfoPath);
-#ifdef _XBOX
- CStdString strKeyboardLayoutConfigurationPath;
- strKeyboardLayoutConfigurationPath.Format("special://xbmc/language/%s/keyboardmap.xml", strLanguage.c_str());
- CLog::Log(LOGINFO, "load keyboard layout configuration info file: %s", strKeyboardLayoutConfigurationPath.c_str());
- g_keyboardLayoutConfiguration.Load(strKeyboardLayoutConfigurationPath);
-#endif
-
CStdString strLanguagePath;
strLanguagePath.Format("special://xbmc/language/%s/strings.xml", strLanguage.c_str());
diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp
index 5632bdf61d..98149bfa88 100644
--- a/xbmc/Util.cpp
+++ b/xbmc/Util.cpp
@@ -59,9 +59,6 @@
#include "TextureManager.h"
#include "utils/fstrcmp.h"
#include "MediaManager.h"
-#ifdef HAS_FTP_SERVER
-#include "lib/libfilezilla/xbfilezilla.h"
-#endif
#include "DirectXGraphics.h"
#include "DNSNameCache.h"
#include "GUIWindowManager.h"
@@ -108,8 +105,6 @@ static uint16_t flashrampGreen[256];
static uint16_t flashrampBlue[256];
#endif
-XBOXDETECTION v_xboxclients;
-
CUtil::CUtil(void)
{
}
@@ -2591,377 +2586,6 @@ int CUtil::GMTZoneCalc(int iRescBiases, int iHour, int iMinute, int &iMinuteNew)
return iHourUTC;
}
-bool CUtil::AutoDetection()
-{
- bool bReturn=false;
- if (g_guiSettings.GetBool("autodetect.onoff"))
- {
- static unsigned int pingTimer = 0;
- if( CTimeUtils::GetTimeMS() - pingTimer < (unsigned int)g_advancedSettings.m_autoDetectPingTime * 1000)
- return false;
- pingTimer = CTimeUtils::GetTimeMS();
-
- // send ping and request new client info
- if ( CUtil::AutoDetectionPing(
- g_guiSettings.GetBool("Autodetect.senduserpw") ? g_guiSettings.GetString("servers.ftpserveruser"):"anonymous",
- g_guiSettings.GetBool("Autodetect.senduserpw") ? g_guiSettings.GetString("servers.ftpserverpassword"):"anonymous",
- g_guiSettings.GetString("autodetect.nickname"),21 /*Our FTP Port! TODO: Extract FTP from FTP Server settings!*/) )
- {
- CStdString strFTPPath, strNickName, strFtpUserName, strFtpPassword, strFtpPort, strBoosMode;
- CStdStringArray arSplit;
- // do we have clients in our list ?
- for(unsigned int i=0; i < v_xboxclients.client_ip.size(); i++)
- {
- // extract client informations
- StringUtils::SplitString(v_xboxclients.client_info[i],";", arSplit);
- if ((int)arSplit.size() > 1 && !v_xboxclients.client_informed[i])
- {
- //extract client info and build the ftp link!
- strNickName = arSplit[0].c_str();
- strFtpUserName = arSplit[1].c_str();
- strFtpPassword = arSplit[2].c_str();
- strFtpPort = arSplit[3].c_str();
- strBoosMode = arSplit[4].c_str();
- strFTPPath.Format("ftp://%s:%s@%s:%s/",strFtpUserName.c_str(),strFtpPassword.c_str(),v_xboxclients.client_ip[i],strFtpPort.c_str());
-
- //Do Notification for this Client
- CStdString strtemplbl;
- strtemplbl.Format("%s %s",strNickName, v_xboxclients.client_ip[i]);
- g_application.m_guiDialogKaiToast.QueueNotification(g_localizeStrings.Get(1251), strtemplbl);
-
- //Debug Log
- CLog::Log(LOGDEBUG,"%s: %s FTP-Link: %s", g_localizeStrings.Get(1251).c_str(), strNickName.c_str(), strFTPPath.c_str());
-
- //set the client_informed to TRUE, to prevent loop Notification
- v_xboxclients.client_informed[i]=true;
-
- //YES NO PopUP: ask for connecting to the detected client via Filemanger!
- if (g_guiSettings.GetBool("autodetect.popupinfo") && CGUIDialogYesNo::ShowAndGetInput(1251, 0, 1257, 0))
- {
- g_windowManager.ActivateWindow(WINDOW_FILES, strFTPPath); //Open in MyFiles
- }
- bReturn = true;
- }
- }
- }
- }
- return bReturn;
-}
-
-bool CUtil::AutoDetectionPing(CStdString strFTPUserName, CStdString strFTPPass, CStdString strNickName, int iFTPPort)
-{
- bool bFoundNewClient= false;
- CStdString strLocalIP;
- CStdString strSendMessage = "ping\0";
- CStdString strReceiveMessage = "ping";
- int iUDPPort = 4905;
- char sztmp[512];
-
- static int udp_server_socket, inited=0;
-#ifndef _LINUX
- int cliLen;
-#else
- socklen_t cliLen;
-#endif
- int t1,t2,t3,t4, life=0;
-
- struct sockaddr_in server;
- struct sockaddr_in cliAddr;
- struct timeval timeout={0,500};
- fd_set readfds;
- char hostname[255];
-#ifndef _LINUX
- WORD wVer;
- WSADATA wData;
- PHOSTENT hostinfo;
- wVer = MAKEWORD( 2, 0 );
- if (WSAStartup(wVer,&wData) == 0)
- {
-#else
- struct hostent * hostinfo;
-#endif
- if(gethostname(hostname,sizeof(hostname)) == 0)
- {
- if((hostinfo = gethostbyname(hostname)) != NULL)
- {
- strLocalIP = inet_ntoa (*(struct in_addr *)*hostinfo->h_addr_list);
- strNickName.Format("%s",hostname);
- }
- }
-#ifndef _LINUX
- WSACleanup();
- }
-#endif
- // get IP address
- sscanf( (char *)strLocalIP.c_str(), "%d.%d.%d.%d", &t1, &t2, &t3, &t4 );
- if( !t1 ) return false;
- cliLen = sizeof( cliAddr);
- // setup UDP socket
- if( !inited )
- {
- int tUDPsocket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
- char value = 1;
- setsockopt( tUDPsocket, SOL_SOCKET, SO_BROADCAST, &value, value );
- struct sockaddr_in addr;
- memset(&(addr),0,sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = INADDR_ANY;
- addr.sin_port = htons(iUDPPort);
- bind(tUDPsocket,(struct sockaddr *)(&addr),sizeof(addr));
- udp_server_socket = tUDPsocket;
- inited = 1;
- }
- FD_ZERO(&readfds);
- FD_SET(udp_server_socket, &readfds);
- life = select( 0,&readfds, NULL, NULL, &timeout );
- if (life == SOCKET_ERROR )
- return false;
- memset(&(server),0,sizeof(server));
- server.sin_family = AF_INET;
-#ifndef _LINUX
- server.sin_addr.S_un.S_addr = INADDR_BROADCAST;
-#else
- server.sin_addr.s_addr = INADDR_BROADCAST;
-#endif
- server.sin_port = htons(iUDPPort);
- sendto(udp_server_socket,(char *)strSendMessage.c_str(),5,0,(struct sockaddr *)(&server),sizeof(server));
- FD_ZERO(&readfds);
- FD_SET(udp_server_socket, &readfds);
- life = select( 0,&readfds, NULL, NULL, &timeout );
-
- unsigned int iLookUpCountMax = 2;
- unsigned int i=0;
- bool bUpdateShares=false;
-
- // Ping able clients? 0:false
- if (life == 0 )
- {
- if(v_xboxclients.client_ip.size() > 0)
- {
- // clients in list without life signal!
- // calculate iLookUpCountMax value counter dependence on clients size!
- if(v_xboxclients.client_ip.size() > iLookUpCountMax)
- iLookUpCountMax += (v_xboxclients.client_ip.size()-iLookUpCountMax);
-
- for (i=0; i<v_xboxclients.client_ip.size(); i++)
- {
- bUpdateShares=false;
- //only 1 client, clear our list
- if(v_xboxclients.client_lookup_count[i] >= iLookUpCountMax && v_xboxclients.client_ip.size() == 1 )
- {
- v_xboxclients.client_ip.clear();
- v_xboxclients.client_info.clear();
- v_xboxclients.client_lookup_count.clear();
- v_xboxclients.client_informed.clear();
-
- // debug log, clients removed from our list
- CLog::Log(LOGDEBUG,"Autodetection: all Clients Removed! (mode LIFE 0)");
- bUpdateShares = true;
- }
- else
- {
- // check client lookup counter! Not reached the CountMax, Add +1!
- if(v_xboxclients.client_lookup_count[i] < iLookUpCountMax )
- v_xboxclients.client_lookup_count[i] = v_xboxclients.client_lookup_count[i]+1;
- else
- {
- // client lookup counter REACHED CountMax, remove this client
- v_xboxclients.client_ip.erase(v_xboxclients.client_ip.begin()+i);
- v_xboxclients.client_info.erase(v_xboxclients.client_info.begin()+i);
- v_xboxclients.client_lookup_count.erase(v_xboxclients.client_lookup_count.begin()+i);
- v_xboxclients.client_informed.erase(v_xboxclients.client_informed.begin()+i);
-
- // debug log, clients removed from our list
- CLog::Log(LOGDEBUG,"Autodetection: Client ID:[%i] Removed! (mode LIFE 0)",i );
- bUpdateShares = true;
- }
- }
- if(bUpdateShares)
- {
- // a client is removed from our list, update our shares
- CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES);
- g_windowManager.SendThreadMessage(msg);
- }
- }
- }
- }
- // life !=0 we are online and ready to receive and send
- while( life )
- {
- bFoundNewClient = false;
- bUpdateShares = false;
- // Receive ping request or Info
- int iSockRet = recvfrom(udp_server_socket, sztmp, 512, 0,(struct sockaddr *) &cliAddr, &cliLen);
- if (iSockRet != SOCKET_ERROR)
- {
- CStdString strTmp;
- // do we received a new Client info or just a "ping" request
- if(strReceiveMessage.Equals(sztmp))
- {
- // we received a "ping" request, sending our informations
- strTmp.Format("%s;%s;%s;%d;%d\r\n\0",
- strNickName.c_str(), // Our Nick-, Device Name!
- strFTPUserName.c_str(), // User Name for our FTP Server
- strFTPPass.c_str(), // Password for our FTP Server
- iFTPPort, // FTP PORT Adress for our FTP Server
- 0 ); // BOOSMODE, for our FTP Server!
- sendto(udp_server_socket,(char *)strTmp.c_str(),strlen((char *)strTmp.c_str())+1,0,(struct sockaddr *)(&cliAddr),sizeof(cliAddr));
- }
- else
- {
- //We received new client information, extracting information
- CStdString strInfo, strIP;
- strInfo.Format("%s",sztmp); //this is the client info
- strIP.Format("%d.%d.%d.%d",
-#ifndef _LINUX
- cliAddr.sin_addr.S_un.S_un_b.s_b1,
- cliAddr.sin_addr.S_un.S_un_b.s_b2,
- cliAddr.sin_addr.S_un.S_un_b.s_b3,
- cliAddr.sin_addr.S_un.S_un_b.s_b4
-#else
- (int)((char *)(cliAddr.sin_addr.s_addr))[0],
- (int)((char *)(cliAddr.sin_addr.s_addr))[1],
- (int)((char *)(cliAddr.sin_addr.s_addr))[2],
- (int)((char *)(cliAddr.sin_addr.s_addr))[3]
-#endif
- ); //this is the client IP
-
- //Is this our Local IP ?
- if ( !strIP.Equals(strLocalIP) )
- {
- //is our list empty?
- if(v_xboxclients.client_ip.size() <= 0 )
- {
- // the list is empty, add. this client to the list!
- v_xboxclients.client_ip.push_back(strIP);
- v_xboxclients.client_info.push_back(strInfo);
- v_xboxclients.client_lookup_count.push_back(0);
- v_xboxclients.client_informed.push_back(false);
- bFoundNewClient = true;
- bUpdateShares = true;
- }
- // our list is not empty, check if we allready have this client in our list!
- else
- {
- // this should be a new client or?
- // check list
- bFoundNewClient = true;
- for (i=0; i<v_xboxclients.client_ip.size(); i++)
- {
- if(strIP.Equals(v_xboxclients.client_ip[i].c_str()))
- bFoundNewClient=false;
- }
- if(bFoundNewClient)
- {
- // bFoundNewClient is still true, the client is not in our list!
- // add. this client to our list!
- v_xboxclients.client_ip.push_back(strIP);
- v_xboxclients.client_info.push_back(strInfo);
- v_xboxclients.client_lookup_count.push_back(0);
- v_xboxclients.client_informed.push_back(false);
- bUpdateShares = true;
- }
- else // this is a existing client! check for LIFE & lookup counter
- {
- // calculate iLookUpCountMax value counter dependence on clients size!
- if(v_xboxclients.client_ip.size() > iLookUpCountMax)
- iLookUpCountMax += (v_xboxclients.client_ip.size()-iLookUpCountMax);
-
- for (i=0; i<v_xboxclients.client_ip.size(); i++)
- {
- if(strIP.Equals(v_xboxclients.client_ip[i].c_str()))
- {
- // found client in list, reset looup_Count and the client_info
- v_xboxclients.client_info[i]=strInfo;
- v_xboxclients.client_lookup_count[i] = 0;
- }
- else
- {
- // check client lookup counter! Not reached the CountMax, Add +1!
- if(v_xboxclients.client_lookup_count[i] < iLookUpCountMax )
- v_xboxclients.client_lookup_count[i] = v_xboxclients.client_lookup_count[i]+1;
- else
- {
- // client lookup counter REACHED CountMax, remove this client
- v_xboxclients.client_ip.erase(v_xboxclients.client_ip.begin()+i);
- v_xboxclients.client_info.erase(v_xboxclients.client_info.begin()+i);
- v_xboxclients.client_lookup_count.erase(v_xboxclients.client_lookup_count.begin()+i);
- v_xboxclients.client_informed.erase(v_xboxclients.client_informed.begin()+i);
-
- // debug log, clients removed from our list
- CLog::Log(LOGDEBUG,"Autodetection: Client ID:[%i] Removed! (mode LIFE 1)",i );
-
- // client is removed from our list, update our shares
- CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES);
- g_windowManager.SendThreadMessage(msg);
- }
- }
- }
- // here comes our list for debug log
- for (i=0; i<v_xboxclients.client_ip.size(); i++)
- {
- CLog::Log(LOGDEBUG,"Autodetection: Client ID:[%i] (mode LIFE=1)",i );
- CLog::Log(LOGDEBUG,"----------------------------------------------------------------" );
- CLog::Log(LOGDEBUG,"IP:%s Info:%s LookUpCount:%i Informed:%s",
- v_xboxclients.client_ip[i].c_str(),
- v_xboxclients.client_info[i].c_str(),
- v_xboxclients.client_lookup_count[i],
- v_xboxclients.client_informed[i] ? "true":"false");
- CLog::Log(LOGDEBUG,"----------------------------------------------------------------" );
- }
- }
- }
- if(bUpdateShares)
- {
- // a client is add or removed from our list, update our shares
- CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES);
- g_windowManager.SendThreadMessage(msg);
- }
- }
- }
- }
- else
- {
- CLog::Log(LOGDEBUG, "Autodetection: Socket error %u", WSAGetLastError());
- }
- timeout.tv_sec=0;
- timeout.tv_usec = 5000;
- FD_ZERO(&readfds);
- FD_SET(udp_server_socket, &readfds);
- life = select( 0,&readfds, NULL, NULL, &timeout );
- }
- return bFoundNewClient;
-}
-
-void CUtil::AutoDetectionGetSource(VECSOURCES &shares)
-{
- if(v_xboxclients.client_ip.size() > 0)
- {
- // client list is not empty, add to shares
- CMediaSource share;
- for (unsigned int i=0; i< v_xboxclients.client_ip.size(); i++)
- {
- //extract client info string: NickName;FTP_USER;FTP_Password;FTP_PORT;BOOST_MODE
- CStdString strFTPPath, strNickName, strFtpUserName, strFtpPassword, strFtpPort, strBoosMode;
- CStdStringArray arSplit;
- StringUtils::SplitString(v_xboxclients.client_info[i],";", arSplit);
- if ((int)arSplit.size() > 1)
- {
- strNickName = arSplit[0].c_str();
- strFtpUserName = arSplit[1].c_str();
- strFtpPassword = arSplit[2].c_str();
- strFtpPort = arSplit[3].c_str();
- strBoosMode = arSplit[4].c_str();
- strFTPPath.Format("ftp://%s:%s@%s:%s/",strFtpUserName.c_str(),strFtpPassword.c_str(),v_xboxclients.client_ip[i].c_str(),strFtpPort.c_str());
-
- strNickName.TrimRight(' ');
- share.strName.Format("FTP XBMC_PC (%s)", strNickName.c_str());
- share.strPath.Format("%s",strFTPPath.c_str());
- shares.push_back(share);
- }
- }
- }
-}
bool CUtil::IsFTP(const CStdString& strFile)
{
if( strFile.Left(6).Equals("ftp://") ) return true;
@@ -2970,64 +2594,6 @@ bool CUtil::IsFTP(const CStdString& strFile)
else return false;
}
-bool CUtil::GetFTPServerUserName(int iFTPUserID, CStdString &strFtpUser1, int &iUserMax )
-{
-#ifdef HAS_FTP_SERVER
- if( !g_application.m_pFileZilla )
- return false;
-
- class CXFUser* m_pUser;
- vector<CXFUser*> users;
- g_application.m_pFileZilla->GetAllUsers(users);
- iUserMax = users.size();
- if (iUserMax > 0)
- {
- //for (int i = 1 ; i < iUserSize; i++){ delete users[i]; }
- m_pUser = users[iFTPUserID];
- strFtpUser1 = m_pUser->GetName();
- if (strFtpUser1.size() != 0) return true;
- else return false;
- }
- else
-#endif
- return false;
-}
-bool CUtil::SetFTPServerUserPassword(CStdString strFtpUserName, CStdString strFtpUserPassword)
-{
-#ifdef HAS_FTP_SERVER
- if( !g_application.m_pFileZilla )
- return false;
-
- CStdString strTempUserName;
- class CXFUser* p_ftpUser;
- vector<CXFUser*> v_ftpusers;
- bool bFoundUser = false;
- g_application.m_pFileZilla->GetAllUsers(v_ftpusers);
- int iUserSize = v_ftpusers.size();
- if (iUserSize > 0)
- {
- int i = 1 ;
- while( i <= iUserSize)
- {
- p_ftpUser = v_ftpusers[i-1];
- strTempUserName = p_ftpUser->GetName();
- if (strTempUserName.Equals(strFtpUserName.c_str()) )
- {
- if (p_ftpUser->SetPassword(strFtpUserPassword.c_str()) != XFS_INVALID_PARAMETERS)
- {
- p_ftpUser->CommitChanges();
- g_guiSettings.SetString("servers.ftpserverpassword",strFtpUserPassword.c_str());
- return true;
- }
- break;
- }
- i++;
- }
- }
-#endif
- return false;
-}
-
void CUtil::GetRecursiveListing(const CStdString& strPath, CFileItemList& items, const CStdString& strMask, bool bUseFileDirectories)
{
CFileItemList myItems;
diff --git a/xbmc/Util.h b/xbmc/Util.h
index e5e17c3eb1..90fe28a0d0 100644
--- a/xbmc/Util.h
+++ b/xbmc/Util.h
@@ -61,14 +61,6 @@ struct sortstringbyname
}
};
-struct XBOXDETECTION
-{
- std::vector<CStdString> client_ip;
- std::vector<CStdString> client_info;
- std::vector<unsigned int> client_lookup_count;
- std::vector<bool> client_informed;
-};
-
class CUtil
{
public:
@@ -185,11 +177,6 @@ public:
static bool SetSysDateTimeYear(int iYear, int iMonth, int iDay, int iHour, int iMinute);
static int GMTZoneCalc(int iRescBiases, int iHour, int iMinute, int &iMinuteNew);
static bool IsFTP(const CStdString& strFile);
- static bool GetFTPServerUserName(int iFTPUserID, CStdString &strFtpUser1, int &iUserMax );
- static bool SetFTPServerUserPassword(CStdString strFtpUserName, CStdString strFtpUserPassword);
- static bool AutoDetectionPing(CStdString strFTPUserName, CStdString strFTPPass, CStdString strNickName, int iFTPPort);
- static bool AutoDetection();
- static void AutoDetectionGetSource(VECSOURCES &share);
static void GetSkinThemes(std::vector<CStdString>& vecTheme);
static void GetRecursiveListing(const CStdString& strPath, CFileItemList& items, const CStdString& strMask, bool bUseFileDirectories=false);
static void GetRecursiveDirsListing(const CStdString& strPath, CFileItemList& items);
diff --git a/xbmc/utils/Network.cpp b/xbmc/utils/Network.cpp
index 7742191d82..e09ecbfffe 100644
--- a/xbmc/utils/Network.cpp
+++ b/xbmc/utils/Network.cpp
@@ -134,9 +134,6 @@ void CNetwork::StartServices()
#ifdef HAS_WEB_SERVER
g_application.StartWebServer();
#endif
-#ifdef HAS_FTP_SERVER
- g_application.StartFtpServer();
-#endif
#ifdef HAS_UPNP
g_application.StartUPnP();
#endif
@@ -161,9 +158,6 @@ void CNetwork::StopServices(bool bWait)
#ifdef HAS_TIME_SERVER
g_application.StopTimeServer();
#endif
-#ifdef HAS_FTP_SERVER
- g_application.StopFtpServer();
-#endif
#ifdef HAS_UPNP
g_application.StopUPnP(bWait);
#endif