/* redraw activity, FIXME: if we didn't get enough size, this gets buggy. At least "Det:" isn't printed properly. also we should rearrange the act list so that the highest priority items comes first. */ static void item_act(SBAR_ITEM_REC *item, int get_size_only) { char *actlist; int max_size; if (get_size_only) { if (activity_list == NULL) item->min_size = item->max_size = 0; /* Skip activity calculation on regular trigger, only set dirty */ return; } actlist = get_activity_list(item->bar->parent_window, TRUE, TRUE); if (actlist == NULL) { return; } max_size = item->max_size; statusbar_item_default_handler(item, TRUE, NULL, actlist, FALSE); statusbar_item_default_handler(item, FALSE, NULL, actlist, FALSE); if (max_size != item->max_size) { /* Due to above hack of skipping the calculation, we need to manually trigger the redraw process now or we won't see the item */ item->bar->dirty = item->dirty = TRUE; statusbar_redraw(item->bar, TRUE); statusbar_redraw_dirty(); } g_free_not_null(actlist); }
static void item_lag(SBAR_ITEM_REC *item, int get_size_only) { SERVER_REC *server; char str[MAX_INT_STRLEN+10]; int lag, lag_unknown; server = active_win == NULL ? NULL : active_win->active_server; lag = get_lag(server, &lag_unknown)/10; if (lag <= 0 || lag < settings_get_int("lag_min_show")) { /* don't print the lag item */ if (get_size_only) item->min_size = item->max_size = 0; return; } last_lag = lag; last_lag_unknown = lag_unknown; if (lag_unknown) { g_snprintf(str, sizeof(str), "%d (?""?)", lag/100); } else { g_snprintf(str, sizeof(str), lag%100 == 0 ? "%d" : "%d.%02d", lag/100, lag%100); } statusbar_item_default_handler(item, get_size_only, NULL, str, TRUE); }
static void item_lag(SBAR_ITEM_REC *item, int get_size_only) { SERVER_REC *server; char str[MAX_INT_STRLEN+10]; int lag, lag_unknown; server = active_win == NULL ? NULL : active_win->active_server; lag = get_lag(server, &lag_unknown); if (lag <= 0 || lag < settings_get_time("lag_min_show")) { /* don't print the lag item */ if (get_size_only) item->min_size = item->max_size = 0; return; } lag /= 10; last_lag = lag; last_lag_unknown = lag_unknown; if (lag_unknown) { /* "??)" in C becomes ']' See: https://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C */ g_snprintf(str, sizeof(str), "%d (?""?)", lag / 100); } else { if (lag % 100 == 0) g_snprintf(str, sizeof(str), "%d", lag / 100); else g_snprintf(str, sizeof(str), "%d.%02d", lag / 100, lag % 100); } statusbar_item_default_handler(item, get_size_only, NULL, str, TRUE); }
/* * Handle otr statusbar of irssi. */ static void otr_statusbar(struct SBAR_ITEM_REC *item, int get_size_only) { WI_ITEM_REC *wi = active_win->active; QUERY_REC *query = QUERY(wi); enum otr_status_format formatnum = TXT_OTR_MODULE_NAME; if (query && query->server && query->server->connrec) { formatnum = otr_get_status_format(query->server, query->name); } statusbar_item_default_handler(item, get_size_only, formatnum ? otr_formats[formatnum].def : "", " ", FALSE); }
static void item_window_empty(SBAR_ITEM_REC *item, int get_size_only) { WINDOW_REC *window; window = active_win; if (item->bar->parent_window != NULL) window = item->bar->parent_window->active; if (window != NULL && window->active == NULL) { statusbar_item_default_handler(item, get_size_only, NULL, "", TRUE); } else if (get_size_only) { item->min_size = item->max_size = 0; } }
/* redraw activity, FIXME: if we didn't get enough size, this gets buggy. At least "Det:" isn't printed properly. also we should rearrange the act list so that the highest priority items comes first. */ static void item_act(SBAR_ITEM_REC *item, int get_size_only) { char *actlist; actlist = get_activity_list(item->bar->parent_window, TRUE, TRUE); if (actlist == NULL) { if (get_size_only) item->min_size = item->max_size = 0; return; } statusbar_item_default_handler(item, get_size_only, NULL, actlist, FALSE); g_free_not_null(actlist); }
static void item_more(SBAR_ITEM_REC *item, int get_size_only) { MAIN_WINDOW_REC *mainwin; int visible; if (active_win == NULL) { mainwin = NULL; visible = FALSE; } else { mainwin = WINDOW_MAIN(active_win); visible = WINDOW_GUI(active_win)->view->more_text; } if (!visible) { if (mainwin != NULL) more_visible = g_slist_remove(more_visible, mainwin); if (get_size_only) item->min_size = item->max_size = 0; return; } more_visible = g_slist_prepend(more_visible, mainwin); statusbar_item_default_handler(item, get_size_only, NULL, "", FALSE); }
static void statusbar_item_default_func(SBAR_ITEM_REC *item, int get_size_only) { statusbar_item_default_handler(item, get_size_only, NULL, "", TRUE); }