From f63decac70239656ac4322b03992dcd50f8bf6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Mon, 27 Apr 2015 12:48:57 -0400 Subject: [PATCH] daemon: remove NumberCleaner Refs #71726 Change-Id: I167f7563247243201134ff417595294a49e1b3df --- src/Makefile.am | 2 -- src/manager.cpp | 4 +-- src/numbercleaner.cpp | 66 ------------------------------------------- src/numbercleaner.h | 43 ---------------------------- 4 files changed, 1 insertion(+), 114 deletions(-) delete mode 100644 src/numbercleaner.cpp delete mode 100644 src/numbercleaner.h diff --git a/src/Makefile.am b/src/Makefile.am index e8d873e739..2ce57ab887 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 38b532fe83..a430f6bb7d 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 fdafb3791a..0000000000 --- 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 22c557fe73..0000000000 --- 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_ -- GitLab