1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 08:13:14 +02:00

Add option irc.look.display_channel_modes_hide_key to hide channel key in channel modes (bug #23961)

This commit is contained in:
Sebastien Helleu
2010-02-02 13:56:35 +01:00
parent 94ddf61d20
commit 5aa82a85e3
19 changed files with 126 additions and 17 deletions
+19 -3
View File
@@ -172,8 +172,8 @@ char *
irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window)
{
char buf[512], buf_name[256], modes[128];
const char *name;
char buf[512], buf_name[256], modes[128], *modes_without_args;
const char *name, *pos_space, *pos_key;
int part_from_channel, display_server;
struct t_gui_buffer *buffer;
struct t_irc_server *server;
@@ -230,12 +230,28 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
&& channel->modes && channel->modes[0]
&& (strcmp (channel->modes, "+") != 0))
{
modes_without_args = NULL;
if (weechat_config_boolean (irc_config_look_display_channel_modes_hide_key))
{
pos_space = strchr(channel->modes, ' ');
if (pos_space)
{
pos_key = strchr(channel->modes, 'k');
if (pos_key && (pos_key < pos_space))
{
modes_without_args = weechat_strndup(channel->modes,
pos_space - channel->modes);
}
}
}
snprintf (modes, sizeof (modes),
"%s(%s%s%s)",
IRC_COLOR_BAR_DELIM,
IRC_COLOR_ITEM_CHANNEL_MODES,
channel->modes,
(modes_without_args) ? modes_without_args : channel->modes,
IRC_COLOR_BAR_DELIM);
if (modes_without_args)
free (modes_without_args);
}
}
}
+27
View File
@@ -56,6 +56,7 @@ struct t_config_option *irc_config_look_nick_suffix;
struct t_config_option *irc_config_look_nick_completion_smart;
struct t_config_option *irc_config_look_display_away;
struct t_config_option *irc_config_look_display_channel_modes;
struct t_config_option *irc_config_look_display_channel_modes_hide_key;
struct t_config_option *irc_config_look_display_ctcp_blocked;
struct t_config_option *irc_config_look_display_ctcp_reply;
struct t_config_option *irc_config_look_display_ctcp_unknown;
@@ -231,6 +232,24 @@ irc_config_change_look_display_channel_modes (void *data,
weechat_bar_item_update ("buffer_name");
}
/*
* irc_config_change_look_display_channel_modes_hide_key: called when the
* "display channel modes
* hide key" option is
* changed
*/
void
irc_config_change_look_display_channel_modes_hide_key (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
weechat_bar_item_update ("buffer_name");
}
/*
* irc_config_change_look_display_nick_modes: called when the "display
* nick modes" option is changed
@@ -1365,6 +1384,14 @@ irc_config_init ()
N_("display channel modes in \"buffer_name\" bar item"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL,
&irc_config_change_look_display_channel_modes, NULL, NULL, NULL);
irc_config_look_display_channel_modes_hide_key = weechat_config_new_option (
irc_config_file, ptr_section,
"display_channel_modes_hide_key", "boolean",
N_("hide channel key if modes are displayed in \"buffer_name\" bar "
"item (this will hide all channel modes arguments if mode +k is "
"set on channel)"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL,
&irc_config_change_look_display_channel_modes_hide_key, NULL, NULL, NULL);
irc_config_look_display_ctcp_blocked = weechat_config_new_option (
irc_config_file, ptr_section,
"display_ctcp_blocked", "boolean",
+1
View File
@@ -78,6 +78,7 @@ extern struct t_config_option *irc_config_look_nick_suffix;
extern struct t_config_option *irc_config_look_nick_completion_smart;
extern struct t_config_option *irc_config_look_display_away;
extern struct t_config_option *irc_config_look_display_channel_modes;
extern struct t_config_option *irc_config_look_display_channel_modes_hide_key;
extern struct t_config_option *irc_config_look_display_ctcp_blocked;
extern struct t_config_option *irc_config_look_display_ctcp_reply;
extern struct t_config_option *irc_config_look_display_ctcp_unknown;