From a8cfbf96aca74fe51c58d3c9ee6e26e876e8ea30 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Mon, 3 Jun 2013 15:21:17 -0400
Subject: [PATCH] account: move split_string into Account

---
 daemon/src/account.cpp        | 16 ++++++++++++++++
 daemon/src/account.h          |  3 +++
 daemon/src/iax/iaxaccount.cpp |  2 +-
 daemon/src/managerimpl.cpp    | 17 +----------------
 daemon/src/managerimpl.h      |  2 --
 daemon/src/sip/sipaccount.cpp |  2 +-
 6 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/daemon/src/account.cpp b/daemon/src/account.cpp
index 6c859f213e..ce497ce18a 100644
--- a/daemon/src/account.cpp
+++ b/daemon/src/account.cpp
@@ -211,6 +211,22 @@ std::string join_string(const std::vector<std::string> &v)
 }
 }
 
+std::vector<std::string>
+Account::split_string(std::string s)
+{
+    std::vector<std::string> list;
+    std::string temp;
+
+    while (s.find("/", 0) != std::string::npos) {
+        size_t pos = s.find("/", 0);
+        temp = s.substr(0, pos);
+        s.erase(0, pos + 1);
+        list.push_back(temp);
+    }
+
+    return list;
+}
+
 
 void Account::setActiveAudioCodecs(const vector<string> &list)
 {
diff --git a/daemon/src/account.h b/daemon/src/account.h
index 71bf9c0bf7..b2aabf09c9 100644
--- a/daemon/src/account.h
+++ b/daemon/src/account.h
@@ -189,6 +189,9 @@ class Account : public Serializable {
             mailBox_ = mb;
         }
 
+        static std::vector<std::string>
+        split_string(std::string s);
+
         static const char * const VIDEO_CODEC_ENABLED;
         static const char * const VIDEO_CODEC_NAME;
         static const char * const VIDEO_CODEC_PARAMETERS;
diff --git a/daemon/src/iax/iaxaccount.cpp b/daemon/src/iax/iaxaccount.cpp
index 6010d3b4ee..302d450201 100644
--- a/daemon/src/iax/iaxaccount.cpp
+++ b/daemon/src/iax/iaxaccount.cpp
@@ -95,7 +95,7 @@ void IAXAccount::unserialize(const Conf::YamlNode &map)
     map.getValue(AUDIO_CODECS_KEY, &audioCodecStr_);
 
     // Update codec list which one is used for SDP offer
-    setActiveAudioCodecs(ManagerImpl::split_string(audioCodecStr_));
+    setActiveAudioCodecs(split_string(audioCodecStr_));
     map.getValue(DISPLAY_NAME_KEY, &displayName_);
 }
 
diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index 8d950e03e0..0aa4e7ded4 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -1897,21 +1897,6 @@ std::string ManagerImpl::createConfigFile() const
     return configdir + DIR_SEPARATOR_STR + PROGNAME + ".yml";
 }
 
-std::vector<std::string> ManagerImpl::split_string(std::string s)
-{
-    std::vector<std::string> list;
-    std::string temp;
-
-    while (s.find("/", 0) != std::string::npos) {
-        size_t pos = s.find("/", 0);
-        temp = s.substr(0, pos);
-        s.erase(0, pos + 1);
-        list.push_back(temp);
-    }
-
-    return list;
-}
-
 std::string ManagerImpl::getCurrentAudioCodecName(const std::string& id)
 {
     std::string accountid = getAccountFromCall(id);
@@ -2538,7 +2523,7 @@ std::string ManagerImpl::getNewCallID()
 
 std::vector<std::string> ManagerImpl::loadAccountOrder() const
 {
-    return split_string(preferences.getAccountOrder());
+    return Account::split_string(preferences.getAccountOrder());
 }
 
 namespace {
diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h
index 4cb02aacbf..6159442154 100644
--- a/daemon/src/managerimpl.h
+++ b/daemon/src/managerimpl.h
@@ -577,8 +577,6 @@ class ManagerImpl {
          */
         void setEchoCancelState(const std::string &state);
 
-        static std::vector<std::string> split_string(std::string v);
-
         /**
          * Ringtone option.
          * If ringtone is enabled, ringtone on incoming call use custom choice. If not, only standart tone.
diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp
index 53762491fc..4f4e116fec 100644
--- a/daemon/src/sip/sipaccount.cpp
+++ b/daemon/src/sip/sipaccount.cpp
@@ -318,7 +318,7 @@ void SIPAccount::unserialize(const Conf::YamlNode &mapNode)
     if (not isIP2IP()) mapNode.getValue(MAILBOX_KEY, &mailBox_);
     mapNode.getValue(AUDIO_CODECS_KEY, &audioCodecStr_);
     // Update codec list which one is used for SDP offer
-    setActiveAudioCodecs(ManagerImpl::split_string(audioCodecStr_));
+    setActiveAudioCodecs(split_string(audioCodecStr_));
 #ifdef SFL_VIDEO
     YamlNode *videoCodecsNode(mapNode.getValue(VIDEO_CODECS_KEY));
 
-- 
GitLab