aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2010-09-13 07:36:38 +0000
committerjmarshallnz <jmarshallnz@svn>2010-09-13 07:36:38 +0000
commit8be83e58f612ad0cd89c726c8f7ef1b169e7f414 (patch)
tree1eb7a2b90157d4073f8fb28e2b1911e47dbb4319
parentfda8383be321944fdc66bcb330aec07bc88a820b (diff)
merged: r33682,r33683,r33684,r33696,r33697,r33704 from trunk
added: [OSX] Variant.cpp/h to xcode project changed: Move prompting for authentication/keyboard dialog etc. from IDirectory subclasses into CDirectory. Fixes #10127 and #8840 (cherry picked from commit 43e3cfef3bfb84feb5bf6d39a162dbea9b35f706) cosmetics: indenting (cherry picked from commit 152830b54b833961bdfaf73cce169f777cb14377) [WIN32] fixed: typo (cherry picked from commit 5202837a56be2b13625c3fdb39daabc0eba296c6) [WIN32] added: Variant.* files to VS2008 project fixed: PasswordManager would consider itself not loaded if no passwords.xml file exists causing it to ditch any temporary credentials attempting to reload the non-existing file on every AuthenticateURL call. git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/Dharma@33719 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--XBMC.xcodeproj/project.pbxproj8
-rw-r--r--project/VS2008Express/XBMC.vcproj8
-rw-r--r--xbmc/FileSystem/Directory.cpp77
-rw-r--r--xbmc/FileSystem/IDirectory.cpp82
-rw-r--r--xbmc/FileSystem/IDirectory.h50
-rw-r--r--xbmc/FileSystem/LastFMDirectory.cpp13
-rw-r--r--xbmc/FileSystem/SMBDirectory.cpp20
-rw-r--r--xbmc/utils/PasswordManager.cpp40
-rw-r--r--xbmc/win32/WINSMBDirectory.cpp8
9 files changed, 225 insertions, 81 deletions
diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj
index 4203dbd6b3..582602854f 100644
--- a/XBMC.xcodeproj/project.pbxproj
+++ b/XBMC.xcodeproj/project.pbxproj
@@ -264,6 +264,8 @@
7CDFC2AD12021E9E00E182BC /* AutoPtrHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CDFC2AB12021E9E00E182BC /* AutoPtrHandle.cpp */; };
7CDFC2AE12021E9E00E182BC /* AutoPtrHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CDFC2AB12021E9E00E182BC /* AutoPtrHandle.cpp */; };
7CEBD8A80F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEBD8A60F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp */; };
+ 7CF1FD69123E049300B2CBCB /* Variant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF1FD67123E049300B2CBCB /* Variant.cpp */; };
+ 7CF1FD6A123E049300B2CBCB /* Variant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF1FD67123E049300B2CBCB /* Variant.cpp */; };
810C9F630D67BD2F0095F5DD /* PltMediaConnect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 810C9F600D67BD2F0095F5DD /* PltMediaConnect.cpp */; };
810C9FA90D67D1FB0095F5DD /* MythDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 810C9FA50D67D1FB0095F5DD /* MythDirectory.cpp */; };
810C9FAA0D67D1FB0095F5DD /* MythFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 810C9FA70D67D1FB0095F5DD /* MythFile.cpp */; };
@@ -2143,6 +2145,8 @@
7CDFC2AC12021E9E00E182BC /* AutoPtrHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoPtrHandle.h; sourceTree = "<group>"; };
7CEBD8A60F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecialProtocolDirectory.cpp; sourceTree = "<group>"; };
7CEBD8A70F33A0D800CAF6AD /* SpecialProtocolDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialProtocolDirectory.h; sourceTree = "<group>"; };
+ 7CF1FD67123E049300B2CBCB /* Variant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Variant.cpp; sourceTree = "<group>"; };
+ 7CF1FD68123E049300B2CBCB /* Variant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Variant.h; sourceTree = "<group>"; };
810C9F600D67BD2F0095F5DD /* PltMediaConnect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PltMediaConnect.cpp; path = MediaConnect/PltMediaConnect.cpp; sourceTree = "<group>"; };
810C9F610D67BD2F0095F5DD /* PltMediaConnect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PltMediaConnect.h; path = MediaConnect/PltMediaConnect.h; sourceTree = "<group>"; };
810C9FA50D67D1FB0095F5DD /* MythDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MythDirectory.cpp; sourceTree = "<group>"; };
@@ -6790,6 +6794,8 @@
E38E1E8A0D25F9FD00618676 /* TuxBoxUtil.h */,
E38E1E8B0D25F9FD00618676 /* UdpClient.cpp */,
E38E1E8C0D25F9FD00618676 /* UdpClient.h */,
+ 7CF1FD67123E049300B2CBCB /* Variant.cpp */,
+ 7CF1FD68123E049300B2CBCB /* Variant.h */,
E38E1E8D0D25F9FD00618676 /* Weather.cpp */,
E38E1E8E0D25F9FD00618676 /* Weather.h */,
F5A7A859112908F00059D6AA /* WebServer.cpp */,
@@ -8099,6 +8105,7 @@
7CD9742A11BC6EAA00649E31 /* GUITextureGLES.cpp in Sources */,
7CDFC2AE12021E9E00E182BC /* AutoPtrHandle.cpp in Sources */,
F5E728D01227527D00B152C1 /* DVDInputStreamBluray.cpp in Sources */,
+ 7CF1FD6A123E049300B2CBCB /* Variant.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -8966,6 +8973,7 @@
7CD2CD0211B38B000009EFC1 /* xbmcaddonmodule.cpp in Sources */,
7CD9742911BC6EAA00649E31 /* GUITextureGLES.cpp in Sources */,
7CDFC2AD12021E9E00E182BC /* AutoPtrHandle.cpp in Sources */,
+ 7CF1FD69123E049300B2CBCB /* Variant.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/project/VS2008Express/XBMC.vcproj b/project/VS2008Express/XBMC.vcproj
index 8412314c05..5aaf2353c4 100644
--- a/project/VS2008Express/XBMC.vcproj
+++ b/project/VS2008Express/XBMC.vcproj
@@ -3236,6 +3236,10 @@
>
</File>
<File
+ RelativePath="..\..\xbmc\utils\Variant.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\xbmc\VideoInfoTag.cpp"
>
</File>
@@ -5981,6 +5985,10 @@
>
</File>
<File
+ RelativePath="..\..\xbmc\utils\Variant.h"
+ >
+ </File>
+ <File
RelativePath="..\..\xbmc\FileSystem\VirtualDirectory.h"
>
</File>
diff --git a/xbmc/FileSystem/Directory.cpp b/xbmc/FileSystem/Directory.cpp
index df3ee9980b..a91f0ed5d2 100644
--- a/xbmc/FileSystem/Directory.cpp
+++ b/xbmc/FileSystem/Directory.cpp
@@ -143,54 +143,59 @@ bool CDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items, C
pDirectory->SetUseFileDirectories(bUseFileDirectories);
pDirectory->SetExtFileInfo(extFileInfo);
- bool result;
- if (g_application.IsCurrentThread() && allowThreads && !CUtil::IsSpecial(strPath))
+ bool result = false;
+ while (!result)
{
- CSingleExit ex(g_graphicsContext);
-
- CGetDirectory get(*pDirectory, strPath);
- if(!get.Wait(TIME_TO_BUSY_DIALOG))
+ if (g_application.IsCurrentThread() && allowThreads && !CUtil::IsSpecial(strPath))
{
- CGUIDialogBusy* dialog = NULL;
- while(!get.Wait(10))
+ CSingleExit ex(g_graphicsContext);
+
+ CGetDirectory get(*pDirectory, strPath);
+ if(!get.Wait(TIME_TO_BUSY_DIALOG))
{
- CSingleLock lock(g_graphicsContext);
- if(g_windowManager.IsWindowVisible(WINDOW_DIALOG_PROGRESS)
- || g_windowManager.IsWindowVisible(WINDOW_DIALOG_LOCK_SETTINGS))
+ CGUIDialogBusy* dialog = NULL;
+ while(!get.Wait(10))
{
- if(dialog)
+ CSingleLock lock(g_graphicsContext);
+ if(g_windowManager.IsWindowVisible(WINDOW_DIALOG_PROGRESS)
+ || g_windowManager.IsWindowVisible(WINDOW_DIALOG_LOCK_SETTINGS))
{
- dialog->Close();
- dialog = NULL;
+ if(dialog)
+ {
+ dialog->Close();
+ dialog = NULL;
+ }
+ g_windowManager.Process(false);
}
- g_windowManager.Process(false);
- }
- else
- {
- if(dialog == NULL)
+ else
{
- dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
- if(dialog)
- dialog->Show();
+ if(dialog == NULL)
+ {
+ dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
+ if(dialog)
+ dialog->Show();
+ }
+ g_windowManager.Process(true);
}
- g_windowManager.Process(true);
}
+ if(dialog)
+ dialog->Close();
}
- if(dialog)
- dialog->Close();
+ result = get.GetDirectory(items);
+ }
+ else
+ {
+ items.m_strPath = strPath;
+ result = pDirectory->GetDirectory(strPath, items);
}
- result = get.GetDirectory(items);
- }
- else
- {
- items.m_strPath = strPath;
- result = pDirectory->GetDirectory(strPath, items);
- }
- if (!result)
- {
- CLog::Log(LOGERROR, "%s - Error getting %s", __FUNCTION__, strPath.c_str());
- return false;
+ if (!result)
+ {
+ if (g_application.IsCurrentThread() && pDirectory->ProcessRequirements())
+ continue;
+ CLog::Log(LOGERROR, "%s - Error getting %s", __FUNCTION__, strPath.c_str());
+ return false;
+ }
}
// cache the directory, if necessary
diff --git a/xbmc/FileSystem/IDirectory.cpp b/xbmc/FileSystem/IDirectory.cpp
index 66b5a53bbc..5a3716c5c9 100644
--- a/xbmc/FileSystem/IDirectory.cpp
+++ b/xbmc/FileSystem/IDirectory.cpp
@@ -22,6 +22,12 @@
#include "IDirectory.h"
#include "Util.h"
+#include "GUIWindowManager.h"
+#include "GUIDialogOK.h"
+#include "GUIDialogKeyboard.h"
+#include "URL.h"
+#include "utils/PasswordManager.h"
+#include "LocalizeStrings.h"
using namespace XFILE;
@@ -129,3 +135,79 @@ void IDirectory::SetExtFileInfo(bool extFileInfo)
{
m_extFileInfo = extFileInfo;
}
+
+bool IDirectory::ProcessRequirements()
+{
+ CStdString type = m_requirements["type"].asString();
+ if (type == "keyboard")
+ {
+ CStdString input;
+ if (CGUIDialogKeyboard::ShowAndGetInput(input, GetLocalized(m_requirements["heading"]), false))
+ {
+ m_requirements["input"] = input.c_str();
+ return true;
+ }
+ }
+ else if (type == "authenticate")
+ {
+ CURL url(m_requirements["url"].asString());
+ if (CPasswordManager::GetInstance().PromptToAuthenticateURL(url))
+ {
+ m_requirements.clear();
+ return true;
+ }
+ }
+ else if (type == "error")
+ {
+ CGUIDialogOK *dialog = (CGUIDialogOK *)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
+ if (dialog)
+ {
+ dialog->SetHeading(GetLocalized(m_requirements["heading"]));
+ dialog->SetLine(0, GetLocalized(m_requirements["line1"]));
+ dialog->SetLine(1, GetLocalized(m_requirements["line2"]));
+ dialog->SetLine(2, GetLocalized(m_requirements["line3"]));
+ dialog->DoModal();
+ }
+ }
+ m_requirements.clear();
+ return false;
+}
+
+bool IDirectory::GetKeyboardInput(const CVariant &heading, CStdString &input)
+{
+ if (!CStdString(m_requirements["input"].asString()).IsEmpty())
+ {
+ input = m_requirements["input"].asString();
+ return true;
+ }
+ m_requirements.clear();
+ m_requirements["type"] = "keyboard";
+ m_requirements["heading"] = heading;
+ return false;
+}
+
+void IDirectory::SetErrorDialog(const CVariant &heading, const CVariant &line1, const CVariant &line2, const CVariant &line3)
+{
+ m_requirements.clear();
+ m_requirements["type"] = "error";
+ m_requirements["heading"] = heading;
+ m_requirements["line1"] = line1;
+ m_requirements["line2"] = line2;
+ m_requirements["line3"] = line3;
+}
+
+void IDirectory::RequireAuthentication(const CStdString &url)
+{
+ m_requirements.clear();
+ m_requirements["type"] = "authenticate";
+ m_requirements["url"] = url.c_str();
+}
+
+CStdString IDirectory::GetLocalized(const CVariant &var) const
+{
+ if (var.isString())
+ return var.asString();
+ else if (var.isInteger())
+ return g_localizeStrings.Get(var.asInteger());
+ return "";
+}
diff --git a/xbmc/FileSystem/IDirectory.h b/xbmc/FileSystem/IDirectory.h
index 02fa2c7619..7bf9d3db7e 100644
--- a/xbmc/FileSystem/IDirectory.h
+++ b/xbmc/FileSystem/IDirectory.h
@@ -21,6 +21,7 @@
*/
#include "StdString.h"
+#include "utils/Variant.h"
class CFileItemList;
@@ -94,11 +95,60 @@ public:
void SetCacheDirectory(DIR_CACHE_TYPE cacheDirectory);
void SetUseFileDirectories(bool useFileDirectories);
void SetExtFileInfo(bool extFileInfo);
+
+ /*! \brief Process additional requirements before the directory fetch is performed.
+ Some directory fetches may require authentication, keyboard input etc. The IDirectory subclass
+ should call GetKeyboardInput, SetErrorDialog or RequireAuthentication and then return false
+ from the GetDirectory method. CDirectory will then prompt for input from the user, before
+ re-calling the GetDirectory method.
+ \sa GetKeyboardInput, SetErrorDialog, RequireAuthentication
+ */
+ bool ProcessRequirements();
+
protected:
+ /*! \brief Prompt the user for some keyboard input
+ Call this method from the GetDirectory method to retrieve additional input from the user.
+ If this function returns false then no input has been received, and the GetDirectory call
+ should return false.
+ \param heading an integer or string heading for the keyboard dialog
+ \param input [out] the returned input (if available).
+ \return true if keyboard input has been received. False if it hasn't.
+ \sa ProcessRequirements
+ */
+ bool GetKeyboardInput(const CVariant &heading, CStdString &input);
+
+ /*! \brief Show an error dialog on failure of GetDirectory call
+ Call this method from the GetDirectory method to set an error message to be shown to the user
+ \param heading an integer or string heading for the error dialog.
+ \param line1 the first line to be displayed (integer or string).
+ \param line2 the first line to be displayed (integer or string).
+ \param line3 the first line to be displayed (integer or string).
+ \sa ProcessRequirements
+ */
+ void SetErrorDialog(const CVariant &heading, const CVariant &line1, const CVariant &line2 = 0, const CVariant &line3 = 0);
+
+ /*! \brief Prompt the user for authentication of a URL.
+ Call this method from the GetDirectory method when authentication is required from the user, before returning
+ false from the GetDirectory call. The user will be prompted for authentication, and GetDirectory will be
+ re-called.
+ \param url the URL to authenticate.
+ \sa ProcessRequirements
+ */
+ void RequireAuthentication(const CStdString &url);
+
+ /*! \brief Get a localized string from a variant
+ If the varaint is already a string we return directly, else if it's an integer we return the corresponding
+ localized string.
+ \param var the variant to localize.
+ */
+ CStdString GetLocalized(const CVariant &var) const;
+
CStdString m_strFileMask; ///< Holds the file mask specified by SetMask()
bool m_allowPrompting; ///< If true, the directory handlers may prompt the user
DIR_CACHE_TYPE m_cacheDirectory; ///< If !DIR_CACHE_NEVER the directory is cached by g_directoryCache (defaults to DIR_CACHE_ONCE)
bool m_useFileDirectories; ///< If true the directory may allow file directories (defaults to false)
bool m_extFileInfo; ///< If true the GetDirectory call can retrieve extra file information (defaults to true)
+
+ CVariant m_requirements;
};
}
diff --git a/xbmc/FileSystem/LastFMDirectory.cpp b/xbmc/FileSystem/LastFMDirectory.cpp
index 14a17b3907..9cdcaa4ea0 100644
--- a/xbmc/FileSystem/LastFMDirectory.cpp
+++ b/xbmc/FileSystem/LastFMDirectory.cpp
@@ -25,9 +25,7 @@
#include "MusicInfoTag.h"
#include "URL.h"
#include "GUIWindowManager.h"
-#include "GUIDialogOK.h"
#include "GUIDialogProgress.h"
-#include "GUIDialogKeyboard.h"
#include "GUISettings.h"
#include "FileItem.h"
#include "FileCurl.h"
@@ -93,7 +91,7 @@ bool CLastFMDirectory::RetrieveList(CStdString url)
if (!m_dlgProgress->IsCanceled() && m_Error)
{
if (m_dlgProgress) m_dlgProgress->Close();
- CGUIDialogOK::ShowAndGetInput(257, 15280, 0, 0);
+ SetErrorDialog(257, 15280, 0, 0);
CLog::Log(LOGERROR, "Unable to retrieve list from last.fm");
return false;
}
@@ -102,7 +100,7 @@ bool CLastFMDirectory::RetrieveList(CStdString url)
if (!m_xmlDoc.LoadFile(m_strDestination))
{
if (m_dlgProgress) m_dlgProgress->Close();
- CGUIDialogOK::ShowAndGetInput(257, 15280, 0, 0);
+ SetErrorDialog(257, 15280, 0, 0);
CLog::Log(LOGERROR, "Error parsing file from audioscrobbler web services, Line %d\n%s", m_xmlDoc.ErrorRow(), m_xmlDoc.ErrorDesc());
return false;
}
@@ -426,7 +424,7 @@ bool CLastFMDirectory::SearchSimilarArtists(CFileItemList &items)
{
CStdString strSearchTerm = "";
- if (!CGUIDialogKeyboard::ShowAndGetInput(strSearchTerm, g_localizeStrings.Get(15281), false))
+ if (!GetKeyboardInput(15281, strSearchTerm))
return false;
m_objname = m_encodedobjname = strSearchTerm;
@@ -441,7 +439,7 @@ bool CLastFMDirectory::SearchSimilarTags(CFileItemList &items)
{
CStdString strSearchTerm = "";
- if (!CGUIDialogKeyboard::ShowAndGetInput(strSearchTerm, g_localizeStrings.Get(15282), false))
+ if (!GetKeyboardInput(15282, strSearchTerm))
return false;
m_objname = m_encodedobjname = strSearchTerm;
@@ -614,11 +612,12 @@ bool CLastFMDirectory::GetDirectory(const CStdString& strPath, CFileItemList &it
CUtil::URLDecode(m_encodedobjname);
AddEntry(15255, "lastfm://xbmc/user/%name%/", "", true, items);
}
+ return true;
}
else
return false;
- return true;
+ return m_Error;
}
DIR_CACHE_TYPE CLastFMDirectory::GetCacheType(const CStdString& strPath) const
diff --git a/xbmc/FileSystem/SMBDirectory.cpp b/xbmc/FileSystem/SMBDirectory.cpp
index 7861923bc2..cf6fc5fa07 100644
--- a/xbmc/FileSystem/SMBDirectory.cpp
+++ b/xbmc/FileSystem/SMBDirectory.cpp
@@ -38,7 +38,6 @@
#include "Util.h"
#include "LocalizeStrings.h"
#include "GUIWindowManager.h"
-#include "GUIDialogOK.h"
#include "Application.h"
#include "FileItem.h"
#include "AdvancedSettings.h"
@@ -307,12 +306,8 @@ int CSMBDirectory::OpenDir(const CURL& url, CStdString& strAuth)
#endif
{
if (m_allowPrompting)
- {
- if (!CPasswordManager::GetInstance().PromptToAuthenticateURL(urlIn))
- break;
- }
- else
- break;
+ RequireAuthentication(urlIn.Get());
+ break;
}
else
{
@@ -330,16 +325,7 @@ int CSMBDirectory::OpenDir(const CURL& url, CStdString& strAuth)
#endif
if (m_allowPrompting)
- {
- CGUIDialogOK* pDialog = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
- pDialog->SetHeading(257);
- pDialog->SetLine(0, cError);
- pDialog->SetLine(1, "");
- pDialog->SetLine(2, "");
-
- ThreadMessage tMsg = {TMSG_DIALOG_DOMODAL, WINDOW_DIALOG_OK, g_windowManager.GetActiveWindow()};
- g_application.getApplicationMessenger().SendMessage(tMsg, false);
- }
+ SetErrorDialog(257, cError.c_str());
break;
}
}
diff --git a/xbmc/utils/PasswordManager.cpp b/xbmc/utils/PasswordManager.cpp
index 6a4eb50a1e..536db2f82f 100644
--- a/xbmc/utils/PasswordManager.cpp
+++ b/xbmc/utils/PasswordManager.cpp
@@ -24,6 +24,8 @@
#include "URL.h"
#include "Settings.h"
#include "XMLUtils.h"
+#include "utils/log.h"
+#include "FileSystem/File.h"
using namespace std;
@@ -99,24 +101,32 @@ void CPasswordManager::Clear()
void CPasswordManager::Load()
{
Clear();
- TiXmlDocument doc;
- if (!doc.LoadFile(g_settings.GetUserDataItem("passwords.xml")))
- return;
- const TiXmlElement *root = doc.RootElement();
- if (root->ValueStr() != "passwords")
- return;
- // read in our passwords
- const TiXmlElement *path = root->FirstChildElement("path");
- while (path)
+ CStdString passwordsFile = g_settings.GetUserDataItem("passwords.xml");
+ if (XFILE::CFile::Exists(passwordsFile))
{
- CStdString from, to;
- if (XMLUtils::GetPath(path, "from", from) && XMLUtils::GetPath(path, "to", to))
+ TiXmlDocument doc;
+ if (!doc.LoadFile(passwordsFile))
+ {
+ CLog::Log(LOGERROR, "%s - Unable to load: %s, Line %d\n%s",
+ __FUNCTION__, passwordsFile.c_str(), doc.ErrorRow(), doc.ErrorDesc());
+ return;
+ }
+ const TiXmlElement *root = doc.RootElement();
+ if (root->ValueStr() != "passwords")
+ return;
+ // read in our passwords
+ const TiXmlElement *path = root->FirstChildElement("path");
+ while (path)
{
- m_permanentCache[from] = to;
- m_temporaryCache[from] = to;
- m_temporaryCache[GetServerLookup(from)] = to;
+ CStdString from, to;
+ if (XMLUtils::GetPath(path, "from", from) && XMLUtils::GetPath(path, "to", to))
+ {
+ m_permanentCache[from] = to;
+ m_temporaryCache[from] = to;
+ m_temporaryCache[GetServerLookup(from)] = to;
+ }
+ path = path->NextSiblingElement("path");
}
- path = path->NextSiblingElement("path");
}
m_loaded = true;
}
diff --git a/xbmc/win32/WINSMBDirectory.cpp b/xbmc/win32/WINSMBDirectory.cpp
index 026e36ce85..5ac84fc1f6 100644
--- a/xbmc/win32/WINSMBDirectory.cpp
+++ b/xbmc/win32/WINSMBDirectory.cpp
@@ -385,12 +385,8 @@ bool CWINSMBDirectory::ConnectToShare(const CURL& url)
{
CLog::Log(LOGERROR,"Couldn't connect to %s, access denied", strUNC.c_str());
if (m_allowPrompting)
- {
- if (!CPasswordManager::GetInstance().PromptToAuthenticateURL(urlIn))
- break;
- }
- else
- break;
+ RequireAuthentication(urlIn.Get());
+ break;
}
else if(dwRet == ERROR_SESSION_CREDENTIAL_CONFLICT)
{