From 83ae701b117a36b64dbd20de1e143273370170c7 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandresavard@msavard.(none)> Date: Wed, 15 Jun 2011 12:08:38 -0400 Subject: [PATCH] #6129: Fix place_call function called twice for pressing enter action --- sflphone-client-gnome/src/actions.c | 8 +++----- sflphone-client-gnome/src/contacts/calltree.c | 11 +---------- sflphone-client-gnome/src/mainwindow.c | 3 --- sflphone-common/src/managerimpl.cpp | 13 +++++++------ 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 02df4fc031..42e1cdef68 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -647,12 +647,10 @@ process_dialing (callable_obj_t *c, guint keyval, gchar *key) //dbus_play_dtmf( key ); } - DEBUG ("--------------------- SFLphone: process dialing : keyval: %d", keyval); - DEBUG ("--------------------- SFLphone: process dialing : key: %s", key); - switch (keyval) { case 65293: /* ENTER */ case 65421: /* ENTER numpad */ + DEBUG("------------------------------------------------ SFLPHONE PLACE CALL (process dialing)"); sflphone_place_call (c); break; case 65307: /* ESCAPE */ @@ -961,13 +959,13 @@ sflphone_place_call (callable_obj_t * c) { gchar *msg = ""; - DEBUG ("Actions: Placing call with %s @ %s and accountid %s", c->_peer_name, c->_peer_number, c->_accountID); - if (c == NULL) { DEBUG ("Actions: Unexpected condition: callable_obj_t is null in %s at %d", __FILE__, __LINE__); return; } + DEBUG ("Actions: Placing call with %s @ %s and accountid %s", c->_peer_name, c->_peer_number, c->_accountID); + if (_is_direct_call (c)) { msg = g_markup_printf_escaped (_ ("Direct SIP call")); statusbar_pop_message (__MSG_ACCOUNT_DEFAULT); diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 5d56978770..5410fd9fdd 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -207,13 +207,9 @@ row_activated (GtkTreeView *tree_view UNUSED, selectedCall = calltab_get_selected_call (active_calltree); if (selectedCall) { - DEBUG ("CallTree: Selected a call"); - // Get the right event from the right calltree if (active_calltree == current_calls) { - DEBUG ("CallTree: Active tree is current calls"); - switch (selectedCall->_state) { case CALL_STATE_INCOMING: dbus_accept (selectedCall); @@ -229,7 +225,6 @@ row_activated (GtkTreeView *tree_view UNUSED, break; case CALL_STATE_DIALING: sflphone_place_call (selectedCall); - DEBUG("---------------------------- PLACING A NEW CALL FROM ROW ACTIVATED (current_calls)"); break; default: WARN ("Row activated - Should not happen!"); @@ -240,26 +235,22 @@ row_activated (GtkTreeView *tree_view UNUSED, // If history or contact: double click action places a new call else { - DEBUG ("CallTree: Active tree is history or contact"); - account_id = g_strdup (selectedCall->_accountID); // Create a new call create_new_call (CALL, CALL_STATE_DIALING, "", account_id, selectedCall->_peer_name, selectedCall->_peer_number, &new_call); - DEBUG("------------------------------------ PLACING A NEW CALL FROM ROW ACTIVATED (history)"); // sflphone_place_call(new_call); calllist_add (current_calls, new_call); calltree_add_call (current_calls, new_call, NULL); // Function sflphone_place_call (new_call) is processed in process_dialing + DEBUG("------------------------------------ PLACING A NEW CALL FROM ROW ACTIVATED (history)"); sflphone_place_call(new_call); calltree_display (current_calls); } } } else if (calltab_get_selected_type (current_calls) == A_CONFERENCE) { - DEBUG ("CallTree: Selected a conference"); - if (active_calltree == current_calls) { selectedConf = calltab_get_selected_conf (current_calls); diff --git a/sflphone-client-gnome/src/mainwindow.c b/sflphone-client-gnome/src/mainwindow.c index 2f837c8a62..d46daed0a3 100644 --- a/sflphone-client-gnome/src/mainwindow.c +++ b/sflphone-client-gnome/src/mainwindow.c @@ -135,14 +135,11 @@ on_key_released (GtkWidget *widget, GdkEventKey *event, gpointer user_data UNUSE if (focus_is_on_searchbar == FALSE) { if(event->keyval == 65293) { - DEBUG("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); if(active_calltree == current_calls) { - DEBUG("Active calltree is current_calls"); sflphone_keypad (event->keyval, event->string); return TRUE; } else if(active_calltree == history) { - DEBUG("Active calltree is history"); return FALSE; } } diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 7e8a33ccf6..a4467fb1db 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -248,6 +248,13 @@ bool ManagerImpl::outgoingCall (const std::string& account_id, return false; } + // Call ID must be unique + if (getAccountFromCall (call_id) != AccountNULL) { + _error ("Manager: Error: Call id already exists in outgoing call"); + return false; + } + + _debug ("Manager: New outgoing call %s to %s", call_id.c_str(), to.c_str()); CallID current_call_id = getCurrentCallId(); @@ -298,12 +305,6 @@ bool ManagerImpl::outgoingCall (const std::string& account_id, return false; } - // Call ID must be unique - if (getAccountFromCall (call_id) != AccountNULL) { - _error ("Manager: Error: Call id already exists in outgoing call"); - return false; - } - if(!associateCallToAccount (call_id, account_id)) { _warn("Manager: Warning: Could not associate call id %s to account id %s", call_id.c_str(), account_id.c_str()); } -- GitLab