diff --git a/src/Makefile.am b/src/Makefile.am index e8d873e7390ff935839f913e6c06d7a128cf1b03..2ce57ab887bc5e5982aa2a667329cabedc50ad74 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -108,7 +108,6 @@ libring_la_SOURCES = conference.cpp \ call.cpp \ account.cpp \ logger.c \ - numbercleaner.cpp \ fileutils.cpp \ threadloop.cpp \ ip_utils.h \ @@ -130,7 +129,6 @@ libring_la_SOURCES = conference.cpp \ account.h \ call.h \ logger.h \ - numbercleaner.h \ fileutils.h \ noncopyable.h \ utf8_utils.h \ diff --git a/src/manager.cpp b/src/manager.cpp index 38b532fe836f6b6788dc44feffcb482d55a7319d..a430f6bb7da3b19e46d19b794777095824f0ab8c 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -58,7 +58,6 @@ #include "im/instant_messaging.h" -#include "numbercleaner.h" #include "config/yamlparser.h" #if HAVE_ALSA @@ -436,8 +435,7 @@ Manager::outgoingCall(const std::string& preferred_account_id, const std::string& conf_id) { std::string current_call_id(getCurrentCallId()); - std::string prefix(hookPreference.getNumberAddPrefix()); - std::string to_cleaned(NumberCleaner::clean(to, prefix)); + std::string to_cleaned = hookPreference.getNumberAddPrefix() + trim(to); std::shared_ptr<Call> call; try { diff --git a/src/numbercleaner.cpp b/src/numbercleaner.cpp deleted file mode 100644 index fdafb3791ae64921a81962801795ce5e080db6f6..0000000000000000000000000000000000000000 --- a/src/numbercleaner.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2004-2015 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. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "numbercleaner.h" - -#include "string_utils.h" - -#include <algorithm> - -#define INVALID_CHAR " -()" - -namespace ring { namespace NumberCleaner { - -static void -strip_chars(const std::string &to_strip, std::string &num) -{ - for (const auto &item : to_strip) - num.erase(std::remove(num.begin(), num.end(), item), num.end()); -} - -std::string -clean(std::string to_clean, const std::string &prefix) -{ - to_clean = trim(to_clean); - size_t pos; - //Hostname and DNS can have '-' - if ((pos = to_clean.find("@")) == std::string::npos) { - strip_chars(INVALID_CHAR, to_clean); - return to_clean.insert(0, prefix); - } - else { - std::string high = to_clean.substr(0,pos+1); - strip_chars(INVALID_CHAR, high); - return high+to_clean.substr(pos+1); - } -} - -}} // namespace ring::NumberCleaner diff --git a/src/numbercleaner.h b/src/numbercleaner.h deleted file mode 100644 index 22c557fe734897651f63d09b87350c3bce9dbc8d..0000000000000000000000000000000000000000 --- a/src/numbercleaner.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2004-2015 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. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#ifndef _NUMBER_CLEANER_H_ -#define _NUMBER_CLEANER_H_ - -#include <string> - -namespace ring { namespace NumberCleaner { - -std::string clean(std::string to_clean, const std::string &prefix = ""); - -}} // namespace ring::NumberCleaner - -#endif // _NUMBER_CLEANER_H_