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() ...@@ -235,9 +235,11 @@ gboolean sflphone_init()
else else
{ {
dbus_register(getpid(), "Gtk+ Client"); dbus_register(getpid(), "Gtk+ Client");
current_calls = calltab_init(NULL); current_calls = calltab_init(NULL);
contacts = calltab_init("contacts"); contacts = calltab_init("contacts");
history = calltab_init("history"); history = calltab_init("history");
account_list_init (); account_list_init ();
codec_list_init(); codec_list_init();
...@@ -972,9 +974,7 @@ void sflphone_save_history (void) ...@@ -972,9 +974,7 @@ void sflphone_save_history (void)
if (current) if (current)
{ {
value = serialize_history_entry (current); value = serialize_history_entry (current);
g_print ("before %i\n", current->_time_start);
key = convert_timestamp_to_gchar (current->_time_start); key = convert_timestamp_to_gchar (current->_time_start);
g_print ("after %s\n", key);
g_hash_table_replace(result, (gpointer) key, g_hash_table_replace(result, (gpointer) key,
(gpointer) value); (gpointer) value);
} }
......
...@@ -136,7 +136,6 @@ void create_history_entry_from_serialized_form (gchar *timestamp, gchar *details ...@@ -136,7 +136,6 @@ void create_history_entry_from_serialized_form (gchar *timestamp, gchar *details
if ((ptr = strtok(details, delim)) != NULL) { if ((ptr = strtok(details, delim)) != NULL) {
do { do {
g_print ("%s\n", ptr);
switch (token) switch (token)
{ {
case 0: case 0:
...@@ -224,8 +223,6 @@ gchar* get_call_duration (callable_obj_t *obj) ...@@ -224,8 +223,6 @@ gchar* get_call_duration (callable_obj_t *obj)
start = obj->_time_start; start = obj->_time_start;
end = obj->_time_stop; end = obj->_time_stop;
g_print ("start = %i - end = %i\n", start, end);
if (start == end) if (start == end)
return g_markup_printf_escaped("<small>Duration:</small> none"); return g_markup_printf_escaped("<small>Duration:</small> none");
...@@ -262,7 +259,10 @@ gchar* serialize_history_entry (callable_obj_t *entry) ...@@ -262,7 +259,10 @@ gchar* serialize_history_entry (callable_obj_t *entry)
// and the timestamps // and the timestamps
timestamp = convert_timestamp_to_gchar (entry->_time_stop); 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; return result;
} }
......
...@@ -78,27 +78,32 @@ calllist_reset (calltab_t* tab) ...@@ -78,27 +78,32 @@ calllist_reset (calltab_t* tab)
tab->callQueue = g_queue_new(); tab->callQueue = g_queue_new();
} }
void void calllist_add_history_entry (callable_obj_t *obj)
calllist_add (calltab_t* tab, callable_obj_t * c)
{ {
if( tab == history )
{
// First case: can still add calls to the list // 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); g_queue_push_tail (history->callQueue, (gpointer *) obj);
calltree_add_call( history , c ); calltree_add_call (history, obj);
} }
// List full -> Remove the last call from history and preprend the new call to the list // List full -> Remove the last call from history and preprend the new call to the list
else else
{ {
calltree_remove_call( history , (callable_obj_t*)g_queue_pop_head( tab -> callQueue ) ); calltree_remove_call( history , (callable_obj_t*)g_queue_pop_head (history->callQueue ) );
g_queue_push_tail (tab->callQueue, (gpointer *) c); g_queue_push_tail (history->callQueue, (gpointer *) obj);
calltree_add_call( history , c ); calltree_add_call (history, obj);
} }
} }
else
g_queue_push_tail (tab->callQueue, (gpointer *) c); 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);
} }
// TODO : sflphoneGTK : try to do this more generic // TODO : sflphoneGTK : try to do this more generic
......
...@@ -41,6 +41,8 @@ typedef struct { ...@@ -41,6 +41,8 @@ typedef struct {
void void
calllist_add_contact (gchar *, gchar *, contact_type_t, GdkPixbuf *); calllist_add_contact (gchar *, gchar *, contact_type_t, GdkPixbuf *);
void calllist_add_history_entry (callable_obj_t *obj);
/** This function initialize a call list. */ /** This function initialize a call list. */
void void
calllist_init (calltab_t* tab); calllist_init (calltab_t* tab);
......
...@@ -104,6 +104,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\n"); ...@@ -104,6 +104,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\n");
// Get the active calls at startup // Get the active calls at startup
sflphone_fill_call_list (); sflphone_fill_call_list ();
// Load the history
sflphone_fill_history (); sflphone_fill_history ();
/* start the main loop */ /* start the main loop */
......
...@@ -15,3 +15,9 @@ number=5143848557 ...@@ -15,3 +15,9 @@ number=5143848557
name=Chez wam name=Chez wam
timestamp_stop=775354987 timestamp_stop=775354987
type=1 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