[project @ 2005-07-07 21:19:26 by unknown_lamer]
authorunknown_lamer <unknown>
Thu, 7 Jul 2005 21:19:26 +0000 (21:19 +0000)
committerunknown_lamer <unknown>
Thu, 7 Jul 2005 21:19:26 +0000 (21:19 +0000)
Added bot:shit/ constants to Scheme, more documentation updates.

18 files changed:
ChangeLog
NEWS
README
TODO
bobot++.info
bobot++.texinfo
examples/bot.autoexec
examples/bot.conf
examples/bot.users
scripts/bobot-utils.scm
source/BotInterp.H
source/Interp.C
source/ScriptCommands.C
source/ServerQueue.C
source/ShitEntry.H
source/ShitList.C
source/ShitList.H
source/UserListItem.H

index 7d0c40f..f62cad7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,44 @@
+2005-07-07  Clinton Ebadi  <clinton@unknownlamer.org>
+
+       * bobot++.texinfo (Shit Levels): Added section
+       (Scheme User Levels): Removed Section
+       (Adding New Commands): Updated ref to Scheme User Levels to refer
+       to the User Levels section, and changed a @code{} into a @{var}
+       (Sending Messages): Rewrote section
+       (High Level Message Functions): Merged bot:say and bot:msg
+       sections
+       (bot.users): Expanded section
+       (bot.shit): Added section
+
+       * source/Interp.C (interp_init_helper): Added bot:shit/none
+       /no-ban, /no-kick, and /no-deop constants to Scheme
+
+       * scripts/bobot-utils.scm (bot:sent-to-me?): Redefined as a
+       closure (this should create the regexp once instead of each time
+       the function is called)
+
+       * examples/bot.autoexec: Updated sample bot.autoexec
+
+       * examples/bot.users: Updated sample bot.users
+
+       * examples/bot.conf: Updated sample config
+
 2005-07-06  Clinton Ebadi  <clinton@unknownlamer.org>
 
+       * bobot++.texinfo (Sent Message Hooks): Documented hooks/send/who
+       and hooks/send/whois
+
+       * source/ServerQueue.C (sendWho): Call hooks/send/who
+       (sendWhois): Call hooks/send/whois
+
+       * source/Interp.C (interp_init_helper): Added hooks/send/who and
+       hooks/send/whois constants to Scheme
+
+       * source/BotInterp.H: Added SEND_WHO and SEND_WHOIS hook constants
+
        * bobot++.texinfo (Misc Scripting Stuff): Documented bot:who and
        bot:whois
+       (bot.conf): Document MAXNICKLENGTH
 
        * source/Interp.C (interp_init_helper): Add bot:who and bot:whois
        bindings to Scheme
        (toUpper): Use Utils::to_upper
        (trim): Use Utils::trim_str
 
-       * source/String.H: removed srep, replaced it with a std::string (my_string)
+       * source/String.H: removed srep, replaced it with a std::string
+       (my_string)
 
        * source/Utils.C (to_upper): Applied patch from Jos Hulzink
        <josh@stack.nl>
diff --git a/NEWS b/NEWS
index 05acab9..05be989 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,15 +12,23 @@ IMPORTANT NOTES:
 
 Version 2.1.9:
 - Scripting
-  + hooks/disconnect now takes an additonal argument that specifies
-    whether the disconnect was intentional or not.
+  + Hooks  
+    * hooks/disconnect now takes an additonal argument that specifies
+      whether the disconnect was intentional or not.
+    * Added hooks/send/who
+    * Added hooks/send/whois
   + The deprecated scripting procedure and hook names are now in a
     `begin-deprecated' block. If your guile is built without
     deprecated feature support, they will not be available.
-  + RENAME: bot:send-ctcp was renamed to bot:ctcp
-  + RENAME: bot:send-ctcp-reply was renamed to bot:ctcp-reply
-  + Added bot:who function
-  + Added bot:whois function
+  + Renamed Functions
+    * bot:send-ctcp was renamed to bot:ctcp
+    * bot:send-ctcp-reply was renamed to bot:ctcp-reply
+  + New Functions
+    * bot:who (send WHO request)
+    * bot:whois (send WHOIS request)
+  + New Constants
+    * bot:shit/none, bot:shit/no-op, bot:shit/no-join,
+      bot:shit/no-deban shit list constants
 - Documention
   + Reorganized a few sections
   + Every hook is now documented
@@ -51,7 +59,7 @@ Version 2.1.8:
   + Debugging
     * The debugging evaluator is now enabled when --debug is passed to
       the bot
-    * New command line option: --debug-scripts enabled the debugging
+    * New command line option: --debug-scripts enables the debugging
       evaluator while running everything else normally
     * Merged error handling patch from Dale Smith. This adds detailed
       errors and backtraces when --debug/--debug-scripts is passed to
diff --git a/README b/README
index 82ce78f..bfdfb53 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-THIS IS BOBOT++ VERSION 2.1 (this file is also -*- text -*-)
+THIS IS BOBOT++ VERSION 2.2 (this file is also -*- text -*-)
 
 === REQUIREMENTS (Compile) === 
 
@@ -8,12 +8,10 @@ for scripting. It is optional and may be disabled by passing
 
 === BACKGROUND ===
 
-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. The Scheme interface is
-going to remain essentially the same, but the config system and
-internal structure of the bot are very different.
+This is the new stable. Upgrading from 2.0 is recommended, especially
+if you use the scripting interface.
 
-=== BIG CHANGES FROM STABLE ===
+=== BIG CHANGES FROM 2.0 ===
 
 The biggest change is that all bot-* functions are now
 bot:*. A simple 'perl -pi -e s/bot-/bot:/g SCRIPT1 SCRIPT2 .. SCRIPTN'
@@ -28,16 +26,17 @@ scripts to use (unless you have Guile disabled).
 
 === IMPORTANT NOTES ===
 
-*** 2.1 is not guaranteed to compile anywhere. ***
-(But PLEASE email me if it doesn't!)
+2.2 should compile on GNU/Linux and FreeBSD. There are some
+compatibility hacks for HP/UX, but they may not works as I don't have
+access to an HP/UX machine. I'm not sure if it builds on other
+systems, if it does please email me. If it doesn't, please email so I
+can fix it.
 
 === DOCUMENTATION ===
 
-Please read the doc in the "doc" directory.
-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.
+There is a texinfo manual. It should be complete. "info bobot++" to
+read it. It has sections on configuring, running, and scripting the
+bot. Suggestions are welcome.
 
 bobotpp --help is also helpful.
 
@@ -48,4 +47,5 @@ License version 2 or later. See the COPYING file for details.
 
 === CONTACT INFO ===
 
-Clinton Ebadi <clinton@unknownlamer.org> (Maintainer)
\ No newline at end of file
+Clinton Ebadi <clinton@unknownlamer.org> (Maintainer)
+Official IRC Channel: #bobotpp on freenode
\ No newline at end of file
diff --git a/TODO b/TODO
index 99aaada..49085ef 100644 (file)
--- a/TODO
+++ b/TODO
@@ -10,12 +10,13 @@ Done (2.2):
 * More detailed script error reporting
 * Commands::sendCTCP, Commands::sendCTCPReply
 * Add DCC_CHAT_END hook for Scheme
-* Finish adding commands to Scheme for sending messages
-* Finish adding hooks/send hooks
+* Implement ctcp-quote
 
 2.2:
 * Finish Texinfo manual
-* Add util functions for doing stuff like quoting CTCP messages
+* Implement ctcp-unquote
+* Finish adding commands to Scheme for sending messages
+* Finish adding hooks/send hooks
 
 2.4: 
 * Use configuration database class
@@ -23,6 +24,7 @@ Done (2.2):
 * Add !setcommandlevel (move ScriptCommands implementation to Commands
   and add a UserCommands)
 * Improve the help system
+* Enhance the scripting layer
 
 2.4/3.0 (2.4 iff backwards compatibility is maintained, 3.0 otherwise):
 General:
index d86aa0b..909b3ae 100644 (file)
@@ -49,6 +49,7 @@ Configuration Files
 
 * bot.conf::
 * bot.users::
+* bot.shit::
 
 bot.conf
 
@@ -61,13 +62,13 @@ Using Bobot++
 * User Levels::
 * Protection::
 * Automatic Op::
+* Shit Levels::
 * Built-In Commands::
 
 Scripting
 
 * Adding New Commands::
 * Hooks::
-* Scheme User Levels::
 * Sending Messages::
 * Misc Scripting Stuff::
 
@@ -94,7 +95,11 @@ File: bobot++.info,  Node: Introduction,  Next: Configuration,  Prev: Top,  Up:
 1 Introduction
 **************
 
-This manual feels abused and neglected because it has almost no content.
+Bobot++ is a powerful IRC bot written in C++. It can be used standalone
+as a channel maintenence bot, or extended to do almost anything using
+Scheme scripts.
+
+   FIXME: Fill the intro in more?
 
 \1f
 File: bobot++.info,  Node: Configuration,  Next: Using the Bot,  Prev: Introduction,  Up: Top
@@ -136,6 +141,7 @@ File: bobot++.info,  Node: Configuration Files,  Prev: Configuration File Placem
 
 * bot.conf::
 * bot.users::
+* bot.shit::
 
 \1f
 File: bobot++.info,  Node: bot.conf,  Next: bot.users,  Prev: Configuration Files,  Up: Configuration Files
@@ -163,6 +169,12 @@ their own subsections.
 * server syntax::
 * channel syntax::
 
+   * MAXNICKLENGTH <9>: The maximum length a valid nickname may be.
+     This should be set before setting the bot's nickname if it will be
+     more than nine characters long. Most IRC servers support nicknames
+     longer than nine characters, but Bobot++ still follows the old spec
+     and defaults to nine.
+
    * NICKNAME <Bobot>: The nickname of the bot (NICK is an alias for
      NICKNAME)
 
@@ -243,20 +255,24 @@ maintain the modes `nt'.
 attempt to maintain any modes.
 
 \1f
-File: bobot++.info,  Node: bot.users,  Prev: bot.conf,  Up: Configuration Files
+File: bobot++.info,  Node: bot.users,  Next: bot.shit,  Prev: bot.conf,  Up: Configuration Files
 
-2.2.2 bot.users
----------------
+2.2.2 bot.users (User List)
+---------------------------
 
 `bot.users' is the default file name of the userlist. It may be changed
-in `bot.conf'. The file contains lines with the format:
+in `bot.conf'. You must add an entry for yourself manually. You will
+probably want to add other entries using the IRC command interface as
+it is more intuitive than editing the file by hand.
+
+   The file contains lines with the format:
 
-   `MASK:CHANNEL:LEVEL:PROTECTION:AUTO-OP'
+   `HOST_MASK:CHANNEL_MASK:LEVEL:PROTECTION:AUTO-OP:EXPIRATION:PASSWORD'
 
-   * MASK is the host mask (e.g. `*!*username
+   * HOST_MASK is the host mask (e.g. `*!*username
      .domain.com') of the user
 
-   * CHANNEL is a channel mask of the channels that the user has
+   * CHANNEL_MASK is a channel mask of the channels that the user has
      priviliges to use the bot in (e.g. `*' for all channels, `#*' for
      all non-local channel, `#foo*' for all channels starting with
      "foo," `#bar' for channel "#bar" only, etc.)
@@ -269,6 +285,46 @@ in `bot.conf'. The file contains lines with the format:
    * AUTO-OP is set to control whether a user is automatically given
      operator priviliges on channel entry (*Note Automatic Op::).
 
+   * EXPIRATION is the UNIX timestamp of when the user entry becomes
+     invalid. Setting this to -1 will make the entry permanent.
+
+   * PASSWORD is the password the user must supply to the bot to
+     authenticate. This can be set to `*NONE*' to not have a password.
+
+
+\1f
+File: bobot++.info,  Node: bot.shit,  Prev: bot.users,  Up: Configuration Files
+
+2.2.3 bot.shit (Ban/Shit List)
+------------------------------
+
+This file stores the ban list. The name may be changed in `bot.conf'.
+You will most likely want to use the IRC command interface to edit this
+file instead of editing it directly.
+
+   The file contains lines in the form:
+
+   `HOST_MASK:CHANNEL_MASK:LEVEL:EXPIRATION:REASON'
+
+   * HOST_MASK is the host mask (e.g. `*!*username
+     .domain.com') of the user
+
+   * CHANNEL_MASK is a channel mask of the channels that the user is
+     banned on (e.g. `*' for all channels, `#*' for all non-local
+     channel, `#foo*' for all channels starting with "foo," `#bar' for
+     channel "#bar" only, etc.
+
+   * LEVEL is a number specifying if the bot should not allow the user
+     to gain ops, to kick the user upon joining, or to prevent the user
+     from being debanned by other users. *Note Shit Levels:: for
+     information on the available levels.
+
+   * EXPIRATION is the UNIX timestamp of when the shit entry becomes
+     invalid. This may be set to -1 to make it valid forever.
+
+   * REASON is text that is sent to the user when they are kicked or
+     banned from the channel.
+
 
 \1f
 File: bobot++.info,  Node: Using the Bot,  Next: Scripting,  Prev: Configuration,  Up: Top
@@ -284,6 +340,7 @@ FIXME: stuff here...
 * User Levels::
 * Protection::
 * Automatic Op::
+* Shit Levels::
 * Built-In Commands::
 
 \1f
@@ -319,7 +376,7 @@ the following command line arguments.
    * `[--debug][-D]' Makes Bobot++ print debugging info and run in the
      foreground
 
-   * `[--debug-scripts][-S]' Enabled the Guile debugging evaluator for
+   * `[--debug-scripts][-S]' Enables the Guile debugging evaluator for
      verbose script errors and backtraces while still running the bot
      in the background.
 
@@ -385,7 +442,7 @@ commands use the numeric codes, Scheme uses the symbolic names.
      user always maintains operator status.
 
 \1f
-File: bobot++.info,  Node: Automatic Op,  Next: Built-In Commands,  Prev: Protection,  Up: Using the Bot
+File: bobot++.info,  Node: Automatic Op,  Next: Shit Levels,  Prev: Protection,  Up: Using the Bot
 
 3.4 Automatic Op
 ================
@@ -399,9 +456,31 @@ IRC commands use the numeric value.
   1. `bot:aop/yes' Do automatically op the user
 
 \1f
-File: bobot++.info,  Node: Built-In Commands,  Prev: Automatic Op,  Up: Using the Bot
+File: bobot++.info,  Node: Shit Levels,  Next: Built-In Commands,  Prev: Automatic Op,  Up: Using the Bot
 
-3.5 Built-In Commands
+3.5 Shit Levels
+===============
+
+The shit list and shit list related commands use different levels to
+define how much the bot hates a user. Scheme uses the symbolic names,
+the shit list and IRC commands use the numbers.
+
+  0. `bot:shit/none' The bot doesn't hate the user (this is the normal
+     level)
+
+  1. `bot:shit/no-op' The bot will deop the user any time he gains
+     operator priviliges in the channel
+
+  2. `bot:shit/no-join' The bot will kick and ban the user when he
+     joins the channel
+
+  3. `bot:shit/no-deban' The bot will kick and ban usre when he joins
+     the channel, and will prevent other users from debanning him.
+
+\1f
+File: bobot++.info,  Node: Built-In Commands,  Prev: Shit Levels,  Up: Using the Bot
+
+3.6 Built-In Commands
 =====================
 
 Bobot++ has many built-in commands that make it useful without
@@ -541,7 +620,6 @@ strings unless otherwise specified.
 
 * Adding New Commands::
 * Hooks::
-* Scheme User Levels::
 * Sending Messages::
 * Misc Scripting Stuff::
 
@@ -561,11 +639,11 @@ Adding a new command is simple. To register a new command use
      NEEDS-CHANNEL? is a bool that is true if the function needs the
      channel name as its first arg, and false otherwise.  NUM-OF-ARGS
      is the number of args FUNC will take and must be within zero (0)
-     and twenty (20).  MIN-LEVEL is one of the *Note Scheme User
-     Levels::.  A user must be at least a `min-level' user to use the
-     new command.  None of the arguments are guaranteed to be passed;
-     if they aren't they are set to the empty string `""'.  An example
-     of a new command would be:
+     and twenty (20).  MIN-LEVEL is one of the *Note User Levels::.  A
+     user must be at least a MIN-LEVEL user to use the new command.
+     None of the arguments are guaranteed to be passed; if they aren't
+     they are set to the empty string `""'.  An example of a new
+     command would be:
 
           (define (hello channel name)
             (if (string=? name "")
@@ -578,7 +656,7 @@ Adding a new command is simple. To register a new command use
      World USER" if called as `!hello USER'.
 
 \1f
-File: bobot++.info,  Node: Hooks,  Next: Scheme User Levels,  Prev: Adding New Commands,  Up: Scripting
+File: bobot++.info,  Node: Hooks,  Next: Sending Messages,  Prev: Adding New Commands,  Up: Scripting
 
 4.2 Hooks
 =========
@@ -859,6 +937,20 @@ the bot's nick and will not be documented in each hook description.
 
      MESSAGE is a string containing the arguments to the CTCP command.
 
+ -- Function: hooks/send/who who
+     This is called when the bot sends a WHO message. The regex is
+     matched on WHO, which is also passed as the only argument to your
+     function.
+
+     WHO is the channel or nick that was WHOed.
+
+ -- Function: hooks/send/whois nick
+     This is called when the bot sends a WHOIS message. The regex is
+     matched on NICK, which is also passed as the only argument to your
+     function.
+
+     NICK is the nickname of the person who was WHOISed.
+
 \1f
 File: bobot++.info,  Node: DCC CHAT Hooks,  Next: Miscellaneous Hooks,  Prev: Sent Message Hooks,  Up: Hook Types
 
@@ -905,40 +997,16 @@ File: bobot++.info,  Node: Miscellaneous Hooks,  Prev: DCC CHAT Hooks,  Up: Hook
      TIME is the in zero-padded `hh:mm' format.
 
 \1f
-File: bobot++.info,  Node: Scheme User Levels,  Next: Sending Messages,  Prev: Hooks,  Up: Scripting
-
-4.3 Scheme User Levels
-======================
-
-There are five levels that a user may be when interfacing with a bot:
-NONE, USER, TRUSTED_USER, FRIEND, MASTER. The Scheme variables for the
-user levels are `bot:user-none', `bot:user-user', `bot:user-trusted',
-`bot:user-friend', and `bot:user-master'. See *Note User Levels:: for
-more information on User Levels.
-
-   When adding a new command, think about who should be able to use it.
-Is your command a general purpose command that helps the channel (e.g.
-`!seen') that everyone should be able to use? Or is it something that
-should be restricted? See *Note User Levels:: for information on what
-level users can do what with the built in bot commands and think about
-what level a user your command is targetted towards. You must be _very_
-careful when giving new commands to 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.
+File: bobot++.info,  Node: Sending Messages,  Next: Misc Scripting Stuff,  Prev: Hooks,  Up: Scripting
 
-\1f
-File: bobot++.info,  Node: Sending Messages,  Next: Misc Scripting Stuff,  Prev: Scheme User Levels,  Up: Scripting
-
-4.4 Sending Messages
+4.3 Sending Messages
 ====================
 
 There are several types of messages you can send with Bobot++ from
-scripts. There is the simple, but rather limited, `bot:say',
-`bot:action' and `bot:msg', and the more powerful, but lower level,
-`bot:send-MESSAGE' functions. Most bots will probably only need the
-higher level functions, but for the sake of why-not Bobot++ lets you
-use the lower level functions (in progress).
+scripts. They are split into High and Low level message sending
+functions. Most bots will only use the high level functions, but the
+low level ones are provided for when a bot needs to do things like send
+raw IRC messages or CTCP commands.
 
 * Menu:
 
@@ -948,7 +1016,7 @@ use the lower level functions (in progress).
 \1f
 File: bobot++.info,  Node: High Level Message Functions,  Next: Low Level Message Functions,  Prev: Sending Messages,  Up: Sending Messages
 
-4.4.1 "High Level" Message Functions
+4.3.1 "High Level" Message Functions
 ------------------------------------
 
  -- Function: bot:say channel message
@@ -960,18 +1028,25 @@ File: bobot++.info,  Node: High Level Message Functions,  Next: Low Level Messag
  -- Function: bot:action channel message
      Send an "action" type  MESSAGE to CHANNEL
 
- -- Function: bot:msg nick message
-     The same as if a user typed `/msg nick message' to their IRC
-     client.
+ -- Function: bot:msg target message
+ -- Function: bot:say target message
+     Send a public or private message to TARGET.
+
+     TARGET may be a channel or a nickname.
+
+     In versions of Bobot++ prior to 2.1.8 `bot:say' could only send to
+     channels, and `bot:msg' could only send private messages to users.
+     They are aliases of the same command now, but it may be worth
+     using them as they used to for clarity.
 
  -- Function: bot:notice target message
      Sends MESSAGE as a NOTICE to TARGET. TARGET may be a user (nick)
-     or a channel. This returns 0 on success.
+     or a channel.
 
 \1f
 File: bobot++.info,  Node: Low Level Message Functions,  Prev: High Level Message Functions,  Up: Sending Messages
 
-4.4.2 "Low Level" Message Functions
+4.3.2 "Low Level" Message Functions
 -----------------------------------
 
 The "Low Level" messaging functions allow you to do things like send
@@ -995,7 +1070,7 @@ before using these. If you have no idea what these do, read rfc 2812
 \1f
 File: bobot++.info,  Node: Misc Scripting Stuff,  Prev: Sending Messages,  Up: Scripting
 
-4.5 Misc. Scripting Stuff
+4.4 Misc. Scripting Stuff
 =========================
 
 These are a few useful things that I thought people writing scripts
@@ -1316,7 +1391,7 @@ Function Index
 * bot:nick:                              Misc Scripting Stuff.
                                                               (line 114)
 * bot:notice:                            High Level Message Functions.
-                                                              (line  20)
+                                                              (line  27)
 * bot:op:                                Misc Scripting Stuff.
                                                               (line 117)
 * bot:part:                              Misc Scripting Stuff.
@@ -1387,6 +1462,8 @@ Function Index
 * hooks/send/ctcp:                       Sent Message Hooks.  (line  33)
 * hooks/send/message:                    Sent Message Hooks.  (line  18)
 * hooks/send/public:                     Sent Message Hooks.  (line  10)
+* hooks/send/who:                        Sent Message Hooks.  (line  43)
+* hooks/send/whois:                      Sent Message Hooks.  (line  50)
 * hooks/signoff:                         Received Message Hooks.
                                                               (line  24)
 * hooks/timer:                           Miscellaneous Hooks. (line  12)
@@ -1406,46 +1483,42 @@ Variable Index
                                                               (line 212)
 * exit-hook:                             Misc Scripting Stuff.
                                                               (line   9)
-* user-friend:                           Scheme User Levels.  (line   6)
-* user-master:                           Scheme User Levels.  (line   6)
-* user-none:                             Scheme User Levels.  (line   6)
-* user-trusted:                          Scheme User Levels.  (line   6)
-* user-user:                             Scheme User Levels.  (line   6)
 
 
 \1f
 Tag Table:
 Node: Top\7f538
-Node: Introduction\7f1948
-Node: Configuration\7f2140
-Node: Configuration File Placement\7f2584
-Node: Configuration Files\7f3085
-Node: bot.conf\7f3278
-Node: server syntax\7f4885
-Node: channel syntax\7f5683
-Node: bot.users\7f6727
-Node: Using the Bot\7f7630
-Node: Starting the Bot\7f7880
-Node: User Levels\7f9389
-Node: Protection\7f10777
-Node: Automatic Op\7f11495
-Node: Built-In Commands\7f11914
-Node: Scripting\7f18893
-Node: Adding New Commands\7f19965
-Node: Hooks\7f21286
-Node: Creating a Hook\7f22126
-Node: Hook Types\7f23332
-Node: Received Message Hooks\7f23896
-Node: Sent Message Hooks\7f29123
-Node: DCC CHAT Hooks\7f30520
-Node: Miscellaneous Hooks\7f31560
-Node: Scheme User Levels\7f32009
-Node: Sending Messages\7f33143
-Node: High Level Message Functions\7f33759
-Node: Low Level Message Functions\7f34539
-Node: Misc Scripting Stuff\7f35592
-Node: Concept Index\7f42417
-Node: Function Index\7f42636
-Node: Variable Index\7f54144
+Node: Introduction\7f1954
+Node: Configuration\7f2266
+Node: Configuration File Placement\7f2710
+Node: Configuration Files\7f3211
+Node: bot.conf\7f3417
+Node: server syntax\7f5337
+Node: channel syntax\7f6135
+Node: bot.users\7f7179
+Node: bot.shit\7f8614
+Node: Using the Bot\7f9839
+Node: Starting the Bot\7f10105
+Node: User Levels\7f11614
+Node: Protection\7f13002
+Node: Automatic Op\7f13720
+Node: Shit Levels\7f14133
+Node: Built-In Commands\7f14884
+Node: Scripting\7f21862
+Node: Adding New Commands\7f22911
+Node: Hooks\7f24222
+Node: Creating a Hook\7f25060
+Node: Hook Types\7f26266
+Node: Received Message Hooks\7f26830
+Node: Sent Message Hooks\7f32057
+Node: DCC CHAT Hooks\7f33941
+Node: Miscellaneous Hooks\7f34981
+Node: Sending Messages\7f35430
+Node: High Level Message Functions\7f35962
+Node: Low Level Message Functions\7f37026
+Node: Misc Scripting Stuff\7f38079
+Node: Concept Index\7f44904
+Node: Function Index\7f45123
+Node: Variable Index\7f56777
 \1f
 End Tag Table
index 1455e81..abc834e 100644 (file)
@@ -75,6 +75,7 @@ Configuration Files
 
 * bot.conf::                    
 * bot.users::                   
+* bot.shit::                    
 
 bot.conf
 
@@ -87,13 +88,13 @@ Using Bobot++
 * User Levels::                 
 * Protection::                  
 * Automatic Op::                
+* Shit Levels::                 
 * Built-In Commands::           
 
 Scripting
 
 * Adding New Commands::         
 * Hooks::                       
-* Scheme User Levels::          
 * Sending Messages::            
 * Misc Scripting Stuff::        
 
@@ -120,8 +121,11 @@ Sending Messages
 @node Introduction, Configuration, Top, Top
 @chapter Introduction
 
-This manual feels abused and neglected because it has almost no
-content.
+Bobot++ is a powerful IRC bot written in C++. It can be used
+standalone as a channel maintenence bot, or extended to do almost
+anything using Scheme scripts.
+
+FIXME: Fill the intro in more?
 
 @node Configuration, Using the Bot, Introduction, Top
 @chapter Configuration
@@ -153,6 +157,7 @@ in @file{~/.bobotpp/config/default/}.
 @menu
 * bot.conf::                    
 * bot.users::                   
+* bot.shit::                    
 @end menu
 
 @node bot.conf, bot.users, Configuration Files, Configuration Files
@@ -180,6 +185,11 @@ their own subsections.
 
 @itemize @bullet
 
+@item @var{maxnicklength} <9>: The maximum length a valid nickname may
+be. This should be set before setting the bot's nickname if it will be
+more than nine characters long. Most IRC servers support nicknames
+longer than nine characters, but Bobot++ still follows the old spec
+and defaults to nine.
 @item @var{nickname} <Bobot>: The nickname of the bot (@var{nick} is an
 alias for @var{nickname})
 @item @var{username} <bobot>: The IRC username of the bot
@@ -256,20 +266,25 @@ then maintain the modes @code{nt}.
 The bot will join @code{#bar} and will not set any modes nor will it
 attempt to maintain any modes.
 
-@node bot.users,  , bot.conf, Configuration Files
-@subsection bot.users
+@node bot.users, bot.shit, bot.conf, Configuration Files
+@subsection bot.users (User List)
 
 @file{bot.users} is the default file name of the userlist. It may be
-changed in @file{bot.conf}. The file contains lines with the format:
+changed in @file{bot.conf}. You must add an entry for yourself
+manually. You will probably want to add other entries using the IRC
+command interface as it is more intuitive than editing the file by
+hand.
+
+The file contains lines with the format:
 
-@samp{@var{mask}:@var{channel}:@var{level}:@var{protection}:@var{auto-op}}
+@samp{@var{host_mask}:@var{channel_mask}:@var{level}:@var{protection}:@var{auto-op}:@var{expiration}:@var{password}}
 
 @itemize
 
-@item @var{mask} is the host mask
+@item @var{host_mask} is the host mask
 (e.g. @samp{*!*username@*.domain.com}) of the user
 
-@item @var{channel} is a channel mask of the channels that the user
+@item @var{channel_mask} is a channel mask of the channels that the user
 has priviliges to use the bot in (e.g. @samp{*} for all channels,
 @samp{#*} for all non-local channel, @samp{#foo*} for all channels
 starting with ``foo,'' @samp{#bar} for channel ``#bar'' only, etc.)
@@ -282,6 +297,46 @@ starting with ``foo,'' @samp{#bar} for channel ``#bar'' only, etc.)
 @item @var{auto-op} is set to control whether a user is automatically
 given operator priviliges on channel entry (@ref{Automatic Op}).
 
+@item @var{expiration} is the UNIX timestamp of when the user entry
+becomes invalid. Setting this to -1 will make the entry permanent.
+
+@item @var{password} is the password the user must supply to the bot
+to authenticate. This can be set to @code{*NONE*} to not have a password.
+
+@end itemize
+
+@node bot.shit,  , bot.users, Configuration Files
+@subsection bot.shit (Ban/Shit List)
+
+This file stores the ban list. The name may be changed in
+@file{bot.conf}. You will most likely want to use the IRC command
+interface to edit this file instead of editing it directly.
+
+The file contains lines in the form:
+
+@samp{@var{host_mask}:@var{channel_mask}:@var{level}:@var{expiration}:@var{reason}}
+
+@itemize
+
+@item @var{host_mask} is the host mask
+(e.g. @samp{*!*username@*.domain.com}) of the user
+
+@item @var{channel_mask} is a channel mask of the channels that the user
+is banned on (e.g. @samp{*} for all channels,
+@samp{#*} for all non-local channel, @samp{#foo*} for all channels
+starting with ``foo,'' @samp{#bar} for channel ``#bar'' only, etc.
+
+@item @var{level} is a number specifying if the bot should not allow
+the user to gain ops, to kick the user upon joining, or to prevent the
+user from being debanned by other users. @ref{Shit Levels} for
+information on the available levels.
+
+@item @var{expiration} is the UNIX timestamp of when the shit entry
+becomes invalid. This may be set to -1 to make it valid forever.
+
+@item @var{reason} is text that is sent to the user when they are
+kicked or banned from the channel.
+
 @end itemize
 
 @node Using the Bot, Scripting, Configuration, Top
@@ -294,6 +349,7 @@ FIXME: stuff here...
 * User Levels::                 
 * Protection::                  
 * Automatic Op::                
+* Shit Levels::                 
 * Built-In Commands::           
 @end menu
 
@@ -320,7 +376,7 @@ first
 still searched after this if dir is not found.
 @item @code{[--debug][-D]} Makes Bobot++ print debugging info and run
 in the foreground
-@item @code{[--debug-scripts][-S]} Enabled the Guile debugging
+@item @code{[--debug-scripts][-S]} Enables the Guile debugging
 evaluator for verbose script errors and backtraces while still running
 the bot in the background.
 @end itemize
@@ -382,7 +438,7 @@ the user who kicked the protected user.
 operator status.
 @end enumerate
 
-@node Automatic Op, Built-In Commands, Protection, Using the Bot
+@node Automatic Op, Shit Levels, Protection, Using the Bot
 @section Automatic Op
 
 A user may be automatically given operator status upon entering a
@@ -394,7 +450,25 @@ channel. Scheme uses the symbolic name, the user list
 @item @code{bot:aop/yes} Do automatically op the user
 @end enumerate
 
-@node Built-In Commands,  , Automatic Op, Using the Bot
+@node Shit Levels, Built-In Commands, Automatic Op, Using the Bot
+@section Shit Levels
+
+The shit list and shit list related commands use different levels to
+define how much the bot hates a user. Scheme uses the symbolic names,
+the shit list and IRC commands use the numbers.
+
+@enumerate 0
+@item @code{bot:shit/none} The bot doesn't hate the user (this is the
+normal level)
+@item @code{bot:shit/no-op} The bot will deop the user any time he
+gains operator priviliges in the channel
+@item @code{bot:shit/no-join} The bot will kick and ban the user when he
+joins the channel
+@item @code{bot:shit/no-deban} The bot will kick and ban usre when he
+joins the channel, and will prevent other users from debanning him.
+@end enumerate
+
+@node Built-In Commands,  , Shit Levels, Using the Bot
 @section Built-In Commands
 
 Bobot++ has many built-in commands that make it useful without
@@ -587,7 +661,6 @@ are strings unless otherwise specified.
 @menu
 * Adding New Commands::         
 * Hooks::                       
-* Scheme User Levels::          
 * Sending Messages::            
 * Misc Scripting Stuff::        
 @end menu
@@ -606,10 +679,10 @@ arguments. @var{needs-channel?} is a bool that is true if the function
 needs the channel name as its first arg, and false otherwise.
 @var{num-of-args} is the number of args @var{func} will take and must
 be within zero (0) and twenty (20).  @var{min-level} is one of the
-@ref{Scheme User Levels}.  A user must be at least a @code{min-level}
-user to use the new command.  None of the arguments are guaranteed to
-be passed; if they aren't they are set to the empty string @code{""}.
-An example of a new command would be:
+@ref{User Levels}.  A user must be at least a @var{min-level} user to
+use the new command.  None of the arguments are guaranteed to be
+passed; if they aren't they are set to the empty string @code{""}.  An
+example of a new command would be:
 
 @example
 (define (hello channel name)
@@ -624,7 +697,7 @@ This will display ``Hello World!'' if called as @kbd{!hello} and
 ``Hello World @var{USER}'' if called as @kbd{!hello @var{USER}}.
 @end defun
 
-@node Hooks, Scheme User Levels, Adding New Commands, Scripting
+@node Hooks, Sending Messages, Adding New Commands, Scripting
 @section Hooks
 
 @cindex Background on Hooks
@@ -918,6 +991,22 @@ sent.
 @var{message} is a string containing the arguments to the CTCP command.
 @end defun
 
+@defun hooks/send/who who
+This is called when the bot sends a WHO message. The regex is matched
+on @var{who}, which is also passed as the only argument to your
+function.
+
+@var{who} is the channel or nick that was WHOed.
+@end defun
+
+@defun hooks/send/whois nick
+This is called when the bot sends a WHOIS message. The regex is
+matched on @var{nick}, which is also passed as the only argument to
+your function.
+
+@var{nick} is the nickname of the person who was WHOISed.
+@end defun
+
 @node DCC CHAT Hooks, Miscellaneous Hooks, Sent Message Hooks, Hook Types
 @subsubsection DCC CHAT Hooks
 
@@ -962,41 +1051,15 @@ This hook is called once a minute. The regex is @strong{not} used.
 @var{time} is the in zero-padded @code{hh:mm} format.
 @end defun
 
-@node Scheme User Levels, Sending Messages, Hooks, Scripting
-@section Scheme User Levels
-
-@vindex user-none
-@vindex user-user
-@vindex user-trusted
-@vindex user-friend
-@vindex user-master
-There are five levels that a user may be when interfacing with a bot:
-@var{none}, @var{user}, @var{trusted_user}, @var{friend},
-@var{master}. The Scheme variables for the user levels are
-@code{bot:user-none}, @code{bot:user-user}, @code{bot:user-trusted},
-@code{bot:user-friend}, and @code{bot:user-master}. See @ref{User
-Levels} for more information on User Levels. 
-
-When adding a new command, think about who should be able to use
-it. Is your command a general purpose command that helps the channel
-(e.g. @code{!seen}) that everyone should be able to use? Or is it
-something that should be restricted? See @ref{User Levels} for
-information on what level users can do what with the built in bot
-commands and think about what level a user your command is targetted
-towards. You must be @emph{very} careful when giving new commands to
-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, Misc Scripting Stuff, Scheme User Levels, Scripting
+
+@node Sending Messages, Misc Scripting Stuff, Hooks, Scripting
 @section Sending Messages
 
 There are several types of messages you can send with Bobot++ from
-scripts. There is the simple, but rather limited, @code{bot:say},
-@code{bot:action} and @code{bot:msg}, and the more powerful, but lower
-level, @code{bot:send-MESSAGE} functions. Most bots will probably only
-need the higher level functions, but for the sake of why-not Bobot++
-lets you use the lower level functions (in progress).
+scripts. They are split into High and Low level message sending
+functions. Most bots will only use the high level functions, but the
+low level ones are provided for when a bot needs to do things like
+send raw IRC messages or CTCP commands.
 
 @menu
 * High Level Message Functions::  
@@ -1017,13 +1080,22 @@ Sends a normal text message, as if a user had typed it in.  The
 Send an ``action'' type  @var{message} to @var{channel}
 @end defun
 
-@defun bot:msg nick message
-The same as if a user typed @code{/msg nick message} to their IRC client.
+
+@defun bot:msg target message
+@defunx bot:say target message
+Send a public or private message to @var{target}.
+
+@var{target} may be a channel or a nickname. 
+
+In versions of Bobot++ prior to 2.1.8 @code{bot:say} could only send
+to channels, and @code{bot:msg} could only send private messages to
+users. They are aliases of the same command now, but it may be worth
+using them as they used to for clarity.
 @end defun
 
 @defun bot:notice target message
 Sends @var{message} as a NOTICE to @var{target}. @var{target} may be a
-user (nick) or a channel. This returns 0 on success.
+user (nick) or a channel.
 @end defun
 
 @node Low Level Message Functions,  , High Level Message Functions, Sending Messages
index 408d4d2..8fa3329 100644 (file)
@@ -1,4 +1,4 @@
-; -*- guile-scheme -*-
+;;; -*- scheme -*-
 
 ;;; Loads all bot-modules listed in scripts.load
 (let ((scripts (open-file "scripts.load" "r")))
index b8753a6..82053c6 100644 (file)
@@ -1,22 +1,22 @@
 # Sample configuration file for Bobot++
 # Copyright (c) 1997 Etienne BERNARD
-# Copyright (C) 2003 Clinton Ebadi (Heavily modified)
+# Copyright (C) 2003,2005 Clinton Ebadi (Heavily modified)
+
+# Maximum Nickname Length that the bot will consider valid
+# maxnicklength = <positive integer> (default = 9)
+maxnicklength = 9
 
 # Nickname of the bot
 # nick = <string>
-nick = TestBot
+nick = Bobot++
 
 # Username of the bot (remember : nick!username@hostname)
 # username = <string>
 username = lamerbot
 
-# Maximum nick length of the bot (default to 9)
-# maxnicklength = <positive integer>
-maxnicklength = 9
-
 # IRCname of the bot (shown with /whois)
 # ircname = <string>
-ircname = Scheme Me!
+ircname = Bobot++
 
 # Command char of the bot
 # cmdchar = <char>
@@ -37,8 +37,6 @@ logfile = bot.log
 # Server
 # server = <name> [<port> [<password>]]
 server = irc.freenode.net
-#server = trollaxor.com
-#server = irc.oftc.net
 
 # Channels for the bot
 # channel = <channelname>:<initial modes>:<modes to keep>:<channel key>
@@ -47,4 +45,4 @@ server = irc.freenode.net
 # channel = &two:nst:nst:
 # channel = #three:nstk key:nstk:key
 # etc...
-channel = #bobot:nt:nt::
+channel = #bobotpp:nt:nt::
index b0edf75..24b5ba3 100644 (file)
@@ -1,2 +1 @@
-*!*YOURUSERNAME@*:#*:4:1:0:-1:*NONE*
-*!*@*:#*:0:0:0:-1:*NONE*
+*!*YOURUSERNAME@YOURHOST:#*:4:1:0:-1:*NONE*
index 1892ec1..916a76e 100644 (file)
@@ -79,7 +79,8 @@
 ;;; match-not-channel adds a prefix regex to your regex so it doesn't
 ;;; match the sender or channel in a PUBLIC message
 (define-public (bot:match-not-channel regex)
-  (string-append "^[[:graph:]]* [&#+!][^ ,\a]+ [[:graph:][:space:]]*" regex))
+  (string-append "^[[:graph:]]* [&#+!][^ ,\a]+ [[:graph:][:space:]]*"
+                regex))
 
 ;;; match-to-me matches text that was addressed to the bot with a
 ;;; ':',',', or nothing after the bot name
   (string-append (bot:match-not-channel (bot:getnickname))
                 "[[:space:][:graph:]]*" regex))
 
-(define-public (bot:sent-to-me? message)
+(define-public bot:sent-to-me?
   (let ((to-me (make-regexp (bot:match-to-me ""))))
-    (if (regexp-exec to-me message) #t #f)))
+    (lambda (message)
+      (if (regexp-exec to-me message) #t #f))))
 
 ;;;; string-utils
 (define-public str-app string-append) ; shorter
      (string-concatenate
       (map (lambda (chr) ; CTCP level quoting
             (case (char->integer chr)
-              ((#o134) (string (integer->char #o134) (integer->char #o134)))
+              ((#o134) (string (integer->char #o134) (integer->char
+                                                      #o134)))
               ((#o01)  (string (integer->char #o134) #\a)) ; X-DELIM
               (else (string chr))))
           (string->list
index 959a172..b0978ae 100644 (file)
@@ -1,6 +1,6 @@
 // BotInterp.H  -*- C++ -*-
 // Copyright (c) 1998 Etienne BERNARD
-// Copyright (C) 2002 Clinton Ebadi
+// Copyright (C) 2002,2005 Clinton Ebadi
 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -14,7 +14,8 @@
 
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
 
 #ifndef BOTINTERP_H
 #define BOTINTERP_H
@@ -81,6 +82,7 @@ struct Hook {
     PUBLIC_NOTICE, RAW, TIMER, TOPIC,
     // send hooks
     SEND_ACTION, SEND_CTCP, SEND_PUBLIC, SEND_MESSAGE,
+    SEND_WHO, SEND_WHOIS,
     // DCC hooks
     DCC_CHAT_BEGIN, DCC_CHAT_END, DCC_CHAT_MESSAGE
   };  
index 331b9d7..7cde5cb 100644 (file)
@@ -27,6 +27,7 @@
 #include "Commands.H"
 #include "Interp.H"
 #include "BotInterp.H"
+#include "ShitEntry.H"
 
 #include <libguile.h>
 
@@ -135,6 +136,13 @@ interp_init_helper (void* unused)
   // auto-op
   scm_c_define ("bot:aop/yes", scm_long2num (true));
   scm_c_define ("bot:aop/no", scm_long2num (false));
+
+  // shit-list
+  scm_c_define ("bot:shit/none", scm_long2num (ShitEntry::SHIT_NOSHIT));
+  scm_c_define ("bot:shit/no-op", scm_long2num (ShitEntry::SHIT_NOOP));
+  scm_c_define ("bot:shit/no-join", scm_long2num (ShitEntry::SHIT_NOJOIN));
+  scm_c_define ("bot:shit/no-deban", 
+               scm_long2num (ShitEntry::SHIT_NODEBAN));
   
   // sys-dir
   scm_c_define ("bot:sys-scripts-dir", 
@@ -165,6 +173,8 @@ interp_init_helper (void* unused)
   scm_c_define ("hooks/send/message", scm_long2num (Hook::SEND_MESSAGE));
   scm_c_define ("hooks/send/action", scm_long2num (Hook::SEND_ACTION));
   scm_c_define ("hooks/send/ctcp", scm_long2num (Hook::SEND_CTCP));
+  scm_c_define ("hooks/send/who", scm_long2num (Hook::SEND_WHO));
+  scm_c_define ("hooks/send/whois", scm_long2num (Hook::SEND_WHOIS));
   // dcc hooks
   scm_c_define ("hooks/dcc/chat-begin", 
                scm_long2num (Hook::DCC_CHAT_BEGIN));
index 84049f5..d03ae76 100644 (file)
@@ -553,7 +553,8 @@ ScriptCommands::getServerList(void)
   SCM res = gh_list(SCM_UNDEFINED);
   ::Server *s;
   int i = 0;
-  std::vector<class Server *>::iterator it = Interp::bot->serverList->begin();
+  std::vector<class Server *>::iterator it = 
+    Interp::bot->serverList->begin();
 
   for ( ; it != Interp::bot->serverList->end(); ++it) {
     s = (*it);
index c644964..b525747 100644 (file)
@@ -301,6 +301,14 @@ ServerQueue::sendWho(String who)
 {
   addLine(String("WHO ") + who,
           WHO_PRIORITY, WHO_PENALTY, ServerQueueItem::WHO);
+
+#ifdef USESCRIPTS
+  Interp::bot->botInterp->RunHooks (Hook::SEND_WHO,
+                                   who,
+                                   scm_list_n (Utils::
+                                                str2scm (who),
+                                                SCM_UNDEFINED));
+#endif
 }
 
 void
@@ -308,4 +316,12 @@ ServerQueue::sendWhois(String nick)
 {
   addLine(String("WHOIS ") + nick,
           NICK_PRIORITY, WHOIS_PENALTY, ServerQueueItem::WHOIS);
+
+#ifdef USESCRIPTS
+  Interp::bot->botInterp->RunHooks (Hook::SEND_WHOIS,
+                                   nick,
+                                   scm_list_n (Utils::
+                                                str2scm (nick),
+                                                SCM_UNDEFINED));
+#endif
 }
index 28bc63b..f34aeea 100644 (file)
@@ -14,7 +14,8 @@
 
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
 
 #ifndef SHITENTRY_H
 #define SHITENTRY_H
index e95f0db..b1d3f27 100644 (file)
@@ -14,7 +14,8 @@
 
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
index 489706e..c77b7f9 100644 (file)
@@ -14,7 +14,8 @@
 
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
 
 #ifndef SHITLIST_H
 #define SHITLIST_H
index ae1d6fc..cf2ee0f 100644 (file)
@@ -14,7 +14,8 @@
 
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
 
 // An UserListItem object is the object that is stored in the UserList.