summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjak1 <mike.wollmann@gmail.com>2021-12-18 22:32:34 +0100
committerjak1 <mike.wollmann@gmail.com>2021-12-18 22:32:34 +0100
commitf1b95ce0ff54d6a403ba07ad3dc899b638ffade2 (patch)
tree0e7e6f318ad7abc6d11b4c53c8ebc71c660c2692
parentbecb122a45942224e597fab88f40d5811e9c825c (diff)
downloadplus-f1b95ce0ff54d6a403ba07ad3dc899b638ffade2.tar.gz
plus-f1b95ce0ff54d6a403ba07ad3dc899b638ffade2.tar.bz2
plus-f1b95ce0ff54d6a403ba07ad3dc899b638ffade2.tar.xz
plus-f1b95ce0ff54d6a403ba07ad3dc899b638ffade2.zip
added ftp:// to url command also @@ftp:/foo.bar|baz@@ fixes #38
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp3
-rw-r--r--src/gui/windows/serverinfowindow.cpp4
-rw-r--r--src/progs/manaplus/actions/commands.cpp5
-rw-r--r--src/utils/browserboxtools.cpp4
4 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 7be4287b5..bb5e3e29a 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -187,7 +187,8 @@ void ItemLinkHandler::handleLink(const std::string &link,
if (link.empty())
return;
- if (strStartWith(link, "http://") || strStartWith(link, "https://"))
+ if (strStartWith(link, "http://") || strStartWith(link, "https://") ||
+ strStartWith(link, "ftp://"))
{
handleHttpLink(link, event);
}
diff --git a/src/gui/windows/serverinfowindow.cpp b/src/gui/windows/serverinfowindow.cpp
index f571d29e1..51af4db5c 100644
--- a/src/gui/windows/serverinfowindow.cpp
+++ b/src/gui/windows/serverinfowindow.cpp
@@ -87,8 +87,8 @@ ServerInfoWindow::~ServerInfoWindow()
void ServerInfoWindow::handleLink(const std::string &link,
MouseEvent *const event A_UNUSED)
{
- if (strStartWith(link, "http://") ||
- strStartWith(link, "https://"))
+ if (strStartWith(link, "http://") || strStartWith(link, "https://") ||
+ strStartWith(link, "ftp://"))
{
openBrowser(link);
}
diff --git a/src/progs/manaplus/actions/commands.cpp b/src/progs/manaplus/actions/commands.cpp
index 711816eac..ff0d91e3d 100644
--- a/src/progs/manaplus/actions/commands.cpp
+++ b/src/progs/manaplus/actions/commands.cpp
@@ -724,7 +724,8 @@ impHandler(url)
if (event.tab != nullptr)
{
std::string url1 = event.args;
- if (!strStartWith(url1, "http") && !strStartWith(url1, "?"))
+ if (!strStartWith(url1, "http") && !strStartWith(url1, "ftp") &&
+ !strStartWith(url1, "?"))
url1 = "http://" + url1;
std::string str(strprintf("[@@%s |%s@@]",
url1.c_str(), event.args.c_str()));
@@ -737,7 +738,7 @@ impHandler(url)
impHandler(openUrl)
{
std::string url = event.args;
- if (!strStartWith(url, "http"))
+ if (!strStartWith(url, "http") && !strStartWith(url, "ftp"))
url = "http://" + url;
openBrowser(url);
return true;
diff --git a/src/utils/browserboxtools.cpp b/src/utils/browserboxtools.cpp
index 28339abb2..771b4e4e7 100644
--- a/src/utils/browserboxtools.cpp
+++ b/src/utils/browserboxtools.cpp
@@ -75,8 +75,8 @@ std::string BrowserBoxTools::replaceLinkCommands(const std::string &link)
std::string data = link;
- if (strStartWith(data, "http://") ||
- strStartWith(data, "https://"))
+ if (strStartWith(data, "http://") || strStartWith(data, "https://") ||
+ strStartWith(data, "ftp://"))
{
return data;
}