forked from Mirrors/sngrep
Added methods and key bindings for soft clear of call list (leaves calls matching current filter)
This commit is contained in:
parent
0ee014d497
commit
5f1f10dd05
|
@ -1201,6 +1201,7 @@ call_flow_handle_key(ui_t *ui, int key)
|
|||
call_raw_set_msg(call_flow_arrow_message(vector_item(info->darrows, info->cur_arrow)));
|
||||
break;
|
||||
case ACTION_CLEAR_CALLS:
|
||||
case ACTION_CLEAR_CALLS_SOFT:
|
||||
// Propagate the key to the previous panel
|
||||
return KEY_PROPAGATED;
|
||||
|
||||
|
|
|
@ -330,10 +330,11 @@ call_list_draw_footer(ui_t *ui)
|
|||
key_action_key_str(ACTION_CLEAR_CALLS), "Clear",
|
||||
key_action_key_str(ACTION_SHOW_FILTERS), "Filter",
|
||||
key_action_key_str(ACTION_SHOW_SETTINGS), "Settings",
|
||||
key_action_key_str(ACTION_CLEAR_CALLS_SOFT), "Clear with Filter",
|
||||
key_action_key_str(ACTION_SHOW_COLUMNS), "Columns"
|
||||
};
|
||||
|
||||
ui_draw_bindings(ui, keybindings, 22);
|
||||
ui_draw_bindings(ui, keybindings, 23);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -672,6 +673,12 @@ call_list_handle_key(ui_t *ui, int key)
|
|||
// Clear List
|
||||
call_list_clear(ui);
|
||||
break;
|
||||
case ACTION_CLEAR_CALLS_SOFT:
|
||||
// Remove stored calls, keeping the currently displayed calls
|
||||
sip_calls_clear_soft();
|
||||
// Clear List
|
||||
call_list_clear(ui);
|
||||
break;
|
||||
case ACTION_AUTOSCROLL:
|
||||
info->autoscroll = (info->autoscroll) ? 0 : 1;
|
||||
break;
|
||||
|
|
|
@ -266,6 +266,7 @@ call_raw_handle_key(ui_t *ui, int key)
|
|||
}
|
||||
break;
|
||||
case ACTION_CLEAR_CALLS:
|
||||
case ACTION_CLEAR_CALLS_SOFT:
|
||||
// Propagate the key to the previous panel
|
||||
return KEY_PROPAGATED;
|
||||
default:
|
||||
|
|
|
@ -55,6 +55,7 @@ key_binding_t bindings[ACTION_SENTINEL] = {
|
|||
{ ACTION_RESIZE_SCREEN, "", { KEY_RESIZE }, 1 },
|
||||
{ ACTION_CLEAR, "clear", { KEY_CTRL('U'), KEY_CTRL('W')}, 2 },
|
||||
{ ACTION_CLEAR_CALLS, "clearcalls", { KEY_F(5), KEY_CTRL('L')}, 2 },
|
||||
{ ACTION_CLEAR_CALLS_SOFT, "clearcallssoft", {KEY_F(9)}, 2 },
|
||||
{ ACTION_TOGGLE_SYNTAX, "togglesyntax", { KEY_F(8), 'C' }, 2 },
|
||||
{ ACTION_CYCLE_COLOR, "colormode", { 'c' }, 1 },
|
||||
{ ACTION_COMPRESS, "compress", { 's' }, 1 },
|
||||
|
|
|
@ -74,6 +74,7 @@ enum key_actions {
|
|||
ACTION_RESIZE_SCREEN,
|
||||
ACTION_CLEAR,
|
||||
ACTION_CLEAR_CALLS,
|
||||
ACTION_CLEAR_CALLS_SOFT,
|
||||
ACTION_TOGGLE_SYNTAX,
|
||||
ACTION_CYCLE_COLOR,
|
||||
ACTION_COMPRESS,
|
||||
|
|
28
src/sip.c
28
src/sip.c
|
@ -470,6 +470,12 @@ sip_calls_vector()
|
|||
return calls.list;
|
||||
}
|
||||
|
||||
vector_t *
|
||||
sip_active_calls_vector()
|
||||
{
|
||||
return calls.active;
|
||||
}
|
||||
|
||||
sip_stats_t
|
||||
sip_calls_stats()
|
||||
{
|
||||
|
@ -725,11 +731,33 @@ sip_calls_clear()
|
|||
// Create again the callid hash table
|
||||
htable_destroy(calls.callids);
|
||||
calls.callids = htable_create(calls.limit);
|
||||
|
||||
// Remove all items from vector
|
||||
vector_clear(calls.list);
|
||||
vector_clear(calls.active);
|
||||
}
|
||||
|
||||
void
|
||||
sip_calls_clear_soft()
|
||||
{
|
||||
// Create again the callid hash table
|
||||
htable_destroy(calls.callids);
|
||||
calls.callids = htable_create(calls.limit);
|
||||
|
||||
// Repopulate list applying current filter
|
||||
calls.list = vector_copy_if(sip_calls_vector(), filter_check_call);
|
||||
calls.active = vector_copy_if(sip_active_calls_vector(), filter_check_call);
|
||||
|
||||
// Repopulate callids based on filtered list
|
||||
sip_call_t *call;
|
||||
vector_iter_t it = vector_iterator(calls.list);
|
||||
|
||||
while ((call = vector_iterator_next(&it)))
|
||||
{
|
||||
htable_insert(calls.callids, call->callid, call);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sip_calls_rotate()
|
||||
{
|
||||
|
|
15
src/sip.h
15
src/sip.h
|
@ -284,6 +284,12 @@ sip_call_is_active(sip_call_t *call);
|
|||
vector_t *
|
||||
sip_calls_vector();
|
||||
|
||||
/**
|
||||
* @brief Return the active call list
|
||||
*/
|
||||
vector_t *
|
||||
sip_active_calls_vector();
|
||||
|
||||
/**
|
||||
* @brief Return stats from call list
|
||||
*
|
||||
|
@ -333,6 +339,15 @@ sip_parse_extra_headers(sip_msg_t *msg, const u_char *payload);
|
|||
void
|
||||
sip_calls_clear();
|
||||
|
||||
/**
|
||||
* @brief Remove al calls
|
||||
*
|
||||
* This funtion will clear the call list of calls other than ones
|
||||
* fitting the current filter
|
||||
*/
|
||||
void
|
||||
sip_calls_clear_soft();
|
||||
|
||||
/**
|
||||
* @brief Remove first call in the call list
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue