changed: Move actual protocol translation in a seperate static function
authorarnova <arnova@void.org>
Wed, 20 Jun 2012 09:22:02 +0000 (11:22 +0200)
committerarnova <arnova@void.org>
Sat, 30 Jun 2012 22:46:22 +0000 (00:46 +0200)
xbmc/URL.cpp
xbmc/URL.h

index 6916002..68834cb 100644 (file)
@@ -433,19 +433,7 @@ const CStdString& CURL::GetProtocol() const
 
 const CStdString CURL::GetTranslatedProtocol() const
 {
-  if (m_strProtocol == "shout"
-   || m_strProtocol == "daap"
-   || m_strProtocol == "dav"
-   || m_strProtocol == "tuxbox"
-   || m_strProtocol == "lastfm"
-   || m_strProtocol == "mms"
-   || m_strProtocol == "rss")
-   return "http";
-  
-  if (m_strProtocol == "davs")
-    return "https";
-  
-  return m_strProtocol;
+  return TranslateProtocol(m_strProtocol);
 }
 
 const CStdString& CURL::GetFileType() const
@@ -715,3 +703,21 @@ void CURL::Encode(CStdString& strURLData)
   }
   strURLData = strResult;
 }
+
+CStdString CURL::TranslateProtocol(const CStdString& prot)
+{
+  if (prot == "shout"
+   || prot == "daap"
+   || prot == "dav"
+   || prot == "tuxbox"
+   || prot == "lastfm"
+   || prot == "mms"
+   || prot == "rss")
+   return "http";
+
+  if (prot == "davs")
+    return "https";
+
+  return prot;
+}
+
index 3ecba1f..2807e5a 100644 (file)
@@ -71,6 +71,8 @@ public:
   static bool IsFullPath(const CStdString &url); ///< return true if the url includes the full path
   static void Decode(CStdString& strURLData);
   static void Encode(CStdString& strURLData);
+  static CStdString TranslateProtocol(const CStdString& prot);
+
 protected:
   int m_iPort;
   CStdString m_strHostName;