diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 8bb20d52a5cd33629392b73ad2c5d1993237731c..38fcaa6a7644032b623e9573ced553772e3d23af 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -1464,13 +1464,66 @@ static void drag_end_cb(GtkWidget * widget, GdkDragContext * context, gpointer d GtkTreeIter iter; GtkTreeIter iter_parent; GtkTreeIter iter_children; - GtkTreeIter parent_conference; + GtkTreeIter parent_conference; // conference for which this call is attached GValue val; + callable_obj_t* call; conference_obj_t* conf; + // Make sure that drag n drop does not imply a dialing call + if(selected_type == A_CALL && selected_call->_state == CALL_STATE_DIALING) { + + DEBUG("Dragged a call on a dialing call"); + + calltree_remove_call(current_calls, selected_call, NULL); + calltree_add_call(current_calls, selected_call, NULL); + return; + } + + else if(selected_type == A_CALL) { + + // user may have dragged it outside the conference + if(dragged_call && dragged_call->_state == CALL_STATE_DIALING) { + + calltree_remove_call(current_calls, dragged_call, NULL); + + DEBUG("Dragged a call on a dialing call"); + + // test if call participate to a conference + if(selected_call->_confID) { + + gtk_tree_path_up(spath); + gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &parent_conference, path); + + calltree_add_call(current_calls, selected_call, &parent_conference); + } + else { + calltree_add_call(current_calls, selected_call, NULL); + } + + calltree_add_call(current_calls, dragged_call, NULL); + return; + + } + + } + else if(selected_type == A_CONFERENCE) { + + DEBUG("Dragged a conference on a dialing call"); + + if(dragged_call && dragged_call->_state == CALL_STATE_DIALING) { + + conf = selected_conf; + + calltree_remove_conference(current_calls, conf, NULL); + calltree_add_conference(current_calls, conf); + return; + } + } + + if(selected_path_depth == 1) { if(dragged_path_depth == 1) { diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 2a3d6d1f9a3114412662dd2902e8c848b5bb9625..a1380e0fbccd269730b65c18c8bd696a17930a28 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -697,12 +697,31 @@ ManagerImpl::transferCall (const CallID& call_id, const std::string& to) CallID current_call_id = getCurrentCallId(); - /* Direct IP to IP call */ + if (participToConference (call_id)) { + + _debug("Particip to a conference\n"); + + Conference *conf = getConferenceFromCallID (call_id); + + if (conf != NULL) { + // remove this participant + removeParticipant (call_id); + + processRemainingParticipant (current_call_id, conf); + } + } else { + + _debug("Do not Particip to a conference\n"); + + // we are not participating to a conference, current call switched to "" + if (!isConference (current_call_id)) + switchCall (""); + } + /* Direct IP to IP call */ if (getConfigFromCall (call_id) == Call::IPtoIP) { returnValue = SIPVoIPLink::instance (AccountNULL)-> transfer (call_id, to); } - /* Classic call, attached to an account */ else { accountid = getAccountFromCall (call_id); @@ -719,22 +738,6 @@ ManagerImpl::transferCall (const CallID& call_id, const std::string& to) removeWaitingCall (call_id); - if (participToConference (call_id)) { - - Conference *conf = getConferenceFromCallID (call_id); - - if (conf != NULL) { - // remove this participant - removeParticipant (call_id); - - processRemainingParticipant (current_call_id, conf); - } - } else { - // we are not participating to a conference, current call switched to "" - if (!isConference (current_call_id)) - switchCall (""); - } - if (_dbus) _dbus->getCallManager()->callStateChanged (call_id, "HUNGUP"); return returnValue; @@ -1009,12 +1012,15 @@ ManagerImpl::participToConference (const CallID& call_id) accountId = getAccountFromCall (call_id); call = getAccountLink (accountId)->getCall (call_id); - if (call == NULL) + if (call == NULL) { return false; + } + if (call->getConfId() == "") { return false; } else { + return true; } }