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

New format for [bar] section in weechat.conf file, bar options can be set with /set command

This commit is contained in:
Sebastien Helleu
2008-04-15 13:50:01 +02:00
parent 362ce3eca8
commit b87d709a70
34 changed files with 1657 additions and 474 deletions
+49 -49
View File
@@ -2553,6 +2553,55 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
if (weechat_strcasecmp (argv[1], "rename") == 0)
{
if (argc < 4)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server rename");
}
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
{
weechat_printf (NULL,
_("%s%s: server \"%s\" not found for "
"\"%s\" command"),
weechat_prefix ("error"), "irc",
argv[2], "server rename");
return WEECHAT_RC_ERROR;
}
/* check if target name already exists */
if (irc_server_search (argv[3]))
{
weechat_printf (NULL,
_("%s%s: server \"%s\" already exists for "
"\"%s\" command"),
weechat_prefix ("error"), "irc",
argv[3], "server rename");
return WEECHAT_RC_ERROR;
}
/* rename server */
if (irc_server_rename (server_found, argv[3]))
{
weechat_printf (NULL,
_("%s: server %s%s%s has been renamed to "
"%s%s"),
"irc",
IRC_COLOR_CHAT_SERVER,
argv[2],
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_SERVER,
argv[3]);
//gui_window_redraw_all_buffers ();
return WEECHAT_RC_OK;
}
return WEECHAT_RC_ERROR;
}
/* TODO: fix server command */
weechat_printf (NULL,
"%sSome server options are temporarirly disabled in "
@@ -2765,55 +2814,6 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_ERROR;
}
if (weechat_strcasecmp (argv[1], "rename") == 0)
{
if (argc < 4)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server rename");
}
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
{
weechat_printf (NULL,
_("%s%s: server \"%s\" not found for "
"\"%s\" command"),
weechat_prefix ("error"), "irc",
argv[2], "server rename");
return WEECHAT_RC_ERROR;
}
/* check if target name already exists */
if (irc_server_search (argv[3]))
{
weechat_printf (NULL,
_("%s%s: server \"%s\" already exists for "
"\"%s\" command"),
weechat_prefix ("error"), "irc",
argv[3], "server rename");
return WEECHAT_RC_ERROR;
}
/* rename server */
if (irc_server_rename (server_found, argv[3]))
{
weechat_printf (NULL,
_("%s: server %s%s%s has been renamed to "
"%s%s"),
"irc",
IRC_COLOR_CHAT_SERVER,
argv[2],
IRC_COLOR_CHAT,
IRC_COLOR_CHAT_SERVER,
argv[3]);
//gui_window_redraw_all_buffers ();
return WEECHAT_RC_OK;
}
return WEECHAT_RC_ERROR;
}
if (weechat_strcasecmp (argv[1], "keep") == 0)
{
if (argc < 3)
+6
View File
@@ -859,6 +859,7 @@ irc_config_init ()
return 0;
ptr_section = weechat_config_new_section (irc_config_file, "look",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
@@ -915,6 +916,7 @@ irc_config_init ()
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (irc_config_file, "network",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
@@ -989,6 +991,7 @@ irc_config_init ()
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (irc_config_file, "dcc",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
@@ -1065,6 +1068,7 @@ irc_config_init ()
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (irc_config_file, "log",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
@@ -1095,6 +1099,7 @@ irc_config_init ()
NULL, 0, 0, "on", NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (irc_config_file, "server_default",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
@@ -1108,6 +1113,7 @@ irc_config_init ()
irc_config_server_create_default_options (ptr_section);
ptr_section = weechat_config_new_section (irc_config_file, "server",
1, 1,
NULL, NULL,
NULL, NULL,
&irc_config_server_write_default, NULL,
+18 -10
View File
@@ -994,6 +994,7 @@ irc_server_rename (struct t_irc_server *server, char *new_name)
int length;
char *option_name, *name, *pos_option;
struct t_plugin_infolist *infolist;
struct t_config_option *ptr_option;
/* check if another server exists with this name */
if (irc_server_search (new_name))
@@ -1009,18 +1010,25 @@ irc_server_rename (struct t_irc_server *server, char *new_name)
free (option_name);
while (weechat_infolist_next (infolist))
{
name = weechat_infolist_string (infolist, "name");
pos_option = strchr (name, '.');
if (pos_option)
weechat_config_search_with_string (weechat_infolist_string (infolist,
"full_name"),
NULL, NULL, &ptr_option,
NULL);
if (ptr_option)
{
pos_option++;
length = strlen (new_name) + 1 + strlen (pos_option) + 1;
option_name = malloc (length);
if (option_name)
name = weechat_infolist_string (infolist, "name");
pos_option = strchr (name, '.');
if (pos_option)
{
snprintf (option_name, length, "%s.%s", new_name, pos_option);
/* TODO: complete this function */
free (option_name);
pos_option++;
length = strlen (new_name) + 1 + strlen (pos_option) + 1;
option_name = malloc (length);
if (option_name)
{
snprintf (option_name, length, "%s.%s", new_name, pos_option);
weechat_config_option_rename (ptr_option, option_name);
free (option_name);
}
}
}
}