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

Added "startup" section in config, new options "startup_command_{before|after}_plugins"

This commit is contained in:
Sebastien Helleu
2008-03-11 14:52:57 +01:00
parent 24ea547090
commit 469ff93d91
5 changed files with 81 additions and 20 deletions
+30
View File
@@ -2216,6 +2216,36 @@ command_init ()
&command_window, NULL);
}
/*
* command_startup: execute command at startup
*/
void
command_startup (int plugins_loaded)
{
char *command, **commands, **ptr_cmd;
struct t_gui_buffer *weechat_buffer;
if (plugins_loaded)
command = CONFIG_STRING(config_startup_command_before_plugins);
else
command = CONFIG_STRING(config_startup_command_after_plugins);
if (command && command[0])
{
commands = string_split_command (command, ';');
if (commands)
{
weechat_buffer = gui_buffer_search_main ();
for (ptr_cmd = commands; *ptr_cmd; ptr_cmd++)
{
input_data (weechat_buffer, *ptr_cmd, 0);
}
string_free_splitted_command (commands);
}
}
}
/*
* command_print_stdout: print list of commands on standard output
*/
+1
View File
@@ -25,6 +25,7 @@ struct t_gui_buffer;
extern int command_reload (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol);
extern void command_init ();
extern void command_startup (int plugins_looaded);
extern void command_print_stdout ();
#endif /* wee-command.h */
+37 -12
View File
@@ -56,13 +56,18 @@
struct t_config_file *weechat_config_file = NULL;
/* config, startup section */
struct t_config_option *config_startup_logo;
struct t_config_option *config_startup_version;
struct t_config_option *config_startup_command_before_plugins;
struct t_config_option *config_startup_command_after_plugins;
/* config, look & feel section */
struct t_config_option *config_look_color_real_white;
struct t_config_option *config_look_save_on_exit;
struct t_config_option *config_look_set_title;
struct t_config_option *config_look_startup_logo;
struct t_config_option *config_look_startup_version;
struct t_config_option *config_look_weechat_slogan;
struct t_config_option *config_look_scroll_amount;
struct t_config_option *config_look_buffer_time_format;
@@ -588,6 +593,36 @@ config_weechat_init ()
if (!weechat_config_file)
return 0;
/* startup */
ptr_section = config_file_new_section (weechat_config_file, "startup",
NULL, NULL, NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
return 0;
}
config_startup_logo = config_file_new_option (
weechat_config_file, ptr_section,
"startup_logo", "boolean",
N_("display WeeChat logo at startup"),
NULL, 0, 0, "on", NULL, NULL);
config_startup_version = config_file_new_option (
weechat_config_file, ptr_section,
"startup_version", "boolean",
N_("display WeeChat version at startup"),
NULL, 0, 0, "on", NULL, NULL);
config_startup_command_before_plugins = config_file_new_option (
weechat_config_file, ptr_section,
"startup_command_before_plugins", "string",
N_("command executed when WeeChat starts, before loading plugins"),
NULL, 0, 0, "", NULL, NULL);
config_startup_command_after_plugins = config_file_new_option (
weechat_config_file, ptr_section,
"startup_command_after_plugins", "string",
N_("command executed when WeeChat starts, after loading plugins"),
NULL, 0, 0, "", NULL, NULL);
/* look */
ptr_section = config_file_new_section (weechat_config_file, "look",
NULL, NULL, NULL, NULL, NULL, NULL);
@@ -617,16 +652,6 @@ config_weechat_init ()
N_("set title for window (terminal for Curses GUI) with "
"name and version"),
NULL, 0, 0, "on", &config_change_title, NULL);
config_look_startup_logo = config_file_new_option (
weechat_config_file, ptr_section,
"look_startup_logo", "boolean",
N_("display WeeChat logo at startup"),
NULL, 0, 0, "on", NULL, NULL);
config_look_startup_version = config_file_new_option (
weechat_config_file, ptr_section,
"look_startup_version", "boolean",
N_("display WeeChat version at startup"),
NULL, 0, 0, "on", NULL, NULL);
config_look_weechat_slogan = config_file_new_option (
weechat_config_file, ptr_section,
"look_weechat_slogan", "string",
+5 -2
View File
@@ -42,11 +42,14 @@
extern struct t_config_file *weechat_config_file;
extern struct t_config_option *config_startup_logo;
extern struct t_config_option *config_startup_version;
extern struct t_config_option *config_startup_command_before_plugins;
extern struct t_config_option *config_startup_command_after_plugins;
extern struct t_config_option *config_look_color_real_white;
extern struct t_config_option *config_look_save_on_exit;
extern struct t_config_option *config_look_set_title;
extern struct t_config_option *config_look_startup_logo;
extern struct t_config_option *config_look_startup_version;
extern struct t_config_option *config_look_weechat_slogan;
extern struct t_config_option *config_look_one_server_buffer;
extern struct t_config_option *config_look_open_near_server;
+8 -6
View File
@@ -410,7 +410,7 @@ weechat_init_vars ()
void
weechat_welcome_message ()
{
if (CONFIG_BOOLEAN(config_look_startup_logo))
if (CONFIG_BOOLEAN(config_startup_logo))
{
gui_chat_printf (NULL,
"%s ___ __ ______________ _____ \n"
@@ -428,27 +428,27 @@ weechat_welcome_message ()
&& CONFIG_STRING(config_look_weechat_slogan)[0])
{
gui_chat_printf (NULL, _("%sWelcome to %s%s%s, %s"),
(CONFIG_BOOLEAN(config_look_startup_logo)) ?
(CONFIG_BOOLEAN(config_startup_logo)) ?
" " : "",
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
PACKAGE_NAME,
GUI_NO_COLOR,
CONFIG_STRING(config_look_weechat_slogan));
}
if (CONFIG_BOOLEAN(config_look_startup_version))
if (CONFIG_BOOLEAN(config_startup_version))
{
gui_chat_printf (NULL, "%s%s%s%s, %s %s %s",
(CONFIG_BOOLEAN(config_look_startup_logo)) ?
(CONFIG_BOOLEAN(config_startup_logo)) ?
" " : "",
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
PACKAGE_STRING,
GUI_NO_COLOR,
_("compiled on"), __DATE__, __TIME__);
}
if (CONFIG_BOOLEAN(config_look_startup_logo) ||
if (CONFIG_BOOLEAN(config_startup_logo) ||
(CONFIG_STRING(config_look_weechat_slogan)
&& CONFIG_STRING(config_look_weechat_slogan)[0]) ||
CONFIG_BOOLEAN(config_look_startup_version))
CONFIG_BOOLEAN(config_startup_version))
gui_chat_printf (NULL,
"%s-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-",
GUI_COLOR(GUI_COLOR_CHAT_NICK));
@@ -521,7 +521,9 @@ main (int argc, char *argv[])
//if (weechat_session)
//session_load (weechat_session); /* load previous session if asked */
weechat_welcome_message (); /* display WeeChat welcome message */
command_startup (0); /* command executed before plugins */
plugin_init (auto_load_plugins); /* init plugin interface(s) */
command_startup (1); /* command executed after plugins */
gui_main_loop (); /* WeeChat main loop */
plugin_end (); /* end plugin interface(s) */
if (CONFIG_BOOLEAN(config_look_save_on_exit))