Commit 23b894cb authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

[#2518] Add a specific status for IP2IP_PROFILE

parent 39ec936a
......@@ -161,7 +161,7 @@ void account_list_set_current (account_t *current)
}
const gchar * account_state_name(account_state_t s)
const gchar * account_state_name (account_state_t s)
{
gchar * state;
switch(s)
......@@ -193,6 +193,9 @@ const gchar * account_state_name(account_state_t s)
case ACCOUNT_STATE_ERROR_EXIST_STUN:
state = _("Stun server invalid");
break;
case IP2IP_PROFILE_STATUS:
state = _("Ready");
break;
default:
state = _("Invalid");
break;
......
......@@ -50,8 +50,9 @@ typedef enum
/** Stun server configuration error. The account is not registered */
ACCOUNT_STATE_ERROR_CONF_STUN,
/** Stun server is not existing. The account is not registered */
ACCOUNT_STATE_ERROR_EXIST_STUN
ACCOUNT_STATE_ERROR_EXIST_STUN,
/** IP profile status **/
IP2IP_PROFILE_STATUS
} account_state_t;
/** @struct account_t
......
......@@ -265,6 +265,9 @@ void sflphone_fill_account_list (void) {
{
a->state = ACCOUNT_STATE_ERROR_EXIST_STUN;
}
else if (strcmp (status, "READY") == 0) {
a->state = IP2IP_PROFILE_STATUS;
}
else
{
a->state = ACCOUNT_STATE_INVALID;
......
......@@ -52,6 +52,7 @@
#include <sys/stat.h> // mkdir(2)
#include <pwd.h> // getpwuid
#define DIRECT_IP_CALL "IP CALL"
#define fill_config_str(name, value) \
(_config.addConfigTreeItem(section, Conf::ConfigTreeItem(std::string(name), std::string(value), type_str)))
......@@ -3368,7 +3369,9 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou
_debug ("Cannot getAccountDetails on a non-existing accountID %s. Defaults will be used.", accountID.c_str());
}
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, getConfigString (accountID, CONFIG_ACCOUNT_ALIAS)));
// The IP profile does not allow to set an alias
(accountID == IP2IP_PROFILE) ? a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, DIRECT_IP_CALL)) :
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, getConfigString (accountID, CONFIG_ACCOUNT_ALIAS)));
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ENABLE, getConfigString (accountID, CONFIG_ACCOUNT_ENABLE)));
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_RESOLVE_ONCE, getConfigString (accountID, CONFIG_ACCOUNT_RESOLVE_ONCE)));
......@@ -3394,17 +3397,24 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou
std::string registrationStateDescription;
if (account != NULL) {
state = account->getRegistrationState();
int code = account->getRegistrationStateDetailed().first;
std::stringstream out;
out << code;
registrationStateCode = out.str();
registrationStateDescription = account->getRegistrationStateDetailed().second;
if (accountID == IP2IP_PROFILE) {
registrationStateCode = EMPTY_FIELD;
registrationStateDescription = "Direct IP call";
}
else {
state = account->getRegistrationState();
int code = account->getRegistrationStateDetailed().first;
std::stringstream out;
out << code;
registrationStateCode = out.str();
registrationStateDescription = account->getRegistrationStateDetailed().second;
}
} else {
state = Unregistered;
}
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, mapStateNumberToString (state)));
(accountID == IP2IP_PROFILE) ? a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, "READY")) :
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, mapStateNumberToString (state)));
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATE_CODE, registrationStateCode));
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATE_DESCRIPTION, registrationStateDescription));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment