From c080c414f9be7521f914d3779056effcca28b40a Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.com> Date: Fri, 1 Oct 2010 12:05:42 -0400 Subject: [PATCH] [#4220] Fix account mailbox number in config --- sflphone-common/src/account.h | 14 ++++++++++++++ sflphone-common/src/iax/iaxaccount.cpp | 11 +++++++++-- sflphone-common/src/sip/sipaccount.cpp | 14 +++++++++++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/sflphone-common/src/account.h b/sflphone-common/src/account.h index 10ca4f887b..ded1ae93a0 100644 --- a/sflphone-common/src/account.h +++ b/sflphone-common/src/account.h @@ -339,6 +339,14 @@ class Account : public Serializable _useragent = ua; } + std::string getMailBox (void) { + return _mailBox; + } + + void setMailBox (std::string mb) { + _mailBox = mb; + } + private: // copy constructor Account (const Account& rh); @@ -436,6 +444,12 @@ class Account : public Serializable */ std::string _useragent; + + /** + * Account mail box + */ + std::string _mailBox; + }; #endif diff --git a/sflphone-common/src/iax/iaxaccount.cpp b/sflphone-common/src/iax/iaxaccount.cpp index ee4428aaba..a4aa8915eb 100644 --- a/sflphone-common/src/iax/iaxaccount.cpp +++ b/sflphone-common/src/iax/iaxaccount.cpp @@ -60,7 +60,7 @@ void IAXAccount::serialize (Conf::YamlEmitter *emitter) Conf::ScalarNode hostname (Account::_hostname); Conf::ScalarNode enable (_enabled ? "true" : "false"); Conf::ScalarNode type (Account::_type); - Conf::ScalarNode mailbox ("97"); + Conf::ScalarNode mailbox (_mailBox); Conf::ScalarNode codecs (_codecStr); Conf::ScalarNode displayName (_displayName); @@ -139,7 +139,12 @@ void IAXAccount::unserialize (Conf::MappingNode *map) val = NULL; } - // val = (Conf::ScalarNode *)(map->getValue(mailboxKey)); + val = (Conf::ScalarNode *) (map->getValue (mailboxKey)); + + if (val) { + _mailBox = val->getValue(); + val = NULL; + } val = (Conf::ScalarNode *) (map->getValue (codecsKey)); @@ -192,6 +197,7 @@ void IAXAccount::setAccountDetails (const std::map<std::string, std::string>& de setHostname (hostname); setPassword (password); setEnabled ( (accountEnable.compare ("true") == 0) ? true : false); + setMailBox (mailbox); std::string displayName; find_in_map (DISPLAY_NAME, displayName) @@ -215,6 +221,7 @@ std::map<std::string, std::string> IAXAccount::getAccountDetails() a.insert (std::pair<std::string, std::string> (HOSTNAME, getHostname())); a.insert (std::pair<std::string, std::string> (USERNAME, getUsername())); a.insert (std::pair<std::string, std::string> (PASSWORD, getPassword())); + a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_MAILBOX, getMailBox())); RegistrationState state = Unregistered; std::string registrationStateCode; diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index a928edbce4..baedf08739 100644 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -177,7 +177,7 @@ void SIPAccount::serialize (Conf::YamlEmitter *emitter) Conf::ScalarNode port (portstr.str()); Conf::ScalarNode serviceRoute (_serviceRoute); - Conf::ScalarNode mailbox ("97"); + Conf::ScalarNode mailbox (_mailBox); Conf::ScalarNode publishAddr (_publishedIpAddress); std::stringstream publicportstr; publicportstr << _publishedPort; @@ -339,7 +339,12 @@ void SIPAccount::unserialize (Conf::MappingNode *map) val = NULL; } - // val = (Conf::ScalarNode *)(map->getValue(mailboxKey)); + val = (Conf::ScalarNode *) (map->getValue (mailboxKey)); + + if (val) { + _mailBox = val->getValue(); + val = NULL; + } val = (Conf::ScalarNode *) (map->getValue (codecsKey)); @@ -383,7 +388,6 @@ void SIPAccount::unserialize (Conf::MappingNode *map) val = NULL; } - // val = (Conf::ScalarNode *)(map->getValue(mailboxKey)); val = (Conf::ScalarNode *) (map->getValue (publishAddrKey)); if (val) { @@ -662,6 +666,7 @@ void SIPAccount::setAccountDetails (const std::map<std::string, std::string>& de setEnabled ( (accountEnable == "true")); setRingtonePath (ringtonePath); setRingtoneEnabled ( (ringtoneEnabled == "true")); + setMailBox (mailbox); // SIP specific account settings if (getType() == "SIP") { @@ -841,6 +846,9 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() a.insert (std::pair<std::string, std::string> (CONFIG_RINGTONE_PATH, getRingtonePath())); a.insert (std::pair<std::string, std::string> (CONFIG_RINGTONE_ENABLED, getRingtoneEnabled() ? "true" : "false")); + a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_MAILBOX, getMailBox())); + + RegistrationState state = Unregistered; std::string registrationStateCode; std::string registrationStateDescription; -- GitLab