mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
Account handling OK
But no persistence for prefered account (order)
This commit is contained in:
@ -112,7 +112,7 @@ notify_voice_mails( guint count , account_t* acc )
|
||||
}
|
||||
|
||||
void
|
||||
notify_switch_account( account_t* acc )
|
||||
notify_current_account( account_t* acc )
|
||||
{
|
||||
// the account is different from NULL
|
||||
GdkPixbuf *pixbuf;
|
||||
@ -124,7 +124,7 @@ notify_switch_account( account_t* acc )
|
||||
g_hash_table_lookup( acc->properties , ACCOUNT_TYPE) ,
|
||||
g_hash_table_lookup( acc->properties , ACCOUNT_ALIAS));
|
||||
|
||||
title = g_markup_printf_escaped(_("Switching account"));
|
||||
title = g_markup_printf_escaped(_("Current account"));
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file(ICON_DIR "/sflphone.png", NULL);
|
||||
|
||||
|
@ -42,7 +42,7 @@ void notify_incoming_call( call_t* c);
|
||||
|
||||
void notify_voice_mails( guint count , account_t* acc );
|
||||
|
||||
void notify_switch_account( account_t* acc );
|
||||
void notify_current_account( account_t* acc );
|
||||
void notify_no_accounts( );
|
||||
void notify_no_registered_accounts( );
|
||||
/*
|
||||
|
@ -129,7 +129,10 @@ account_list_get_nth ( guint n )
|
||||
account_t*
|
||||
account_list_get_current( )
|
||||
{
|
||||
return account_list_get_by_id( __CURRENT_ACCOUNT_ID );
|
||||
if( __CURRENT_ACCOUNT_ID != NULL )
|
||||
return account_list_get_by_id( __CURRENT_ACCOUNT_ID );
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -570,41 +570,48 @@ sflphone_place_call ( call_t * c )
|
||||
{
|
||||
if(c->state == CALL_STATE_DIALING)
|
||||
{
|
||||
account_t * current = account_list_get_current();
|
||||
if( current )
|
||||
if( account_list_get_size() == 0 )
|
||||
notify_no_accounts();
|
||||
else if( account_list_get_by_state( ACCOUNT_STATE_REGISTERED ) == NULL )
|
||||
notify_no_registered_accounts();
|
||||
else
|
||||
{
|
||||
if(g_strcasecmp(g_hash_table_lookup( current->properties, "Status"),"REGISTERED")==0)
|
||||
{
|
||||
// OK, everything alright - the call is made with the current account
|
||||
c -> accountID = current -> accountID;
|
||||
status_bar_display_account(c);
|
||||
dbus_place_call(c);
|
||||
account_t * current = account_list_get_current();
|
||||
if( current )
|
||||
{
|
||||
if(g_strcasecmp(g_hash_table_lookup( current->properties, "Status"),"REGISTERED")==0)
|
||||
{
|
||||
// OK, everything alright - the call is made with the current account
|
||||
c -> accountID = current -> accountID;
|
||||
status_bar_display_account(c);
|
||||
dbus_place_call(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No current accounts have been setup.
|
||||
// So we place a call with the first registered account
|
||||
// And we change the current account
|
||||
current = account_list_get_by_state( ACCOUNT_STATE_REGISTERED );
|
||||
c -> accountID = current -> accountID;
|
||||
dbus_place_call(c);
|
||||
notify_current_account( current );
|
||||
status_bar_display_account(c);
|
||||
account_list_set_current_id( c-> accountID );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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( g_strcasecmp(g_hash_table_lookup( current->properties, "Status"),"REGISTERED")==0 ){
|
||||
notify_switch_account( current );
|
||||
//main_warning_error_message(_("Switch account."));
|
||||
c -> accountID = current -> accountID;
|
||||
status_bar_display_account(c);
|
||||
dbus_place_call(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
notify_no_registered_accounts();
|
||||
// No current accounts have been setup.
|
||||
// So we place a call with the first registered account
|
||||
// and we change the current account
|
||||
current = account_list_get_by_state( ACCOUNT_STATE_REGISTERED );
|
||||
c -> accountID = current -> accountID;
|
||||
dbus_place_call(c);
|
||||
notify_current_account( current );
|
||||
status_bar_display_account(c);
|
||||
account_list_set_current_id( c-> accountID );
|
||||
}
|
||||
}
|
||||
else{
|
||||
notify_no_accounts();
|
||||
main_window_error_message(_("There is no accounts to make this call with."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,7 +619,7 @@ sflphone_place_call ( call_t * c )
|
||||
void
|
||||
sflphone_set_current_account()
|
||||
{
|
||||
if( account_list_get_size > 0 )
|
||||
if( account_list_get_size() > 0 )
|
||||
account_list_set_current_pos( 0 );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user