Commit b5637b1a authored by Tristan Matthews's avatar Tristan Matthews

* #6853: hangup as soon as all digits have been deleted

parent c65106e3
......@@ -628,12 +628,23 @@ sflphone_incoming_call (callable_obj_t * c)
}
}
/* Truncates last char from dynamically allocated string */
static void truncate_last_char(gchar **str)
{
if (strlen(*str) > 0) {
gchar *tmp = *str;
tmp = g_strndup(*str, strlen(*str) - 1);
g_free(*str);
*str = tmp;
}
}
void
process_dialing (callable_obj_t *c, guint keyval, gchar *key)
{
// We stop the tone
if (!*c->_peer_number && c->_state != CALL_STATE_TRANSFERT)
dbus_start_tone (FALSE , 0);
dbus_start_tone (FALSE, 0);
switch (keyval) {
case GDK_Return:
......@@ -645,16 +656,14 @@ process_dialing (callable_obj_t *c, guint keyval, gchar *key)
break;
case GDK_BackSpace:
if (c->_state == CALL_STATE_TRANSFERT) {
if (*c->_trsft_to)
c->_trsft_to[strlen (c->_trsft_to) - 1] = '\0';
truncate_last_char(&c->_trsft_to);
calltree_update_call (current_calls, c, NULL);
} else {
if (*c->_peer_number) {
c->_peer_number[strlen (c->_peer_number) -1] = '\0';
calltree_update_call (current_calls, c, NULL);
}
else
dbus_hang_up(c);
truncate_last_char(&c->_peer_number);
calltree_update_call (current_calls, c, NULL);
/* If number is now empty, hang up immediately */
if (strlen(c->_peer_number) == 0)
dbus_hang_up(c);
}
break;
......
......@@ -181,12 +181,12 @@ callable_obj_t *create_history_entry_from_serialized_form (const gchar *entry)
case 1: peer_number = *ptr; break;
case 2: peer_name = *ptr; break;
case 3: time_start = *ptr; break;
case 4: time_stop = *ptr; break;
case 5: callID = *ptr; break;
case 4: time_stop = *ptr; break;
case 5: callID = *ptr; break;
case 6: accountID = *ptr; break;
case 7: recordfile = *ptr; break;
case 8: confID = *ptr; break;
case 9: time_added = *ptr; break;
case 8: confID = *ptr; break;
case 9: time_added = *ptr; break;
default: break;
}
......
......@@ -692,9 +692,9 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
gchar * description = NULL;
gchar * audio_codec = call_get_audio_codec (c);
if (c->_state == CALL_STATE_TRANSFERT) {
if (c->_state == CALL_STATE_TRANSFERT)
description = calltree_display_call_info (c, DISPLAY_TYPE_CALL_TRANSFER, "");
} else {
else {
if (c->_sas && display_sas && c->_srtp_state == SRTP_STATE_ZRTP_SAS_UNCONFIRMED && !c->_zrtp_confirmed)
description = calltree_display_call_info (c, DISPLAY_TYPE_SAS, "");
else
......@@ -1712,17 +1712,18 @@ void drag_data_received_cb (GtkWidget *widget, GdkDragContext *context UNUSED, g
static void menuitem_response( gchar *string )
{
if(g_strcmp0(string, SFL_CREATE_CONFERENCE) == 0) {
sflphone_join_participant (calltree_selected_call->_callID, calltree_dragged_call->_callID);
}
else if(g_strcmp0(string, SFL_TRANSFER_CALL) == 0) {
DEBUG("Calltree: Transfering call %s, to %s", calltree_selected_call->_peer_number, calltree_dragged_call->_peer_number);
if (g_strcmp0(string, SFL_CREATE_CONFERENCE) == 0)
sflphone_join_participant (calltree_selected_call->_callID,
calltree_dragged_call->_callID);
else if (g_strcmp0(string, SFL_TRANSFER_CALL) == 0) {
DEBUG("Calltree: Transfering call %s, to %s",
calltree_selected_call->_peer_number,
calltree_dragged_call->_peer_number);
dbus_attended_transfer(calltree_selected_call, calltree_dragged_call);
calltree_remove_call(current_calls, calltree_selected_call, NULL);
}
else {
else
DEBUG("CallTree: Error unknown option selected in menu %s", string);
}
// Make sure the create conference opetion will appear next time the menu pops
// The create conference option will hide if tow call from the same conference are draged on each other
......
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