diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 734b798d219e4027214d2a16c962cf31a6737103..151ca33774c6184c08235b244e095c5f55120628 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -80,7 +80,7 @@ popup_menu (GtkWidget *widget, call_selected_cb(GtkTreeSelection *sel, void* data UNUSED ) { - DEBUG("Selection Callback"); + DEBUG("CallTree: Selection callback"); GtkTreeIter iter; GValue val; @@ -90,9 +90,10 @@ call_selected_cb(GtkTreeSelection *sel, void* data UNUSED ) gchar* string_path; - if (! gtk_tree_selection_get_selected (sel, &model, &iter)) + if (! gtk_tree_selection_get_selected (sel, &model, &iter)) { + ERROR("CallTree: Not a valid selection, returning"); return; - + } // store info for dragndrop path = gtk_tree_model_get_path(model, &iter); @@ -101,7 +102,7 @@ call_selected_cb(GtkTreeSelection *sel, void* data UNUSED ) if(gtk_tree_model_iter_has_child(GTK_TREE_MODEL(model), &iter)) { - DEBUG("SELECTED A CONFERENCE"); + DEBUG("CallTree: Selected a conference"); selected_type = A_CONFERENCE; val.g_type = 0; @@ -119,14 +120,14 @@ call_selected_cb(GtkTreeSelection *sel, void* data UNUSED ) } - DEBUG(" selected_path %s, selected_call_id %s, selected_path_depth %i\n", selected_path, selected_call_id, selected_path_depth); + DEBUG("CallTree: selected_path %s, selected_call_id %s, selected_path_depth %d", + selected_path, selected_call_id, selected_path_depth); } else { - DEBUG("SELECTED A CALL"); + DEBUG("CallTree: Selected a call"); selected_type = A_CALL; - // gtk_tree_model_iter_parent(GTK_TREE_MODEL(model), parent_conference, &iter); val.g_type = 0; gtk_tree_model_get_value (model, &iter, COLUMN_ACCOUNT_PTR, &val); @@ -142,16 +143,12 @@ call_selected_cb(GtkTreeSelection *sel, void* data UNUSED ) selected_conf = NULL; } - DEBUG(" selected_path %s, selected_call_id %s, selected_path_depth %i\n", selected_path, selected_call_id, selected_path_depth); + DEBUG("CallTree: selected_path %s, selected_call_id %s, selected_path_depth %d", + selected_path, selected_call_id, selected_path_depth); } - - // conferencelist_reset (); - // sflphone_fill_conference_list(); - g_value_unset(&val); update_actions(); - } /* A row is activated when it is double clicked */ @@ -165,20 +162,19 @@ row_activated(GtkTreeView *tree_view UNUSED, conference_obj_t* selectedConf = NULL; gchar *account_id; - DEBUG("double click action"); + DEBUG("CallTree: Double click action"); if(calltab_get_selected_type(active_calltree) == A_CALL) { - DEBUG("Selected a call\n"); selectedCall = calltab_get_selected_call(active_calltree); if (selectedCall) { - DEBUG("there is a selected call\n"); - + DEBUG("CallTree: Selected a call"); + // Get the right event from the right calltree if( active_calltree == current_calls ) { - DEBUG("active tree is current calls"); + DEBUG("CallTree: Active tree is current calls"); switch(selectedCall->_state) { case CALL_STATE_INCOMING: @@ -205,7 +201,7 @@ row_activated(GtkTreeView *tree_view UNUSED, // If history or contact: double click action places a new call else { - DEBUG("active tree is history or contact"); + DEBUG("CallTree: Active tree is history or contact"); account_id = g_strdup (selectedCall->_accountID); @@ -221,7 +217,7 @@ row_activated(GtkTreeView *tree_view UNUSED, } else if(calltab_get_selected_type(current_calls) == A_CONFERENCE) { - DEBUG("Selected a conference\n"); + DEBUG("CallTree: Selected a conference"); if( active_calltree == current_calls ) { @@ -250,14 +246,21 @@ row_activated(GtkTreeView *tree_view UNUSED, void row_single_click(GtkTreeView *tree_view UNUSED, void * data UNUSED) { - DEBUG("single click action"); - callable_obj_t * selectedCall=NULL; - account_t * account_details=NULL; + callable_obj_t * selectedCall = NULL; + account_t * account_details = NULL; gchar * displaySasOnce=""; + DEBUG("CallTree: Single click action"); + selectedCall = calltab_get_selected_call( active_calltree ); - if (selectedCall != NULL) { + /* + if(!selected_call) { + selected_call = selectedCall; + } + */ + + if (selectedCall) { account_details = account_list_get_by_id(selectedCall->_accountID); DEBUG("AccountID %s", selectedCall->_accountID); @@ -338,7 +341,7 @@ calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, gch gchar * hostname = NULL; gchar * display_number = ""; - DEBUG("Display call info"); + DEBUG("CallTree: Display call info"); // If call is outgoing, keep the hostname, strip it elsewhere if(c->_type == CALL && c->_history_state == OUTGOING) { @@ -371,7 +374,7 @@ calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, gch case DISPLAY_TYPE_CALL: - DEBUG("display a normal call"); + DEBUG("CallTree: Display a normal call"); if(c->_state_code == 0) { if(g_strcmp0("", c->_peer_name) == 0) { @@ -401,7 +404,7 @@ calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, gch case DISPLAY_TYPE_CALL_TRANSFER: - DEBUG("display a call transfer") + DEBUG("CallTree: Display a call transfer") if(g_strcmp0("",c->_peer_name) == 0){ description = g_markup_printf_escaped("<b>%s</b><i>%s</i>\n<i>Transfert to:%s</i> ", @@ -416,7 +419,7 @@ calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, gch case DISPLAY_TYPE_STATE_CODE : - DEBUG("display a state code"); + DEBUG("CallTree: Display a state code"); if(g_strcmp0("",c->_peer_name) == 0){ @@ -446,7 +449,7 @@ calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, gch case DISPLAY_TYPE_SAS: - DEBUG("display a call with sas"); + DEBUG("CallTree: Display a call with sas"); if(g_strcmp0("", c->_peer_name) == 0){ description = g_markup_printf_escaped("<b>%s</b><i>%s</i>\n<i>Confirm SAS <b>%s</b> ?</i> ", @@ -460,7 +463,7 @@ calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, gch case DISPLAY_TYPE_HISTORY : - DEBUG("display history entry"); + DEBUG("CallTree: Display history entry"); if(g_strcmp0("", c->_peer_name) == 0) { description = g_markup_printf_escaped("<b>%s</b><i>%s</i>", @@ -473,7 +476,7 @@ calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, gch break; default : - DEBUG("Not an allowable type of display"); + DEBUG("CallTree: Not an allowable type of display"); break; } @@ -631,13 +634,16 @@ calltree_create (calltab_t* tab, gboolean searchbar_type) calltree_remove_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) { - DEBUG("calltree_remove_call %s", c->_callID); - GtkTreeIter iter; GValue val; callable_obj_t * iterCall; GtkTreeStore* store = tab->store; + if(!c) + ERROR("CallTree: Error: Not a valid call"); + + DEBUG("CallTree: Remove call %s", c->_callID); + int nbChild = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), parent); int i; for( i = 0; i < nbChild; i++) @@ -851,7 +857,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) { - DEBUG("calltree_add_call id: %s, peer name: %s", c->_callID, c->_peer_name); + DEBUG("CallTree: Add call to calltree id: %s, peer name: %s", c->_callID, c->_peer_name); if (tab == history) { @@ -1042,8 +1048,6 @@ void calltree_add_history_entry (callable_obj_t * c) void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) { - DEBUG("Calltree: Add conference %s", conf->_confID); - GdkPixbuf *pixbuf=NULL; GdkPixbuf *pixbuf_security=NULL; GtkTreeIter iter; @@ -1070,6 +1074,8 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) return; } + DEBUG("Calltree: Add conference %s", conf->_confID); + // description = g_markup_printf_escaped("<b>%s</b>", conf->_confID); description = g_markup_printf_escaped("<b>%s</b>", ""); @@ -1396,17 +1402,15 @@ static void drag_begin_cb(GtkWidget *widget, GdkDragContext *dc, gpointer data) GtkTargetList* target_list; - // DEBUG("drag_begin_cb %s\n", dragged_path); - if((target_list = gtk_drag_source_get_target_list(widget)) != NULL); - - } static void drag_end_cb(GtkWidget * widget, GdkDragContext * context, gpointer data) { - DEBUG("drag_end_cb\n"); - DEBUG(" selected_path %s, selected_call_id %s, selected_path_depth %i\n", selected_path, selected_call_id, selected_path_depth); - DEBUG(" dragged path %s, dragged_call_id %s, dragged_path_depth %i\n", selected_path, selected_call_id, dragged_path_depth); + DEBUG("CallTree: Drag end callback"); + DEBUG("CallTree: selected_path %s, selected_call_id %s, selected_path_depth %d", + selected_path, selected_call_id, selected_path_depth); + DEBUG("CallTree: dragged path %s, dragged_call_id %s, dragged_path_depth %d", + dragged_path, dragged_call_id, dragged_path_depth); GtkTreeModel *model = (GtkTreeModel*)current_calls->store; GtkTreePath *path = gtk_tree_path_new_from_string(dragged_path); @@ -1424,100 +1428,75 @@ static void drag_end_cb(GtkWidget * widget, GdkDragContext * context, gpointer d conference_obj_t* conf; - // Make sure that drag n drop does not imply a dialing call - if(selected_type == A_CALL) { + // Make sure drag n drop does not imply a dialing call for either selected and dragged call + if(selected_call && (selected_type == A_CALL)) { - DEBUG("Selected a call"); + DEBUG("CallTree: Selected a call"); if(selected_call->_state == CALL_STATE_DIALING || selected_call->_state == CALL_STATE_INVALID || selected_call->_state == CALL_STATE_FAILURE || selected_call->_state == CALL_STATE_BUSY || selected_call->_state == CALL_STATE_TRANSFERT) { - DEBUG("Selected an invalid call"); + DEBUG("CallTree: Selected an invalid call"); - calltree_remove_call(current_calls, selected_call, NULL); - calltree_add_call(current_calls, selected_call, NULL); - return; + calltree_remove_call(current_calls, selected_call, NULL); + calltree_add_call(current_calls, selected_call, NULL); + + dragged_call = NULL; + return; } - if(dragged_type == A_CALL) { + if(dragged_call && (dragged_type == A_CALL)) { - DEBUG("Dragged on a call"); + DEBUG("CallTree: Dragged on a call"); if(dragged_call->_state == CALL_STATE_DIALING || dragged_call->_state == CALL_STATE_INVALID || dragged_call->_state == CALL_STATE_FAILURE || dragged_call->_state == CALL_STATE_BUSY || dragged_call->_state == CALL_STATE_TRANSFERT) { - DEBUG("Dragged on an invalid call"); + DEBUG("CallTree: Dragged on an invalid call"); - if(selected_call->_confID != NULL) { - - } - else { 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) { + if(selected_call->_confID) { - gtk_tree_path_up(spath); - gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &parent_conference, path); + gtk_tree_path_up(spath); + gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &parent_conference, spath); - calltree_add_call(current_calls, selected_call, &parent_conference); - } - else { - calltree_add_call(current_calls, selected_call, NULL); - } + calltree_add_call(current_calls, selected_call, &parent_conference); + } + else { - calltree_add_call(current_calls, dragged_call, NULL); - return; - + calltree_add_call(current_calls, selected_call, NULL); + } + + dragged_call = NULL; + return; + } } - } - */ - if(selected_type == A_CONFERENCE) { - DEBUG("Selected a conference"); + // Make sure a conference is only dragged on another conference + if(selected_conf && (selected_type == A_CONFERENCE)) { - if(dragged_type == A_CALL) { + DEBUG("CallTree: Selected a conference"); - DEBUG("Dragged on a call"); + if(!dragged_conf && (dragged_type == A_CALL)) { - if(dragged_call->_state == CALL_STATE_DIALING || - dragged_call->_state == CALL_STATE_INVALID || - dragged_call->_state == CALL_STATE_FAILURE || - dragged_call->_state == CALL_STATE_BUSY || - dragged_call->_state == CALL_STATE_TRANSFERT) { - - DEBUG("Dragged on an invalid call"); + DEBUG("CallTree: Dragged on a call"); conf = selected_conf; calltree_remove_conference(current_calls, conf, NULL); calltree_add_conference(current_calls, conf); - return; - } + + dragged_call = NULL; + return; } } @@ -1731,18 +1710,21 @@ void drag_data_received_cb(GtkWidget *widget, GdkDragContext *context, gint x, g if(gtk_tree_model_iter_has_child(tree_model, &iter)) { - DEBUG("DRAGGING ON A CONFERENCE"); + DEBUG("CallTree: Dragging on a conference"); dragged_type = A_CONFERENCE; + dragged_call = NULL; } else { - DEBUG("DRAGGING ON A CALL"); + DEBUG("CallTree: Dragging on a call"); dragged_type = A_CALL; + dragged_conf = NULL; } switch (position) { case GTK_TREE_VIEW_DROP_AFTER: + DEBUG("CallTree: GTK_TREE_VIEW_DROP_AFTER"); dragged_path = gtk_tree_path_to_string(drop_path); dragged_path_depth = gtk_tree_path_get_depth(drop_path); dragged_call_id = "NULL"; @@ -1751,6 +1733,7 @@ void drag_data_received_cb(GtkWidget *widget, GdkDragContext *context, gint x, g break; case GTK_TREE_VIEW_DROP_INTO_OR_AFTER: + DEBUG("CallTree: GTK_TREE_VIEW_DROP_INTO_OR_AFTER"); dragged_path = gtk_tree_path_to_string(drop_path); dragged_path_depth = gtk_tree_path_get_depth(drop_path); if (dragged_type == A_CALL) { @@ -1766,6 +1749,7 @@ void drag_data_received_cb(GtkWidget *widget, GdkDragContext *context, gint x, g break; case GTK_TREE_VIEW_DROP_BEFORE: + DEBUG("CallTree: GTK_TREE_VIEW_DROP_BEFORE"); dragged_path = gtk_tree_path_to_string(drop_path); dragged_path_depth = gtk_tree_path_get_depth(drop_path); dragged_call_id = "NULL"; @@ -1774,6 +1758,7 @@ void drag_data_received_cb(GtkWidget *widget, GdkDragContext *context, gint x, g break; case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE: + DEBUG("CallTree: GTK_TREE_VIEW_DROP_INTO_OR_BEFORE"); dragged_path = gtk_tree_path_to_string(drop_path); dragged_path_depth = gtk_tree_path_get_depth(drop_path); if (dragged_type == A_CALL) { diff --git a/sflphone-common/src/sip/sdp.cpp b/sflphone-common/src/sip/sdp.cpp index c71ee5ab4095f5e85bccdc324d2f1a052554fe6e..52025485eabe9ee283627bf8e53a2bf6c0d40c7e 100644 --- a/sflphone-common/src/sip/sdp.cpp +++ b/sflphone-common/src/sip/sdp.cpp @@ -52,8 +52,8 @@ Sdp::Sdp (pj_pool_t *pool) Sdp::~Sdp() { - clean_session_media(); - clean_local_media_capabilities(); + // clean_session_media(); + // clean_local_media_capabilities(); } void Sdp::set_media_descriptor_line (sdpMedia *media, pjmedia_sdp_media** p_med) {