Eggdev: [eggheads-patches] [PATCH] Add a "preinit-server" event

Thomas Sader thommey at gmail.com
Tue Jul 30 18:49:11 CST 2013


Hey grawity,

sorry it took so long to react. I've committed your patch without the tcl
variable. We only keep around the tcl variables for init/connect-server for
legacy reasons.
A possible future extension might be to allow the preinit-server bind to
return 1 to stop eggdrop from sending NICK/USER/PASS on its own for
complete control over the registration from Tcl, but the way it is now
should be enough to implement CAP support.

Thank you for your contribution,
thommey


2013/1/7 Mantas Mikulėnas <grawity at gmail.com>

> On Mon, Jan 07, 2013 at 06:13:40PM +0100, Moritz Wilhelmy wrote:
> > On Sun, Jan 06, 2013 at 02:34:39 +0200, Mantas Mikulėnas wrote:
> > -nothing-
> >
> > FYI, the patch is missing ;-)
>
> AGH. I didn't even notice that I sent an empty message... the patch
> description is missing too. Sorry!
>
> Anyway: This patch adds a "preinit-server" event, which is triggered
> immediately after completing the TCP (or SSL) connection but before
> sending NICK+USER commands. This allows things like IRCv3 SASL
> authentication [1] to be implemented in pure Tcl. (Example
> implementation: [2])
>
> Patch also adds a "preinit-server" Tcl variable for consistency, even
> though it is completely unused here.
>
> [1]: http://ircv3.atheme.org/extensions/sasl-3.1
> [2]: https://gist.github.com/4455067#file-g_cap-tcl
>
> Index: src/mod/server.mod/server.c
> ===================================================================
> RCS file: /usr/local/cvsroot/eggdrop1.8/src/mod/server.mod/server.c,v
> retrieving revision 1.8
> diff -u -r1.8 server.c
> --- a/src/mod/server.mod/server.c       25 Oct 2011 16:47:20 -0000      1.8
> +++ b/src/mod/server.mod/server.c       4 Jan 2013 19:17:14 -0000
> @@ -46,6 +46,8 @@
>  static int flud_time;           /* msg flood time */
>  static int flud_ctcp_thr;       /* ctcp flood threshold */
>  static int flud_ctcp_time;      /* ctcp flood time */
> +static char preinitserver[121]; /* what, if anything, to send to the
> server
> +                                   immediately on connection */
>  static char initserver[121];    /* what, if anything, to send to the
>                                   * server on connection */
>  static char botuserhost[121];   /* bot's user at host (refreshed whenever
> the
> @@ -1356,6 +1358,7 @@
>    {"altnick",             altnick,        NICKMAX,           0},
>    {"realname",            botrealname,    80,                0},
>    {"init-server",         initserver,     120,               0},
> +  {"preinit-server",      preinitserver,  120,               0},
>    {"connect-server",      connectserver,  120,               0},
>    {"stackable-commands",  stackablecmds,  510,               0},
>    {"stackable2-commands", stackable2cmds, 510,               0},
> Index: src/mod/server.mod/servmsg.c
> ===================================================================
> RCS file: /usr/local/cvsroot/eggdrop1.8/src/mod/server.mod/servmsg.c,v
> retrieving revision 1.6
> diff -u -r1.6 servmsg.c
> --- a/src/mod/server.mod/servmsg.c      15 Jun 2012 00:04:59 -0000      1.6
> +++ b/src/mod/server.mod/servmsg.c      4 Jan 2013 19:17:15 -0000
> @@ -1338,6 +1338,9 @@
>    strcpy(botname, origbotname);
>    /* Start alternate nicks from the beginning */
>    altnick_char = 0;
> +  if (preinitserver[0])
> +    do_tcl("preinit-server", preinitserver); /* Call Tcl preinit-server */
> +  check_tcl_event("preinit-server");
>    if (pass[0])
>      dprintf(DP_MODE, "PASS %s\n", pass);
>    dprintf(DP_MODE, "NICK %s\n", botname);
> Index: src/mod/server.mod/help/set/server.help
> ===================================================================
> RCS file:
> /usr/local/cvsroot/eggdrop1.8/src/mod/server.mod/help/set/server.help,v
> retrieving revision 1.4
> diff -u -r1.4 server.help
> --- a/src/mod/server.mod/help/set/server.help   1 Nov 2010 22:38:34 -0000
>       1.4
> +++ b/src/mod/server.mod/help/set/server.help   4 Jan 2013 19:17:15 -0000
> @@ -20,6 +20,12 @@
>     specifies text to send to the server when first connecting
>     there.  this is usually used to set the bot's mode to +i
>     or something equally unimportant.
> +%{help=set preinit-server}%{+n}
> +###  %bset preinit-server%b <raw-irc-text>
> +   specifies text to send to the server as soon as the TCP
> +   connection is established.
> +
> +see also: set init-server
>  %{help=set botnick}%{+n}
>  ###  %bset botnick%b
>     this read-only variable returns the bots current nickname on irc.
> Index: doc/tcl-commands.doc
> ===================================================================
> RCS file: /usr/local/cvsroot/eggdrop1.8/doc/tcl-commands.doc,v
> retrieving revision 1.12
> diff -u -r1.12 tcl-commands.doc
> --- a/doc/tcl-commands.doc      26 Jun 2012 21:20:49 -0000      1.12
> +++ b/doc/tcl-commands.doc      6 Jan 2013 00:30:58 -0000
> @@ -2242,6 +2242,7 @@
>               userfile-loaded - called after userfile has been loaded
>
>               connect-server    - called just before we connect to an IRC
> server
> +             preinit-server    - called immediately when we connect to
> the server
>               init-server       - called when we actually get on our IRC
> server
>               disconnect-server - called when we disconnect from our IRC
> server
>           Module: core
> Index: doc/html/tcl-commands.html
> ===================================================================
> RCS file: /usr/local/cvsroot/eggdrop1.8/doc/html/tcl-commands.html,v
> retrieving revision 1.13
> diff -u -r1.13 tcl-commands.html
> --- a/doc/html/tcl-commands.html        26 Jun 2012 21:20:49 -0000
>  1.13
> +++ b/doc/html/tcl-commands.html        6 Jan 2013 00:31:00 -0000
> @@ -4921,6 +4921,16 @@
>
>                    <tr valign="top">
>                      <td>
> +                      <p><strong>preinit-server</strong></p>
> +                    </td>
> +
> +                    <td>
> +                      <p>called immediately we connect to the IRC
> server</p>
> +                    </td>
> +                  </tr>
> +
> +                  <tr valign="top">
> +                    <td>
>                        <p><strong>init-server</strong></p>
>                      </td>
>
> End.
>
> --
> Mantas Mikulėnas <grawity at gmail.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.eggheads.org/pipermail/eggdev/attachments/20130731/120d7a27/attachment.html>


More information about the Eggdev mailing list