Skip to content
Snippets Groups Projects
Commit e0632409 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#6183: Fix saving history to file

parent 56249d65
Branches
Tags
No related merge requests found
...@@ -1333,27 +1333,36 @@ void sflphone_fill_history (void) ...@@ -1333,27 +1333,36 @@ void sflphone_fill_history (void)
void sflphone_save_history (void) void sflphone_save_history (void)
{ {
GQueue *items;
gint size; gint size;
int i; gint i;
callable_obj_t *current; QueueElement *current;
GHashTable *result = NULL; GHashTable *result = NULL;
gchar *key, *value; gchar *key, *value;
DEBUG ("SFLphone: Saving history ..."); DEBUG ("SFLphone: Saving history");
result = g_hash_table_new (NULL, g_str_equal); result = g_hash_table_new (NULL, g_str_equal);
items = history->callQueue;
size = calllist_get_size (history); size = calllist_get_size (history);
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
current = g_queue_peek_nth (items, i); current = calllist_get_nth (history, i);
if (current) { if (current) {
value = serialize_history_entry (current); if(current->type == HIST_CALL) {
key = convert_timestamp_to_gchar (current->_time_start); value = serialize_history_call_entry (current->elem.call);
g_hash_table_replace (result, (gpointer) key, key = convert_timestamp_to_gchar (current->elem.call->_time_start);
(gpointer) value); }
else if(current->type == HIST_CONFERENCE) {
value = serialize_history_conference_entry(current->elem.conf);
key = convert_timestamp_to_gchar (current->elem.conf->_time_start);
}
else {
ERROR("SFLphone: Error: Unknown type for serialization");
}
g_hash_table_replace (result, (gpointer) key, (gpointer) value);
}
else {
WARN("SFLphone: Warning: %dth element is null", i);
} }
} }
......
...@@ -455,7 +455,7 @@ gchar* get_call_duration (callable_obj_t *obj) ...@@ -455,7 +455,7 @@ gchar* get_call_duration (callable_obj_t *obj)
} }
gchar* serialize_history_entry (callable_obj_t *entry) gchar* serialize_history_call_entry (callable_obj_t *entry)
{ {
// "0|514-276-5468|Savoir-faire Linux|144562458" for instance // "0|514-276-5468|Savoir-faire Linux|144562458" for instance
...@@ -471,8 +471,6 @@ gchar* serialize_history_entry (callable_obj_t *entry) ...@@ -471,8 +471,6 @@ gchar* serialize_history_entry (callable_obj_t *entry)
gchar* peer_name = (entry->_peer_name == NULL || g_strcasecmp (entry->_peer_name,"") == 0) ? "empty": entry->_peer_name; gchar* peer_name = (entry->_peer_name == NULL || g_strcasecmp (entry->_peer_name,"") == 0) ? "empty": entry->_peer_name;
gchar* account_id = (entry->_accountID == NULL || g_strcasecmp (entry->_accountID,"") == 0) ? "empty": entry->_accountID; gchar* account_id = (entry->_accountID == NULL || g_strcasecmp (entry->_accountID,"") == 0) ? "empty": entry->_accountID;
DEBUG("ACCOUNT ID STORED IN HISTORY %s", account_id);
result = g_strconcat (history_state, separator, result = g_strconcat (history_state, separator,
entry->_peer_number, separator, entry->_peer_number, separator,
peer_name, separator, peer_name, separator,
......
...@@ -223,7 +223,7 @@ history_state_t get_history_state_from_id (gchar *indice); ...@@ -223,7 +223,7 @@ history_state_t get_history_state_from_id (gchar *indice);
gchar* get_call_duration (callable_obj_t *obj); gchar* get_call_duration (callable_obj_t *obj);
gchar* serialize_history_entry (callable_obj_t *entry); gchar* serialize_history_call_entry(callable_obj_t *entry);
gchar* get_history_id_from_state (history_state_t state); gchar* get_history_id_from_state (history_state_t state);
......
...@@ -170,3 +170,8 @@ void conference_participant_list_update (gchar** participants, conference_obj_t* ...@@ -170,3 +170,8 @@ void conference_participant_list_update (gchar** participants, conference_obj_t*
} }
} }
gchar *serialize_history_conference_entry(conference_obj_t *entry)
{
return "";
}
...@@ -88,4 +88,6 @@ GSList* conference_next_participant (GSList* participant); ...@@ -88,4 +88,6 @@ GSList* conference_next_participant (GSList* participant);
void conference_participant_list_update (gchar**, conference_obj_t*); void conference_participant_list_update (gchar**, conference_obj_t*);
gchar *serialize_history_conference_entry(conference_obj_t *entry);
#endif #endif
...@@ -194,8 +194,6 @@ calllist_remove_call (calltab_t* tab, const gchar * callID) ...@@ -194,8 +194,6 @@ calllist_remove_call (calltab_t* tab, const gchar * callID)
DEBUG("CallList: Remove call %s from list", callID); DEBUG("CallList: Remove call %s from list", callID);
c = g_queue_find_custom (tab->callQueue, callID, is_callID_callstruct); c = g_queue_find_custom (tab->callQueue, callID, is_callID_callstruct);
// c = calllist_get_call (tab, callID);
if(c == NULL) { if(c == NULL) {
DEBUG("CallList: Could not remove call %s", callID); DEBUG("CallList: Could not remove call %s", callID);
return; return;
......
...@@ -337,8 +337,6 @@ update_actions() ...@@ -337,8 +337,6 @@ update_actions()
WARN ("Should not happen in update_actions()!"); WARN ("Should not happen in update_actions()!");
break; break;
} }
DEBUG("ok");
} else if (selectedConf) { } else if (selectedConf) {
DEBUG("UIManager: Update actions for conference"); DEBUG("UIManager: Update actions for conference");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment