diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/weechat.c | 20 | ||||
-rw-r--r-- | src/common/weechat.h | 2 | ||||
-rw-r--r-- | src/irc/irc-server.c | 4 | ||||
-rw-r--r-- | src/irc/irc.h | 2 | ||||
-rw-r--r-- | src/plugins/plugins.c | 4 | ||||
-rw-r--r-- | src/plugins/plugins.h | 2 |
6 files changed, 23 insertions, 11 deletions
diff --git a/src/common/weechat.c b/src/common/weechat.c index 9e5bfcfe1..58a2e348e 100644 --- a/src/common/weechat.c +++ b/src/common/weechat.c @@ -78,9 +78,11 @@ int sigsegv = 0; /* SIGSEGV received? char *weechat_home = NULL; /* WeeChat home dir. (example: /home/toto/.weechat) */ FILE *weechat_log_file = NULL; /* WeeChat log file (~/.weechat/weechat.log) */ -char *local_charset = NULL; /* local charset, for example: ISO-8859-1 */ +char *local_charset = NULL; /* local charset, for example: ISO-8859-1, UTF-8 */ -int server_cmd_line; /* at least one server on WeeChat command line */ +int server_cmd_line; /* at least one server on WeeChat command line */ +int auto_connect; /* enabled by default, can by disabled on cmd line */ +int auto_load_plugins; /* enabled by default, can by disabled on cmd line */ #ifdef HAVE_GNUTLS gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */ @@ -444,10 +446,15 @@ wee_parse_args (int argc, char *argv[]) t_irc_server server_tmp; server_cmd_line = 0; + auto_connect = 1; + auto_load_plugins = 1; for (i = 1; i < argc; i++) { - if ((strcmp (argv[i], "-c") == 0) + if ((strcmp (argv[i], "-a") == 0) + || (strcmp (argv[i], "--no-connect") == 0)) + auto_connect = 0; + else if ((strcmp (argv[i], "-c") == 0) || (strcmp (argv[i], "--config") == 0)) { wee_display_config_options (); @@ -484,6 +491,9 @@ wee_parse_args (int argc, char *argv[]) printf ("\n%s%s", WEE_LICENSE); wee_shutdown (EXIT_SUCCESS, 0); } + else if ((strcmp (argv[i], "-p") == 0) + || (strcmp (argv[i], "--no-plugin") == 0)) + auto_load_plugins = 0; else if ((strcmp (argv[i], "-v") == 0) || (strcmp (argv[i], "--version") == 0)) { @@ -886,10 +896,10 @@ main (int argc, char *argv[]) gui_init (); /* init WeeChat interface */ weechat_welcome_message (); /* display WeeChat welcome message */ #ifdef PLUGINS - plugin_init (); /* init plugin interface(s) */ + plugin_init (auto_load_plugins);/* init plugin interface(s) */ #endif /* auto-connect to servers */ - server_auto_connect (server_cmd_line); + server_auto_connect (auto_connect, server_cmd_line); fifo_create (); /* create FIFO pipe for remote control */ gui_main_loop (); /* WeeChat main loop */ diff --git a/src/common/weechat.h b/src/common/weechat.h index 80771d700..0e36a4a28 100644 --- a/src/common/weechat.h +++ b/src/common/weechat.h @@ -89,12 +89,14 @@ " or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]\n\n" #define WEE_USAGE2 \ + " -a, --no-connect disable auto-connect to servers at startup\n" \ " -c, --config display config file options\n" \ " -f, --key-functions display WeeChat internal functions for keys\n" \ " -h, --help this help\n" \ " -i, --irc-commands display IRC commands\n" \ " -k, --keys display WeeChat default keys\n" \ " -l, --license display WeeChat license\n" \ + " -p, --no-plugin don't load any plugin at startup\n" \ " -v, --version display WeeChat version\n" \ " -w, --weechat-commands display WeeChat commands\n\n" diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c index 126043c04..afcac970a 100644 --- a/src/irc/irc-server.c +++ b/src/irc/irc-server.c @@ -1529,7 +1529,7 @@ server_reconnect (t_irc_server *server) */ void -server_auto_connect (int command_line) +server_auto_connect (int auto_connect, int command_line) { t_irc_server *ptr_server; @@ -1537,7 +1537,7 @@ server_auto_connect (int command_line) ptr_server = ptr_server->next_server) { if ( ((command_line) && (ptr_server->command_line)) - || ((!command_line) && (ptr_server->autoconnect)) ) + || ((!command_line) && (auto_connect) && (ptr_server->autoconnect)) ) { (void) gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1); gui_redraw_buffer (gui_current_window->buffer); diff --git a/src/irc/irc.h b/src/irc/irc.h index 2a11cadc8..e2335c4a5 100644 --- a/src/irc/irc.h +++ b/src/irc/irc.h @@ -303,7 +303,7 @@ extern void server_recv (t_irc_server *); extern void server_child_read (t_irc_server *); extern int server_connect (t_irc_server *); extern void server_reconnect (t_irc_server *); -extern void server_auto_connect (int); +extern void server_auto_connect (int, int); extern void server_disconnect (t_irc_server *, int); extern void server_disconnect_all (); extern t_irc_server *server_search (char *); diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c index a7aab152a..06b96b4fb 100644 --- a/src/plugins/plugins.c +++ b/src/plugins/plugins.c @@ -851,7 +851,7 @@ plugin_unload_all () */ void -plugin_init () +plugin_init (int auto_load) { char *list_plugins, *pos, *pos2; @@ -859,7 +859,7 @@ plugin_init () plugin_config_read (); /* auto-load plugins if asked */ - if (cfg_plugins_autoload && cfg_plugins_autoload[0]) + if (auto_load && cfg_plugins_autoload && cfg_plugins_autoload[0]) { if (ascii_strcasecmp (cfg_plugins_autoload, "*") == 0) plugin_auto_load (); diff --git a/src/plugins/plugins.h b/src/plugins/plugins.h index 25bb2f1e1..0adba8914 100644 --- a/src/plugins/plugins.h +++ b/src/plugins/plugins.h @@ -52,7 +52,7 @@ extern void plugin_remove (t_weechat_plugin *); extern void plugin_unload (t_weechat_plugin *); extern void plugin_unload_name (char *); extern void plugin_unload_all (); -extern void plugin_init (); +extern void plugin_init (int); extern void plugin_end (); #endif /* plugins.h */ |