llweb.cpp

Go to the documentation of this file.
00001 
00033 #include "llviewerprecompiledheaders.h"
00034 
00035 #include "llweb.h"
00036 
00037 #include "llwindow.h"
00038 
00039 //#include "llfloaterhtml.h"
00040 #include "llviewercontrol.h"
00041 
00042 // static
00043 void LLWeb::loadURL(std::string url)
00044 {
00045         loadURLExternal(url);
00046 }
00047 
00048 
00049 // static
00050 void LLWeb::loadURLExternal(std::string url)
00051 {
00052         std::string escaped_url = escapeURL(url);
00053 #if LL_LIBXUL_ENABLED
00054         spawn_web_browser(escaped_url.c_str());
00055 #endif
00056 }
00057 
00058 
00059 // static
00060 std::string LLWeb::escapeURL(std::string url)
00061 {
00062         // The CURL curl_escape() function escapes colons, slashes,
00063         // and all characters but A-Z and 0-9.  Do a cheesy mini-escape.
00064         std::string escaped_url;
00065         S32 len = url.length();
00066         for (S32 i = 0; i < len; i++)
00067         {
00068                 char c = url[i];
00069                 if (c == ' ')
00070                 {
00071                         escaped_url += "%20";
00072                 }
00073                 else if (c == '\\')
00074                 {
00075                         escaped_url += "%5C";
00076                 }
00077                 else
00078                 {
00079                         escaped_url += c;
00080                 }
00081         }
00082         return escaped_url;
00083 }

Generated on Thu Jul 1 06:09:45 2010 for Second Life Viewer by  doxygen 1.4.7