pre_connect_cmd
Rich Healey <[email protected]> Fri, 14 Nov 2008 13:07:26 +1100
| Newsgroups | gmane.network.irc.irssi.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --------------000203050204010205080609 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I've attached a diff that I find useful, I'm not sure of your opinions of it. There are a few things that still need to be done that I'm not sure how to go about as of yet. a) Setting it up such that a user can add this in the program itself with the /network -pre_connect_cmd . b) Performing the appropriate incantations on the configure script to include this (at the moment it needs -D_PRE_CONNECT_CMD to build in, the impression I got from the irc channel was that at best this was a possible addon. At the moment if a network has a "pre_connect_cmd" directive in the config file, that command is passed back to the shell, before connecting. I personally use this to make sure my nick is released on DALnet before connecting. Thanks Rich Healey - -- Richo - - [email protected] Developer / Systems Admin - OpenPGP: 0x8C8147807 MSN: [email protected] AIM: richohealey33 irc.psych0tik.net -> #hbh #admin ((richohealey)) irc.freenode.org -> #hbh #debian ((PythonNinja)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkkc3V4ACgkQLeTfO4yBSAeM5ACbB82lbVd3WdNwNDsLgV6XdLJf AH4AoNnEoTv9XQVBuLscNXXT+F69KXvR =ZNs9 -----END PGP SIGNATURE----- --------------000203050204010205080609 Content-Type: text/plain; name="irssi.pre_connect_cmd.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="irssi.pre_connect_cmd.diff" Index: src/core/chatnet-rec.h =================================================================== --- src/core/chatnet-rec.h (revision 4906) +++ src/core/chatnet-rec.h (working copy) @@ -9,4 +9,7 @@ char *own_host; /* address to use when connecting this server */ char *autosendcmd; /* command to send after connecting to this ircnet */ +#ifdef _PRE_CONNECT_CMD +char *pre_connect_cmd; /* shell command to be executed before connection */ +#endif IPADDR *own_ip4, *own_ip6; /* resolved own_address if not NULL */ Index: src/core/server-connect-rec.h =================================================================== --- src/core/server-connect-rec.h (revision 4906) +++ src/core/server-connect-rec.h (working copy) @@ -22,6 +22,7 @@ char *nick; char *username; char *realname; +char *pre_connect_cmd; char *ssl_cert; char *ssl_pkey; Index: src/core/chat-commands.c =================================================================== --- src/core/chat-commands.c (revision 4906) +++ src/core/chat-commands.c (working copy) @@ -17,7 +17,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - #include "module.h" #include "network.h" #include "signals.h" @@ -83,7 +82,6 @@ cmd_params_free(free_arg); return NULL; } - if (strchr(addr, '/') != NULL) conn->unix_socket = TRUE; Index: src/core/servers-setup.c =================================================================== --- src/core/servers-setup.c (revision 4906) +++ src/core/servers-setup.c (working copy) @@ -17,7 +17,9 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - +#ifdef _PRE_CONNECT_CMD +#include <stdlib.h> +#endif #include "module.h" #include "signals.h" #include "network.h" @@ -313,6 +315,10 @@ chatrec = chatnet_find(dest); if (chatrec != NULL) { + #ifdef _PRE_CONNECT_CMD + if (chatrec->pre_connect_cmd != NULL) + system(chatrec->pre_connect_cmd); + #endif rec = create_chatnet_conn(chatrec->name, port, password, nick); if (rec != NULL) return rec; Index: src/irc/core/irc-chatnets.c =================================================================== --- src/irc/core/irc-chatnets.c (revision 4906) +++ src/irc/core/irc-chatnets.c (working copy) @@ -17,7 +17,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - #include "module.h" #include "signals.h" #include "lib-config/iconfig.h" @@ -48,6 +47,10 @@ rec->max_msgs = config_node_get_int(node, "max_msgs", 0); rec->max_modes = config_node_get_int(node, "max_modes", 0); rec->max_whois = config_node_get_int(node, "max_whois", 0); + #ifdef _PRE_CONNECT_CMD + rec->pre_connect_cmd = config_node_get_str(node, "pre_connect_cmd", NULL); + #endif + } static void sig_chatnet_saved(IRC_CHATNET_REC *rec, CONFIG_NODE *node) @@ -73,6 +76,10 @@ iconfig_node_set_int(node, "max_modes", rec->max_modes); if (rec->max_whois > 0) iconfig_node_set_int(node, "max_whois", rec->max_whois); + #ifdef _PRE_CONNECT_CMD + if (rec->pre_connect_cmd != NULL) + iconfig_node_set_str(node, "pre_connect_cmd", rec->pre_connect_cmd); + #endif } static void sig_chatnet_destroyed(IRC_CHATNET_REC *rec) --------------000203050204010205080609--