--- /dev/null
+diff -burNp eggdrop1.6.19/configure eggdrop1.6.19.new/configure
+--- eggdrop1.6.19/configure 2008-04-19 06:21:20.000000000 +0200
++++ eggdrop1.6.19.new/configure 2008-09-22 09:29:38.000000000 +0200
+@@ -315,7 +315,8 @@ ac_includes_default="\
+ # include <unistd.h>
+ #endif"
+
+-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS egg_ac_parameters CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB LN_S HEAD_1 STRIP AWK BASENAME UNAME DEFAULT_MAKE MOD_EXT MODULE_XLIBS MOD_LD MOD_CC MOD_STRIP SHLIB_LD SHLIB_CC SHLIB_STRIP EGGEXEC TCLLIB TCLLIBFN TCLINC TCLINCFN TCL_REQS TCL_LIBS EGGVERSION DEST MOD_UPDIR LIBOBJS LTLIBOBJS'
++ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS egg_ac_parameters CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB LN_S HEAD_1 STRIP AWK BASENAME UNAME DEFAULT_MAKE MOD_EXT MODULE_XLIBS MOD_LD MOD_CC MOD_STRIP SHLIB_LD SHLIB_CC SHLIB_STRIP EGGEXEC TCLLIB TCLLIBFN TCLINC TCLINCFN TCL_REQS TCL_LIBS EGGVERSION DESTDIR MOD_UPDIR LIBOBJS LTLIBOBJS'
++
+ ac_subst_files=''
+
+ # Initialize some variables set by options.
+@@ -10129,8 +10130,8 @@ _ACEOF
+
+
+
+- if test "${DEST-x}" = "x"; then
+- DEST=\${prefix}
++ if test "${DESTDIR-x}" = "x"; then
++ DESTDIR=\${prefix}
+ fi
+
+
+@@ -10828,7 +10829,7 @@ s,@TCLINCFN@,$TCLINCFN,;t t
+ s,@TCL_REQS@,$TCL_REQS,;t t
+ s,@TCL_LIBS@,$TCL_LIBS,;t t
+ s,@EGGVERSION@,$EGGVERSION,;t t
+-s,@DEST@,$DEST,;t t
++s,@DESTDIR@,$DESTDIR,;t t
+ s,@MOD_UPDIR@,$MOD_UPDIR,;t t
+ s,@LIBOBJS@,$LIBOBJS,;t t
+ s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+diff -burNp eggdrop1.6.19/doc/html/compiling.html eggdrop1.6.19.new/doc/html/compiling.html
+--- eggdrop1.6.19/doc/html/compiling.html 2008-02-16 22:40:58.000000000 +0100
++++ eggdrop1.6.19.new/doc/html/compiling.html 2008-09-22 09:32:52.000000000 +0200
+@@ -147,7 +147,7 @@
+
+ <blockquote>
+ <pre>
+-make install DEST=<directory>
++make install DESTDIR=<directory>
+ </pre>
+ </blockquote>
+
+@@ -155,7 +155,7 @@ make install DEST=<directory>
+
+ <blockquote>
+ <pre>
+-make install DEST=/home/user/otherdir
++make install DESTDIR=/home/user/otherdir
+ </pre>
+ </blockquote>
+ </ol>
+@@ -255,7 +255,7 @@ sh5 ./configure --with-tclinc='<f
+
+ <blockquote>
+ <pre>
+-gmake install DEST='directory'
++gmake install DESTDIR='directory'
+ </pre>
+ </blockquote>
+
+@@ -263,7 +263,7 @@ gmake install DEST='directory'
+
+ <blockquote>
+ <pre>
+-gmake install DEST=/home/user/otherdir
++gmake install DESTDIR=/home/user/otherdir
+ </pre>
+ </blockquote></li>
+ </ol>
+@@ -389,14 +389,14 @@ tar -zxf eggdrop1.6.19.tar.gz
+
+ <li>Compile the bot using 'make eggdrop'.<br><br></li>
+
+- <li>Install the bot by typing 'make install DEST=<install
++ <li>Install the bot by typing 'make install DESTDIR=<install
+ path>'.<br><br>
+
+ For example:
+
+ <blockquote>
+ <pre>
+-make install DEST='C:/eggdrop/'
++make install DESTDIR='C:/eggdrop/'
+ </pre>
+ </blockquote>
+
+diff -burNp eggdrop1.6.19/doc/html/faqs.html eggdrop1.6.19.new/doc/html/faqs.html
+--- eggdrop1.6.19/doc/html/faqs.html 2008-02-16 22:40:58.000000000 +0100
++++ eggdrop1.6.19.new/doc/html/faqs.html 2008-09-22 09:36:32.000000000 +0200
+@@ -254,7 +254,7 @@
+
+ <li>
+ <p>If it's not your machine, you may have to resort to 'make
+- static' and 'make install DEST="path"' to make
++ static' and 'make install DESTDIR="path"' to make
+ and install your bot.</p>
+ </li>
+
+diff -burNp eggdrop1.6.19/doc/html/install.html eggdrop1.6.19.new/doc/html/install.html
+--- eggdrop1.6.19/doc/html/install.html 2008-02-16 22:40:58.000000000 +0100
++++ eggdrop1.6.19.new/doc/html/install.html 2008-09-22 09:39:15.000000000 +0200
+@@ -100,13 +100,13 @@
+ <p>If you want to install to a different directory, use:</p>
+
+ <blockquote>
+- <p>make install DEST=<directory></p>
++ <p>make install DESTDIR=<directory></p>
+ </blockquote>
+
+ <p>For example:</p>
+
+ <blockquote>
+- <p>make install DEST=/home/user/otherdir</p>
++ <p>make install DESTDIR=/home/user/otherdir</p>
+ </blockquote>
+
+ <p>Note that you must use full path for every file to be correctly
+diff -burNp eggdrop1.6.19/doc/html/readme.html eggdrop1.6.19.new/doc/html/readme.html
+--- eggdrop1.6.19/doc/html/readme.html 2008-02-16 22:40:59.000000000 +0100
++++ eggdrop1.6.19.new/doc/html/readme.html 2008-09-22 09:39:49.000000000 +0200
+@@ -261,7 +261,7 @@
+ <blockquote>
+ <p>If you followed <a href="install.html">Compilation and
+ Installation of Eggdrop</a> and did a 'make install' (or
+- 'make install DEST="path"') after 'make',
++ 'make install DESTDIR="path"') after 'make',
+ this will be pretty easy. Just upload the new eggdrop1.6.x.tar.gz file
+ to your home dir on your shell, gunzip and untar it, and type 'cd
+ ~/eggdrop1.6.x'. Next, type './configure', 'make
+diff -burNp eggdrop1.6.19/doc/html/starting.html eggdrop1.6.19.new/doc/html/starting.html
+--- eggdrop1.6.19/doc/html/starting.html 2008-02-16 22:40:59.000000000 +0100
++++ eggdrop1.6.19.new/doc/html/starting.html 2008-09-22 09:42:21.000000000 +0200
+@@ -97,7 +97,7 @@
+ Eggdrop, you just have to do:</p>
+
+ <blockquote>
+- <p><em>make DEST="directory" install</em></p>
++ <p><em>make DESTDIR="directory" install</em></p>
+ </blockquote>
+
+ <p>and it will copy all the necessary files.</p>
+diff -burNp eggdrop1.6.19/doc/Makefile.in eggdrop1.6.19.new/doc/Makefile.in
+--- eggdrop1.6.19/doc/Makefile.in 2004-08-08 20:17:00.000000000 +0200
++++ eggdrop1.6.19.new/doc/Makefile.in 2008-09-22 09:45:18.000000000 +0200
+@@ -34,39 +34,39 @@ clean:
+ @rm -f *~
+
+ install:
+- @if test ! -d $(DEST)/doc; then \
++ @if test ! -d $(DESTDIR)/doc; then \
+ echo "Creating 'doc' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/doc >/dev/null; \
+ fi
+- @if test ! -d $(DEST)/doc/man1; then \
++ @if test ! -d $(DESTDIR)/doc/man1; then \
+ echo "Creating 'doc/man1' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/man1 >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/doc/man1 >/dev/null; \
+ fi
+- @if test ! -d $(DEST)/doc/html; then \
++ @if test ! -d $(DESTDIR)/doc/html; then \
+ echo "Creating 'doc/html' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/doc/html >/dev/null; \
+ fi
+- @if test ! -d $(DEST)/doc/settings; then \
++ @if test ! -d $(DESTDIR)/doc/settings; then \
+ echo "Creating 'doc/settings' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/settings >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/doc/settings >/dev/null; \
+ fi
+ @echo "Copying docs."
+ @for i in $(DOCS); do \
+- $(INSTALL_DATA) $(srcdir)/$$i $(DEST)/doc/; \
++ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)/doc/; \
+ done
+ @for i in $(MAN1); do \
+- $(INSTALL_DATA) $(srcdir)/$$i $(DEST)/doc/man1/; \
++ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)/doc/man1/; \
+ done
+ @for i in $(SETTING_DOCS); do \
+- $(INSTALL_DATA) $(srcdir)/settings/$$i $(DEST)/doc/settings/; \
++ $(INSTALL_DATA) $(srcdir)/settings/$$i $(DESTDIR)/doc/settings/; \
+ done
+ @if test "x`echo $(SETTING_MOD_DOCS)`" != "x$(SETTING_MOD_DOCS)"; then \
+ for i in `echo $(SETTING_MOD_DOCS)`; do \
+- $(INSTALL_DATA) $$i $(DEST)/doc/settings/; \
++ $(INSTALL_DATA) $$i $(DESTDIR)/doc/settings/; \
+ done; \
+ fi
+ @if test "x`echo $(WEB_DOCS)`" != "x$(WEB_DOCS)"; then \
+ for i in `echo $(WEB_DOCS)`; do \
+- $(INSTALL_DATA) $$i $(DEST)/doc/html/; \
++ $(INSTALL_DATA) $$i $(DESTDIR)/doc/html/; \
+ done; \
+ fi
+diff -burNp eggdrop1.6.19/eggdrop.conf eggdrop1.6.19.new/eggdrop.conf
+--- eggdrop1.6.19/eggdrop.conf 2008-02-16 21:15:30.000000000 +0100
++++ eggdrop1.6.19.new/eggdrop.conf 2008-09-22 09:52:43.000000000 +0200
+@@ -1,4 +1,4 @@
+-#! /path/to/executable/eggdrop
++#! /usr/bin/eggdrop
+ # ^- This should contain a fully qualified path to your Eggdrop executable.
+ #
+ # $Id$
+@@ -185,22 +185,22 @@ set sort-users 0
+
+ # Specify here where Eggdrop should look for help files. Don't modify this
+ # setting unless you know what you're doing!
+-set help-path "help/"
++set help-path "/usr/share/eggdrop/help/"
+
+ # Specify here where Eggdrop should look for text files. This is used for
+ # certain Tcl and DCC commands.
+-set text-path "text/"
++set text-path "/usr/share/eggdrop/"
+
+ # Set here a place to store temporary files.
+ set temp-path "/tmp"
+
+ # The MOTD (Message Of The day) is displayed when people dcc chat or telnet
+ # to the bot. Look at doc/TEXT-SUBSTITUTIONS for options.
+-set motd "text/motd"
++set motd "/usr/share/eggdrop/motd"
+
+ # This banner will be displayed on telnet connections. Look at
+ # doc/TEXT-SUBSTITUTIONS for options.
+-set telnet-banner "text/banner"
++set telnet-banner "/usr/share/eggdrop/banner"
+
+ # This specifies what permissions the user, channel, and notes files should
+ # be set to. The octal values are the same as for the chmod system command.
+@@ -419,7 +419,7 @@ die "Please make sure you edit your conf
+ # If you run the bot from the compilation directory, you will want to set
+ # this to "". If you use 'make install' (like all good kiddies do ;), this
+ # is a fine default. Otherwise, use your head :)
+-set mod-path "modules/"
++set mod-path "/usr/lib/eggdrop/modules/"
+
+
+ #### BLOWFISH MODULE ####
+@@ -1334,19 +1334,19 @@ loadmodule uptime
+ # directory. All scripts should be put there, although you can place them where
+ # you like as long as you can supply a fully qualified path to them.
+ #
+-# source scripts/script.tcl
++# /usr/share/eggdrop/scripts/script.tcl
+
+-source scripts/alltools.tcl
+-source scripts/action.fix.tcl
++source /usr/share/eggdrop/scripts/alltools.tcl
++source /usr/share/eggdrop/scripts/action.fix.tcl
+
+ # Use this script for Tcl and Eggdrop backwards compatibility.
+ # NOTE: This can also cause problems with some newer scripts.
+-#source scripts/compat.tcl
++source /usr/share/eggdrop/scripts/compat.tcl
+
+ # This script provides many useful informational functions, like setting
+ # users' URLs, e-mail address, ICQ numbers, etc. You can modify it to add
+ # extra entries.
+-source scripts/userinfo.tcl
++source /usr/share/eggdrop/scripts/userinfo.tcl
+ loadhelp userinfo.help
+
+ # A few IRC networks (EFnet and Undernet) have added some simple checks to
+diff -burNp eggdrop1.6.19/INSTALL eggdrop1.6.19.new/INSTALL
+--- eggdrop1.6.19/INSTALL 2008-02-16 22:40:54.000000000 +0100
++++ eggdrop1.6.19.new/INSTALL 2008-09-22 09:53:40.000000000 +0200
+@@ -66,11 +66,11 @@ Last revised: July 24, 2004
+
+ If you want to install to a different directory, use:
+
+- make install DEST=<directory>
++ make install DESTDIR=<directory>
+
+ For example:
+
+- make install DEST=/home/user/otherdir
++ make install DESTDIR=/home/user/otherdir
+
+ Note that you must use full path for every file to be correctly
+ installed.
+diff -burNp eggdrop1.6.19/Makefile.in eggdrop1.6.19.new/Makefile.in
+--- eggdrop1.6.19/Makefile.in 2004-08-28 08:43:21.000000000 +0200
++++ eggdrop1.6.19.new/Makefile.in 2008-09-22 09:56:26.000000000 +0200
+@@ -11,7 +11,7 @@ VPATH = @srcdir@
+
+ @SET_MAKE@
+ prefix = @prefix@
+-DEST = @DEST@
++DESTDIR = @DESTDIR@
+ EGGEXEC = @EGGEXEC@
+ EGGVERSION = @EGGVERSION@
+
+@@ -119,7 +119,7 @@ MAKE_DEPEND = $(MAKE) 'MAKE=$(MAKE)' 'CC
+
+ MAKE_CONFIG = $(MAKE) 'MAKE=$(MAKE)'
+
+-MAKE_INSTALL = $(MAKE) 'MAKE=$(MAKE)' 'DEST=$(DEST)'
++MAKE_INSTALL = $(MAKE) 'MAKE=$(MAKE)' 'DESTDIR=$(DESTDIR)'
+
+ all: @DEFAULT_MAKE@
+
+@@ -308,109 +308,109 @@ install-start:
+ echo ""; \
+ exit 1; \
+ fi
+- @if test "x$(DEST)" = "x"; then \
++ @if test "x$(DESTDIR)" = "x"; then \
+ echo "You must specify a destination directory."; \
+ echo "Example:"; \
+ echo ""; \
+- echo " make install DEST=\"/home/wcc/mybot\""; \
++ echo " make install DESTDIR=\"/home/wcc/mybot\""; \
+ echo ""; \
+ exit 1; \
+ fi
+ @echo ""
+ @$(egg_test_run)
+ @echo ""
+- @echo "Installing in directory: '$(DEST)'."
++ @echo "Installing in directory: '$(DESTDIR)'."
+ @echo ""
+- @if test ! -d $(DEST); then \
+- echo "Creating directory '$(DEST)'."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST) >/dev/null; \
++ @if test ! -d $(DESTDIR); then \
++ echo "Creating directory '$(DESTDIR)'."; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR) >/dev/null; \
+ fi
+
+ install-bin:
+- @if test -f $(DEST)/o$(EGGEXEC); then \
+- rm -f $(DEST)/o$(EGGEXEC); \
++ @if test -f $(DESTDIR)/o$(EGGEXEC); then \
++ rm -f $(DESTDIR)/o$(EGGEXEC); \
+ fi
+- @if test -h $(DEST)/$(EGGEXEC); then \
++ @if test -h $(DESTDIR)/$(EGGEXEC); then \
+ echo "Removing symlink to archival eggdrop binary."; \
+- rm -f $(DEST)/$(EGGEXEC); \
++ rm -f $(DESTDIR)/$(EGGEXEC); \
+ fi
+- @if test -f $(DEST)/$(EGGEXEC); then \
++ @if test -f $(DESTDIR)/$(EGGEXEC); then \
+ echo "Renaming old '$(EGGEXEC)' executable to 'o$(EGGEXEC)'."; \
+- mv -f $(DEST)/$(EGGEXEC) $(DEST)/o$(EGGEXEC); \
++ mv -f $(DESTDIR)/$(EGGEXEC) $(DESTDIR)/o$(EGGEXEC); \
+ fi
+ @echo "Copying new '$(EGGEXEC)' executable and creating symlink."
+- @$(INSTALL_PROGRAM) $(EGGEXEC) $(DEST)/$(EGGEXEC)-$(EGGVERSION)
+- @(cd $(DEST) && $(LN_S) $(EGGEXEC)-$(EGGVERSION) $(EGGEXEC))
++ @$(INSTALL_PROGRAM) $(EGGEXEC) $(DESTDIR)/$(EGGEXEC)-$(EGGVERSION)
++ @(cd $(DESTDIR) && $(LN_S) $(EGGEXEC)-$(EGGVERSION) $(EGGEXEC))
+
+ install-modules:
+- @if test -h $(DEST)/modules; then \
++ @if test -h $(DESTDIR)/modules; then \
+ echo "Removing symlink to archival modules subdirectory."; \
+- rm -f $(DEST)/modules; \
++ rm -f $(DESTDIR)/modules; \
+ fi
+- @if test -d $(DEST)/modules; then \
++ @if test -d $(DESTDIR)/modules; then \
+ echo "Moving old modules into 'modules.old' subdirectory."; \
+- rm -rf $(DEST)/modules.old; \
+- mv -f $(DEST)/modules $(DEST)/modules.old; \
++ rm -rf $(DESTDIR)/modules.old; \
++ mv -f $(DESTDIR)/modules $(DESTDIR)/modules.old; \
+ fi
+ @if test ! "x`echo *.$(MOD_EXT)`" = "x*.$(MOD_EXT)"; then \
+- if test ! -d $(DEST)/modules-$(EGGVERSION); then \
++ if test ! -d $(DESTDIR)/modules-$(EGGVERSION); then \
+ echo "Creating 'modules-$(EGGVERSION)' subdirectory and symlink."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/modules-$(EGGVERSION) >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/modules-$(EGGVERSION) >/dev/null; \
+ fi; \
+- (cd $(DEST) && $(LN_S) modules-$(EGGVERSION) modules); \
++ (cd $(DESTDIR) && $(LN_S) modules-$(EGGVERSION) modules); \
+ echo "Copying new modules."; \
+ for i in *.$(MOD_EXT); do \
+- $(INSTALL_PROGRAM) $$i $(DEST)/modules-$(EGGVERSION)/; \
++ $(INSTALL_PROGRAM) $$i $(DESTDIR)/modules-$(EGGVERSION)/; \
+ done; \
+ fi
+
+ install-data:
+- @if test ! -f $(DEST)/eggdrop.conf; then \
+- $(INSTALL_DATA) $(srcdir)/eggdrop.conf $(DEST)/; \
++ @if test ! -f $(DESTDIR)/eggdrop.conf; then \
++ $(INSTALL_DATA) $(srcdir)/eggdrop.conf $(DESTDIR)/; \
+ fi
+- @if test ! -d $(DEST)/logs; then \
++ @if test ! -d $(DESTDIR)/logs; then \
+ echo "Creating 'logs' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/logs >/dev/null; \
+- $(INSTALL_DATA) $(srcdir)/logs/CONTENTS $(DEST)/logs/; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/logs >/dev/null; \
++ $(INSTALL_DATA) $(srcdir)/logs/CONTENTS $(DESTDIR)/logs/; \
+ fi;
+- @if test ! -d $(DEST)/text; then \
++ @if test ! -d $(DESTDIR)/text; then \
+ echo "Creating 'text' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/text >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/text >/dev/null; \
+ fi;
+- @if test ! -f $(DEST)/text/motd; then \
+- $(INSTALL_DATA) $(srcdir)/text/motd $(DEST)/text/; \
++ @if test ! -f $(DESTDIR)/text/motd; then \
++ $(INSTALL_DATA) $(srcdir)/text/motd $(DESTDIR)/text/; \
+ fi
+- @if test ! -f $(DEST)/text/banner; then \
+- $(INSTALL_DATA) $(srcdir)/text/banner $(DEST)/text/; \
++ @if test ! -f $(DESTDIR)/text/banner; then \
++ $(INSTALL_DATA) $(srcdir)/text/banner $(DESTDIR)/text/; \
+ fi
+
+ install-help:
+ @echo "Copying help files."
+ @if test ! "x`echo $(srcdir)/help/*.help`" = "x$(srcdir)/help/*.help"; then \
+- if test ! -d $(DEST)/help; then \
++ if test ! -d $(DESTDIR)/help; then \
+ echo "Creating 'help' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/help >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/help >/dev/null; \
+ fi; \
+ for i in $(srcdir)/help/*.help; do \
+- $(INSTALL_DATA) $$i $(DEST)/help/; \
++ $(INSTALL_DATA) $$i $(DESTDIR)/help/; \
+ done; \
+ fi
+ @if test ! "x`echo $(srcdir)/help/msg/*.help`" = "x$(srcdir)/help/msg/*.help"; then \
+- if test ! -d $(DEST)/help/msg; then \
++ if test ! -d $(DESTDIR)/help/msg; then \
+ echo "Creating 'help/msg' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/help/msg >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/help/msg >/dev/null; \
+ fi; \
+ for i in $(srcdir)/help/msg/*.help; do \
+- $(INSTALL_DATA) $$i $(DEST)/help/msg/; \
++ $(INSTALL_DATA) $$i $(DESTDIR)/help/msg/; \
+ done; \
+ fi
+ @if test ! "x`echo $(srcdir)/help/set/*.help`" = "x$(srcdir)/help/set/*.help"; then \
+- if test ! -d $(DEST)/help/set; then \
++ if test ! -d $(DESTDIR)/help/set; then \
+ echo "Creating 'help/set' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/help/set >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/help/set >/dev/null; \
+ fi; \
+ for i in $(srcdir)/help/set/*.help; do \
+- $(INSTALL_DATA) $$i $(DEST)/help/set/; \
++ $(INSTALL_DATA) $$i $(DESTDIR)/help/set/; \
+ done; \
+ fi
+ @cd src/mod/ && $(MAKE_INSTALL) install-help
+@@ -418,25 +418,25 @@ install-help:
+ install-language:
+ @echo "Copying language files."
+ @if test ! "x`echo $(srcdir)/language/*.lang`" = "x$(srcdir)/language/*.lang"; then \
+- if test ! -d $(DEST)/language; then \
++ if test ! -d $(DESTDIR)/language; then \
+ echo "Creating 'language' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/language >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/language >/dev/null; \
+ fi; \
+ for i in $(srcdir)/language/*.lang; do \
+- $(INSTALL_DATA) $$i $(DEST)/language/; \
++ $(INSTALL_DATA) $$i $(DESTDIR)/language/; \
+ done; \
+ fi
+ @cd src/mod && $(MAKE_INSTALL) install-language
+
+ install-filesys:
+- @if test ! -d $(DEST)/filesys; then \
++ @if test ! -d $(DESTDIR)/filesys; then \
+ echo "Creating skeletal filesystem subdirectories."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/filesys >/dev/null; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/filesys/incoming >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/filesys >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/filesys/incoming >/dev/null; \
+ fi
+
+ install-doc:
+- @$(INSTALL_DATA) $(srcdir)/README $(DEST)
++ @$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)
+ @cd doc/ && $(MAKE_INSTALL) install
+
+ install-scripts:
+@@ -449,7 +449,7 @@ install-end:
+ @echo "You MUST ensure that you edit/verify your configuration file."
+ @echo "An example configuration file, eggdrop.conf, is distributed with Eggdrop."
+ @echo ""
+- @echo "Remember to change directory to $(DEST) before you proceed."
++ @echo "Remember to change directory to $(DESTDIR) before you proceed."
+ @echo ""
+
+ #safety hash
+diff -burNp eggdrop1.6.19/scripts/Makefile.in eggdrop1.6.19.new/scripts/Makefile.in
+--- eggdrop1.6.19/scripts/Makefile.in 2008-02-16 07:00:17.000000000 +0100
++++ eggdrop1.6.19.new/scripts/Makefile.in 2008-09-22 09:58:28.000000000 +0200
+@@ -32,44 +32,44 @@ clean:
+ @rm -f *~
+
+ install:
+- @if test ! -d $(DEST)/scripts; then \
++ @if test ! -d $(DESTDIR)/scripts; then \
+ echo "Creating 'scripts' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/scripts >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/scripts >/dev/null; \
+ echo "Copying scripts."; \
+ for i in $(DOCS); do \
+- $(INSTALL_DATA) $(srcdir)/$$i $(DEST)/scripts/; \
++ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)/scripts/; \
+ done; \
+ for i in $(SCRIPTS); do \
+- $(INSTALL_DATA) $(srcdir)/$$i $(DEST)/scripts/; \
++ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)/scripts/; \
+ done; \
+ for i in $(EXESCRIPTS); do \
+- $(INSTALL_SCRIPT) $(srcdir)/$$i $(DEST)/scripts/; \
++ $(INSTALL_SCRIPT) $(srcdir)/$$i $(DESTDIR)/scripts/; \
+ done; \
+ if test ! "x`echo $(srcdir)/help/*.help`" = "x$(srcdir)/help/*.help"; then \
+- if test ! -d $(DEST)/help; then \
++ if test ! -d $(DESTDIR)/help; then \
+ echo "Creating 'help' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/help >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/help >/dev/null; \
+ fi; \
+ for i in $(srcdir)/help/*.help; do \
+- $(INSTALL_DATA) $$i $(DEST)/help/; \
++ $(INSTALL_DATA) $$i $(DESTDIR)/help/; \
+ done; \
+ fi; \
+ if test ! "x`echo $(srcdir)/help/msg/*.help`" = "x$(srcdir)/help/msg/*.help"; then \
+- if test ! -d $(DEST)/help/msg; then \
++ if test ! -d $(DESTDIR)/help/msg; then \
+ echo "Creating 'help/msg' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/help/msg >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/help/msg >/dev/null; \
+ fi; \
+ for i in $(srcdir)/help/msg/*.help; do \
+- $(INSTALL_DATA) $$i $(DEST)/help/msg/; \
++ $(INSTALL_DATA) $$i $(DESTDIR)/help/msg/; \
+ done; \
+ fi; \
+ if test ! "x`echo $(srcdir)/help/set/*.help`" = "x$(srcdir)/help/set/*.help"; then \
+- if test ! -d $(DEST)/help/set; then \
++ if test ! -d $(DESTDIR)/help/set; then \
+ echo "Creating 'help/set' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/help/set >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/help/set >/dev/null; \
+ fi; \
+ for i in $(srcdir)/help/set/*.help; do \
+- $(INSTALL_DATA) $$i $(DEST)/help/set/; \
++ $(INSTALL_DATA) $$i $(DESTDIR)/help/set/; \
+ done; \
+ fi; \
+ fi
+diff -burNp eggdrop1.6.19/src/eggdrop.h eggdrop1.6.19.new/src/eggdrop.h
+--- eggdrop1.6.19/src/eggdrop.h 2008-02-16 22:41:03.000000000 +0100
++++ eggdrop1.6.19.new/src/eggdrop.h 2008-09-22 10:00:48.000000000 +0200
+@@ -75,7 +75,7 @@
+
+
+ /* Language stuff */
+-#define LANGDIR "./language" /* language file directory */
++#define LANGDIR "/usr/share/eggdrop/language" /* language file directory */
+ #define BASELANG "english" /* language which always gets loaded before
+ all other languages. You do not want to
+ change this. */
+diff -burNp eggdrop1.6.19/src/mod/Makefile.in eggdrop1.6.19.new/src/mod/Makefile.in
+--- eggdrop1.6.19/src/mod/Makefile.in 2004-08-28 08:43:22.000000000 +0200
++++ eggdrop1.6.19.new/src/mod/Makefile.in 2008-09-22 10:02:45.000000000 +0200
+@@ -123,50 +123,50 @@ install: install-help install-language
+
+ install-help:
+ @echo "Copying module help files."
+- @if test ! -d $(DEST)/help; then \
++ @if test ! -d $(DESTDIR)/help; then \
+ echo "Creating 'help' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/help >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/help >/dev/null; \
+ fi; \
+ for i in $(mods); do \
+ if test ! "x`echo $(srcdir)/$$i/help/*.help`" = "x$(srcdir)/$$i/help/*.help"; then \
+ for h in $(srcdir)/$$i/help/*.help; do \
+- $(INSTALL_DATA) $$h $(DEST)/help/; \
++ $(INSTALL_DATA) $$h $(DESTDIR)/help/; \
+ done; \
+ fi; \
+ done;
+- @if test ! -d $(DEST)/help/msg; then \
++ @if test ! -d $(DESTDIR)/help/msg; then \
+ echo "Creating 'help/msg' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/help/msg >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/help/msg >/dev/null; \
+ fi; \
+ for i in $(mods); do \
+ if test ! "x`echo $(srcdir)/$$i/help/msg/*.help`" = "x$(srcdir)/$$i/help/msg/*.help"; then \
+ for h in $(srcdir)/$$i/help/msg/*.help; do \
+- $(INSTALL_DATA) $$h $(DEST)/help/msg/; \
++ $(INSTALL_DATA) $$h $(DESTDIR)/help/msg/; \
+ done; \
+ fi; \
+ done;
+- @if test ! -d $(DEST)/help/set; then \
++ @if test ! -d $(DESTDIR)/help/set; then \
+ echo "Creating 'help/set' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/help/set >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/help/set >/dev/null; \
+ fi; \
+ for i in $(mods); do \
+ if test ! "x`echo $(srcdir)/$$i/help/set/*.help`" = "x$(srcdir)/$$i/help/set/*.help"; then \
+ for h in $(srcdir)/$$i/help/set/*.help; do \
+- $(INSTALL_DATA) $$h $(DEST)/help/set/; \
++ $(INSTALL_DATA) $$h $(DESTDIR)/help/set/; \
+ done; \
+ fi; \
+ done;
+
+ install-language:
+ @echo "Copying module language files."
+- @if test ! -d $(DEST)/language; then \
++ @if test ! -d $(DESTDIR)/language; then \
+ echo "Creating 'language' subdirectory."; \
+- $(top_srcdir)/misc/mkinstalldirs $(DEST)/language >/dev/null; \
++ $(top_srcdir)/misc/mkinstalldirs $(DESTDIR)/language >/dev/null; \
+ fi; \
+ for i in $(mods); do \
+ if test ! "x`echo $(srcdir)/$$i/language/*.lang`" = "x$(srcdir)/$$i/language/*.lang"; then \
+ for h in $(srcdir)/$$i/language/*.lang; do \
+- $(INSTALL_DATA) $$h $(DEST)/language/; \
++ $(INSTALL_DATA) $$h $(DESTDIR)/language/; \
+ done; \
+ fi; \
+ done;
--- /dev/null
+diff -burNp eggdrop1.6.19/scripts/autobotchk eggdrop1.6.19.new/scripts/autobotchk
+--- eggdrop1.6.19/scripts/autobotchk 2003-04-15 19:41:57.000000000 +0200
++++ eggdrop1.6.19.new/scripts/autobotchk 2008-09-22 12:38:36.447797899 +0200
+@@ -99,7 +99,7 @@ set delay 10
+ set email 1
+
+ # If you renamed your eggdrop binary, you should change this variable
+-set binary "eggdrop"
++set binary "/usr/bin/eggdrop"
+
+ while {[set opt [newsplit argv]] != ""} {
+ switch -- $opt {
+@@ -143,16 +143,6 @@ if {[string match "*/scripts" $dir]} {
+
+ set dir [string trimright $dir /]
+
+-if {![file exists $dir/help] || ![file isdirectory $dir/help]} {
+- puts "*** ERROR: are you sure you are running from a bot directory?"
+- puts ""
+- exit
+-} elseif {![file exists $dir/$binary]} {
+- puts "*** ERROR: are you sure you are running from a bot directory?"
+- puts ""
+- exit
+-}
+-
+ puts -nonewline "Opening '$config' for processing ... "
+
+ if {[catch {open $dir/$config r} fd]} {
--- /dev/null
+diff -burNp eggdrop1.6.19/src/tcl.c eggdrop1.6.19-new/src/tcl.c
+--- eggdrop1.6.19/src/tcl.c 2008-02-16 22:41:04.000000000 +0100
++++ eggdrop1.6.19-new/src/tcl.c 2008-09-22 16:45:55.460597054 +0200
+@@ -282,7 +282,7 @@ static char *tcl_eggstr(ClientData cdata
+ if (!obj)
+ return NULL;
+ len = 0;
+- bytes = Tcl_GetByteArrayFromObj(obj, &len);
++ bytes = Tcl_GetStringFromObj(obj, &len);
+ if (!bytes)
+ return NULL;
+ s = malloc(len + 1);
+@@ -339,7 +339,7 @@ static int utf_converter(ClientData cdat
+ utftot += sizeof(char *) * objc;
+ objc -= 5;
+ for (i = 0; i < objc; i++) {
+- byteptr = (char *) Tcl_GetByteArrayFromObj(objv[i], &len);
++ byteptr = (char *) Tcl_GetStringFromObj(objv[i], &len);
+ strings[i] = (char *) nmalloc(len + 1);
+ utftot += len + 1;
+ strncpy(strings[i], byteptr, len);
--- /dev/null
+From http://www.egghelp.org/files/patches/nohostwhowhom1.6.17.desc:
+
+"With this patch, eggdrop won't send hosts upon joining the botnet or
+ on a remote who."
+
+Patch created by BarkerJr <http://barkerjr.net/irc/eggdrop/>
+
+diff -ur eggdrop1.6.17/src/botcmd.c eggdrop1.6.17.new/src/botcmd.c
+--- eggdrop1.6.17/src/botcmd.c 2004-09-06 15:35:37.000000000 -0400
++++ eggdrop1.6.17.new/src/botcmd.c 2004-09-06 15:44:57.000000000 -0400
+@@ -357,8 +357,8 @@
+ for (i = 0; i < dcc_total; i++)
+ if (dcc[i].type->flags & DCT_REMOTEWHO)
+ if (dcc[i].u.chat->channel == chan) {
+- k = sprintf(s, " %c%-15s %s", (geticon(i) == '-' ? ' ' : geticon(i)),
+- dcc[i].nick, dcc[i].host);
++ k = sprintf(s, " %c%-15s hidden",
++ (geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick);
+ if (now - dcc[i].timeval > 300) {
+ unsigned long days, hrs, mins;
+
+@@ -397,8 +397,8 @@
+ ok = 1;
+ botnet_send_priv(idx, botnetnick, nick, NULL, "%s:", BOT_OTHERPEOPLE);
+ }
+- l = sprintf(s, " %c%-15s %s", (geticon(i) == '-' ? ' ' : geticon(i)),
+- dcc[i].nick, dcc[i].host);
++ l = sprintf(s, " %c%-15s hidden",
++ (geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick);
+ if (now - dcc[i].timeval > 300) {
+ k = (now - dcc[i].timeval) / 60;
+ if (k < 60)
+diff -ur eggdrop1.6.17/src/botmsg.c eggdrop1.6.17.new/src/botmsg.c
+--- eggdrop1.6.17/src/botmsg.c 2004-09-06 15:35:37.000000000 -0400
++++ eggdrop1.6.17.new/src/botmsg.c 2004-09-06 15:35:57.000000000 -0400
+@@ -611,15 +611,15 @@
+ int l;
+
+ if (tands > 0) {
+- l = simple_sprintf(OBUF, "j %s %s %D %c%D %s\n",
++ l = simple_sprintf(OBUF, "j %s %s %D %c%D hidden\n",
+ botnetnick, dcc[useridx].nick,
+ dcc[useridx].u.chat->channel, geticon(useridx),
+- dcc[useridx].sock, dcc[useridx].host);
++ dcc[useridx].sock);
+ send_tand_but(-1, OBUF, -l);
+ #ifndef NO_OLD_BOTNET
+- tandout_but(-1, "join %s %s %d %c%d %s\n", botnetnick,
++ tandout_but(-1, "join %s %s %d %c%d hidden\n", botnetnick,
+ dcc[useridx].nick, dcc[useridx].u.chat->channel,
+- geticon(useridx), dcc[useridx].sock, dcc[useridx].host);
++ geticon(useridx), dcc[useridx].sock);
+ tandout_but(-1, "chan %s %d %s %s %s.\n",
+ botnetnick, dcc[useridx].u.chat->channel,
+ dcc[useridx].nick, NET_JOINEDTHE,
+diff -ur eggdrop1.6.17/src/botnet.c eggdrop1.6.17.new/src/botnet.c
+--- eggdrop1.6.17/src/botnet.c 2004-09-06 15:35:37.000000000 -0400
++++ eggdrop1.6.17.new/src/botnet.c 2004-09-06 15:35:57.000000000 -0400
+@@ -752,16 +752,16 @@
+ (dcc[i].u.chat->channel < GLOBAL_CHANS)) {
+ #ifndef NO_OLD_BOTNET
+ if (b_numver(z) < NEAT_BOTNET)
+- l = simple_sprintf(x, "join %s %s %d %c%d %s\n",
++ l = simple_sprintf(x, "join %s %s %d %c%d hidden\n",
+ botnetnick, dcc[i].nick,
+ dcc[i].u.chat->channel, geticon(i),
+- dcc[i].sock, dcc[i].host);
++ dcc[i].sock);
+ else
+ #endif
+- l = simple_sprintf(x, "j !%s %s %D %c%D %s\n",
++ l = simple_sprintf(x, "j !%s %s %D %c%D hidden\n",
+ botnetnick, dcc[i].nick,
+ dcc[i].u.chat->channel, geticon(i),
+- dcc[i].sock, dcc[i].host);
++ dcc[i].sock);
+ tputs(dcc[z].sock, x, l);
+ #ifndef NO_OLD_BOTNET
+ if (b_numver(z) < NEAT_BOTNET) {
+diff -ur eggdrop1.6.17/src/patch.h eggdrop1.6.17.new/src/patch.h
+--- eggdrop1.6.17/src/patch.h 2004-09-06 15:35:37.000000000 -0400
++++ eggdrop1.6.17.new/src/patch.h 2004-09-06 15:36:26.000000000 -0400
+@@ -36,7 +36,7 @@
+ *
+ *
+ */
+-/* PATCH GOES HERE */
++patch("nohostwhowhom");
+ /*
+ *
+ *
--- /dev/null
+diff -burN eggdrop1.6.17.orig/aclocal.m4 eggdrop1.6.17/aclocal.m4
+--- eggdrop1.6.17.orig/aclocal.m4 2004-10-18 00:15:56.783956064 +0200
++++ eggdrop1.6.17/aclocal.m4 2004-10-18 00:38:40.107699352 +0200
+@@ -757,9 +757,9 @@
+ if test "$IRIX" = "yes"; then
+ AC_MSG_WARN([Skipping library tests because they CONFUSE IRIX.])
+ else
+- AC_CHECK_LIB(socket, socket)
+- AC_CHECK_LIB(nsl, connect)
+- AC_CHECK_LIB(dns, gethostbyname)
++ AC_SEARCH_LIBS(socket, socket)
++ AC_SEARCH_LIBS(connect, nsl)
++ AC_SEARCH_LIBS(gethostbyname, [resolv bind dns])
+ AC_CHECK_LIB(dl, dlopen)
+ AC_CHECK_LIB(m, tan, EGG_MATH_LIB="-lm")
+
--- /dev/null
+diff -burNp eggdrop1.6.19/aclocal.m4 eggdrop1.6.19.new/aclocal.m4
+--- eggdrop1.6.19/aclocal.m4 2008-04-19 06:21:20.000000000 +0200
++++ eggdrop1.6.19.new/aclocal.m4 2008-09-22 14:03:38.304371902 +0200
+@@ -36,6 +36,63 @@ AC_DEFUN([EGG_MSG_CONFIGURE_START],
+ AC_MSG_RESULT
+ ])
+
++dnl EGG_SSL_CRAP()
++dnl
++AC_DEFUN(EGG_SSL_CRAP, [dnl
++#ssl checks - hoe
++AC_MSG_CHECKING(whether to include SSL support)
++AC_ARG_WITH(ssl,
++[ --with-ssl[=PATH] Include SSL support (DIR is OpenSSL's install dir).],
++[
++ case "$withval" in
++ no)
++ AC_MSG_RESULT(no) ;;
++ yes)
++ AC_MSG_RESULT(yes)
++ AC_CHECK_LIB(ssl,SSL_accept,[AC_DEFINE(EGG_SSL_EXT)
++ SSL_LIBS="-lssl -lcrypto"],[AC_MSG_ERROR([You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL])],-lcrypto)
++ ;;
++ *)
++dnl A whole whack of possible places where this might be
++ test -f $withval/openssl/ssl.h && SSL_INCLUDE="$withval"
++ test -f $withval/include/openssl/ssl.h && SSL_INCLUDE="$withval/include"
++
++ test -f $withval/lib/libssl.a && SSL_LIB="$withval/lib"
++ test -f $withval/lib/ssl/libssl.a && SSL_LIB="$withval/lib/ssl"
++ test -f $withval/lib/openssl/libssl.a && SSL_LIB="$withval/lib/openssl/ssl"
++ test -f $withval/libssl.a && SSL_LIB="$withval"
++ test -f $withval/ssl/libssl.a && SSL_LIB="$withval/ssl"
++ test -f $withval/openssl/libssl.a && SSL_LIB="$withval/openssl"
++
++ test -f $withval/lib/libcrypto.a && CRYPTO_LIB="$withval/lib"
++ test -f $withval/lib/ssl/libcrypto.a && CRYPTO_LIB="$withval/lib/ssl"
++ test -f $withval/lib/openssl/libcrypto.a && CRYPTO_LIB="$withval/lib/openssl/ssl"
++ test -f $withval/libcrypto.a && CRYPTO_LIB="$withval"
++ test -f $withval/ssl/libcrypto.a && CRYPTO_LIB="$withval/ssl"
++ test -f $withval/openssl/libcrypto.a && CRYPTO_LIB="$withval/openssl"
++
++ if test -n "$SSL_INCLUDE" && test -n "$SSL_LIB" && test -n "$CRYPTO_LIB"; then
++ SSL_LIBS="-lssl -lcrypto -L$SSL_LIB -L$CRYPTO_LIB";
++ AC_DEFINE([EGG_SSL_EXT], [], [SSL support])
++ AC_MSG_RESULT(yes)
++ else
++ AC_MSG_RESULT(no)
++ AC_MSG_ERROR([You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL])
++ fi ;;
++ esac
++],[
++ AC_MSG_RESULT(will try to find)
++ AC_CHECK_LIB(ssl,SSL_accept,[AC_DEFINE(EGG_SSL_EXT)
++ SSL_LIBS="-lssl -lcrypto"],[AC_MSG_ERROR([OpenSSL was not found. Please supply a pathname to OpenSSL])],-lcrypto)
++ AC_CHECK_HEADERS("openssl/ssl.h",,[AC_MSG_ERROR([OpenSSL was not found. Please supply a pathname to OpenSSL])],)
++
++ AC_SUBST(SSL_LIBS)dnl
++ AC_SUBST(SSL_INCLUDE)dnl
++])
++
++#end of ssl checks - hoe (.16 by poci)
++])dnl
++
+
+ dnl EGG_MSG_CONFIGURE_END()
+ dnl
+diff -burNp eggdrop1.6.19/config.h.in eggdrop1.6.19.new/config.h.in
+--- eggdrop1.6.19/config.h.in 2006-11-20 12:38:25.000000000 +0100
++++ eggdrop1.6.19.new/config.h.in 2008-09-22 14:07:26.990831137 +0200
+@@ -33,6 +33,9 @@
+ /* Define to 1 if you have the `clock' function. */
+ #undef HAVE_CLOCK
+
++/* Defines ssl mode */
++#undef EGG_SSL_EXT
++
+ /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+ #undef HAVE_DIRENT_H
+diff -burNp eggdrop1.6.19/configure eggdrop1.6.19.new/configure
+--- eggdrop1.6.19/configure 2008-04-19 06:21:20.000000000 +0200
++++ eggdrop1.6.19.new/configure 2008-09-22 14:22:28.610498567 +0200
+@@ -856,6 +857,7 @@ Optional Packages:
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-tcllib=PATH full path to Tcl library
+ --with-tclinc=PATH full path to Tcl header
++ --with-ssl=PATH Include SSL support (DIR is OpenSSL's install dir).
+
+ Some influential environment variables:
+ CC C compiler command
+@@ -10113,8 +10115,372 @@ EOF
+
+ ac_config_commands="$ac_config_commands replace-if-changed"
+
++#ssl checks - hoe
++echo "$as_me:$LINENO: checking whether to include SSL support" >&5
++echo $ECHO_N "checking whether to include SSL support... $ECHO_C" >&6
++
++# Check whether --with-ssl or --without-ssl was given.
++if test "${with_ssl+set}" = set; then
++ withval="$with_ssl"
++
++ case "$withval" in
++ no)
++ echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6 ;;
++ yes)
++ echo "$as_me:$LINENO: result: yes" >&5
++echo "${ECHO_T}yes" >&6
++ echo "$as_me:$LINENO: checking for SSL_accept in -lssl" >&5
++echo $ECHO_N "checking for SSL_accept in -lssl... $ECHO_C" >&6
++if test "${ac_cv_lib_ssl_SSL_accept+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ ac_check_lib_save_LIBS=$LIBS
++LIBS="-lssl -lcrypto $LIBS"
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++
++/* Override any gcc2 internal prototype to avoid an error. */
++#ifdef __cplusplus
++extern "C"
++#endif
++/* We use char because int might match the return type of a gcc2
++ builtin and then its argument prototype would still apply. */
++char SSL_accept ();
++int
++main ()
++{
++SSL_accept ();
++ ;
++ return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext conftest$ac_exeext
++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
++ (eval $ac_link) 2>conftest.er1
++ ac_status=$?
++ grep -v '^ *+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } &&
++ { ac_try='test -z "$ac_c_werror_flag"
++ || test ! -s conftest.err'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; } &&
++ { ac_try='test -s conftest$ac_exeext'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }; then
++ ac_cv_lib_ssl_SSL_accept=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ac_cv_lib_ssl_SSL_accept=no
++fi
++rm -f conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_accept" >&5
++echo "${ECHO_T}$ac_cv_lib_ssl_SSL_accept" >&6
++if test $ac_cv_lib_ssl_SSL_accept = yes; then
++ cat >>confdefs.h <<\_ACEOF
++#define EGG_SSL_EXT 1
++_ACEOF
++
++ SSL_LIBS="-lssl -lcrypto"
++else
++ { { echo "$as_me:$LINENO: error: You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL" >&5
++echo "$as_me: error: You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL" >&2;}
++ { (exit 1); exit 1; }; }
++fi
++
++ ;;
++ *)
++ test -f $withval/openssl/ssl.h && SSL_INCLUDE="$withval"
++ test -f $withval/include/openssl/ssl.h && SSL_INCLUDE="$withval/include"
++
++ test -f $withval/lib/libssl.a && SSL_LIB="$withval/lib"
++ test -f $withval/lib/ssl/libssl.a && SSL_LIB="$withval/lib/ssl"
++ test -f $withval/lib/openssl/libssl.a && SSL_LIB="$withval/lib/openssl/ssl"
++ test -f $withval/libssl.a && SSL_LIB="$withval"
++ test -f $withval/ssl/libssl.a && SSL_LIB="$withval/ssl"
++ test -f $withval/openssl/libssl.a && SSL_LIB="$withval/openssl"
++
++ test -f $withval/lib/libcrypto.a && CRYPTO_LIB="$withval/lib"
++ test -f $withval/lib/ssl/libcrypto.a && CRYPTO_LIB="$withval/lib/ssl"
++ test -f $withval/lib/openssl/libcrypto.a && CRYPTO_LIB="$withval/lib/openssl/ssl"
++ test -f $withval/libcrypto.a && CRYPTO_LIB="$withval"
++ test -f $withval/ssl/libcrypto.a && CRYPTO_LIB="$withval/ssl"
++ test -f $withval/openssl/libcrypto.a && CRYPTO_LIB="$withval/openssl"
++
++ if test -n "$SSL_INCLUDE" && test -n "$SSL_LIB" && test -n "$CRYPTO_LIB"; then
++ SSL_LIBS="-lssl -lcrypto -L$SSL_LIB -L$CRYPTO_LIB";
++ cat >>confdefs.h <<\_ACEOF
++#define EGG_SSL_EXT 1
++_ACEOF
++
++ echo "$as_me:$LINENO: result: yes" >&5
++echo "${ECHO_T}yes" >&6
++ else
++ echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
++ { { echo "$as_me:$LINENO: error: You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL" >&5
++echo "$as_me: error: You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL" >&2;}
++ { (exit 1); exit 1; }; }
++ fi ;;
++ esac
++
++else
++
++ echo "$as_me:$LINENO: result: will try to find" >&5
++echo "${ECHO_T}will try to find" >&6
++ echo "$as_me:$LINENO: checking for SSL_accept in -lssl" >&5
++echo $ECHO_N "checking for SSL_accept in -lssl... $ECHO_C" >&6
++if test "${ac_cv_lib_ssl_SSL_accept+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ ac_check_lib_save_LIBS=$LIBS
++LIBS="-lssl -lcrypto $LIBS"
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++
++/* Override any gcc2 internal prototype to avoid an error. */
++#ifdef __cplusplus
++extern "C"
++#endif
++/* We use char because int might match the return type of a gcc2
++ builtin and then its argument prototype would still apply. */
++char SSL_accept ();
++int
++main ()
++{
++SSL_accept ();
++ ;
++ return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext conftest$ac_exeext
++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
++ (eval $ac_link) 2>conftest.er1
++ ac_status=$?
++ grep -v '^ *+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } &&
++ { ac_try='test -z "$ac_c_werror_flag"
++ || test ! -s conftest.err'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; } &&
++ { ac_try='test -s conftest$ac_exeext'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }; then
++ ac_cv_lib_ssl_SSL_accept=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ac_cv_lib_ssl_SSL_accept=no
++fi
++rm -f conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_accept" >&5
++echo "${ECHO_T}$ac_cv_lib_ssl_SSL_accept" >&6
++if test $ac_cv_lib_ssl_SSL_accept = yes; then
++ cat >>confdefs.h <<\_ACEOF
++#define EGG_SSL_EXT 1
++_ACEOF
++
++ SSL_LIBS="-lssl -lcrypto"
++else
++ { { echo "$as_me:$LINENO: error: OpenSSL was not found. Please supply a pathname to OpenSSL" >&5
++echo "$as_me: error: OpenSSL was not found. Please supply a pathname to OpenSSL" >&2;}
++ { (exit 1); exit 1; }; }
++fi
++
++
++for ac_header in "openssl/ssl.h"
++do
++as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
++if eval "test \"\${$as_ac_Header+set}\" = set"; then
++ echo "$as_me:$LINENO: checking for $ac_header" >&5
++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
++if eval "test \"\${$as_ac_Header+set}\" = set"; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++fi
++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
++else
++ # Is the header compilable?
++echo "$as_me:$LINENO: checking $ac_header usability" >&5
++echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++$ac_includes_default
++#include <$ac_header>
++_ACEOF
++rm -f conftest.$ac_objext
++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++ (eval $ac_compile) 2>conftest.er1
++ ac_status=$?
++ grep -v '^ *+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } &&
++ { ac_try='test -z "$ac_c_werror_flag"
++ || test ! -s conftest.err'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; } &&
++ { ac_try='test -s conftest.$ac_objext'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }; then
++ ac_header_compiler=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ac_header_compiler=no
++fi
++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
++echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
++echo "${ECHO_T}$ac_header_compiler" >&6
++
++# Is the header present?
++echo "$as_me:$LINENO: checking $ac_header presence" >&5
++echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++#include <$ac_header>
++_ACEOF
++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
++ ac_status=$?
++ grep -v '^ *+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } >/dev/null; then
++ if test -s conftest.err; then
++ ac_cpp_err=$ac_c_preproc_warn_flag
++ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
++ else
++ ac_cpp_err=
++ fi
++else
++ ac_cpp_err=yes
++fi
++if test -z "$ac_cpp_err"; then
++ ac_header_preproc=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ ac_header_preproc=no
++fi
++rm -f conftest.err conftest.$ac_ext
++echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
++echo "${ECHO_T}$ac_header_preproc" >&6
+
++# So? What about this header?
++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
++ yes:no: )
++ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
++echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
++echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
++ ac_header_preproc=yes
++ ;;
++ no:yes:* )
++ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
++echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
++echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
++echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
++echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
++echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
++echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
++ (
++ cat <<\_ASBOX
++## -------------------------------- ##
++## Report this to bugs@eggheads.org ##
++## -------------------------------- ##
++_ASBOX
++ ) |
++ sed "s/^/$as_me: WARNING: /" >&2
++ ;;
++esac
++echo "$as_me:$LINENO: checking for $ac_header" >&5
++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
++if eval "test \"\${$as_ac_Header+set}\" = set"; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ eval "$as_ac_Header=\$ac_header_preproc"
++fi
++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
++
++fi
++if test `eval echo '${'$as_ac_Header'}'` = yes; then
++ cat >>confdefs.h <<_ACEOF
++#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
++_ACEOF
++
++else
++ { { echo "$as_me:$LINENO: error: OpenSSL was not found. Please supply a pathname to OpenSSL" >&5
++echo "$as_me: error: OpenSSL was not found. Please supply a pathname to OpenSSL" >&2;}
++ { (exit 1); exit 1; }; }
++fi
++
++done
++
++
++
++fi;
+
++#end of ssl checks - hoe (.16 by poci)
+
+
+ # Substitute Makefile variables.
+@@ -10827,6 +11193,8 @@ s,@TCLINC@,$TCLINC,;t t
+ s,@TCLINCFN@,$TCLINCFN,;t t
+ s,@TCL_REQS@,$TCL_REQS,;t t
+ s,@TCL_LIBS@,$TCL_LIBS,;t t
++s,@SSL_LIBS@,$SSL_LIBS,;t t
++s,@SSL_INCLUDE@,$SSL_INCLUDE,;t t
+ s,@EGGVERSION@,$EGGVERSION,;t t
+ s,@DEST@,$DEST,;t t
+ s,@MOD_UPDIR@,$MOD_UPDIR,;t t
+diff -burNp eggdrop1.6.19/configure.ac eggdrop1.6.19.new/configure.ac
+--- eggdrop1.6.19/configure.ac 2008-02-18 23:25:33.000000000 +0100
++++ eggdrop1.6.19.new/configure.ac 2008-09-22 14:23:32.432890637 +0200
+@@ -150,6 +150,7 @@ EGG_TCL_CHECK_THREADS
+ EGG_TCL_LIB_REQS
+ EGG_TCL_LUSH
+
++EGG_SSL_CRAP
+
+ # Substitute Makefile variables.
+ EGG_SUBST_EGGVERSION
+diff -burNp eggdrop1.6.19/disabled_modules eggdrop1.6.19.new/disabled_modules
+--- eggdrop1.6.19/disabled_modules 2002-06-04 07:11:10.000000000 +0200
++++ eggdrop1.6.19.new/disabled_modules 2008-09-22 14:25:14.439395696 +0200
+@@ -1,12 +0,0 @@
+-# disabled_modules -- File which lists all Eggdrop modules that are
+-# disabled by default.
+-#
+-# $Id$
+-#
+-# Note:
+-# - Lines which start with a '#' character are ignored.
+-# - Every module name needs to be on its own line
+-
+-# Woobie only serves as an example for module programming. No need to
+-# compile it for normal bots ...
+-woobie
+diff -burNp eggdrop1.6.19/Makefile eggdrop1.6.19.new/Makefile
+--- eggdrop1.6.19/Makefile 2008-04-19 06:21:34.000000000 +0200
++++ eggdrop1.6.19.new/Makefile 2008-09-22 14:25:56.388522764 +0200
+@@ -1,8 +0,0 @@
+-all:
+- @echo ""
+- @echo "Before you can compile your bot you have to configure it."
+- @echo "Please start the configure script now:"
+- @echo ""
+- @echo " % ./configure"
+- @echo ""
+-
+diff -burNp eggdrop1.6.19/Makefile.in eggdrop1.6.19.new/Makefile.in
+--- eggdrop1.6.19/Makefile.in 2004-08-28 08:43:21.000000000 +0200
++++ eggdrop1.6.19.new/Makefile.in 2008-09-22 14:29:11.247383482 +0200
+@@ -57,6 +57,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ RANLIB = @RANLIB@
+ MOD_EXT = @MOD_EXT@
+ XREQS = @TCL_REQS@
++XSSL_LIBS = @SSL_LIBS@
++XSSL_INCLUDE = @SSL_INCLUDE@
+ TCLLIB = @TCLLIB@
+ TCLLIBFN = @TCLLIBFN@
+
+@@ -89,7 +91,8 @@ egg_install_msg = echo "" && \
+ MAKE_MODEGG = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(MOD_CC)' 'LD=$(MOD_LD)' \
+ 'STRIP=$(MOD_STRIP)' 'RANLIB=$(RANLIB)' 'CFLGS=$(CFLGS)' \
+ 'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' \
+-'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(standard build)' 'MODOBJS='
++'XSSL_LIBS=$(XSSL_LIBS)' 'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' \
++'XSSL_INCLUDE=$(XSSL_INCLUDE)' 'EGGBUILD=' 'MODOBJS='
+
+ MAKE_MODULES = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(SHLIB_CC)' 'LD=$(SHLIB_LD)' \
+ 'STRIP=$(SHLIB_STRIP)' 'CFLGS=$(CFLGS)' 'XLIBS=$(XLIBS)' 'MOD_EXT=$(MOD_EXT)' \
+@@ -99,12 +102,13 @@ MAKE_STATIC = $(MAKE) 'MAKE=$(MAKE)' 'CC
+ 'STRIP=$(STRIP)' 'RANLIB=$(RANLIB)' 'CFLGS=$(CFLGS) -DSTATIC' \
+ 'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' \
+ 'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(static version)' \
+-'MODOBJS=mod/*.o'
++'XSSL_INCLUDE=$(XSSL_INCLUDE)' 'XSSL_LIBS=$(XSSL_LIBS)' 'MODOBJS=mod/*.o'
+
+ MAKE_DEBEGG = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(MOD_CC)' 'LD=$(MOD_LD) -g' \
+ 'STRIP=touch' 'RANLIB=$(RANLIB)' 'CFLGS=-g3 $(DEBCFLAGS) $(CFLGS)' \
+ 'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' \
+-'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(debug version)' 'MODOBJS='
++'XSSL_LIBS=$(XSSL_LIBS)' 'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' \
++'XSSL_INCLUDE=$(XSSL_INCLUDE)' 'EGGBUILD=(debug version)' 'MODOBJS='
+
+ MAKE_DEBMODULES = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(SHLIB_CC)' 'LD=$(SHLIB_LD)' \
+ 'XLIBS=$(XLIBS)' 'STRIP=touch' 'CFLGS=-g3 $(DEBCFLAGS) $(CFLGS)' \
+@@ -113,7 +117,8 @@ MAKE_DEBMODULES = $(MAKE) 'MAKE=$(MAKE)'
+ MAKE_SDEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD) -g' \
+ 'STRIP=touch' 'RANLIB=$(RANLIB)' 'CFLGS=-g3 $(DEBCFLAGS) -DSTATIC $(CFLGS)' \
+ 'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' 'XLIBS=$(XLIBS)' \
+-'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(static debug version)' 'MODOBJS=mod/*.o'
++'XSSL_INCLUDE=$(XSSL_INCLUDE)' 'XSSL_LIBS=$(XSSL_LIBS)' 'EGGEXEC=$(EGGEXEC)' \
++'EGGBUILD=(static and debug version)' 'MODOBJS=mod/*.o'
+
+ MAKE_DEPEND = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)'
+
+diff -burNp eggdrop1.6.19/src/dcc.c eggdrop1.6.19.new/src/dcc.c
+--- eggdrop1.6.19/src/dcc.c 2008-02-16 22:41:03.000000000 +0100
++++ eggdrop1.6.19.new/src/dcc.c 2008-09-22 14:30:37.252784308 +0200
+@@ -32,7 +32,11 @@
+ #include "tandem.h"
+
+ /* Includes for botnet md5 challenge/response code <cybah> */
++#ifndef EGG_SSL_EXT
+ #include "md5/md5.h"
++#else
++#include "openssl/md5.h"
++#endif
+
+ extern struct userrec *userlist;
+ extern struct chanset_t *chanset;
+diff -burNp eggdrop1.6.19/src/dccutil.c eggdrop1.6.19.new/src/dccutil.c
+--- eggdrop1.6.19/src/dccutil.c 2008-02-16 22:41:03.000000000 +0100
++++ eggdrop1.6.19.new/src/dccutil.c 2008-09-22 14:31:42.540452895 +0200
+@@ -33,6 +33,7 @@
+ #include "chan.h"
+ #include "modules.h"
+ #include "tandem.h"
++#include "net.h"
+
+ extern struct dcc_t *dcc;
+ extern int dcc_total, max_dcc, dcc_flood_thr, backgrd, copy_to_tmp, MAXSOCKS;
+diff -burNp eggdrop1.6.19/src/eggdrop.h eggdrop1.6.19.new/src/eggdrop.h
+--- eggdrop1.6.19/src/eggdrop.h 2008-02-16 22:41:03.000000000 +0100
++++ eggdrop1.6.19.new/src/eggdrop.h 2008-09-22 14:33:40.008829213 +0200
+@@ -616,18 +616,6 @@ enum {
+ #define HELP_TEXT 2
+ #define HELP_IRC 16
+
+-/* This is used by the net module to keep track of sockets and what's
+- * queued on them
+- */
+-typedef struct {
+- int sock;
+- short flags;
+- char *inbuf;
+- char *outbuf;
+- unsigned long outbuflen; /* Outbuf could be binary data */
+- unsigned long inbuflen; /* Inbuf could be binary data */
+-} sock_list;
+-
+ enum {
+ EGG_OPTION_SET = 1, /* Set option(s). */
+ EGG_OPTION_UNSET = 2 /* Unset option(s). */
+diff -burNp eggdrop1.6.19/src/main.c eggdrop1.6.19.new/src/main.c
+--- eggdrop1.6.19/src/main.c 2008-02-16 22:41:03.000000000 +0100
++++ eggdrop1.6.19.new/src/main.c 2008-09-22 14:35:26.008450672 +0200
+@@ -161,6 +161,9 @@ int cx_line[16];
+ int cx_ptr = 0;
+ #endif
+
++#ifdef EGG_SSL_EXT
++int clean_net();
++#endif
+
+ void fatal(const char *s, int recoverable)
+ {
+@@ -171,6 +174,9 @@ void fatal(const char *s, int recoverabl
+ for (i = 0; i < dcc_total; i++)
+ if (dcc[i].sock >= 0)
+ killsock(dcc[i].sock);
++ #ifdef EGG_SSL_EXT
++ clean_net();
++ #endif
+ unlink(pid_file);
+ if (!recoverable) {
+ bg_send_quit(BG_ABORT);
+diff -burNp eggdrop1.6.19/src/Makefile.in eggdrop1.6.19.new/src/Makefile.in
+--- eggdrop1.6.19/src/Makefile.in 2006-11-20 12:38:25.000000000 +0100
++++ eggdrop1.6.19.new/src/Makefile.in 2008-09-22 14:38:37.400421493 +0200
+@@ -11,6 +11,8 @@ INSTALL = @INSTALL@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_DATA = @INSTALL_DATA@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
++XSSL_LIBS = @SSL_LIBS@
++XSSL_INCLUDE = @SSL_INCLUDE@
+
+ CC = @CC@
+ LD = @CC@
+@@ -37,7 +39,7 @@ doofus:
+ @echo "Linking eggdrop $(EGGBUILD)."
+ @echo ""
+ @touch mod/mod.xlibs
+- $(LD) -o ../$(EGGEXEC) $(eggdrop_objs) $(MODOBJS) $(XLIBS) md5/md5c.o compat/*.o `cat mod/mod.xlibs`
++ $(LD) -o ../$(EGGEXEC) $(eggdrop_objs) $(MODOBJS) $(XLIBS) md5/md5c.o compat/*.o `cat mod/mod.xlibs` $(XSSL_LIBS) $(XSSL_INCLUDE)
+ $(STRIP) ../$(EGGEXEC)
+ @echo ""
+ @echo "Successful compile: $(EGGEXEC)"
+diff -burNp eggdrop1.6.19/src/md5/md5c.c eggdrop1.6.19.new/src/md5/md5c.c
+--- eggdrop1.6.19/src/md5/md5c.c 2004-04-10 09:49:23.000000000 +0200
++++ eggdrop1.6.19.new/src/md5/md5c.c 2008-09-22 14:40:36.140399142 +0200
+@@ -17,9 +17,23 @@
+
+ #include <string.h>
+
++#ifndef EGG_SSL_EXT
+ #include "md5.h"
++#else
++#include "openssl/md5.h"
++#endif
++
+ #include "compat/compat.h"
+
++typedef unsigned long MD5_u32plus;
++
++typedef struct {
++ MD5_u32plus lo, hi;
++ MD5_u32plus a, b, c, d;
++ unsigned char buffer[64];
++ MD5_u32plus block[16];
++} MD5_CTX;
++
+ /*
+ * The basic MD5 functions.
+ *
+diff -burNp eggdrop1.6.19/src/md5/md5.h eggdrop1.6.19.new/src/md5/md5.h
+--- eggdrop1.6.19/src/md5/md5.h 2003-03-06 04:35:59.000000000 +0100
++++ eggdrop1.6.19.new/src/md5/md5.h 2008-09-22 14:44:22.801432410 +0200
+@@ -5,6 +5,8 @@
+ * Written by Solar Designer <solar@openwall.com> in 2001, and placed in
+ * the public domain. See md5c.c for more information.
+ */
++#include "../config.h"
++#ifndef EGG_SSL_EXT
+
+ #ifndef _MD5_H
+ #define _MD5_H
+@@ -24,3 +26,4 @@ extern void MD5_Update(MD5_CTX *ctx, voi
+ extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
+
+ #endif
++#endif
+diff -burNp eggdrop1.6.19/src/mod/irc.mod/chan.c eggdrop1.6.19.new/src/mod/irc.mod/chan.c
+--- eggdrop1.6.19/src/mod/irc.mod/chan.c 2008-02-16 22:41:09.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/irc.mod/chan.c 2008-09-22 14:46:27.143879710 +0200
+@@ -965,10 +965,10 @@ static int got324(char *from, char *msg)
+ q = strchr(p, ' ');
+ if (q != NULL) {
+ *q = 0;
+- set_key(chan, p);
++ set_keyegg(chan, p);
+ strcpy(p, q + 1);
+ } else {
+- set_key(chan, p);
++ set_keyegg(chan, p);
+ *p = 0;
+ }
+ }
+diff -burNp eggdrop1.6.19/src/mod/irc.mod/irc.c eggdrop1.6.19.new/src/mod/irc.mod/irc.c
+--- eggdrop1.6.19/src/mod/irc.mod/irc.c 2008-02-16 22:41:09.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/irc.mod/irc.c 2008-09-22 14:47:35.182249518 +0200
+@@ -256,7 +256,7 @@ static void maybe_revenge(struct chanset
+
+ /* Set the key.
+ */
+-static void set_key(struct chanset_t *chan, char *k)
++static void set_keyegg(struct chanset_t *chan, char *k)
+ {
+ nfree(chan->channel.key);
+ if (k == NULL) {
+diff -burNp eggdrop1.6.19/src/mod/irc.mod/irc.h eggdrop1.6.19.new/src/mod/irc.mod/irc.h
+--- eggdrop1.6.19/src/mod/irc.mod/irc.h 2008-02-16 22:41:09.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/irc.mod/irc.h 2008-09-22 14:53:47.281677127 +0200
+@@ -69,7 +69,7 @@ static void set_delay(struct chanset_t *
+
+ static void reset_chan_info(struct chanset_t *);
+ static void recheck_channel(struct chanset_t *, int);
+-static void set_key(struct chanset_t *, char *);
++static void set_keyegg(struct chanset_t *, char *);
+ static void maybe_revenge(struct chanset_t *, char *, char *, int);
+ static int detect_chan_flood(char *, char *, char *, struct chanset_t *, int,
+ char *);
+diff -burNp eggdrop1.6.19/src/mod/irc.mod/mode.c eggdrop1.6.19.new/src/mod/irc.mod/mode.c
+--- eggdrop1.6.19/src/mod/irc.mod/mode.c 2008-02-16 22:41:09.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/irc.mod/mode.c 2008-09-22 14:57:12.177766159 +0200
+@@ -1128,7 +1128,7 @@ static int gotmode(char *from, char *ori
+ break;
+ }
+ if (ms2[0] == '+') {
+- set_key(chan, op);
++ set_keyegg(chan, op);
+ if (channel_active(chan))
+ got_key(chan, nick, from, op);
+ } else {
+@@ -1139,7 +1139,7 @@ static int gotmode(char *from, char *ori
+ !chan_master(user) && !match_my_nick(nick))
+ add_mode(chan, '+', 'k', chan->key_prot);
+ }
+- set_key(chan, NULL);
++ set_keyegg(chan, NULL);
+ }
+ check_tcl_mode(nick, from, u, chan->dname, ms2, op);
+ break;
+diff -burNp eggdrop1.6.19/src/mod/module.h eggdrop1.6.19.new/src/mod/module.h
+--- eggdrop1.6.19/src/mod/module.h 2008-02-16 22:41:06.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/module.h 2008-09-22 15:00:36.262853551 +0200
+@@ -471,13 +471,23 @@
+ /* IPv6 leftovers: 286 */
+ /* IPv6 leftovers: 287 */
+ /* 288 - 291 */
+-/* IPv6 leftovers: 288 */
++#ifdef EGG_SSL_EXT
++#define net_switch_to_ssl ((int (*)(int))global[289])
++#define use_ssl (*(int *)global[290]) /* kyotou */
++#define strip_mirc_codes ((void (*)(int, char *))global[291])
++#define check_ansi ((int (*) (char *))global[292])
++#define oatoi ((int (*) (const char *))global[293])
++/* 292 - 295 */
++#define str_isdigit ((int (*) (const char *))global[294])
++#define remove_crlf ((void (*)(char **))global[295])
++#else
+ #define strip_mirc_codes ((void (*)(int, char *))global[289])
+ #define check_ansi ((int (*) (char *))global[290])
+ #define oatoi ((int (*) (const char *))global[291])
+ /* 292 - 295 */
+ #define str_isdigit ((int (*) (const char *))global[292])
+ #define remove_crlf ((void (*)(char **))global[293])
++#endif
+
+ /* hostmasking */
+ #define maskhost(a,b) _maskhost((a),(b),1)
+diff -burNp eggdrop1.6.19/src/mod/server.mod/servmsg.c eggdrop1.6.19.new/src/mod/server.mod/servmsg.c
+--- eggdrop1.6.19/src/mod/server.mod/servmsg.c 2008-02-16 22:41:10.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/server.mod/servmsg.c 2008-09-22 15:16:40.818273894 +0200
+@@ -1293,6 +1293,14 @@ static void server_resolve_success(int s
+ fatal("NO SERVERS WILL ACCEPT MY CONNECTION.", 0);
+ } else {
+ dcc[servidx].sock = serv;
++ #ifdef EGG_SSL_EXT
++ if (use_ssl) { /* kyotou */
++ if (net_switch_to_ssl(serv)==0) {
++ putlog(LOG_SERV, "*", "SSL %s %s (Error while switching to SSL)", IRC_FAILEDCONNECT, dcc[servidx].host);
++ lostdcc(servidx);
++ }
++ }
++ #endif
+ /* Queue standard login */
+ dcc[servidx].timeval = now;
+ SERVER_SOCKET.timeout_val = &server_timeout;
+diff -burNp eggdrop1.6.19/src/modules.c eggdrop1.6.19.new/src/modules.c
+--- eggdrop1.6.19/src/modules.c 2008-02-16 22:41:04.000000000 +0100
++++ eggdrop1.6.19.new/src/modules.c 2008-09-22 15:30:23.753434245 +0200
+@@ -29,9 +29,17 @@
+ #include "main.h"
+ #include "modules.h"
+ #include "tandem.h"
++
++#ifndef EGG_SSL_EXT
+ #include "md5/md5.h"
++#else
++#include "openssl/md5.h"
++#endif
++
+ #include "users.h"
+
++#include "net.h"
++
+ #ifndef STATIC
+ # ifdef MOD_USE_SHL
+ # include <dl.h>
+@@ -94,6 +102,10 @@ extern int parties, noshare, dcc_total,
+ password_timeout, force_expire, protect_readonly, reserved_port_min,
+ reserved_port_max, copy_to_tmp, quiet_reject;
+
++#ifdef EGG_SSL_EXT
++extern int use_ssl; /* kyotou */
++#endif
++
+ extern party_t *party;
+ extern time_t now, online_since;
+ extern tand_t *tandbot;
+@@ -128,6 +140,9 @@ void check_static(char *name, char *(*fu
+ }
+ #endif /* STATIC */
+
++#ifdef EGG_SSL_EXT
++int net_switch_to_ssl(int);
++#endif
+
+ /* The null functions */
+ void null_func()
+@@ -564,7 +579,13 @@ Function global_table[] = {
+ (Function) 0, /* IPv6 leftovers: 286 */
+ (Function) 0, /* IPv6 leftovers: 287 */
+ /* 288 - 291 */
++#ifdef EGG_SSL_EXT
+ (Function) 0, /* IPv6 leftovers: 288 */
++ (Function) net_switch_to_ssl,
++ (Function) & use_ssl, /* kyotou */
++#else
++ (Function) 0, /* IPv6 leftovers: 288 */
++#endif
+ (Function) strip_mirc_codes,
+ (Function) check_ansi,
+ (Function) oatoi,
+diff -burNp eggdrop1.6.19/src/net.c eggdrop1.6.19.new/src/net.c
+--- eggdrop1.6.19/src/net.c 2008-02-16 22:41:04.000000000 +0100
++++ eggdrop1.6.19.new/src/net.c 2008-09-22 16:10:28.739840200 +0200
+@@ -52,6 +52,18 @@
+ # endif
+ #endif
+
++#ifdef EGG_SSL_EXT
++# ifndef EGG_SSL_INCS
++# include <openssl/ssl.h>
++# include <openssl/err.h>
++# include <openssl/rand.h>
++# define EGG_SSL_INCS 1
++# endif
++#endif
++
++#include "net.h"
++
++
+ extern struct dcc_t *dcc;
+ extern int backgrd, use_stderr, resolve_timeout, dcc_total;
+ extern unsigned long otraffic_irc_today, otraffic_bn_today, otraffic_dcc_today,
+@@ -65,6 +77,12 @@ int firewallport = 1080; /* Default
+ char botuser[21] = "eggdrop"; /* Username of the user running the bot. */
+ int dcc_sanitycheck = 0; /* Do some sanity checking on dcc connections. */
+
++#ifdef EGG_SSL_EXT
++SSL_CTX *ssl_ctx=NULL;
++char *tls_rand_file = NULL;
++int use_ssl = 0; /* kyotou */
++#endif
++
+ sock_list *socklist = NULL; /* Enough to be safe. */
+ int MAXSOCKS = 0;
+ sigjmp_buf alarmret; /* Env buffer for alarm() returns. */
+@@ -88,6 +106,46 @@ IP my_atoul(char *s)
+ return ret;
+ }
+
++#ifdef EGG_SSL_EXT
++int seed_PRNG(void)
++{
++ char stackdata[1024];
++ static char rand_file[300];
++ FILE *fh;
++
++#if OPENSSL_VERSION_NUMBER >= 0x00905100
++ if (RAND_status())
++ return 0; /* PRNG already good seeded */
++#endif
++ /* if the device '/dev/urandom' is present, OpenSSL uses it by default.
++ * check if it's present, else we have to make random data ourselfs.
++ */
++ if ((fh = fopen("/dev/urandom", "r"))) {
++ fclose(fh);
++ return 0;
++ }
++ if (RAND_file_name(rand_file, sizeof(rand_file)))
++ tls_rand_file = rand_file;
++ else
++ return 1;
++ if (!RAND_load_file(rand_file, 1024)) {
++ /* no .rnd file found, create new seed */
++ unsigned int c;
++ c = time(NULL);
++ RAND_seed(&c, sizeof(c));
++ c = getpid();
++ RAND_seed(&c, sizeof(c));
++ RAND_seed(stackdata, sizeof(stackdata));
++ }
++#if OPENSSL_VERSION_NUMBER >= 0x00905100
++ if (!RAND_status())
++ return 2; /* PRNG still badly seeded */
++#endif
++ return 0;
++}
++#endif
++
++
+ /* Initialize the socklist
+ */
+ void init_net()
+@@ -96,9 +154,35 @@ void init_net()
+
+ for (i = 0; i < MAXSOCKS; i++) {
+ socklist[i].flags = SOCK_UNUSED;
++#ifdef EGG_SSL_EXT
++ socklist[i].ssl=NULL;
++#endif
+ }
++#ifdef EGG_SSL_EXT
++ /* good place to init ssl stuff */
++ SSL_load_error_strings();
++ OpenSSL_add_ssl_algorithms();
++ ssl_ctx=SSL_CTX_new(SSLv23_client_method());
++ if (!ssl_ctx)
++ fatal("SSL_CTX_new() failed",0);
++ if (seed_PRNG())
++ fatal("Wasn't able to properly seed the PRNG!",0);
++#endif
+ }
+
++#ifdef EGG_SSL_EXT
++/* cleanup mess when quiting */
++int clean_net() {
++ if (ssl_ctx) {
++ SSL_CTX_free(ssl_ctx);
++ ssl_ctx = NULL;
++ }
++ if (tls_rand_file)
++ RAND_write_file(tls_rand_file);
++ return 0;
++ }
++#endif
++
+ int expmem_net()
+ {
+ int i, tot = 0;
+@@ -231,6 +315,13 @@ int sockoptions(int sock, int operation,
+
+ for (i = 0; i < MAXSOCKS; i++)
+ if ((socklist[i].sock == sock) && !(socklist[i].flags & SOCK_UNUSED)) {
++#ifdef EGG_SSL_EXT
++ if (socklist[i].ssl) {
++ SSL_shutdown(socklist[i].ssl);
++ SSL_free(socklist[i].ssl);
++ socklist[i].ssl=NULL;
++ }
++#endif
+ if (operation == EGG_OPTION_SET)
+ socklist[i].flags |= sock_options;
+ else if (operation == EGG_OPTION_UNSET)
+@@ -366,6 +457,64 @@ static int proxy_connect(int sock, char
+ return sock;
+ }
+
++#ifdef EGG_SSL_EXT
++int net_switch_to_ssl(int sock) {
++int err;
++int i=0;
++ debug0("net_switch_to_ssl()");
++ while (i<MAXSOCKS) {
++ if (socklist[i].sock==sock) {
++ break;
++ }
++ i++;
++ }
++ if (i==MAXSOCKS) {
++ debug0("Error while swithing to SSL - sock not found in list");
++ return 0;
++ }
++
++ if (socklist[i].ssl) {
++ debug0("Error while swithing to SSL - already in ssl");
++ return 0;
++ }
++ socklist[i].ssl = SSL_new(ssl_ctx);
++ if (!socklist[i].ssl) {
++ debug0("Error while swithing to SSL - SSL_new() error");
++ return 0;
++ }
++
++ SSL_set_fd(socklist[i].ssl, socklist[i].sock);
++ err = SSL_connect(socklist[i].ssl);
++
++ while (err <= 0) {
++ int errs;
++ errs=SSL_get_error(socklist[i].ssl,err);
++ if ((errs!=SSL_ERROR_WANT_READ)&&(errs!=SSL_ERROR_WANT_WRITE)&&
++ (errs!=SSL_ERROR_WANT_X509_LOOKUP)) {
++ putlog(LOG_DEBUG,"*", "SSL_connect() = %d, %s", err,
++ (char *)ERR_error_string(ERR_get_error(), NULL));
++ SSL_shutdown(socklist[i].ssl);
++ SSL_free(socklist[i].ssl);
++ socklist[i].ssl = NULL;
++ return 0;
++ }
++ usleep(1000);
++ err = SSL_connect(socklist[i].ssl);
++ }
++
++ if (err==1) {
++ debug0("SSL_connect() success");
++ return 1;
++ }
++ debug0("Error while SSL_connect()");
++ SSL_shutdown(socklist[i].ssl);
++ SSL_free(socklist[i].ssl);
++ socklist[i].ssl = NULL;
++ return 0;
++}
++#endif
++
++
+ /* Starts a connection attempt to a socket
+ *
+ * If given a normal hostname, this will be resolved to the corresponding
+@@ -627,6 +776,9 @@ static int sockread(char *s, int *len)
+ for (i = 0; i < MAXSOCKS; i++) {
+ if ((!(socklist[i].flags & SOCK_UNUSED)) &&
+ ((FD_ISSET(socklist[i].sock, &fd)) ||
++#ifdef EGG_SSL_EXT
++ ((socklist[i].ssl)&&(SSL_pending(socklist[i].ssl))) ||
++#endif
+ ((socklist[i].sock == STDOUT) && (!backgrd) &&
+ (FD_ISSET(STDIN, &fd))))) {
+ if (socklist[i].flags & (SOCK_LISTEN | SOCK_CONNECT)) {
+@@ -651,7 +803,31 @@ static int sockread(char *s, int *len)
+ if ((socklist[i].sock == STDOUT) && !backgrd)
+ x = read(STDIN, s, grab);
+ else
++#ifdef EGG_SSL_EXT
++ {
++ if (socklist[i].ssl) {
++ x=SSL_read(socklist[i].ssl,s,grab);
++ if (x < 0) {
++ int err = SSL_get_error(socklist[i].ssl, x);
++ x = -1;
++ switch (err) {
++ case SSL_ERROR_WANT_READ:
++ errno = EAGAIN;
++ break;
++ case SSL_ERROR_WANT_WRITE:
++ errno = EAGAIN;
++ break;
++ case SSL_ERROR_WANT_X509_LOOKUP:
++ errno = EAGAIN;
++ break;
++ }
++ }
++ } else
+ x = read(socklist[i].sock, s, grab);
++ }
++#else
++ x = read(socklist[i].sock, s, grab);
++#endif
+ if (x <= 0) { /* eof */
+ if (errno != EAGAIN) { /* EAGAIN happens when the operation would
+ * block on a non-blocking socket, if the
+@@ -944,6 +1120,26 @@ void tputs(register int z, char *s, unsi
+ socklist[i].outbuflen += len;
+ return;
+ }
++#ifdef EGG_SSL_EXT
++ if (socklist[i].ssl) {
++ x=SSL_write(socklist[i].ssl,s,len);
++ if (x < 0) {
++ int err = SSL_get_error(socklist[i].ssl, x);
++ x = -1;
++ switch (err) {
++ case SSL_ERROR_WANT_READ:
++ errno = EAGAIN;
++ break;
++ case SSL_ERROR_WANT_WRITE:
++ errno = EAGAIN;
++ break;
++ case SSL_ERROR_WANT_X509_LOOKUP:
++ errno = EAGAIN;
++ break;
++ }
++ }
++ } else
++#endif
+ /* Try. */
+ x = write(z, s, len);
+ if (x == -1)
+@@ -1010,6 +1206,27 @@ void dequeue_sockets()
+ (socklist[i].outbuf != NULL) && (FD_ISSET(socklist[i].sock, &wfds))) {
+ /* Trick tputs into doing the work */
+ errno = 0;
++#ifdef EGG_SSL_EXT
++ if (socklist[i].ssl) {
++ x = write(socklist[i].sock, socklist[i].outbuf,
++ socklist[i].outbuflen);
++ if (x < 0) {
++ int err = SSL_get_error(socklist[i].ssl, x);
++ x = -1;
++ switch (err) {
++ case SSL_ERROR_WANT_READ:
++ errno = EAGAIN;
++ break;
++ case SSL_ERROR_WANT_WRITE:
++ errno = EAGAIN;
++ break;
++ case SSL_ERROR_WANT_X509_LOOKUP:
++ errno = EAGAIN;
++ break;
++ }
++ }
++ } else
++#endif
+ x = write(socklist[i].sock, socklist[i].outbuf, socklist[i].outbuflen);
+ if ((x < 0) && (errno != EAGAIN)
+ #ifdef EBADSLT
+diff -burNp eggdrop1.6.19/src/net.h eggdrop1.6.19.new/src/net.h
+--- eggdrop1.6.19/src/net.h 1970-01-01 01:00:00.000000000 +0100
++++ eggdrop1.6.19.new/src/net.h 2008-09-22 16:12:38.979826983 +0200
+@@ -0,0 +1,30 @@
++#ifndef _EGG_NET_H
++#define _EGG_NET_H
++#ifdef EGG_SSL_EXT
++# ifndef EGG_SSL_INCS
++# include <openssl/ssl.h>
++# include <openssl/err.h>
++# include <openssl/rand.h>
++# define EGG_SSL_INCS 1
++# endif
++#endif
++
++/* This is used by the net module to keep track of sockets and what's
++ * queued on them
++ */
++typedef struct {
++ int sock;
++#ifdef EGG_SSL_EXT
++ SSL *ssl;
++#endif
++ short flags;
++ char *inbuf;
++ char *outbuf;
++ unsigned long outbuflen; /* Outbuf could be binary data */
++ unsigned long inbuflen; /* Inbuf could be binary data */
++#ifdef USE_IPV6
++ unsigned int af;
++#endif /* USE_IPV6 */
++} sock_list;
++
++#endif /* _EGG_NET_H */
+diff -burNp eggdrop1.6.19/src/patch.h eggdrop1.6.19.new/src/patch.h
+--- eggdrop1.6.19/src/patch.h 2008-04-19 06:21:20.000000000 +0200
++++ eggdrop1.6.19.new/src/patch.h 2008-09-22 16:13:41.491758122 +0200
+@@ -36,7 +36,9 @@
+ *
+ *
+ */
+-/* PATCH GOES HERE */
++#ifdef EGG_SSL_EXT
++patch("SSL");
++#endif
+ /*
+ *
+ *
+diff -burNp eggdrop1.6.19/src/tcl.c eggdrop1.6.19.new/src/tcl.c
+--- eggdrop1.6.19/src/tcl.c 2008-02-16 22:41:04.000000000 +0100
++++ eggdrop1.6.19.new/src/tcl.c 2008-09-22 16:16:08.499821489 +0200
+@@ -45,6 +45,10 @@ typedef struct {
+
+ extern time_t online_since;
+
++#ifdef EGG_SSL_EXT
++extern int use_ssl; /* kyotou */
++#endif
++
+ extern char origbotname[], botuser[], motdfile[], admin[], userfile[],
+ firewall[], helpdir[], notify_new[], hostname[], myip[], moddir[],
+ tempdir[], owner[], network[], botnetnick[], bannerfile[],
+@@ -522,6 +526,9 @@ static tcl_ints def_tcl_ints[] = {
+ {"enable-simul", &enable_simul, 0}, /* compat */
+ {"debug-output", &debug_output, 0}, /* compat */
+ {"use-console-r", &use_console_r, 0}, /* compat */
++#ifdef EGG_SSL_EXT
++ {"use-ssl", &use_ssl, 0}, /* kyotou */
++#endif
+ {NULL, NULL, 0}
+ };
+
+diff -burNp eggdrop1.6.19/src/tclmisc.c eggdrop1.6.19.new/src/tclmisc.c
+--- eggdrop1.6.19/src/tclmisc.c 2008-02-16 22:41:04.000000000 +0100
++++ eggdrop1.6.19.new/src/tclmisc.c 2008-09-22 16:17:34.872716077 +0200
+@@ -26,7 +26,12 @@
+ #include "main.h"
+ #include "modules.h"
+ #include "tandem.h"
+-#include "md5/md5.h"
++
++#ifndef EGG_SSL_EXT
++ #include "md5/md5.h"
++#else
++#include "openssl/md5.h"
++#endif
+
+ #ifdef TIME_WITH_SYS_TIME
+ # include <sys/time.h>
--- /dev/null
+diff -burNp eggdrop1.6.19/src/chan.h eggdrop1.6.19.new/src/chan.h
+--- eggdrop1.6.19/src/chan.h 2008-02-16 22:41:03.000000000 +0100
++++ eggdrop1.6.19.new/src/chan.h 2008-09-22 11:27:30.636306556 +0200
+@@ -191,6 +191,7 @@ struct chanset_t {
+ int mode_mns_prot; /* modes to reject */
+ int limit_prot; /* desired limit */
+ char key_prot[121]; /* desired password */
++ char topic_prot[501]; /* desired topic */
+ char pls[21]; /* positive mode changes */
+ char mns[21]; /* negative mode changes */
+ char *key; /* new key to set */
+diff -burNp eggdrop1.6.19/src/chanprog.c eggdrop1.6.19.new/src/chanprog.c
+--- eggdrop1.6.19/src/chanprog.c 2008-02-16 22:41:03.000000000 +0100
++++ eggdrop1.6.19.new/src/chanprog.c 2008-09-22 11:30:50.744325464 +0200
+@@ -690,3 +690,24 @@ int isowner(char *name)
+
+ return 0;
+ }
++
++/* If we have a protected topic and the bot is opped, halfoped,
++ * or the channel is -t, change the topic. (Sup 11May2001)
++*/
++void check_topic(struct chanset_t *chan)
++{
++ memberlist *m = NULL;
++
++ if (chan->topic_prot[0]) {
++ m = ismember(chan, botname);
++ if (!m)
++ return;
++ if (chan->channel.topic) {
++ if (!egg_strcasecmp(chan->topic_prot, chan->channel.topic))
++ return;
++ }
++ if (chan_hasop(m) || !channel_optopic(chan) || chan_hashalfop(m))
++ dprintf(DP_SERVER, "TOPIC %s :%s\n", chan->name, chan->topic_prot);
++ }
++}
++
+diff -burNp eggdrop1.6.19/src/mod/channels.mod/channels.c eggdrop1.6.19.new/src/mod/channels.mod/channels.c
+--- eggdrop1.6.19/src/mod/channels.mod/channels.c 2008-02-16 22:41:06.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/channels.mod/channels.c 2008-09-22 11:34:55.161533902 +0200
+@@ -385,6 +385,7 @@ static void write_channels()
+ FILE *f;
+ char s[121], w[1024], w2[1024], name[163];
+ char need1[242], need2[242], need3[242], need4[242], need5[242];
++ char topic[1002];
+ struct chanset_t *chan;
+ struct udef_struct *ul;
+
+@@ -405,6 +406,7 @@ static void write_channels()
+ convert_element(chan->dname, name);
+ get_mode_protect(chan, w);
+ convert_element(w, w2);
++ convert_element(chan->topic_prot, topic);
+ convert_element(chan->need_op, need1);
+ convert_element(chan->need_invite, need2);
+ convert_element(chan->need_key, need3);
+@@ -412,7 +414,7 @@ static void write_channels()
+ convert_element(chan->need_limit, need5);
+ /* Do not indent me (adds extra spaces to chan file). */
+ fprintf(f,
+-"channel %s %s%schanmode %s idle-kick %d stopnethack-mode %d revenge-mode %d \
++"channel %s %s%schanmode %s topic %s idle-kick %d stopnethack-mode %d revenge-mode %d \
+ need-op %s need-invite %s need-key %s need-unban %s need-limit %s \
+ flood-chan %d:%d flood-ctcp %d:%d flood-join %d:%d flood-kick %d:%d \
+ flood-deop %d:%d flood-nick %d:%d aop-delay %d:%d ban-time %d exempt-time %d \
+@@ -422,7 +424,7 @@ invite-time %d %cenforcebans %cdynamicba
+ %cseen %cinactive %cdynamicexempts %cuserexempts %cdynamicinvites \
+ %cuserinvites %cnodesynch ",
+ channel_static(chan) ? "set" : "add", name, channel_static(chan) ?
+- " " : " { ", w2, chan->idle_kick, chan->stopnethack_mode,
++ " " : " { ", w2, topic, chan->idle_kick, chan->stopnethack_mode,
+ chan->revenge_mode, need1, need2, need3, need4, need5,
+ chan->flood_pub_thr, chan->flood_pub_time,
+ chan->flood_ctcp_thr, chan->flood_ctcp_time,
+diff -burNp eggdrop1.6.19/src/mod/channels.mod/cmdschan.c eggdrop1.6.19.new/src/mod/channels.mod/cmdschan.c
+--- eggdrop1.6.19/src/mod/channels.mod/cmdschan.c 2008-02-16 22:41:07.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/channels.mod/cmdschan.c 2008-09-22 11:37:38.571477034 +0200
+@@ -1269,6 +1269,7 @@ static void cmd_chaninfo(struct userrec
+ channel_static(chan) ? "static" : "dynamic", chan->dname);
+ get_mode_protect(chan, work);
+ dprintf(idx, "Protect modes (chanmode): %s\n", work[0] ? work : "None");
++ dprintf(idx, "Protect topic: %s\n", chan->topic_prot[0] ? chan->topic_prot : "None");
+ if (chan->idle_kick)
+ dprintf(idx, "Idle Kick after (idle-kick): %d\n", chan->idle_kick);
+ else
+diff -burNp eggdrop1.6.19/src/mod/channels.mod/help/chaninfo.help eggdrop1.6.19.new/src/mod/channels.mod/help/chaninfo.help
+--- eggdrop1.6.19/src/mod/channels.mod/help/chaninfo.help 2003-02-02 05:20:44.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/channels.mod/help/chaninfo.help 2008-09-22 11:42:29.504962817 +0200
+@@ -4,6 +4,7 @@
+ It shows any of the following:
+ %bchanmode%b These modes are enforced on the channel. Both + and -
+ modes can be enforced.
++ %btopic%b which topic is enforced on the channel
+ %bidle-kick%b Kick idle users that are not +f or above on the channel
+ after how many minutes (set this to 0 to disable).
+ %{+n}
+diff -burNp eggdrop1.6.19/src/mod/channels.mod/tclchan.c eggdrop1.6.19.new/src/mod/channels.mod/tclchan.c
+--- eggdrop1.6.19/src/mod/channels.mod/tclchan.c 2008-02-16 22:41:07.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/channels.mod/tclchan.c 2008-09-22 11:46:12.888320583 +0200
+@@ -1223,6 +1223,15 @@ static int tcl_channel_modify(Tcl_Interp
+ return TCL_ERROR;
+ }
+ chan->invite_time = atoi(item[i]);
++ } else if (!strcmp(item[i], "topic")) {
++ i++;
++ if (i >= items) {
++ if (irp)
++ Tcl_AppendResult(irp, "channel topic needs argument", NULL);
++ return TCL_ERROR;
++ }
++ strncpyz(chan->topic_prot, item[i], sizeof(chan->topic_prot));
++ check_topic(chan);
+ } else if (!strcmp(item[i], "+enforcebans"))
+ chan->status |= CHAN_ENFORCEBANS;
+ else if (!strcmp(item[i], "-enforcebans"))
+diff -burNp eggdrop1.6.19/src/mod/irc.mod/chan.c eggdrop1.6.19.new/src/mod/irc.mod/chan.c
+--- eggdrop1.6.19/src/mod/irc.mod/chan.c 2008-02-16 22:41:09.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/irc.mod/chan.c 2008-09-22 11:51:07.921436628 +0200
+@@ -1513,12 +1513,14 @@ static int gottopic(char *from, char *ms
+ memberlist *m;
+ struct chanset_t *chan;
+ struct userrec *u;
++ struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+
+ chname = newsplit(&msg);
+ fixcolon(msg);
+ u = get_user_by_host(from);
+ nick = splitnick(&from);
+ chan = findchan(chname);
++ get_user_flagrec(u, &fr, chname);
+ if (chan) {
+ putlog(LOG_JOIN, chan->dname, "Topic changed on %s by %s!%s: %s",
+ chan->dname, nick, from, msg);
+@@ -1527,6 +1529,8 @@ static int gottopic(char *from, char *ms
+ m->last = now;
+ set_topic(chan, msg);
+ check_tcl_topc(nick, from, u, chan->dname, msg);
++ if (egg_strcasecmp(botname, nick) && !glob_master(fr) && !chan_master(fr))
++ check_topic(chan);
+ }
+ return 0;
+ }
+@@ -1545,6 +1549,7 @@ static int got331(char *from, char *msg)
+ if (chan) {
+ set_topic(chan, NULL);
+ check_tcl_topc("*", "*", NULL, chan->dname, "");
++ check_topic(chan);
+ }
+ return 0;
+ }
+@@ -1564,6 +1569,7 @@ static int got332(char *from, char *msg)
+ fixcolon(msg);
+ set_topic(chan, msg);
+ check_tcl_topc("*", "*", NULL, chan->dname, msg);
++ check_topic(chan);
+ }
+ return 0;
+ }
+diff -burNp eggdrop1.6.19/src/mod/irc.mod/cmdsirc.c eggdrop1.6.19.new/src/mod/irc.mod/cmdsirc.c
+--- eggdrop1.6.19/src/mod/irc.mod/cmdsirc.c 2008-02-16 22:41:09.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/irc.mod/cmdsirc.c 2008-09-22 11:55:02.514726004 +0200
+@@ -898,6 +898,7 @@ static void cmd_channel(struct userrec *
+ static void cmd_topic(struct userrec *u, int idx, char *par)
+ {
+ struct chanset_t *chan;
++ struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+
+ if (par[0] && (strchr(CHANMETA, par[0]) != NULL)) {
+ char *chname = newsplit(&par);
+@@ -923,6 +924,13 @@ static void cmd_topic(struct userrec *u,
+ dprintf(idx, "I'm not a channel op or halfop on %s and the channel is "
+ "+t.\n", chan->dname);
+ else {
++ if (chan->topic_prot[0]) {
++ get_user_flagrec(u, &fr, chan->dname);
++ if (!glob_master(fr) && !chan_master(fr)) {
++ dprintf(idx, "The topic of %s is protected.\n", chan->dname);
++ return;
++ }
++ }
+ dprintf(DP_SERVER, "TOPIC %s :%s\n", chan->name, par);
+ dprintf(idx, "Changing topic...\n");
+ putlog(LOG_CMDS, "*", "#%s# (%s) topic %s", dcc[idx].nick,
+diff -burNp eggdrop1.6.19/src/mod/irc.mod/mode.c eggdrop1.6.19.new/src/mod/irc.mod/mode.c
+--- eggdrop1.6.19/src/mod/irc.mod/mode.c 2008-02-16 22:41:09.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/irc.mod/mode.c 2008-09-22 12:00:05.134685721 +0200
+@@ -460,8 +460,10 @@ static void got_op(struct chanset_t *cha
+ }
+ }
+ m->flags |= WASOP;
+- if (check_chan)
++ if (check_chan) {
+ recheck_channel(chan, 1);
++ check_topic(chan);
++ }
+ }
+
+ static void got_halfop(struct chanset_t *chan, char *nick, char *from,
+@@ -549,8 +551,10 @@ static void got_halfop(struct chanset_t
+ }
+ }
+ m->flags |= WASHALFOP;
+- if (check_chan)
++ if (check_chan) {
+ recheck_channel(chan, 1);
++ check_topic(chan);
++ }
+ }
+
+ static void got_deop(struct chanset_t *chan, char *nick, char *from,
+@@ -1246,6 +1250,8 @@ static int gotmode(char *from, char *ori
+ (chan->mode_mns_prot & todo)))
+ add_mode(chan, ms2[0] == '+' ? '-' : '+', *chg, "");
+ }
++ if ((ms2[0] == '-') && ((*chg == 't') || (*chg == 'h')))
++ check_topic(chan);
+ }
+ chg++;
+ }
+diff -burNp eggdrop1.6.19/src/mod/module.h eggdrop1.6.19.new/src/mod/module.h
+--- eggdrop1.6.19/src/mod/module.h 2008-02-16 22:41:06.000000000 +0100
++++ eggdrop1.6.19.new/src/mod/module.h 2008-09-22 12:01:11.964804368 +0200
+@@ -361,7 +361,7 @@
+ #define rem_tcl_coups ((void (*) (tcl_coups *))global[210])
+ #define botname ((char *)(global[211]))
+ /* 212 - 215 */
+-/* 212: remove_gunk() -- UNUSED (drummer) */
++#define check_topic ((void (*)(struct chanset_t *))global[212])
+ #define check_tcl_chjn ((void (*) (const char *,const char *,int,char,int,const char *))global[213])
+ #define sanitycheck_dcc ((int (*)(char *, char *, char *, char *))global[214])
+ #define isowner ((int (*)(char *))global[215])
+diff -burNp eggdrop1.6.19/src/modules.c eggdrop1.6.19.new/src/modules.c
+--- eggdrop1.6.19/src/modules.c 2008-02-16 22:41:04.000000000 +0100
++++ eggdrop1.6.19.new/src/modules.c 2008-09-22 12:09:57.119525901 +0200
+@@ -461,7 +461,7 @@ Function global_table[] = {
+ (Function) rem_tcl_coups,
+ (Function) botname,
+ /* 212 - 215 */
+- (Function) 0, /* remove_gunk() -- UNUSED! (drummer) */
++ (Function) check_topic,
+ (Function) check_tcl_chjn,
+ (Function) sanitycheck_dcc,
+ (Function) isowner,
+diff -burNp eggdrop1.6.19/src/patch.h eggdrop1.6.19.new/src/patch.h
+--- eggdrop1.6.19/src/patch.h 2008-04-19 06:21:20.000000000 +0200
++++ eggdrop1.6.19.new/src/patch.h 2008-09-22 12:11:00.141439071 +0200
+@@ -36,7 +36,7 @@
+ *
+ *
+ */
+-/* PATCH GOES HERE */
++patch("topicprot");
+ /*
+ *
+ *
+diff -burNp eggdrop1.6.19/src/proto.h eggdrop1.6.19.new/src/proto.h
+--- eggdrop1.6.19/src/proto.h 2008-02-16 22:41:04.000000000 +0100
++++ eggdrop1.6.19.new/src/proto.h 2008-09-22 12:12:19.684612158 +0200
+@@ -114,6 +114,7 @@ void check_timers();
+ void set_chanlist(const char *host, struct userrec *rec);
+ void clear_chanlist(void);
+ void clear_chanlist_member(const char *nick);
++void check_topic(struct chanset_t *);
+
+ /* cmds.c */
+ int check_dcc_attrs(struct userrec *, int);