diff --git a/bin/dbus/cx.ring.Ring.ConfigurationManager.xml b/bin/dbus/cx.ring.Ring.ConfigurationManager.xml index c92808cb6b73e23ec766f0fea1462b238419ca5d..7f6f1f44eabe25b527b4f92edb66bc796f1810d5 100644 --- a/bin/dbus/cx.ring.Ring.ConfigurationManager.xml +++ b/bin/dbus/cx.ring.Ring.ConfigurationManager.xml @@ -1114,19 +1114,6 @@ </arg> </method> - <!-- Hook configuration --> - <method name="getHookSettings" tp:name-for-bindings="getHookSettings"> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="MapStringString"/> - <arg type="a{ss}" name="settings" direction="out"> - </arg> - </method> - - <method name="setHookSettings" tp:name-for-bindings="setHookSettings"> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="MapStringString"/> - <arg type="a{ss}" name="settings" direction="in"> - </arg> - </method> - <signal name="accountsChanged" tp:name-for-bindings="accountsChanged"> </signal> diff --git a/bin/dbus/dbusconfigurationmanager.cpp b/bin/dbus/dbusconfigurationmanager.cpp index 3f072bc26ced576b234c84f5aefd885270c5bf5a..70f86c6b85a98116a3402590e0006a266e2ebb07 100644 --- a/bin/dbus/dbusconfigurationmanager.cpp +++ b/bin/dbus/dbusconfigurationmanager.cpp @@ -487,18 +487,6 @@ DBusConfigurationManager::setAccountsOrder(const std::string& order) DRing::setAccountsOrder(order); } -auto -DBusConfigurationManager::getHookSettings() -> decltype(DRing::getHookSettings()) -{ - return DRing::getHookSettings(); -} - -void -DBusConfigurationManager::setHookSettings(const std::map<std::string, std::string>& settings) -{ - DRing::setHookSettings(settings); -} - auto DBusConfigurationManager::validateCertificate(const std::string& accountId, const std::string& certificate) -> decltype(DRing::validateCertificate(accountId, certificate)) { diff --git a/bin/dbus/dbusconfigurationmanager.h b/bin/dbus/dbusconfigurationmanager.h index 75a2b64a9b81dfe497eaf78d0a2dc5993bd6db7a..893424cdc3e9df6d1c4b018391c5fce1389f4554 100644 --- a/bin/dbus/dbusconfigurationmanager.h +++ b/bin/dbus/dbusconfigurationmanager.h @@ -138,8 +138,6 @@ class DRING_PUBLIC DBusConfigurationManager : void setRingingTimeout(const int32_t& timeout); int32_t getRingingTimeout(); void setAccountsOrder(const std::string& order); - std::map<std::string, std::string> getHookSettings(); - void setHookSettings(const std::map<std::string, std::string>& settings); std::vector<std::map<std::string, std::string>> getCredentials(const std::string& accountID); void setCredentials(const std::string& accountID, const std::vector<std::map<std::string, std::string>>& details); std::string getAddrFromInterfaceName(const std::string& interface); diff --git a/bin/jni/configurationmanager.i b/bin/jni/configurationmanager.i index 2a698a792a3e7f86cd0d1e4ef267aba2d2041fbc..bb280fb3aceef7dc6ab58c4582bbb20b06bb6144 100644 --- a/bin/jni/configurationmanager.i +++ b/bin/jni/configurationmanager.i @@ -168,9 +168,6 @@ int32_t getRingingTimeout(); void setAccountsOrder(const std::string& order); -std::map<std::string, std::string> getHookSettings(); -void setHookSettings(const std::map<std::string, std::string>& settings); - std::vector<std::map<std::string, std::string> > getCredentials(const std::string& accountID); void setCredentials(const std::string& accountID, const std::vector<std::map<std::string, std::string> >& details); diff --git a/bin/nodejs/configurationmanager.i b/bin/nodejs/configurationmanager.i index c1757fdcf5b32d1ee0665a13a8b9c63ba38f00f7..8633a7fccc1983796db398525f0ea6a1051bbc13 100644 --- a/bin/nodejs/configurationmanager.i +++ b/bin/nodejs/configurationmanager.i @@ -159,9 +159,6 @@ int32_t getRingingTimeout(); void setAccountsOrder(const std::string& order); -std::map<std::string, std::string> getHookSettings(); -void setHookSettings(const std::map<std::string, std::string>& settings); - std::vector<std::map<std::string, std::string> > getCredentials(const std::string& accountID); void setCredentials(const std::string& accountID, const std::vector<std::map<std::string, std::string> >& details); diff --git a/configure.ac b/configure.ac index 2efeab8971d40ead044420c0b2bb10da01c19941..ddf51cd4a1978a231344cebc05f553197ea02827 100644 --- a/configure.ac +++ b/configure.ac @@ -623,7 +623,6 @@ AC_CONFIG_FILES([Makefile \ src/media/audio/sound/Makefile \ src/config/Makefile \ src/client/Makefile \ - src/hooks/Makefile \ src/media/video/Makefile \ src/media/video/v4l2/Makefile \ src/media/video/androidvideo/Makefile \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ebb1af5a8bf7e18dfd93abac20b02ca0235e51f8..d2489e952681a48f786525791e86b9e9c6c542e7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -79,7 +79,6 @@ set (Source_Files ${Source_Files} PARENT_SCOPE) add_subdirectory(client) add_subdirectory(config) add_subdirectory(dring) -add_subdirectory(hooks) add_subdirectory(im) add_subdirectory(jamidht) add_subdirectory(media) diff --git a/src/Makefile.am b/src/Makefile.am index 97213484e5e0835a7c90d8126b9b79d0783586d5..3c0dbbc769387f3aef7f33a2109bf27583fb9182 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,7 +33,7 @@ ENABLE_VIDEO_LIBS+= \ endif endif -SUBDIRS = client media config hooks sip upnp security jamidht im $(ENABLE_VIDEO_SUBDIR) +SUBDIRS = client media config sip upnp security jamidht im $(ENABLE_VIDEO_SUBDIR) if ENABLE_PLUGIN SUBDIRS+=plugin @@ -48,7 +48,6 @@ libring_la_LIBADD = \ ./media/libmedia.la \ ./client/libclient.la \ ./config/libconfig.la \ - ./hooks/libhooks.la \ ./security/libsecurity.la \ ./upnp/libupnpcontrol.la \ ./jamidht/libringacc.la \ diff --git a/src/client/configurationmanager.cpp b/src/client/configurationmanager.cpp index b9155df1b5457b189627b71eb62c79910d4ef9d0..9fcbf0578a7758dcc90e6f30b5146c8ba872ce52 100644 --- a/src/client/configurationmanager.cpp +++ b/src/client/configurationmanager.cpp @@ -71,7 +71,6 @@ using jami::JamiAccount; using jami::tls::TlsValidator; using jami::tls::CertificateStore; using jami::AudioDeviceType; -using jami::HookPreference; void registerConfHandlers(const std::map<std::string, std::shared_ptr<CallbackWrapperBase>>& handlers) @@ -921,18 +920,6 @@ muteRingtone(bool mute) return; } -std::map<std::string, std::string> -getHookSettings() -{ - return jami::Manager::instance().hookPreference.toMap(); -} - -void -setHookSettings(const std::map<std::string, std::string>& settings) -{ - jami::Manager::instance().hookPreference = HookPreference(settings); -} - void setAccountsOrder(const std::string& order) { diff --git a/src/dring/configurationmanager_interface.h b/src/dring/configurationmanager_interface.h index 55d0e3159eb9de656f8c06789df0b58cd5e2ce56..732ca1134a2b6fdfa52f9d99de11b7eec3ad3c8e 100644 --- a/src/dring/configurationmanager_interface.h +++ b/src/dring/configurationmanager_interface.h @@ -173,9 +173,6 @@ DRING_PUBLIC int32_t getRingingTimeout(); DRING_PUBLIC void setAccountsOrder(const std::string& order); -DRING_PUBLIC std::map<std::string, std::string> getHookSettings(); -DRING_PUBLIC void setHookSettings(const std::map<std::string, std::string>& settings); - DRING_PUBLIC std::vector<std::map<std::string, std::string>> getCredentials( const std::string& accountID); DRING_PUBLIC void setCredentials(const std::string& accountID, diff --git a/src/hooks/CMakeLists.txt b/src/hooks/CMakeLists.txt deleted file mode 100644 index 79f6f00d5e8c4d1a166a6c09024e1de0d248dee1..0000000000000000000000000000000000000000 --- a/src/hooks/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -################################################################################ -# Source groups - hooks -################################################################################ -list (APPEND Source_Files__hooks - "${CMAKE_CURRENT_SOURCE_DIR}/urlhook.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/urlhook.h" -) - -set (Source_Files__hooks ${Source_Files__hooks} PARENT_SCOPE) \ No newline at end of file diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am deleted file mode 100644 index 33a0882f81611306078067bbdf9a55e43f1c0d18..0000000000000000000000000000000000000000 --- a/src/hooks/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -noinst_LTLIBRARIES = libhooks.la - -libhooks_la_SOURCES = \ - urlhook.cpp urlhook.h diff --git a/src/hooks/urlhook.cpp b/src/hooks/urlhook.cpp deleted file mode 100644 index 0b697a411779272fb359e90bf79368ac3bf4f5ce..0000000000000000000000000000000000000000 --- a/src/hooks/urlhook.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2004-2020 Savoir-faire Linux Inc. - * - * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "urlhook.h" -#include <cstdlib> - -namespace jami { - -int -UrlHook::runAction(const std::string& command, const std::string& args) -{ - // FIXME : use fork and execve, so no need to escape shell arguments - const std::string cmd = command + (args.empty() ? "" : " ") + "\"" + args + "\" &"; - -#if __APPLE__ -#include "TargetConditionals.h" -#if defined(TARGET_IPHONE_SIMULATOR) || defined(TARGET_OS_IPHONE) - return 0; -#endif -#elif defined(RING_UWP) - return 0; -#else - return system(cmd.c_str()); -#endif -} - -} // namespace jami diff --git a/src/hooks/urlhook.h b/src/hooks/urlhook.h deleted file mode 100644 index 0d251ebdef34d0ab392d85c18d1c5d0a0c7b2897..0000000000000000000000000000000000000000 --- a/src/hooks/urlhook.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2004-2020 Savoir-faire Linux Inc. - * - * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef URL_HOOK_H -#define URL_HOOK_H - -#include <string> - -namespace jami { -namespace UrlHook { - -int runAction(const std::string& command, const std::string& arg); - -} -} // namespace jami - -#endif // URL_HOOK_H diff --git a/src/manager.cpp b/src/manager.cpp index cb6f8cd100636496233a62f946b7e8d1e603c92d..c71a777af6186b8eebc819b9dadd9ae45fff20d5 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -706,7 +706,6 @@ Manager::instance() Manager::Manager() : preferences() , voipPreferences() - , hookPreference() , audioPreference() , shortcutPreferences() #ifdef ENABLE_VIDEO @@ -947,11 +946,10 @@ Manager::outgoingCall(const std::string& account_id, JAMI_DBG() << "try outgoing call to '" << to << "'" << " with account '" << account_id << "'"; - std::string to_cleaned = hookPreference.getNumberAddPrefix() + trim(to); std::shared_ptr<Call> call; try { - call = newOutgoingCall(to_cleaned, account_id, volatileCallDetails); + call = newOutgoingCall(trim(to), account_id, volatileCallDetails); } catch (const std::exception& e) { JAMI_ERR("%s", e.what()); return {}; @@ -1730,7 +1728,6 @@ Manager::saveConfig() preferences.verifyAccountOrder(getAccountList()); preferences.serialize(out); voipPreferences.serialize(out); - hookPreference.serialize(out); audioPreference.serialize(out); #ifdef ENABLE_VIDEO videoPreferences.serialize(out); @@ -2823,7 +2820,6 @@ Manager::loadAccountMap(const YAML::Node& node) // build preferences preferences.unserialize(node); voipPreferences.unserialize(node); - hookPreference.unserialize(node); audioPreference.unserialize(node); shortcutPreferences.unserialize(node); #ifdef ENABLE_VIDEO diff --git a/src/manager.h b/src/manager.h index 24414b362aa7c36c28d542e8b09738e7466fafd6..5296c47c983c169fee1892e3c581efded5c571ee 100644 --- a/src/manager.h +++ b/src/manager.h @@ -86,11 +86,6 @@ public: */ VoipPreference voipPreferences; - /** - * Hook preferences - */ - HookPreference hookPreference; - /** * Audio preferences */ diff --git a/src/meson.build b/src/meson.build index a03dc79c1c9142ac032f986c74de29b317634f51..b8c611b6cf2f540c6f9a6846d84cf971fc0b2e96 100644 --- a/src/meson.build +++ b/src/meson.build @@ -12,7 +12,6 @@ libjami_sources = files( 'client/presencemanager.cpp', 'client/ring_signal.cpp', 'config/yamlparser.cpp', - 'hooks/urlhook.cpp', 'im/instant_messaging.cpp', 'im/message_engine.cpp', 'jamidht/eth/libdevcore/Common.cpp', diff --git a/src/preferences.cpp b/src/preferences.cpp index 1d5f42ed23f0ad473a97c73bc1d6894e21897a37..e66f1d21a3e02fefa4a0fc74cb08c293544df0c8 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -64,7 +64,6 @@ #pragma GCC diagnostic pop #include "config/yamlparser.h" -#include "hooks/urlhook.h" #include "sip/sip_utils.h" #include <sstream> #include <algorithm> @@ -100,14 +99,6 @@ static constexpr const char* PULSE_LENGTH_KEY {"pulseLength"}; static constexpr const char* SYMMETRIC_RTP_KEY {"symmetric"}; static constexpr const char* ZID_FILE_KEY {"zidFile"}; -// hooks preferences -constexpr const char* const HookPreference::CONFIG_LABEL; -static constexpr const char* NUMBER_ADD_PREFIX_KEY {"numberAddPrefix"}; -static constexpr const char* NUMBER_ENABLED_KEY {"numberEnabled"}; -static constexpr const char* SIP_ENABLED_KEY {"sipEnabled"}; -static constexpr const char* URL_COMMAND_KEY {"urlCommand"}; -static constexpr const char* URL_SIP_FIELD_KEY {"urlSipField"}; - // audio preferences constexpr const char* const AudioPreference::CONFIG_LABEL; static constexpr const char* ALSAMAP_KEY {"alsa"}; @@ -286,66 +277,6 @@ VoipPreference::unserialize(const YAML::Node& in) parseValue(node, ZID_FILE_KEY, zidFile_); } -HookPreference::HookPreference() - : numberAddPrefix_("") - , numberEnabled_(false) - , sipEnabled_(false) - , urlCommand_("x-www-browser") - , urlSipField_("X-ring-url") -{} - -HookPreference::HookPreference(const std::map<std::string, std::string>& settings) - : numberAddPrefix_(settings.find("PHONE_NUMBER_HOOK_ADD_PREFIX")->second) - , numberEnabled_(settings.find("PHONE_NUMBER_HOOK_ENABLED")->second == "true") - , sipEnabled_(settings.find("URLHOOK_SIP_ENABLED")->second == "true") - , urlCommand_(settings.find("URLHOOK_COMMAND")->second) - , urlSipField_(settings.find("URLHOOK_SIP_FIELD")->second) -{} - -std::map<std::string, std::string> -HookPreference::toMap() const -{ - std::map<std::string, std::string> settings; - settings["PHONE_NUMBER_HOOK_ADD_PREFIX"] = numberAddPrefix_; - settings["PHONE_NUMBER_HOOK_ENABLED"] = numberEnabled_ ? "true" : "false"; - settings["URLHOOK_SIP_ENABLED"] = sipEnabled_ ? "true" : "false"; - settings["URLHOOK_COMMAND"] = urlCommand_; - settings["URLHOOK_SIP_FIELD"] = urlSipField_; - - return settings; -} - -void -HookPreference::serialize(YAML::Emitter& out) const -{ - out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap; - out << YAML::Key << NUMBER_ADD_PREFIX_KEY << YAML::Value << numberAddPrefix_; - out << YAML::Key << SIP_ENABLED_KEY << YAML::Value << sipEnabled_; - out << YAML::Key << URL_COMMAND_KEY << YAML::Value << urlCommand_; - out << YAML::Key << URL_SIP_FIELD_KEY << YAML::Value << urlSipField_; - out << YAML::EndMap; -} - -void -HookPreference::unserialize(const YAML::Node& in) -{ - const auto& node = in[CONFIG_LABEL]; - - parseValue(node, NUMBER_ADD_PREFIX_KEY, numberAddPrefix_); - parseValue(node, SIP_ENABLED_KEY, sipEnabled_); - parseValue(node, URL_COMMAND_KEY, urlCommand_); - parseValue(node, URL_SIP_FIELD_KEY, urlSipField_); -} - -void -HookPreference::runHook(pjsip_msg* msg) -{ - if (sipEnabled_) { - const std::string header(sip_utils::fetchHeaderValue(msg, urlSipField_)); - UrlHook::runAction(urlCommand_, header); - } -} - AudioPreference::AudioPreference() : audioApi_(PULSEAUDIO_API_STR) , alsaCardin_(atoi(ALSA_DFT_CARD)) diff --git a/src/preferences.h b/src/preferences.h index ec7a92cad9b0454e1ccfcbebb4403e06854d8c78..67c6f95c2fa00b837f1bf28fdbd4859758453939 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -147,37 +147,6 @@ private: constexpr static const char* const CONFIG_LABEL = "voipPreferences"; }; -class HookPreference : public Serializable -{ -public: - HookPreference(); - HookPreference(const std::map<std::string, std::string>& settings); - - void serialize(YAML::Emitter& out) const override; - void unserialize(const YAML::Node& in) override; - - std::string getNumberAddPrefix() const - { - if (numberEnabled_) - return numberAddPrefix_; - else - return ""; - } - - const std::string& getUrlCommand() const { return urlCommand_; } - - std::map<std::string, std::string> toMap() const; - void runHook(pjsip_msg* msg); - -private: - std::string numberAddPrefix_; - bool numberEnabled_; - bool sipEnabled_; - std::string urlCommand_; - std::string urlSipField_; - constexpr static const char* const CONFIG_LABEL = "hooks"; -}; - class AudioPreference : public Serializable { public: diff --git a/src/sip/sipvoiplink.cpp b/src/sip/sipvoiplink.cpp index 892d655628fb6743f0d53d4ff9ea55cce7973388..4245db83625ce821536ba5e82fe97ba9044083f8 100644 --- a/src/sip/sipvoiplink.cpp +++ b/src/sip/sipvoiplink.cpp @@ -323,8 +323,6 @@ transaction_request_cb(pjsip_rx_data* rdata) return PJ_FALSE; } - Manager::instance().hookPreference.runHook(rdata->msg_info.msg); - bool hasVideo = false; if (r_sdp) { auto pj_str_video = pj_str((char*) "video"); diff --git a/tools/dringctrl/dring.functest.yml b/tools/dringctrl/dring.functest.yml index 4b13d5d7fdc704cf0dc46fe43a712be97f68237c..1f2ed6bbe49ff239c3ddf34e7121e4575c29f8b1 100644 --- a/tools/dringctrl/dring.functest.yml +++ b/tools/dringctrl/dring.functest.yml @@ -175,9 +175,6 @@ addressbook: hooks: numberAddPrefix: numberEnabled: false - sipEnabled: false - urlCommand: x-www-browser - urlSipField: X-sflphone-url audio: alsa: cardIn: 0