diff --git a/gnome/src/actions.c b/gnome/src/actions.c index 9445d102d6e7b81e656617e98ca8747e3f8ab038..88ec5115dcddf52f815b1a0ab11991a91bbfdd6b 100644 --- a/gnome/src/actions.c +++ b/gnome/src/actions.c @@ -345,7 +345,6 @@ gboolean sflphone_init(GError **error) account_list_init(); codec_capabilities_load(); conferencelist_init(current_calls_tab); - conferencelist_init(history_tab); // Fetch the configured accounts sflphone_fill_account_list(); @@ -926,7 +925,6 @@ sflphone_add_participant(const gchar* callID, const gchar* confID) time(&call->_time_added); - calltree_add_call_to_conference_in_history(call, confID); dbus_add_participant(callID, confID); } @@ -1079,58 +1077,15 @@ void sflphone_fill_conference_list(void) void sflphone_fill_history(void) { gchar **entries, **entries_orig; - callable_obj_t *history_call, *call; - QueueElement *element; - entries = entries_orig = dbus_get_history(); while (entries && *entries) { gchar *current_entry = *entries; + /* do something with key and value */ + callable_obj_t *history_call = create_history_entry_from_serialized_form(current_entry); - // Parsed a conference - if (g_str_has_prefix(current_entry, "9999")) { - // create a conference entry - conference_obj_t *history_conf = create_conference_history_entry_from_serialized(current_entry); - - // verify if this conference has been already created - conference_obj_t *conf = conferencelist_get(history_tab, history_conf->_confID); - - // if this conference hasn't been created yet, add it to the conference list - if (!conf) - conferencelist_add(history_tab, history_conf); - else { - // if this conference was already created since one of the participants have already - // been unserialized, update the recordfile value - g_free(conf->_recordfile); - conf->_recordfile = g_strdup(history_conf->_recordfile); - } - } else { - // do something with key and value - history_call = create_history_entry_from_serialized_form(current_entry); - - // Add it and update the GUI - calllist_add_call(history_tab, history_call); - - if (history_call->_confID && strlen(history_call->_confID) > 0) { - - // process conference - conference_obj_t *conf = conferencelist_get(history_tab, history_call->_confID); - - if (!conf) { - // conference does not exist yet, create it - conf = create_new_conference(CONFERENCE_STATE_ACTIVE_ATTACHED, history_call->_confID); - conferencelist_add(history_tab, conf); - } - - // add this participant to the conference - conference_add_participant(history_call->_callID, conf); - - // conference start timestamp corespond to - if (conf->_time_start > history_call->_time_added) - conf->_time_start = history_call->_time_added; - } - } - + /* Add it and update the GUI */ + calllist_add_call(history_tab, history_call); entries++; } @@ -1140,23 +1095,10 @@ void sflphone_fill_history(void) guint n = calllist_get_size(history_tab); for (guint i = 0; i < n; i++) { - element = calllist_get_nth(history_tab, i); - - if (element->type == HIST_CALL) { - call = element->elem.call; - calltree_add_history_entry(call, NULL); - } - } - - // fill the treeview with conferences - n = conferencelist_get_size(history_tab); + QueueElement *element = calllist_get_nth(history_tab, i); - for (guint i = 0; i < n; i++) { - conference_obj_t *conf = conferencelist_get_nth(history_tab, i); - if (!conf) - DEBUG("SFLphone: Error: Could not find conference"); - else - calltree_add_conference_to_history(conf); + if (element->type == HIST_CALL) + calltree_add_history_entry(element->elem.call, NULL); } } @@ -1192,36 +1134,15 @@ void sflphone_save_history(void) gchar *value; - if (current->type == HIST_CALL) + if (current->type == HIST_CALL) { value = serialize_history_call_entry(current->elem.call); - else if (current->type == HIST_CONFERENCE) - value = serialize_history_conference_entry(current->elem.conf); - else { - ERROR("SFLphone: Error: Unknown type for serialization"); - break; - } - - gchar *key = g_strdup_printf("%i", (int) current->elem.call->_time_start); - - g_hash_table_replace(result, (gpointer) key, - g_slist_append(g_hash_table_lookup(result, key),(gpointer) value)); - } + gchar *key = g_strdup_printf("%i", (int) current->elem.call->_time_start); - size = conferencelist_get_size(history_tab); - - for (gint i = 0; i < size; ++i) { - conference_obj_t *conf = conferencelist_get_nth(history_tab, i); - - if (!conf) { - DEBUG("SFLphone: Error: Could not get %dth conference", i); - break; + g_hash_table_replace(result, (gpointer) key, + g_slist_append(g_hash_table_lookup(result, key),(gpointer) value)); } - - gchar *value = serialize_history_conference_entry(conf); - gchar *key = g_strdup_printf("%i", (int) conf->_time_start); - - g_hash_table_replace(result, (gpointer) key, - g_slist_append(g_hash_table_lookup(result, key), (gpointer) value)); + else + ERROR("SFLphone: Error: Unknown type for serialization"); } gchar **ordered_result = sflphone_order_history_hash_table(result); diff --git a/gnome/src/conference_obj.c b/gnome/src/conference_obj.c index f144ac1c47fd0af9459bc92d947169c20810a6c4..f2bda66b51a3310be1f614408da839091b3e0221 100644 --- a/gnome/src/conference_obj.c +++ b/gnome/src/conference_obj.c @@ -171,110 +171,3 @@ void conference_participant_list_update(gchar** participants, conference_obj_t* } } -gchar *serialize_history_conference_entry(conference_obj_t *entry) -{ - gchar *confID = entry->_confID; - - gchar *time_start = g_strdup_printf("%i", (int) entry->_time_start); - gchar *time_stop = g_strdup_printf("%i", (int) entry->_time_stop); - - gchar *peer_name = (entry->_confID == NULL || (strlen(entry->_confID) == 0)) ? "empty": entry->_confID; - - gint length = g_slist_length(entry->participant_list); - GSList *participant_list = entry->participant_list; - - gchar *participantstr = NULL; - for (gint i = 0; i < length; ++i) { - const gchar * const tmp = (gchar *) g_slist_nth_data(participant_list, i); - - if (!tmp) - WARN("Conference: Peer number is NULL in conference list"); - - gchar *old = participantstr; - participantstr = g_strconcat(old, tmp, ";", NULL); - g_free(old); - - DEBUG("Conference: Participant number: %s, concatenation: %s", tmp, participantstr); - } - - static const gchar * const separator = "|"; - gchar *result = g_strconcat("9999", separator, - participantstr, separator, // peer number - peer_name, separator, - time_start, separator, - time_stop, separator, - confID, separator, - "empty", separator, // peer AccountID - entry->_recordfile ? entry->_recordfile : "", separator, - "empty", separator, - "empty", NULL); - g_free(participantstr); - g_free(time_stop); - g_free(time_start); - - return result; -} - -conference_obj_t *create_conference_history_entry_from_serialized(gchar *entry) -{ - history_state_t history_state = MISSED; - conference_state_t state = CONFERENCE_STATE_ACTIVE_ATTACHED; - const gchar *participant = NULL; - const gchar *name = NULL; - const gchar *time_start = NULL; - const gchar *time_stop = NULL; - const gchar *accountID = NULL; - const gchar *recordfile = NULL; - const gchar *confID = NULL; - - DEBUG("Conference: Create a conference from serialized form"); - - static const gchar * const delim = "|"; - gchar **ptr = g_strsplit(entry, delim, 10); - gint token = 0; - - while (ptr && token < 10) { - switch (token) { - case 0: - history_state = MISSED; - break; - case 1: - participant = *ptr; - break; - case 2: - name = *ptr; - break; - case 3: - time_start = *ptr; - break; - case 4: - time_stop = *ptr; - break; - case 5: - confID = *ptr; - break; - case 6: - accountID = *ptr; - break; - case 7: - recordfile = *ptr; - break; - case 8: - case 9: - default: - break; - } - - token++; - ptr++; - } - - // create a new empty conference - conference_obj_t *conf = create_new_conference(state, confID); - - conf->_time_start = atoi(time_start); - conf->_time_stop = atoi(time_stop); - conf->_recordfile = g_strdup(recordfile); - - return conf; -} diff --git a/gnome/src/conference_obj.h b/gnome/src/conference_obj.h index d9135b8f312632e26f45d8f177e91a5360d2ff64..e7f0e3a57cb6c92257a702c24da0ee3ac68876c4 100644 --- a/gnome/src/conference_obj.h +++ b/gnome/src/conference_obj.h @@ -79,8 +79,4 @@ void conference_remove_participant (const gchar*, conference_obj_t *); void conference_participant_list_update (gchar**, conference_obj_t*); -gchar *serialize_history_conference_entry(conference_obj_t *entry); - -conference_obj_t *create_conference_history_entry_from_serialized(gchar *); - #endif diff --git a/gnome/src/contacts/calllist.c b/gnome/src/contacts/calllist.c index fcbebd8b103293e2a8d9d87cb5dbfc8eb42ef497..f8dd259bd51378a00498e2a4f5b6c348abf62cd4 100644 --- a/gnome/src/contacts/calllist.c +++ b/gnome/src/contacts/calllist.c @@ -91,10 +91,8 @@ calllist_free_element(gpointer data, gpointer user_data UNUSED) { QueueElement *element = data; - if (element->type == HIST_CONFERENCE) - free_conference_obj_t (element->elem.conf); - else /* HIST_CALL */ - free_callable_obj_t (element->elem.call); + g_assert(element->type == HIST_CALL); + free_callable_obj_t(element->elem.call); g_free(element); } @@ -132,8 +130,6 @@ calllist_clean_history(void) if (c->type == HIST_CALL) calltree_remove_call(history_tab, c->elem.call); - else if (c->type == HIST_CONFERENCE) - calltree_remove_conference(history_tab, c->elem.conf); } calllist_reset(history_tab); diff --git a/gnome/src/contacts/calllist.h b/gnome/src/contacts/calllist.h index 7eeab9b928265420493cf8f49e2ebb248c317339..66d793f5627f598d5c792b8a480c0f893b8e94f7 100644 --- a/gnome/src/contacts/calllist.h +++ b/gnome/src/contacts/calllist.h @@ -39,7 +39,7 @@ * @brief A list to hold calls. */ -typedef enum { HIST_CONFERENCE, HIST_CALL } ElementType; +typedef enum { HIST_CALL } ElementType; typedef union { callable_obj_t *call; diff --git a/gnome/src/contacts/calltree.c b/gnome/src/contacts/calltree.c index 7e8cbfa26998416d74b80e776302119849f6b75e..62028e9e5b59c779fc9b917a1d220e3f3b0c8517 100644 --- a/gnome/src/contacts/calltree.c +++ b/gnome/src/contacts/calltree.c @@ -82,7 +82,6 @@ static void drag_end_cb(GtkWidget *, GdkDragContext *, gpointer); static void drag_data_received_cb(GtkWidget *, GdkDragContext *, gint, gint, GtkSelectionData *, guint, guint, gpointer); static void drag_history_received_cb(GtkWidget *, GdkDragContext *, gint, gint, GtkSelectionData *, guint, guint, gpointer); static void menuitem_response(gchar *); -static void calltree_create_conf_from_participant_list(GSList *); enum { COLUMN_ACCOUNT_PIXBUF = 0, @@ -244,47 +243,11 @@ row_activated(GtkTreeView *tree_view UNUSED, break; } } - } else if (active_calltree_tab == history_tab) { - conference_obj_t* selectedConf = calltab_get_selected_conf(history_tab); - - if (selectedConf == NULL) { - ERROR("CallTree: Error: Could not get selected conference from history"); - return; - } - - calltree_create_conf_from_participant_list(selectedConf->participant_list); - calltree_display(current_calls_tab); - } + } else + WARN("CallTree: Selected a conference in history, should not be possible"); } } -static void -calltree_create_conf_from_participant_list(GSList *list) -{ - gint list_length = g_slist_length(list); - - /* create an array of gchar pointers */ - gchar *participant_list[list_length + 1]; - - /* build the list up */ - for (gint i = 0; i < list_length; ++i) { - gchar *participant_id = (gchar *) g_slist_nth_data(list, i); - callable_obj_t *call = calllist_get_call(history_tab, participant_id); - - /* allocate memory for the participant number */ - participant_list[i] = g_strconcat(call->_peer_number, ",", - call->_accountID, NULL); - } - /* NULL terminate it */ - participant_list[list_length] = NULL; - - dbus_create_conf_from_participant_list((const gchar **)participant_list); - /* free it, note we can't do this with g_strfreev since the array itself - * was created on the stack */ - for (gint i = 0; i < list_length; ++i) - g_free(participant_list[i]); -} - /* Catch cursor-activated signal. That is, when the entry is single clicked */ static void row_single_click(GtkTreeView *tree_view UNUSED, void * data UNUSED) @@ -1156,50 +1119,6 @@ void calltree_remove_conference(calltab_t* tab, const conference_obj_t* conf) DEBUG("CallTree: Finished Removing conference"); } -void calltree_add_conference_to_history(conference_obj_t *conf) -{ - if (!conf) - ERROR("CallTree: Error conference is NULL"); - - DEBUG("CallTree: Add conference %s to history", conf->_confID); - - GtkTreeIter iter; - gtk_tree_store_prepend(history_tab->store, &iter, NULL); - - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersAttached.svg", NULL); - - if (pixbuf && (gdk_pixbuf_get_width(pixbuf) > 32 || gdk_pixbuf_get_height(pixbuf) > 32)) { - GdkPixbuf *new = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR); - g_object_unref(pixbuf); - pixbuf = new; - } - - const gchar * const date = get_formatted_start_timestamp(conf->_time_start); - gchar *description = g_strconcat("Conference: \n", date, NULL); - - gtk_tree_store_set(history_tab->store, &iter, - COLUMN_ACCOUNT_PIXBUF, pixbuf, - COLUMN_ACCOUNT_DESC, description, - COLUMN_ACCOUNT_SECURITY_PIXBUF, NULL, - COLUMN_ACCOUNT_PTR, conf, -1); - - g_free(description); - if (pixbuf != NULL) - g_object_unref(G_OBJECT(pixbuf)); - - for (GSList *part = conf->participant_list; part; - part = g_slist_next(part)) { - const gchar * const call_id = (gchar *) part->data; - callable_obj_t *call = calllist_get_call(history_tab, call_id); - - if (call) - calltree_add_history_entry(call, &iter); - else - ERROR("ConferenceList: Error: Could not find call \"%s\"", call_id); - } -} - - void calltree_display(calltab_t *tab) { /* If we already are displaying the specified calltree */ @@ -1626,30 +1545,3 @@ static void menuitem_response(gchar *string) DEBUG("%s", string); } -void calltree_add_call_to_conference_in_history(callable_obj_t *call, const gchar * const confID) -{ - GtkTreeIter iter; - GtkTreeModel *tree_model = GTK_TREE_MODEL(history_tab->store); - - gtk_tree_model_get_iter_first(tree_model, &iter); - - while (gtk_tree_model_iter_next(tree_model, &iter)) { - GValue val = { .g_type = 0 }; - gtk_tree_model_get_value(tree_model, &iter, COLUMN_ACCOUNT_PTR, &val); - - /* confID maybe the ID for an existing conference or another call */ - if (gtk_tree_model_iter_has_child(tree_model, &iter)) { - conference_obj_t *c = (conference_obj_t *) g_value_get_pointer(&val); - - if (g_strcmp0(c->_confID, confID) == 0) - break; - } else { - callable_obj_t *c = (callable_obj_t *) g_value_get_pointer(&val); - - if (g_strcmp0(c->_callID, confID) == 0) - break; - } - } - - calltree_add_history_entry(call, &iter); -} diff --git a/gnome/src/contacts/calltree.h b/gnome/src/contacts/calltree.h index d0a7fe903407ccd5bd320a07f5555b6528c80ebc..f960c4f498f2e9f0f950640809c9e0f63bd20de7 100644 --- a/gnome/src/contacts/calltree.h +++ b/gnome/src/contacts/calltree.h @@ -71,9 +71,6 @@ calltree_create (calltab_t *, int searchbar_type); void calltree_add_call (calltab_t *, callable_obj_t *, GtkTreeIter *); -void -calltree_add_call_to_conference_in_history(callable_obj_t *call, const gchar * const confID); - /* * Update the call tree if the call state changes * @param c The call to update @@ -99,9 +96,6 @@ calltree_add_history_entry (callable_obj_t *, GtkTreeIter *); void calltree_add_conference_to_current_calls(conference_obj_t *); -void -calltree_add_conference_to_history(conference_obj_t *); - void calltree_remove_conference(calltab_t *, const conference_obj_t *); diff --git a/gnome/src/contacts/conferencelist.c b/gnome/src/contacts/conferencelist.c index 65ddf2fe14636061ab764019f99143c2ede15047..3d4c68f8e1f04fbc347f7653fb0e4422e39dce31 100644 --- a/gnome/src/contacts/conferencelist.c +++ b/gnome/src/contacts/conferencelist.c @@ -61,19 +61,6 @@ void conferencelist_clean(calltab_t *tab) g_queue_free(tab->conferenceQueue); } -void conferencelist_clean_history(void) -{ - while (conferencelist_get_size(history_tab) > 0) { - conference_obj_t *conf = conferencelist_pop_head(history_tab); - - if (conf) - calltree_remove_conference(history_tab, conf); - else - ERROR("ConferenceList: Conference pointer is NULL"); - } -} - - void conferencelist_reset(calltab_t *tab) { if (tab == NULL) { diff --git a/gnome/src/contacts/conferencelist.h b/gnome/src/contacts/conferencelist.h index 47f1d4d6163b9d573b7df1009e65ebb6ee891684..2d864673066ff7a1c3fa5b21e412bf963e51b5cb 100644 --- a/gnome/src/contacts/conferencelist.h +++ b/gnome/src/contacts/conferencelist.h @@ -41,9 +41,6 @@ void conferencelist_init (calltab_t *); /** This function empty and free the conference list. */ void conferencelist_clean (calltab_t *); -/** This function empty and free the history conference list */ -void conferencelist_clean_history (void); - /** This function empty, free the conference list and allocate a new one. */ void conferencelist_reset (calltab_t *); diff --git a/gnome/src/dbus/dbus.c b/gnome/src/dbus/dbus.c index 3ff02aa0214791a98dc2c0bacb0983919f5adc94..5c3cbfc55d42b17dac3ec1fc5f0f97af50098cc4 100644 --- a/gnome/src/dbus/dbus.c +++ b/gnome/src/dbus/dbus.c @@ -293,9 +293,7 @@ conference_created_cb(DBusGProxy *proxy UNUSED, const gchar* confID, void * foo time(&new_conf->_time_start); conferencelist_add(current_calls_tab, new_conf); - conferencelist_add(history_tab, new_conf); calltree_add_conference_to_current_calls(new_conf); - calltree_add_conference_to_history(new_conf); } static void @@ -364,18 +362,6 @@ record_playback_stopped_cb(DBusGProxy *proxy UNUSED, const gchar *filepath) element->elem.call->_record_is_playing = FALSE; } - const gint conflist_size = conferencelist_get_size(history_tab); - - for (gint i = 0; i < conflist_size; i++) { - conference_obj_t *conf = conferencelist_get_nth(history_tab, i); - - if (conf == NULL) { - ERROR("DBUS: ERROR: Could not find %dth conf", i); - break; - } else if (g_strcmp0(conf->_recordfile, filepath) == 0) - conf->_record_is_playing = FALSE; - } - update_actions(); } diff --git a/gnome/src/uimanager.c b/gnome/src/uimanager.c index 1030d2826b74518b2c4302e3360992a3ebe4b28a..6f61b02f897551e2943426b2f9e4c8b1ba8e02d9 100644 --- a/gnome/src/uimanager.c +++ b/gnome/src/uimanager.c @@ -697,25 +697,14 @@ start_playback_record_cb(void) DEBUG("UIManager: Start playback button pressed"); callable_obj_t *selectedCall = calltab_get_selected_call(history_tab); - conference_obj_t *selectedConf = calltab_get_selected_conf(history_tab); - if (selectedCall == NULL && selectedConf == NULL) { + if (selectedCall == NULL) { ERROR("UIManager: Error: No selected object in playback record callback"); return; } - if (selectedCall && selectedConf) { - ERROR("UIManager: Error: Two selected object in playback record callback"); - return; - } - - if (selectedCall) { - DEBUG("UIManager: Start selected call file playback %s", selectedCall->_recordfile); - selectedCall->_record_is_playing = dbus_start_recorded_file_playback(selectedCall->_recordfile); - } else if (selectedConf) { - DEBUG("UIMAnager: Start selected conf file playback %s", selectedConf->_recordfile); - selectedConf->_record_is_playing = dbus_start_recorded_file_playback(selectedConf->_recordfile); - } + DEBUG("UIManager: Start selected call file playback %s", selectedCall->_recordfile); + selectedCall->_record_is_playing = dbus_start_recorded_file_playback(selectedCall->_recordfile); update_actions(); } @@ -726,14 +715,8 @@ stop_playback_record_cb(void) DEBUG("UIManager: Stop playback button pressed"); callable_obj_t *selectedCall = calltab_get_selected_call(history_tab); - conference_obj_t *selectedConf = calltab_get_selected_conf(history_tab); - if (selectedCall && selectedConf) { - ERROR("UIManager: Error: Two selected object in history treeview"); - return; - } - - if (selectedCall == NULL && selectedConf == NULL) { + if (selectedCall == NULL) { ERROR("UIManager: Error: No selected object in history treeview"); return; } @@ -747,15 +730,6 @@ stop_playback_record_cb(void) dbus_stop_recorded_file_playback(selectedCall->_recordfile); DEBUG("UIManager: Stop selected call file playback %s", selectedCall->_recordfile); selectedCall->_record_is_playing = FALSE; - } else if (selectedConf) { - if (selectedConf->_recordfile == NULL) { - ERROR("UIManager: Error: Record file is NULL"); - return; - } - - dbus_stop_recorded_file_playback(selectedConf->_recordfile); - DEBUG("UIMAnager: Start selected call file playback: %s", selectedConf->_recordfile); - selectedConf->_record_is_playing = FALSE; } update_actions(); @@ -918,11 +892,7 @@ edit_paste(void * foo UNUSED) static void clear_history(void) { - if (conferencelist_get_size(history_tab) != 0) - conferencelist_clean_history(); - - if (calllist_get_size(history_tab) != 0) - calllist_clean_history(); + calllist_clean_history(); } /**