summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@irssi.org>2011-11-21 21:27:58 +0000
committerahf <ahf@dbcabf3a-b0e7-0310-adc4-f8d773084564>2011-11-21 21:27:58 +0000
commit796134ffbd57eb47922bfa44a9823fae404ab522 (patch)
tree4d0d3175941b970e40f7a61e1fe46320885baf7d /src
parent518b822db451a863b9496e985b10b88c50339582 (diff)
downloadirssi-796134ffbd57eb47922bfa44a9823fae404ab522.zip
Add -noautosendcmd to /SERVER and /CONNECT.
Passing this option will force Irssi to not execute the content of the autosendcmd chatnet-setting upon connect. Fixes: #738 git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5209 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/core/chat-commands.c7
-rw-r--r--src/core/chatnets.c5
-rw-r--r--src/core/server-connect-rec.h1
-rw-r--r--src/core/servers-reconnect.c3
-rw-r--r--src/perl/perl-common.c1
5 files changed, 12 insertions, 5 deletions
diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c
index 0f796324..f5d0e9f8 100644
--- a/src/core/chat-commands.c
+++ b/src/core/chat-commands.c
@@ -113,6 +113,9 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
if (g_hash_table_lookup(optlist, "!") != NULL)
conn->no_autojoin_channels = TRUE;
+ if (g_hash_table_lookup(optlist, "noautosendcmd") != NULL)
+ conn->no_autosendcmd = TRUE;
+
if (g_hash_table_lookup(optlist, "noproxy") != NULL)
g_free_and_null(conn->proxy);
@@ -133,6 +136,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
/* SYNTAX: CONNECT [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>]
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
+ [-!] [-noautosendcmd]
[-noproxy] [-network <network>] [-host <hostname>]
[-rawlog <file>]
<address>|<chatnet> [<port> [<password> [<nick>]]] */
@@ -238,6 +242,7 @@ static void sig_default_command_server(const char *data, SERVER_REC *server,
/* SYNTAX: SERVER [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>]
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
+ [-!] [-noautosendcmd]
[-noproxy] [-network <network>] [-host <hostname>]
[-rawlog <file>]
[+]<address>|<chatnet> [<port> [<password> [<nick>]]] */
@@ -453,7 +458,7 @@ void chat_commands_init(void)
signal_add("default command server", (SIGNAL_FUNC) sig_default_command_server);
signal_add("server sendmsg", (SIGNAL_FUNC) sig_server_sendmsg);
- command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey ssl_verify +ssl_cafile +ssl_capath +host noproxy -rawlog");
+ command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey ssl_verify +ssl_cafile +ssl_capath +host noproxy -rawlog noautosendcmd");
command_set_options("msg", "channel nick");
}
diff --git a/src/core/chatnets.c b/src/core/chatnets.c
index c307afda..376fab58 100644
--- a/src/core/chatnets.c
+++ b/src/core/chatnets.c
@@ -118,12 +118,11 @@ static void sig_connected(SERVER_REC *server)
g_return_if_fail(IS_SERVER(server));
- if (server->connrec->chatnet == NULL || server->session_reconnect ||
- server->connrec->no_autojoin_channels)
+ if (server->connrec->chatnet == NULL || server->session_reconnect)
return;
rec = chatnet_find(server->connrec->chatnet);
- if (rec != NULL && rec->autosendcmd)
+ if (!server->connrec->no_autosendcmd && rec != NULL && rec->autosendcmd)
eval_special_string(rec->autosendcmd, "", server, NULL);
}
diff --git a/src/core/server-connect-rec.h b/src/core/server-connect-rec.h
index cfbe3eba..a9588f04 100644
--- a/src/core/server-connect-rec.h
+++ b/src/core/server-connect-rec.h
@@ -34,6 +34,7 @@ GIOChannel *connect_handle; /* connect using this handle */
unsigned int reconnection:1; /* we're trying to reconnect a connected server */
unsigned int reconnecting:1; /* we're trying to reconnect any connection */
unsigned int no_autojoin_channels:1; /* don't autojoin any channels */
+unsigned int no_autosendcmd:1; /* don't execute autosendcmd */
unsigned int unix_socket:1; /* Connect using named unix socket */
unsigned int use_ssl:1; /* this connection uses SSL */
unsigned int ssl_verify:1;
diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c
index c8a72628..15f9f354 100644
--- a/src/core/servers-reconnect.c
+++ b/src/core/servers-reconnect.c
@@ -188,7 +188,8 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info)
dest->channels = g_strdup(src->channels);
dest->away_reason = g_strdup(src->away_reason);
- dest->no_autojoin_channels = src->no_autojoin_channels;
+ dest->no_autojoin_channels = src->no_autojoin_channels;
+ dest->no_autosendcmd = src->no_autosendcmd;
dest->use_ssl = src->use_ssl;
dest->ssl_cert = g_strdup(src->ssl_cert);
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c
index daaa87f6..198da57d 100644
--- a/src/perl/perl-common.c
+++ b/src/perl/perl-common.c
@@ -301,6 +301,7 @@ void perl_connect_fill_hash(HV *hv, SERVER_CONNECT_REC *conn)
hv_store(hv, "reconnection", 12, newSViv(conn->reconnection), 0);
hv_store(hv, "no_autojoin_channels", 20, newSViv(conn->no_autojoin_channels), 0);
+ hv_store(hv, "no_autosendcmd", 14, newSViv(conn->no_autosendcmd), 0);
hv_store(hv, "unix_socket", 11, newSViv(conn->unix_socket), 0);
hv_store(hv, "use_ssl", 7, newSViv(conn->use_ssl), 0);
hv_store(hv, "no_connect", 10, newSViv(conn->no_connect), 0);