[project @ 2005-01-06 18:19:16 by unknown_lamer]
authorunknown_lamer <unknown>
Thu, 6 Jan 2005 18:19:16 +0000 (18:19 +0000)
committerunknown_lamer <unknown>
Thu, 6 Jan 2005 18:19:16 +0000 (18:19 +0000)
Misc. bug fixes, documentation updates, and part of the new config
system. It compiles at least; the rest of the config system will be
added soonish.

ChangeLog
NEWS
TODO
bobot++.info
bobot++.texinfo
source/BotConfig.C [new file with mode: 0644]
source/BotConfig.H [new file with mode: 0644]
source/Makefile.am

index 98d354b..ebb93ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2005-01-06  Clinton Ebadi  <clinton@unknownlamer.org>
+
+       * source/BotConfig.C (set_option_value): Fuck you STL
+       (push_back_): Reimplemented so that it doesn't need std::bind1st
+       because the STL is being stupid
+
+2004-12-26  Clinton Ebadi  <clinton@unknownlamer.org>
+
+       * source/BotConfig.C (read_config): Implemented properly
+       (get_option_values): Implemented properly
+       (set_config_file): Fixed
+
+2004-07-10  Clinton Ebadi  <clinton@unknownlamer.org>
+
+       * bobot++.texinfo (Built-In Commands): Added empty stubs to the
+       list of commands
+
+2004-06-22  Clinton Ebadi  <clinton@unknownlamer.org>
+
+       * source/BotConfig.C: New file (implementation of configuration database)
+
+       * source/BotConfig.H: New File (semi-generic configuration database)
+
+2004-06-17  Clinton Ebadi  <clinton@unknownlamer.org>
+
+       * bobot++.texinfo (Starting the Bot): New section
+
 2004-06-14  Clinton Ebadi  <clinton@unknownlamer.org>
 
        * bobot++.texinfo (Protection): Added Section
diff --git a/NEWS b/NEWS
index e27d45a..647eaae 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Version 2.1.5: Cleanups
   Friend of the bot
 - Implemented bot:ctcp-quote
 - The Bot Configuration section of the manual has been completed.
+- Misc. Bugfixes
 
 Version 2.1.4: DCC Support Enhancements
 - Internal Change: DCCConnection is now an abstract class
diff --git a/TODO b/TODO
index 9fcb80d..02e2735 100644 (file)
--- a/TODO
+++ b/TODO
@@ -4,18 +4,22 @@ Done:
 * Abstract DCC support so that DCC FILE may be easily implemented
 
 2.2:
+* Utils::isValidNickName should have a configurable max nick length
+   (now that most networks allow for longer than nine character
+   nicks). This is dependant upon the new configuration system
 * 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
 * Finish adding hooks/send hooks
 * Write Texinfo manual
 * Configuration Database
-* Improve the help syst
+* Improve the help system
 * DCC FILE support (sending and recieving)
 * XDCC file server script (requires DCC FILE support)
 * bot:protection/[none|no-ban|no-kick|no-deop] constants
 * bot:aop/[no|yes] constants
 * Extend AOP to support +v (0 = no op, 1 = +o, 2 = +v)
+* Add DCC_CHAT_END hook for Scheme
 
 2.4/3.0 (2.4 iff backwards compatibility is maintained, 3.0 otherwise):
 General:
@@ -59,4 +63,6 @@ Definitely 3.0:
    - To clarify: There will be one thread for DCCs and another thread
    for the current irc server connection, each with its own select
    loop. There may also be a thread for the network repls if I
-   implement those.
\ No newline at end of file
+   implement those.
+* New config values in config db should be added before old values
+   (this is faster but breaks the way server lists work in 2.x)
\ No newline at end of file
index 32164c1..1cc9b56 100644 (file)
@@ -1,4 +1,4 @@
-This is bobot++.info, produced by makeinfo version 4.6 from
+This is bobot++.info, produced by makeinfo version 4.7 from
 bobot++.texinfo.
 
    This file documents Bobot++ by Clinton Ebadi and Etienne Bernard
@@ -57,9 +57,11 @@ bot.conf
 
 Using Bobot++
 
+* Starting the Bot::
 * User Levels::
 * Protection::
 * Automatic Op::
+* Built-In Commands::
 
 Scripting
 
@@ -82,16 +84,16 @@ Sending Messages
 \1f
 File: bobot++.info,  Node: Introduction,  Next: Configuration,  Prev: Top,  Up: Top
 
-Introduction
-************
+Introduction
+**************
 
 This manual feels abused and neglected because it has almost no content.
 
 \1f
 File: bobot++.info,  Node: Configuration,  Next: Using the Bot,  Prev: Introduction,  Up: Top
 
-Configuration
-*************
+Configuration
+***************
 
 Bobot++ is easy to configure. See the `examples' directory for an
 example configuration.
@@ -104,8 +106,8 @@ example configuration.
 \1f
 File: bobot++.info,  Node: Configuration Files,  Next: Configuration File Placement,  Prev: Configuration,  Up: Configuration
 
-Configuration Files
-===================
+2.1 Configuration Files
+=======================
 
 * Menu:
 
@@ -115,8 +117,8 @@ Configuration Files
 \1f
 File: bobot++.info,  Node: bot.conf,  Next: bot.users,  Prev: Configuration Files,  Up: Configuration Files
 
-bot.conf
---------
+2.1.1 bot.conf
+--------------
 
 * Menu:
 
@@ -163,8 +165,8 @@ configuration variables are listed below in the format "VARIABLE
 \1f
 File: bobot++.info,  Node: server syntax,  Next: channel syntax,  Prev: bot.conf,  Up: bot.conf
 
-server syntax
-.............
+2.1.1.1 server syntax
+.....................
 
 SERVER = SERVER_NAME [PORT [PASSWORD]]
 
@@ -182,8 +184,8 @@ to multiple servers at a time in a usable manner).
 \1f
 File: bobot++.info,  Node: channel syntax,  Prev: server syntax,  Up: bot.conf
 
-channel syntax
-..............
+2.1.1.2 channel syntax
+......................
 
 CHANNEL = NAME:INITIAL_MODES:MODES_TO_KEEP:CHANNEL_KEY
 
@@ -209,8 +211,8 @@ attempt to maintain any modes.
 \1f
 File: bobot++.info,  Node: bot.users,  Prev: bot.conf,  Up: Configuration Files
 
-bot.users
----------
+2.1.2 bot.users
+---------------
 
 `bot.users' is the default file name of the userlist. It may be changed
 in `bot.conf'. The file contains lines with the format:
@@ -237,8 +239,8 @@ in `bot.conf'. The file contains lines with the format:
 \1f
 File: bobot++.info,  Node: Configuration File Placement,  Prev: Configuration Files,  Up: Configuration
 
-Configuration File Placement
-============================
+2.2 Configuration File Placement
+================================
 
 Bobot++ will look in `/etc/bobotpp/default/' for its default config if
 none is specified on the command line. Put the configuration files you
@@ -249,22 +251,64 @@ you want to have your own personal configuration, put it in
 \1f
 File: bobot++.info,  Node: Using the Bot,  Next: Scripting,  Prev: Configuration,  Up: Top
 
-Using Bobot++
-*************
+Using Bobot++
+***************
 
 FIXME: stuff here...
 
 * Menu:
 
+* Starting the Bot::
 * User Levels::
 * Protection::
 * Automatic Op::
+* Built-In Commands::
 
 \1f
-File: bobot++.info,  Node: User Levels,  Next: Protection,  Prev: Using the Bot,  Up: Using the Bot
+File: bobot++.info,  Node: Starting the Bot,  Next: User Levels,  Prev: Using the Bot,  Up: Using the Bot
+
+3.1 Starting the Bot
+====================
+
+The bot is usually installed with the binary name `bobotpp'. It accepts
+the following command line arguments:
+
+   * `[--help][-h]' - Shows detailed help and exits
+
+   * `[--version][-v]' - Shows version information and exits
+
+   * `[--no-background][-b]' - Run bobot++ in the foreground
+
+   * `[--config-file file][-f]' - Use file instead of `bot.conf'
+
+   * `[--config-dir dir][-d]' - Use dir as dir to load config file from
+
+   * `[--config dir][-c]' - Search your config path (defaults to
+     `$HOME/.bobotpp/config/' and then `/etc/bobotpp/') for dir and
+     then loads your config data using dir
+
+   * `[--sys-config dir][-s]' - Looks for config in `/etc/bobotpp/dir'.
+     Note that the user dir is still searched first
+
+   * `[--user-config dir][-u]' - Looks for config in
+     `$HOME/.bobotpp/config/dir/'. Note that the system dir is still
+     searched after this if dir is not found.
+
+   * `[--debug][-D]' Makes Bobot++ print debugging info and run in the
+     foreground
 
-User Levels
-===========
+
+   The default configuration is read from
+`$HOME/.bobotpp/config/default/' and then `/etc/bobotpp/default/' if
+the user config is not found.
+
+   The bot defaults to running in the background as a daemon.
+
+\1f
+File: bobot++.info,  Node: User Levels,  Next: Protection,  Prev: Starting the Bot,  Up: Using the Bot
+
+3.2 User Levels
+===============
 
 There are several user levels available in Bobot++ to provide gradated
 access to commands. `!adduser' and `bot.users' use the numeric code;
@@ -298,8 +342,8 @@ available to `bot:user-none'.
 \1f
 File: bobot++.info,  Node: Protection,  Next: Automatic Op,  Prev: User Levels,  Up: Using the Bot
 
-Protection
-==========
+3.3 Protection
+==============
 
 A user added via Scheme, the `bot.users' file, or `!adduser' may be
 protected from being deoped, kicked, or banned. There are currently no
@@ -317,26 +361,106 @@ symbolic levels in Scheme; just use the numeric code.
 
 
 \1f
-File: bobot++.info,  Node: Automatic Op,  Prev: Protection,  Up: Using the Bot
+File: bobot++.info,  Node: Automatic Op,  Next: Built-In Commands,  Prev: Protection,  Up: Using the Bot
 
-Automatic Op
-============
+3.4 Automatic Op
+================
 
 A user may be automatically given operator status upon entering a
 channel. Set the AOP field to "0" to disable auto-op or "1" to enable
 auto-op.
 
+\1f
+File: bobot++.info,  Node: Built-In Commands,  Prev: Automatic Op,  Up: Using the Bot
+
+3.5 Built-In Commands
+=====================
+
+Bobot++ has many built-in commands that make it useful without
+scripting support. The reference leaves off the command char; remember
+to use whatever you defined the command char to be in `bot.conf'. If a
+command needs the channel name then you must specify the channel as the
+first argument to the command when private messaging the bot a command.
+
+COMMAND            NEEDS CHANNEL      MIN LEVEL TO USE   DESCRIPTION
+`action' `do'      Yes                USER                Causes the bot
+                                                         to perform the
+                                                         action `do' in
+                                                         the current
+                                                         channel.
+`adduser'                                                
+`addserver'                                              
+`addshit'                                                
+`alias'                                                  
+`ban'                                                    
+`banlist'                                                
+`channels'                                               
+`cycle'                                                  
+`dcclist'                                                
+`deban'                                                  
+`delserver'                                              
+`deluser'                                                
+`delshit'                                                
+`deop'                                                   
+`die'                                                    
+`do'                                                     
+`execute'                                                *Only available
+                                                         if scripting
+                                                         support is
+                                                         enabled*
+`help'                                                   
+`ident'                                                  
+`invite'                                                 
+`join'                                                   
+`keep'                                                   
+`kick'                                                   
+`kickban'                                                
+`load'                                                   
+`loadscript'                                             *Only available
+                                                         if scripting
+                                                         support is
+                                                         enabled*
+`lock'                                                   
+`mode'                                                   
+`msg'                                                    
+`names'                                                  
+`nextserver'                                             
+`nick'                                                   
+`nslookup'                                               
+`op'                                                     
+`part'                                                   
+`password'                                               
+`reconnect'                                              
+`rspymessage'                                            
+`save'                                                   
+`say'                                                    
+`server'                                                 
+`serverlist'                                             
+`setfloodrate'                                           
+`setversion'                                             
+`shitlist'                                               
+`spylist'                                                
+`spymessage'                                             
+`stats'                                                  
+`tban'                                                   
+`tkban'                                                  
+`topic'                                                  
+`unlock'                                                 
+`userlist'                                               
+`who'                                                    
+`whois'                                                  
+
 \1f
 File: bobot++.info,  Node: Scripting,  Next: Concept Index,  Prev: Using the Bot,  Up: Top
 
-Scripting
-*********
+Scripting
+***********
 
 Bobot++'s most powerful feature is its scripting system. You write
 scripts using Guile Scheme. This manual does not cover how to use Guile
 or how to learn Scheme. *Note Guile Reference Manual: (guile)Top, for
 the Guile reference manual and
-<http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html> for a
+`http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html' for a
 good tutorial on Scheme.
 
    Note that in previous versions the scripting commands where in the
@@ -357,8 +481,8 @@ to convert your code to use the new functions.
 \1f
 File: bobot++.info,  Node: Adding New Commands,  Next: Hooks,  Prev: Scripting,  Up: Scripting
 
-Adding New Commands
-===================
+4.1 Adding New Commands
+=======================
 
 Adding a new command is simple. To register a new command use
 `bot:addcommand'. The prototype for `bot:addcommand' is
@@ -377,7 +501,7 @@ set to the empty string `""'. An example of a new command would be:
        (if (string=? name "")
          (bot:say channel "Hello world!")
          (bot:say channel (string-append "Hello " name "!")))
-     
+
      (bot:addcommand "hello" hello #t 2 0)
 
    This will display "Hello World!" if called as `!hello' and "Hello
@@ -386,8 +510,8 @@ World `USER'" if called as `!hello USER'.
 \1f
 File: bobot++.info,  Node: Hooks,  Next: Scheme User Levels,  Prev: Adding New Commands,  Up: Scripting
 
-Hooks
-=====
+4.2 Hooks
+=========
 
 Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII
 and tiny fugue (a MUD bot) hooks with a little bit of extra stuff added
@@ -410,8 +534,8 @@ non-fallthrough hooks matches processing of hooks stops.
 \1f
 File: bobot++.info,  Node: Creating a Hook,  Next: Hook Types,  Prev: Hooks,  Up: Hooks
 
-Creating a Hook
----------------
+4.2.1 Creating a Hook
+---------------------
 
 To add a new hook you use the function `bot:addhook'. `bot:addhook' is
 prototyped as `(bot:addhook type regex function pri fall name)'. `type'
@@ -432,8 +556,8 @@ regexps for the log function all be `".*"' and set their names to
 \1f
 File: bobot++.info,  Node: Hook Types,  Prev: Creating a Hook,  Up: Hooks
 
-Hook Types
-----------
+4.2.2 Hook Types
+----------------
 
 Here is a list of the various hooks are notes on each one. The general
 format of a hook is:
@@ -596,8 +720,8 @@ format of a hook is:
 \1f
 File: bobot++.info,  Node: Scheme User Levels,  Next: Sending Messages,  Prev: Hooks,  Up: Scripting
 
-Scheme User Levels
-==================
+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
@@ -619,8 +743,8 @@ can use new commands you add.
 \1f
 File: bobot++.info,  Node: Sending Messages,  Next: Misc Scripting Stuff,  Prev: Scheme User Levels,  Up: Scripting
 
-Sending Messages
-================
+4.4 Sending Messages
+====================
 
 There are several types of messages you can send with Bobot++ from
 scripts. There is the simple, but rather limited, `bot:say',
@@ -637,16 +761,16 @@ 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
 
-"High Level" Message Functions
-------------------------------
+4.4.1 "High Level" Message Functions
+------------------------------------
 
 ...
 
 \1f
 File: bobot++.info,  Node: Low Level Message Functions,  Prev: High Level Message Functions,  Up: Sending Messages
 
-"Low Level" Message Functions
------------------------------
+4.4.2 "Low Level" Message Functions
+-----------------------------------
 
 The "Low Level" messaging functions allow you to do things like send
 CTCP messages. You probably want to read rfc 2812 and the CTCP spec
@@ -663,8 +787,8 @@ 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
 
-Misc. Scripting Stuff
-=====================
+4.5 Misc. Scripting Stuff
+=========================
 
 These are a few useful things that I thought people writing scripts
 might want to know.
@@ -679,9 +803,10 @@ File: bobot++.info,  Node: Concept Index,  Next: Function Index,  Prev: Scriptin
 Concept Index
 *************
 
+\0\b[index\0\b]
 * Menu:
 
-* Background on Hooks:                   Hooks.
+* Background on Hooks:                   Hooks.                 (line 6)
 
 \1f
 File: bobot++.info,  Node: Function Index,  Next: Variable Index,  Prev: Concept Index,  Up: Top
@@ -689,10 +814,11 @@ File: bobot++.info,  Node: Function Index,  Next: Variable Index,  Prev: Concept
 Function Index
 **************
 
+\0\b[index\0\b]
 * Menu:
 
-* addcommand:                            Adding New Commands.
-* addhook:                               Creating a Hook.
+* addcommand:                            Adding New Commands.   (line 6)
+* addhook:                               Creating a Hook.       (line 6)
 
 \1f
 File: bobot++.info,  Node: Variable Index,  Prev: Function Index,  Up: Top
@@ -700,64 +826,68 @@ File: bobot++.info,  Node: Variable Index,  Prev: Function Index,  Up: Top
 Variable Index
 **************
 
+\0\b[index\0\b]
 * Menu:
 
 * exit-hook:                             Misc Scripting Stuff.
-* hooks/action:                          Hook Types.
-* hooks/ctcp:                            Hook Types.
-* hooks/ctcp-reply:                      Hook Types.
-* hooks/dcc/begin:                       Hook Types.
-* hooks/dcc/message:                     Hook Types.
-* hooks/disconnect:                      Hook Types.
-* hooks/flood:                           Hook Types.
-* hooks/invite:                          Hook Types.
-* hooks/join:                            Hook Types.
-* hooks/kick:                            Hook Types.
-* hooks/message:                         Hook Types.
-* hooks/mode:                            Hook Types.
-* hooks/nickname:                        Hook Types.
-* hooks/notice:                          Hook Types.
-* hooks/part:                            Hook Types.
-* hooks/public:                          Hook Types.
-* hooks/public-notice:                   Hook Types.
-* hooks/raw:                             Hook Types.
-* hooks/signoff:                         Hook Types.
-* hooks/timer:                           Hook Types.
-* hooks/topic:                           Hook Types.
-* user-friend:                           Scheme User Levels.
-* user-master:                           Scheme User Levels.
-* user-none:                             Scheme User Levels.
-* user-trusted:                          Scheme User Levels.
-* user-user:                             Scheme User Levels.
+                                                              (line   9)
+* hooks/action:                          Hook Types.          (line  23)
+* hooks/ctcp:                            Hook Types.          (line  50)
+* hooks/ctcp-reply:                      Hook Types.          (line  56)
+* hooks/dcc/begin:                       Hook Types.          (line 146)
+* hooks/dcc/message:                     Hook Types.          (line 154)
+* hooks/disconnect:                      Hook Types.          (line  62)
+* hooks/flood:                           Hook Types.          (line  68)
+* hooks/invite:                          Hook Types.          (line  74)
+* hooks/join:                            Hook Types.          (line  80)
+* hooks/kick:                            Hook Types.          (line  86)
+* hooks/message:                         Hook Types.          (line 104)
+* hooks/mode:                            Hook Types.          (line  98)
+* hooks/nickname:                        Hook Types.          (line  38)
+* hooks/notice:                          Hook Types.          (line 110)
+* hooks/part:                            Hook Types.          (line  92)
+* hooks/public:                          Hook Types.          (line 116)
+* hooks/public-notice:                   Hook Types.          (line 122)
+* hooks/raw:                             Hook Types.          (line 128)
+* hooks/signoff:                         Hook Types.          (line  44)
+* hooks/timer:                           Hook Types.          (line 134)
+* hooks/topic:                           Hook Types.          (line 140)
+* 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\7f522
-Node: Introduction\7f1768
-Node: Configuration\7f1956
-Node: Configuration Files\7f2239
-Node: bot.conf\7f2446
-Node: server syntax\7f3872
-Node: channel syntax\7f4720
-Node: bot.users\7f5547
-Node: Configuration File Placement\7f6438
-Node: Using the Bot\7f6908
-Node: User Levels\7f7111
-Node: Protection\7f8556
-Node: Automatic Op\7f9157
-Node: Scripting\7f9412
-Node: Adding New Commands\7f10373
-Node: Hooks\7f11637
-Node: Creating a Hook\7f12608
-Node: Hook Types\7f13744
-Node: Scheme User Levels\7f17215
-Node: Sending Messages\7f18341
-Node: High Level Message Functions\7f18949
-Node: Low Level Message Functions\7f19160
-Node: Misc Scripting Stuff\7f19910
-Node: Concept Index\7f20326
-Node: Function Index\7f20508
-Node: Variable Index\7f20769
+Node: Introduction\7f1811
+Node: Configuration\7f2003
+Node: Configuration Files\7f2290
+Node: bot.conf\7f2505
+Node: server syntax\7f3943
+Node: channel syntax\7f4807
+Node: bot.users\7f5650
+Node: Configuration File Placement\7f6553
+Node: Using the Bot\7f7031
+Node: Starting the Bot\7f7281
+Node: User Levels\7f8625
+Node: Protection\7f10081
+Node: Automatic Op\7f10690
+Node: Built-In Commands\7f10979
+Node: Scripting\7f15513
+Node: Adding New Commands\7f16478
+Node: Hooks\7f17745
+Node: Creating a Hook\7f18724
+Node: Hook Types\7f19872
+Node: Scheme User Levels\7f23355
+Node: Sending Messages\7f24489
+Node: High Level Message Functions\7f25105
+Node: Low Level Message Functions\7f25328
+Node: Misc Scripting Stuff\7f26090
+Node: Concept Index\7f26514
+Node: Function Index\7f26733
+Node: Variable Index\7f27032
 \1f
 End Tag Table
index 92f6010..c9dd2d8 100644 (file)
@@ -83,9 +83,11 @@ bot.conf
 
 Using Bobot++
 
+* Starting the Bot::            
 * User Levels::                 
 * Protection::                  
 * Automatic Op::                
+* Built-In Commands::           
 
 Scripting
 
@@ -261,12 +263,57 @@ in @file{~/.bobotpp/config/default/}.
 FIXME: stuff here...
 
 @menu
+* Starting the Bot::            
 * User Levels::                 
 * Protection::                  
 * Automatic Op::                
+* Built-In Commands::           
 @end menu
 
-@node User Levels, Protection, Using the Bot, Using the Bot
+@node Starting the Bot, User Levels, Using the Bot, Using the Bot
+@section Starting the Bot
+
+The bot is usually installed with the binary name @file{bobotpp}. It
+accepts the following command line arguments:
+
+@itemize
+
+@item @code{[--help][-h]} - Shows detailed help and exits
+
+@item @code{[--version][-v]} - Shows version information and exits
+
+@item @code{[--no-background][-b]} - Run bobot++ in the foreground
+
+@item @code{[--config-file file][-f]} - Use file instead of
+@file{bot.conf}
+
+@item @code{[--config-dir dir][-d]} - Use dir as dir to load config
+file from
+
+@item @code{[--config dir][-c]} - Search your config path (defaults to
+@file{@var{$HOME}/.bobotpp/config/} and then @file{/etc/bobotpp/}) for
+dir and then loads your config data using dir
+
+@item @code{[--sys-config dir][-s]} - Looks for config in
+@file{/etc/bobotpp/dir}. Note that the user dir is still searched
+first
+
+@item @code{[--user-config dir][-u]} - Looks for config in
+@file{@var{$HOME}/.bobotpp/config/dir/}. Note that the system dir is
+still searched after this if dir is not found.
+
+@item @code{[--debug][-D]} Makes Bobot++ print debugging info and run
+in the foreground
+
+@end itemize
+
+The default configuration is read from
+@file{@var{$HOME}/.bobotpp/config/default/} and then
+@file{/etc/bobotpp/default/} if the user config is not found.
+
+The bot defaults to running in the background as a daemon.
+
+@node User Levels, Protection, Starting the Bot, Using the Bot
 @section User Levels
 
 There are several user levels available in Bobot++ to provide gradated
@@ -323,13 +370,144 @@ operator status.
 
 @end enumerate
 
-@node Automatic Op,  , Protection, Using the Bot
+@node Automatic Op, Built-In Commands, Protection, Using the Bot
 @section Automatic Op
 
 A user may be automatically given operator status upon entering a
 channel. Set the @var{aop} field to ``0'' to disable auto-op or ``1''
 to enable auto-op.
 
+@node Built-In Commands,  , Automatic Op, Using the Bot
+@section Built-In Commands
+
+Bobot++ has many built-in commands that make it useful without
+scripting support. The reference leaves off the command char;
+remember to use whatever you defined the command char to be in
+@file{bot.conf}. If a command needs the channel name then you must
+specify the channel as the first argument to the command when private
+messaging the bot a command.
+
+@multitable @columnfractions 0.25 0.25 0.25 0.25
+@item @sc{command} @tab @sc{Needs Channel} @tab @sc{Min Level to Use} @tab @sc{Description}
+
+@item @command{action} @option{do} @tab Yes @tab @var{USER} @tab
+Causes the bot to perform the action @option{do} in the current
+channel.
+
+@item @command{adduser}
+
+@item @command{addserver}
+
+@item @command{addshit}
+
+@item @command{alias}
+
+@item @command{ban}
+
+@item @command{banlist}
+
+@item @command{channels}
+
+@item @command{cycle}
+
+@item @command{dcclist}
+
+@item @command{deban}
+
+@item @command{delserver}
+
+@item @command{deluser}
+
+@item @command{delshit}
+
+@item @command{deop}
+
+@item @command{die}
+
+@item @command{do}
+
+@item @command{execute} @tab @tab @tab @strong{Only available if scripting
+support is enabled}
+
+@item @command{help}
+
+@item @command{ident}
+
+@item @command{invite}
+
+@item @command{join}
+
+@item @command{keep}
+
+@item @command{kick}
+
+@item @command{kickban}
+
+@item @command{load}
+
+@item @command{loadscript} @tab @tab @tab @strong{Only available if scripting
+support is enabled}
+
+@item @command{lock}
+
+@item @command{mode}
+
+@item @command{msg}
+
+@item @command{names}
+
+@item @command{nextserver}
+
+@item @command{nick}
+
+@item @command{nslookup}
+
+@item @command{op}
+
+@item @command{part}
+
+@item @command{password}
+
+@item @command{reconnect}
+
+@item @command{rspymessage}
+
+@item @command{save}
+
+@item @command{say}
+
+@item @command{server}
+
+@item @command{serverlist}
+
+@item @command{setfloodrate}
+
+@item @command{setversion}
+
+@item @command{shitlist}
+
+@item @command{spylist}
+
+@item @command{spymessage}
+
+@item @command{stats}
+
+@item @command{tban}
+
+@item @command{tkban}
+
+@item @command{topic}
+
+@item @command{unlock}
+
+@item @command{userlist}
+
+@item @command{who}
+
+@item @command{whois}
+
+@end multitable
+
 @node Scripting, Concept Index, Using the Bot, Top
 @chapter Scripting
 
diff --git a/source/BotConfig.C b/source/BotConfig.C
new file mode 100644 (file)
index 0000000..dd478a9
--- /dev/null
@@ -0,0 +1,126 @@
+// BotConfig.C  -*- C++ -*-
+// Copyright (C) 2004 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
+// the Free Software Foundation; either version 2 of the License, or
+// any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
+
+#include "BotConfig.H"
+#include "Bot.H"
+#include "StringTokenizer.H"
+#include <iostream>
+#include <string>
+#include <list>
+#include <algorithm>
+
+BotConfig::BotConfig (std::string cf)
+  : config_filename (cf)
+{ }
+
+bool BotConfig::read_config ()
+{
+  std::ifstream config_file (config_filename.c_str ());
+  std::string current_line;
+  unsigned int line_number = 1;
+
+  options_db.clear ();
+
+  if (!config_file)
+    {
+      // FIXME: log lines (needs local bot object, probably a
+      // redesign. UGH).
+      
+      // Bot::logLine ("Error: Config File Not Found `" +
+      // config_filename + "'");
+      return false;
+    }
+
+  while (!config_file.eof ())
+    {
+      std::getline (config_file, current_line);
+      if (current_line.length () == 0 || current_line[0] == '#')
+       {
+         line_number++;
+         continue;
+       }
+      
+      StringTokenizer st (current_line);
+      std::string command = st.nextToken('=').trim().toUpper();
+      StringTokenizer params (st.nextToken('=').trim());
+
+      options_db[command] = t_option_values (t_value_list (), 
+                                           t_watcher_list ());
+      while (params.hasMoreTokens (','))
+       {
+         options_db[command].first.push_back (params.nextToken (',').trim());
+       }
+    }
+  return true;
+}
+
+
+BotConfig::t_option_values BotConfig::get_option_values (std::string key)
+{
+  t_options_db::const_iterator cf_iter = 
+    options_db.find (key);
+
+  if (cf_iter != options_db.end ())
+    return cf_iter->second;
+  else
+    return t_option_values (); // Empty vector
+}
+
+std::string BotConfig::set_config_file (std::string fname)
+{
+  std::string old_config_filename = config_filename;
+  config_filename = fname;
+  options_db.clear ();
+  read_config ();
+  return old_config_filename;
+}
+
+namespace
+{
+  struct push_back_
+  {
+    BotConfig::t_value_list* lst;
+    
+    push_back_ (BotConfig::t_value_list* l)
+      : lst (l) 
+    {}
+
+    void operator()(BotConfig::t_value val)
+    {
+      lst->push_back (val);
+    }
+  };
+}
+
+void BotConfig::set_option_value (std::string key, t_value_list values, 
+                                 bool append)
+{
+  t_options_db::iterator cf_iter = options_db.find (key);
+  if (cf_iter != options_db.end ())
+    {
+      if (append)
+       {
+         // FIXME: Potentially slow (make this push_front in 3.0)
+         std::for_each (values.begin (), values.end (),
+                        push_back_ (&cf_iter->second.first));
+       }
+         else
+           cf_iter->second.first = values;
+    }
+}
+
+      
diff --git a/source/BotConfig.H b/source/BotConfig.H
new file mode 100644 (file)
index 0000000..14dcefe
--- /dev/null
@@ -0,0 +1,80 @@
+// BotConfig.H  -*- C++ -*-
+// Copyright (C) 2004 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
+// the Free Software Foundation; either version 2 of the License, or
+// any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
+
+/*
+  Config Database:
+  map<key,pair<list<string>,list<watcher>>
+  void watcher (key, options, appended?)
+
+*/
+
+#include <map>
+#include <list>
+#include <string>
+
+class BotConfig
+{
+public:
+  typedef std::string t_value;
+  typedef std::list<t_value> t_value_list;
+
+  typedef void (*t_watcher) (std::string, t_value_list, bool);
+
+  typedef std::list<t_watcher> t_watcher_list;
+  typedef std::pair<t_value_list, t_watcher_list> t_option_values;
+
+  typedef std::map<std::string, t_option_values> t_options_db;
+
+  
+private:
+  t_options_db options_db;
+  std::string config_filename;
+
+public:
+  BotConfig (std::string);
+
+  bool read_config (); // true if read successfully
+  bool write_config (); // true if written succesfully
+
+  // Getters
+  t_option_values  get_option_values (std::string key);
+
+  
+
+  // Setters
+  void set_option_value (std::string key, t_value_list values, 
+                        bool append);
+  
+
+  std::string set_config_file (std::string new_filename); // returns
+                                                         // old
+                                                         // filename
+
+  bool add_watcher (std::string key, t_watcher new_watcher); // t if key
+                                                          // exists,
+                                                          // f
+                                                          // otherwise
+  bool clear_watchers (std::string key); // t if key exists, f
+                                        // otherwise
+
+  // Static Procedures (these are for convinience)
+  t_value_list get_option_value_list (t_option_values v)
+  { return v.first; }
+
+  t_watcher_list get_option_watcher_list (t_option_values v)
+  { return v.second; }
+};
index ef77312..9a5958e 100644 (file)
@@ -2,6 +2,7 @@ bin_PROGRAMS = bobotpp
 
 bobotpp_SOURCES = BanEntry.C \
        Bot.C \
+       BotConfig.C \
        BotInterp.C \
        Channel.C \
        ChannelList.C \
@@ -37,6 +38,7 @@ bobotpp_SOURCES = BanEntry.C \
        Utils.C \
        BanEntry.H \
        Bot.H \
+       BotConfig.H \
        BotInterp.H \
        Channel.H \
        ChannelList.H \