From 631833fe7ef9308ea6375d86f1ad5caed499d1b6 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou Date: Fri, 15 Jan 2010 15:40:53 -0500 Subject: [PATCH] [#2659] Make URL hook handle multiple $_GET arguments --- sflphone-common/src/hooks/urlhook.cpp | 27 +++++++++++++++++++++++- sflphone-common/test/hookmanagerTest.cpp | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/sflphone-common/src/hooks/urlhook.cpp b/sflphone-common/src/hooks/urlhook.cpp index b50aa1feb..3538602fb 100644 --- a/sflphone-common/src/hooks/urlhook.cpp +++ b/sflphone-common/src/hooks/urlhook.cpp @@ -19,6 +19,7 @@ #include "urlhook.h" #include +#include UrlHook::UrlHook () { } @@ -28,9 +29,33 @@ int UrlHook::addAction (std::string field_value, std::string command) { std::string command_bg; + std::string temp; + std::vector args; + size_t pos; + unsigned int i; + + /* Escape the '&' char to not discard $_GET parameters in the URL - #2659 */ + while ( (pos = field_value.find ("&", 0)) != std::string::npos) { + temp = field_value.substr (0, pos); + field_value.erase (0, pos + 1); + args.push_back (temp); + std::cout << temp << " " << std::endl; + } + + command_bg = command + " "; + + pos = args.size (); + for (i=0; iaddAction ("www.google.ca", "x-www-browser"); + status = urlhook->addAction ("http://www.google.ca/?arg1=arg1&arg2=nvls&x=2&y=45&z=1", "x-www-browser"); CPPUNIT_ASSERT (status == 0); }