Skip to content
Snippets Groups Projects
Commit 2aa75780 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

correction

parent 7dd04827
No related branches found
No related tags found
No related merge requests found
...@@ -59,24 +59,9 @@ sflphone_notify_voice_mail (guint count) ...@@ -59,24 +59,9 @@ sflphone_notify_voice_mail (guint count)
if( account_list_get_size() > 0 ) if( account_list_get_size() > 0 )
{ {
account_t* acc = account_list_get_by_state( ACCOUNT_STATE_REGISTERED ); account_t* acc = account_list_get_by_state( ACCOUNT_STATE_REGISTERED );
if( acc == NULL ) if( acc != NULL )
{
// Notify that no account is registered
//notify_no_account_registered();
}
else
{
if( account_list_get_default() == NULL ){
// Notify that the first registered account has count voice mails
notify_voice_mails( count , acc ); notify_voice_mails( count , acc );
} }
else
{
// Notify that the default registered account has count voice mails
notify_voice_mails( count , account_list_get_by_id(account_list_get_default()) );
}
}
}
} }
void void
...@@ -84,16 +69,15 @@ status_bar_display_account( call_t* c) ...@@ -84,16 +69,15 @@ status_bar_display_account( call_t* c)
{ {
gchar* msg; gchar* msg;
account_t* acc; account_t* acc;
if(c->accountID != NULL) if(c->accountID != NULL){
acc = account_list_get_by_id(c->accountID); acc = account_list_get_by_id(c->accountID);
else msg = g_markup_printf_escaped("%s account- %s" ,
acc = account_list_get_by_id( account_list_get_default());
msg = g_markup_printf_escaped("Default: %s account- %s" ,
g_hash_table_lookup( acc->properties , ACCOUNT_TYPE), g_hash_table_lookup( acc->properties , ACCOUNT_TYPE),
g_hash_table_lookup( acc->properties , ACCOUNT_ALIAS)); g_hash_table_lookup( acc->properties , ACCOUNT_ALIAS));
status_bar_message_add( msg , __MSG_ACCOUNT_DEFAULT); status_bar_message_add( msg , __MSG_ACCOUNT_DEFAULT);
g_free(msg); g_free(msg);
} }
}
gboolean gboolean
...@@ -210,7 +194,7 @@ sflphone_init() ...@@ -210,7 +194,7 @@ sflphone_init()
{ {
dbus_register(getpid(), "Gtk+ Client"); dbus_register(getpid(), "Gtk+ Client");
sflphone_fill_account_list(); sflphone_fill_account_list();
sflphone_set_default_account(); sflphone_set_current_account();
sflphone_fill_codec_list(); sflphone_fill_codec_list();
return TRUE; return TRUE;
} }
...@@ -486,7 +470,8 @@ sflphone_keypad( guint keyval, gchar * key) ...@@ -486,7 +470,8 @@ sflphone_keypad( guint keyval, gchar * key)
dbus_hang_up(c); dbus_hang_up(c);
break; break;
default: // TODO should this be here? default: // TODO should this be here?
//dbus_play_dtmf(key); // To play the dtmf when calling mail box for instance
dbus_play_dtmf(key);
if (keyval < 255 || (keyval >65453 && keyval < 65466)) if (keyval < 255 || (keyval >65453 && keyval < 65466))
{ {
gchar * temp = g_strconcat(call_get_number(c), key, NULL); gchar * temp = g_strconcat(call_get_number(c), key, NULL);
...@@ -504,7 +489,7 @@ sflphone_keypad( guint keyval, gchar * key) ...@@ -504,7 +489,7 @@ sflphone_keypad( guint keyval, gchar * key)
{ {
case 65293: /* ENTER */ case 65293: /* ENTER */
case 65421: /* ENTER numpad */ case 65421: /* ENTER numpad */
status_bar_display_account(c); //status_bar_display_account(c);
dbus_accept(c); dbus_accept(c);
break; break;
case 65307: /* ESCAPE */ case 65307: /* ESCAPE */
...@@ -583,54 +568,50 @@ sflphone_keypad( guint keyval, gchar * key) ...@@ -583,54 +568,50 @@ sflphone_keypad( guint keyval, gchar * key)
void void
sflphone_place_call ( call_t * c ) sflphone_place_call ( call_t * c )
{ {
status_bar_display_account(c); //status_bar_display_account(c);
if(c->state == CALL_STATE_DIALING) if(c->state == CALL_STATE_DIALING)
{ {
account_t * account; account_t * current = account_list_get_current();
gchar* account_id = account_list_get_current(); if( current )
if( account_id == NULL ){
account_id = account_list_get_default();
account = account_list_get_by_id(account_id);
}
else
account = account_list_get_by_id( account_id );
// Here : account_id is either the default one, either the current one selected with a right-click
if(account)
{ {
if(strcmp(g_hash_table_lookup(account->properties, "Status"),"REGISTERED")==0) if(strcmp(g_hash_table_lookup( current->properties, "Status"),"REGISTERED")==0)
{ {
c->accountID = account_id; // OK, everything alright - the call is made with the current account
c -> accountID = current -> accountID;
dbus_place_call(c); dbus_place_call(c);
} }
else else
{ {
main_window_error_message(_("The account selected as default is not registered.")); // the current account (ie the first in the list) isn't registered
// So we try the next one. If it is registered, place a call with
int pos;
for( pos = 1 ; pos < account_list_get_size() ; pos++ ){
current = account_list_get_nth(pos);
if( current ){
if( strcmp(g_hash_table_lookup( current->properties, "Status"),"REGISTERED")==0 ){
// notify_switch_account();
//main_warning_error_message(_("Switch account."));
c -> accountID = current -> accountID;
dbus_place_call(c);
break;
} }
} }
else{
account = account_list_get_by_state (ACCOUNT_STATE_REGISTERED);
if(account)
{
c->accountID = account->accountID;
dbus_place_call(c);
} }
else
{
main_window_error_message(_("There is no registered account to make this call with."));
} }
}
else{
// notify_no_accounts();
main_window_error_message(_("There is no accounts to make this call with."));
} }
} }
} }
/* Internal to action - set the DEFAULT_ACCOUNT variable */ /* Internal to action - set the __CURRENT_ACCOUNT variable */
void void
sflphone_set_default_account( ) sflphone_set_current_account()
{ {
gchar* default_id = strdup(dbus_get_default_account()); if( account_list_get_size > 0 )
account_list_set_default(default_id); account_list_set_current_pos( 0 );
} }
void void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment