  This is the documentation for VladBot 3.0
------------------------------------------------------------------------------
Contents:
---------
  0 - Introduction
      0.0 - Disclaimer
      0.1 - Support 
      0.2 - Supporting further development
  1 - Installation
      1.0 - Compiling
      1.1 - The Configuration File
         1.1.1 - Configuring Channels
         1.1.2 - Configuring the AFTF (Advanced File Transfer Facilities)
         1.1.3 - Configuring Logging
         1.1.4 - 2.1-style userlist support
      1.2 - Editing The User Files
  2 - User Commands
      2.0 - User Commands
      2.1 - Adding Users
      2.2 - User Levels
      2.3 - Protected Levels
      2.4 - Shit Levels
  3 - Channel Commands
      3.0 - Communicating with a VladBot
      3.1 -
      3.0 - Updates
      3.1 - Glossary
      3.2 - Differences among modes
      3.3 - Notes
      3.4 - Final word

------------------------------------------------------------------------------
0 - Introduction:
-----------------

  This document explains how to install VladBot version 3.0.  VladBot is a
C bot which resides in IRC.  The coder of this bot program is VladDrac -
irvdwijk@cs.vu.nl.

0.0 - Disclaimer:
-----------------

VladBot - An IRC service bot
Copyright (C) 1994-95 Ivo van der Wijk

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
(at your option) 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., 675 Mass Ave, Cambridge, MA 02139, USA.

0.1 - Support
-------------
There is no support for this release. You can play with it if you like,
but I won't help you setting it up.

0.2 - Supporting further development
------------------------------------
If want to support further development of Vladbot, a donation is appreciated!
People within The Netherlands can tranfer money to accountnumber
55.45.38.490 ABN-AMRO Bussum. People from outside holland can send money 
through snailmail (cash, check, ..) to:

Ivo van der Wijk
v. Ostadelaan 70 IV
1072 TA
The Netherlands
email: irvdwijk@cs.vu.nl

You can also send question etc. to this address (no mailbombs :)

1 - Installation:
-----------------

1.0 - Compiling:
----------------

Before you even begin to configure your VladBot, you must first compile it.  
And, before you can compile, you must edit the Makefile included to your 
system's particular architecture.  VladBot compiles on most platforms, such 
as Linux, AIX, Solaris, etc.  The Makefile is pretty self-explainatory, so
there's no real need to explain it here.  

1.1 - The Configuration File
----------------------------

After you have successfully compiled the VladBot source, you can now create 
and configure your bot.  This section will explain how to set up a simple bot, 
and will tell you what the definitions in the config file mean.

Usually, unless you've hacked the source, the config file is called 
vladbot.cfg.  Most commands are different between each bot.  These commands
are to be put in between the 'NewBot', and 'EndBot' directives.  Each of
these can be cut off to the next line with the '\' character.  Comments are
also supported in the config file.  To make a line a comment, insert a '#'
before it.  Here is a listing and explaination of each of these commands.

----------
    NewBot    	<name>		- This must be before any of these commands.
    			  	  <name> is a unique name given to this 
				  particualar bot.
    Nick	"NickName"	- Set the bot's nickname on IRC.
    Login	"LoginName"	- Set the bot's login name.
    			  	  (ie. LoginName@your.host)
                                  Some servers don't allow 'fake logins'. If 
    			          you have problems connecting, set the login
    			          to your own.
    Name	"MyName"        - This is the name that appears when
    			          someone does a /whois your_bot
    Prefix 	"nb"            - This refers to the bot's command prefix.
    			          It is very similar to the CmdChr.
    CmdChr	'!'             - This is the bot's command character
    			          To use it someone would type '!command'
    UserList    "user.list"     - This is the file that contains the userlist
                                  (3.0 only uses one userlist, so no seperate
    			          user/shit/protlist!)
    Server	"server", port  - This defines a server for your bot to use
    			          This may be used more than once to define
    			          multiple servers. The default portnumber is
    			          6667 if you don't supply one.
    Channel, ChanMode, ChanTopic,
    ChanKey, ChanExtModei, ChanIdleKick 
                                - Channels are higly configurable. See section
                                  1.1.1 for a detailed description

* FTPUpload, FTPDownload an Index will only work if you compiled the bot 
  without AFTF (Advanced File Transfered Facilities).
    FTPUpload   "ul-dir"        - The place where uploaded files go.
    FTPDownload "dl-dir"        - The "root" directory for downloading
    			          from the bot.
    Index	".index" 	- This is the indexfile for the ftp-dcc
    			          feature of the VladBot.

* FTPArea will only work if you compiled the bot WITH AFTF (AFTF is the new,
  BBS-like filesystem for vladbot. It's still under development, and syntax
  may change with every new release!)
    FTPArea	"Name", "Desc", "Path"
                                - Set the root directory for the filesystem.
				  The name of the directory will be 'Name',
				  the description will be 'Desc' and the path
				  will be 'Path'. See seciont 1.1.2 for more
				  info on setting up AFTF
    HelpRoot	"HelpRootDir"	- Set the directory where helpfiles are located,
                                  3.0 supports use of more than one helpfile.
				  All these helpfiles must be located within
				  this directory. AHS (Advanced help system)
				  is still under development and probably very
				  buggy!
    Help	"help.bot"      - This is the Main index helpfile
    Invisible   True/False      - This determines wether or not the bot
    			          the bot is an "invisible" user.  This is
    			          the mode "i" for a user.
    Log         "file", LogType - This is the configurable log option.
    			          It may be used multiple times so that you
    			          can have multiple log types in different
    			          files.  You may alos have more than one
    			          log type per logfile.  A complete listing
    			          and explaination of the LogTypes are in
    			          sections 1.1.3
    registertype TYPE		- Defines the type of user-registration used.
    				  Three types are available:
				  AUTO  = an unknow user is automagically added
				          to the userlist
			          ASK   = A user has to ask the bot to be 
				          registered (/msg bot REGISTER)
			          OTHER = Someone with LIST3 must register
				          (or add with adduser) this user,
					  i.e. /msg bot register vladdrac
    oldusertype TYPE		- Same as registertype. See section 1.1.4 for
                                  more info on 2.1-style userlist support
    olduserlist, oldprotlist,
    oldshitlist                 - See section 1.1.4 for more info on 2.1-style 
                                  userlist support
    sessiontimeout SECONDS	- VladBot keeps information stored for each
                                  active user in a session. This command 
				  defines how long a user should be idle before
				  his/her session is removed form memory  
    floodprot interval, bytes   - This option is used to prevent the bot from
                                  flooding itself to death. If the bot has
				  sent 'bytes' bytes within 'interval' secs,
				  it will stop sending data (i.e. in case of
				  a BOTKILL attack)
    EndBot			- The end of this bot configuration
----------

  Here is a simple configuration for one bot.

----------
NewBot  MyBot
	nick		"MyBot"
	login		"MyBot"
	name		"/msg MyBot !help"
	prefix		"mb"
	cmdchr		'!'
	userlist	"user.list"
	server		"irc.indiana.edu"
	server		"irc.math.ufl.edu"
	server		"poe.acc.virginia.edu"
	channel		"#mychan"
	  chanmode	"#mychan", "+st", 
	  chantopic     "#mychan", "My Bot Channel"
	  chanextmode   "#mychan", KickNetHack, LooseOp, ForceMode, \ 
	                           NoForceTopic
	log		"sys.log", Sys
	log		"dcc.log", DCC
	ftparea		"Main", "The main FileArea", "~irc/bots/mybot/files"
	invisible	True
	registertype	ASK
	oldusertype	ASK
	sessiontimeout	1800
	floodprot	4, 400
EndBot
----------

After you have configured your bot(s), you can now configure the system wide 
variables.  These are the same for each bot, and cannot be modified
seperatly.  Here is a list and explaination of each (in alphabetical order).

----------
    DccBlocksize	   size - Set the size for datablocks when using DCC
    DccMaxSize	           size - Maximum size for incoming files in Kbytes
    Debug		  Level - This defines the debug level for the bot.
    			          Level 0: Show no information
    			          Level 1: Show only errors
    			          Level 2: Show all information.
    DelayOp	       Min, Max - If a users joins a channel, op him/her 
                                  between min and max seconds after joining.
    			          Setting min (or min and max) to 0 will turn
    			          off delayed opping
    DefUMode "Mode_Name",Mode, .. 
                             - Defines a user mode.
    DefPMode "Mode_Name",Mode, ..
                             - Defines a protected mode.
    DefSMode "Mode_Name",Mode, ..
                             - Defines a shit mode.
    FloodParam TYPE, interval, lines, timeout, action
                             - Define action to take when a certain flood
    			       is detected
    Maintainer  	   "???" - This is usually your name and your address
    			           But you can set it to whatever you want.
    pidfile	      "filename" - Tell the bot to store the PID in this file
    ping           send, timeout - Tell the bot to send a PING to the server
                               every 'send' seconds after the last sent
    			       pong (usually reply to ping from server)
    			       and give the server 'timeout' seconds to
    			       respond
    resetrate	    secs - Reset internal values etc. every 'secs' 
                               seconds
    selectwait    secs, usec - make select() waut secs, usec
----------

  A complete, working bot is in the vladbot.cfg file, please see that for more
info.  

----------
----------

And, here are some examples of these commands.

----------
maintainer              "VladDrac - ivo@nijenrode.nl"
debug                   NOISE
dccmaxsize              2048                    # 2 megs
dccblocksize            2048
delayop                 5, 10
floodparam              CTCP,           2,      6,      90,     IGNORE
floodparam              MSG,            2,      4,      90,     IGNORE
floodparam              PUBLIC,         3,      4,      -1,     KICK
floodparam              NOTICE_PRV,     2,      6,      90,     IGNORE
floodparam              NOTICE_PUBL,    2,      5,      -1,     KICK
floodparam              NICK,           3,      3,      -1,     KICK
floodparam              OP,             2,      3,      -1,     KICK
floodparam              DEOP,           2,      3,      -1,     KICK
floodparam              BAN,            2,      3,      -1,     KICK
floodparam              KICK,           2,      2,      -1,     KICK
floodparam              MODE,           1,      5,      -1,     KICK

resetrate               90                      # every 90 secs
selectwait              90, 0                   # 90 sec 0 usec
pidfile                 "~/bots/vladbot.pid"

defumode	"CO_OP", CMD7, FILE3, LIST3, CHAN3, OPER3, NOTE3, GLBL3, SOP
defpmode 	"NORMAL", DEOP3
defsmode	"BAD_USER", SHITACCS3, SHITCHAN3
defumode 	"OPERATOR", CO_OP,OP
----------

1.1.1 - Configuring Channels
----------------------------
VladBot knows 5 cfg-commands to configure channels:
----------

channel  "#channelname"		
	Join this channel on startup
chanmode "#channelname", "modestring"
	This is the mode to set on the channel when the bot joins it. You can
	make the bot enforce the setting of this mode by setting the
	extended channelmode 'ForceMode'
chantopic "#channelname", "topic"
	Set the topic for "#channelname". You can make the bot enforce this 
	setting by setting the extended channelmode 'ForceTopic'
chanidlekick "#channelname", secs
	Kick idle users after 'secs' seconds. (The bot will also do a temporary
	ban on the user to break auto-join.)
chanextmode "#channelname", mode, mode, ..
	Set extended channelmodes. Available modes are:
	ALLOWNETHACK	-	Allow ops-hacking through netsplits
	DEOPNETHACK	-	Deop people that hacks ops through netsplits
	KICKNETHACK	-	Kick people that hacks ops through netsplits
	KBANNETHACK	-	Kickban people that hacks ops through netsplits

	LOOSEOP		-	Allow ops to be spread by anyone
	MODERATEOP	-	Allow ops only to be spread by people with 
				usermode OPER2
	STRICTOP	-	Only users with usermode OPER2 are allowed to
				be operator
	NOANONKICKS	-	Do not allow anonymous kicks throught the
				'kick' command (the bot will show the name of
				the user who requested the kick)
	ANONKICKS	-	Allow anonymous kicks.
	
1.1.2 - Configuring the AFTF (Advanced File Transfer Facilities)
--------------------------------------------------------------
AFTF is pretty simple at this moment, because most of it doesn't work yet :)

Just make ftparea point to the root of your download-tree. There's no seperate
uploadtree, you will have to define yourself in which directories uploading
is allowed and in which isn't.

If no special options are set, the bot picks default values (for example,
directories are not uploadable, all dirs are downloadable). To change these 
values, for example, for the file (or directory 'foo'), edit the file 
.dirinfo in the same directory. This file can contains a line for each file
in this directory (of a file has no correspondig entry, defaults will be used)

The entry for a file will look like this:

----------
name DESC description COST cost OWNER uid PERM mode TYPE type

name = the name of the file
DESC "Description for the file or directory"
	Set a description for a file or directory
COST number_of_cookies
	Set the price of a file. Each user has an amount of cookies. If a user
	downloads a file that costs cookies, the amount will be substracted
	from this users amount of cookies.
OWNER uid
	Set the owner of a file. The paramter is the userid of this user 
PERM mode
	This is a three digit mode. The first digit defines the filelevel needed
	for reading (downloading) the file, the second defines the filelevel
	needed for writing (downloading) - This only applies to directories,
	and the third mode defines the access to fileareas and permission to
	use 'FILES' in the area.
TYPE	
	Currently unused

----------
For example, this is a .dirinfo which I use for Nederserv's root area:

 vladbots DESC "Vladbot release (no 3.0!)" COST 0 OWNER 0 PERM 040 TYPE 1 
 vladbot-3.0 DESC "Vladbot release 3.0 - Unsupported!" COST 0 OWNER 0 PERM 040 TYPE 1
 incoming DESC "Place to put stuff" COST 0 OWNER 0 PERM 400 TYPE 1
----------

I.e. the directories vladbots and vladbot-3.0 are accessible and downloadable
for everyone, but not writable. 
incoming is writable and can be entered by everyone, but ppl cannot download 
from it.

You can set a description for the current filearea in the file .description.
This file contains HTML-formatted text, i.e.

----------
<H1>Nederserv's Filearea's</H1>
<HR>
Some of the fileareas are missing because NederServ has been moved to a 
different machine (temporarily). I will try to make them available as soon
as possible though
<HR>
----------


1.1.3 - configuring Logging
-------------------------
You can define what type of messages should be sent to which file by using
the log-command. The syntax is 
log "file", type, ..

Available types are:
PRIVATE PUBLIC NOTICE MODE KICK JOIN LEAVE QUIT CTCP DCC FLOOD COMMANDS ERROR
SYS

1.1.4 - 2.1-style userlist support
---------------------------------
VladBot 3.0 had 4 commands to support the use of the old 2.1 userlist. 
Conversion from 2.1 to 3.0 is not possible, but it is possible to use the
old userlists next to the 3.0-version.

First of all, define where your old userlists are located:
olduserlist	"user.old.list"
oldshitlist	"shit.old.list"
oldprotlist	"prot.old.list"

Then define conversion values to convert the decimal 2.1-levels to 3.0 
usermodes:
defumode                "0",    CMD1
defumode                "50",   CMD1, FILE1, LIST1, CHAN1, OPER1, NOTE1, GLBL1
defumode                "100",  CMD3, FILE1, LIST2, CHAN2, OPER2, NOTE2, \
                                GLBL1, LOP
defumode                "125",  CMD4, FILE1, LIST3, CHAN3, OPER2, NOTE3, \
                                GLBL3, SOP
defumode                "150",  CMD7, FILE3, LIST3, CHAN3, OPER3, NOTE3, \
                                GLBL3, OP

Finaly, define what to do with this stuff by setting oldusertype. Three values
are possible:
AUTO	-	Whenever the bot sees a new user, it tries to determinte 
		appropriate usermodes by searching the old userlists.
ASK	-	The user has to ask the bot to search the old userlist
		(/msg bot olduser)
OTHER	-	To get his/her old userlevels, a user must be 'olduser-ed' by
		someone with usermode LIST3, i.e.
		/msg bot olduser vladdrac

1.2 - Editing The User Files
----------------------------
There is no need to edit the userlist by hand. Actually, it's pretty much
impossible to do so :)

Just follow these steps to add yourself to the userlist. After that you can
add users from within IRC by sending messages to the bot.

After compilation, start the Bot with the '-c' flag. This will put the bot in
console mode (this is a very misleading name.. there are no console 
possibilities yet). You will see a little menu show up.

Now follow these steps:
L)oad or create a userlist
  * enter the name 'users.list' (or any other, it depends on what you defined in
    the configfile)
A)dd a user
  * Enter your own nick!user@host, for example, if you're currently logged into
    foo.bar.org, your loginname is 'loser' and your nick is 'Lamer', enter the
    string Lamer!loser@foo.bar.org (DO NOT ENTER ANY PATTERNS!)
    Example:
    VladDrac!ivo@zeus.nijenrode.nl
  * Enter your name. Just type your real name.. save the funny comments for 
    later
  * enter a comment... (here you can type your funny comment), or just type 
    enter
  * Enter a passwd. You will need this to identify yourself to the bot
    ("/msg yourbot Identify Password" in IRC)
  * Enter your usermodes. Just enter
    CMD7, FILE3, LIST3, CHAN3, OPER3, NOTE3, GLBL3, OP
    These are maximum values of all usermodes available (trust me)
Q)uit. 
  * The userlist will be written to file.

----------
 Sections 2 and 3 unfinished
----------
