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

Added command line arguments to disable auto-connect to servers and plugins auto-load

This commit is contained in:
Sebastien Helleu
2005-10-30 19:22:53 +00:00
parent e5754e1fe6
commit be1c9be925
20 changed files with 736 additions and 584 deletions
+15 -5
View File
@@ -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 */
+2
View File
@@ -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"
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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 *);
+2 -2
View File
@@ -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 ();
+1 -1
View File
@@ -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 */