[project @ 2002-07-28 22:17:32 by unknown_lamer]
authorunknown_lamer <unknown>
Sun, 28 Jul 2002 22:17:32 +0000 (22:17 +0000)
committerunknown_lamer <unknown>
Sun, 28 Jul 2002 22:17:32 +0000 (22:17 +0000)
A few things, there is now a bot:exit-hook that is a standard Guile
hook that is run when the bot shuts down. 2.1.0 was released, so I
bumped the version number in configure.ac to 2.1.1CVS.

12 files changed:
ChangeLog
Makefile.in
NEWS
README
TODO
bobot++.info
bobot++.texinfo
configure
configure.ac
source/Bot.C
source/Interp.C
source/Parser.C

index bb0ead5..0bf49d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-07-27  Clinton Ebadi  <clinton@unknownlamer.org>
+
+       * source/Interp.C (Shutdown): Runs bot:exit-hook hooks
+       (Startup): New var for Scheme: bot:exit-hook. Calls the thunks
+       associated with the hook when Interp::Shutdown is called (bot exit).
+
 2002-07-23  Clinton Ebadi  <clinton@unknownlamer.org>
 
        * source/BotInterp.H (Hook<): Changed behavior of Hook's <. If a
index 8b3acf9..e3d7835 100644 (file)
@@ -199,8 +199,9 @@ dist-info: $(INFO_DEPS)
        done
 
 mostlyclean-aminfo:
-       -rm -f bobot++.aux bobot++.cp bobot++.dvi bobot++.fn bobot++.ky bobot++.log \
-         bobot++.pg bobot++.ps bobot++.toc bobot++.tp bobot++.vr
+       -rm -f bobot++.aux bobot++.cp bobot++.cps bobot++.dvi bobot++.fn bobot++.fns \
+         bobot++.ky bobot++.log bobot++.pg bobot++.ps bobot++.toc \
+         bobot++.tp bobot++.vr bobot++.vrs
 
 maintainer-clean-aminfo:
        cd $(srcdir) && \
diff --git a/NEWS b/NEWS
index 0d44e29..1c8d68e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,14 +1,10 @@
-======================================================================
-====== This is a -*- text -*- file and ===============================
-====== User Visible Changes In Bobot++ ===============================
-======================================================================
+(-*- text -*-)
+User Visible Changes In Bobot++
 
-IMPORTANT NOTE:
-+====================================================================+
-| As of version 1.98 unknown_lamer is the new maintainer.            |
-| Also as of version 1.98, you must have Guile 1.5.6+ or 1.6.x in    |
-| order to compile scripting support.                                |
-+====================================================================+
+IMPORTANT NOTES: 
+  As of version 1.98 unknown_lamer is the new maintainer.  Also as of
+  version 1.98, you must have Guile 1.5.6+ or 1.6.x in order to
+  compile scripting support.
 
 =====================================================================
 ====== The News =====================================================
@@ -37,7 +33,7 @@ Version 2.1.0: Zug Zug
 - bobot-utils.scm is now autoloaded, so you don't need to
   load it if you want to use its functions.
 - Logs are now in ~/.bobotpp/logs/
-- bot-* procedures in Scheme are now bot:*. The onl bot-* functions
+- bot-* procedures in Scheme are now bot:*. The old bot-* functions
   are defined as aliases in bobot-utils.scm
 - You can now use lambda's for new commands (oops, I wasn't protecting
   the objects from garbage collection)
diff --git a/README b/README
index 9c27324..3886879 100644 (file)
--- a/README
+++ b/README
@@ -1,16 +1,28 @@
 THIS IS BOBOT++ VERSION 2.1 (this file is also -*- text -*-)
 
 This is the unstable tree. 2.0 is what you want to use if you don't
-want your scripts to break every other day.
+want your scripts to break every other day. Then again, I'm not
+updated this every day and so far the code is mostly backwards
+compatible. The biggest change is that all bot-* functions are not
+bot:*. A simple 'perl -pi -e s/bot-/bot:/g SCRIPT1 SCRIPT2 .. SCRIPTN'
+should be enough to update your scripts. The bot-* functions are
+defined as aliases for the bot:* functions in bobot-utils.scm, which
+is autoloaded by bobot++.
 
 The binary is now named bobotpp because of automake's choking on ++ in
-rule names. Make install isn't really needed because bobotpp reads
-it's config from the current dir. 2.1 will change this too.
+rule names. In order for the bot to work properly, you must 'make
+install' it so that bobot-utils.scm is installed and can be loaded for
+scripts to use.
 
 2.1 is not guaranteed to compile anywhere.
 
 Please read the doc in the "doc" directory.
-Also see bobot++.texinfo
+Also see bobot++.texinfo, which should be an ok set of docs on how to
+configure and use Bobot++, even if it is horribly incomplete. You
+should still read the old doc in the doc directory because it is more
+complete.
+
+bobotpp --help is also helpful.
 
 This program is distributed under the terms of the GNU General Public
 License version 2 or later. See the COPYING file for details.
diff --git a/TODO b/TODO
index 774f1de..a7409c0 100644 (file)
--- a/TODO
+++ b/TODO
@@ -20,6 +20,8 @@ Scripting:
 * Finish adding commands to Scheme for sending messages
    (e.g. bot:send-CTCP to send a CTCP message)
 * Add util functions for doing stuff like quoting CTCP messages
+* Call hooks/public when bot sends a privmsg to a channel (read IRC
+   protocol spec for other stuff that might need this)
 
 Networking:
 * Add a networked interface to guile repl
index f9b5eb3..7ee40b8 100644 (file)
@@ -139,6 +139,7 @@ should be enough to convert your code to use the new functions.
 * Hooks::
 * Scheme User Levels::
 * Sending Messages::
+* Misc Scripting Stuff::
 
 \1f
 File: bobot++.info,  Node: Adding New Commands,  Next: Hooks,  Prev: Scripting,  Up: Scripting
@@ -370,7 +371,7 @@ interface becomes more powerful, you must think more about what users
 can use new commands you add.
 
 \1f
-File: bobot++.info,  Node: Sending Messages,  Prev: Scheme User Levels,  Up: Scripting
+File: bobot++.info,  Node: Sending Messages,  Next: Misc Scripting Stuff,  Prev: Scheme User Levels,  Up: Scripting
 
 Sending Messages
 ================
@@ -413,6 +414,19 @@ before using these. If you have no idea what these do, read rfc 2812
      `bot:ctcp-quote' the message!
 
 
+\1f
+File: bobot++.info,  Node: Misc Scripting Stuff,  Prev: Sending Messages,  Up: Scripting
+
+Misc. Scripting Stuff
+=====================
+
+   These are a few useful things that I thought people writing scripts
+might want to know.
+
+   If you want to execute code when the bot exits, just do `add-hook!
+bot:exit-hook THUNK' where THUNK is an argumentless procedure (a
+thunk). When the bot exits your thunk will be called.
+
 \1f
 File: bobot++.info,  Node: Concept Index,  Next: Function Index,  Prev: Scripting,  Up: Top
 
@@ -478,16 +492,17 @@ Node: Configure File Placement\7f2025
 Node: Using the Bot\7f2499
 Node: User Levels\7f2673
 Node: Scripting\7f3677
-Node: Adding New Commands\7f4560
-Node: Hooks\7f5803
-Node: Creating a Hook\7f6741
-Node: Hook Types\7f7533
-Node: Scheme User Levels\7f10006
-Node: Sending Messages\7f11135
-Node: High Level Message Functions\7f11703
-Node: Low Level Message Functions\7f11921
-Node: Concept Index\7f12680
-Node: Function Index\7f12862
-Node: Variable Index\7f13123
+Node: Adding New Commands\7f4585
+Node: Hooks\7f5828
+Node: Creating a Hook\7f6766
+Node: Hook Types\7f7558
+Node: Scheme User Levels\7f10031
+Node: Sending Messages\7f11160
+Node: High Level Message Functions\7f11757
+Node: Low Level Message Functions\7f11975
+Node: Misc Scripting Stuff\7f12734
+Node: Concept Index\7f13153
+Node: Function Index\7f13335
+Node: Variable Index\7f13596
 \1f
 End Tag Table
index d8a9356..cdcfe01 100644 (file)
@@ -24,7 +24,7 @@ Texts.
 @author Clinton Ebadi
 
 @page
-@vskip Opt plus 1filll
+@c @vskip O plus 1filll
 Copyright @copyright{} 2002 Clinton Ebadi
 
 Permission is granted to copy, distribute and/or modify this document
@@ -147,6 +147,7 @@ convert your code to use the new functions.
 * Hooks::                       
 * Scheme User Levels::          
 * Sending Messages::            
+* Misc Scripting Stuff::        
 @end menu
 
 @node Adding New Commands, Hooks, Scripting, Scripting
@@ -543,7 +544,7 @@ lower level users because you can do basically everything the bot can
 do with a script. As the scripting interface becomes more powerful,
 you must think more about what users can use new commands you add.
 
-@node Sending Messages,  , Scheme User Levels, Scripting
+@node Sending Messages, Misc Scripting Stuff, Scheme User Levels, Scripting
 @section Sending Messages
 
 There are several types of messages you can send with Bobot++ from
@@ -582,6 +583,17 @@ command. Make sure to @code{bot:ctcp-quote} the message!
 
 @end itemize
 
+@node Misc Scripting Stuff,  , Sending Messages, Scripting
+@section Misc. Scripting Stuff
+
+These are a few useful things that I thought people writing scripts
+might want to know.
+
+If you want to execute code when the bot exits, just do
+@code{add-hook! bot:exit-hook @var{thunk}} where @var{thunk} is an
+argumentless procedure (a thunk). When the bot exits your thunk will
+be called.
+
 @node Concept Index, Function Index, Scripting, Top
 @unnumbered Concept Index
 @printindex cp
@@ -593,3 +605,5 @@ command. Make sure to @code{bot:ctcp-quote} the message!
 @node Variable Index,  , Function Index, Top
 @unnumbered Variable Index
 @printindex vr
+
+@bye
index 8277d04..5171506 100644 (file)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.53 for Bobot++ 2.1CVS.
+# Generated by GNU Autoconf 2.53 for Bobot++ 2.1.1CVS.
 #
 # Report bugs to <clinton@unknownlamer.org>.
 #
@@ -256,8 +256,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='Bobot++'
 PACKAGE_TARNAME='bobot--'
-PACKAGE_VERSION='2.1CVS'
-PACKAGE_STRING='Bobot++ 2.1CVS'
+PACKAGE_VERSION='2.1.1CVS'
+PACKAGE_STRING='Bobot++ 2.1.1CVS'
 PACKAGE_BUGREPORT='clinton@unknownlamer.org'
 
 # Factoring default headers for most tests.
@@ -769,7 +769,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Bobot++ 2.1CVS to adapt to many kinds of systems.
+\`configure' configures Bobot++ 2.1.1CVS to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -831,7 +831,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Bobot++ 2.1CVS:";;
+     short | recursive ) echo "Configuration of Bobot++ 2.1.1CVS:";;
    esac
   cat <<\_ACEOF
 
@@ -920,7 +920,7 @@ fi
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-Bobot++ configure 2.1CVS
+Bobot++ configure 2.1.1CVS
 generated by GNU Autoconf 2.53
 
 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
@@ -935,7 +935,7 @@ cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Bobot++ $as_me 2.1CVS, which was
+It was created by Bobot++ $as_me 2.1.1CVS, which was
 generated by GNU Autoconf 2.53.  Invocation command line was
 
   $ $0 $@
@@ -1500,7 +1500,7 @@ fi
 
 # Define the identity of the package.
 PACKAGE=Bobot++
-VERSION=2.1.0CVS
+VERSION=2.1.1CVS
 
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE "$PACKAGE"
@@ -4778,7 +4778,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by Bobot++ $as_me 2.1CVS, which was
+This file was extended by Bobot++ $as_me 2.1.1CVS, which was
 generated by GNU Autoconf 2.53.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4840,7 +4840,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-Bobot++ config.status 2.1CVS
+Bobot++ config.status 2.1.1CVS
 configured by $0, generated by GNU Autoconf 2.53,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -5933,7 +5933,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by Bobot++ $as_me 2.1CVS, which was
+This file was extended by Bobot++ $as_me 2.1.1CVS, which was
 generated by GNU Autoconf 2.53.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5995,7 +5995,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-Bobot++ config.status 2.1CVS
+Bobot++ config.status 2.1.1CVS
 configured by $0, generated by GNU Autoconf 2.53,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -7089,7 +7089,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by Bobot++ $as_me 2.1CVS, which was
+This file was extended by Bobot++ $as_me 2.1.1CVS, which was
 generated by GNU Autoconf 2.53.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -7151,7 +7151,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-Bobot++ config.status 2.1CVS
+Bobot++ config.status 2.1.1CVS
 configured by $0, generated by GNU Autoconf 2.53,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
index 47585d6..5ae57ba 100644 (file)
@@ -1,8 +1,8 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_PRERQ(2.50)
 dnl AC_INIT(source/Makefile.in)
-AC_INIT([Bobot++], [2.1CVS], [clinton@unknownlamer.org])
-AM_INIT_AUTOMAKE([Bobot++], [2.1.0CVS])
+AC_INIT([Bobot++], [2.1.1CVS], [clinton@unknownlamer.org])
+AM_INIT_AUTOMAKE([Bobot++], [2.1.1CVS])
 AM_CONFIG_HEADER(config.h)
 
 dnl Options
index 6852832..0a9f3b4 100644 (file)
@@ -17,6 +17,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
 
 #include <fstream>
+#include <algorithm>
 #include <iomanip>
 #include <cstring>
 #include <cstdlib>
@@ -667,7 +668,7 @@ namespace
 void
 Bot::destroy_user_functions ()
 {
-  for_each (userFunctions.begin (),
+  std::for_each (userFunctions.begin (),
            userFunctions.end (),
            erase_userf);
   userFunctions.erase (userFunctions.begin (),
index cba72d0..2443311 100644 (file)
@@ -49,7 +49,8 @@ scm_apply_wrapper(void *data)
 void
 Interp::Startup()
 {
-//  scm_primitive_load_path(scm_makfrom0str("ice-9/boot-9.scm"));
+  // Hooks
+  scm_c_define ("bot:exit-hook", scm_make_hook (scm_long2num (0)));
 
   // Symbols
   // bot:user-*
@@ -166,7 +167,9 @@ Interp::Startup()
 
 void
 Interp::Shutdown()
-{ }
+{ 
+  scm_c_run_hook (gh_lookup ("bot:exit-hook"), SCM_EOL);
+}
 
 void
 Interp::Execute(Bot *b, String command)
index 257f26c..8fae1f3 100644 (file)
@@ -880,180 +880,6 @@ Parser::parseCTCP (ServerConnection * cnx,
 #endif
 }
 
-// struct userFunctionsStruct userFunctionsInit[] = {
-//   {
-//    "ACTION", UserCommands::Action, User::USER, true}
-//   ,
-//   {
-//    "ADDUSER", UserCommands::AddUser, User::FRIEND, false}
-//   ,
-//   {
-//    "ADDSERVER", UserCommands::AddServer, User::FRIEND, false}
-//   ,
-//   {
-//    "ADDSHIT", UserCommands::AddShit, User::FRIEND, false}
-//   ,
-//   {
-//    "ALIAS", UserCommands::Alias, User::MASTER, false}
-//   ,
-//   {
-//    "BAN", UserCommands::Ban, User::USER, true}
-//   ,
-//   {
-//    "BANLIST", UserCommands::BanList, User::USER, true}
-//   ,
-//   //  { "CHANGELEVEL", UserCommands::ChangeLevel, User::FRIEND,       false },
-//   {
-//    "CHANNELS", UserCommands::Channels, User::FRIEND, false}
-//   ,
-//   {
-//    "CYCLE", UserCommands::Cycle, User::FRIEND, true}
-//   ,
-//   {
-//    "DCCLIST", UserCommands::DCCList, User::FRIEND, false}
-//   ,
-//   {
-//    "DEBAN", UserCommands::Deban, User::USER, true}
-//   ,
-//   {
-//    "DELSERVER", UserCommands::DelServer, User::FRIEND, false}
-//   ,
-//   {
-//    "DELUSER", UserCommands::DelUser, User::FRIEND, false}
-//   ,
-//   {
-//    "DELSHIT", UserCommands::DelShit, User::FRIEND, false}
-//   ,
-//   {
-//    "DEOP", UserCommands::Deop, User::TRUSTED_USER, true}
-//   ,
-//   {
-//    "DIE", UserCommands::Die, User::MASTER, false}
-//   ,
-//   {
-//    "DO", UserCommands::Do, User::MASTER, false}
-//   ,
-// #ifdef USESCRIPTS
-//   {
-//    "EXECUTE", UserCommands::Execute, User::MASTER, false}
-//   ,
-// #endif
-//   {
-//    "HELP", UserCommands::Help, User::NONE, false}
-//   ,
-//   {
-//    "IDENT", UserCommands::Ident, User::NONE, true}
-//   ,
-//   {
-//    "INVITE", UserCommands::Invite, User::USER, true}
-//   ,
-//   {
-//    "JOIN", UserCommands::Join, User::FRIEND, false}
-//   ,
-//   {
-//    "KEEP", UserCommands::Keep, User::FRIEND, true}
-//   ,
-//   {
-//    "KICK", UserCommands::Kick, User::USER, true}
-//   ,
-//   {
-//    "KICKBAN", UserCommands::KickBan, User::USER, true}
-//   ,
-//   {
-//    "LOAD", UserCommands::Load, User::FRIEND, false}
-//   ,
-// #ifdef USESCRIPTS
-//   {
-//    "LOADSCRIPT", UserCommands::LoadScript, User::MASTER, false}
-//   ,
-// #endif
-//   {
-//    "LOCK", UserCommands::Lock, User::FRIEND, true}
-//   ,
-//   {
-//    "MODE", UserCommands::Mode, User::FRIEND, true}
-//   ,
-//   {
-//    "MSG", UserCommands::Msg, User::USER, false}
-//   ,
-//   {
-//    "NAMES", UserCommands::Names, User::USER, true}
-//   ,
-//   {
-//    "NEXTSERVER", UserCommands::NextServer, User::FRIEND, false}
-//   ,
-//   {
-//    "NICK", UserCommands::Nick, User::FRIEND, false}
-//   ,
-//   {
-//    "NSLOOKUP", UserCommands::NsLookup, User::USER, false}
-//   ,
-//   {
-//    "OP", UserCommands::Op, User::TRUSTED_USER, true}
-//   ,
-//   {
-//    "PART", UserCommands::Part, User::FRIEND, true}
-//   ,
-//   {
-//    "PASSWORD", UserCommands::Password, User::USER, true}
-//   ,
-//   {
-//    "RECONNECT", UserCommands::Reconnect, User::FRIEND, false}
-//   ,
-//   {
-//    "RSPYMESSAGE", UserCommands::RSpyMessage, User::USER, false}
-//   ,
-//   {
-//    "SAVE", UserCommands::Save, User::FRIEND, false}
-//   ,
-//   {
-//    "SAY", UserCommands::Say, User::USER, true}
-//   ,
-//   {
-//    "SERVER", UserCommands::Server, User::FRIEND, false}
-//   ,
-//   {
-//    "SERVERLIST", UserCommands::ServerList, User::FRIEND, false}
-//   ,
-//   {
-//    "SETVERSION", UserCommands::SetVersion, User::MASTER, false}
-//   ,
-//   {
-//    "SHITLIST", UserCommands::ShitList, User::FRIEND, false}
-//   ,
-//   {
-//    "SPYLIST", UserCommands::SpyList, User::USER, false}
-//   ,
-//   {
-//    "SPYMESSAGE", UserCommands::SpyMessage, User::USER, false}
-//   ,
-//   {
-//    "STATS", UserCommands::Stats, User::FRIEND, true}
-//   ,
-//   {
-//    "TBAN", UserCommands::TBan, User::USER, true}
-//   ,
-//   {
-//    "TKBAN", UserCommands::TKBan, User::USER, true}
-//   ,
-//   {
-//    "TOPIC", UserCommands::Topic, User::USER, true}
-//   ,
-//   {
-//    "UNLOCK", UserCommands::Unlock, User::FRIEND, true}
-//   ,
-//   {
-//    "USERLIST", UserCommands::UserList, User::FRIEND, false}
-//   ,
-//   {
-//    "WHO", UserCommands::Who, User::NONE, true}
-//   ,
-//   {
-//    "WHOIS", UserCommands::Whois, User::FRIEND, true}
-//   ,
-//   {
-//    "", 0, 0, false}
-// };
 void
 Parser::parseMessage (ServerConnection * cnx,
                      Person * from, String to, String parameters)