From ff37d557570d4456375380deff61880b240d184e Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Mon, 23 Apr 2012 14:34:39 -0400
Subject: [PATCH] * #9910: SIP: cleanup

---
 daemon/src/sip/sipaccount.cpp  |  2 +-
 daemon/src/sip/sipaccount.h    |  6 +++---
 daemon/src/sip/sipvoiplink.cpp | 11 +++++------
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp
index 050123f442..1fce8c82e4 100644
--- a/daemon/src/sip/sipaccount.cpp
+++ b/daemon/src/sip/sipaccount.cpp
@@ -400,7 +400,7 @@ void SIPAccount::setAccountDetails(std::map<std::string, std::string> details)
     publishedIpAddress_ = details[CONFIG_PUBLISHED_ADDRESS];
     localPort_ = atoi(details[CONFIG_LOCAL_PORT].c_str());
     publishedPort_ = atoi(details[CONFIG_PUBLISHED_PORT].c_str());
-    if(stunServer_ != details[CONFIG_STUN_SERVER]) {
+    if (stunServer_ != details[CONFIG_STUN_SERVER]) {
         DEBUG("Stun server changed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
         link_->sipTransport.destroyStunResolver(stunServer_);
         // pj_stun_sock_destroy(pj_stun_sock *stun_sock);
diff --git a/daemon/src/sip/sipaccount.h b/daemon/src/sip/sipaccount.h
index fb6980f19d..82ac7d9e87 100644
--- a/daemon/src/sip/sipaccount.h
+++ b/daemon/src/sip/sipaccount.h
@@ -469,7 +469,7 @@ class SIPAccount : public Account {
          * @param The public IPV4 address in the standard dot notation.
          * @return void
          */
-        void setPublishedAddress(const std::string& publishedIpAddress) {
+        void setPublishedAddress(const std::string &publishedIpAddress) {
             publishedIpAddress_ = publishedIpAddress;
         }
 
@@ -497,11 +497,11 @@ class SIPAccount : public Account {
             return zrtpHelloHash_;
         }
 
-        void setReceivedParameter(std::string received) {
+        void setReceivedParameter(const std::string &received) {
             receivedParameter_ = received;
         }
 
-        std::string getReceivedParameter() {
+        std::string getReceivedParameter() const {
             return receivedParameter_;
         }
 
diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp
index b1ebcc9153..041af3f903 100644
--- a/daemon/src/sip/sipvoiplink.cpp
+++ b/daemon/src/sip/sipvoiplink.cpp
@@ -1563,13 +1563,12 @@ void update_contact_header(pjsip_regc_cbparam *param, SIPAccount *account)
     pj_pool_release(pool);
 }
 
-static void looksForReceivedParameter(pjsip_regc_cbparam *param, SIPAccount *account) {
+void lookForReceivedParameter(pjsip_regc_cbparam *param, SIPAccount *account)
+{
     pj_str_t receivedValue = param->rdata->msg_info.via->recvd_param;
-    std::string publicIpFromReceived = "";
 
-    ERROR("looksForReceivedParameter");
-    if(receivedValue.slen) {
-        publicIpFromReceived = std::string(receivedValue.ptr, receivedValue.slen);
+    if (receivedValue.slen) {
+        std::string publicIpFromReceived(receivedValue.ptr, receivedValue.slen);
         DEBUG("Cool received received parameter... uhhh?, the value is %s", publicIpFromReceived.c_str());
         account->setReceivedParameter(publicIpFromReceived);
     }
@@ -1614,7 +1613,7 @@ void registration_cb(pjsip_regc_cbparam *param)
     if (param->code < 0 || param->code >= 300) {
         switch (param->code) {
             case 606:
-                looksForReceivedParameter(param, account);
+                lookForReceivedParameter(param, account);
                 account->setRegistrationState(ErrorNotAcceptable);
                 break;
 
-- 
GitLab