diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 47bc3652a277749a7adf4b4e37a6b90a0bb2fb58..1918fa294368c2241bea76c0fa8dd033fc9a2bc6 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -719,7 +719,7 @@ sflphone_new_call() callable_obj_t * current_selected_call; gchar *peer_name, *peer_number; - DEBUG("sflphone_new_call"); + DEBUG("Actions: Sflphone new call"); current_selected_call = calltab_get_selected_call(current_calls); @@ -882,7 +882,7 @@ static int _place_registered_call(callable_obj_t * c) { account_t * current = NULL; if(c == NULL) { - DEBUG("callable_obj_t is NULL in _place_registered_call"); + DEBUG("Actions: Callable_obj_t is NULL in _place_registered_call"); return -1; } @@ -901,29 +901,31 @@ static int _place_registered_call(callable_obj_t * c) { } if( account_list_get_by_state( ACCOUNT_STATE_REGISTERED ) == NULL ) { + DEBUG("Actions: No registered account, cannot make a call"); notify_no_registered_accounts(); sflphone_fail(c); return -1; } - DEBUG("place_registered_call begin"); - + DEBUG("Actions: Get account for this call"); if(g_strcasecmp(c->_accountID, "") != 0) { + DEBUG("Actions: Account %s already set for this call", c->_accountID); current = account_list_get_by_id(c->_accountID); } else { + DEBUG("Actions: No account set for this call, use first of the list"); current = account_list_get_current(); } - DEBUG("place_registered_call end"); - if(current == NULL) { - DEBUG("Unexpected condition: account_t is NULL in %s at %d for accountID %s", __FILE__, __LINE__, c->_accountID); + DEBUG("Actions: Unexpected condition: account_t is NULL in %s at %d for accountID %s", __FILE__, __LINE__, c->_accountID); return -1; } if(g_strcasecmp(g_hash_table_lookup( current->properties, "Status"),"REGISTERED")==0) { /* The call is made with the current account */ - c->_accountID = current->accountID; + // free memory for previous account id and get a new one + g_free(c->_accountID); + c->_accountID = g_strdup(current->accountID); dbus_place_call(c); } else { /* Place the call with the first registered account @@ -931,7 +933,8 @@ static int _place_registered_call(callable_obj_t * c) { * If we are here, we can be sure that there is at least one. */ current = account_list_get_by_state( ACCOUNT_STATE_REGISTERED ); - c->_accountID = current->accountID; + g_free(c->_accountID); + c->_accountID = g_strdup(current->accountID); dbus_place_call(c); notify_current_account( current ); } @@ -946,15 +949,15 @@ sflphone_place_call ( callable_obj_t * c ) { gchar *msg = ""; - DEBUG("Placing call with %s @ %s and accountid %s", c->_peer_name, c->_peer_number, c->_accountID); + DEBUG("Actions: Placing call with %s @ %s and accountid %s", c->_peer_name, c->_peer_number, c->_accountID); if(c == NULL) { - DEBUG("Unexpected condition: callable_obj_t is null in %s at %d", __FILE__, __LINE__); + DEBUG("Actions: Unexpected condition: callable_obj_t is null in %s at %d", __FILE__, __LINE__); return; } if(_is_direct_call(c)) { - msg = g_markup_printf_escaped (_("Direct SIP call")); + msg = g_markup_printf_escaped (_("Direct SIP call")); statusbar_pop_message(__MSG_ACCOUNT_DEFAULT); statusbar_push_message( msg , NULL, __MSG_ACCOUNT_DEFAULT); g_free(msg); diff --git a/sflphone-client-gnome/src/callable_obj.c b/sflphone-client-gnome/src/callable_obj.c index 8165ada6ce359295cb2fb4ce5605b772de194871..f40645a0749dc9f1fc6e2996f3da51ff7acd1edf 100644 --- a/sflphone-client-gnome/src/callable_obj.c +++ b/sflphone-client-gnome/src/callable_obj.c @@ -133,14 +133,16 @@ void *threaded_clock_incrementer(void *pc) { callable_obj_t *call = (callable_obj_t *)pc; + while(call->clockStarted) { + gchar *res; int duration; time_t start, current; gdk_threads_enter (); - + set_timestamp(&(call->_time_current)); start = call->_time_start; @@ -148,6 +150,7 @@ void *threaded_clock_incrementer(void *pc) { if (current == start) { g_snprintf(call->_timestr, 20, "00:00"); + } duration = (int) difftime(current, start); @@ -174,9 +177,12 @@ void *threaded_clock_incrementer(void *pc) { calltree_update_clock(); gdk_threads_leave (); + - sleep(1); + usleep(10000); + } + } void create_new_call (callable_type_t type, call_state_t state, gchar* callID , gchar* accountID, gchar* peer_name, gchar* peer_number, callable_obj_t ** new_call) @@ -185,6 +191,10 @@ void create_new_call (callable_type_t type, call_state_t state, gchar* callID , callable_obj_t *obj; gchar *call_id; + DEBUG("CallableObj: Create new call"); + + DEBUG("Account: %s", accountID); + // Allocate memory obj = g_new0 (callable_obj_t, 1); @@ -204,7 +214,7 @@ void create_new_call (callable_type_t type, call_state_t state, gchar* callID , set_timestamp (&(obj->_time_start)); set_timestamp (&(obj->_time_current)); set_timestamp (&(obj->_time_stop)); - g_snprintf(obj->_timestr, 20, "00:00"); + // g_snprintf(obj->_timestr, 20, "00:00"); if (g_strcasecmp (callID, "") == 0) call_id = generate_call_id (); @@ -311,16 +321,24 @@ void create_history_entry_from_serialized_form (gchar *timestamp, gchar *details void free_callable_obj_t (callable_obj_t *c) { + DEBUG("CallableObj: Free callable object"); + + + if(!c) + ERROR("CallableObj: Callable object is NULL"); + c->clockStarted = 0; - pthread_join(c->tid, NULL); - g_free (c->_callID); g_free (c->_accountID); g_free (c->_peer_name); g_free (c->_peer_number); g_free (c->_peer_info); g_free (c); + + DEBUG("If you don't see it that is because there is a problem"); + + // calltree_update_clock(); } void attach_thumbnail (callable_obj_t *call, GdkPixbuf *pixbuf) { diff --git a/sflphone-client-gnome/src/callable_obj.h b/sflphone-client-gnome/src/callable_obj.h index 2c039e27b05df54307aaa7a22e02011bdd905c3e..e8688ad340e0668b105288b0dbef5762656ed723 100644 --- a/sflphone-client-gnome/src/callable_obj.h +++ b/sflphone-client-gnome/src/callable_obj.h @@ -112,7 +112,7 @@ typedef struct { time_t _time_start; // The timestamp the call was initiating time_t _time_current; // Clock increment to display call's elapsed time time_t _time_stop; // The timestamp the call was over - gchar _timestr[20]; // The timestamp as a string format for + gchar _timestr[20]; // The timestamp as a string format for disply in statusbar history_state_t _history_state; // The history state if necessary srtp_state_t _srtp_state; // The state of security on the call gchar* _srtp_cipher; // Cipher used for the srtp session diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index c326b3595d89abdaf24141d952d6b1c217aad944..dac450d507534fb51f1732c971c8885f7ab70627 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -1408,11 +1408,15 @@ void calltree_display (calltab_t *tab) { void calltree_update_clock() { - if(!selected_call) + if(!selected_call) { + statusbar_update_clock(NULL); return; + } - if(!(selected_call->_timestr)) + if(!(selected_call->_timestr)) { + statusbar_update_clock(NULL); return; + } // TODO this make the whole thing crash... // calltree_update_call(current_calls, c, NULL); diff --git a/sflphone-client-gnome/src/mainwindow.c b/sflphone-client-gnome/src/mainwindow.c index acdb3ffbb520b6da85b31f2bdf038df97c858108..0cd6bd195f0e4bccce91dc34872d501af71f408e 100644 --- a/sflphone-client-gnome/src/mainwindow.c +++ b/sflphone-client-gnome/src/mainwindow.c @@ -206,7 +206,7 @@ create_main_window () g_signal_connect (G_OBJECT (window), "key-release-event", G_CALLBACK (on_key_released), NULL); - g_signal_connect_after (G_OBJECT (window), "focus-in-event", + g_signal_connect_after (G_OBJECT (window), "focus-in-event", G_CALLBACK (focus_on_mainwindow_in), NULL); g_signal_connect_after (G_OBJECT (window), "focus-out-event", @@ -449,14 +449,19 @@ statusbar_update_clock(gchar *msg) { gchar *message = NULL; + if(!msg) { + statusbar_pop_message(__MSG_ACCOUNT_DEFAULT); + statusbar_push_message(message, NULL, __MSG_ACCOUNT_DEFAULT); + } + + pthread_mutex_lock(&statusbar_message_mutex); message = g_strdup(status_current_message); pthread_mutex_unlock(&statusbar_message_mutex); if(message) { - - statusbar_pop_message(__MSG_ACCOUNT_DEFAULT); - statusbar_push_message(message, msg, __MSG_ACCOUNT_DEFAULT); + statusbar_pop_message(__MSG_ACCOUNT_DEFAULT); + statusbar_push_message(message, msg, __MSG_ACCOUNT_DEFAULT); } g_free(message); diff --git a/sflphone-common/configure.ac b/sflphone-common/configure.ac index e7abe149da9c3a96db475cb5fbefd22c70c5f62d..6043a9108905530e79e896f20699fc439c3b1b7d 100644 --- a/sflphone-common/configure.ac +++ b/sflphone-common/configure.ac @@ -272,10 +272,10 @@ AC_CHECK_LIB([yaml], yaml_parser_initialize, [AC_CHECK_HEADERS(yaml.h, have_yaml=true, have_yaml=false)], have_yaml = false) -if ! $have_yaml; then + if test "$have_yaml" = "false"; then AC_MSG_ERROR([You need the libyaml yaml parser] [http://expat.sourceforge.net/]) -fi + fi yaml_CFLAGS= yaml_LIBS=-lyaml