diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/weeconfig.c | 22 | ||||
-rw-r--r-- | src/common/weeconfig.h | 3 | ||||
-rw-r--r-- | src/gui/curses/gui-display.c | 53 |
3 files changed, 69 insertions, 9 deletions
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c index d2357f05a..e7333a8b4 100644 --- a/src/common/weeconfig.c +++ b/src/common/weeconfig.c @@ -87,6 +87,9 @@ int cfg_look_infobar; char *cfg_look_infobar_timestamp; int cfg_look_infobar_seconds; int cfg_look_infobar_delay_highlight; +int cfg_look_hotlist_names_count; +int cfg_look_hotlist_names_level; +int cfg_look_hotlist_names_length; t_config_option weechat_options_look[] = { { "look_set_title", N_("set title for window (terminal for Curses GUI) with name & version"), @@ -147,12 +150,12 @@ t_config_option weechat_options_look[] = "right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, config_change_buffers }, { "look_nicklist_min_size", N_("min size for nicklist"), N_("min size for nicklist (width or height, depending on look_nicklist_position " - "(0 = no min size))"), + "(0 = no min size))"), OPTION_TYPE_INT, 0, 100, 0, NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_buffers }, { "look_nicklist_max_size", N_("max size for nicklist"), N_("max size for nicklist (width or height, depending on look_nicklist_position " - "(0 = no max size; if min == max and > 0, then size is fixed))"), + "(0 = no max size; if min == max and > 0, then size is fixed))"), OPTION_TYPE_INT, 0, 100, 0, NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_buffers }, { "look_no_nickname", N_("text to display instead of nick when not connected"), @@ -185,9 +188,22 @@ t_config_option weechat_options_look[] = NULL, NULL, &cfg_look_infobar_seconds, NULL, config_change_buffer_content }, { "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"), N_("delay (in seconds) for highlight messages in infobar " - "(0 = disable highlight notifications in infobar)"), + "(0 = disable highlight notifications in infobar)"), OPTION_TYPE_INT, 0, INT_MAX, 7, NULL, NULL, &cfg_look_infobar_delay_highlight, NULL, config_change_noop }, + { "look_hotlist_names_count", N_("max number of names in hotlist"), + N_("max number of names in hotlist (0 = no name displayed, only buffer numbers)"), + OPTION_TYPE_INT, 0, 32, 3, + NULL, NULL, &cfg_look_hotlist_names_count, NULL, config_change_buffer_content }, + { "look_hotlist_names_level", N_("level for displaying names in hotlist"), + N_("level for displaying names in hotlist (combination of: 1=join/part, 2=message, " + "4=private, 8=highlight, for example: 12=private+highlight)"), + OPTION_TYPE_INT, 1, 15, 12, + NULL, NULL, &cfg_look_hotlist_names_level, NULL, config_change_buffer_content }, + { "look_hotlist_names_length", N_("max length of names in hotlist"), + N_("max length of names in hotlist (0 = no limit)"), + OPTION_TYPE_INT, 0, 32, 0, + NULL, NULL, &cfg_look_hotlist_names_length, NULL, config_change_buffer_content }, { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL } }; diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h index c611d7730..c07e43681 100644 --- a/src/common/weeconfig.h +++ b/src/common/weeconfig.h @@ -102,6 +102,9 @@ extern int cfg_look_infobar; extern char *cfg_look_infobar_timestamp; extern int cfg_look_infobar_seconds; extern int cfg_look_infobar_delay_highlight; +extern int cfg_look_hotlist_names_count; +extern int cfg_look_hotlist_names_level; +extern int cfg_look_hotlist_names_length; extern int cfg_col_title; extern int cfg_col_title_bg; diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index e7e933ed3..302379593 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -1205,8 +1205,9 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) { t_gui_window *ptr_win; t_weechat_hotlist *ptr_hotlist; - char format_more[32], str_nicks[32], *string; + char format[32], str_nicks[32], *string; int i, first_mode, x; + int display_name, names_count; /* make gcc happy */ (void) buffer; @@ -1386,6 +1387,8 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) _("Act: ")); wprintw (ptr_win->win_status, string); free (string); + + names_count = 0; for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist) { @@ -1394,28 +1397,66 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) case HOTLIST_LOW: gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_DATA_OTHER); + display_name = ((cfg_look_hotlist_names_level & 1) != 0); break; case HOTLIST_MSG: gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_DATA_MSG); + display_name = ((cfg_look_hotlist_names_level & 2) != 0); break; case HOTLIST_PRIVATE: gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_DATA_PRIVATE); + display_name = ((cfg_look_hotlist_names_level & 4) != 0); break; case HOTLIST_HIGHLIGHT: gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_DATA_HIGHLIGHT); + display_name = ((cfg_look_hotlist_names_level & 8) != 0); + break; + default: + display_name = 0; break; } if (ptr_hotlist->buffer->dcc) - wprintw (ptr_win->win_status, "%d/DCC", + { + wprintw (ptr_win->win_status, "%d", ptr_hotlist->buffer->number); + gui_window_set_color (ptr_win->win_status, + COLOR_WIN_STATUS_DELIMITERS); + wprintw (ptr_win->win_status, ":"); + gui_window_set_color (ptr_win->win_status, + COLOR_WIN_STATUS); + wprintw (ptr_win->win_status, "DCC"); + } else + { wprintw (ptr_win->win_status, "%d", ptr_hotlist->buffer->number); - gui_window_set_color (ptr_win->win_status, - COLOR_WIN_STATUS); + + if (display_name && (cfg_look_hotlist_names_count != 0) + && (names_count < cfg_look_hotlist_names_count)) + { + names_count++; + + gui_window_set_color (ptr_win->win_status, + COLOR_WIN_STATUS_DELIMITERS); + wprintw (ptr_win->win_status, ":"); + + gui_window_set_color (ptr_win->win_status, + COLOR_WIN_STATUS); + if (cfg_look_hotlist_names_length == 0) + snprintf (format, sizeof (format) - 1, "%%s"); + else + snprintf (format, sizeof (format) - 1, "%%.%ds", cfg_look_hotlist_names_length); + if (BUFFER_IS_SERVER(ptr_hotlist->buffer)) + wprintw (ptr_win->win_status, format, SERVER(ptr_hotlist->buffer)->name); + else if (BUFFER_IS_CHANNEL(ptr_hotlist->buffer) + || BUFFER_IS_PRIVATE(ptr_hotlist->buffer)) + wprintw (ptr_win->win_status, format, CHANNEL(ptr_hotlist->buffer)->name); + } + } + if (ptr_hotlist->next_hotlist) wprintw (ptr_win->win_status, ","); } @@ -1466,8 +1507,8 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) mvwprintw (ptr_win->win_status, 0, x, "%s", string); else { - snprintf (format_more, sizeof (format_more) - 1, "%%-%ds", (int)(strlen (string))); - mvwprintw (ptr_win->win_status, 0, x, format_more, " "); + snprintf (format, sizeof (format) - 1, "%%-%ds", (int)(strlen (string))); + mvwprintw (ptr_win->win_status, 0, x, format, " "); } if (gui_buffer_has_nicklist (ptr_win->buffer)) { |