[project @ 2004-06-14 04:26:29 by unknown_lamer]
authorunknown_lamer <unknown>
Mon, 14 Jun 2004 04:26:29 +0000 (04:26 +0000)
committerunknown_lamer <unknown>
Mon, 14 Jun 2004 04:26:29 +0000 (04:26 +0000)
Fixed a typo in README, disabled DCC CHAT for users below level 3 (FRIEND), and worked on the manual.

ChangeLog
NEWS
README
TODO
bobot++.info
bobot++.texinfo
source/DCCChatConnection.C
source/ScriptCommands.H

index 5c5c54c..98d354b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
+2004-06-14  Clinton Ebadi  <clinton@unknownlamer.org>
+
+       * bobot++.texinfo (Protection): Added Section
+       (User Levels): Rewrote section to be useful
+       (bot.users): Added section
+
 2004-06-12  Clinton Ebadi  <clinton@unknownlamer.org>
 
+       * source/DCCChatConnection.C (connect): Checks to make sure the
+       person initiating a DCC CHAT with the bot is at least a FRIEND of
+       the bot.
+
+       * README: Fixed a typo
+
        * scripts/bobot-utils.scm (ctcp-quote): Implemented ctcp-quote
        (bot:ctcp-quote): Renamed ctcp-quote to bot:ctcp-quite (whoops)
 
diff --git a/NEWS b/NEWS
index c3c0c30..e27d45a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,10 @@ IMPORTANT NOTES:
 ====== The News =====================================================
 =====================================================================
 
-Version 2.1.5: Manual Stuff
+Version 2.1.5: Cleanups
+- A DCC CHAT with the bot may now only be initiated if the user is a
+  Friend of the bot
+- Implemented bot:ctcp-quote
 - The Bot Configuration section of the manual has been completed.
 
 Version 2.1.4: DCC Support Enhancements
diff --git a/README b/README
index 3886879..5f9b0a5 100644 (file)
--- a/README
+++ b/README
@@ -3,7 +3,7 @@ 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. 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
+compatible. The biggest change is that all bot-* functions are now
 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
diff --git a/TODO b/TODO
index dd870c0..9fcb80d 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,14 +1,21 @@
+Done:
+* DCC CHAT min user level
+* Lots of hooks related stuff that I never wrote down
+* Abstract DCC support so that DCC FILE may be easily implemented
+
 2.2:
 * 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
-* DCC CHAT min user level
 * Configuration Database
 * Improve the help syst
 * 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)
 
 2.4/3.0 (2.4 iff backwards compatibility is maintained, 3.0 otherwise):
 General:
index ebb004f..32164c1 100644 (file)
@@ -48,6 +48,7 @@ Configuration
 Configuration Files
 
 * bot.conf::
+* bot.users::
 
 bot.conf
 
@@ -57,6 +58,8 @@ bot.conf
 Using Bobot++
 
 * User Levels::
+* Protection::
+* Automatic Op::
 
 Scripting
 
@@ -90,9 +93,8 @@ File: bobot++.info,  Node: Configuration,  Next: Using the Bot,  Prev: Introduct
 Configuration
 *************
 
-Bobot++ is easy to configure. The configuration file format may be
-changing in the 2.1 series, so it is not documented for now. See the
-`examples' directory for an example configuration.
+Bobot++ is easy to configure. See the `examples' directory for an
+example configuration.
 
 * Menu:
 
@@ -108,14 +110,20 @@ Configuration Files
 * Menu:
 
 * bot.conf::
+* bot.users::
 
 \1f
-File: bobot++.info,  Node: bot.conf,  Prev: Configuration Files,  Up: Configuration Files
+File: bobot++.info,  Node: bot.conf,  Next: bot.users,  Prev: Configuration Files,  Up: Configuration Files
 
 bot.conf
 --------
 
-`bot.conf' contains key value pairs separated by `='.
+* Menu:
+
+* server syntax::
+* channel syntax::
+
+   `bot.conf' contains key value pairs separated by `='.
 
    `<key> = <value>'
 
@@ -152,11 +160,6 @@ configuration variables are listed below in the format "VARIABLE
      starts up. This also has a special syntax.
 
 
-* Menu:
-
-* server syntax::
-* channel syntax::
-
 \1f
 File: bobot++.info,  Node: server syntax,  Next: channel syntax,  Prev: bot.conf,  Up: bot.conf
 
@@ -203,6 +206,34 @@ maintain the modes `nt'.
    The bot will join `#bar' and will not set any modes nor will it
 attempt to maintain any modes.
 
+\1f
+File: bobot++.info,  Node: bot.users,  Prev: bot.conf,  Up: Configuration Files
+
+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:
+
+   `MASK:CHANNEL:LEVEL:PROTECTION:AUTO-OP'
+
+   * 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
+     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.)
+
+   * LEVEL is the user level of the user (*Note User Levels::).
+
+   * PROTECTION is the protection level of the user (*Note
+     Protection::).
+
+   * AUTO-OP is set to control whether a user is automatically given
+     operator priviliges on channel entry (*Note Automatic Op::).
+
+
 \1f
 File: bobot++.info,  Node: Configuration File Placement,  Prev: Configuration Files,  Up: Configuration
 
@@ -226,26 +257,74 @@ FIXME: stuff here...
 * Menu:
 
 * User Levels::
+* Protection::
+* Automatic Op::
 
 \1f
-File: bobot++.info,  Node: User Levels,  Prev: Using the Bot,  Up: Using the Bot
+File: bobot++.info,  Node: User Levels,  Next: Protection,  Prev: Using the Bot,  Up: Using the Bot
 
 User Levels
 ===========
 
-There are five levels that a user may be when interfacing with a bot:
-NONE, USER, TRUSTED_USER, FRIEND, MASTER. All users default to NONE
-unless they are changed by a script, the `!adduser' command or the
-`bot.users' file. NONE is for everyone--very few commands (e.g. help)
-are available to the users and almost everyone should be this level. A
-USER can execute many of the bot commands, but can't use masks on kicks
-and bans. A TRUSTED user can everything a USER can do, but can also use
-masks on kicks and bans. A FRIEND can do everything except for stopping
-the bot (be careful who you give this to!). The MASTER level is for the
-bot's owner (probably you) and can do _everything_ to the bot. Be
-_very_ careful if you give MASTER level access to anyone else. You
-cannot use this symbolic levels with the `!adduser' command. See
-(FIXME: ref) for the numbers you must use with `!adduser'.
+There are several user levels available in Bobot++ to provide gradated
+access to commands. `!adduser' and `bot.users' use the numeric code;
+Scheme uses the textual name for the level. By default (if no catch-all
+setting is found in *Note bot.users::.) a user is not even a
+`bot:user-none' and cannot execute *any* commands, even commands
+available to `bot:user-none'.
+
+  0. `bot:user-none' - No *built-in* commands may be executed _by
+     default_ (commands may be added from Scheme that can be executed
+     by users of level none and the level required to execute a command
+     may be changed from Scheme).
+
+  1. `bot:user-user' - Will be able to execute most commands but not
+     all and cannot use masks on kicks and bans.
+
+  2. `bot:user-trusted' - For built-ins with a default configuration
+     this user has access to the same set of commands as an `user' but
+     may use masks on kicks and bans. Scheme commands may be added
+     which require a user to be of this level.
+
+  3. `bot:user-friend' - In the default configuration a user who is a
+     friend will be able to do everything short of stopping the bot.
+     Again, there may be user added commands that require a higher user
+     level.
+
+  4. `bot:user-master' - This is the highest user level and has access
+     to every feature of the bot.
+
+
+\1f
+File: bobot++.info,  Node: Protection,  Next: Automatic Op,  Prev: User Levels,  Up: Using the Bot
+
+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
+symbolic levels in Scheme; just use the numeric code.
+
+  0. No protection
+
+  1. No ban. If a user is banned the bot will unban him..
+
+  2. No kick. The user may still be kicked but the bot will kickban the
+     user who kicked the protected user.
+
+  3. No deop. The bot will ensure that the user always maintains
+     operator status.
+
+
+\1f
+File: bobot++.info,  Node: Automatic Op,  Prev: Protection,  Up: Using the Bot
+
+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: Scripting,  Next: Concept Index,  Prev: Using the Bot,  Up: Top
@@ -263,8 +342,9 @@ good tutorial on Scheme.
    Note that in previous versions the scripting commands where in the
 form `bot-FUNCTION'. They are now in the form `bot:FUNCTION'. The old
 names are still available, but are deprecated and will be removed in
-Bobot++ 2.4. The command `perl -pi -e ``s/bot-/bot:/g'' YOUR-FILES'
-should be enough to convert your code to use the new functions.
+Bobot++ 3.0. New commands are only available with the `bot:' prefix.
+The command `perl -pi -e ``s/bot-/bot:/g'' YOUR-FILES' should be enough
+to convert your code to use the new functions.
 
 * Menu:
 
@@ -654,27 +734,30 @@ Variable Index
 \1f
 Tag Table:
 Node: Top\7f522
-Node: Introduction\7f1722
-Node: Configuration\7f1910
-Node: Configuration Files\7f2291
-Node: bot.conf\7f2484
-Node: server syntax\7f3889
-Node: channel syntax\7f4737
-Node: Configuration File Placement\7f5564
-Node: Using the Bot\7f6034
-Node: User Levels\7f6205
-Node: Scripting\7f7206
-Node: Adding New Commands\7f8111
-Node: Hooks\7f9375
-Node: Creating a Hook\7f10346
-Node: Hook Types\7f11482
-Node: Scheme User Levels\7f14953
-Node: Sending Messages\7f16079
-Node: High Level Message Functions\7f16687
-Node: Low Level Message Functions\7f16898
-Node: Misc Scripting Stuff\7f17648
-Node: Concept Index\7f18064
-Node: Function Index\7f18246
-Node: Variable Index\7f18507
+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
 \1f
 End Tag Table
index d61bd50..92f6010 100644 (file)
@@ -1,4 +1,4 @@
-\input texinfo  @c -*- texinfo -*-
+input texinfo  @c -*- texinfo -*-
 @c %**start of header
 @setfilename bobot++.info
 @settitle Bobot++: A Schemeable IRC Bot
@@ -74,6 +74,7 @@ Configuration
 Configuration Files
 
 * bot.conf::                    
+* bot.users::                   
 
 bot.conf
 
@@ -83,6 +84,8 @@ bot.conf
 Using Bobot++
 
 * User Levels::                 
+* Protection::                  
+* Automatic Op::                
 
 Scripting
 
@@ -114,9 +117,8 @@ content.
 @node Configuration, Using the Bot, Introduction, Top
 @chapter Configuration
 
-Bobot++ is easy to configure. The configuration file format may be
-changing in the 2.1 series, so it is not documented for now. See the
-@file{examples} directory for an example configuration. 
+Bobot++ is easy to configure. See the @file{examples} directory for an
+example configuration.
 
 @menu
 * Configuration Files::         
@@ -128,11 +130,17 @@ changing in the 2.1 series, so it is not documented for now. See the
 
 @menu
 * bot.conf::                    
+* bot.users::                   
 @end menu
 
-@node bot.conf,  , Configuration Files, Configuration Files
+@node bot.conf, bot.users, Configuration Files, Configuration Files
 @subsection bot.conf
 
+@menu
+* server syntax::               
+* channel syntax::              
+@end menu
+
 @file{bot.conf} contains key value pairs separated by @code{=}. 
 
 @code{<key> = <value>}
@@ -167,11 +175,6 @@ when it starts up. This also has a special syntax.
 
 @end itemize
 
-@menu
-* server syntax::               
-* channel syntax::              
-@end menu
-
 @node server syntax, channel syntax, bot.conf, bot.conf
 @subsubsection server syntax
 
@@ -215,14 +218,42 @@ 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
+
+@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:
+
+@samp{@var{mask}:@var{channel}:@var{level}:@var{protection}:@var{auto-op}}
+
+@itemize
+
+@item @var{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
+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.)
+
+@item @var{level} is the user level of the user (@ref{User Levels}).
+
+@item @var{protection} is the protection level of the user
+(@ref{Protection}).
+
+@item @var{auto-op} is set to control whether a user is automatically
+given operator priviliges on channel entry (@ref{Automatic Op}).
+
+@end itemize
+
 @node Configuration File Placement,  , Configuration Files, Configuration
 @section Configuration File Placement
 
 Bobot++ will look in @file{/etc/bobotpp/default/} for its default
 config if none is specified on the command line. Put the configuration
 files you want to be loaded by default in this directory. If you are
-not root or you want to have your own personal configuration, put it in
-@file{~/.bobotpp/config/default/}. 
+not root or you want to have your own personal configuration, put it
+in @file{~/.bobotpp/config/default/}.
 
 @node Using the Bot, Scripting, Configuration, Top
 @chapter Using Bobot++
@@ -231,27 +262,73 @@ FIXME: stuff here...
 
 @menu
 * User Levels::                 
+* Protection::                  
+* Automatic Op::                
 @end menu
 
-@node User Levels,  , Using the Bot, Using the Bot
+@node User Levels, Protection, Using the Bot, Using the Bot
 @section User Levels
 
-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}. All users default to @var{none} unless they are changed
-by a script, the @code{!adduser} command or the @file{bot.users}
-file. @var{none} is for everyone---very few commands (e.g. help) are
-available to the users and almost everyone should be this
-level. A @var{user} can execute many of the bot commands, but can't
-use masks on kicks and bans. A @var{trusted} user can everything a
-@var{user} can do, but can also use masks on kicks and bans. A
-@var{friend} can do everything except for stopping the bot (be
-careful who you give this to!). The @var{master} level is for the
-bot's owner (probably you) and can do @emph{everything} to the bot. Be
-@emph{very} careful if you give @var{master} level access to anyone
-else. You cannot use this symbolic levels with the @code{!adduser}
-command. See (FIXME: ref) for the numbers you must use with
-@code{!adduser}.
+There are several user levels available in Bobot++ to provide gradated
+access to commands. @command{!adduser} and @file{bot.users} use the
+numeric code; Scheme uses the textual name for the level. By default
+(if no catch-all setting is found in @xref{bot.users}.) a user is not
+even a @code{bot:user-none} and cannot execute @strong{any} commands,
+even commands available to @code{bot:user-none}.
+
+@enumerate 0
+
+@item @code{bot:user-none} - No @strong{built-in} commands may be
+executed @emph{by default} (commands may be added from Scheme that can
+be executed by users of level none and the level required to execute a
+command may be changed from Scheme).
+
+@item @code{bot:user-user} - Will be able to execute most commands but
+not all and cannot use masks on kicks and bans.
+
+@item @code{bot:user-trusted} - For built-ins with a default
+configuration this user has access to the same set of commands as an
+@code{user} but may use masks on kicks and bans. Scheme commands may
+be added which require a user to be of this level.
+
+@item @code{bot:user-friend} - In the default configuration a user who
+is a friend will be able to do everything short of stopping the
+bot. Again, there may be user added commands that require a higher
+user level.
+
+@item @code{bot:user-master} - This is the highest user level and has
+access to every feature of the bot.
+
+@end enumerate
+
+@node Protection, Automatic Op, User Levels, Using the Bot
+@section Protection
+
+A user added via Scheme, the @file{bot.users} file, or
+@command{!adduser} may be protected from being deoped, kicked, or
+banned. There are currently no symbolic levels in Scheme; just use the
+numeric code.
+
+@enumerate 0
+
+@item No protection
+
+@item No ban. If a user is banned the bot will unban him..
+
+@item No kick. The user may still be kicked but the bot will kickban
+the user who kicked the protected user.
+
+@item No deop. The bot will ensure that the user always maintains
+operator status.
+
+@end enumerate
+
+@node Automatic Op,  , 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 Scripting, Concept Index, Using the Bot, Top
 @chapter Scripting
@@ -266,9 +343,10 @@ a good tutorial on Scheme.
 Note that in previous versions the scripting commands where in the
 form @code{bot-@var{function}}. They are now in the form
 @code{bot:@var{function}}. The old names are still available, but are
-deprecated and will be removed in Bobot++ 2.4. The command
-@command{perl -pi -e ``s/bot-/bot:/g'' @var{your-files}} should be enough to
-convert your code to use the new functions. 
+deprecated and will be removed in Bobot++ 3.0. New commands are only
+available with the @code{bot:} prefix. The command @command{perl -pi
+-e ``s/bot-/bot:/g'' @var{your-files}} should be enough to convert
+your code to use the new functions.
 
 @menu
 * Adding New Commands::         
index 4614ed1..6af7d10 100644 (file)
@@ -37,18 +37,27 @@ DCCChatConnection::connect()
   if (!socket.connect())
     return false;
 
+  DCCPerson *from = new DCCPerson (this);
+
+  if (Utils::getLevel (bot, from->getAddress()) < User::FRIEND)
+    {
+      from->sendNotice 
+       ("\002You do not have permission to DCC CHAT the bot\002");
+      delete from;
+      return false;
+    }
+
 #ifdef USESCRIPTS
   // run hooks/dcc/chat-begin
-  DCCPerson *tmp = new DCCPerson (this);
   bot->botInterp->RunHooks (Hook::DCC_CHAT_BEGIN, 
-                           tmp->getAddress (),
+                           from->getAddress (),
                            scm_list_n (Utils::
-                                       string2SCM (tmp->getAddress ()),
+                                       string2SCM (from->getAddress ()),
                                        SCM_UNDEFINED));
-  delete tmp;
 #endif
 
 
+  delete from;
   return true;
 }
 
index 2ec1301..c3df33d 100644 (file)
@@ -83,7 +83,7 @@ public:
   static SCM sendDCCChatMessage (SCM, SCM);
 
   // Message sending
 static SCM sendCTCP(SCM, SCM, SCM);
+ static SCM sendCTCP(SCM, SCM, SCM);
   /*
   SCM sendCTCPReply(SCM, SCM, SCM);
   SCM sendChannelMode(SCM);