Commit 148aec74 authored by Emmanuel Milou's avatar Emmanuel Milou

[#1214] Handle empty field - remove g_print

parent f655cb39
......@@ -235,9 +235,11 @@ gboolean sflphone_init()
else
{
dbus_register(getpid(), "Gtk+ Client");
current_calls = calltab_init(NULL);
contacts = calltab_init("contacts");
history = calltab_init("history");
account_list_init ();
codec_list_init();
......@@ -972,9 +974,7 @@ void sflphone_save_history (void)
if (current)
{
value = serialize_history_entry (current);
g_print ("before %i\n", current->_time_start);
key = convert_timestamp_to_gchar (current->_time_start);
g_print ("after %s\n", key);
g_hash_table_replace(result, (gpointer) key,
(gpointer) value);
}
......
......@@ -136,7 +136,6 @@ void create_history_entry_from_serialized_form (gchar *timestamp, gchar *details
if ((ptr = strtok(details, delim)) != NULL) {
do {
g_print ("%s\n", ptr);
switch (token)
{
case 0:
......@@ -224,8 +223,6 @@ gchar* get_call_duration (callable_obj_t *obj)
start = obj->_time_start;
end = obj->_time_stop;
g_print ("start = %i - end = %i\n", start, end);
if (start == end)
return g_markup_printf_escaped("<small>Duration:</small> none");
......@@ -262,7 +259,10 @@ gchar* serialize_history_entry (callable_obj_t *entry)
// and the timestamps
timestamp = convert_timestamp_to_gchar (entry->_time_stop);
result = g_strconcat (history_state, "|", entry->_peer_number, "|", entry->_peer_name, "|", timestamp, NULL);
result = g_strconcat (history_state, separator,
entry->_peer_number, separator,
g_strcasecmp (entry->_peer_name,"") ==0 ? "empty": entry->_peer_name,
separator, timestamp, NULL);
return result;
}
......
......@@ -78,24 +78,29 @@ calllist_reset (calltab_t* tab)
tab->callQueue = g_queue_new();
}
void
calllist_add (calltab_t* tab, callable_obj_t * c)
void calllist_add_history_entry (callable_obj_t *obj)
{
if( tab == history )
{
// First case: can still add calls to the list
if( calllist_get_size(tab) < dbus_get_max_calls() )
if( calllist_get_size (history) < dbus_get_max_calls() )
{
g_queue_push_tail (tab->callQueue, (gpointer *) c);
calltree_add_call( history , c );
g_queue_push_tail (history->callQueue, (gpointer *) obj);
calltree_add_call (history, obj);
}
// List full -> Remove the last call from history and preprend the new call to the list
else
{
calltree_remove_call( history , (callable_obj_t*)g_queue_pop_head( tab -> callQueue ) );
g_queue_push_tail (tab->callQueue, (gpointer *) c);
calltree_add_call( history , c );
calltree_remove_call( history , (callable_obj_t*)g_queue_pop_head (history->callQueue ) );
g_queue_push_tail (history->callQueue, (gpointer *) obj);
calltree_add_call (history, obj);
}
}
void
calllist_add (calltab_t* tab, callable_obj_t * c)
{
if( tab == history )
{
calllist_add_history_entry (c);
}
else
g_queue_push_tail (tab->callQueue, (gpointer *) c);
......
......@@ -41,6 +41,8 @@ typedef struct {
void
calllist_add_contact (gchar *, gchar *, contact_type_t, GdkPixbuf *);
void calllist_add_history_entry (callable_obj_t *obj);
/** This function initialize a call list. */
void
calllist_init (calltab_t* tab);
......
......@@ -104,6 +104,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\n");
// Get the active calls at startup
sflphone_fill_call_list ();
// Load the history
sflphone_fill_history ();
/* start the main loop */
......
......@@ -15,3 +15,9 @@ number=5143848557
name=Chez wam
timestamp_stop=775354987
type=1
[534244222]
number=136
name=empty
timestamp_stop=5656534543
type=1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment