Fix wrong displayed filtered calls in CallList

This commit is contained in:
Kaian 2015-03-01 01:18:15 +01:00
parent 373617d1d5
commit 080a4a10d2
4 changed files with 23 additions and 16 deletions

View File

@ -63,19 +63,22 @@ filter_get(int type)
return filters[type].expr; return filters[type].expr;
} }
int void
filter_display_count() filter_stats(int *total, int *displayed)
{ {
sip_call_t *call = NULL; sip_call_t *call = NULL;
int filtered_cnt = 0;
while ((call = call_get_next_filtered(call))) { // Initialize stats
filtered_cnt++; *total = 0;
*displayed = 0;
while ((call = call_get_next(call))) {
(*total)++;
if (filter_check_call(call) == 0)
(*displayed)++;
} }
return filtered_cnt;
} }
int int
filter_check_call(sip_call_t *call) filter_check_call(sip_call_t *call)
{ {

View File

@ -99,12 +99,13 @@ const char *
filter_get(int type); filter_get(int type);
/** /**
* @brief Number of calls that not have been filtered * @brief Get Filtered calls
* *
* @return Number of calls without filtered flag * @param total Total calls processed
* @param displayed number of calls matching filters
*/ */
int void
filter_display_count(); filter_stats(int *total, int *displayed);
/** /**
* @brief Check if a call if filtered * @brief Check if a call if filtered

View File

@ -226,9 +226,8 @@ call_list_draw(PANEL *panel)
wattroff(win, A_BOLD | A_REVERSE | COLOR_PAIR(CP_DEF_ON_CYAN)); wattroff(win, A_BOLD | A_REVERSE | COLOR_PAIR(CP_DEF_ON_CYAN));
} }
// Store call counters // Get filter call counters
callcnt = sip_calls_count(); filter_stats(&callcnt, &dispcallcnt);
dispcallcnt = filter_display_count();
// Print calls count (also filtered) // Print calls count (also filtered)
mvwprintw(win, 1, 35, "%*s", 35, ""); mvwprintw(win, 1, 35, "%*s", 35, "");

View File

@ -144,15 +144,19 @@ save_destroy(PANEL *panel)
int int
save_draw(PANEL *panel) save_draw(PANEL *panel)
{ {
int total, displayed;
// Get panel information // Get panel information
save_info_t *info = (save_info_t*) panel_userptr(panel); save_info_t *info = (save_info_t*) panel_userptr(panel);
WINDOW *win = panel_window(panel); WINDOW *win = panel_window(panel);
// Get filter stats
filter_stats(&total, &displayed);
mvwprintw(win, 5, 3, "( ) Save all dialogs"); mvwprintw(win, 5, 3, "( ) Save all dialogs");
mvwprintw(win, 6, 3, "( ) Save selected dialogs (%d dialogs)", mvwprintw(win, 6, 3, "( ) Save selected dialogs (%d dialogs)",
call_group_count(info->group)); call_group_count(info->group));
mvwprintw(win, 7, 3, "( ) Save displayed dialogs (%d dialogs)", mvwprintw(win, 7, 3, "( ) Save displayed dialogs (%d dialogs)", displayed);
filter_display_count());
set_field_buffer(info->fields[FLD_SAVE_ALL], 0, set_field_buffer(info->fields[FLD_SAVE_ALL], 0,
(info->savemode == SAVE_ALL) ? "*" : ""); (info->savemode == SAVE_ALL) ? "*" : "");