Page MenuHomeDevCentral

No OneTemporary

This file is larger than 256 KB, so syntax highlighting was skipped.
This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
diff --git a/.debug b/.debug
deleted file mode 100755
index 8956314..0000000
--- a/.debug
+++ /dev/null
@@ -1,13 +0,0 @@
-
---------------------------------------------------
-Darkbot should be compiled in DEBUG mode now.
-
-All input/output will be shown on-screen. To
-begin program, type: "run"
-
-If program dies, you can type "backtrace" and
-"where" to check where/why.
-
-juice@darkbot.org
---------------------------------------------------
-
diff --git a/.debug2 b/.debug2
deleted file mode 100755
index 2252bbe..0000000
--- a/.debug2
+++ /dev/null
@@ -1,12 +0,0 @@
-
----------------------------------------------------
-
-Darkbot should be compiled in DEBUG mode now.
-
-All input/output will be logged to darkbot_debug.log
-begin program, type: "./darkbot"
-
-juice@darkbot.org)
-
----------------------------------------------------
-
diff --git a/.gitignore b/.gitignore
index f682731..a000ce6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,8 @@
-/beta/build
-/beta/source/.dirstamp
-/beta/source/*.o
-/beta/source/compat/.dirstamp
-/beta/source/compat/*.o
-/beta/dat/autotopic.ini
-/beta/dat/info2.db.bak*
-/beta/dat/seen.db
+build
+/source/.dirstamp
+/source/*.o
+/source/compat/.dirstamp
+/source/compat/*.o
+/dat/autotopic.ini
+/dat/info2.db.bak*
+/dat/seen.db
diff --git a/beta/COPYING b/COPYING
similarity index 100%
rename from beta/COPYING
rename to COPYING
diff --git a/Makefile b/Makefile
deleted file mode 100755
index 7634b21..0000000
--- a/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-# ------------------------------------------------ #
-# Darkbot Makefile (c) Jason Hamilton 07.06.98 #
-# paul@msunix.co.uk 08/12/2001 #
-# ------------------------------------------------ #
-# To compile Darkbot, just type 'make' #
-# To compile for Win32 (95/98/NT) 'make win' #
-# To compile for Win32 with no console, type #
-# 'make win2' #
-# #
-# To compile in debug mode, type 'make debug' #
-# To compile and have all data be logged to #
-# ..darkbot_debug.log, 'make debug2' #
-# ------------------------------------------------ #
-
-SOURCE_DIR = source
-
-all:
- @cd ${SOURCE_DIR}; make all; cd ..;
-
-win:
- @cd ${SOURCE_DIR}; make win; cd ..;
-
-win2:
- @cd ${SOURCE_DIR}; make win2; cd ..;
-
-debug:
- @cd ${SOURCE_DIR}; make debug; cd ..;
-
-debug2:
- @cd ${SOURCE_DIR}; make debug2; cd ..;
-
-clean:
- @echo "Cleaning ..."; cd ${SOURCE_DIR}; make clean; cd ..;
diff --git a/beta/README b/README
similarity index 100%
rename from beta/README
rename to README
diff --git a/README.txt b/README.txt
deleted file mode 100755
index 87121cb..0000000
--- a/README.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-Darkbot, Talking Robot - Copyright (c) 2006 Darkbot Project
-
-- To configure your Darkbot on Unixes, run ./configure script.
-- To configure on Windows edit files in dat folder.
-
-- For full documentation and step by step configuration help,
-please check Darkbot's help page at http://www.freezedown.org/
-
-- Read WHATSNEW for added/latest features and changes.
-_ Read README_UTILS for info on shell utilities and all fiels in
-scripts dir.
-
-- If you are running a Darkbot with version release prior to 7.0
-use convertdb to convert your userlist.db to an encrypted password
-format. Users will need to set their passwords on IRC which initial
-value would be 0(zero). convertdb script and all integrated Darkbot
-utility scripts are on scripts directory.
-
-- If your bot is stupid, and you want it to know some general
-stuff, download pre-made databases from Darkbot site. You should be
-aware of database mechanics before installing and running any database.
-
-This program is provided free for non-commercial use only. Any
-commercial use of this source code or binaries compiled thereof
-requires the prior written consent of the project administrator.
-Distribution of modified source code or binaries compiled from
-modified source code for any platform is expressly forbidden!
-All code patches to be applied to the program are donations to
-the project and must remain under this terms and conditions.
-No code with copyright statments other than the ones ruled by this
-project is accepted unless agreed by all parties in writing.
-All Darkbot program and information is provided as is without
-warranty of any kind. In any event shall Darkbot project or any
-of it's collaborators be liable for any damages whatsoever.
-If you do not agree with the above user disclaimer, please do not
-use the program and delete all Darkbot files.
-Contact juice@freezedown.org with any questions regarding the use
-of this program.
-
-Darkbot is a creation of Jason Hamilton [ Jason@superlink.net ]
-and has been coded by several contributors who donates their
-code patches to the project. Please read file contributors on
-docs directory with a list of who makes this program possible.
-
-
-juice
- Project Administrator
-( juice@freezedown.org )
diff --git a/beta/VERSION b/VERSION
similarity index 100%
rename from beta/VERSION
rename to VERSION
diff --git a/beta/autogen.sh b/autogen.sh
similarity index 100%
rename from beta/autogen.sh
rename to autogen.sh
diff --git a/beta/dat/deop.ini b/beta/dat/deop.ini
deleted file mode 100755
index e69de29..0000000
diff --git a/beta/dat/info2.db b/beta/dat/info2.db
deleted file mode 100755
index e69de29..0000000
diff --git a/beta/dat/perform.ini b/beta/dat/perform.ini
deleted file mode 100755
index e69de29..0000000
diff --git a/beta/dat/permbans.db b/beta/dat/permbans.db
deleted file mode 100755
index e73956d..0000000
--- a/beta/dat/permbans.db
+++ /dev/null
@@ -1,2 +0,0 @@
-# This is an example. Use comments like this.
-*@postedialppwhatever*.ulaval.ca 0 Permbanned!
diff --git a/beta/dat/quiz.db b/beta/dat/quiz.db
deleted file mode 100644
index 3f82f94..0000000
--- a/beta/dat/quiz.db
+++ /dev/null
@@ -1,5 +0,0 @@
-What is 1+1?@The answer is 2!
-What is 1+2?@The answer is 3!
-What is 1+3?@The answer is 4!
-What is 5+5?@The answer is 10!
-What is 2+2?@The answer is 4!
diff --git a/beta/dat/random.ini b/beta/dat/random.ini
deleted file mode 100755
index 577eedc..0000000
--- a/beta/dat/random.ini
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This is the random prefix said before answering a
-/* question that uses no variables.
-/* Put a space after each reply line...
-/*
-/* Nick = ^
-/* Bold = %
-/* Underline = &
-/* Inverse = ~
-/*
-hmmmmm... ^,
-well, ^%:%
-^ I think
-heh&,&
-^ heh,
-^: well,
-welp... ^:
-&(&^&)&%:%
-%[%^%]%
-^:
-^
-~(^)~
-%=%^%=%:
diff --git a/beta/dat/randomstuff.ini b/beta/dat/randomstuff.ini
deleted file mode 100755
index 01ae644..0000000
--- a/beta/dat/randomstuff.ini
+++ /dev/null
@@ -1,82 +0,0 @@
-yo quiero taco bell
-You're not fully clean until you're darkbot clean.
-jeje 10x
-word up!
-ice ice baby
-do be do be do
-\\//\\//hatever!
-as if...
-de plane boss, de plane!
-+is magicaly delicious.
-you're one sick little puppy!
-+looks around
-heh
-+thinks there is too much lag...
-+can't wait till he gets his T1 in his room
-oh btw...
-DarkBot: Australian for beer.
-+ZZzzzZZzzzzZZzzz
-blah blah
-Anyone here, not a bot?
-It's another slow night...
-;)
-heh
-+likes candy
-hmmmm...
-I even use BX.
-How can rew assist you today?
-Nintendo is neat.
-Why are there so many lamers out today?
-Hello
-Who's awake?
-+is back from the dead. Gone 12 days 4 hrs 43 mins
-hey
-y a w n
-Anyone wanna see my pic?
-a/s/l
-Who wants free ram?
-Life is good.
-Just do it.
-Elvis has left the building!
-(800) DARK-BOT, call today!
-Darkbot, got it in you?
-I need a drink
-+is hungry
-Feed me
-+is away: (backing up databases)
-I hate candy.  NOT
-heh heh
-ha
-sheesh
-...
-I like garbage ... no, the band, silly.
-c-a-n-d-y, man's best friend.
-Any hot females here?
-+is a hot robot looking for a hot bot girlie
-I have 128 meg ram.
-I'm definately not on a puny dialup.
-I just dropped my contact.. brb
-I have a 25" monitor. 1600x1200 res.
-What's playing in the movies?
-Heere leezard leezard leezard!
-"Deep Impact", heh!
-bada bing
-bada boom
-=]
-*8)
-;P
-Is that a mouse in your pocket, or are you just glad to see me?
-any hot bots wanna chat?
-burp
-+flashes the channel.
-did i do that!!???
-look up in the sky...
-it's a bird...
-it's a plane..
-it's SuperMan!
-i'm nekkid *blush*
-not only am i the president, i'm also a client!
-+thinks you all need hair club for men!
-anyone seen my garden weasel?
-BIG bada boom!
-say hello to my little friend.
diff --git a/beta/dat/rdb/dunno.rdb b/beta/dat/rdb/dunno.rdb
deleted file mode 100755
index a3744e6..0000000
--- a/beta/dat/rdb/dunno.rdb
+++ /dev/null
@@ -1,11 +0,0 @@
-whut?
-what are you talking about?
-eh?
-I don't know what you're talking about.
-what do you mean?
-I dunno.
-I don't know.
-I'm not sure on that one.
-I might know later on.
-No idea.
-huh?
diff --git a/beta/dat/rdb/whut.rdb b/beta/dat/rdb/whut.rdb
deleted file mode 100755
index 9f68b2f..0000000
--- a/beta/dat/rdb/whut.rdb
+++ /dev/null
@@ -1,9 +0,0 @@
-hmm?
-whut?
-yes?
-yes N~?
-what N~?
-N~, what?
-N~, whut?
-yah?
-sup N~?
diff --git a/beta/dat/servers.ini b/beta/dat/servers.ini
deleted file mode 100755
index e841a3a..0000000
--- a/beta/dat/servers.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-# Freezedown "Darkbot" Server
-irc.freezedown.org 6667 nopass
-
diff --git a/beta/dat/setup.ini b/beta/dat/setup.ini
deleted file mode 100644
index a2141e7..0000000
--- a/beta/dat/setup.ini
+++ /dev/null
@@ -1,62 +0,0 @@
-ANTI_IDLE=0
-BITCH_DEOP=0
-BITCH_DEOP_TEXT=grr, someone op me!
-BITCH_KICK_TEXT=grrr, kick me again and I'm going to...
-BOT_CMD_CHAR=!
-BOT_NICK=Darkbot
-BOT_NAME=http://www.freezedown.org
-BOT_USER_ID=database
-BOT_USER_MODE=+i-ds
-BOT_VHOST=0
-CONNECT_TIME=10
-DEFAULT_CHANNEL=#darkbot
-DISPLAY_SYNC=0
-DO_WHOIS=0
-DUNNO_TEXT=*shrug*
-DUNNO_RANDOM_TEXT=1
-DUPS_REMOVE=0
-DUPS_SAVE=1
-ENTRY_EXISTS_TEXT=Sorry, there is an existing entry under keyword
-ENTRY_NOT_EXIST_TEXT=I was unable to find entry:
-FIND_NO_TEXT=Sorry, I don't have any entry for
-FIND_WHAT_TEXT=What am I trying to find
-FLOOD_NOTICE_KICK=1
-FLOOD_NOTICE_BAN=0
-FLOOD_NOTICE_BAN_HOST=0
-FLOOD_KICK=1
-FLOOD_TEXT=Don't flood!
-GREET_GUESTS_TEXT=0
-GREET_NEW_TEXT=0
-GREET_USER_TEXT=1
-IGNORE_TIME=5
-IGNORE_USER_TIME=60
-KICK_TEXT=Requested!
-KICK_ON_BAN=0
-LOG_CHANGES=1
-LOG_PRIVATE=1
-OP_ON_LOGIN=0
-OUTPUT1_COUNT=4
-OUTPUT1_TIME=1
-OUTPUT2_COUNT=6
-OUTPUT2_TIME=2
-OUTPUT_PURGE_COUNT=7
-OUTPUT3_TIME=3
-PERFORM_TIME=1
-QUESTIONS_GENERAL=1
-QUESTIONS_PRIVATE=0
-RANDOM_BACKUP=0
-RANDOM_IDLE_TIME=1800
-RANDOM_TIME=3600
-SEEN_MODE=1
-SEEN_TIME=604800
-SEEN_TEXT=in the last 7 days.
-SETINFO_TEXT=My !setinfo variables are: ^ nick, % Number of joins, & Channel, $ user@host. Example: !setinfo ^ has joined & % times!! (also, if you make the first char of your SETINFO a "+" the setinfo will be shown as an ACTION)
-SLEEP_TIME=300
-SLEEP_TEXT=ACTION falls asleep... ZzzZZzzZZzz
-SLEEP_WAKE_TEXT=ACTION wakes up from a snooze..
-SORT_DB=0
-TOPIC_TIME=1800
-VARIABLES_TEXT=Data variables are: N~ (Nick), C~ (Chan), T~ (Time/date) B~ (Botnick), Q~ (Question asked), R~ (random nick), !~ (command char), S~ (current Server), P~ (current port) V~ (botVer), W~ (db WWW site), H~ (u@h), t~ (unixtime), BAN (sets a ban), TEMPBAN (bans for 60 sec)
-VOICE_ON_JOIN=0
-WHUT_TEXT=hmmm?
-WHUT_RANDOM_TEXT=1
diff --git a/beta/dat/stats.db b/beta/dat/stats.db
deleted file mode 100755
index e69de29..0000000
diff --git a/beta/dat/userlist.db b/beta/dat/userlist.db
deleted file mode 100644
index 99cc1b2..0000000
--- a/beta/dat/userlist.db
+++ /dev/null
@@ -1,5 +0,0 @@
-#* *juice@*.dhcp.embarqhsd.net 3 1 password I haven't used !SETINFO yet!
-#* *dvs1@58.165.* 3 278 password How's it hangin' ^, welcome to &.
-#* *dvs1@124.176.* 3 278 password How's it hangin' ^, welcome to &.
-#* *dvs1@124.109.* 3 278 password How's it hangin' ^, welcome to &.
-#* *dvs1@202.155.* 3 278 password How's it hangin' ^, welcome to &.
diff --git a/beta/docs/README_UTILS b/beta/docs/README_UTILS
deleted file mode 100755
index 5500f9c..0000000
--- a/beta/docs/README_UTILS
+++ /dev/null
@@ -1,373 +0,0 @@
-:::WARNING::: Do not use these script with darkbot they need updated.
-
- Shell Utilities Help
-
-All shell utilities mentioned here with exception to 'configure' must be
-in /scripts directory.
-
-For support, malfunctions, suggestions, please visit our forum.
-http://forum.freezedown.org
-
-----------------------------------------------------------------------
-
-AddServer
-AddUser
-check-integrity
-configure
-convertdb (not a shell utility)
-dbcron
-download-databases
-kill.darkbot
-live-update
-restart.darkbot
-
-----------------------------------------------------------------------
-###########
-AddServer #
-###########
-
-Basically what this script does is managing your servers.ini file by adding
-removing and changing servers and ports.
-
-You have the option of manipulating only your local servers file or downloading
-an updated server list from the International Federation of IRC and work with
-those servers.
-
-On all lists the servers are preceded by a number (which is not in fact part of
-the files) to help you better choose or manage each entry.
-
-On the remote servers list the ports displayed on the right are only for your
-reference and corresponds to all available ports. It's recommendable to select
-option 2 on the menu to load the external servers before changing local ports
-so you'll have updated information to deal with.
-
-If you decide to move all remote list to your local file, port 6667 will be
-used for all servers. You can later change that port for each server on the
-main menu, option 8.
-
-On all lists PgUp/Down or arrow keys scrolls the text; Q quits from the list.
-CTRL+C aborts at all times.
-
-To launch the utility write ./AddServer. For a quick server entry write:
-./AddServer server port (ex: ./AddServer irc.server.here 6667 )
-
-----------------------------------------------------------------------
-#########
-AddUser #
-#########
-
-Manages user access on Darkbot
-This utility displays, adds and removes user entries on your userlist.db file.
-Usage: AddUser [-option|s]
- To launch the utility and go to it's menu write $0
- For a quick user entry write:
- ./AddUser userid@host level
- Ex: ./AddUser *whateverid@*host.domain.net 2
- (It will add an user with access level 2 to all channels).\n
- ./AddUser -h Shows this help information
-
-While displaying file contents all entries are preceded by a number (which is
-not in fact part of the files) to help you better choose or manage each user.
-If the entries goes over screen size ( as this help text for sure will ) use
-arrow keys or PgUp/Down to scroll and type Q to quit, or scroll the list to
-it's very end so it will automatically exit and proceed to the next function.
-CTRL + C aborts at all times.
-
-How userlist.db is composed... How to enter values...
-dat/userlist.db is the file where all user access records are stored.
-
-Every entry should have:
-<#channel(s)> <userid@host> <seen user> <level> <password> <greeting message>
-
-When entered online the command line should be:
-!ADDUSER #channel *userid@host.domain level 0 (where level must be 1,2 or 3)
-
-- Channel field can be:
-#* - it gives user access to all channels
-#channelABC - it gives user access to #channelABC only
-#channel1,#channel2,#etc - it gives user access to #channel1,#channel2,#etc
-
-- On the user id field
- correct - *userid (or) *useri*
- not recommended - userid (or) *
- incorrect - ~userid (or) *!*userid (or the use of ! and ~ anywhere)
-
-- On the host field
- Static IPs (IP never changes) - You should use it as is, i.e.:
- if your IP is like this ...
- myhost.123.mydomain.net
- myhost.mydomain.net
- 11.222.12.123
- ... you can leave it as they are.
- Dynamic IPs (IP is different on each connection)
- You must use asterisks (*) and/or question marks (?) on the changeable areas
- Examples:
- on : myhost.123.mydomain.net
- use: myhost.*.mydomain.net (or) myhost.???.mydomain.net
- on : myhost.mydomain.net
- use: *.mydomain.net
- on : 11.222.12.123
- use: 11.222.12.* (or) 11.222.*
-
- Host Masks can NOT have spaces or any other characters or symbols besides the
- ones mentioned above.
-
-- Seen field
-Starting as default value of 0 it will increase with the times Darkbot sees
-the user accessing it's channels.
-This field is automatically generated by Darkbot so no user intervention
-is needed when adding an user online.
-
-- Level field
-User levels allowed are:
- 1 = Database Management commands
- 2 = Channel Operation + Database Management commands
- 3 = Administrator - All commands
-
-- Password field
-When added online trough the !ADDUSER command or entered directly on the file
-for the first time while adding an user should be a zero (0).
-When the user issues the online command /msg Darkbot pass 0 new_password
-the new password will be encrypted on the file (on latest releases).
-Be aware however if you have on defines.h LOGS activated, the message issued
-by the user to Darkbot will not be encrypted. Turn LOGS off if you don't
-want that to happen.
-
-- Setinfo field
-It will have a default message like 'I need to use !Setinfo'. When any
-value entered could have a 0 (zero), which deactivates the function, or a
-greeting message Darkbot displays when the user joins a channel.
-You can see a short help online by typing !SETINFO
-
-----------------------------------------------------------------------
-#################
-check-integrity #
-#################
-
- Checks all dat files for common mistakes/errors
-
- Darkbot must be offline for most of saved information be effective.
-
- Usage: <file|s|all> [-option|s]
-
-Examples:
-./check-integrity all
-./check-integrity info2 userlist
-./check-integrity all -nointro
-./check-integrity random perform -nointro -quick
-./check-integrity -report
-
-Available command line triggers for files are:
-all; info2; servers; setup; perform; userlist; random
-(all checks all files; random checks all files with random entries)
-
-Available command line triggers for options are:
- -quick Speeds up the process bypassing pauses (sleep instances)
- -nointro Bypasses introductory information *
- -report Shows report file contents
- -topicsize sets info2.db's topic length (default 50) *1
- -replysize sets info2.db's reply length (default 400) *1
- -default Returns program to it's default values removing all options
- -h Shows a brief usage help
- * The values of these options will be retained unless you use -default
- *1 This setting is only necessary if you are using a different length
- then the one defined on defines.h file
-
-To trigger a parameter write ./check-integrity followed by one or as many
-files or options you want.
-- All operations are done on a working temporary file, leaving it's original
- intact.
-- All removed items/entries from any file are recorded on the report file.
-- No files are definitely saved after changes without a prior bakup being made
- on the original directory.
-
-- This is a non interactive utility, i.e., no user intervention is needed.
- However, all steps of the process are paused during up to 5 seconds so
- the user can follow it's progress by reading it's messages. If the user
- wants to speed up the process option '-quick' must be used at command line
- so all sleep/pause instances will be bypassed.
-
- Main Features
- Line Feed check - verifies if there is a line feed at the end of files
- Empty Lines - Cleans all empty lines wherever they are on the files
- Incomplete Entries - Checks if there are topics with no replies on info2
- Duplicate Entries - Checks for repeated lines on some files
- Duplicate Topics - Checks for duplicate topics on info2
- Topic Length - Checks if topic length on info2 is under the limit
- Data Length - Checks if data length on info2 is under the limit
- RDBs check - verifies if there are RDBs on info2 without links to files
- and files on dat directory wihout RDB links
- Random Files - Checks if total number of random entries is correctly
- posted on the first line on randomstuff.ini, random.ini and all
- RDB files or removes it in case local version is RC4 or later.
- Setup.ini - Checks syntax; misplaced spaces; missing values
- Servers.ini - Checks syntax; missing ports
- Perform.ini - Default checks (empty lines and line feed)
- Userlist.db - Checks for missing '#' on channels field; missing or
- incorrect IPs; incorrect leading '~' and '*!' or missing '*' on userid
- field; user levels; seen field; password field; setinfo field
-
-This utility executes a considerable amount of operations during
-file integrity verification. It depends on the size of the files
-to be checked and errors to correct the time it takes to perform
-all it's functions with accuracy.
-All process is done without user intervention, so be patient and
-wait until it is done or leave it working and check afterwards
-it's final results on the integrity-report file or by typing
-./check-integrity -report
-If you are in a rush type ./check-integrity -quick
-If you get wrong results on final counts due to unpredictable
-characters or symbols you might have on your files please help
-us correct the problem by participating it on the forum.
-To abort all operations at any time press CTRL + C
-
-----------------------------------------------------------------------
-###########
-configure #
-###########
-
-Goes over all basic configuration of your Darkbot.
-You must run this script when on first installation of Darkbot.
-
-----------------------------------------------------------------------
-###########
-convertdb #
-###########
-
-(Not a shell utility)
-
-Syntax: ./convertdb -convert
-
-It converts old Darkbot versions userlist.db passwords (prior to series 7.0)
-into an encrypted format.
-You have copied your pre 7f0 userlist.db in to the dat directory
-DO NOT use this utility if You have created a brand new darkbot, and have no
-users.
-
-All users added with this script will have a password of 0
-and should set their new password on IRC by issuing the command
-/msg Darkbot pass 0 new_password.\n
-
-Be aware if you are logging private messages the encryption
-will not cover them, making it possible to see passwords
-on the logs. So turn logs off on defines.h if you don't want
-that to happen.
-
-The file on scripts directory it's already compiled. However, if you
-compile it's source on a non cygwin environment it's bin should
-be placed on scripts directory and being so userlist relative path
-should be "../dat/userlist.db" and "../dat/temp.db".
-Under cygwin the executable should be placed on Darkbot's root dir
-due to the necessity of cygwin dynamic library.
-If that is the case read the instructions and edit source/convertdb.c
-
-
-----------------------------------------------------------------------
-########
-dbcron #
-########
-
-Utility to auto generate crontab job on Darkbot checking if it is connected
-during a cycled period of time.
-
-When you first run it a new file is created overwriting original one and
-the actual cron working engine is installed and it will remains active,
-providing it's path and Darkbot's path remains the same.
-
-If for any reason you've changed your Darkbot directory or it's binary
-you'll need to modify the variables DBPATH DBBIN and DBPIDFILE on top of
-the newly created file accordingly to the actual values.
-
-Defaulty crontab job is of 10 mins interval. If you wish to change it
-edit '0,10,20,30,40,50 * * * *'. If you don't understand it type 'man crontab'
-
-How main engine works:
-Changes to darkbot root dir; if pid file exists extracts pid number;
-tests it by issuing an inoffensive kill; if pid is active exits, doing
-nothing; if not means the file with pid is there but there is no active
-process, so removes it. finally cheks if program bin exists then starts it.
-
-
-----------------------------------------------------------------------
-####################
-download-databases #
-####################
-
-Downloads available pre made database files from Darkbot's site.
-After download is made to your computer the pre-made database(s) will be
-installed definetely on info2.db file after a series of integrity checks
-done in conjunction with check-integrity utility.
-
-
-----------------------------------------------------------------------
-##############
-kill.darkbot #
-##############
-
-Kills Darkbot pid
-
-----------------------------------------------------------------------
-#############
-live-update #
-#############
-
-Updates local Darkbot files directly from Darkbot site
-
-Program Usage:
- ./live-update [OPTION]
- ./live-update: (with no option) executes the program
- ./live-update -u Undo last changes
- ./live-update -n News - (latest news usually related to updates)
- ./live-update -v (v0, v1, v2) Verbose mode.
- ./live-update -h Help info (this one)
- ./live-update -o Turns Live Update ON or OFF
- NOTE: - By switching live-update OFF you'll not be able to receive
- live updates!
- - Settings for verbose are 0=Stealth/silent; 1=Minimal messages
- (default - no prompts if no updates present); 2=all available
- program messages.
-
-This script checks if there is any news update, pre-made database
-or a most recent code release by comparing the contents of local
-installation with the information obtained from the site.
-
-In practice this utility starts by checking program integrity -
-- if it passes goes to Darkbot site and downloads a piece of code
-which contains the updates ids - those ids are compared with the
-information stored locally - then checks if there is any news you
-should read.
-At the same time compares the installed code with most recent one -
-- if there is necessity of code updates then patches all files with
-the most current one, backing up all modified files. The update will
-be done file by file on the same installation or by creating a new
-directory with the name of the new release id on $HOME/darkbot-Ver
-directory. Previous data files on dat directory are transferred to the
-new installation. Old dynamic files like defines.h or darkbot.c are
-transferred to the newly created source directory, with extensions .OLD.
-The utility checks also if there is any new pre-made database in
-conjuction with download-databases engine.
-If the user wants to reverse (UNDO) the update process could do so with
-the command ./live-update -u (not affecting downloaded databases).
-A backup of all modified files/dirs is kept on .scriptutils/liveupdate/
-working directory for the engine (do not remove it).
-When typed ./liveupdate and nothing happens means there are no updates.
-To do:
- - automatic update of the new defines.h file;
- - this utility being also integrated on a shell GUI.
-
-Be advised that if you change Darkbot version from source files this
-utility will not work. There is no reason to waste time and bandwidth
-on an adultered program. The same will happen if you move or remove
-source files from their original locations.
-
-For support, use the forum at http://forum.freezedown.org
-
-
-----------------------------------------------------------------------
-#################
-restart.darkbot #
-#################
-
-Restarts Darkbot
-
-
diff --git a/beta/docs/TODO b/beta/docs/TODO
deleted file mode 100644
index e60c290..0000000
--- a/beta/docs/TODO
+++ /dev/null
@@ -1,211 +0,0 @@
-----------------------------------------------------------
-The TO-DO List For Darkbot
-----------------------------------------------------------
-These are features that are in the planning stages, or
-that haven't been completely worked out, yet. Also, any
-suggestions that people have made, that are planning to
-be added, will be listed here.
-
-Features and bugs are also being tracked via the sf.net
-trackers at http://sourceforge.net/projects/darkbot
-----------------------------------------------------------
-
-
-- Freenode uses different identd syntax n=blah@host, update
- masking to use this and remove the n= part.
-
-- Make setnick command not spit out the message in room
- about changing nicks after the effect.
-
-- Add escape character for | in topic responses so you can
- output a | rather than use multiline replies. Other places
- need escape character options too.
-
-- Add option to make the bot not kick/ban people who are
- logged in with access to the bot.
-
-- Add googlesque queries to search command, so you can
- excluse words from searches.
-- plural functions still needs to be implemented in spots,
- about half of the functions use a different parsing
- mechanism that still works, because I hadn't thought of
- adding a "startarg" parameter to my db_argstostr()
- function before that point. i will update these later.
-
-- chanserv_topic function needs to be a private message
- command and accept channel arguments (easy, but to
- remember for later).
-
-- atoi needs to be swapped for strtol in all places
- since atoi isn't as safe.
-
-- Some kind of solution for large numbers needs to be
- worked out for use with the unixtime user command.
- Implementations with 32 bit instead of 64 bit longs
- are limited to time representations in a range
- consisting of only up to one more place value than
- the current unixtime, and is a system dependant
- value.
-
-- Add some kind of escape sequence or special parsing
- for topics that start with key words like "WHAT", these
- words are also recognized internally by the bot for
- answering questions.
-
-- Multi-channel randomstuffs. I want to make it possible
- for every channel specified in setup.ini as the home
- channel, in the case of multiple home channels, has
- their own randomstuff timers that output randomstuffs
- according to the action going on, for each specific
- channel.
-
-- Fix broken commands. weather.
-
-- Write things to replace the stuff that Windows can't do.
- Backup command, etc.
-
-- Make the output of the MEM command more useful and friendly.
-
-- Make the google command (and maybe all other web
- lookup commands) more robust.
-
-- Add internet movie database (http://www.imdb.com) and
- slashdot news (http://slashdot.org) searches.
-
-- Single login, remembered across channel part/joins etc.
-
-- Changing the bot's nick needs some testing and tweaking.
-
-- IPv6.
-
-- Merge acronym, 21, lurker, syndet, pantheon, and serv
- into darkbot. All are linked to from the darkbot pages.
-
-----------------------------------------------------------
-onefang's TO-DO List For Darkbot
-----------------------------------------------------------
-
-Add a show parameters command.
-
-Deal with scripts/dbcron one way or another.
-
-Update the INSTALL instructions.
-
-Double check the in code summaries for setup parameters.
-
-Allow multiple command characters - SETCHAR !'~
-
-Convert use of the obsolete gethostbyname() to getaddrinfo().
-
-The alarm() may not be portable enough. Replace multiple alarm() calls
-with a single setitimer() call. Give alarm() the benefit of the doubt
-for now.
-
-The first argument passed to the various select() calls could be better,
-it's more efficient to actually calculate that.
-
-Add a callback to the webinfo structure and otherwise restructure the
-web stuff so that disabling a web command can #ifdef out all the code for
-that command.
-
-Merge all the scripts plus convertdb into darkbot so that all admin
-stuff can be done from IRC, command line, or text UI.
-
-Make the replaceable params in responses consistant. X~ and %X.
-
-If possible, make all !set foo=bar stuff change the current state of the
-bot rather than requiring a restart.
-
-Scripting or modules. Scripting using embryo is a really good option.
-A limited subset could be used for the calc command as well.
-
-Find a cross pratform Windows/unix GUI toolkit we can live with and
-create a GUI for darkbot admin.
-
-Make multiple random responses easier to setup.
- admin: bot add foo bar | baz | some other response
- user: foo is also blah
- admin: bot add foo | another answer
-
-Menu in PM. Plain one liner, colour one liner, multiple lines, colour multiple lines.
- user: /msg bot menu
- >bot<: Main menu - 1) factiod comands, 2) user commands, 3) channel commands, B) backup one menu, Q) quit menu.
- user: /msg bot menu big
- >bot<: Main menu -
- >bot<: 1) factiod comands
- >bot<: 2) user commands
- >bot<: 3) channel commands
- >bot<: B) backup one menu
- >bot<: Q) quit menu.
-
-Don't give long answers in channel, only in PM. Instead, give a summary
-in channel, and inform user that a longer response is available via PM.
- bot: summary of foo bar. (PM "foo bar" for more.)
- luser: PM "foo bar"
- bot: PM "foo bar" means to send me a private message you idiot. Try this command "/msg bot foo bar".
-
-Make the bot gender definable, defaulting to female. Allow users to
-register their gender. Auto convert all relevant text to proper gender.
-
-Add memos "tell onefang that foo", as opposed to factoid telling "tell
-onefang about bah". Allow memos to yourself. Fix alarm and tie that in
-as well, alarms to others and to self. Limit memos & alarms to karma
-memos & alarms per hour to limit abuse.
-
-Allow unlogged in users to create factiods, and change these factoids, plus
-make additions to factoids.
- luser: blah is humbug.
- user: blah?
- bot: luser tells me that blah is humbug. luser may have been drunk at the time.
- luser: known fact is wrong.
- user: what is known fact?
- bot: Known fact is correct. On the other hand, luser thinks that known fact is wrong.
-
-Channel logging, and playback to PM.
-
-wtf, add a karma system.
- use it to sort the unlogged user added factoids.
- bot: luser tells me that blah is humbug. Others have more to say, but I trust luser more. (PM "blah" for more.)
- Use it to refer people to the highest karma person.
- bot: Dunno, ask High_Karma_Dude.
- Use no karma and negative karma as extra security levels. No karma = -1, negative karma = (karma / 100) - 2
-
-Keep track of how much she has been fed, deny taking food from strangers
-(low/no karama users). This implies that botsnack become an information command.
-
-data include files.
- Keep track of what database include files are not used for a while, and unload
- them, keeping the questions and a pointer to the file though.
-
-Multiple server/channel support like xchat.
- Allow different data per server/channel, using includes for common stuff.
- Allow different setup per server/channel.
-
-Keep track of unanswered questions, for two reasons -
- So the admin can look through it later and add factiods if needed.
- If the user is still around (and given a suitable timeout) answer the
- question if an answer arrives.
-
-Implement the Porter-Stemmer algorithm to improve English-language
-searching as per the drupal module of the same name. It reduces each
-word in the index to its basic root or stem (e.g. 'blogging' to 'blog')
-so that variations on a word ('blogs', 'blogger', 'blogging', 'blog')
-are considered equivalent when searching. This generally results in
-more relevant results. Also, start by stripping out all punctuation.
-On the other hand, question marks mean it is more likely to be a
-question. Same applies to use of the W words near the beginning, they
-are more likely to be questions.
-
-Add a locale to weather codes database or search facility. Combine all
-the weather commands into one. Make it return metric results.
-
-Command to guess a users timezone, and show time in that zone.
-
-Random greetings, random channel topics, etc.
-
-Interface other shell commands, but be secure. In fact, setup a chroot
-for arbitrary shell commands.
-
-Allow DCC to and from a file server.
-
-Channel protection - mass join, mass kick.
diff --git a/beta/docs/WHATSNEW b/beta/docs/WHATSNEW
deleted file mode 100644
index da7f014..0000000
--- a/beta/docs/WHATSNEW
+++ /dev/null
@@ -1,988 +0,0 @@
-
- *******************************************************
- Warnings, errors, malfunctions, code patches, suggestions
- Support Forum: http://www.freezedown.org/forum
- (order is reverse-chronologic)
- *******************************************************
-
-
-Darkbot 8rc4: May 13, 2009
- - Fixed DIE, NICK, METAR, PART, RANDQ, RANDQ2, RDB, STATS, TAR,
- TELL commands crashing with no args. I made a small change to
- the initial command parsing function which rendered some things
- improper and made many functions crash because they were no
- longer receiving the arguments they expected before the change.
- - Fixed CHAR_INVOKE'd commands to do nothing if given too many
- arguments.
- - INFO2 command now outputs correctly in privmsg.
- - Added the "You must specify a search string" message to
- RANDQ and RANDQ commands with no arguments.
- - Sleep command now checks for too many args, this is part
- of the command structure now, so more commands are to follow
- probably.
- - MSG_INVOKE'd commands now also check for too many arguments.
- - Commands with less arguments than expected now show
- help messages again.
- - Fixed crash error on ADDUSER command.
- - Fixed retarded error in MEM command where I was trying
- to change the contents of a const variable.
- - Made OS, MEM, CMDCHAR, and CPU commands check for too many arguments.
- - Fixed OS command on Windows.
- - Fixed chanserv_random_stuff.
- - Fixed alarmclock function.
- - Fixed permbans command not outputting help for null
- input. More to come.
- - Fixed several commands that crashed not checking for
- a null argument array. The fix I did looks sort of
- retarded, but I found if i didn't check args[0] and args
- both, it would crash on different command types.
- Go figure. This fix works and I'll work on bettering it.
-Darkbot 8rc4: April 30, 2009
- - Fixed extensions.m4 file from discriminating against
- me using a newer version of automake than 1.9.6, and
- removed a few automake warnings.
- - Fixed autotopic only using first word of input.
- - Fixed crash on ADD command and probably others when msg
- with no arguments.
-Darkbot 8rc3: Sep 17 2008
- - Fixed USERLIST and SETINFO commands crashing with no args.
- There's probably more of these to come.
- - Topics can now start with these commands that check for too
- many arguments. Say you want to do:
-
- dbtest add info+things hey N~, I don't have info on things.
-
- Before this, a parsing error would invoke the "info" command.
- This has been fixed, and the bot will now either not respond
- to these inquiries if they don't exist in it's database, or
- provide the desired reply.
- - Added "too_many" parameter into the chanserv_command struct.
- This specifies to the command parser if a command sent to the
- bot should be checked for having too many arguments. This
- particular change helps fix a number of issues which would
- cause headache, and will be fine tuned more thoroughly when
- I get the chance.
- - More parser errors fixed. Added ILN in additon to ILC.
- - add stats function now has subsequent call to free()
- after the malloc() call. (Duh? What happened to that?)
- - Fixed ILC. Oops on my part for breaking it.
- - Part command no longer tries to output "I left the room"
- message to the channel it parts.
- - Updated TODO.
- - Changed all command function parsing. Things should hopefully
- work more correctly again.
- - HLIST (Helperlist) command now allows multiple arguments.
- For instead if you want to list all users level 3 and level 3,
- you would do !HLIST 3 2.
- - Fixed tell command to tell people about topics without having
- do delimit them with '+' signs, so it runs like normal text now
- for multi-word topics.
- - Fixed sleep command. It now actually sleeps for the specified
- amount of time, if any is specified.
- - Part message now accepted as a parameter to PART command.
- - More work on unixtime function. It now has more complex error
- checking for strtol. More work on this to come.
- - Renamed pluralize function to plural.
-
-Darkbot 8rc3: Jan 16 2008
- - Alarmclock function uses time_t variable now instead of long.
- Also now accepts arguments specified in seconds.
-
- - Bot no longer crashing during start if there's blank lines in
- the servers file. It now ignores blank lines and comments
- starting with '#' and '/'. If the server file is blank, it
- aborts and tells the user to edit the file.
-
- - Added pluralize() function for beautification purposes. See more
- in general.c.
-
-
-Darkbot 8rc2: June 07, 2007
- - The STATS command, and all overhead produced by this command
- can now be disabled during compile like so:
- ./configure --disable-stats
- OR
- ./configure --enable-stats=no
-
- - Changed the RANDOMSTUFF command to be a NORMAL_COMMAND, so you
- can use this command with ADDRESS_INVOKE again (address the bot
- directly).
-
- - Added a little thing at the top of docs/WHATSNEW that indicates
- which order the lines therein consist of according to when the
- changes they represent were implemented. Made this sound more
- technical than it should for no reason at all.
-
- - If the input type is ADDRESS_INVOKE (the bot was called upon by
- name), the bot responds anyway now, because it's going to output
- an "I don't know" response if the topic doesn't exist. This doesn't
- happen with DIRECT_INVOKE because the text may have been normal
- channel conversation that was mistakenly parsed as a command.
-
- - Commands which require 0 parameters now act accordingly again
- when supplied with too many arguments. In other words, "dbtest
- info things" would trigger the info command before. Now, it
- uses check_existing_url and outputs a response if the topic
- exists, otherwise, it just ignores it.
-
-
-Darkbot 8rc2: December 09, 2006
- - Updated server and user lists.
- - More fixes to random whut.
- - Tweaked random number generation.
- - Consistant random number generation throughout the code.
-
-Darkbot 8rc2: December 04, 2006
- - Fixed some variable checking that was checking for integers
- instead of bool values (random whut is fixed by this, flood
- kick)
- - Fixed Makefile.am file to produce DOS 8.3 file format
- compliant config.h pre-file, and the copyright thingo
- in the same file.
-
-Darkbot 8rc2: October 11, 2006
- - Fixed some divide by zero errors.
- - Cleaned up the logging.
- - Cleaned up the output of the build system.
- - Cleaned up the parameter names.
- - Cleaned up some help text.
- - Script for building minimal darkbot.
- - Disabled more channel code.
- - Started documenting what darkbot works on.
-
-Darkbot 8rc2: June 11, 2006
- - Added docs/SETUP.
-
-Darkbot 8rc2: May 31, 2006
- - A busy month.
- - Completed the autofoo.
- - Added compat directory full of replacement functions for
- when autofoo decides that the users OS is missing stuff.
- - Added a testing mode for developers.
- - Cleaned up most OS dependant things so that they now work
- everywhere.
- - Converted some defines.h things into ./configure --enable-X
- --with-X=Y things.
- - Added !set foo=bar infrastructure and command. The contents
- of setup.ini is now under the control of generic, array based
- code. To add things to setup.ini, just add them to the array.
- - Added setup.ini parameters to the internal help system.
- - Moved the rest of defines.h to setup.ini.
- - General clean up and lots of minor things that get fixed in
- passing.
- - Added docs/HACKING.
- - Re arranged some files.
- - New building scripts.
- - Darkbot and convertdb are much cleverer about finding the data
- files.
- - Cleaned up vars.c and vars.h.
- - Have the help system deal with the command character as needed.
-
-Darkbot 8rc2: May 04, 2006
- - Cleaned generated files out of cvs and updated .cvsignore
- files to match.
-
-Darkbot 8rc2: Apr 21, 2006
- - Added most of the help command summaries.
-
-Darkbot 8rc2: Apr 19, 2006
- - Fine tuned what commands can be done where. In particular
- any password related commands can only be done in private
- now.
- - Made some commands behave consistantly no matter where they
- are invoked from.
- - Added HELP COMMANDS.
- - Don't try to send oversize messages, split at a space.
-
-Darkbot 8rc2: Apr 16, 2006
- - Rewrote chansrv.c to use an array of pointers instead
- of a huge if-else-if.
- - Added patch from nak that stops ops from kicking
- themselves via a topic kick.
- - Added HELP <command>.
- - Added isop <nick>.
- - Added level <nick>.
-
-Darkbot 8rc2: Mar 09, 2006
- - Added !WEATHER <zipcode> command.
-
-Darkbot 8rc2: Nov 07, 2005
- - Fixed spelling errors, the word 'queue' was mispelled
- throughout the code and in comments.
- - I apparently broke show_banlist() a few releases back
- trying to eliminate a type conversion warning, so it's
- fixed again.
- - B~ (bot nickname) variable can now be used in perform.ini
- - OS command now works on windows.
- - Fixed google command. A search string used to determine
- successful replies was changed by google.
- - Changed "ugly" message responses.
- - Restart and rehash commands should now work on all operating
- systems, including Windows.
-
-Darkbot 8rc1: Mar 04, 2005
- - Removed an unneeded line in main.c, that was used to "hide"
- warnings on WIN32, which is a very bad idea.
- - Changed check_dbtimers() so it ignores the CVS directory,
- which contains information for the CVS server. This
- fixes a situation that seems to have only presented itself
- in FreeBSD, where it thinks the CVS directory is a
- timer, and sends out random garble every few seconds.
-
- - configure.ac and source/Makefile.am; very minor updates.
-
- - Fixed randq, which I accidentally broke when adding the
- -I switch. This also fixes some problems that turned up
- on FreeBSD.
-
- - Fixed a warning that came up in permbans.c about mixing
- types when compiling on OS X. I changed %d on line 198
- to %ud.
-
- - configure now checks for clock_t.
-
- - configure now automatically checks for snprintf, and
- uses a replacement if it's not found.
-
- - docs/INSTALL.txt is now INSTALL in the toplevel dir.
- Another thing for automake to stop complaining about.
-
- - The original configure script is now located in the
- scripts directory, and is called "Setup".
-
- - docs/contributors.txt is now called AUTHORS in the
- top level of the distribution. Another thing automake
- complains about. I also worked on the appearance of
- this file, hopefully it looks a little better now.
-
- - README.txt in the toplevel is now called "README".
- Automake complains about this file also, if it's not
- found.
-
- - This file is now called ChangeLog, and has been moved
- to the toplevel distribution dir. The reason for this
- is that automake complains, if it can't find this file.
-
- - configure now checks for the presence of windows.h,
- and defines WIN32, if it's found. This removes the
- need to do "make win". Until I add the noconsole
- option again, you can run darkbot with no console by
- doing "./darkbot &" in your cygwin shell.
-
- - The configure.ac file is not yet complete, and most
- of the definitions listed in config.h are not completely
- implemented into the code yet. If you have problems,
- please let me know, and these files will become completely
- implemented as demand is met.
-
- - Included premade Makefiles and configure script.
-
- - Added "make convertdb", which will compile the database
- conversion utility, which encrypts the passwords in your
- userlist.db file.
-
- - I added a Makefile.am in the toplevel, and in the source
- directory. These files are used in conjunction with
- GNU Automake to produce a Makefile.
-
- - Added Makefile.ams and configure.ac for autoconf/automake.
-
-Darbkot 7f2: April 05, 2004
-
- - Fixed the google function. Google changed some text that
- the bot was using to tell if the search was successful.
-
-Darkbot 7f1: Mar 06th, 2004
-
- - Made a short dirty fix for "!randq *" crashing the bot.
- If you do a randq query consisting entirely of * and ?
- characters, the bot will now just spit out a random quote.
- This needs to be fixed better, obviously, but this will
- keep peoples' bots from crashing until the issue can be
- properly addressed.
-
- - Changed unlink() calls to remove(). remove() is ANSI C.
-
- - Private message responses no longer have that "sent by"
- thing on them. It was annoying, and pointless.
-
- - Renamed the log() function db_log() to avoid a conflict
- with a function internal with gcc. Apparently this only
- affects newer versions of gcc.
-
- - Removed two unused variables in convertdb.c. I also changed
- 'unlink' to 'remove', to comply with the ANSI standard.
-
- - Changed forum URL to http://forum.freezedown.org, since that
- works too, looks cooler, and is shorter. :)
-
- - Fixed a bug that caused the bot to never respond to anything
- after being killed. The same problem was also fixed in a
- number of other situations that it was popping up. gs26()
- was being called both before, and during prepare_bot(), so
- I made the call happen only during prepare_bot().
-
- - Fixed a minor flaw in convertdb.c. It said the syntax was
- "convertdb -convert", even if the executable wasn't named
- convertdb.
-
- - Taiwanish file got dumped somehow, it's back now.
-
- - New setting in defines.h, AUTOHELP_GUESTS, makes the bot send
- a message to the channel, whenever a user with the word "Guest"
- in their nickname joins, asking them if they need help. This
- can be used in help channels, to avoid Guest users just joining
- the channel, and moving on because nobody is talking.
-
- - I'm fairly sure I have dbcron fixed now. I can't test it,
- because I don't have a system with crond, but the fix was
- made using basic shell syntax. >> instead of >. :)
-
- - Please remember to include which operating system you're using
- when reporting bugs. This information is crucial because (all?)
- operating systems have subtle differences that can cause any
- number of problems in various situations. It's impossible to
- keep all of these conditions in mind when writing code, because
- there's just so many of them. Any other information that you can
- provide will, more than likely, be greatly appreciated.
-
- - I don't see why this is a development version anymore, so
- I've moved it to final. As always, any malfunctions or
- problems may be reported via the forum.
-
- - darkbot.info isn't resolving anymore, so references to this
- site have been removed. I left the support emails, until
- updated email addresses are known of. If your email needs
- to be updated anywhere in the code, and I didn't realize it,
- let me know.
-
- - Changed setup.ini, WHATSNEW, according to previous statement.
-
- - Updated some text in defines.h
-
- - Updated the title screen in main.c
-
- - Removed references of "make cygwin". Just use "make win"
- from now on.
-
- - Fixed a typo in the Makefile.
-
- - You can use comments in the performs file now by appending
- a '#' to the beginning of the line.
-
-Darkbot 7.0-RC9: Oct 19th, 2003
-
- - Added new channel command, "QUOTE". All this does right
- now is display a random line from randomstuff.ini on
- command.
-
-Darkbot 7.0-RC9: Oct 5th, 2003
- - This feature was already added, but I never documented it...
- The R~ variable (random nickname) now works in RDB topic
- responses. Look for randomstuff compatibility in the near
- future, but first i have to rewrite do_random_stuff() to
- accept a channel arguement.
-
- - I was reading through this WHATSNEW file, and corrected
- a few typos that were made.
-
- - I removed the run_deop() code. It didn't work very
- well anyway, or at all actually. I plan on reintroducing
- this whenever I can get some free time.
-
- - Fixed Ebonic language file.
-
- - Added Taiwanish language option.
-
-Darkbot 7.0-RC8: June 20th, 2003
- - I screwed up the Makefile by accident, adding some
- new features, and I hadn't finished yet when I
- committed. OOPS. Fixed now.
-
- - Updated more depricated URL strings.
-
- - Updated language files.
-
- - Minor changes on startup splash screen.
-
- - Support forum URL is now http://www.freezedown.org/forum
-
- - Updated the default servers.ini file to reflect the
- changes.
-
- - You can now use Darkbot on servers which require a
- connection password. Check servers.ini for an
- example.
-
- - Updated some outdated text in the configure script.
-
- - Darkbots now default to irc.freezedown.org #darkbot.
- Please edit your setup.ini and servers.ini files to
- minimize traffic, since that is also our help channel.
-
-Darkbot 7.0-RC7: June 2nd, 2003
-
- - Updated the INSTALL.txt file to reflect some support
- changes.
-
- - Fix for possible problems with counting in datasearch
- algorithm. long was changed to size_t.
-
- - Fixed bug that prevented ACTIONs from being used on
- RDB responses.
-
- - Suppressed more warnings when compiling on Solaris
- from chan.c, in the do_math function.
-
- - Removed another unused variable from url.c
-
- - Removed an unused variable from random.c
-
- - Removed the .runonce script from executing during the
- "make" process. The funcionality this script produced
- is depricated. Also removed this file from the distro.
-
- - Darkbot will now properly compile on Solaris. To make
- this happen, you need to manually edit source/Makefile,
- and remove a comment symbol before the word "LIBS".
-
- - Suppressed a warning message from main.h that happened
- when compiling on Solaris.
-
- - Makefile now works correctly on Solaris.
-
- - The MEM command is now limited to only users with admin
- (level 3) access on the bot.
-
- - On startup, we now run_performs() BEFORE we join our home
- channel. This fixes an issue that happened chiefly on
- Undernet, and allows the bot to authenticate and set
- umode +x, before it joins any channels. I hope to fix
- this in a better way, but for now it's driving me nuts.
-
- - The startup screen now actually reflects what version this
- is. Sorry, I forgot all about that startup screen, because
- it's hard coded. hehe.
-
- - The Q~ variable in topic replies now works correctly. It
- was chopping all but the first word off, before.
-
- - Added MrSiMo to the list of contributors for his Arabic
- translation.
-
- - The sleep command now accepts an arguement for the number
- of seconds you want the bot to sleep for.
-
- - DEFAULT_UMODE is now set immediately upon connection.
- Several users said this was not being done, it was. It was
- just waiting >300 seconds, for whatever reason. Also, the
- bot command PERFORMS now sets DEFAULT_UMODE in addition
- to running the performs file.
-
- - New command line option.
- -I now specifies the location of the directory containing
- the data files (by default, dat/).
-
- - Multiple command line arguements are now supported.
- I have no clue why this wasn't done before.
-
- - The .debug and .debug2 scripts were missing from the
- distribution. They're back now.
-
- - Found another place where the bot wasn't deleting old
- userlist entries. This has been fixed.
-
- - Added the CHANUSERS command. All this does is return
- a list of users on either the specified channel, or
- the current channel, if none is specified. I may
- remove this eventually, as i'm just using it for
- debugging purposes right now.
-
- - CHANINFO command will output to whatever channel it
- received the command from now, instead of the channel
- it's showing data about.
-
- - The CHANINFO command now supports a channel name
- parameter. Dunno why it didn't have that before...
-
- - Darkbot is on CVS now at SourceForge!
-
- - Soapta revamped the google module.
-
- - The MEM command now displays the correct process. I removed
- the -x flag from the ps command it was issuing, and it fixed
- it. If anyone sees any reason the -x flag should be used,
- let me know and i'll recode the whole thing.
-
- - Added SETHOST alias for the VHOST command.
-
- - Updates to the Ebonic and French languages which define
- Lbadtopic and Lbadtopic2 now. Other languages still need
- this added.
-
- - The RDB command, which gives information about the number
- of RDB files, can now be used with an arguement, to tell
- how many lines are in a specific RDB file. It was supposed
- to do this before, but it didn't work properly. This
- command is still unavailable in Windows.
-
- - Removed a warning concerning do_randq that happened if you
- compiled with RANDOM_STUFF undefined.
-
- - Fixed another bug that was causing the bot to never remove
- old entries from it's internal user list. This time it wasn't
- parsing the channel name for PARTs correctly. I also removed
- some parsing being done on an unused variable whenever
- someone parted a channel.
-
- - Fix for RDB command... i forgot to change this when I moved
- all of the RDB files to their own directory. OOPS! :)
-
-Darkbot 7.0-RC6: Oct 30th, 2002
-
- - Added Arabic language.
-
- - You can now toggle the use of encrypted userlist.db passwords.
- Check defines.h for this.
-
- - Fix for the bot not executing performs when it connects to
- a server which does not have an MOTD. Also cleaned up a small
- amount of redundant code dealing with performs.
-
- - The bot will no longer crash if it encounters blank lines in
- the info2.db during data searches (DSEARCH and SEARCH commands).
-
-
-Darkbot 7.0-RC5: Sep 24th, 2002
-
- - Fixed do_randomtopic(), so it's now possible to output the first
- quote. it never did this before (oops).
-
- - Fixed the socket connection routines for windows.
-
- - Fixed a rather large bug that caused the bot to never actually delete
- users from the internal user list when necessary.
- This also fixes another problem where the bot would put return a
- nickname from R~ that is not actually on the channel.
-
- - RDB topics now support the use of tokenized responses. This includes
- the use of tokenized responses in the WHUT and DUNNO replies.
-
- - Added timers directory to the distribution, it was missing.
-
- - Got rid of the do_randomtopic2() function for the random dunno, and
- random whut replies. do_randomtopic() now handles everything. This
- cut down the size of the code a bit, and should have been how it was
- done originally, anyway. This also means variables and also raw
- commands can now be used in the replies for whut, and dunno, also.
-
- - Added a level 3 helper command, "PERFORMS", which just executes all
- all commands that are in the bot's performs.ini file, at any time.
-
- - Fixed minor oversight that I created when adding a check for illegal
- characters in !nick, it now lets you use all legal characters.
-
- - RDB topic responses can now contain raw commands.
-
- - RDB files are now stored in their own directory. By default, this is
- dat/rdb.
-
- - Changed get_word() function to make it a little more useful.
-
- - Changed some error replies in the RANDQ function, and added a response
- for the condition of randomstuff.ini being empty.
-
- - Cleaned up the prototypes.h file, it looked really ugly. :)
- This also reduced the total amount of code by a bit, but i'm not going
- to bother checking just how much. :P
-
- - Fixed an issue in seen, that might cause the bot to improperly count
- the number of seens in the database.
-
- - Fixed minor bug in add_randstuff() that caused the bot to say there was
- one more randomstuff in the file it's adding to than there actually was.
-
- - Fixed a bug in do_random_stuff() that prevented the bot from outputting
- randomstuffs, in very rare instances. This suspectedly was causing some
- strangeness noted in Debian, and some other OSs.
-
- - Added a new alias for randomstuff, RS.
-
- - Fixed a bug in !USERLIST, that caused the bot to flood itself, and not
- show of all of the users it was supposed to show.
- !USERLIST now works correctly, and hopefully on ALL OS.
-
- - Fixed a bug in !BANLIST that caused it to not output correctly on some
- OS.
-
- - Due to abuse and channel cluttering, the !VARIABLES command now messages
- the user with the output, instead of sending it to the current channel.
-
- - Fixed a compilation error concerning BITCH_DEOP_REASON being undeclared.
- What i did is remove this, and now if BITCH_ABOUT_DEOP is turned on, it
- just runs the list of commands in deop.ini. If BITCH_ABOUT_DEOP is turned
- off, it does nothing when the bot is deoped. Apparently, before this
- version, it ALWAYS ran deop.ini, and the BITCH_ABOUT_DEOP just toggled the
- bot saying whatever line was defined in BITCH_DEOP_REASON. That seemed kind
- of pointless, to me, but i never noticed it before now.
-
-Darkbot 7.0-RC4: Jun 24th, 2002
- Again, Ron did a couple necessary and urgent changes and fixes:
- - Finally, the bug in windows concerning DEL and REPLACE has
- been corrected. A function which checks readability and
- writeability was leaving the info2.db file open at startup,
- and causing all sorts of problems, since the new code structure
- was implemented.
-
- - NO NEED FOR TOP LINE WITH NUMBER ANYMORE on random phrase files.
- ... After yet even more problems with randomstuffs being counted
- improperly, I've recoded the entire randomstuff routine.
- They no longer rely on any number at the top of the file, which
- means you can remove that number from your randomstuff.ini.
- Optimizations made to make randomstuff more random, also.
-
- - Fixed a bug where Darkbot would crash when you use !nick
- with illegal characters.
-
- - Patched a socket issue in create_connection() that appeared
- only in windows.
-
- - Eliminated a warning dealing with the redefinition of size_t
- when compiling the bot in windows.
-
- - Eliminated all of the casting done on malloc in the program.
- Casting malloc is totally unnecessary, and can mask other
- errors.
-
- - Improved the fix for topics that consist entirely of "*"
- characters. It now checks for "?" also. This prevents
- segmentation faults, and topics which are entirely wild-
- cards are seriously annoying anyway. Sorry if it's in any
- inconvenience to anyone.
-
- - Minor cosmetic fix to the output of DBSIZE, it'll now say
- that the database is "1 byte in size", instead of "1 bytes
- in size", if it's only 1 byte. This should never happen,
- but if it does, it'll look nice. :)
-
- - Added #define MSG_RESPONSES to defines.h to have Darkbot
- answering or not to private queries. Check next 2 defines.
- (default is OFF)
-
- - Added #define ALLOW_ADD_IN_MSG to turn ON or OFF the
- possibility of ADDing database entries to Darkbot in
- private message. (default = OFF)
-
- - Added #define ALLOW_DEL_IN_MSG to turn ON or OFF the
- possibility of DELeting database entries from Darkbot in
- private message. (default = OFF)
-
- - Added RANDQ function and alias RANDQUOTE, to output a random
- line from your randomstuff.ini that contains a specified search
- string.
- RANDQ output returns a (11/23) type thing at the beginning of
- the line, which tells which quote it's showing, out of how many
- were matched in your search.
- RANDQ can be used from any channel, and in MSG. It wont output
- An obvious side effect to this, is that the ~ variable in
- randomstuffs will evaluate to a nickname, if it's used in private
- message (The nickname of whoever invoked it).
- To make the function toggleable a directive with the same name
- was made on defines.h (default = ON)
- Try it out, !RANDQ <stuff>
-
- - Added RANDQ2 command, which is the same as RANDQ, only it
- matches case sensitively.
-
- - Added BACKUP_RANDOMSTUFF define to backup randomstuff.ini
- file every time a random phrase is added. This was done due
- to missing contents when adding an entry on a file with a high
- ammount of phrases. Latest fixes resolves the problem but this
- define will stay to play on the safe side and/or if user likes
- to backup changed files.
-
- - Added hostmask code, where the bot converts hostmasks to
- *jason@*.superlink.net, or *jason@203.203.203.*.
-
- - After lots of complaints, the second line in the info reply
- only shows up with the stats command now.
-
- Shell utilities
- - Adjusted check-integrity to the non necessity anymore of top
- line with number of random entries on random phrases files.
- - configure script now forces entering at least one server
- and at least one user level 3, on servers.ini and userlist.db
- files respectively, in case those files are empty.
- (working on checking errors on user input).
- - added an option on 'configure' to import servers.ini and
- userlist.db from another location.
- - Added BSDs compatibility to all shell scripts.
- - Added Cygwin compatibility to AddServer, AddUser,
- check-integrity and download-databases scripts (live-update
- and dbcron not fully tested yet).
-
-Darkbot 7.0-RC3: May 22nd, 2002
-
- ron@freezedown.org has worked on the following 4 issues:
- - Fixed a bug that caused crashes if the bot responds to a
- topic containing R~ in private message.
-
- - Fixed a bug that caused excess floods if the bot were to
- send private messages to itself.
-
- - Fixed a bug concerning topics that consists entirely of the
- '*' character, which caused segmentation faults. Darkbot
- will not allow you to add a topic like this now.
-
- - Fixed the Makefile, on my computer it kept compiling all
- of the source files seperately and then compiling them all
- together instead of linking the .o files it made.
-
- - Added directory logs lost in action. It is now within dat directory
-
- - Fixed .Stripdb and .Stripdb2 - so now points to the correct bin path
-
- Shell utilities: (all changed/improved - read docs/README_UTILS)
- - Added README_UTILS to docs directory with information about shell utils
-
- - Added compatibility to wget (besides lynx) on scripts that needs to
- connect to internet
-
- - All utility scripts now share working directory .scriptutils instead of
- having dynamic files all over scripts directory
-
- - download-databases now integrated on live-update (besides standalone)
- (if updated on RC3 the change will take effect next time live-update
- is executed)
-
- - Added a couple more features and improved others for more accuracy on
- check-integrity engine. USE IT before asking for help or going into
- paranoia if you suspect you have data errors or even if you are not
- sure eventual errors became from bad entries on data files.
-
- - Added a few features to AddUser utility
-
- - configure script now bypasses previously configured items. Just hit
- ENTER key to go to the next setup. Also it gets already configured
- parameters and use it as session defaults instead of the usual Darkbot
- defaults. The script is now linked to AddUser and AddServer with all
- features those utilities now have.
-
-
-Darkbot 7.0-RC2: Apr 13th, 2002
-
- - Windows port. Not much to do at this time. Last changes
- on the core code made some commands not working properly.
- Any interested coder... the affected commands
- are DELETE, which do not delete, and REPLACE, which leaves
- in info2.db 2 entries with the same topic. I should remind
- all coders that the source must be sent together with it's
- executable/bin files. Any coder willing to participate use
- the email on top of this info or directly to me
- at LuizCB@darkbot.info . (only development matters please)
-
- - The following are a couple Unix scripts to help on Darkbot
- management. Most are complete, some needs small adjustments
- or more features. I've used basic sh technics on it's making,
- I should say, while learning the language on the fly.
- Please test them and send any modiffs in case you are able
- to. The idea of these shell scripts is mainly to open a door
- to C coders to implement them so it will be possible to port
- it to other platforms.
-
- - A more featured AddServer. Downloads and installs servers
- of the network you choose. Thanks to the folks at the
- International Federation of IRC - http://ifirc.com
- for a job well done on your site! The merit of that will
- go to our web page on the credits area as soon as stable
- version 7 is released.
-
- - New crontab setup utility. Run dbcron on scripts dir and
- if crontab is active on your shell the script will do
- everything for you (10 mins interval cron job).
-
- - Implemented a new update utility. On scripts
- directory type ./live-update -h for help on it's
- usage. At this stage the update engine will not
- transfer your previous directives on defines.h
- or darkbot.c to the new file, so you'll have to
- edit defines.h manually and compile Darkbot.
- The script is compatible with all Darkbot releases
- and can be launched standalone providing it's in
- scripts directory. To install it ( in case you don't have
- it with your Darkbot) type
- lynx -source http://live-update.darkbot.info > live-update
- then chmod +x live-update
- (get-latest will no longer be available)
-
- - New download-databases utility. ( it will be integrated soon on
- live-update engine but can also work standalone).
-
- - New file-integrity utility ( still needs some ajustments and
- more features but you can use it already - works with
- download-databases utility or by itself). Type
- ./check-integrity to check info2.db. Due to unpredictable
- user entries on info2.db this utility could behave
- abnormally on some special characters. Please send me all
- info2.db file in case anything like that happens so I can
- make exclusions on the code.
-
- Changes applied by reet:
- - Fixed major bug when adding users - the password wasn't
- encrypted, thus user could never login.
-
- - Added new commands IGNORE & UNIGNORE syntax is:
- <bot> ignore <nick>
- <bot> unignore <nick>
- The ignore list is only stored in RAM, changing
- nicks will get around this ignore. This is useful
- to ignore people who query the bot too much.
-
- - Applied code optimization patches on info and check_permban,
- submited by Neil Darlow
-
- - Preview for next full release: adjustments on shell utilities
- and a full featured menu GUI might be finished. Minor
- changes in meanwhile can be updated using live-update
- engine.
-
-
-Darkbot 7.0-RC1: Mar 2nd, 2002
-
- - Fixed get-latest script; besides checking for code updates
- also looks for latest news. Database files updates
- will be also done/actualized soon. It's not linked
- anywhere by now so if you want to use it type it's
- name.
-
- - Organized file structure; all scripts are now on scripts
- directory, documents on docs except README which is
- now on Darkbot's root dir. A new contributors file
- was created with the list of colaborators.
-
- - defines.h is now organized in different way and prepared
- to a "shell GUI" to be released soon.
-
- - Organized 'configure' in a different way. Now it starts
- with defines.h editing and then it goes to data files.
-
- - scripts/dbcron - a new script to execute crontab. There is
- plenty of help how to use in it. Read it. Soon the
- reconnection process will me automated.
-
- - Updated makefile to reflect the new directory tree.
-
- - Code contributors please use this release as the base of
- your changes.
-
- - The next changes are code modifications also in preparation
- for release 7, mostly adapted, updated or implemented
- by reet, paul @ darkbot.info
-
- - Added GOOGLE feature. Simply type:
- <bot> google <search string>
- The bot will then return the first URL google
- returns.
- #define GOOGLE ON to use this feature.
-
- - ********** IMPORTANT **********************************
- - userlist.db passwords are now *ENCRYPTED*
- If you are using an older version userlist.db
- you MUST set all the passwords to 0 *** OR ***
- Cygwin/Windows users run convert.exe
- UNIX users run ./convert
- and your userlist.db will be converted
- *******************************************************
-
- - #define PERFORM_TIMER ON if you want darkbot to send its
- PERFORM.INI to the IRC server every 60 seconds, useful
- if your bot is banned from a channel, or couldn't
- log in to channel services due to a net split etc.
- It's in defines.h
-
-
-Darkbot 7 (alpha 2.1): Dec 23rd, 2001
-
- - Fixed 'INFO2.DB must have at least one topic' problem. Bot
- should work normally, even if INFO2.DB is empty.
-
- - Added 'stats' support to darkbot, <botnick> stats will return
- total number of questions asked since it started
- recording. You can also do <botnick> stats <nickname>
- to get indivdual stats from a user. dat/stats.db holds
- the data.
-
- - Added 'quiz' support to darkbot, <botnick> quiz to execute
- the quiz, it will pick a random question/answer from
- dat/quiz.db. The format of the question answer in the
- file should be <question>@<answer>
- e.g. What is 1+1?@The answer is 2!
- quiz is still in experimental stages, check defines.h
- to enable/set it up.
-
-
-Darkbot 7 (alpha 2): Dec 17th, 2001
-
- - New define - #define VOICE_USERS_ON_JOIN [on/off]
-
- - New commands: /msg bot infosize or /msg bot dbsize
- or in channel: bot infosize or bot dbsize
- returns the file size of INFO2.DB
-
- - New command: bot whisper <nick> about <topic>
- darkbot will NOTICE the user, instead of PRIVMSG
-
- - Moved source code and Makefile to source directory -
- this keeps the root tree of darkbot clean, nothing
- changes for the user, they still type make in the
- darkbot root, and the binary will be copied there.
-
- - Repaired get_rand_nick() problem - bot was still returning
- it's own nick - *should* be ok now.
-
- - Added Ron's random whut, and dunno function.
-
-Darkbot 7 (alpha 2): Dec 16th, 2001
-
- - Removed #ifdef WIN32 references for sprintf/snprintf,
- have included the function snprintf() in general.c,
- for older compilers - #define SNPRINTF_SUPPORT should
- be switched OFF if your compiler supports snprintf()
- this is quite a change.
-
- - Due to lots of people not reading #defines.h and complaining
- about make error (clock_t), the configure script
- will display an alert about this just before defines.h
- is about to be edited.
-
- - New defines - #define CONNECT_WAIT_TIMEOUT [seconds]
- #define OP_USERS_ON_LOGIN [on/off]
-
- - New PRIVMSG commands - OP, DEOP, VOICE/V, DEVOICE/DEV/DV/,
- DVOICE, KICK/WACK/K, DELETE/REMOVE/
- FORGET/DEL, TELL, ADD/REMEMBER/SAVE,
- WHERE/WHO, ADDUSER, DIE
- Some of them aren't new, but didn't work, and are now fixed.
- Just /msg bot tell nick about topic, these commands
- usually NOTICE the user, rather than PRIVMSG.
-
- - The connection routine to the server should be better -
- instead of quitting after failing to connect, it
- will constantly cycle all the servers.
-
- - I've added CYGWIN support in the Makefile - just to hide
- those size_t warnings if you get them. If you use
- CYGWIN, just use make cygwin
-
- - Permban bug fixed.
-
- - Info/Info2 bug fixed.
-
- - NICK bug fixed - bot will keep the new nick until it quits.
-
- - There is a bug/feature where if a nick has a pipe (|) and
- requests a topic that has raw - commands, it ignores
- them - looking in to this.
-
-
-
diff --git a/beta/scripts/AddServer b/beta/scripts/AddServer
deleted file mode 100755
index 4cc5bc2..0000000
--- a/beta/scripts/AddServer
+++ /dev/null
@@ -1,477 +0,0 @@
-#!/bin/sh
-PID=0624233000
-PNAS="
-* Darkbot Servers Utility *
-<***********_~_***********>
-"
-
-# changes: dependencies - option of using lynx or wget (041402)
-
-ABORT () {
-echo -e "\nThis utility will stop now!\n\nLeav\
-ing $0 ...\n\n\n"; sleep 1; exit 0
-}
-
-DB_SCRIPTS_PATH () {
-cd scripts 2>/dev/null
-dirutil="scripts"
-filutil="`basename $0`"
-# check if dir is correct
-if ! echo `pwd` | grep -q "\/"$dirutil""; then
-# file is not being launched from $dirutil
- if [ -d "$dirutil" ]; then # dir is there
-# if file is not in the correct dir
- if [ ! "`ls "$dirutil" | grep "$filutil"`" ]; then
- # file is not in the correct dir so move it
-clear
-echo -e "$PNAS\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory.\n"
-echo "Moving it now...."
-sleep 2
-cat > db_wrong_path << EOF[WP]
-mv -f $0 "$dirutil"/
-cd "$dirutil"/
-echo -e "\n| Your "$filutil" is now located in your "$dirutil" directory |
- | Launch it from there when necessary |\n\n"
-sleep 4
-$0
-rm -f ../db_wrong_path
-exit 0
-EOF[WP]
-. db_wrong_path
- else # file is in dir so just cd
-cd "$dirutil"/
- fi
- else # dir is not there so don't bother - tell user to move it
-clear
-echo -e "$PNAS\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory and launched from there or Darkbot's root.
-Please move it and launch it again."
-sleep 3
-ABORT
- fi
-fi
-}
-#DB_SCRIPTS_PATH
-
-BASE_WORKDIR=.scriptutils
-TMP=$BASE_WORKDIR/._tmp/as$$
-mkdir -p $BASE_WORKDIR/._tmp/
-trap 'rm -fr $BASE_WORKDIR/._tmp* >/dev/null 2>&1' 0
-m_trap="echo -e \n\n -- `basename $0` terminated by `whoami` --\n\n"
-trap '$m_trap 1>&2; exit' 1 2 3 13 15
-
-FILESERV="../dat/servers.ini"
-
-ABORT () {
-echo -e "\nThis utility will stop now!\n\nLeav\
-ing $PNAS...\n\n\n"; sleep 1; exit 0
-}
-
-SERVERS_HELP () {
-echo -e "$PNAS
-Basically what this script does is managing your servers.ini file by adding
-removing and changing servers and ports.
-You have the option of manipulating only your local servers file or downloading
-an updated server list from the International Federation of IRC and work with
-those servers.
-On all lists the servers are preceded by a number (which is not in fact part of
-the files) to help you better choose or manage each entry.
-On the remote servers list the ports displayed on the right are only for your
-reference and corresponds to all available ports. It's recommendable to select
-option 2 on the menu to load the external servers before changing local ports
-so you'll have updated information to deal with.
-If you decide to move all remote list to your local file, port 6667 will be
-used for all servers. You can later change that port for each server on the
-main menu, option 8.
-On all lists PgUp/Down or arrow keys scrolls the text; Q quits from the list.
-CTRL+C aborts at all times.
-To launch the utility write $0. For a quick server entry write:
-$0 server port (ex: $0 irc.server.here 6667 )\n
-Comments, suggestions?
-Support: http://forum.freezedown.org\n"
-if [ -n "$insider" ]; then echo "[ Hit ENTER to continue ]"; read PTR; fi
-}
-
-# test environment
-TESTDEPEND () {
-NonFatalError () {
-echo "NON FATAL ERROR at $0 (`date`): $FiLe not detected on this system. \
-Going to simple operation mode, which means only simple SERVER addition will \
-be performed..." >> $BASE_WORKDIR/error_messages
-clear
-echo -e "$PNAS\nNON FATAL ERROR: $FiLe not detected on this system.
-Going to simple operation mode, which means only simple SERVER addition will
-be performed...\n"
-}
-if ! (type "$1" 1>/dev/null 2>&1); then
-FiLe="$1"
-NonFatalError $1
-sleep 1; unset $FiLe
-fi
-}
-TESTDEPEND "grep"; TESTDEPEND "sed"; TESTDEPEND "cut"; TESTDEPEND "cat"
-
-# test dependencies which can have optional programs and set vars for those.
-TESTDEPEND_SUBST () {
-# test lynx/wget
-if (type "lynx" 1>/dev/null 2>&1); then
-dld_prg="lynx"
-else
- if (type "wget" 1>/dev/null 2>&1); then
- dld_prg="wget"
- fi
-fi
-if [ -z "$dld_prg" ]; then
-echo -e "FATAL ERROR at $0 (`date`): lynx and wget not detected \
-on this system. One it's necessary for this utility to work \
-properly" >> $BASE_WORKDIR/error_messages
-echo -e "$PNAS\nFATAL ERROR at $0 (`date`)\n\n
-Either lynx or wget are essential for $0 to work properly.
-None of those programs were found on this system"
-ABORT
-fi
-}
-TESTDEPEND_SUBST
-
-# dat/servers.ini
-DISPLAY_LOCAL () {
-if [ ! -e "$FILESERV" ] || [ ! -s "$FILESERV" ]; then
-# echo -e "$PNAS\nThere are no servers present."; sleep 2
-echo " #### There are no servers present - servers.ini is empty ####"; sleep 2
-LASTACTION="Unaccomplished action - no servers present on ../dat/servers.ini."
-else
-clear
-echo -e "$PNAS* Local Server List ** "$FILESERV" ** \n
-[ PgUp/Down or arrow keys scrolls; Q quits from the list ]\n
-`cat -b "$FILESERV"`\n
-" | less -deXF
-echo " Press ENTER to continue"; read PTR
-
-LASTACTION="Displayed Darkbot servers list."
-fi
-}
-
-QUICK_ADD () {
-clear
-echo ""$ADDserv" "$ADDport"" >> "$FILESERV"
-echo -e "$PNAS\nAdded to your "$FILESERV" exactly this entry:
-"$ADDserv" "$ADDport"\n\n"
-}
-
-ADDSERVER () {
-unset SERV; unset PORT
-while [ -z "$SERV" ]
-do
- clear
- echo -n "$PNAS
- Enter a server name: "
- read SERV
- if [ -z "$SERV" ]; then
- echo -e "You MUST specify a server!\n"
- sleep 1
- fi
-done
-while [ -z "$PORT" ]
-do
- echo -n "
- What port to connect to on $SERV? [6667] "
- read PORT
- if [ -z "$PORT" ]; then
- echo -e "\n Defaulting port to 6667...\n"
- PORT=6667
- sleep 1
- fi
-done
-echo "$SERV $PORT" >> $FILESERV
-LASTACTION="Added: SERVER: "$SERV" PORT: "$PORT""
-if [ -e "$TMP.TESTDEPEND" ]; then
-clear
-echo -e "$PNAS\nAdded to your "$FILESERV"\n Server: "$SERV" - Port: "$PORT"\n\n"
-fi
-}
-
-DELSERVER () {
-if [ -s "$FILESERV" ]; then
-unset DEL_SERV
-echo -n "Please enter the number corresponding to the server to be removed: "
-read DEL_SERV
-svr_num_lines="$(cat "$FILESERV" | wc -l | tr -cd '[:alnum:]')"
-if [ ! -z "$DEL_SERV" ]; then
-# if [ "$DEL_SERV" -le "$srv_num_lines" ]; then
- REMOVED=$(sed -n $DEL_SERV"p" $FILESERV)
- if [ ! -z "$REMOVED" ]; then
- sed $DEL_SERV"d" $FILESERV > $TMP.FILESERV
- LASTACTION="Removed: $REMOVED."
- cat $TMP.FILESERV > $FILESERV
- LASTACTION="Removed from your Darkbot IRC servers list: $REMOVED."
- else
- LASTACTION="Unaccomplished server entry removal - invalid input."
- fi
-else
-LASTACTION="Unaccomplished server removal - no servers present on $FILESERV."
-fi
-fi
-}
-
-CHANGEPORT () {
-if [ -s "$FILESERV" ]; then
-unset READ_SERV_NUM; unset NEW_PORT
-cat -b $FILESERV > $TMP.FILESERV
-while [ -z "$READ_SERV_NUM" ]; do
-echo -n "Enter the number corresponding to the server to change the port: "
-read READ_SERV_NUM
-SERV_TMP=$(sed -n $READ_SERV_NUM"p" $FILESERV | cut -d' ' -f1)
-OLD_PORT=$(sed -n $READ_SERV_NUM"p" $FILESERV | cut -d' ' -f2)
-done
-
-## Possible port choices/ confront with remote server then put var on echo
-if [ "$RemoteStatus" != "off" ]; then
-PossPortChoices=$(sed -n /$SERV_TMP/p $TMP.NETW_NAME | cut -d: -f2)
-fi
-clear
-while [ -z "$NEW_PORT" ]; do
-echo -n "$PNAS
-Current port on $SERV_TMP: $OLD_PORT.
-`if [ ! -z $PossPortChoices ]; then echo Available ports: $PossPortChoices; fi`
-Enter the new port or press ENTER for default [6667]: "
-read NEW_PORT
-if [ -z $NEW_PORT ]; then NEW_PORT=6667; fi
-sed -e '/'$SERV_TMP'/s/'$OLD_PORT'/'$NEW_PORT'/' $FILESERV > $TMP.2.FILESERV
-cat $TMP.2.FILESERV > $FILESERV
-done
-LASTACTION="Changed port $OLD_PORT to $NEW_PORT on $SERV_TMP"
-else
-LASTACTION="Unaccomplished port change - no servers present on $FILESERV."
-fi
-}
-
-# remote servers
-GET_REMOTE () {
-if [ ! -s $TMP.rem.servers ]; then
-
-DLD_PRG_COMMLINE () {
-if [ "$dld_prg" = "lynx" ]; then
-lynx -source -nostatus http://ifirc.com/servers.ini 2>/dev/null > $TMP.rem.servers
-else
-wget -qO $TMP.rem.servers http://ifirc.com/servers.ini
-fi
-}
-
-trymax="3"; trycount="0"
-while [ "$trycount" != "$trymax" ] && [ ! -s $TMP.rem.servers ]; do
-trycount=`expr $trycount + 1`
-echo -e "$PNAS\n An updated server list is being downloaded from the
- International Federation of IRC - http://ifirc.com.\n
-Please wait...\n"
-
-DLD_PRG_COMMLINE
-#cp servers.ini $TMP.rem.servers # debug only
-# cp $TMP.rem.servers servers.ini # debug only
-done
-unset testRemote
-testRemote=$(grep undernet $TMP.rem.servers)
-if [ -z "$testRemote" ]; then
- echo -e "$PNAS\n I can't obtain the remote servers list at this time"
- LASTACTION="Remote (external) server list unreachable."
- RemoteStatus="off"
- fi
-fi
-}
-
-SELECT_REMOTE () {
-if [ ! -z "$testRemote" ]; then
-while [ ! -s "$TMP.NETW_NAME" ]; do
-clear
-echo -n "$PNAS
-* External Server List *
-
-Write the name of the IRC network (ex: Undernet): "
-read NETW_NAME
-if [ ! -z "$NETW_NAME" ]; then
-grep -i "$NETW_NAME": $TMP.rem.servers | cut -d: -f3-4 | sed s/GROUP// > $TMP.NETW_NAME
-grep -i "$NETW_NAME": $TMP.rem.servers | cut -d: -f3 | sed 's/$/ 6667/' > $TMP.EXTERNAL_ALL6667
-grep -i "$NETW_NAME": $TMP.rem.servers | cut -d: -f3 | sed 's/$//' > $TMP.EXTERNAL_NOPORTS
-
- if [ ! -s $TMP.NETW_NAME ]; then
- echo -e "\nERROR: I don't have network '$NETW_NAME' on my list.\n"
- sleep 1
- fi
-fi
-done
-fi # testRemote != null
-}
-
-DISPLAY_REMOTE () {
-if [ ! -z "$testRemote" ]; then
-if [ ! -s $TMP.NETW_NAME ]; then
-SELECT_REMOTE
-clear
-fi
-echo -e "$PNAS* External Server List ** $NETW_NAME ** \n
-[ PgUp/Down or arrow keys scrolls; Q quits from the list ]\n
-`cat -b $TMP.NETW_NAME`\n
-" | less -deXF
-echo " Press ENTER to continue"; read PTR
-LASTACTION="Displayed remote servers list."
-# cat -b $TMP.NETW_NAME > NETW_NAME # debug only
-# cat $TMP.NETW_NAME > NETW_NAME # debug only
-fi # testRemote != null
-}
-
-ADDSERVER_REMOTE () {
-unset READ_REM_SERV_NUM
-if [ ! -s $TMP.NETW_NAME ]; then SELECT_REMOTE; fi
-if [ ! -z "$testRemote" ]; then
-ADD_1_REMOTE () {
-cat -b $TMP.NETW_NAME | less -deXF
-while [ -z "$READ_REM_SERV_NUM" ]; do
-echo -n "
-Enter the number corresponding to the server to be added: "
-read READ_REM_SERV_NUM
-REM_SERV_TMP=$(sed -n $READ_REM_SERV_NUM"p" $TMP.EXTERNAL_NOPORTS)
-
-REM_SERV_PORTS=$(sed -n $READ_REM_SERV_NUM"p" $TMP.NETW_NAME | cut -d: -f2)
-done
-clear
-echo -n "$PNAS
-Available ports for "$REM_SERV_TMP": "$REM_SERV_PORTS"
-
-Write the port number for "$REM_SERV_TMP"
-or press ENTER for default [6667]: "
-read READ_REM_SERV_PORT
-if [ -z $READ_REM_SERV_PORT ]; then READ_REM_SERV_PORT=6667; fi
-echo "$REM_SERV_TMP" "$READ_REM_SERV_PORT" >> $FILESERV
-LASTACTION="Added SERVER "$REM_SERV_TMP", PORT "$READ_REM_SERV_PORT"."
-}
-
-APPEND_ALL_REMOTE () {
-cat $TMP.EXTERNAL_ALL6667 >> "$FILESERV"
-LASTACTION="Appended all servers from "$NETW_NAME" to your Darkbot IRC servers!"
-}
-
-OVERWRITE_ALL_REMOTE () {
-cat $TMP.EXTERNAL_ALL6667 > "$FILESERV"
-LASTACTION="Overwrited your Darkbot servers file with all servers from "$NETW_NAME"!"
-}
-fi # testRemote != null
-}
-
-SERVERS_MENU () {
-while [ "$CHOICE" != "0" ]; do
-unset servini_status_; unset servini_status
-if [ ! -e "$FILESERV" ] || [ ! -s "$FILESERV" ]; then
-servini_status_="*"
-servini_status=" Not available - empty file"
-fi
-if [ "$RemoteStatus" = "off" ]; then
-RemoteStatus1="*" # for menu
-fi
-
-clear
-if [ -f "$FILESERV" ]; then TOTAL_LOCAL_SERV="$(cat "$FILESERV" | wc -l | tr -cd '[:alnum:]')"; fi
-if [ "$TOTAL_LOCAL_SERV" = "1" ]; then server_s="server" ; else server_s="servers" ; fi
-if [ "$TOTAL_LOCAL_SERV" = "" ]; then TOTAL_LOCAL_SERV="0" ;fi
-echo -e "$PNAS
-`if [ ! -z "$LASTACTION" ]; then
-echo -e " | Last action/status:\n |" $servini_status_""$RemoteStatus1" "$LASTACTION" "; else echo "MAIN MENU"; fi`
- | Number of servers currently in servers.ini file: "$TOTAL_LOCAL_SERV"
-
-[1] Display my `if [ "$TOTAL_LOCAL_SERV" != "0" ]; then echo "$TOTAL_LOCAL_SERV"; fi` "$server_s". "$servini_status_"
-[2] Display the external server list. "$RemoteStatus1"
-[3] Add a server to my local server file. (manually)
-[4] Add a server from the external list. (pick one) "$RemoteStatus1"
-[5] Add all servers from the external server list. (append to local) "$RemoteStatus1"
-[6] Add all servers from the external server list. (overwrite local) "$RemoteStatus1"
-[7] Change the port on a server. "$servini_status_"
-[8] Remove a server from my servers file. "$servini_status_"
-[9] Remove all servers from my servers.ini file. "$servini_status_"
-(C) Check my servers.ini file for errors (fast mode). "$servini_status_"
-(H) HELP
-(X) EXIT Darkbot Servers Utility.
- "$servini_status_" $servini_status \n"
-echo -n "Enter your choice: "
-read CHOICE
-case $CHOICE in
-1)
-#clear; DISPLAY_LOCAL;;
-DISPLAY_LOCAL;;
-2)
-clear; GET_REMOTE; DISPLAY_REMOTE;;
-3)
-clear; ADDSERVER;;
-4)
-clear; GET_REMOTE; ADDSERVER_REMOTE; ADD_1_REMOTE;;
-5)
-clear; GET_REMOTE; ADDSERVER_REMOTE; APPEND_ALL_REMOTE;;
-6)
-clear; GET_REMOTE; ADDSERVER_REMOTE; OVERWRITE_ALL_REMOTE;;
-7)
-#clear; DISPLAY_LOCAL; CHANGEPORT;;
-DISPLAY_LOCAL; CHANGEPORT;;
-8)
-#clear; DISPLAY_LOCAL; DELSERVER;;
-DISPLAY_LOCAL; DELSERVER;;
-9)
-if [ "$servini_status_" != "*" ]; then
-cat servers.ini > "$FILESERV" 2>/dev/null
-echo "REMOVING all servers from servers.ini...";
-LASTACTION="Removed all servers from servers.ini file."
-else
-echo " #### No servers to remove. File servers.ini is empty ####"
-LASTACTION="Unaccomplished servers removal - empty file."
-fi
-sleep 2;;
-C)
-if [ "$servini_status_" != "*" ]; then
- if [ ! -s check-integrity ]; then
- LASTACTION="Unaccomplished file check - utility not installed."
- else
- ./check-integrity servers -quick
- LASTACTION="Checked servers.ini for errors."
- fi
-else
-LASTACTION="Unaccomplished file check - empty file."
-fi;;
-c)
-if [ "$servini_status_" != "*" ]; then
- if [ ! -s check-integrity ]; then
- LASTACTION="Unaccomplished file check - utility not installed."
- else
- ./check-integrity servers -quick
- LASTACTION="Checked servers.ini for errors."
- fi
-else
-LASTACTION="Unaccomplished file check - empty file."
-fi;;
-
-h)
-clear; insider=y; SERVERS_HELP;;
-H)
-clear; insider=y; SERVERS_HELP;;
-x)
-exit 0;;
-X)
-exit 0;;
-*)
-if [ -z $CHOICE ]; then
-echo -e "\nERROR: Playing with the ENTER key..?"; sleep 2; clear
-else
-echo -e "\nERROR: '$CHOICE' is not a valid choice"; sleep 2; clear
-fi
-esac
-done
-}
-
-# start engines
-if [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--h" ]; then
-clear; SERVERS_HELP
-
- elif [ ! -z "$1" ] && [ ! -z "$2" ]; then
- ADDserv="$1"; ADDport="$2"; QUICK_ADD
-
- elif [ ! -e "$TMP.TESTDEPEND" ]; then SERVERS_MENU
- else
- ADDSERVER
-
-fi
diff --git a/beta/scripts/AddUser b/beta/scripts/AddUser
deleted file mode 100755
index 55f0c02..0000000
--- a/beta/scripts/AddUser
+++ /dev/null
@@ -1,289 +0,0 @@
-#!/bin/sh
-PID=0624233000
-PNAU="
-* Darkbot Users Utility *
-<**********_~_**********>
-"
-
-# to do: check errors on user input
-
-ABORT () {
-echo -e "\nThis utility will stop now!\n\nLeav\
-ing $0 ...\n\n\n"; sleep 1; exit 0
-}
-
-DB_SCRIPTS_PATH () {
-dirutil="scripts"
-filutil="`basename $0`"
-# check if dir is correct
-if ! echo `pwd` | grep -q "\/"$dirutil""; then
-# file is not being launched from $dirutil
- if [ -d "$dirutil" ]; then # dir is there
-# if file is not in the correct dir
- if [ ! "`ls "$dirutil" | grep "$filutil"`" ]; then
- # file is not in the correct dir so move it
-clear
-echo -e "$PNAU\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory.\n"
-echo "Moving it now...."
-sleep 2
-cat > db_wrong_path << EOF[WP]
-mv -f $0 "$dirutil"/
-cd "$dirutil"/
-echo -e "\n| Your "$filutil" is now located in your "$dirutil" directory |
- | Launch it from there when necessary |\n\n"
-sleep 4
-$0
-rm -f ../db_wrong_path
-exit 0
-EOF[WP]
-. db_wrong_path
- else # file is in dir so just cd
-cd "$dirutil"/
- fi
- else # dir is not there so don't bother - tell user to move it
-clear
-echo -e "$PNAU\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory and launched from there or Darkbot's root.
-Please move it and launch it again."
-sleep 3
-ABORT
- fi
-fi
-}
-#DB_SCRIPTS_PATH
-
-BASE_WORKDIR=.scriptutils
-TMP=$BASE_WORKDIR/._tmp/au$$
-mkdir -p $BASE_WORKDIR/._tmp/
-trap 'rm -fr $BASE_WORKDIR/._tmp* >/dev/null 2>&1' 0
-m_trap="echo -e \n\n -- `basename $0` terminated by `whoami` --\n\n"
-trap '$m_trap 1>&2; exit' 1 2 3 13 15
-
-FILEUSER="../dat/userlist.db"
-
-ABORT () {
-echo -e "\nThis utility will stop now!\n\nLeav\
-ing $PNAU...\n\n\n"; sleep 1; exit 0
-}
-
-USERS_HELP () {
-echo -e "$PNAU
-This utility displays, adds and removes user entries on your userlist.db file.\n
-While displaying file contents all entries are preceded by a number (which is
-not in fact part of the files) to help you better choose or manage each user.\n
-If the entries goes over screen size use arrow keys or PgUp/Down to scroll and
-type Q to quit or scroll the list to it's very end so it will automatically
-exit and proceed to the next function. CTRL + C aborts at all times.\n
-To launch the utility write $0. For a quick user entry write:
-$0 userid@host level Ex: $0 *whateverid@*host.domain.net 2
-(It will add an user with access level 2 to all channels).\n
-Comments, suggestions?
-Support: http://forum.freezedown.org\n"
-if [ -n "$insider" ]; then echo "[ Hit ENTER to continue ]"; read PTR; fi
-}
-
-# test environment
-TESTDEPEND () {
-NonFatalError () {
-echo "NON FATAL ERROR at $0 (`date`): $FiLe not detected on this system. \
-Going to simple operation mode, which means only simple USER addition will \
-be performed..." >> $BASE_WORKDIR/error_messages
-clear
-echo -e "$PNAU\nNON FATAL ERROR: $FiLe not detected on this system.
-Going to simple operation mode, which means only simple USER addition will
-be performed...\n"
-}
-if ! (type "$1" 1>/dev/null 2>&1); then
-FiLe="$1"
-NonFatalError $1
-sleep 1; unset $FiLe
-fi
-}
-TESTDEPEND "grep"; TESTDEPEND "sed"; TESTDEPEND "cut"; TESTDEPEND "cat"
-
-# dat/userlist.db
-DISPLAY_USERDB () {
-if [ ! -e "$FILEUSER" ] || [ ! -s "$FILEUSER" ]; then
-echo -e "$PNAU\nThere are no user entries present."
-LASTACTION="Unaccomplished action: no users entries to display."
-else
-echo -e "$PNAU* Local User List ** "$FILEUSER" ** \n
-| ---- If entries goes over screen's vertical size ---- |
-| ---- PgUp/Down or arrow keys scrolls; Q quits from the list ---- |\n
-`cat -b "$FILEUSER"`\n
-" | less -deXF
-echo " Press ENTER to continue"; read PTR
-
-LASTACTION="Displayed Darkbot users list."
-fi
-}
-
-CHECK_SYNTAX () {
-echo $null
-}
-
-QUICK_ADD () {
-clear
-echo "#* "$ADDuser" "$ADDlevel" 0 0" >> "$FILEUSER"
-echo "$PNAU
-Added to your "$FILEUSER" exactly this entry:
-#* "$ADDuser" "$ADDlevel" 0 0\n\n"
-}
-
-ADDUSER () {
-echo -e "\n$PNAU\n
-The format of the user@host must be *userid@*.host.isp
-Exs: *jason@*.superlink.net <-- dyanmic ip
- *mtr@darkmind.eclipse.net <-- static host
- *darkmind@204.127.145.* <-- unresolved host\n"
-unset NICK; unset LEVEL
-while [ -z "$NICK" ]
-do
-echo -n "Enter the *user@host of the user you'd like to add: "
-read NICK
-if [ -z "$NICK" ]; then
-echo -e "You MUST specify an user@host!\n"
-sleep 1
-fi
-done
-while [ -z "$LEVEL" ]
-do
-echo "
-What level should $NICK be added at?
-
- 1) Helper access. Database management commands.
- 2) Channel operation commands + database management.
- 3) Bot administrator. All commands.
- "
-echo -n "Select the level: "
-read LEVEL
-case $LEVEL in
-1)
- LEVEL=1;;
-2)
- LEVEL=2;;
-3)
- LEVEL=3;;
-*)
-echo "\"$LEVEL\" is not a valid selection."
-sleep 1;;
-esac
-done
-clear
-echo -e "\n$PNAU\n
-Adding user: $NICK at level $LEVEL..."
-echo "#* $NICK $LEVEL 0 0 I need to use SETINFO" >> "$FILEUSER"
-echo -e "
-Use ADDUSER and DELUSER commands to add or delete users on-line\n
-***************************************************************\n
-Darkbot now encrypt the password in the userlist!
-Be aware if you are logging private messages the encryption
- will not cover them, making it possible to see passwords
- on the logs. So turn logs off on defines.h if you don't want
- that to happen.
-All users added with this script will have a password of 0
-and should set their new password on IRC by issuing the command
-/msg Darkbot pass 0 new_password.\n
-***************************************************************\n"
-echo -e "Press ENTER to continue."
-read PTR
-}
-
-DELUSER () {
-if [ -s "$FILEUSER" ]; then
-echo -n "Please enter the number corresponding to the user entry to \
-be removed: "
-read DEL_USER
-usr_num_lines="$(cat "$FILEUSER" | wc -l | tr -cd '[:alnum:]')"
-if [ ! -z "$DEL_USER" ] && [ "$DEL_USER" -le "$usr_num_lines" ]; then
-REMOVED=$(sed -n $DEL_USER"p" $FILEUSER)
-sed $DEL_USER"d" $FILEUSER > $TMP.FILEUSER
-LASTACTION="Removed: $REMOVED."
-cat $TMP.FILEUSER > $FILEUSER
-LASTACTION="Removed from your Darkbot IRC users list entry:\n "$REMOVED""
-else
-LASTACTION="Unaccomplished user entry removal - invalid input."
-fi
-else
-LASTACTION="Unaccomplished user entry removal - no users present on $FILEUSER."
-fi
-}
-
-USERS_MENU () {
-while [ "$CHOICE" != "0" ]; do
-unset userdb_status_; unset userdb_status
-if [ ! -e "$FILEUSER" ] || [ ! -s "$FILEUSER" ]; then
-userdb_status_="*"
-userdb_status=" Not available - empty file"
-fi
-#if [ "$RemoteStatus" = "off" ]; then
-#RemoteStatus1="*" # for menu
-#fi
-
-clear
-echo -e "$PNAU
-`if [ ! -z "$LASTACTION" ]; then
-echo -e " | Last action/status:\n |"$userdb_status_" "$LASTACTION" "; \
-else echo "Main Menu"; fi`
-
-[1] Display my userlist.db entries. "$userdb_status_"
-[2] Add an user to my userlist.db
-[3] Remove an entry from my users file. "$userdb_status_"
-[4] Check my userlist.db file for errors (fast mode). "$userdb_status_"
-[H] HELP
-[X] Exit Darkbot Users Utility.
- "$userdb_status_" $userdb_status \n"
-echo -n "Enter your choice: "
-read CHOICE
-case $CHOICE in
-1)
-clear; DISPLAY_USERDB;;
-2)
-clear; ADDUSER;;
-3)
-clear; DISPLAY_USERDB; DELUSER;;
-4)
-if [ "$userdb_status_" != "*" ]; then
- if [ ! -s check-integrity ]; then
- LASTACTION="Unaccomplished file check - utility not installed."
- else
-./check-integrity userlist -quick
- fi
-else
-LASTACTION="Unaccomplished file check - empty file."
-fi;;
-h)
-clear; insider=y; USERS_HELP;;
-H)
-clear; USERS_HELP;;
-x)
-exit 0;;
-X)
-exit 0;;
-*)
-if [ -z $CHOICE ]; then
-echo -e "\nERROR: Playing with the ENTER key..?
-Write the number or letter corresponding to the action to take."
-sleep 2; clear
-else
-echo -e "\nERROR: '$CHOICE' is not a valid choice.
-Write the number or letter corresponding to the action to take"
-sleep 2; clear
-fi
-esac
-done
-}
-
-# start engines
-if [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--h" ]; then
-clear; USERS_HELP
-
- elif [ ! -z "$1" ] && [ ! -z "$2" ]; then
- ADDuser="$1"; ADDlevel="$2"; QUICK_ADD
-
- elif [ ! -e "$TMP.TESTDEPEND" ]; then USERS_MENU
- else
- ADDUSER
-
-fi
diff --git a/beta/scripts/check-integrity b/beta/scripts/check-integrity
deleted file mode 100755
index 16ef602..0000000
--- a/beta/scripts/check-integrity
+++ /dev/null
@@ -1,2209 +0,0 @@
-#! /bin/sh
-PNCI="\nDarkbot Database File Integrity\n<*************_~_*************>\n"
-PID=0624233000
-SLEEP () { SLEEP=$(sleep $1); }
-#cd scripts 2>/dev/null
-# to do: function to remove comments from shell utils and c files
-# removal of pre-made databases (in conjunction w/download-databases)
-# set -x # debug only
-
-USAGE () {
-clear
- echo -e >&2 "\n$PNCI Checks Darkbot data files for errors.\n
-Usage: `basename $0` <file|s|all> [-option|s]
-(file triggers are: all; info2; servers; setup; perform; userlist; random)
- Options:
- -h Shows this brief usage help (read README_UTILS for detailed info)
- -quick Speeds up the process bypassing pauses (sleep instances)
- -nointro Bypasses introductory information (a)
- -report Shows report file contents
- -topicsize sets info2.db's topic length (default 50) (a)(b)
- -replysize sets info2.db's reply length (default 400) (a)(b)
- -default Returns program to it's default values removing all options
-(a) The values of these options will be retained unless you use -default
-(b) Only necessary if you have a different length then the one on defines.h
-WARNING: Darkbot must be offline for most of saved information be effective!
-exs:
-$0 all Starts utility in full mode
-$0 info2 Checks info2.db in normal operation
-$0 userlist -quick Checks userlist.db bypassing pauses\n
- Support: http://forum.freezedown.org\n"
-exit 1
-}
-
-ABORT () {
-echo -e "\nThis utility will stop now!\n\nLeav\
-ing $0 ...\n\n\n"; sleep 1; exit 0
-}
-
-DB_SCRIPTS_PATH () {
-dirutil="scripts"
-filutil="`basename $0`"
-# check if dir is correct
-if ! echo `pwd` | grep -q "\/"$dirutil""; then
-# file is not being launched from $dirutil
- if [ -d "$dirutil" ]; then # dir is there
- # if file is not in the correct dir
- if [ ! "`ls "$dirutil" | grep "$filutil"`" ]; then
- # file is not in the correct dir so move it
-clear
-echo -e "$PNCI\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory.\n"
-echo "Moving it now...."
-sleep 2
-cat > db_wrong_path << EOF[WP]
-mv -f $0 "$dirutil"/
-cd "$dirutil"/
-echo -e "\n| Your "$filutil" is now located in your "$dirutil" directory |
- | Launch it from there when necessary |\n\n"
-sleep 4
-$0
-rm -f ../db_wrong_path
-exit 0
-EOF[WP]
-. db_wrong_path
- else # file is in dir so just cd
-cd "$dirutil"/
- fi
- else # dir is not there so don't bother - tell user to move it
-clear
-echo -e "$PNCI\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory and launched from there or Darkbot's root.
-Please move it and launch it again."
-sleep 3
-ABORT
- fi
-fi
-}
-
-ENVIRONMENT () {
-cd scripts 2>/dev/null
-BASE_WORKDIR=.scriptutils
-COMMON_TMP=$BASE_WORKDIR/tmp
-mkdir -p $BASE_WORKDIR/tmp
-TMP=$BASE_WORKDIR/._tmp/ci$$
-mkdir -p $BASE_WORKDIR/._tmp/
-ci_vars=$BASE_WORKDIR/.ci_vars
-if [ -e "$ci_vars" ]; then
-. "$ci_vars"; fi
-ci_report=$BASE_WORKDIR/integrity-report
-trap 'rm -fr $COMMON_TMP >/dev/null; rm -fr $BASE_WORKDIR/._tmp* >/dev/null 2>&1' 0
-m_trap="echo -e \n\n -- `basename $0` terminated by `whoami` --\n\n"
-trap '$m_trap 1>&2; exit' 1 2 3 13 15
-# SLEEP () { SLEEP=$(sleep $1); }
-}
-
-# test environment
-TESTDEPEND () {
-NonFatalError () {
-echo "FATAL ERROR at $0 (`date`): $FiLe not detected \
-on this system." >> $BASE_WORKDIR/error_messages
-clear
-echo -e "$PNCI\nFATAL ERROR at $0 (`date`)\n\n
-$FiLe not detected on this system.
-It is essential for $0 to work properly."
-ABORT
-}
-if ! (type "$1" 1>/dev/null 2>&1); then
-FiLe="$1"
-NonFatalError $1
-sleep 1; unset $FiLe
-fi
-}
-TESTDEPEND_GO () {
-TESTDEPEND "grep"; TESTDEPEND "sed"; TESTDEPEND "cut"; TESTDEPEND "tee"
-TESTDEPEND "wc"; TESTDEPEND "tr"; TESTDEPEND "cat"; TESTDEPEND "expr"
-}
-
-CI_INTRO () {
-count=30; counter=1
-while [ $count != "$counter" ]; do
-count=`expr "$count" - 1`
-clear
-echo -e "$PNCI
-This information will vanish in ["$count"] seconds...\n
-This utility executes a considerable amount of operations during
-file integrity verification. It depends on the size of the files
-to be checked and errors to correct the time it takes to perform
-all it's functions with accuracy.
-All process is done without user intervention, so be patient and
-wait until it is done or leave it working and check afterwards
-it's final results on the integrity-report file or by typing
-$0 -report.
-If you are in a rush type $0 -quick (fast mode).\n
-If you get wrong results on final counts due to unpredictable
-characters or symbols you might have on your files please help
-us correct the problem by participating it on the forum.\n
-For detailed information about this utility read README_UTILS.\n
-To bypass this introduction write $0 -nointro
-To abort all operations at any time press CTRL + C"
-SLEEP 1
-done
-}
-
-LINE_FEED () {
-# just for diagnose since DELEMPTY_LINES will fix any eventual problem
-clear
-echo -e "$PNCI* Line Feed *\n
-Checking for missing line feed at the end of file contents...\n"
-unset line_feed
-if [ "$(tail -n1 $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')" = \
-"0" ]; then
-echo "- Detected missing Line Feed at the end of $ORIG_FILE!" \
-| tee -a $TMP-LINE_FEED.$ORIG_FILE.rep.head
-line_feed=y
-else
-echo "- No missing line feed detected at the end of $ORIG_FILE!" \
-| tee -a $TMP-LINE_FEED.$ORIG_FILE.rep.head
-fi
-SLEEP 4
-}
-
-EMPTY_LINES () {
-clear
-echo -e "$PNCI* Empty Lines *\n
-Checking for empty lines on $ORIG_FILE...\n"
-SLEEP 1
-
-# check numb lines if not done b4
-if [ -z "$numLinesORI" ]; then
-numLinesORI=$(cat $ORIG_PATH | wc -l | tr -cd '[:alnum:]')
-fi
-
-# added this in case info2.db is empty and the working file is an imported db
-if [ ! -z "$numLinesORI" ] || [ "$numLinesORI" != "0" ]; then
-numLinesORI=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-fi
-
-# if detected no line feed actual lines will be + 1
-if [ "$line_feed" = "y" ]; then
-numLinesORI="`expr $numLinesORI + 1`"
-CHANGED=""$CHANGED" "$ORIG_FILE""
-fi
-
-# clean empty
-grep '.' $TMP-DB.WORK.FILE > $TMP-DB.WORK.FILE_TMP
-mv -f $TMP-DB.WORK.FILE_TMP $TMP-DB.WORK.FILE
-
-#check numb lines after
-numLinesNOW=$(cat "$TMP-DB.WORK.FILE" | wc -l | tr -cd '[:alnum:]')
-
-# REPORT
-# a quick report
-echo "EMPTY LINES on "$ORIG_FILE"" > $TMP-EMPTY_LINES.$ORIG_FILE.rep.head
-if [ "$numLinesORI" != "$numLinesNOW" ]; then
-CHANGED=""$CHANGED" "$ORIG_FILE""
-numLinesORI_NOW=$(expr $numLinesORI - $numLinesNOW 2>/dev/null)
-
-echo "- Total found - ["$numLinesORI_NOW"] Lines before = "$numLinesORI"\
- Lines after = "$numLinesNOW"" | tee -a $TMP-EMPTY_LINES.$ORIG_FILE.rep.head
-line_s=$(if [ "$numLinesORI_NOW" -gt "1" ]; then echo lines
-else echo line; fi)
-echo -e "\nRemoved "$numLinesORI_NOW" empty "$line_s"!"
-else
-echo "- No empty lines found!" | tee -a $TMP-EMPTY_LINES.$ORIG_FILE.rep.head
-fi
-
-SLEEP 4
-}
-
-INCOMPL_ENTRIES () {
-# checks for lines with only 1 word followed by carriage return
-clear
-echo -e "$PNCI* Incomplete Entries *\n
-Checking for topics with no replies on $ORIG_FILE...\n"
-SLEEP 1
-
-grep -ne '^ *[^ ]\+$' $TMP-DB.WORK.FILE > $TMP-noreply
-noreply_lines=$(cat $TMP-noreply | wc -l | tr -cd '[:alnum:]')
-
-if [ "$noreply_lines" != "0" ]; then
-echo -e " Total found - [$noreply_lines]\n"
-# removing it
-echo -e "sed '" > $TMP-noreply.to.be.deleted
-sed s/:/d' '/ $TMP-noreply | cut -d' ' -f1 >> $TMP-noreply.to.be.deleted
-echo -e "' $TMP-DB.WORK.FILE > $TMP-noreply.deleted" >> \
-$TMP-noreply.to.be.deleted
-echo -e "Removing it...\n"
-. $TMP-noreply.to.be.deleted
-mv -f $TMP-noreply.deleted $TMP-DB.WORK.FILE
-entry_pl=$(if [ "$noreply_lines" -gt "1" ]; then echo entries
-else echo entry; fi)
-echo -e "Removed "$noreply_lines" incomplete "$entry_pl" from \
-$ORIG_FILE!\n"
-fi
-
-# REPORT
-echo -e "INCOMPLETE ENTRIES (no topic or reply)" > \
-$TMP-INCOMPL_ENTRIES.rep.head
-if [ -s $TMP-noreply ]; then
-echo -e "- Incomplete entries found: "$noreply_lines"" >> \
-$TMP-INCOMPL_ENTRIES.rep.head
-echo "(Check section \"Removed INCOMPLETE ENTRIES from $ORIG_FILE\" \
-on this file)" >> $TMP-INCOMPL_ENTRIES.rep.head
-echo -e "===== Removed INCOMPLETE ENTRIES from $ORIG_FILE
-`cut -d: -f2- $TMP-noreply`
-_______________________ end of incomplete entries \
-_______________________" > $TMP-INCOMPL_ENTRIES.rep.body
-CHANGED=""$CHANGED" "$ORIG_FILE""
-else
-echo "- No incomplete entries found!" | tee -a \
-$TMP-INCOMPL_ENTRIES.rep.head
-fi
-
-SLEEP 4
-}
-
-DUP_ENTRIES () {
-clear
-echo -e "$PNCI* Duplicate Entries *\n
-Checking for duplicate entries on $ORIG_FILE ..."
-SLEEP 1
-
-# get duplicate lines - 1 item per dups on a vertical list ( for infos)
-sort $TMP-DB.WORK.FILE | uniq -di > $TMP.dup.entries
-# count number of lines that have repeated replies
-dupentries_lines=$(cat $TMP.dup.entries | wc -l | tr -cd '[:alnum:]')
-
-# if there are dup entries proceed with deletion and report
-if [ -s $TMP.dup.entries ]; then
-
-# just a condition for entry/entries
-if [ "$dupentries_lines" -gt "1" ]; then ENTRY_pl=entries
-else ENTRY_pl=entry
-fi
-
-echo -e "\n Total found - ["$dupentries_lines"]\n"
-
-# get total num of lines on the main file before entry deletion; used on infos
-dupentries_lin_bef=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-
-#DELETE
-# execute uniq - produce final file without repeats
-echo -e "Removing it..."
-#duplicate "$dupentries_lines" $ENTRY_pl from $ORIG_FILE..."
-sort $TMP-DB.WORK.FILE | uniq -i > $TMP-DB.WORK.FILE-TMP
-mv -f $TMP-DB.WORK.FILE-TMP $TMP-DB.WORK.FILE
-
-# COUNTS
-# count main after
-dupentries_lin_aft=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-# result - count amount of repetitions ( lines extracted )
-dupentries_lin_rem=$(expr "$dupentries_lin_bef" - "$dupentries_lin_aft")
-if [ "$dupentries_lin_rem" -gt "1" ]; then
-echo -e "\nRemoved all "$dupentries_lin_rem" repetitions of \
-"$dupentries_lines" $ENTRY_pl from $ORIG_FILE!"
-else
-echo -e "\nRemoved "$dupentries_lin_rem" repetition of \
-"$dupentries_lines" $ENTRY_pl from $ORIG_FILE!"
-fi
-fi
-
-# REPORT
-if [ -s $TMP.dup.entries ]; then
-echo "DUPLICATE ENTRIES
-- Number of entries with repetitions: "$dupentries_lines"
-- Number of repetitions found: "$dupentries_lin_rem"
-- Number of lines removed: "$dupentries_lin_rem"
- (Check section \"Removed DUPLICATE ENTRIES from $ORIG_FILE\" on this file)" \
- > $TMP-DUP_ENTRIES.$ORIG_FILE.rep.head
-
-echo -e "===== Removed DUPLICATE ENTRIES from "$ORIG_FILE"" > \
-$TMP-DUP_ENTRIES.$ORIG_FILE.rep.body
-cat $TMP.dup.entries >> $TMP-DUP_ENTRIES.$ORIG_FILE.rep.body
-echo "_______________________ end of duplicate entries \
-________________________" >> $TMP-DUP_ENTRIES.$ORIG_FILE.rep.body
-CHANGED=""$CHANGED" "$ORIG_FILE""
-else
-echo
-echo "- No repeated entries found!" \
-| tee -a $TMP-DUP_ENTRIES.$ORIG_FILE.rep.head
-fi
-
-SLEEP 4
-}
-
-DUP_TOPICS () {
-clear
-echo -e "$PNCI* Duplicate Topics *\n
-Checking for duplicate topics on $ORIG_FILE ...\n"
-SLEEP 1
-
-# get a list of all dups (including repetitions) and line numbers
-grep -n . $TMP-DB.WORK.FILE | cut -d' ' -f1 | sed s/:/' '/ | sort +1 | \
-uniq -iD -f1 > $TMP.dup.topics
-
-# count number of lines with repeated topics
-duptopics_lines=$(cat $TMP.dup.topics | wc -l | tr -cd '[:alnum:]')
-
-# if there are dup topics proceed with deletion and report
-if [ -s $TMP.dup.topics ]; then
-
-# get total num of lines on the main file before entry deletion; used on infos
-duptopics_lin_bef=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-
-# get only 1 line of repeats (2nd column on this 1) then sort it/numerical order# this file will have lines not to be removed from main file
-# i.e., 1 of the dups needs to be kept on the main file
-uniq -id -f1 $TMP.dup.topics | cut -d' ' -f1 | sort -g > $TMP-duptopics.uniques
-duptopics_uniques=$(cat $TMP-duptopics.uniques | wc -l | tr -cd '[:alnum:]')
-
-duptopics_repetitions=$(expr "$duptopics_lines" - "$duptopics_uniques")
-
-# condition for topic/topics repetition/s etc
-topic_s="$(if [ "$duptopics_uniques" -gt "1" ]; then echo topics; \
-dbs_plural=y; else echo topic; dbs_plural=n; fi)"
-repetition_s="$(if [ "$duptopics_repetitions" -gt "1" ]; then echo repetitions; \
-else echo repetition; fi)"
-
-echo -e " Detected a total of "$duptopics_repetitions" $repetition_s on \
-$duptopics_uniques $topic_s!"
-
-if [ "$duptopics_repetitions" -gt 250 ]; then
-echo -e "That's a huge amount of repetitions.
-This process envolves several operations and can take some time to complete."
-fi
-echo -e "\n Please wait...\n"
-
-# sort file $TMP.dup.topics so next step will not be a mess
-cut -d' ' -f1 $TMP.dup.topics | sort -g > $TMP-duptopics.sorted
-
-entry_ies="$(if [ "$repetition_s" = "repetitions" ]; then echo "entries"; \
-else echo "entry"; fi)"
-echo -e " Marking "$entry_ies" to be removed...\n"
-
-# compare with diff then extract only lines to be removed from main file
-diff -y $TMP-duptopics.sorted $TMP-duptopics.uniques | grep "<" | \
-sed s/[[:blank:]]*[\<$]// > $TMP-duptopics.2b.del
-
-# DELETE from main file
-# prepare sed operations
-echo "sed '" > $TMP-duptopics.2.del
-sed 's/$/d/' $TMP-duptopics.2b.del >> $TMP-duptopics.2.del
-echo "' $TMP-DB.WORK.FILE > $TMP-topic.lines.deleted" >> $TMP-duptopics.2.del
-
-duplicate_s="$(if [ "$repetition_s" = "repetitions" ]; then echo \
-"all "$duptopics_repetitions" duplications"; else echo \
-""$duptopics_repetitions" duplication"; fi)"
-echo -e " Trying to remove "$duplicate_s" from $ORIG_FILE..."
-
-# execute the file
-. $TMP-duptopics.2.del
-
-## move file w/deletes to working file
-mv -f $TMP-topic.lines.deleted $TMP-DB.WORK.FILE
-
-# COUNTS
-# count main after
-duptopics_lin_aft=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-# result - count amount of repetitions ( lines extracted )
-duptopics_lin_rem=$(expr "$duptopics_lin_bef" - "$duptopics_lin_aft")
-# compare lines on file from total antecipated lines 2 be removed
-if [ "$duptopics_lin_rem" = "$duptopics_repetitions" ]; then
- if [ "$duptopics_lin_rem" -gt "1" ]; then
- echo -e "\nRemoved all "$duptopics_lin_rem" repetitions of \
-"$duptopics_uniques" "$topic_s" from $ORIG_FILE!"
- else
- echo -e "\nRemoved "$duptopics_lin_rem" repetition of \
-"$duptopics_uniques" $topic_s from $ORIG_FILE!"
- fi
-else
-echo -e "There is a discrepancy between what was antecipated to be removed
-("$duptopics_repetitions $repetition_s") and what whas actually removed \
-("$duptopics_lin_rem").
-That can be caused by some symbols or characters on your $ORIG_FILE
-which are creating a conflict with this utility.
-Check $ci_report and compare the results
-with what you have in your file."
-fi
-fi
-
-# REPORT
-if [ -s $TMP.dup.topics ]; then
-echo -e "\nPlease wait while a copy of all removed entries is being made
-and a report generated..."
-SLEEP 2
-echo "DUPLICATE TOPICS
-- Number of topics with repetitions: "$duptopics_uniques"
-- Number of repetitions found: "$duptopics_repetitions"
-- Number of lines removed: "$duptopics_lin_rem"" > \
- $TMP-DUP_TOPICS.rep.head
- echo "(You'll find on DUPLICATE TOPICS section of this file all removed entries
- in case you would like to modify it and then reinsert it on it's previous
- location. One entry with the same topic was left on your $ORIG_FILE file)" \
- >> $TMP-DUP_TOPICS.rep.head
-if [ "$duptopics_repetitions" != "$duptopics_lin_rem" ]; then
-echo -e "##### WARNING #####\nWrong result: Removed \
-"$duptopics_lin_rem" of "$duptopics_repetitions" repetitions on \
-"$duptopics_uniques" topics.
- Check the corresponding section of this file and compare the results with
- your $ORIG_FILE file. Data with unpredictable characters might be causing
- the difference. If you discover the cause please contact us at the forum
- and if possible attach the file."
-fi >> $TMP-DUP_TOPICS.rep.head
-echo -e "===== Removed DUPLICATE TOPICS from "$ORIG_FILE"" > \
-$TMP-DUP_TOPICS.rep.body
-# prepare sed operations
-echo "sed -n '" > $TMP.report_duptopics_0
-sed 's/$/p/' $TMP-duptopics.2b.del >> $TMP.report_duptopics_0
-echo "' $TMP-DB.WORK.FILE >> $TMP-DUP_TOPICS.rep.body" >> \
-$TMP.report_duptopics_0
-# execute sed
-. $TMP.report_duptopics_0
-echo "________________________ end of duplicate topics \
-________________________" >> $TMP-DUP_TOPICS.rep.body
-CHANGED=""$CHANGED" "$ORIG_FILE""
-else
-echo "- No duplicate topics found." | tee -a $TMP-DUP_TOPICS.rep.head
-fi
-
-SLEEP 5
-}
-
-TOPIC_SIZE () {
-# checks max length your database topics
-# topics + than 400 chars or whatever is set on defines.h's
-# define TOPIC_SIZE
-
-clear
-echo -e "$PNCI* Maximum Topic Size/Length *\n
-Checking maximum character length of the topics entries on $ORIG_FILE...\n"
-
-# if no var with size go for defines.h. if no defimes.h assume 400
-if [ ! -n "$TOPIC_SIZE" ]; then
-# get defines.h setting if existent
-TOPIC_SIZE="$(sed -n '/MAX_TOPIC_SIZE/s/#define[[:blank:]]MAX_TOPIC_SIZE//p' \
-../source/defines.h 2>/dev/null | tr -cd '[:alnum:]')"
-
- if [ ! -n "$TOPIC_SIZE" ]; then
-echo -e "Unable to obtain configured maximum topic lenght allowed.
-Assuming default value of 400 characters...\n
-If this is not the setting you actually have please press CTRL + C to abort
-and write $0 -topic_size to set the default for this utility.\n"
-TOPIC_SIZE=50
-SLEEP 2
- else
- echo -e "Your defined maximum topic length is "$TOPIC_SIZE" characters."
- fi
-fi
-
-# get max topic length on file
-ACTUAL_TOPIC_SIZE=$(cat $TMP-DB.WORK.FILE | cut -d' ' -f1 | wc -L \
-| tr -cd '[:alnum:]')
-
-# size+1 - ( if TOPIC_SIZE this will put it as 401
-# because what we need is remove all exceeding max length, i.e, 401&+)
-TOPIC_SIZE_PLUS_1=`expr $TOPIC_SIZE + 1`
-
-# if length in file is greater than max size... work on it
-if [ "$ACTUAL_TOPIC_SIZE" -gt "$TOPIC_SIZE" ]; then
-echo -e "- Currently your longest topic (length) is: \
-"$ACTUAL_TOPIC_SIZE" characters \n"
-SLEEP 1
-echo -e "Please wait while the total number of topics exceeding maximum
-character lenght allowed is being obtained..."
-SLEEP 1
-
-# get all over length
-cat $TMP-DB.WORK.FILE | grep -nE '^.[^ ]{'$TOPIC_SIZE',}' \
-> $TMP-topic.size.all
-
-if [ -s $TMP-topic.size.all ]; then # we have entries in fault
-
-# get only line numbers ( will be needed to report file )
-cut -d: -f1 $TMP-topic.size.all > $TMP-topic.size.all.numb
-
-# get number of lines on working file (later will be used to check if
-# operations went right
-NUM_LINES_B4=$(cat "$TMP-DB.WORK.FILE" | wc -l | tr -cd '[:alnum:]')
-
-# count total before deletion
-NUM_TOPICS_EXCEEDING_SIZE=$(cat "$TMP-topic.size.all.numb" | wc -l \
-| tr -cd '[:alnum:]')
-
-echo -e "- Total entries with topic length exceeding size found: \
-"$NUM_TOPICS_EXCEEDING_SIZE"\n"
-SLEEP 2
-
-echo "Preparing for deletion process..."
-SLEEP 1
-echo "sed '
-`cat $TMP-topic.size.all | sed s/:/d' '/ | cut -d' ' -f1`
-' $TMP-DB.WORK.FILE > $TMP-topic.size.deleted" >> $TMP-topic.size.lines.to.del
-
-echo -e "Removing it ..."
-SLEEP 1
-# execute
-. $TMP-topic.size.lines.to.del
-# move it to working file
-mv -f $TMP-topic.size.deleted $TMP-DB.WORK.FILE
-
-entry_pl=$(if [ "$NUM_TOPICS_EXCEEDING_SIZE" -gt "1" ]; \
-then echo entries; else echo entry; fi)
-echo -e "Removed "$NUM_TOPICS_EXCEEDING_SIZE" "$entry_pl" from \
-"$ORIG_FILE"!\n"
-
-fi # end of -s $TMP-topic.size.all
-
-else # "$ACTUAL_TOPIC_SIZE" is not greater than "$TOPIC_SIZE"
-echo -e "\nYour topic's length is within your current configuration
-value, which is "$TOPIC_SIZE" characters maximum.\n\n"
-SLEEP 3
-fi
-
-# REPORT
-if [ -s $TMP-topic.size.all ]; then
-# first check from the working file
-NUM_LINES_AFTER=$(cat "$TMP-DB.WORK.FILE" | wc -l | tr -cd '[:alnum:]')
-NUM_LINES_NOW="$(expr "$NUM_LINES_B4" - "$NUM_LINES_AFTER")"
-NUM_LINES_DIFF="$(expr "$NUM_TOPICS_EXCEEDING_SIZE" - "$NUM_LINES_NOW")"
-
-# report head top
-echo "TOPICS LENGTH" > $TMP-TOPIC_SIZE.rep.head
-
-if [ "$NUM_LINES_NOW" != "0" ]; then # means at least some were removed
-# check if are the same as the ones that were supposed too
- if [ "$NUM_LINES_NOW" = "$NUM_TOPICS_EXCEEDING_SIZE" ]; then # looks ok
-# report header
-echo "- Allowed length = "$TOPIC_SIZE" \
-Maximum lenght detected = "$ACTUAL_TOPIC_SIZE"
-- Entries exceeding configured value = "$NUM_TOPICS_EXCEEDING_SIZE"
-- Total entries removed = "$NUM_LINES_NOW""
-
-# report body
-echo -e "\n===== Removed TOPICS LENGTH exceeding allowed value on \
-"$ORIG_FILE"
-`cat $TMP-topic.size.all | cut -d: -f2-`
-________________ end of topics with maximum length exceeded \
-__________________" > $TMP-TOPIC_SIZE.rep.body
-
- else # something wrong, diff of lines on working file don't match total 2b del
- echo "$NUM_LINES_DIFF entries were not removed! Please check report file."
- fi
-
-else # final lines count on working file is = 0 so no lines were removed
-echo "Something went wrong... not possible to remove entries.
-Check report file."
-fi
-
-CHANGED=""$CHANGED" "$ORIG_FILE""
-else # (-s $TMP-topic.size.all) no entries in fault
-echo -e "No topics exceeding maximum length allowd found!"
-fi >> $TMP-TOPIC_SIZE.rep.head
-
-SLEEP 5
-}
-
-DATA_SIZE () {
-# checks max length your database replies
-# replies + than 400 chars or whatever is set on defines.h's
-# define DATA_SIZE
-
-clear
-echo -e "$PNCI* Maximum Reply Size/Length *\n
-Checking maximum character length of the replies entries on $ORIG_FILE...\n"
-
-# if no var with size go for defines.h. if no defimes.h assume 400
-if [ ! -n "$DATA_SIZE" ]; then
-# get defines.h setting
-DATA_SIZE="$(sed -n '/MAX_DATA_SIZE/s/#define[[:blank:]]MAX_DATA_SIZE//p' \
-../source/defines.h 2>/dev/null | tr -cd '[:alnum:]')"
- if [ ! -n "$DATA_SIZE" ]; then
-echo -e "Unable to obtain configured maximum reply lenght allowed.
-Assuming default value of 400 characters...\n
-If this is not the setting you actually have please press CTRL + C to abort
-and write $0 -data_size to set the default for this utility.\n"
-DATA_SIZE=400
-SLEEP 2
- else
- echo -e "Your defined maximum reply length is "$DATA_SIZE" characters."
- fi
-fi
-
-# get max reply length on file
-ACTUAL_DATA_SIZE=$(cat $TMP-DB.WORK.FILE | cut -d' ' -f2- | wc -L \
-| tr -cd '[:alnum:]')
-
-# size+1 - ( if DATA_SIZE this will put it as 401
-# because what we need is remove all exceeding max length, i.e, 401&+)
-DATA_SIZE_PLUS_1=`expr $DATA_SIZE + 1`
-
-# if length in file is greater than max size... work on it
-if [ "$ACTUAL_DATA_SIZE" -gt "$DATA_SIZE" ]; then
-echo -e "---- Currently your longest reply (length) is: \
-"$ACTUAL_DATA_SIZE" characters ----\n"
-SLEEP 1
-echo -e "Please wait while the total number of topics exceeding maximum
-character lenght allowed is being obtained..."
-SLEEP 1
-
-# get length after 1st whitespace//assuming there's no whitspace in front
-# cat $TMP-DB.WORK.FILE | grep -En '^[^ ]* +(.{400,})$'
-cat $TMP-DB.WORK.FILE | grep -En '^ *[^ ]* +.{'$DATA_SIZE_PLUS_1',}$' \
-> $TMP-data.size.all
-
-if [ -s $TMP-data.size.all ]; then # we have entries in fault
-
-# get only line numbers ( will be needed to report file )
-cut -d: -f1 $TMP-data.size.all > $TMP-data.size.all.numb
-
-# get number of lines on working file (later will be used to check if
-# operations went right
-NUM_LINES_B4=$(cat "$TMP-DB.WORK.FILE" | wc -l | tr -cd '[:alnum:]')
-
-# count total before deletion
-NUM_REPLIES_EXCEEDING_SIZE=$(cat "$TMP-data.size.all.numb" | wc -l \
-| tr -cd '[:alnum:]')
-
-echo -e "- Total entries with reply length exceeding size found: \
-"$NUM_REPLIES_EXCEEDING_SIZE"\n"
-SLEEP 2
-
-echo "Preparing for deletion process..."
-SLEEP 1
-echo "sed '
-`cat $TMP-data.size.all | sed s/:/d' '/ | cut -d' ' -f1`
-' $TMP-DB.WORK.FILE > $TMP-data.size.deleted" >> $TMP-data.size.lines.to.del
-
-echo -e "Removing it ..."
-SLEEP 1
-# execute
-. $TMP-data.size.lines.to.del
-# move it to working file
-mv -f $TMP-data.size.deleted $TMP-DB.WORK.FILE
-
-entry_pl=$(if [ "$NUM_REPLIES_EXCEEDING_SIZE" -gt "1" ]; \
-then echo entries; else echo entry; fi)
-echo -e "Removed "$NUM_REPLIES_EXCEEDING_SIZE" "$entry_pl" from \
-"$ORIG_FILE"!\n"
-
-fi # end of -s $TMP-data.size.all
-
-else # "$ACTUAL_DATA_SIZE" is not greater than "$DATA_SIZE"
-echo -e "\nYour replies length is within your current configuration
-value, which is "$DATA_SIZE" characters maximum.\n\n"
-SLEEP 3
-fi
-
-# REPORT
-if [ -s $TMP-data.size.all ]; then
-# first check from the working file
-NUM_LINES_AFTER=$(cat "$TMP-DB.WORK.FILE" | wc -l | tr -cd '[:alnum:]')
-NUM_LINES_NOW="$(expr "$NUM_LINES_B4" - "$NUM_LINES_AFTER")"
-NUM_LINES_DIFF="$(expr "$NUM_REPLIES_EXCEEDING_SIZE" - "$NUM_LINES_NOW")"
-
-# report head top
-echo "REPLIES LENGTH" > $TMP-DATA_SIZE.rep.head
-
-if [ "$NUM_LINES_NOW" != "0" ]; then # means at least some were removed
-# check if are the same as the ones that were supposed too
- if [ "$NUM_LINES_NOW" = "$NUM_REPLIES_EXCEEDING_SIZE" ]; then # looks ok
-# report header
-echo "- Allowed length = "$DATA_SIZE" \
-Maximum lenght detected = "$ACTUAL_DATA_SIZE"
-- Entries exceeding configured value = "$NUM_REPLIES_EXCEEDING_SIZE"
-- Total entries removed = "$NUM_LINES_NOW""
-
-# report body
-echo -e "\n===== Removed REPLIES LENGTH exceeding allowed value on \
-"$ORIG_FILE"
-`cat $TMP-data.size.all | cut -d: -f2-`
-________________ end of replies with maximum length exceeded \
-__________________" > $TMP-DATA_SIZE.rep.body
-
- else # something wrong, diff of lines on working file don't match total 2b del
- echo "$NUM_LINES_DIFF entries were not removed! Please check report file."
- fi
-
-else # final lines count on working file is = 0 so no lines were removed
-echo "Something went wrong... not possible to remove entries.
-Check report file."
-fi
-
-CHANGED=""$CHANGED" "$ORIG_FILE""
-else # (-s $TMP-data.size.all) no entries in fault
-echo -e "No replies exceeding maximum length allowd found!"
-fi >> $TMP-DATA_SIZE.rep.head
-
-SLEEP 5
-}
-
-# check for entries without related rdb files
-CHECK_RDBS () {
-clear
-echo -e "$PNCI* RDB links and files *\n
-Checking for RDB entries on $ORIG_FILE ...\n"
-SLEEP 1
-
-# extract possible rdbs links
-sed -n /[[:space:]]~[[:alnum:]]/p "$TMP-DB.WORK.FILE" > $TMP-rdb.lines.all
-
-if [ -s $TMP-rdb.lines.all ]; then
-# count total
-rdb_lines_all=$(cat $TMP-rdb.lines.all | wc -l | tr -cd '[:alnum:]')
-# examine which ones are really rdb links and extract uniques
-count="0"
-while [ $count != "$rdb_lines_all" ]; do
-count=`expr $count + 1`
-# just a progress ind.
-clear; echo -e "$PNCI* RDB links and files *\n
- Examining existent RDB links on your $ORIG_FILE...\n"
- if [ $count != "$rdb_lines_all" ]; then
- echo -e " [`expr $count \* 100 / $rdb_lines_all`%] done\n"
- fi
-# extract line by line (all lines even ones that are not rdbs)
-rdb_line="$(sed -n "$count"p $TMP-rdb.lines.all)"
-# if = 2 words -> is a rdb
-if [ "`echo "$rdb_line" | wc -w | tr -cd '[:alnum:]'`" = "2" ]; then
-# put it on a list
-echo "$rdb_line" >> $TMP-rdb.lines.with.repeats
-fi
-done
-SLEEP 3
-fi # end of if there are entries with leading ~
-
-# if there are indeed rdb links (count uniques, repeats and extract only links)
-if [ -s $TMP-rdb.lines.with.repeats ]; then
-# count total (with) repeats
-rdb_lines_with_repeats=$(cat $TMP-rdb.lines.with.repeats | wc -l \
-| tr -cd '[:alnum:]')
-entry_s=$(if [ "$rdb_lines_with_repeats" -gt "1" ]; then echo entries
-else echo entry; fi)
-echo -e " So far detected "$rdb_lines_with_repeats" "$entry_s" \
-with RDB links..."
-SLEEP 1
-# extract only links; sort; uniq
-cat $TMP-rdb.lines.with.repeats | cut -d ' ' -f2 | sort | uniq > \
-$TMP-rdb.lines.uniques
-# count total uniques
-rdb_lines_uniques=$(cat $TMP-rdb.lines.uniques | wc -l | tr -cd '[:alnum:]')
-link_s=$(if [ "$rdb_lines_uniques" -gt "1" ]; then echo links
-else echo link; fi)
-echo -e " Detected "$rdb_lines_with_repeats" "$entry_s" with \
-"$rdb_lines_uniques" unique RDB "$link_s"!"
-SLEEP 1
-fi
-
-# check which rdb files exist on ../dat/
-ls ../dat/*.rdb > $TMP-rdb.files.all
-# remove whut and dunno, not needed for first operation
-grep -vw whut.rdb $TMP-rdb.files.all > $TMP-rdb.files.tmp
-grep -vw dunno.rdb $TMP-rdb.files.tmp > $TMP-rdb.files
-# count total rdb files for info (before matching)
-if [ -s $TMP-rdb.files ]; then
-rdb_files_b4=$(cat $TMP-rdb.files | wc -l | tr -cd '[:alnum:]')
-file_s=$(if [ "$rdb_files_b4" -gt "1" ]; then echo files; else echo file; fi)
-echo -e " Found "$rdb_files_b4" RDB "$file_s" on ..dat/ directory!"
-SLEEP 3
-
-# check which links don't have a file
-if [ ! -z "$rdb_lines_uniques" ]; then
-count="0"
-while [ $count != "$rdb_lines_uniques" ]; do
-count=`expr $count + 1`
-# extract line by line
-rdb_line="$(sed -n "$count"p $TMP-rdb.lines.uniques)"
-# just a progress ind.
-clear; echo -e "$PNCI* RDB links and files *\n
- Comparing RDB links from your $ORIG_FILE with \
-existent RDB files.\n"
-echo " Processing RDB link: $rdb_line ..."
- if [ $count != "$rdb_lines_uniques" ]; then
- echo -e " [`expr $count \* 100 / $rdb_lines_uniques`%] done\n"
- else
- echo -e " Done!\n"; fi
-# extract rdb link with no leading ~
-rdb_link="`echo "$rdb_line" | cut -d' ' -f2 | cut -d~ -f2`"
-# compare with the rdb files
-# # # test this one better # # #
-if [ `grep -w $rdb_link $TMP-rdb.files` ]; then
-# means there is a corresponding file
-# remove that file from files list so the ones left need to be
-# checked because might not have any entry on info2
-grep -wv $rdb_link $TMP-rdb.files > $TMP-rdb.files.tmp
-mv -f $TMP-rdb.files.tmp $TMP-rdb.files
-else
-# there is no match; put the line on a file for deletion and report
-# first all corresponding link lines with respective number
-grep -nw "[[:space:]]*$rdb_line" "$TMP-DB.WORK.FILE" 2>/dev/null >> \
-$TMP-rdb.nomatch.all
-# then only that link
-echo "$rdb_line" >> $TMP-rdb.nomatch.unique
-fi
-done
-SLEEP 3
-
-fi # if [ ! -z "$rdb_lines_uniques" ]; then
-fi # if [ -s $TMP-rdb.files ]; then
-
-# count total files without match (the ones left out)
-if [ -s "$TMP-rdb.files" ]; then
-rdb_files=$(cat $TMP-rdb.files | wc -l | tr -cd '[:alnum:]')
-echo -e " Found "$rdb_files" RDB files without any match.\n"
-SLEEP 2
-fi
-
-if [ -s $TMP-rdb.nomatch.unique ]; then
-# count total unique link lines (without repeats) without match
-rdb_nomatch_unique=$(cat $TMP-rdb.nomatch.unique | wc -l | tr -cd '[:alnum:]')
-echo " Found "$rdb_nomatch_unique" unmatched unique RDB links."
-SLEEP 1
-# count total links lines (with repeats) without match
-rdb_nomatch_all=$(cat $TMP-rdb.nomatch.all | wc -l | tr -cd '[:alnum:]')
-echo " (A total of "$rdb_nomatch_all" related entries on $ORIG_FILE)"
-SLEEP 1
-# prepare a file for deletion and report process
-cut -d: -f1 $TMP-rdb.nomatch.all > $TMP-rdb.nomatch.all.linenumb
-
-# extract line/s to be deleted to a tmp file for report
-# sed operations
-echo "sed -n '" > $TMP-rdb.nomatch.all.2.report
-sed 's/$/p/' $TMP-rdb.nomatch.all.linenumb >> $TMP-rdb.nomatch.all.2.report
-echo "' "$TMP-DB.WORK.FILE" >> $TMP-CHECK_RDBS.rep.body.0" >> $TMP-rdb.nomatch.all.2.report
-# execute sed
-. $TMP-rdb.nomatch.all.2.report
-
-# DELETE
-echo -e "\nRemoving broken RDB links...\n"
-SLEEP 3
-# make file with line numbers for deletion
-echo "sed '" > $TMP-rdb.nomatch.all.2.del
-sed 's/$/d/' $TMP-rdb.nomatch.all.linenumb >> $TMP-rdb.nomatch.all.2.del
-echo "' "$TMP-DB.WORK.FILE" > $TMP-rdb.nomatch.all.deleted" \
->> $TMP-rdb.nomatch.all.2.del
-# execute it
-. $TMP-rdb.nomatch.all.2.del
-# move file w/deletes to working file
-mv -f $TMP-rdb.nomatch.all.deleted $TMP-DB.WORK.FILE
-link_s=$(if [ "$rdb_nomatch_unique" -gt "1" ]; then echo links
-else echo link; fi)
-echo -e "Removed "$rdb_nomatch_unique" unmatched RDB "$link_s" from \
-$ORIG_FILE!"
-
-SLEEP 3
-fi # if there were no non matching rdbs
-# end of main engine
-
-# REPORT
-clear
-echo -e "$PNCI* RDB links and files *\n"
-SLEEP 1
-# report header links
-RDBS_rep_head () {
-echo "RDB LINKS AND FILES" | tee -a $TMP-CHECK_RDBS.rep.head
-if [ ! -z "$rdb_lines_uniques" ]; then
-echo "- Existent RDB unique links = $rdb_lines_uniques"
-echo "- Existent RDB entries = $rdb_lines_with_repeats"
- if [ ! -z "$rdb_nomatch_unique" ]; then
-echo "- Total broken unique RDB links = $rdb_nomatch_unique"
-echo "- Total entries with broken RDB links = $rdb_nomatch_all"
-
-# make report body for broken links
-echo -e "===== Removed BROKEN RDB LINKS from "$ORIG_FILE"" > \
-$TMP-CHECK_RDBS.rep.body
-cat $TMP-CHECK_RDBS.rep.body.0 >> $TMP-CHECK_RDBS.rep.body
-echo "________________________ end of broken rdb links \
-________________________" >> $TMP-CHECK_RDBS.rep.body
-
- CHANGED=""$CHANGED" "$ORIG_FILE""
- else
- echo "- No broken RDB links found!"
- fi
-else
-echo "- Existent RDB links = none found"
-fi
-# report header files
-if [ ! -z "$rdb_files_b4" ]; then
-echo "- Existent RDB files = $rdb_files_b4"
- if [ ! -z "$rdb_files" ]; then
-echo "- RDB files without any RDB lynk = $rdb_files (not removed)"
-
-# make report body for files without rdb links
-echo -e "\n===== RDB FILES WITHOUT MATCHING LINKS on $ORIG_FILE
-----< NOT REMOVED from ../dat/ directory - do it yourself >----" >> \
-$TMP-CHECK_RDBS.rep.body
-cat $TMP-rdb.files >> $TMP-CHECK_RDBS.rep.body
-echo "________________ end of rdb files without matching links \
-__________________" >> $TMP-CHECK_RDBS.rep.body
-
- CHANGED=""$CHANGED" "$ORIG_FILE""
- fi
-else
-echo "- Existent RDB files = none found"
-fi
-}
-RDBS_rep_head | tee $TMP-CHECK_RDBS.rep.head
-if [ ! -z "$rdb_nomatch_unique" ]; then
-echo "(Check section \"Removed BROKEN RDB LINKS from "$ORIG_FILE"\" \
-on this file)" >> $TMP-CHECK_RDBS.rep.head
-fi
-
-SLEEP 5
-}
-
-RANDOM_FILES () {
-clear
-echo -e "$PNCI* Random Phrases Files *\n\n
-Preparing files for checking.\n
-Please wait..."
-
-_RM_RD_TOP_LINE () {
-# function to make a var when Darkbot version is affected on the new format
-# of random files where top line number is not needed anymore.
-# Using backup_randomstuff as a search pattern since it was created on the
-# same revision, RC4, instead of more complicate version extraction.
-if [ "`grep 'BACKUP_RANDOMSTUFF' ../docs/WHATSNEW 2>/dev/null`" ] \
-|| [ "`grep 'BACKUP_RANDOMSTUFF' ../source/defines.h 2>/dev/null`" ]; then
-rm_rd_top_line="y"
-fi
-}
-# this condition is here in case i'll decide to trigger this all process from
-# (also) another utility, like live-update or configure, so revision will
-# be analyzed there
-if [ -z "$rm_rd_top_line" ]; then
-_RM_RD_TOP_LINE
-fi
-
-# make a list of rdb files on dat directory
-ls ../dat/*.rdb > $TMP-rd.files.all
-
-# put random.ini and randomstuff.ini on the list of files to check
-echo "../dat/random.ini" >> $TMP-rd.files.all
-echo "../dat/randomstuff.ini" >> $TMP-rd.files.all
-
-# count total number of lines on the list file
-rd_files_all=$(cat $TMP-rd.files.all | wc -l | tr -cd '[:alnum:]')
-
-SLEEP 2
-# start checking
-count="0"
-while [ $count != "$rd_files_all" ]; do
-count=`expr $count + 1`
-
-# extract line by line
-rd_file="$(sed -n "$count"p $TMP-rd.files.all)"
-rd_file_name="$(echo "$rd_file" | cut -d/ -f3)"
-
-# just a progress ind.
-clear
-echo -e "$PNCI* Random Phrases Files *\n
-`expr "$rd_files_all" - "$count"` of "$rd_files_all" files to check. $(if \
-[ $count != "$rd_files_all" ]; \
-then echo " [`expr $count \* 100 / $rd_files_all`%] done."; \
-else echo " Done!"; fi)"
-echo -e "Processing "$rd_file_name"\n"
-echo -e "Checking for missing line feed at the end of file contents ..."
-SLEEP 1
-
-# remove tmp errors file for a new cycle
-rm -f $TMP-random.errors.rep.head
-
-# prepare random.ini
-if [ "$rd_file_name" = "random.ini" ]; then
-grep -wv "^\/\*" ../dat/random.ini > $TMP-random.ini
-grep -w "^\/\*" ../dat/random.ini > $TMP-random.ini.comments
-rd_file="$TMP-random.ini"
-fi
-
-# check numb lines before
-rd_numLinesORI=$(cat $rd_file | wc -l | tr -cd '[:alnum:]')
-echo " Initial number of lines = "$rd_numLinesORI""
-
-unset line_feed
-if [ "$(tail -n1 $rd_file | wc -l | tr -cd '[:alnum:]')" = \
-"0" ]; then
-echo "- Detected missing Line Feed on the last line!" \
-| tee -a $TMP-random.errors.rep.head
-line_feed="y"
-else
-echo "- No missing line feed detected on the last line!"
-fi
-SLEEP 2
-
-# if detected no line feed actual lines will be + 1
-if [ "$line_feed" = "y" ]; then
-rd_numLinesORI="`expr $rd_numLinesORI + 1`"
-fi
-
-# clean empty lines
-echo -e "\nChecking for empty lines ..."
-SLEEP 1
-grep '.' $rd_file > $TMP-rd_file
-# check numb lines after
-rd_numLinesNOW=$(cat $TMP-rd_file | wc -l | tr -cd '[:alnum:]')
-echo " Number of lines after checking = "$rd_numLinesNOW""
-
-line_s=`if [ "$rd_numLinesNOW" -gt "1" ]; then echo lines; else echo line; fi`
-# a quick report
-if [ "$rd_numLinesORI" != "$rd_numLinesNOW" ]; then
-rd_numLinesORI_NOW=$(expr "$rd_numLinesORI" - "$rd_numLinesNOW" 2>/dev/null)
-echo " ### ERROR ###"
-echo " Total lines before = "$rd_numLinesORI""
-echo " Total lines after = "$rd_numLinesNOW""
-echo "- Removed "$rd_numLinesORI_NOW" empty "$line_s"." \
-| tee -a $TMP-random.errors.rep.head
-echo
-else
-echo -e "- No empty lines found!\n"
-fi
-if [ "$line_feed" = "y" ]; then echo " (there is now an additional line \
-due to the missing line feed)"; fi #| tee -a $TMP-random.errors.rep.head
-
-SLEEP 1
-
-echo "Checking top line number and random entries..."
-SLEEP 1
-
-# check number on top
-top_rd_line= total_rd_lines=
-top_rd_line=$(head -n1 "$TMP-rd_file" | grep ^[0-9])
-total_rd_lines=$(cat "$TMP-rd_file" | wc -l | tr -cd '[:alnum:]')
-
-if [ -n "$top_rd_line" ]; then # there is a number
-
-# if the file being checked is not the only one not in need to remove the line
-# on top with the number, which is random.ini, and Darkbot version being checked
-# is not prior to the one where top line number is not needed anymore...
-if [ "$rd_file_name" = "random.ini" ] || [ $rm_rd_top_line != "y" ]; then
-# proceed, it's not included on the files to remove top line
-
-# count lines - subtract 1 from total so top line is not counted
-echo " Existent top line number = "$top_rd_line""
-rd_lines=$(expr "$total_rd_lines" - 1 2>/dev/null)
-echo " Total number of random entries = "$rd_lines""
-
-if [ "$top_rd_line" != "$rd_lines" ]; then # is not the same so it's wrong
-echo -e " ### ERROR ### Total line number is not correct!\n Fixing it..."
-echo "$rd_lines" > $TMP-fixed.rd.lines
-sed 1d "$TMP-rd_file" >> $TMP-fixed.rd.lines
-mv -f $TMP-fixed.rd.lines "$TMP-rd_file"
-echo "- Replaced top number of random entries from "$top_rd_line" \
-to "$rd_lines"" | tee -a $TMP-random.errors.rep.head
-else
-echo -e "- Random number correct!\n"
-fi
-
-else # if $rd_file_name isnot "random.ini" & $rm_rd_top_line is y
-# remove top line, it's not needed it on RC4 & +
-sed 1d "$TMP-rd_file" >> $TMP-fixed.rd.lines
-mv -f $TMP-fixed.rd.lines "$TMP-rd_file"
-echo "- Removed top line with number of random entries, not \
-needed anymore." | tee -a $TMP-random.errors.rep.head
-fi
-
-else # there is no line number on top so make a new file fixed
-if [ "$rd_file_name" = "random.ini" ] || [ $rm_rd_top_line != "y" ]; then
-# proceed, it's not included on the files to remove top line
-echo " Total number of random entries = "$total_rd_lines""
-echo -e " ### ERROR ### There is no total lines number on top!
-Fixing it..."
-echo "$total_rd_lines" > $TMP-fixed.rd.lines
-cat "$TMP-rd_file" >> $TMP-fixed.rd.lines
-mv -f $TMP-fixed.rd.lines "$TMP-rd_file"
-echo "- Added missing total number of random entries of "$total_rd_lines"" \
-| tee -a $TMP-random.errors.rep.head
-else echo "- Nothing wrong with it. It's not present and it's not needed anymore."
-fi
-fi
-
-# prep file for report with random file name and errors
-if [ -s $TMP-random.errors.rep.head ]; then
-echo " Random file "$rd_file_name"" >> $TMP-random.errors.rep.head0
-cat $TMP-random.errors.rep.head >> $TMP-random.errors.rep.head0
-
-# prep a file for backup and save
- # replace random.ini comments
-if [ "$rd_file_name" = "random.ini" ]; then
-cat $TMP-rd_file >> $TMP-random.ini.comments
-mv -f $TMP-random.ini.comments $TMP-$rd_file_name
-else
-mv -f $TMP-rd_file $TMP-$rd_file_name
-fi
-
-# backup file
-echo "echo -e \"\nBacking up "$rd_file_name" before applying the changes...\"
-cp -f $rd_file $rd_file.bak
-echo \"Moving "$rd_file_name"'s working file to it's original location...\"
-mv -f $TMP-$rd_file_name ../dat/$rd_file_name
-SLEEP 1" >> $TMP-RANDOM_FILES
-
-fi
-echo -e "\nDone with "$rd_file_name"."
-SLEEP 3
-done
-
-file_s="`if [ "$rd_files_all" -gt "1" ]; then echo files; else echo file; fi`"
-# REPORT
-# report header
-echo "RANDOM PHRASES FILES CHECK
-- line feed, empty lines and total entries number -
-(only files with errors will be mentioned here)
-Total files checked: $rd_files_all" > $TMP-RANDOM_FILES.rep.head
-if [ -s $TMP-random.errors.rep.head0 ]; then
-cat $TMP-random.errors.rep.head0 >> $TMP-RANDOM_FILES.rep.head
-
-CHANGED=""$CHANGED" "$ORIG_FILE""
-else
-echo " No errors found on "$rd_files_all" "$file_s" checked!" \
-| tee -a $TMP-RANDOM_FILES.rep.head
-fi
-
-SLEEP 4
-}
-
-SETUP_INI () {
-clear
-echo -e "$PNCI* setup.ini file *\n"
-
-echo -e "\n - setup.ini file as is before been checked -"
-cat $TMP-DB.WORK.FILE
-SLEEP 3
-
-echo -e "\nChecking contents of setup.ini file...\n"
-SLEEP 1
-
-# count words
-numLinesSETUP=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-# count words
-numWordsSETUP=$(cat $TMP-DB.WORK.FILE | wc -w | tr -cd '[:alnum:]')
-
-# start checking values
-if [ ! "`grep 'NICK=' $TMP-DB.WORK.FILE | cut -d= -f2`" ]; then
-echo "NICK=Darkbot"
-Missing_Parm="$Missing_Parm""NICK "
-else
-grep 'NICK' $TMP-DB.WORK.FILE | tr -d ' '
-fi > $TMP-DB.WORK.FILE.tmp
-
-if [ ! "`grep 'USERID=' $TMP-DB.WORK.FILE | cut -d= -f2`" ]; then
-echo "USERID=darkbot"
-Missing_Parm="$Missing_Parm""USERID "
-else
-grep 'USERID' $TMP-DB.WORK.FILE | tr -d ' '
-fi >> $TMP-DB.WORK.FILE.tmp
-
-if [ ! "`grep 'CHAN=' $TMP-DB.WORK.FILE | cut -d= -f2`" ]; then
-echo "CHAN=#darkbot"
-Missing_Parm="$Missing_Parm""CHAN "
-else
-grep 'CHAN' $TMP-DB.WORK.FILE | tr -d ' ' > $TMP-DB.WORK.FILE.chan
- # check if there isn't a # before channel name
- if [ ! `grep 'CHAN=#' $TMP-DB.WORK.FILE.chan` ]; then
- sed 's/CHAN=/CHAN=#/' $TMP-DB.WORK.FILE.chan > $TMP-DB.WORK.FILE.chan2
- mv -f $TMP-DB.WORK.FILE.chan2 $TMP-DB.WORK.FILE.chan
- fi
- # check if there isn't a # before channel name after a ,
- if [ `grep ',' $TMP-DB.WORK.FILE.chan` ]; then
- sed -e 's/,/,#/g' -e 's/##/#/g' $TMP-DB.WORK.FILE.chan > $TMP-DB.WORK.FILE.chan2
- mv -f $TMP-DB.WORK.FILE.chan2 $TMP-DB.WORK.FILE.chan
- fi
- cat $TMP-DB.WORK.FILE.chan >> $TMP-DB.WORK.FILE.tmp
-fi >> $TMP-DB.WORK.FILE.tmp
-
-if [ ! "`grep 'REALNAME=' $TMP-DB.WORK.FILE | cut -d= -f2`" ]; then
-echo "REALNAME=Download me from http://www.freezedown.org"
-Missing_Parm="$Missing_Parm""REALNAME "
-else
-grep 'REALNAME' $TMP-DB.WORK.FILE
-fi >> $TMP-DB.WORK.FILE.tmp
-
-if [ ! "`grep 'VHOST=' $TMP-DB.WORK.FILE | cut -d= -f2`" ]; then
-echo "VHOST=0"
-Missing_Parm="$Missing_Parm""VHOST "
-else
-grep 'VHOST' $TMP-DB.WORK.FILE | tr -d ' '
-fi >> $TMP-DB.WORK.FILE.tmp
-
-if [ ! "`grep 'CMDCHAR=' $TMP-DB.WORK.FILE | cut -d= -f2`" ]; then
-echo "CMDCHAR=!"
-Missing_Parm="$Missing_Parm""CMDCHAR "
-else
-grep 'CMDCHAR' $TMP-DB.WORK.FILE | tr -d ' '
-fi >> $TMP-DB.WORK.FILE.tmp
-
-if [ "`grep 'SEEN' $TMP-DB.WORK.FILE`" ]; then
-SEEN=$(grep 'SEEN' $TMP-DB.WORK.FILE | tr -d ' '| cut -d= -f2)
-# check if is 0 or 1
- if [ "$SEEN" -lt "2" 2>/dev/null ]; then
- echo "SEEN="$SEEN""
- else
- # is not 0 or 1 so check if is off or on
- if [ `echo "$SEEN" | grep -i "on" 2>/dev/null` ]; then
- echo "SEEN=1"
- else
- echo "SEEN=0"
- fi
- fi
-fi >> $TMP-DB.WORK.FILE.tmp
-
-mv -f $TMP-DB.WORK.FILE.tmp $TMP-DB.WORK.FILE
-
-clear
-echo -e "$PNCI* setup.ini file *\n"
-echo -e "\n - setup.ini file as is after being checked -"
-cat $TMP-DB.WORK.FILE
-echo -e "\n"
-
-echo " - Summary -"
-
-echo "setup.ini file contents" > $TMP-SETUP_INI.rep.head
-numLinesSETUP_now=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-if [ "$numLinesSETUP_now" -lt "$numLinesSETUP" ]; then
-numLinesSETUP_diff="$(expr "$numLinesSETUP" - "$numLinesSETUP_now")"
-fi
-
-numWordsSETUP_now=$(cat $TMP-DB.WORK.FILE | wc -w | tr -cd '[:alnum:]')
-if [ "$numWordsSETUP_now" -lt "$numWordsSETUP" ]; then
-numWordsSETUP_diff="$(expr "$numWordsSETUP" - "$numWordsSETUP_now")"
-space_s=$(if [ "$numWordsSETUP_diff" -gt "1" ]; then echo spaces;
-else echo space; fi)
-echo "- Found "$numWordsSETUP_diff" misplaced empty "$space_s"!"
-else echo "- No misplaced spaces found!"
-fi | tee -a $TMP-SETUP_INI.rep.head
-
-if [ -n "$Missing_Parm" ]; then
-echo "- Missing values on `echo "$Missing_Parm" | \
-sed s/[[:space:]]/,' '/` (defaults were used)"
-else
-echo "- Parameters and values looks ok."
-fi | tee -a $TMP-SETUP_INI.rep.head
-
-echo
-if [ -n "$numLinesSETUP_diff" ] || [ -n "$numWordsSETUP_diff" ] || \
-[ -n "$Missing_Parm" ]; then
-echo "setup.ini contents and syntax appears to be correct now." \
-| tee -a $TMP-SETUP_INI.rep.head
-echo -e "\n===== setup.ini file contents before changes
-`cat $ORIG_PATH`
-________________ end of setup.ini file before changes made \
-__________________" > $TMP-SETUP_INI.rep.body
-
-CHANGED=""$CHANGED" "$ORIG_FILE""
-else
-echo "setup.ini contents and syntax appears to be correct." \
-| tee -a $TMP-SETUP_INI.rep.head
-fi
-echo
-
-SLEEP 5
-}
-
-SERVERS_INI () {
-clear
-echo -e "$PNCI* servers.ini file *\n"
-
-echo -e " - servers.ini file as is before been checked -"
-cat $TMP-DB.WORK.FILE
-SLEEP 1
-
-# count lines
-numLinesSERVERS=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-# count words
-numWordsSERVERS=$(cat $TMP-DB.WORK.FILE | wc -w | tr -cd '[:alnum:]')
-
-count="0"
-numMissPORTS=0
-while [ $count != "$numLinesSERVERS" ]; do
-count=`expr $count + 1`
-servers_tmp="$(sed -n "$count"p $TMP-DB.WORK.FILE)"
-if [ `echo "$servers_tmp" | grep -E :` ]; then
-server="$(echo $servers_tmp | cut -d: -f1)"
-port="$(echo $servers_tmp | cut -d: -f2 | grep [0-9])"
-else
-server="$(echo $servers_tmp | cut -d' ' -f1)"
-port="$(echo $servers_tmp | cut -d' ' -f2 | grep [0-9])"
-fi
-
-clear
-echo -e "$PNCI* servers.ini file *\n
-Checking entries syntax...\n
- SERVER - "$server"
- PORT - "$port""
-
-if [ ! -n "$port" ]; then
-echo -e "#### ERROR #####\nNo port detected.\nDefaulting to 6667..."; SLEEP 1
-Missing_PORTS=`expr $numMissPORTS + 1`
-echo "$server" "6667" >> $TMP-DB.WORK.FILE.tmp
-else
-echo "$servers_tmp" >> $TMP-DB.WORK.FILE.tmp
-fi
-SLEEP 1
-
-done
-SLEEP 1
-
-clear
-echo -e "$PNCI* servers.ini file *\n\n"
-
-if [ -s $TMP-DB.WORK.FILE.tmp ]; then
-mv -f $TMP-DB.WORK.FILE.tmp $TMP-DB.WORK.FILE
-fi
-
-echo "servers.ini file contents" > $TMP-SERVERS_INI.rep.head
-numLinesSERVERS_now=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-if [ "$numLinesSERVERS_now" -lt "$numLinesSERVERS" ]; then
-numLinesSERVERS_diff="$(expr "$numLinesSERVERS" - "$numLinesSERVERS_now")"
-fi
-
-numWordsSERVERS_now=$(cat $TMP-DB.WORK.FILE | wc -w | tr -cd '[:alnum:]')
-if [ "$numWordsSERVERS_now" -lt "$numWordsSERVERS" ]; then
-numWordsSERVERS_diff="$(expr "$numWordsSERVERS" - "$numWordsSERVERS_now")"
-space_s=$(if [ "$numWordsSERVERS_diff" -gt "1" ]; then echo spaces;
-else echo space; fi)
-echo "- Found "$numWordsSERVERS_diff" misplaced empty "$space_s"!"
-else echo "- No misplaced spaces found!"
-fi | tee -a $TMP-SERVERS_INI.rep.head
-
-port_s="$(if [ -n "$Missing_PORTS" ] && [ "$Missing_PORTS" -gt "1" ]; then echo "s"; else echo ""; fi)"
-if [ -n "$Missing_PORTS" ]; then
-echo "- Missing value$port_s on "$Missing_PORTS" port$port_s! \
-(default 6667 were used)"
-else
-echo "- Apparently there are no errors on entries syntax and PORTS placement."
-fi | tee -a $TMP-SERVERS_INI.rep.head
-echo
-
-if [ -n "$numLinesSERVERS_diff" ] || [ -n "$numWordsSERVERS_diff" ] || \
-[ -n "$Missing_PORTS" ]; then
-echo "servers.ini contents and syntax appears to be correct now."
-echo -e "\n===== servers.ini file contents before changes
-`cat $ORIG_PATH`
-________________ end of servers.ini file before changes made \
-__________________" > $TMP-SERVERS_INI.rep.body
-CHANGED=""$CHANGED" "$ORIG_FILE""
-else
-echo "servers.ini contents and syntax appears to be correct." \
-| tee -a $TMP-SERVERS_INI.rep.head
-fi
-echo
-
-SLEEP 5
-}
-
-USERLIST_DB () {
-# just a basic check at this stage
-# to do: check repeated IPs at the end of the process besides repeated
-# entries at start; optimize all integers check
-clear
-echo -e "$PNCI* userlist.db file *\n"
-
-# count lines
-numLinesUSERLIST=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-usrlst_removed="0"; usrlst_errors="0"; usrlst_errors_b4="0"
-count=0
-while [ "$count" != "$numLinesUSERLIST" ]; do
-count=`expr "$count" + 1`
-
-# get complete line
-usrlst_entry="$(sed -n "$count"p $TMP-DB.WORK.FILE)"
-
-clear
-echo -e "$PNCI* userlist.db file *\n"
-echo -e "[`expr "$numLinesUSERLIST" - "$count"`] entries to be checked.\n"
-echo -e "Verifying syntax on entry:\n$usrlst_entry\n"
-
-# get complete line
-#usrlst_entry="$(sed -n "$count"p $TMP-DB.WORK.FILE)"
-
-# if no @ bypass to later remove entry
-if [ "`echo "$usrlst_entry" | cut -d' ' -f2 | grep '@'`" ]; then
-
-# check if 1st field or after a , starts with # ( #channel or #*)
-usrlst_chan="$(echo "$usrlst_entry" | cut -d' ' -f1)"
-usrlst_chan0="$(echo "$usrlst_chan" | sed -e s/,/,'#'/g -e s/'##'/'#'/g)"
-if [ ! "`echo "$usrlst_chan0" | grep -E '^\#'`" ]; then
-usrlst_chan0="#"$usrlst_chan0""
-fi
-if [ "$usrlst_chan" != "$usrlst_chan0" ]; then
-echo -e "#### ERROR ####\n Channel field incorrect! \
-Missing channel prefix '#'. Adding it...\n"
-usrlst_errors="$(expr "$usrlst_errors" + 1)"
-usrlst_chan="$usrlst_chan0"
-fi
-
-# get user mask
-usrlst_mask="$(echo "$usrlst_entry" | cut -d' ' -f2)"
-if [ "`echo "$usrlst_mask" | grep '\.$'`" ]; then
-echo -e "#### ERROR ####\n Unexpected end of user IP! Adding '*'...\n"
-usrlst_errors="$(expr "$usrlst_errors" + 1)"
-usrlst_mask="$(echo ""$usrlst_mask"*")"
-fi
-if [ "`echo "$usrlst_mask" | grep -E '\.\.'`" ]; then
-echo -e "#### ERROR ####\n Incorrect syntax on user IP '..'. Fixing it...\n"
-usrlst_mask="$(echo "$usrlst_mask" | sed 's/\.\./\./')"
-usrlst_errors="$(expr "$usrlst_errors" + 1)"
-fi
-
-usrlst_ip="@$(echo "$usrlst_mask" | cut -d@ -f2)"
-
-#check if 2nd string starts with * (*userid) not ~ | not *!
-usrlst_userid="$(echo "$usrlst_entry" | cut -d' ' -f2 | cut -d@ -f1)"
-if [ "`echo "$usrlst_userid" | grep '~'`" ]; then
-echo -e "#### ERROR ####\n USER ID field incorrect! Unnecessary leading ~\n"
-usrlst_userid="$(echo "$usrlst_userid" | sed 's/~//')"
-usrlst_errors="$(expr "$usrlst_errors" + 1)"
-fi
-
-if [ "`echo "$usrlst_userid" | grep -E '^\*!'`" ]; then
-echo -e "#### ERROR ####\n USER ID field incorrect! Disallowed leading characters *!\n"
-usrlst_userid="$(echo "$usrlst_userid" | sed 's/\*\!//')"
-usrlst_errors="$(expr "$usrlst_errors" + 1)"
-fi
-if [ ! "`echo "$usrlst_userid" | grep '^\*'`" ]; then
-echo -e "#### ERROR ####\n USER ID field incorrect! Missing leading *\n"
-usrlst_userid="$(echo "*"$usrlst_userid"")"
-usrlst_errors="$(expr "$usrlst_errors" + 1)"
-fi
-
-# check if 3rd colum is 1 2 or 3 (levels)
-usrlst_level="$(echo "$usrlst_entry" | cut -d' ' -f3)"
-if [ ! "`echo "$usrlst_level" | grep '^[0-3]$'`" ]; then
-echo -e "#### ERROR ####\n USER Access level field incorrect! Using 1...\n"
-usrlst_level="1"
-usrlst_errors="$(expr "$usrlst_errors" + 1)"
-fi
-
-# check if 4th column is an integer (times bot saw user)
-usrlst_seen="$(echo "$usrlst_entry" | cut -d' ' -f4)"
-unset testinteger
-testinteger="$(expr "$usrlst_seen" - "0" 2>/dev/null)"
-if [ -z "$testinteger" ]; then
-echo -e "#### ERROR ####\n Number of times seen field is not an integer! \
-Fixing it...\n"
-usrlst_seen="0"
-usrlst_errors="$(expr "$usrlst_errors" + 1)"
-fi
-
-# check if 5th column is password
-usrlst_pass="$(echo "$usrlst_entry" | cut -d' ' -f5)"
-if [ -z "$usrlst_pass" ]; then
-echo -e "#### ERROR ####\n Missing password field! Using password 0...\n"
-usrlst_pass="0"
-usrlst_errors="$(expr "$usrlst_errors" + 1)"
-fi
-
-# check if 6th column is 0 or setinfo
-usrlst_setinfo="$(echo "$usrlst_entry" | cut -d' ' -f6-)"
-if [ -z "$usrlst_setinfo" ]; then
-echo -e "#### ERROR ####\n Missing SETINFO field! Using 0...\n"
-usrlst_setinfo="0"
-usrlst_errors="$(expr "$usrlst_errors" + 1)"
-fi
-
-usrlst_new=""$usrlst_chan" "$usrlst_userid""$usrlst_ip" "$usrlst_level" \
-"$usrlst_seen" "$usrlst_pass" "$usrlst_setinfo""
-
-echo "$usrlst_new" >> $TMP-USERLIST.DB
-
-if [ "$usrlst_errors" -gt "$usrlst_errors_b4" ]; then
-echo -e "Corrected entry:"
-echo "----" >> $TMP-USERLIST_DB.rep.body0
-echo "$usrlst_entry" >> $TMP-USERLIST_DB.rep.body0
-echo "$usrlst_new" | tee -a $TMP-USERLIST_DB.rep.body0
-SLEEP 4
-fi
-
-else # no @ on IP
-echo -e "#### ERROR ####\n Unable to obtain IP. Entry is being removed...\n"
-echo "$usrlst_entry" >> $TMP-USERLIST_DB.rep.body1
-usrlst_removed="$(expr "$usrlst_removed" + 1)"
-SLEEP 4
-fi
-
-usrlst_errors_b4="$usrlst_errors"
-
-done
-usrlst_uniq_errors="$(expr "`cat $TMP-USERLIST_DB.rep.body0 2>/dev/null | wc -l | tr -cd '[:alnum:]'`" / 3)"
-
-# if no $TMP-USERLIST.DB means all entries were irrecoverable/wrong / missing @
-if [ ! -s $TMP-USERLIST.DB ]; then
-touch $TMP-USERLIST.DB
-no_entries=y # since file is 0 just a var to avoid 2nd round of dup check
-fi
-mv -f $TMP-USERLIST.DB $TMP-DB.WORK.FILE
-
-# REPORT
-# start gathering results
-# get/accumulate results from 1st passage of DUP_ENTRIES
-if [ -s $TMP.dup.entries ]; then
-dupentries_lines_1="$dupentries_lines"
-dupentries_lin_rem_1="$dupentries_lin_rem"
-cat $TMP.dup.entries >> $TMP.dup.entries_1
-fi
-# checking dup entries again if/after changes
-if [ -z "$no_entries" ]; then
-if [ "$usrlst_uniq_errors" -gt "0" ] || [ "$usrlst_removed" -gt "0" ]; then
-clear
-echo -e "$PNCI* userlist.db file *\n
-Doing a quick check for duplicate entries again on "$ORIG_FILE" after
-syntax changes made"
-SLEEP 2
-DUP_ENTRIES
-fi
-fi
-
-# get total entries after changes
-numLinesUSERLIST_after=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-error_s="$(if [ "$usrlst_errors" -gt "1" ]; then echo errors; else echo error; fi)"
-entry_s="$(if [ "$usrlst_uniq_errors" -gt "1" ]; then echo entries; else echo entry; fi)"
-clear
-echo -e "$PNCI* userlist.db file *\n"
-echo "userlist.db file contents" > $TMP-USERLIST_DB.rep.head
-echo "- Total entries before checking: "$numLinesUSERLIST_ORI" \
-After: "$numLinesUSERLIST_after""| tee -a $TMP-USERLIST_DB.rep.head
-
-if [ "$usrlst_uniq_errors" -gt "0" ] || [ "$usrlst_removed" -gt "0" ]; then
-if [ "$usrlst_uniq_errors" -gt "0" ]; then
-echo "- Corrected a total of "$usrlst_errors" "$error_s" on \
-"$usrlst_uniq_errors" "$entry_s"."
-fi
-if [ -s $TMP-USERLIST_DB.rep.body0 ]; then
-echo -e "===== Fixed userlist.db errors
-(first entry on each section corresponds to the one with errors)
-`cat $TMP-USERLIST_DB.rep.body0`
-_______________________ end of fixed userlist.db entries \
-_______________________" > $TMP-USERLIST_DB.rep.body
-fi
-if [ "$usrlst_removed" -gt "0" ]; then
-echo "- Removed entries due to missing or irrecoverable IP: "$usrlst_removed""
-echo -e "-=-=- Removed entries from userlist.db due to irrecoverable IP
-`cat $TMP-USERLIST_DB.rep.body1`
-_______________________ end of removed userlist.db entries \
-_______________________" >> $TMP-USERLIST_DB.rep.body
-fi
-
-else
-echo "- No syntax errors found."
-fi | tee -a $TMP-USERLIST_DB.rep.head
-
-# dup_entries
-if [ -s $TMP.dup.entries ]; then
-dupentries_lines="$(expr "$dupentries_lines" + "$dupentries_lines_1")"
-dupentries_lin_rem="$(expr "$dupentries_lin_rem" + "$dupentries_lin_rem_1")"
-dupentries_lin_rem="$(expr "$dupentries_lin_rem" + "$dupentries_lin_rem_1")"
-cat $TMP.dup.entries >> $TMP.dup.entries_1
-
-echo "DUPLICATE ENTRIES on "$ORIG_FILE"
-- Number of entries with repetitions: "$dupentries_lines"
-- Number of repetitions found: "$dupentries_lin_rem"
-- Number of lines removed: "$dupentries_lin_rem"
- (Check section \"Removed DUPLICATE ENTRIES from $ORIG_FILE\" on this file)"
-echo -e "-=-=- Removed DUPLICATE ENTRIES from "$ORIG_FILE"" >> \
-$TMP-USERLIST_DB.rep.body
-cat $TMP.dup.entries_1 >> $TMP-USERLIST_DB.rep.body
-echo "_______________________ end of duplicate entries on "$ORIG_FILE"\
-________________________" >> $TMP-USERLIST_DB.rep.body
-CHANGED=""$CHANGED" "$ORIG_FILE""
-else
-
-echo "- No repeated entries found!"
-fi | tee -a $TMP-USERLIST_DB.rep.head
-rm -f $TMP.dup.entries
-rm -f $TMP-DUP_ENTRIES.$ORIG_FILE.rep.head
-rm -f $TMP-DUP_ENTRIES.$ORIG_FILE.rep.body
-SLEEP 3
-# end of dup_entries report
-
-if [ "$usrlst_uniq_errors" -gt "0" ] || [ "$usrlst_removed" -gt "0" ]; then
-CHANGED=""$CHANGED" "$ORIG_FILE""
-fi
-SLEEP 4
-}
-
-# NOT IMPLEMENTED YET
-REMOVE_PREMADE_DBS () {
-echo $null
-}
-
-## END OF MAIN FUNCTIONS ##
-###########################
-
-###########
-## FILES ##
-################ PREP AND START
-FILES_PREP () {
-clear
-echo -e "$PNCI\n-- Preparing $ORIG_FILE file --\n\nUsing $ORIG_FILE in a safe
-temporary working file..."
-SLEEP 1
-
-if [ ! -s $ORIG_PATH ]; then
-touch $ORIG_PATH
- if [ "$ORIG_PATH" = "../dat/userlist.db" ]; then
-echo "#channel *user_ident@*user.ip.net 1 0 password_here \
-You need to !setinfo" >> "$ORIG_PATH"
- fi
-fi
-
-# copy orig file to working file
-cp -f $ORIG_PATH $TMP-DB.WORK.FILE
-
-if [ "$external_db" = "DB_MASTER" ]; then
-numLinesDB_MASTER=$(cat $COMMON_TMP/TMP-DB_MASTER | wc -l | tr -cd '[:alnum:]')
-echo -e "\nMoving downloaded database to the info2.db working file..."
-cat $COMMON_TMP/TMP-DB_MASTER >> $TMP-DB.WORK.FILE
-info2db_lines="$(if [ "$numLines_info2_ORI" = "0" ]; then
-echo "info2.db empty file."; else
-echo "initial "$numLines_info2_ORI" info2.db lines,\nmaking a total of \
-`expr "$numLinesDB_MASTER" + "$numLines_info2_ORI"` entries to be checked."; fi)"
-echo -e "\n"$numLinesDB_MASTER" new entries added to your "$info2db_lines""
-CHANGED=""$CHANGED" "$ORIG_FILE""
-SLEEP 4
-fi
-
-numLinesORI=$(cat $TMP-DB.WORK.FILE | wc -l | tr -cd '[:alnum:]')
-SLEEP 3
-}
-
-# files start
-START_INFO2 () {
-ORIG_FILE="info2.db"
-ORIG_PATH="../dat/info2.db"
-numLines_info2_ORI=$(cat $ORIG_PATH 2>/dev/null | wc -l | tr -cd '[:alnum:]')
-sleep 2
-# if file is not empty ...
-if [ "$numLines_info2_ORI" != "0" ] || [ -n "$external_db" ]; then
-FILES_PREP
-LINE_FEED; EMPTY_LINES; INCOMPL_ENTRIES; DUP_ENTRIES; DUP_TOPICS
-TOPIC_SIZE; DATA_SIZE; CHECK_RDBS
- if echo "$CHANGED" | grep -q info2.db 1>/dev/null; then
- mv -f $TMP-DB.WORK.FILE $TMP-INFO2.DB
- fi
-else # if is empty
-clear
-echo -e "$PNCI\ninfo2.db file is empty. There is no need to check it!
-Add topics and replies to it so your Darkbot could "talk".\n"
-SLEEP 3
-fi
-
-}
-START_SERVERS () {
-ORIG_FILE="servers.ini"
-ORIG_PATH="../dat/servers.ini"
-numLinesORI=$(cat $ORIG_PATH 2>/dev/null | wc -l | tr -cd '[:alnum:]')
-# if file is not empty ...
-if [ "$numLinesORI" != "0" ]; then
-FILES_PREP
-LINE_FEED; EMPTY_LINES;
-SERVERS_INI
- if echo "$CHANGED" | grep -q servers.ini 1>/dev/null; then
- mv -f $TMP-DB.WORK.FILE $TMP-SERVERS.INI
- fi
-else # if is empty
-clear
-echo -e "$PNCI\nservers.ini file is empty. There is no need to check it!
-You'll need to add servers so your Darkbot can connect to IRC.\n"
-SLEEP 3
-fi
-}
-START_SETUP () {
-ORIG_FILE="setup.ini"
-ORIG_PATH="../dat/setup.ini"
-numLinesORI=$(cat $ORIG_PATH 2>/dev/null | wc -l | tr -cd '[:alnum:]')
-FILES_PREP
-LINE_FEED; EMPTY_LINES;
-SETUP_INI
-if echo "$CHANGED" | grep -q setup.ini 1>/dev/null; then
-mv -f $TMP-DB.WORK.FILE $TMP-SETUP.INI
-fi
-}
-START_PERFORM () {
-ORIG_FILE="perform.ini"
-ORIG_PATH="../dat/perform.ini"
-numLinesORI=$(cat $ORIG_PATH 2>/dev/null | wc -l | tr -cd '[:alnum:]')
-# if file is not empty ...
-if [ "$numLinesORI" != "0" ]; then
-FILES_PREP
-LINE_FEED; EMPTY_LINES
-if echo "$CHANGED" | grep -q perform.ini 1>/dev/null; then
-mv -f $TMP-DB.WORK.FILE $TMP-PERFORM.INI
-fi
-else # if is empty
-clear
-echo -e "$PNCI\nperform.ini file is empty. There is no need to check it!\n"
-SLEEP 3
-fi
-}
-START_USERLIST () {
-ORIG_FILE="userlist.db"
-ORIG_PATH="../dat/userlist.db"
-numLinesUSERLIST_ORI="$(cat $ORIG_PATH 2>/dev/null | wc -l | tr -cd '[:alnum:]')"
-numLinesORI="$numLinesUSERLIST_ORI"
-# if file is not empty ...
-if [ "$numLinesORI" != "0" ]; then
-FILES_PREP
-LINE_FEED; EMPTY_LINES; DUP_ENTRIES
-USERLIST_DB
-if echo "$CHANGED" | grep -q userlist.db 1>/dev/null; then
-mv -f $TMP-DB.WORK.FILE $TMP-USERLIST.DB
-fi
-else # if is empty
-clear
-echo -e "$PNCI\nuserlist.db file is empty. There is no need to check it!
-Use AddUser to add yourself as Darkbot administrator."
-SLEEP 3
-fi
-}
-START_RANDOM () {
-RANDOM_FILES
-}
-## END OF FILES PREP AND START ##
-#################################
-
-####################
-## UPDATE PROCESS ##
-FILES_BACKUP () {
-# backup file
-clear
-echo -e "$PNCI\n- ORIGINAL FILES UPDATE -\n"
-if [ -s "$2" ]; then
-echo -e "Backing up your current "$1" before updating it \
-with the changes made...\n"
-cp -fp "$2".bak.1 "$2".bak.2 2>/dev/null
-cp -fp "$2".bak.0 "$2".bak.1 2>/dev/null
-mv -f "$2" "$2".bak.0
-echo "Your most current $ORIG_FILE backup is "$2".bak.0"
-if [ -e "$2".bak.1 ]; then
-echo "You still have a previous backup on "$2".bak.1"
-fi
-if [ -e "$2".bak.2 ]; then
-echo "and an older one as "$2".bak.2"
-fi
-fi
-SLEEP 3
-}
-
-FILES_UPDATE () {
-if [ -n "$CHANGED" ]; then
-count=10; counter=1
-while [ $count != "$counter" ]; do
-count=`expr "$count" - 1`
-clear
-echo -e "$PNCI\n- ORIGINAL FILES UPDATE -\n
-The changes made will be effectively updated now.
-If you do not want those changes to be saved to the original files press
-CTRL + C now to abort.\n
-The update process will start in ["$count"] seconds...\n"
-SLEEP 1
-done
-
-no_changes () {
-#if echo $ci_files | grep $1; then
-if [ ! -s $TMP-no.changes ]; then
-echo -e "clear\necho \"$PNCI\n- ORIGINAL FILES UPDATE -\n\"" > $TMP-no.changes
-fi
-if echo "$ci_files" | grep -i `echo "$1" | cut -d. -f1`; then
-echo -e "echo \"No changes made on your $1 $2.\"
-SLEEP 1" >> $TMP-no.changes
-fi
-}
-
-if [ -s $TMP-INFO2.DB ]; then
-FILES_BACKUP info2.db ../dat/info2.db
-echo -e "\nMoving working file to ../dat/info2.db ...\n"
-mv -f $TMP-INFO2.DB ../dat/info2.db
-SLEEP 1
-else
-no_changes info2.db file
-fi
-
-if [ -s $TMP-SERVERS.INI ]; then
-FILES_BACKUP servers.ini ../dat/servers.ini
-echo -e "\nMoving working file to ../dat/servers.ini ...\n"
-mv -f $TMP-SERVERS.INI ../dat/servers.ini
-SLEEP 1
-else
-no_changes servers.ini file
-fi
-
-if [ -s $TMP-SETUP.INI ]; then
-FILES_BACKUP setup.ini ../dat/setup.ini
-echo -e "\nMoving working file to ../dat/setup.ini ...\n"
-mv -f $TMP-SETUP.INI ../dat/setup.ini
-SLEEP 2
-else
-no_changes setup.ini file
-fi
-
-if [ -s $TMP-PERFORM.INI ]; then
-FILES_BACKUP perform.ini ../dat/perform.ini
-echo -e "\nMoving working file to ../dat/perform.ini ...\n"
-mv -f $TMP-PERFORM.INI ../dat/perform.ini
-SLEEP 2
-else
-no_changes perform.ini file
-fi
-
-if [ -f $TMP-USERLIST.DB ]; then
-FILES_BACKUP userlist.db ../dat/userlist.db
-echo -e "\nMoving working file to ../dat/userlist.db ...\n"
-mv -f $TMP-USERLIST.DB ../dat/userlist.db
-SLEEP 2
-else
-no_changes userlist.db file
-fi
-
-if [ -s $TMP-RANDOM_FILES ]; then
-# do some cosmetic work on the file for backups, only on these random files
-echo -e "clear\n echo -e \"$PNCI\n- ORIGINAL FILES UPDATE -\n\"" > $TMP-RANDOM_FILES_TMP
-cat $TMP-RANDOM_FILES >> $TMP-RANDOM_FILES_TMP
-mv -f $TMP-RANDOM_FILES_TMP $TMP-RANDOM_FILES
-echo "SLEEP 1" >> $TMP-RANDOM_FILES
-# go for it
-echo -e "\nMoving random files to dat directory...\n"
-. $TMP-RANDOM_FILES
-SLEEP 2
-else
-no_changes random files
-fi
-
-# execute no changes messages
-if [ -s $TMP-no.changes ]; then
-. $TMP-no.changes
-fi
-
-fi # end of count down to update changes
-SLEEP 4
-}
-
-## END OF UPDATE PROCESS ##
-###########################
-
-############
-## REPORT ##
-INTEGRITY_REPORT () {
-if [ -s $ci_report ]; then
-cp -fp $ci_report $ci_report.old
-fi
-_head_separator_ () {
-echo "----------------------------------\
----------------------------------------" >> $ci_report
-}
-_head_entry_ () {
-cat $1 >> $ci_report 2>/dev/null
-}
-# obtain numb of lines after process done
-echo -e "$PNCI* Integrity Check Report File *
- Generated on `date`
-=========================================================================
-| SUMMARY |
-================================== ==================================" \
-> $ci_report
-_head_separator_
-info2LinesFinal=$(cat ../dat/info2.db 2>/dev/null | wc -l | tr -cd '[:alnum:]')
-echo "TOTAL LINES/ENTRIES on info2.db: \
-Before = "$numLines_info2_ORI" Now = "$info2LinesFinal"\
-`if [ "$line_feed" = "y" ]; then echo -e "\n(There is one \
-additional line due to an added line feed)"; fi`" >> $ci_report
-_head_entry_ $TMP-LINE_FEED.info2.db.rep.head
-_head_entry_ $TMP-EMPTY_LINES.info2.db.rep.head
-_head_entry_ $TMP-INCOMPL_ENTRIES.rep.head
-_head_entry_ $TMP-DUP_ENTRIES.info2.db.rep.head
-_head_entry_ $TMP-DUP_TOPICS.rep.head
-_head_entry_ $TMP-TOPIC_SIZE.rep.head
-_head_entry_ $TMP-DATA_SIZE.rep.head
-_head_entry_ $TMP-CHECK_RDBS.rep.head
-_head_separator_ # end of info2.db
-_head_entry_ $TMP-RANDOM_FILES.rep.head
-_head_separator_ # servers.ini
-_head_entry_ $TMP-SERVERS_INI.rep.head
-_head_entry_ $TMP-LINE_FEED.servers.ini.rep.head
-_head_entry_ $TMP-EMPTY_LINES.servers.ini.rep.head
-_head_separator_ # setup.ini
-_head_entry_ $TMP-SETUP_INI.rep.head
-_head_entry_ $TMP-LINE_FEED.setup.ini.rep.head
-_head_entry_ $TMP-EMPTY_LINES.setup.ini.rep.head
-_head_separator_ # perform.ini
-_head_entry_ $TMP-LINE_FEED.perform.ini.rep.head
-_head_entry_ $TMP-EMPTY_LINES.perform.ini.rep.head
-_head_separator_ # userlist.db
-_head_entry_ $TMP-USERLIST_DB.rep.head
-_head_entry_ $TMP-LINE_FEED.userlist.db.rep.head
-_head_entry_ $TMP-EMPTY_LINES.userlist.db.rep.head
-_head_separator_
-echo "
-=========================================================================
-| MODIFICATIONS |
-================================== ==================================
-" >> $ci_report
-_body_entry_ () {
-cat $1 >> $ci_report 2>/dev/null
-}
-_body_separator_ () {
-echo "" >> $ci_report
-}
-_body_entry_ $TMP-INCOMPL_ENTRIES.rep.body
-_body_separator_
-_body_entry_ $TMP-DUP_ENTRIES.info2.db.rep.body
-_body_separator_
-_body_entry_ $TMP-DUP_TOPICS.rep.body
-_body_separator_
-_body_entry_ $TMP-TOPIC_SIZE.rep.body
-_body_separator_
-_body_entry_ $TMP-DATA_SIZE.rep.body
-_body_separator_
-_body_entry_ $TMP-CHECK_RDBS.rep.body
-_body_separator_
-_body_entry_ $TMP-SETUP_INI.rep.body
-_body_separator_
-_body_entry_ $TMP-USERLIST_DB.rep.body
-
-}
-## END OF REPORT ##
-###################
-
-CI_LOG_VARS () {
-if [ ! -s "$ci_vars" ]; then
-touch $ci_vars
-fi
-
-if [ "$1" = "topicsize" ]; then
-unset TOPIC_SIZE
-while [ -z "$TOPIC_SIZE" ]; do
-clear
-echo -e "$PNCI\n - CHANGING TOPIC LENGTH VALUE -\n\n"
-echo -n "Enter the topic length to be set for this utility
-(Default value for topic length is 50 characters): "
-read topic_size
-
-unset testinteger
-testinteger="$(expr "$topic_size" - "0" 2>/dev/null)"
-if [ ! -z "$testinteger" ]; then
-TOPIC_SIZE="$topic_size"
-
-if [ "`grep 'TOPIC_SIZE' $ci_vars`" ]; then
-grep -v 'TOPIC_SIZE' $ci_vars > $TMP
-cat $TMP > $ci_vars
-fi
-echo "TOPIC_SIZE=\"$TOPIC_SIZE\"" >> $ci_vars
-
-echo -e "\nAdded value of "$topic_size" for maximum topic length!\n
-This value MUST be the same as the one given on defines.h
-when Darkbot was configured.
-[ To remove this setting type $0 -default ]\n"
-else
-echo -e "\n#### ERROR ####\nPlease enter an integer [0-9]"
-sleep 2
-fi
-done
-SLEEP 4
-fi
-
-if [ "$1" = "replysize" ]; then
-unset DATA_SIZE
-while [ -z "$DATA_SIZE" ]; do
-clear
-echo -e "$PNCI\n - CHANGING REPLY LENGTH VALUE -\n\n"
-echo -n "Enter the reply length to be set for this utility
-(Default value for reply length is 400 characters): "
-read reply_size
-
-unset testinteger
-testinteger="$(expr "$reply_size" - "0" 2>/dev/null)"
-if [ ! -z "$testinteger" ]; then
-DATA_SIZE="$reply_size"
-
-if [ "`grep 'DATA_SIZE' $ci_vars`" ]; then
-grep -v 'DATA_SIZE' $ci_vars > $TMP
-cat $TMP > $ci_vars
-fi
-echo "DATA_SIZE=\"$DATA_SIZE\"" >> $ci_vars
-
-echo -e "\nAdded value of "$reply_size" for maximum reply length!\n
-This value MUST be the same as the one given on defines.h
-when Darkbot was configured.
-[ To remove this setting type $0 -default ]\n"
-else
-echo -e "\n#### ERROR ####\nPlease enter an integer [0-9]"
-sleep 2
-fi
-done
-SLEEP 4
-fi
-
-if [ "$1" = "nointro" ]; then
-ci_intro_OnOff=off
-if [ "`grep 'ci_intro_OnOff' $ci_vars`" ]; then
-grep -v 'ci_intro_OnOff' "$ci_vars" > $TMP
-cat $TMP > $ci_vars
-fi
-echo "ci_intro_OnOff=\"$ci_intro_OnOff\"" >> $ci_vars
-clear
-echo -e "$PNCI\n - INTRODUCTION TEXT -\n\n
-Introduction is now turned off\n
-[ To remove this setting type $0 -default ]\n"
-SLEEP 4
-fi
-}
-
-CI_INTRO_START () {
-if [ ! `echo "$ci_arg" | grep 'nointro' 2>/dev/null` ]; then # \
- if [ ! `echo "$ci_intro_OnOff" | grep 'off' 2>/dev/null` ]; then
- if [ ! `echo "$ci_switches" | grep 'quick' 2>/dev/null` ]; then
- CI_INTRO
- fi
- fi
-fi
-}
-
-# ------------------------ START UTILITY ------------------------ #
-###########
-## START ##
-
-#DB_SCRIPTS_PATH;
-ENVIRONMENT; TESTDEPEND_GO
-
-ci_files= ci_switches=
-for ci_arg
-do
- case "$ci_arg" in
- -*) ci_switches="$ci_switches $ci_arg" ;;
- *) ci_files="$ci_files $ci_arg" ;;
- esac
-done
-
-# not in use but left here for future consid.
-case "$ci_files" in
-#"") USAGE 1>&2 ;;
-"") $null 1>&2 ;;
-*) for file in $ci_files
- do
- CI_INTRO_START
- done
- stat=0
- ;;
-esac
-
-if [ -z "$ci_files" ] && [ -z "$ci_switches" ]; then
-USAGE
-fi
-
-# ----- SWITCHES -----
-# help __
-if echo "$ci_switches" | grep -qi 'h' 1>/dev/null; then
-USAGE
-fi
-# default __
-if echo "$ci_switches" | grep -qi 'default' 1>/dev/null; then
-rm -f "$ci_vars"
-fi
-# SLEEP function __
-if echo "$ci_switches" | grep -qi 'quick' 1>/dev/null; then
-# bypasses or not 'sleep' (pause) periods -- syntax= SLEEP 3
-SLEEP () { SLEEP=$($null); }
-# if wants quick there is no reason for intro, so... bypass INTRO
-else
-SLEEP () { SLEEP=$(sleep $1); }
-fi
-# bypasses introduction __
-if echo "$ci_switches" | grep -qi 'nointro' 1>/dev/null; then
-CI_LOG_VARS nointro
-#else
-#if [ "$ci_intro_OnOff" != "off" ]; then CI_INTRO; fi
-fi
-# show report __
-if echo "$ci_switches" | grep -qi 'report' 1>/dev/null; then
- if [ -s $ci_report ]; then
- cat $ci_report | less -deXF
- else
- echo -e "$PNCI\n\nThere is no report file registered\n"
- fi
-fi
-# topic length __
-if echo "$ci_switches" | grep -qi 'topicsize' 1>/dev/null; then
-CI_LOG_VARS topicsize
-fi
-# reply length __
-if echo "$ci_switches" | grep -qi 'replysize' 1>/dev/null; then
-CI_LOG_VARS replysize
-fi
-
-# ----- FILES -----
-# do all
-if echo "$ci_files" | grep -qi "all" 1>/dev/null; then
-START_INFO2
-START_SERVERS
-START_SETUP
-START_PERFORM
-START_USERLIST
-START_RANDOM
-fi
-
-# info2.db
-if echo "$ci_files" | grep -qi 'info2' 1>/dev/null; then
-START_INFO2
-fi
-# servers.ini
-if echo "$ci_files" | grep -qi 'servers' 1>/dev/null; then
-START_SERVERS
-fi
-# setup.ini
-if echo "$ci_files" | grep -qi 'setup' 1>/dev/null; then
-START_SETUP
-fi
-# perform.ini
-if echo "$ci_files" | grep -qi 'perform' 1>/dev/null; then
-START_PERFORM
-fi
-# userlist.db
-if echo "$ci_files" | grep -qi 'userlist' 1>/dev/null; then
-START_USERLIST
-fi
-# random.ini
-if echo "$ci_files" | grep -qi 'random' 1>/dev/null; then
-START_RANDOM
-fi
-# external databases
-if echo "$ci_files" | grep -qi 'DB_MASTER' 1>/dev/null; then
-external_db="DB_MASTER"
-START_INFO2
-fi
-# remove dbs ###### NOT IMPLEMENTED YET ######
-if echo "$ci_files" | grep -qi 'remove dbs' 1>/dev/null; then
- # go to dd and use remove function
-./download-databases
- # do a pre check on info2
-START_INFO2
-REMOVE_PREMADE_DBS # add selected dbs to the end of info2 with a mark; run a
- # dup entries function for this only where uniques and dups
- # are removed; check at the end entries left after the mark
- # meaning they didn't have any match ( just for info); do
- # counts at the end | add actions to report
-fi
-
-# ____________________ FINAL ____________________
-if [ -n "$CHANGED" ]; then
-FILES_UPDATE
-INTEGRITY_REPORT
-echo -e "\nA file `pwd`/$ci_report was created
-with the result of all actions taken during this process.
-You can see it by typing $0 -report"
-# rm empty lines
-
-# clean empty
-grep '.' $ci_report > $TMP-ci_report
-mv -f $TMP-ci_report $ci_report
-
-else # no changes made to any file
-clear
-echo -e "$PNCI\n"
- if [ ! -z "$ci_files" ]; then
- echo -e "\nNo changes were made to your files!\n"
- fi
-fi
-
- if [ ! -z "$ci_files" ]; then
- if echo "$ci_files" | grep -qi 'DB_MASTER' 1>/dev/null; then
- ci_files_0="info2.db with downloaded and installed pre-made database"
- else
- file_s="$( if [ "`echo "$ci_files" | wc -w | tr -cd '[:alnum:]'`" -gt "1" ] \
- || `echo "$ci_files" | grep -qi 'random'`; then \
- echo files; else echo file; fi)"
-
- ci_files_0="$(echo "$ci_files" | sed -e s/[[:space:]]/''-''/g)"
- fi
- echo -e "\n Data integrity check process on
- "[$ci_files_0-]" "$file_s" complete.\n"
- fi
-
-SLEEP 3
-exit 0
diff --git a/beta/scripts/dbcron b/beta/scripts/dbcron
deleted file mode 100755
index 0c438dd..0000000
--- a/beta/scripts/dbcron
+++ /dev/null
@@ -1,142 +0,0 @@
-#! /bin/sh
-PID=0624233000
-# Darkbot utility to auto generate crontab.
-# Just run this script and a new one with the same name will be created
-# with the actual path of your Darkbot installation. At the same time
-# a crontab job will be created with 10 mins interval.
-
-# to do: user defined timers on command line utility launch
-
-MAKE_DBCRON () {
-cat > dbcron << EOF[DBCRON]
-#! /bin/sh
-# Darkbot's crontab utility
-
-DBPATH="$DBPATH" # your darkbot directory
-DBBIN="$DBBIN" # Darkbot's binary (executable) file
-DBPIDFILE="$DBBIN.pid" # process ID file (same as binary + .pid)
-
-# This file was automatically generated the first time you've run dbcron.
-# If for any reason you've changed your Darkbot directory or it's binary
-# you'll need to modify the variables DBPATH DBBIN and DBPIDFILE on top of
-# this file accordingly to the actual values.
-# Defaulty crontab job is of 10 mins interval. If you wish to change it
-# edit '0,10,20,30,40,50 * * * *'. If you don't understand it type 'man crontab'
-# -----------------------------------------------------------------------------
-# What this script does:
-# Changes to darkbot root dir; if pid file exists extracts pid number;
-# tests it by issuing an inoffensive kill; if pid is active exits, doing
-# nothing; if not means the file with pid is there but there is no active
-# process, so removes it. finally cheks if program bin exists then starts it.
-# ____________ Do not change anything bellow this line! ____________#
-cd \$DBPATH
-if test -r \$DBPATH/\$DBPIDFILE; then
- DBPID=\$(cat \$DBPATH/\$DBPIDFILE)
- if \$(kill -CHLD \$DBPID >/dev/null 2>&1)
- then
- exit 0
- fi
- echo -e "\nstale pid file (erasing it)"
- rm -f \$DBPATH/\$DBPIDFILE
-fi
-echo -e "\nDarkbot is dead! Restarting . . . . . . . .\n"
-if test -x \$DBBIN ;then
- \$DBPATH/\$DBBIN
- exit 0
-fi
-echo "could not reload"
-EOF[DBCRON]
-}
-
-# PREP SCRIPT
-
-# check if it is on the right place
-ABORT () {
-echo -e "\nThis utility will stop now!\n\nLeav\
-ing $0...\n\n\n"; sleep 1; exit 0
-}
-DB_SCRIPTS_PATH () {
-dirutil="scripts"
-filutil="`basename $0`"
-# check if dir is correct
-if ! echo `pwd` | grep -q "\/"$dirutil""; then
-# file is not being launched from $dirutil
- if [ -d "$dirutil" ]; then # dir is there
- # if file is not in the correct dir
- if [ ! "`ls "$dirutil" | grep "$filutil"`" ]; then
- # file is not in the correct dir so move it
-clear
-echo -e "$PNCI\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory.\n"
-echo "Moving it now...."
-sleep 2
-cat > db_wrong_path << EOF[WP]
-mv -f $0 "$dirutil"/
-cd "$dirutil"/
-echo -e "\n| Your "$filutil" is now located in your "$dirutil" directory |
- | Launch it from there when necessary |\n\n"
-sleep 4
-$0
-rm -f ../db_wrong_path
-exit 0
-EOF[WP]
-. db_wrong_path
- else # file is in dir so just cd
-cd "$dirutil"/
- fi
- else # dir is not there so don't bother - tell user to move it
-clear
-echo -e "$PNCI\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory and launched from there or Darkbot's root.
-Please move it and launch it again."
-sleep 3
-ABORT
- fi
-fi
-}
-#DB_SCRIPTS_PATH
-
-# check if crontab is present if not there is no reason to run this script
-if ! type crontab >/dev/null 2>&1 ; then
-echo -e "\nThis script needs 'crontab' command to run, which appears it's \
-not installed on this system.
-Leaving..."
-exit 0
-fi
-
-#check if crond is active
-if [ ! "$(ps ax | grep -v grep | grep crond 2>/dev/null)" ]; then
-echo -e "\nThis script needs 'crond' running, which appears it's \
-not on this system.
-Leaving..."
-fi
-
-# dbcron engine creation. make vars for darkbot path, dir and pid file
-DBPATH=$(cd ..; pwd)
-if [ -x "$DBPATH/darkbot" ]; then
-DBBIN="darkbot"
-DBPIDFILE=$DBBIN.pid
-
-# vars are done so let's tell crontab how we want it setup
-# check every 10 minutes; send messages to null
-# echo '0,10,20,30,40,50 * * * *' "$DBPATH/scripts/dbcron" > crontable.$$ #debug only
-echo '0,10,20,30,40,50 * * * *' "$DBPATH/scripts/dbcron >/dev/null 2>&1" >> crontable.$$
-crontab crontable.$$; rm -f crontable.$$
-
-# transfer crontab engine file with new vars on top to a new file with same
-# name as this one. THIS FILE CONTENTS WILL BE GONE!
- MAKE_DBCRON
- clear
-echo -e "\n\nDarkbot crontab utility\n\nCrontab job created successfully!
-To check if everything is okay, kill your bot if it is connected to IRC.
-It should automatically restart in 10 minutes.\n
-Suggestions, improvements?
-Support: http://forum.freezedown.org\n\n"
-else
-echo -e "\nDarkbot's Crontab Utility.
-WARNING!!!!\nDarkbot's binary not found.
-Please run ./configure if you haven't do so or restore \
-file names to it's default values.\n
-Leaving $0..."
-exit 0
-fi
diff --git a/beta/scripts/download-databases b/beta/scripts/download-databases
deleted file mode 100755
index 68fff80..0000000
--- a/beta/scripts/download-databases
+++ /dev/null
@@ -1,384 +0,0 @@
-#!/bin/sh
-PNDD="Darkbot's pre-made Databases Utility\n<****************_~_****************>\n"
-PID=0624233000
-
-# todo -- download tars as of live-update instead of *.db
-# removal of pre-made databases (in conjunction w/check-integrity)
-
-ABORT () {
-echo -e "\nThis utility will stop now!\n\nLeav\
-ing $PN...\n\n\n"; sleep 1; exit 0
-}
-
-DB_SCRIPTS_PATH () {
-dirutil="scripts"
-filutil="`basename $0`"
-# check if dir is correct
-if ! echo `pwd` | grep -q "\/"$dirutil""; then
-# file is not being launched from $dirutil
- if [ -d "$dirutil" ]; then # dir is there
- # if file is not in the correct dir
- if [ ! "`ls "$dirutil" | grep "$filutil"`" ]; then
- # file is not in the correct dir so move it
-clear
-echo -e "$PNCI\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory.\n"
-echo "Moving it now...."
-sleep 2
-cat > db_wrong_path << EOF[WP]
-mv -f $0 "$dirutil"/
-cd "$dirutil"/
-echo -e "\n| Your "$filutil" is now located in your "$dirutil" directory |
- | Launch it from there when necessary |\n\n"
-sleep 4
-$0
-rm -f ../db_wrong_path
-exit 0
-EOF[WP]
-. db_wrong_path
- else # file is in dir so just cd
-cd "$dirutil"/
- fi
- else # dir is not there so don't bother - tell user to move it
-clear
-echo -e "$PNCI\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory and launched from there or Darkbot's root.
-Please move it and launch it again."
-sleep 3
-ABORT
- fi
-fi
-}
-#DB_SCRIPTS_PATH
-
-ENVIRONMENT () {
-BASE_WORKDIR=.scriptutils
-COMMON_TMP=$BASE_WORKDIR/tmp
-mkdir -p $BASE_WORKDIR/tmp
-DDDIR=$BASE_WORKDIR/dldatabases
-TMP=$BASE_WORKDIR/._tmp/ddat$$
-mkdir -p $BASE_WORKDIR/._tmp/
-DD_LOGFILE=$BASE_WORKDIR/.dbs_status
-cp -f $DD_LOGFILE $TMP-DBS_STATUS 2>/dev/null
-trap 'rm -f $TMP* >/dev/null; rm -fr $BASE_WORKDIR/._* >/dev/null 2>&1' 0
-m_trap="echo -e \n\n -- `basename $0` terminated by `whoami` --\n\n"
-trap '$m_trap 1>&2; exit' 1 2 3 13 15
-}
-
-# test dependencies
-TESTDEPEND () {
-NonFatalError () {
-echo "FATAL ERROR at $0 (`date`): $FiLe not detected \
-on this system." >> $BASE_WORKDIR/error_messages
-clear
-echo -e "$PNDD\nFATAL ERROR at $0 (`date`)\n\n
-$FiLe not detected on this system.
-It is essential for $0 to work properly."
-ABORT
-}
-if ! (type "$1" 1>/dev/null 2>&1); then
-FiLe="$1"
-NonFatalError $1
-sleep 1; unset $FiLe
-fi
-}
-TESTDEPEND_GO () {
-TESTDEPEND "grep"; TESTDEPEND "sed"; TESTDEPEND "cut"
-TESTDEPEND "wc"; TESTDEPEND "cat"; TESTDEPEND "expr"
-}
-
-# test dependencies which can have optional programs and set vars for those.
-TESTDEPEND_SUBST () {
-# test lynx/wget
-if (type "lynx" 1>/dev/null 2>&1); then
-dld_prg="lynx"
- else
- if (type "wget" 1>/dev/null 2>&1); then
- dld_prg="wget"
- fi
-fi
-if [ -z "$dld_prg" ]; then
-echo -e "FATAL ERROR at $0 (`date`): lynx and wget not detected \
-on this system. One it's necessary for this utility to work \
-properly" >> $BASE_WORKDIR/error_messages
-clear
-echo -e "$PN\nFATAL ERROR at $0 (`date`)\n\n
-Either lynx or wget are essential for $0 to work properly.
-None of those programs were found on this system"
-ABORT
-fi
-}
-
-# download command line to parse redirection url
-GET_SERVER_URLS () {
-if [ "$dld_prg" = "lynx" ]; then
-lynx -source http://www.freezedown.org 2>/dev/null > $TMP
-else
-wget -qO $TMP http://www.freezedown.org
-fi
-# parse redir. main url. ex: http://pincel.net/darkbot/
-REDIRECT_URL_MAIN=$(grep "FRAME SRC" $TMP | cut -d\" -f2)
-# redirection url for dbs. ex: http://pincel.net/darkbot/arquive/databases/
-REDIRECT_URL_DBS=""$REDIRECT_URL_MAIN"archive/databases"
-if [ ! -s $TMP ]; then
-clear
-echo -e "$PNDD\nWARNING\n
-Unable to establish connection with the server."
-ABORT; fi
-}
-
-# get dbs info text
-# download command line to parse redirection url
-GET_DBS_INFO () {
-if [ "$dld_prg" = "lynx" ]; then
-lynx -dump -nolist "$REDIRECT_URL_MAIN"databases.html > $TMP-db.txt
-else
-wget -qO $TMP-db.txt "$REDIRECT_URL_MAIN"databases.html
-fi
-if ! grep -qwi "Pre-made" $TMP-db.txt 2>/dev/null; then
-clear
-echo -e "$PNDD\nWARNING\n
-Unable to obtain from the server essential information."
-ABORT; fi
-}
-
-# get vars -- Database=acro2
-GET_DBS_VARS () {
-if [ "$dld_prg" = "lynx" ]; then
-cat $TMP-db.txt | sed -ne /Elaborated/s/[[:blank:]]*/Database=/p \
-| cut -d ' ' -f1 | cut -d. -f1 > $TMP.db.vars
-else
-sed -ne /zip[\<a*]/s/[[:blank:]]*/Database=/p $TMP-db.txt \
-| cut -d. -f1 > $TMP.db.vars
-fi
-}
-
-# download status; evaluate user activity; check if any new database
-# register activity in local file
-DBS_STATUS () {
-rm -f $TMP-DISPLAY # refresh list
-numLines="$(cat $TMP.db.vars | wc -l | sed s/[[:blank:]]*//)"
-count="0"
-while [ "$count" != "$numLines" ]; do
-count=`expr $count + 1`
-sed -n "$count"p $TMP.db.vars > $TMP.db.var
-unset Database
-. $TMP.db.var
-# get complete local line if exists and put it on a file list
-grep -w "$Database" $TMP-DBS_STATUS 2>/dev/null > $TMP.db.loc.var
-# check the status and put the result on an organized list to display
-if [ -s $TMP.db.loc.var ]; then
- if grep -w "{D}" $TMP.db.loc.var 1>/dev/null; then
- echo "[$count] {D} $Database -`cat $TMP.db.loc.var | cut -d- -f2`" >> $TMP-DISPLAY; fi
- if grep "{I}" $TMP.db.loc.var 1>/dev/null; then
- echo "[$count] {I} $Database" >> $TMP-DISPLAY; fi
- if grep "{x}" $TMP.db.loc.var 1>/dev/null; then
- echo "[$count] {x} $Database -`cat $TMP.db.loc.var | cut -d- -f2`" >> $TMP-DISPLAY; fi
-else
-echo "[$count] {A} $Database" >> $TMP-DISPLAY
-fi
-done
-# prep file to be used on live-update
-cat $TMP-DISPLAY | grep -w "{A}" | cut -d\} -f2 > $COMMON_TMP/.dbs_available
-} # end of DBS_STATUS
-
-DBS_STATUS_FINAL () {
-# move all new dbs status to local status file
-rm -f $DD_LOGFILE
-# extract all but {A} without list number
-cut -d' ' -f2- $TMP-DISPLAY | grep -v "{A}" > $TMP-DISPLAY1
-# extract {I} and add to local
-grep "{I}" $TMP-DISPLAY1 >> $DD_LOGFILE
-# extract old {D} and add to local
-grep "{D}" $TMP-DISPLAY1 >> $DD_LOGFILE
-# move newly download entries to local
-cat $TMP-DISPLAY2 2>/dev/null >> $DD_LOGFILE
-}
-
-# MENU and DOWNLOAD
-DBS_MENU_DLD () {
-while [ -z $LEAVENOW ]; do
-DBS_STATUS
-clear
-# menu
-# start by listing dbs by number and corresponding db, ex: 1 acro2.db
-echo -e "$PNDD\nAvailable Databases:
-( {A}=Available {D}=Downloaded {I}=Ignored {x}=Marked for Installation )
-`#cut -d= -f2 $TMP.db.vars | cat -b`
-`cat $TMP-DISPLAY`
-------------------------------------
- [I] Ignore databases
-`if [ "$dld_prg" = "lynx" ]; then echo -e " [R] Read Databases information"; fi`
- [Q] Quit "$Quit_txt"" | less -deXF
-echo -n "
-Please make your choice. To select databases write their corresponding
-numbers, separated by spaces or commas, ie, 1,2,5 or 1 2 5: "
- read CHOICE
-# outputs 1 2 3 etc corresponding to database number or I/X
-
-# dbs to be ignored
-_DBS_IGNORE () {
-clear
-echo -e "$PNDD\nIgnore Databases\n
-This feature is only useful when $0 is being used
-during live-update process so the utility will not prompt for available
-pre-made databases on non wanted files.\n"
-echo -n "Enter the number corresponding to the database to be ignored
-or write 'ALL' to mark all {A}vailable databases as {I}gnored: "
-read CHOICE_I
-
-# mark all ignored
-if echo "$CHOICE_I" | grep -qwi all 1>/dev/null; then
-sed s/{A}/{I}/g $TMP-DISPLAY > $TMP
-cat $TMP | cut -d' ' -f2- > $TMP-DBS_STATUS
-fi
-
-# if choice is a number
-sed -n "$CHOICE_I"p $TMP.db.vars 2>/dev/null > $TMP.db.vari
-. $TMP.db.vari
-
-#check if it is marked other way than {A}. (for {D} or {x})
-if [ "$CHOICE_I" != "all" ] || [ "$CHOICE_I" != "uuu" ] ; then
-grep -wi "$Database" $TMP-DISPLAY > $TMP
-if grep -qwi "{D}" $TMP 2>/dev/null; then
-echo -e "\nDatabase $Database is marked as {D}ownloaded!\n"; sleep 2
-elif grep -qwi "{x}" $TMP; then
-echo -e "\nDatabase $Database is {x} marked for installation!\n"; sleep 2
-else # is marked as {A} so {I}gnore
-echo "{I} $Database" >> $TMP-DBS_STATUS
-fi
-fi # if not all or uuu
-} # end of _DBS_IGNORE (Ignore options)
-if echo $CHOICE | grep -qwi i 1>/dev/null; then _DBS_IGNORE; fi
-
-# [r]ead info about the files
-if echo $CHOICE | grep -qwi r 1>/dev/null; then
-clear
-echo -e "$PNDD\nAvailable database files information\n
-`grep Elaborated $TMP-db.txt | less -deX`
-\nPress ENTER to continue"
-read PTR
-fi
-
-# [q]uits databases utility and start integrity check in case there is any {x}
-if echo $CHOICE | grep -qwi q 1>/dev/null; then
- # check if $TMP-DISPLAY2 exists (created if there is any {x}download)
- if [ ! -s $TMP-DISPLAY2 ]; then # no files to download so log other changes
- DBS_STATUS_FINAL
- fi
-LEAVENOW=end
-fi
-
-DB_SELECT_DLD () {
-# check how many lines on the remote list
-numLines="$(cat $TMP.db.vars | wc -l | sed s/[[:blank:]]*//)"
-
-# set max = total number/lines
-max="$numLines"; count="0"
-
-while [ $count != $max ]; do
-count=`expr $count + 1`
-# if CHOICE is between the range of num lines/items to choose
-if (echo $CHOICE | grep -qw "$count" 1>/dev/null); then
-# extract corresponding line from vars file
-sed -n "$count"p $TMP.db.vars > $TMP.db.var
-# then extracs var itself, ie Database=whatever
-. $TMP.db.var
-
-DLD_PRG_COMMLINE4 () {
-clear; echo -e "\n$PNDD\n
-\n* ========== > Downloading $Database pre-made database > > > >\n\nPlease wait..."
-if [ "$dld_prg" = "lynx" ]; then
-lynx -source "$REDIRECT_URL_DBS/$Database".db >> $TMP-DB_MASTER
-else
-wget -qO $TMP-DB_MASTER "$REDIRECT_URL_DBS"/"$Database".db
-fi
-# add database to log file
-echo "{x} $Database - (marked for installation)" >> $TMP-DBS_STATUS
-# prepare log entry in case the process finishes
-echo "{D} $Database - `date +%D`" >> $TMP-DISPLAY2
-# just a var for QUIT text
-Quit_txt="and proceed with check integrity and final installation."
-}
-
-# check if it was ignored
-if grep -w "$Database" $TMP-DBS_STATUS 2>/dev/null | grep -qw "{I}"; then
-clear
-echo -e "$PNDD\n
-Removing [I]gnored status from "$Database"..."
-sleep 2
-grep -wv $Database $TMP-DBS_STATUS > $TMP
-cat $TMP > $TMP-DBS_STATUS
-fi
-# check if it was downloaded already
-if grep -w "$Database" $TMP-DBS_STATUS 2>/dev/null | grep -qw "{D}"; then
-clear
-echo -e "$PNDD\n
-Looks like you have already downloaded database
-`grep -w "$Database" $TMP-DBS_STATUS`.\n"
-echo -n "Download it again? [(y)es or (n)o]: "
-unset yesno1
-read yesno1
-case $yesno1 in
-y* | Y*)
-input1=y;;
-n* | N*)
-input1=n;;
-esac
-
-# if Y remove from list; download
-if [ "$input1" = "y" ]; then
-grep -wv $Database $TMP-DBS_STATUS > $TMP
-cat $TMP > $TMP-DBS_STATUS
-DLD_PRG_COMMLINE4
-fi
-
-else # means is a 1st download
-DLD_PRG_COMMLINE4
-fi # end of if database is in status list
-
-fi
-done
-} # end DB_SELECT_DLD
-DB_SELECT_DLD
-
-done
-} # DBS_MENU_DLD
-
-DBS_FINALS () {
-if [ -s $TMP-DB_MASTER ]; then
-DBS_STATUS_FINAL
-if [ -s check-integrity ]; then
-cat $TMP-DB_MASTER > $COMMON_TMP/TMP-DB_MASTER
-./check-integrity DB_MASTER
-else
-if [ -s ../dat/external_databases ]; then
-mv -f ../dat/external_databases ../dat/external_databases.old
-fi
-cat $TMP-DB_MASTER > ../dat/external_databases
-clear
-echo -e ""$PNDD"\nDownloaded database is now at ../dat/external_databases\n
-Move it to your info2.db file by writing
-cat external_databases >> info2.db\n\n"
-fi
-fi
-}
-
-if [ "$1" = "-s" ]; then
-ENVIRONMENT
-TESTDEPEND_GO
-TESTDEPEND_SUBST
-GET_SERVER_URLS
-GET_DBS_INFO
-GET_DBS_VARS
-DBS_STATUS
-else
-ENVIRONMENT
-TESTDEPEND_GO
-TESTDEPEND_SUBST
-GET_SERVER_URLS
-GET_DBS_INFO
-GET_DBS_VARS
-DBS_MENU_DLD
-DBS_FINALS
-fi
diff --git a/beta/scripts/kill.darkbot b/beta/scripts/kill.darkbot
deleted file mode 100755
index 546becc..0000000
--- a/beta/scripts/kill.darkbot
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-# Kills darkbot.pid process.
-
-kill -9 `cat ../darkbot.pid`
diff --git a/beta/scripts/live-update b/beta/scripts/live-update
deleted file mode 100755
index 4dac75f..0000000
--- a/beta/scripts/live-update
+++ /dev/null
@@ -1,552 +0,0 @@
-#!/bin/sh
-PNLU="Darkbot Live-Update"
-PN2="
-$PNLU
-<*******_~_*******>
-"
-PID=0624233000
-
-USAGE () {
- echo -e >&2 "\n$PNLU - Updates Darkbot program.\n
- This program basically does the following: checks directory and file
- integrity; contacts Darkbot site and downloads latest information;
- compares recent information with the one installed; updates local
- installation if necessary or display messages from the developers.\n
- Usage: <program> -[option]
- "$0" (with no option/flag) executes the program
- "$0" -u Undo last changes
- "$0" -n News - (latest news, usually related to updates)
- "$0" -v (v0, v1, v2) Verbose mode. [currently - `if [ "$verbose" = "" ]; then echo "1"; else echo "$verbose"; fi`] *
- "$0" -h Help information (this one)
- "$0" -o "$PNLU" execution ON/OFF [currently `if [ "$livupd_OnOff" != "OFF" ]; then echo "ON"; else echo "OFF"; fi`] *\n
- * - By switching this utility OFF you'll not be able to
- receive live updates from Darkbot's site.
- * - Settings for verbose: 0=stealth/silent; 1=minimal messages (default,
- no prompts if no updates present); 2=all available messages\n
- Support: http://forum.freezedown.org\n"
-exit 1
-}
-
-ABORT () {
-echo -e "\nThis utility will stop now!\n\nLeav\
-ing $PNLU...\n\n\n"; sleep 1; exit 0
-}
-
-DB_SCRIPTS_PATH () {
-dirutil="scripts"
-filutil="`basename $0`"
-# check if dir is correct
-if ! echo `pwd` | grep -q "\/"$dirutil""; then
-# file is not being launched from $dirutil
- if [ -d "$dirutil" ]; then # dir is there
- # if file is not in the correct dir
- if [ ! "`ls "$dirutil" | grep "$filutil"`" ]; then
- # file is not in the correct dir so move it
-clear
-echo -e "$PNCI\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory.\n"
-echo "Moving it now...."
-sleep 2
-cat > db_wrong_path << EOF[WP]
-mv -f $0 "$dirutil"/
-cd "$dirutil"/
-echo -e "\n| Your "$filutil" is now located in your "$dirutil" directory |
- | Launch it from there when necessary |\n\n"
-sleep 4
-$0
-rm -f ../db_wrong_path
-exit 0
-EOF[WP]
-. db_wrong_path
- else # file is in dir so just cd
-cd "$dirutil"/
- fi
- else # dir is not there so don't bother - tell user to move it
-clear
-echo -e "$PNCI\n\n##### WARNING #####\n\n"$filutil" must be located \
-in "$dirutil" directory and launched from there or Darkbot's root.
-Please move it and launch it again."
-sleep 3
-ABORT
- fi
-fi
-}
-#DB_SCRIPTS_PATH
-
-ENVIRONMENT () {
-# set environment dirs and vars
-BASE_WORKDIR=.scriptutils
-COMMON_TMP=$BASE_WORKDIR/tmp
-mkdir -p $BASE_WORKDIR/tmp
-LUDIR=$BASE_WORKDIR/liveupdate
-TMP=$LUDIR/._tmp/lu$$
-mkdir -p $LUDIR/._tmp/
-if [ -e "$LUDIR/.l_vars" ]; then
-. "$LUDIR/.l_vars"; fi
-trap 'rm -fr $COMMON_TMP >/dev/null; rm -fr $TMP* >/dev/null; \
-rm -fr $LUDIR/._* >/dev/null 2>&1' 0
-m_trap="echo -e \n\n -- `basename $0` terminated by `whoami` --\n\n"
-trap '$m_trap 1>&2; exit' 1 2 3 13 15
-}
-
-# test dependencies
-TESTDEPEND () {
-NonFatalError () {
-echo "FATAL ERROR at $0 (`date`): $FiLe not detected \
-on this system." >> $BASE_WORKDIR/error_messages
-clear
-echo -e "$PNLU\nFATAL ERROR at $0 (`date`)\n\n
-$FiLe not detected on this system.
-It is essential for $0 to work properly."
-ABORT
-}
-if ! (type "$1" 1>/dev/null 2>&1); then
-FiLe="$1"
-NonFatalError $1
-sleep 1; unset $FiLe
-fi
-}
-TESTDEPEND_GO () {
-TESTDEPEND "grep"; TESTDEPEND "sed"; TESTDEPEND "cut"; TESTDEPEND "tar"
-TESTDEPEND "wc"; TESTDEPEND "cat"; TESTDEPEND "expr"; TESTDEPEND "head"
-
-}
-TESTDEPEND_GO
-
-# test dependencies which can have optional programs and set vars for those.
-TESTDEPEND_SUBST () {
-# test lynx/wget
-if (type "lynx" 1>/dev/null 2>&1); then
-dld_prg="lynx"
- else
- if (type "wget" 1>/dev/null 2>&1); then
- dld_prg="wget"
- fi
-fi
-if [ -z "$dld_prg" ]; then
-echo -e "FATAL ERROR at $0 (`date`): lynx and wget not detected \
-on this system. One it's necessary for this utility to work \
-properly" >> $BASE_WORKDIR/error_messages
-clear
-echo -e "$PNLU\nFATAL ERROR at $0 (`date`)\n\n
-Either lynx or wget are essential for $0 to work properly.
-None of those programs were found on this system"
-ABORT
-fi
-}
-TESTDEPEND_SUBST
-
-YESNO() {
-# usage -- YESNO "question..?"
-# if [ "$YESNO_ANSWER" = "n" -o "$YESNO_ANSWER" = "N" ]; then echo no; fi
-# y/n function - Returns: 0 (true) = yes; 1 (false) = no
-YESNO_DFLT=y # Set default: -y = yes; -n = no; otherwise no default
-# options & args
-for YESNO_OPT do
-case "$YESNO_OPT" in
- -[yY]*) YESNO_DFLT='y' ;;
- -[nN]*) YESNO_DFLT='n' ;;
- --) shift; break ;;
- -*) ;;
- *) break
-esac
-shift
-done
-YESNO_PROMPT="$*"
-# get the response
-while : ; do
-echo -n "$YESNO_PROMPT (y/n)?${YESNO_DFLT:+ [$YESNO_DFLT]} " >&2
-read YESNO_ANSWER YESNO_JUNK
-: ${YESNO_ANSWER:=$YESNO_DFLT}
-case "$YESNO_ANSWER" in
-[yY]*)
-#echo "YES ANSWER"
-return 0
-;;
-[nN]*)
-#echo "NO ANSWER"
-return 1
-;;
-*)
-clear
-echo -e "$PN2\n\nERROR: invalid entry!\n
- PLEASE press ENTER or type Y (Yes) to proceed or N (No) or CTRL+C to abort.
- ..." >&2
-esac
-done
-return
-}
-
-###### LOGS ######
-LOG_VARS () {
-echo "livupd_OnOff=\"$livupd_OnOff\"" > $LUDIR/.l_vars
-echo "WarnOnOff=\"$WarnOnOff\"" >> $LUDIR/.l_vars
-echo "verbose=\"$verbose\"" >> $LUDIR/.l_vars
-echo "l_livupdID=\"$livupdID\"" >> $LUDIR/.l_vars
-echo "loc_Revision=\"$Revision\"" >> $LUDIR/.l_vars
-echo "prev_Revision=\"$l_version\"" >> $LUDIR/.l_vars
-echo "LastUpdate=\"`date`\"" >> $LUDIR/.l_vars
-echo "l_db_dir=\"$l_db_dir\"" >> $LUDIR/.l_vars
-}
-LOG_NEWS () {
-if [ -z "$TMP-livupd" ]; then
-echo "No NEWS available from last update." > $LUDIR/.l_news
-else
-. $TMP-livupd -n > $LUDIR/.l_news
-fi
-}
-
-INTEGRITY () {
-if [ -d "../source" ]; then
- if [ "`ls -l ../source 2>/dev/null | grep '[ch]$'`" != "" ]; then
- l_sourceDir="../source"; dat="../dat"; docs="../docs"; scripts="../scripts"
- l_db_dir=`pwd | cut -d/ -f4`
- else
- clear
- echo -e "$PN2\n\nWARNING!!!!\n\n No source files found!\n"
- ABORT
- fi
-else
- if [ -e "../darkbot.c" ]; then
- l_sourceDir=".."; dat="../dat"; docs="../docs"; scripts="../scripts"
- l_db_dir=`pwd | cut -d/ -f4`
- else
- clear
- echo -e "$PN2\n\nWARNING!!!!\n\n No source files found!\n"
- ABORT
- fi
-fi #source exists
-}
-
-REMOTE1 () {
-# download command line
-DLD_PRG_COMMLINE () {
-updater="http://updater.darkbot.info"
-#updater="http://192.168.1.10/ongoing/.livupd"
-if [ "$dld_prg" = "lynx" ]; then
-lynx -source "$updater" > $TMP-livupd
-else
-wget -qO $TMP-livupd "$updater"
-fi
-}
-#get remote updater
-if [ "$verbose" = "2" ]; then clear
-echo -e "$PN2\n
- Contacting Darkbot site.\n\n
- Please wait..."
-sleep 3
-else 1>&2; fi
-trymax="3"; trycount="0"
-while [ "$trycount" != "$trymax" ] && [ ! -s $TMP-livupd ]; do
-trycount=`expr $trycount + 1`
-########################################################
-DLD_PRG_COMMLINE
-#cp -f .livupd $TMP-livupd # debug only
-done
-if [ "$verbose" = "2" ]; then clear
-echo -e "$PN2\n
- Connection with Darkbot site established.
- Retrieving the most recent information...\n
- Please wait"
-sleep 3
-else 1>&2
-fi
-}
-
-CHECK_PREMADE_DBS () {
-# check for pre-made databases
-if [ "$check_pre_made_dbs" != "complete" ]; then
-./download-databases -s
-if [ -s $COMMON_TMP/.dbs_available ]; then
-rm -f $COMMON_TMP/.dbs_available
-clear
-echo -e "$PN2\n
-Detected pre-made databases available for download!\n\n"
-YESNO " Run pre-made databases download utility?
-
-[ ENTER or Y (Yes); N (No) or CTRL+C to abort ]"
-if [ "$YESNO_ANSWER" = "n" -o "$YESNO_ANSWER" = "N" ]; then
-clear
-echo -e "$PN2\nIf you want to avoid $0 detecting available databases
-select 'I' on ./download-databases to ignore them.\n
-Bypassing pre-made databases download utility...\n
-[ Hit ENTER to continue ]\n"
-read PTR
-else
-echo -e "\nPlease wait..."; sleep 1
- ./download-databases
-echo -e "Pre-made databases check complete!\n\n"
-sleep 3
-check_pre_made_dbs=complete
-fi
-fi
-fi
-} # end of check/pre-made databases
-
-REMOTE2 () {
-if [ "$verbose" = "2" ]; then clear
-echo -e "$PN2\n
- Information with latest updates received.
- Comparing local information with the current one from the site...\n
- Please wait"
-sleep 3
-else 1>&2
-fi
-# change local id vars so remote ones will not colide
-# check remote vars
-. $TMP-livupd -cvars 2>/dev/null
-if [ ! -z "$livupdID" ]; then
-# remote file id not null so proceed
- if [ "$l_livupdID" != "$livupdID" ]; then
- # local file id != same as remote one so there's something new
- if [ ! -z "$loc_Revision" ]; then
- if [ "$loc_Revision" != "$Revision" ]; then
- # local revision != same as remote so there is a new program release
- if [ "$verbose" != "0" ]; then clear
- echo -e "$PN2\n
- New Release Update detected!\n
- You have Darkbot $loc_Revision installed.
- Most recent release is Darkbot $Revision.\n\n"
- YESNO " Read information about it?
- [ENTER or Y (Yes) to read it or N (No) not to. CTRL+C aborts]"
- if [ "$YESNO_ANSWER" != "n" ]; then
- if [ "$YESNO_ANSWER" != "N" ]; then
- # display news
- . $TMP-livupd -n
- YESNO "
-..............
- Proceed?
-
- [ ENTER or Y (Yes) to proceed; N (No) or CTRL+C to abort ]"
- if [ "$YESNO_ANSWER" = "n" -o "$YESNO_ANSWER" = "N" ]; then ABORT; fi
- fi
- fi # yes/no answer is no
- else 1>&2; fi # verbose = 0
- # run remote updater
- . $TMP-livupd -s
- else
- if [ "$loc_Revision" = "$Revision" ]; then
- if [ "$verbose" != "0" ]; then clear; echo -e "$PN2\n
- You are running Darkbot "$Revision", latest release."
- sleep 1
- else 1>&2; fi
- fi
- # local revision is the same as remote but still there's something new
- # first display news then run optional updater; this optional script can
- # also have small updates or non source ones, like new database
- if [ "$verbose" != "0" ]; then #clear
- echo -e "\n There are some NEWS from Darkbot's developers
- regarding your Darkbot $loc_Revision!\n"
- YESNO " Read it?
- [ ENTER or Y (Yes) to proceed; N (No) or CTRL+C to abort ]"
- if [ "$YESNO_ANSWER" = "n" -o "$YESNO_ANSWER" = "N" ]; then ABORT; fi
- else 1>&2; fi # verbose = 0
- . $TMP-livupd -n
- . $TMP-livupd -o
- LOG_VARS
- LOG_NEWS
- fi
- else # missing local revision
- if [ "$verbose" = "2" ]; then clear
- echo -e "$PN2\n
- Unable to obtain local revision ID
- Most probably due to misplaced or adulterated source files.\n"
- ABORT
- else 1>&2; fi
- fi
- else # files ids are the same
- if [ "$verbose" = "2" ]; then clear
- echo -e "$PN2\n
- No news or updates available!\n\n
- Leaving $PNLU..."
- echo -e "\n\n"
- sleep 3
- else 1>&2; fi
- exit 0
- fi
-else # no remote file id present so we didn't get the file or arrived corrupted
-if [ "$verbose" = "2" ]; then clear
- echo -e "$PN2\n
- Unable to compare information at this time.
- most probably due to misplaced source files or adulterated version.\n
- Leaving $0...\n"
-sleep 3
-else 1>&2; fi
-exit 0
-fi
-}
-
-###### STARTING & LIVE-UPDATE SETTINGS ######
-VERBOSE () {
-if [ ! -z "$1" ]; then # means choice is 0, 1 or 2
-if [ "$verbose" != "$1" ]; then
-verbose="$1"
-LOG_VARS
-fi
-clear
-echo -e "$PN2\n\n Switch value on $PNLU for verbose mode is now [\
-`if [ "$verbose" = "" ]; then echo "1"; else echo "$verbose"; fi`] \n"
-if [ "$verbose" = "0" ]; then
- echo -e " which means, NO $PNLU program messages will be shown.
- Recommended setting is 1 (minimal display of messages).\n
- NOTE: have in mind, by deactivating \""$PNLU"\" functioning
- messages you'd might miss important information!\n"
-fi
-if [ "$verbose" = "1" ]; then
- echo -e " which means, MINIMAL but essential program messages will be shown.\n"
-fi
-if [ "$verbose" = "2" ]; then
- echo -e " which means, ALL program messages will be shown.\n"
-fi
-else clear # choice was v or V (var $1 null)
-echo -e "$PN2\n\n $PNLU verbose mode is currently on value [\
-`if [ "$verbose" = "" ]; then echo "1"; else echo "$verbose"; fi`] \n"
-fi
-echo -e " Possible options/values are:
- $0 -v Displays verbose status.
- $0 -v0 Turns all messages off. (stealth mode - Not recommendable)
- $0 -v1 Runs with essential messages. ( default - Recommended)
- $0 -v2 Runs with all available program messages.
- -------------------------------------------------
- * option 0 will not run the engine on the background and not all messages will
- be hidden, specially the ones involving the actual update process, because
- we want you to know what's going into your computer.\n\n"
-exit 1
-}
-
-LIVUPDONOFF () {
- if [ "$livupd_OnOff" = "ON" ] || [ -z "$livupd_OnOff" ]; then
- livupd_OnOff=OFF
- else
- livupd_OnOff=ON
- fi
- LOG_VARS
- clear
- echo -e "$PN2\n\nON/OFF program switch is now turned "$livupd_OnOff".\n"
- if [ "$livupd_OnOff" = "OFF" ]; then
- echo -e "NOTE: have in mind, by deactivating \""$PNLU"\"
- you'll not be able to receive live updates!\n\n"
- fi
- if [ "$livupd_OnOff" = "ON" ]; then
- echo -e " To run "$PNLU" just type $0\n\n"
- fi
- exit 1
-}
-WARNONOFF () {
- if [ "$WarnOnOff" = "ON" ] || [ -z "$WarnOnOff" ]; then
- WarnOnOff=OFF
- else
- WarnOnOff=ON
- fi
- LOG_VARS
- clear
- echo -e "$PN2\n\nON/OFF switch WARNING message is now turned "$WarnOnOff"\n"
- if [ "$WarnOnOff" = "OFF" ]; then
- echo -e "which means you can't receive live updates from Darkbot's site.\n
- **** It's recommendable reactivating it by writing $0 -o
- * You can see a short program usage help by typing $0 -h
- * If you don't want to see this warning again type $0 -W
- **************************************************\n\n"
- fi
-exit 1
-}
-
-#__________________________________________________________________
-### START ENGINE ###
-ENVIRONMENT
-# switches
-if [ "$1" = "-n" ] || [ "$1" = "-N" ]; then
- if [ -e "$LUDIR/.l_news" ]; then clear
- cat $LUDIR/.l_news | less -de; exit 1
- else clear
- echo -e "$PN2\n\n Sorry, no news available.\n\n"
- exit 1
- fi
-fi
-
-if [ "$1" = "-u" ] || [ "$1" = "-U" ]; then
- if [ -e "$LUDIR/.l_undo" ]; then
- clear
- echo -e "$PN2\n\n This operation will restore your Darkbot as it was \
- before latest
- update ($LastUpdate - Darkbot $prev_Revision -> $loc_Revision).
- All $PNLU settings will return to it's defaults.\n"
- YESNO " Are you sure you want to reverse your changes?
- [ ENTER or Y (Yes) to proceed; N (No) or CTRL+C to abort ]"
- if [ "$YESNO_ANSWER" = "n" -o "$YESNO_ANSWER" = "N" ]; then ABORT; fi
- tar -zxf $LUDIR/back.tar.gz -C $LUDIR
- . $LUDIR/.l_undo
- clear
- echo -e "$PN2\n\n Changes reversed to their previous state.\n
- $PNLU returned to it's default mode.\n\n"
- rm -fr $LUDIR
- exit 1
- else clear
- echo -e "$PN2\n\n Sorry, no UNDO CHANGES available.\n\n"
- if [ ! -z "$loc_Revision" ]; then
- echo -e " This utility was last used on $LastUpdate
- during Darkbot $prev_Revision to $loc_Revision live update.
- To see information about last update type $0 -n\n\n"; fi
- exit 1
- fi
-fi
-
-if [ "$1" = "-v" ] || [ "$1" = "-V" ]; then VERBOSE; fi
-if [ "$1" = "-v0" ]; then VERBOSE 0; fi
-if [ "$1" = "-v1" ]; then VERBOSE 1; fi
-if [ "$1" = "-v2" ]; then VERBOSE 2; fi
-if [ "$1" = "-h" ] || [ "$1" = "--h" ]; then clear; USAGE; fi
-if [ "$1" = "-o" ] || [ "$1" = "-O" ]; then LIVUPDONOFF; fi
-if [ "$1" = "-w" ] || [ "$1" = "-W" ]; then WARNONOFF; fi
-
-if [ -z "$livupd_OnOff" ] || [ "$livupd_OnOff" != "OFF" ]; then
-# if no vars present this is a first time
- if [ ! -e "$LUDIR/.l_vars" ]; then
- clear
- echo -e "$PN2\n
- Welcome to $PNLU engine.
- Looks like this is your first time running this utility
- (or you've reversed to it's defaults any previous changes).\n
- For help on $PNLU options exit and type $0 -h
- or press ENTER to proceed with update process.
- If there are no updates available this utility will exit with
- no messages.\n"
- YESNO " Proceed?
- [ ENTER or Y (Yes) to proceed; N (No) or CTRL+C to exit ]"
- if [ "$YESNO_ANSWER" = "n" -o "$YESNO_ANSWER" = "N" ]; then ABORT; fi
- fi
-INTEGRITY
- if [ ! -z "$l_sourceDir" ]; then
- REMOTE1
- if [ -s download-databases ]; then CHECK_PREMADE_DBS; fi
- fi
-
- # check if update file came
- if [ ! "`grep livupdID $TMP-livupd 2>/dev/null`" ]; then
- if [ "$verbose" = "2" ]; then clear
- echo -e "$PN2\n\nUnable to retrieve update information.
- Leaving....\n\n"
- else 1>&2
- fi
- exit 0
- fi
-
-if [ ! -z "$TMP-livupd" ]; then REMOTE2
-fi
-if [ "$remote_end" = "end" ]; then LOG_VARS; LOG_NEWS
-exit 0
-fi
-
-else # program is off by user choice so.. exit with a warning
- if [ -z "$WarnOnOff" ] || [ "$WarnOnOff" != "OFF" ]; then
- clear
- echo -e "$PN2\n\nWARNING\n
- $PNLU is inactive (OFF)
- which means you can't receive live updates from Darkbot's site.\n
- **** It's recommendable reactivating it by writing $0 -o
- * You can see a short program usage help by typing $0 -h
- * If you don't want to see this warning again type $0 -W
- **************************************************\n\n"
- fi
-fi
-exit 0
diff --git a/beta/scripts/restart.darkbot b/beta/scripts/restart.darkbot
deleted file mode 100755
index e416b3b..0000000
--- a/beta/scripts/restart.darkbot
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-# Restarts darkbot.pid process. (only for unix)
-
-kill -HUP `cat ../darkbot.pid`
diff --git a/beta/source/chan.c b/beta/source/chan.c
deleted file mode 100755
index 785ec26..0000000
--- a/beta/source/chan.c
+++ /dev/null
@@ -1,617 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-#ifdef ENABLE_MATH
-
-/* Changed input to be unsigned instead of signed. This
- * suppressed warning messages when compiling on Solaris.
- */
-
-void
-do_math (const char *who, char *target, char *math)
-{
- char number_string[STRING_SHORT] = { 0 };
- char op = 0;
- unsigned char input[STRING_SHORT] = { 0 };
- unsigned int index = 0;
- unsigned int to = 0;
- unsigned int input_length = 0;
- unsigned int number_length = 0;
- double result = 0.0;
- double number = 0.0;
-
- strncpy (input, math, sizeof (input));
- input_length = strlen (input);
- for (to = 0, index = 0; index <= input_length; index++)
- if (*(input + index) != ' ')
- *(input + to++) = *(input + index);
- input_length = strlen (input);
- index = 0;
- if (input[index] == '=')
- index++;
- else
- {
- number_length = 0;
- if (input[index] == '+' || input[index] == '-')
- *(number_string + number_length++) = *(input + index++);
- for (; isdigit (*(input + index)); index++)
- *(number_string + number_length++) = *(input + index);
- if (*(input + index) == '.')
- {
- *(number_string + number_length++) = *(input + index++);
- for (; isdigit (*(input + index)); index++)
- *(number_string + number_length++) = *(input + index);
- }
- *(number_string + number_length) = '\0';
- if (number_length > 0)
- result = atof (number_string);
- }
- for (; index < input_length;)
- {
- op = *(input + index++);
- number_length = 0;
- if (input[index] == '+' || input[index] == '-')
- *(number_string + number_length++) = *(input + index++);
- for (; isdigit (*(input + index)); index++)
- *(number_string + number_length++) = *(input + index);
- if (*(input + index) == '.')
- {
- *(number_string + number_length++) = *(input + index++);
- for (; isdigit (*(input + index)); index++)
- *(number_string + number_length++) = *(input + index);
- }
- *(number_string + number_length) = '\0';
- number = atof (number_string);
- switch (op)
- {
- case '+':
- result += number;
- break;
- case '-':
- result -= number;
- break;
- case '*':
- result *= number;
- break;
- case '/':
- if (number == 0)
- {
- L016 (target, who);
- return;
- }
- else
- result /= number;
- break;
- case '%':
- if ((long) number == 0)
- {
- L016 (target, who);
- return;
- }
- else
- result = (double) ((long) result % (long) number);
- break;
- default:
- L017 (target, who);
- return;
- }
- }
- S ("PRIVMSG %s :%s\2:\2 %f\n", target, who, result);
-}
-#endif
-
-long
-cf (char *host, char *nick, char *chan)
-{
- int f_n = 0;
-
- if (check_access (host, chan, 0, nick) >= 3)
- return 0;
- f_n = f_f (host);
- if (f_n == -1)
- {
- a_f (host);
- return 0;
- }
- if (ood[f_n].value)
- return 1;
- ood[f_n].count++;
- if ((time (NULL) - ood[f_n].time) > FT)
- ood[f_n].count = 0;
- else if ((time (NULL) - ood[f_n].time) <= FT && ood[f_n].count >= FR)
- {
- ood[f_n].value = true;
- if (!ood[f_n].kick)
- {
- ood[f_n].kick = 1;
- if (*chan == '#' || *chan == '&')
- {
-#ifdef ENABLE_CHANNEL
- if (FLOOD_KICK == true)
- L018 (chan, nick, FLOOD_REASON, fc, host);
- else
-#endif
- L019 (CHAN, fc, host);
- }
- else
- L019 (CHAN, fc, host);
- }
- return 1;
- }
- ood[f_n].time = time (NULL);
- return 0;
-}
-
-/**
- * Update a nick's channel greeting and user@host.
- * 6/23/00 Dan:
- * - All method arguments are now pointers to const data
- * - Rewrote to use a for loop, and fewer variables
- * - Info is only saved to disk if changes are made
- */
-void
-update_setinfo (const char *new_uh, const char *new_greetz, const char *nick)
-{
- struct helperlist *c = helperhead;
- bool madeChange = false;
- size_t i = 0;
-
- for (; c != NULL; c = c->next)
- {
- ++i;
- if (!match_wild (c->uh, new_uh) == 0)
- {
- strncpy (c->greetz, new_greetz, sizeof (c->greetz));
- strlwr (c->uh);
- L020 (nick, i, c->uh, new_greetz);
- madeChange = true;
- }
- }
- if (madeChange)
- {
- save_changes ();
- }
-}
-
-/**
- * 6/23/00 Dan:
- * - All variables now initialized when declared
- * - Altered variable types to reflect usage
- */
-void
-info (const char *source, char *target)
-{
- FILE *fp;
- clock_t starttime = 0;
- char b[STRING_LONG] = { 0 };
- size_t topics = 0, dup = 0;
- time_t t2time = 0, c_uptime = 0;
- char *ptr = NULL, *subj = NULL;
- char last[STRING_LONG] = { 0 };
- t2time = time (NULL);
- unlink (TMP_URL);
- starttime = clock ();
- fp = fopen (URL2, "r");
- if (NULL == fp)
- {
- L003 (source, URL2);
- return;
- }
- while (fgets (b, STRING_LONG, fp))
- {
- topics++;
- if (FIND_DUPS)
- {
- if(*b == '\n')
- continue;
-
- stripline (b);
- subj = strtok (b, " ");
- ptr = strtok (NULL, "");
- strlwr (subj);
- if (strcasecmp (last, subj) == 0)
- {
- dup++;
- if (SAVE_DUPS)
- db_log (BACKUP_DUP, "%s %s\n", subj, ptr);
- }
- else
- {
- db_log (TMP_URL, "%s %s\n", subj, ptr);
- }
- strncpy (last, subj, sizeof (last));
- last[sizeof (last) - 1] = '\0';
- }
- }
-
- fclose (fp);
- rename (TMP_URL, URL2);
- if ((FIND_DUPS) && (dup > 0))
- {
- L025 (target, dup);
- }
- c_uptime = time (NULL) - uptime;
- topics -= dup;
- if (c_uptime > 86400)
- {
- L026 (target,
- dbVersion,
- topics,
- c_uptime / 86400,
- (c_uptime / 86400 ==
- 1) ? "" : "s",
- (c_uptime / 3600) % 24,
- (c_uptime / 60) % 60, QUESTIONS,
- ADDITIONS, DELETIONS,
- (double) (clock () -
- starttime) /
- CLOCKS_PER_SEC, (((double) (clock () - starttime) / CLOCKS_PER_SEC) == 1) ? "" : "s");
- }
- else if (c_uptime > 3600)
- {
- L027 (target,
- dbVersion,
- topics,
- c_uptime / 3600,
- c_uptime / 3600 == 1 ? "" : "s",
- (c_uptime / 60) % 60,
- (c_uptime / 60) % 60 ==
- 1 ? "" : "s", QUESTIONS,
- ADDITIONS, DELETIONS,
- (double) (clock () -
- starttime) /
- CLOCKS_PER_SEC, (((double) (clock () - starttime) / CLOCKS_PER_SEC) == 1) ? "" : "s");
- }
- else
- {
- L028 (target,
- dbVersion,
- topics,
- c_uptime / 60,
- c_uptime / 60 == 1 ? "" : "s",
- c_uptime % 60,
- c_uptime % 60 == 1 ? "" : "s",
- QUESTIONS, ADDITIONS, DELETIONS,
- (double) (clock () - starttime) / CLOCKS_PER_SEC, (((double)
- (clock () -
- starttime) /
- CLOCKS_PER_SEC) == 1) ? "" : "s");
- }
-//#ifdef ENABLE_STATS
-// get_stats(target, NULL); */
-//#endif
-}
-
-/**
- * Output information about the bot's database to a target.
- * 6/22 Dan:
- * - Changed both method arguments to be pointers to const data,
- * this is a read only method.
- */
-void
-show_info2 (const char *target, const char *source, enum chanserv_invoke_type invoked)
-{
- S ("%s %s :%s, compiled on %s. "
- "I have processed %ld lines of text since startup...\n",
- (invoked == MSG_INVOKE) ? "NOTICE" : "PRIVMSG", target,
- source, __DATE__, NUMLINESSEEN);
-}
-
-/**
- * 6/23/00 Dan:
- * - All method arguments are now pointer to const
- * - Return type is now time_t
- * - A for loop is now used instead of a while loop
- */
-time_t
-return_useridle (const char *chan, const char *who, int toggle)
-{ /* toggle=0 is for idle time, toggle=1 is to check if user
- is in the chan */
- const struct userlist *c = userhead;
-
- for (; c != NULL; c = c->next)
- {
- if (!strcasecmp (who, c->nick) && !strcasecmp (chan, c->chan))
- {
- if (toggle == 1)
- {
- /* If we only care if user is present or not.. */
- return 1;
- }
- else
- return c->idle;
- } /* if */
- } /* for */
- return 0;
-}
-
-void
-process_nick (char *nick, char *newnick)
-{
- struct userlist *c;
-
- c = userhead;
- newnick++;
- while (c)
- {
- if (strcasecmp (nick, c->nick) == 0)
- {
- strncpy (c->nick, newnick, sizeof (c->nick));
- }
- c = c->next;
- }
-}
-
-/**
- * 6/23/00 Dan:
- * - All method arguments are now pointer to const
- * - A for loop is now used instead of a while loop
- */
-void
-show_chaninfo (const char *nick, const char *chan, const char *target)
-{
- size_t totalUsers = 0, foundUsers = 0;
- const struct userlist *c = userhead;
-
- for (; c != NULL; c = c->next)
- {
- ++totalUsers;
- if (!strcasecmp (chan, c->chan))
- ++foundUsers;
- }
- S ("PRIVMSG %s :%s, I see %d users in %s (%d users total in ram)\n",
- target, nick, foundUsers, chan, totalUsers);
-}
-
-/*
- * This function displays a list of users that are listed in the bot's internal user
- * list as being on the channel pointed to by chan, to the nick pointed to by nick.
- * Each message sent to the target should be no more than 200 characters in length.
- */
-
-void show_chanusers (const char *nick, const char *chan)
-{
- const struct userlist *c = userhead;
- char DATA [STRING_SHORT * 7] = {0},
- tmp [STRING_SHORT] = {0};
- size_t foundUsers = 0, len = 0;
-
- for (; c != NULL; c = c->next)
- {
- if (strcasecmp (chan, c->chan) == 0)
- {
- ++foundUsers;
-
-
- snprintf (tmp, sizeof (tmp), "%s", DATA);
-
- /* The check for DATA being NULL is done to prevent ugly looking spaces
- * at the beginning of the line when it's outputted.
- */
- snprintf (DATA, (sizeof (DATA) + sizeof (tmp)),
- "%s%s%s",
- tmp,
- (DATA == NULL ? "" : " "),
- c->nick);
-
- /* Add the length of the new nick and room for a space to the length
- * of the current buffer.
- */
-
- len += (strlen (c->nick) + 1);
-
- memset (tmp, 0, sizeof (tmp));
-
- if (len >= 200)
- {
- S ("NOTICE %s :%s\n", nick, DATA);
- len = 0;
- memset (DATA, 0, sizeof (DATA));
- db_sleep (2);
- }
- }
- }
-
- /* If there's any leftover data in our buffer after we've reached the end of the list,
- * send that as well.
- */
-
- if (len > 0)
- S ("NOTICE %s :%s\n", nick, DATA);
-
- /* Even if no users were found... */
-
- S ("NOTICE %s :End of CHANUSERS list; %d user%s found.\n",
- nick, foundUsers, (foundUsers == 1 ? "" : "s"));
-
-}
-
-void
-do_modes (char *source, char *data)
-{
- char *chan = NULL, *mode = NULL, *nick = NULL, *ptr = NULL;
- long PM = 0, j = 0, i = 0;
-
- chan = strtok (data, " ");
- mode = strtok (NULL, " ");
-
- if ((ptr = strchr (source, '!')) != NULL)
- *ptr++ = '\0';
- j = strlen (mode);
- i = -1; /* i needs to start at 0 */
- while (j > 0)
- {
- j--;
- i++;
- if (mode[i] == '+')
- PM = 1;
- if (mode[i] == '-')
- PM = 0;
- if (mode[i] == 'o')
- {
- nick = strtok (NULL, " ");
- do_op(nick, chan, PM); /* flag this member as having been (De)OP'd/ */
- continue;
- }
- if (mode[i] == 'v')
- { /* voice sucks, ignore it */
- nick = strtok (NULL, " ");
- continue;
- }
- if (mode[i] == 'k' || mode[i] == 'b')
- {
- nick = strtok (NULL, " ");
- if (nick[0] == '*' && nick[1] == '!')
- {
- nick += 2;
- }
- strlwr (nick);
- if (PM == 1)
- scan_chan_users (chan, source, nick);
- continue;
- }
- if (mode[i] == 'l' && PM == 1)
- { /* don't parse if -limit
- * since no parms */
- nick = strtok (NULL, " ");
- continue;
- }
- }
-
-}
-
-/**
- * do_quit
- *
- * Purpose:
- * 1) delete all instances when a nick matches (nick)
- * 2) delete all users off a given channel
- * 2) delete everything (i.e., when the bot is disconnected from irc)
- *
- * toggle 1 = delete user.
- * toggle 2 = delete chan
- * toggle 3 = everything (when I'm killed).
- */
-void
-do_quit (const char *nick, long toggle)
-{
- struct userlist *pNode = userhead;
- struct userlist *pPrev = NULL;
-
- if (toggle == 1)
- {
- /* delete user */
- while (pNode)
- {
- if (strcasecmp (pNode->nick, nick) == 0)
- {
- /* found a match, remove it */
- save_seen (pNode->nick, pNode->uh, pNode->chan);
- if (pPrev != NULL)
- {
- pPrev->next = pNode->next;
- free (pNode);
- pNode = pPrev->next;
- }
- else
- {
- /* first node in the list */
- userhead = pNode->next;
- free (pNode);
- pNode = userhead;
- }
- }
- else
- {
- /* No match, continue to next node */
- pPrev = pNode;
- pNode = pNode->next;
- }
- }
- }
- else if (toggle == 2)
- {
- /* delete channel */
- while (pNode)
- {
- if (strcasecmp (pNode->chan, nick) == 0)
- {
- /* found a match, remove it */
- save_seen (pNode->nick, pNode->uh, pNode->chan);
- if (pPrev != NULL)
- {
- pPrev->next = pNode->next;
- free (pNode);
- pNode = pPrev->next;
- }
- else
- {
- /* first node in the list */
- userhead = pNode->next;
- free (pNode);
- pNode = userhead;
- }
- }
- else
- {
- /* No match, continue to next node */
- pPrev = pNode;
- pNode = pNode->next;
- }
- }
- }
- else if (toggle == 3)
- {
- struct userlist *tempPtr = userhead;
-
- while (pNode)
- {
- tempPtr = pNode->next;
- free (pNode);
- pNode = tempPtr;
- }
- }
-}
-
-long
-f_f (char *host)
-{
- int i = 0;
-
- for (i = 0; i < fc; i++)
- if (!strcasecmp (ood[i].host, host))
- return i;
-
- return -1;
-}
-
-void
-a_f (char *host)
-{
- if (++fc > 100)
- fc = 0;
- fc--;
- strncpy (ood[fc].host, host, sizeof (ood[fc].host));
- ood[fc].time = time (NULL);
- ood[fc].count = 0;
- ood[fc].value = false;
- fc++;
-}
-
-void
-reset_ (void)
-{
- int i = 0;
-
- for (i = 0; i < fc; i++)
- {
- if (ood[i].value && (time (NULL) - ood[i].time) > rt)
- {
- ood[i].count = 0;
- ood[i].time = time (NULL);
- ood[i].value = false;
- ood[i].kick = 0;
- }
- }
-}
diff --git a/beta/source/chansrv.c b/beta/source/chansrv.c
deleted file mode 100755
index f297238..0000000
--- a/beta/source/chansrv.c
+++ /dev/null
@@ -1,2533 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-// FIXME: When the command is invoked in a channel, target is the channel name, otherwise target is the bots name?
-// Due to the original nature of this code, some of these routines assume the in channel case, others assume the /msg case.
-// Also check the commands that can have a channel argument work the same in and out of channel.
-
-enum chanserv_command_type
-{
- INFO_COMMAND = 0,
- SAFE_COMMAND = 1,
- NORMAL_COMMAND = 2,
- DANGER_COMMAND = 3,
- PASSWORD_COMMAND = 4
-};
-
-struct chanserv_command
-{
- enum chanserv_command_type type;
- int access;
- int arg_count;
- int too_many; /* Check for too many args */
- struct chanserv_output *(*func) (char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost);
- char *command[5];
- char *syntax;
- char *summary;
-};
-
-struct chanserv_output
-{
- char *output;
- struct chanserv_output *next;
-};
-
-struct chanserv_output *chanserv_show_help(char *cmd, int user_level);
-
-
-struct chanserv_output *chanserv_asprintf(struct chanserv_output *output, const char *format, ...)
-{
- struct chanserv_output *result = NULL;
- static char temp[BUFSIZ]; /* a temp buffer (8KB) */
- va_list list;
- int r;
-
- va_start(list, format);
- r = vsprintf(temp, format, list);
- va_end(list);
-
- if (r >= 0)
- {
- char *ptr;
-
- ptr = malloc(r + 1);
- if (ptr)
- {
- result = malloc(sizeof(struct chanserv_output));
- if (result)
- {
- strncpy(ptr, temp, r); /* copy at most n */
- ptr[r] = '\0'; /* ensure \0 at end */
-
- result->output = ptr;
- result->next = NULL;
- if (output)
- {
- struct chanserv_output *next = output;
-
- while (next->next)
- next = next->next;
- next->next = result;
- result = output;
- }
- }
- else
- free(ptr);
- }
-
- }
- if (result == NULL)
- {
- ;// FIXME: Should bitch about lack of ram.
- }
- return result;
-}
-
-void chanserv_output_free(struct chanserv_output *output)
-{
- while (output)
- {
- struct chanserv_output *next = output->next;
-
- free(output->output);
- free(output);
- output = next;
- }
-}
-
-
-struct chanserv_output *chanserv_add(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = { 0 }, topic [STRING_LONG] = {0};
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Add what?");
-
- /* Save topic since we're chopping args[0] off later. */
- strncpy (topic, args[0], sizeof (topic));
-
- /* Check to make sure the topic doesn't exist first. */
- if (check_existing_url(source, topic, target) == 1)
- {
- return chanserv_asprintf(result, "%s \37%s\37\n",
- EXISTING_ENTRY, topic);
- }
-
- /* Cut off the first argument (the topic) */
- args++;
-
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- return chanserv_asprintf(result, "What info is to be added for %s?", topic);
-
- // Fix for some segmentation fault problems
- // concerning topics consisting entirely of
- // wildcard characters.
- if (strspn(topic, "*?") == strlen(topic))
- return chanserv_asprintf(NULL, "Sorry, but support for that topic has been removed.");
-
- /* FIXME: If both things happen, result is overwritten with
- * the second event, and the first truncation isn't displayed
- */
- if (strlen(topic) > MAX_TOPIC_SIZE)
- {
- topic[MAX_TOPIC_SIZE] = '\0';
- result = chanserv_asprintf(NULL, "Topic is over the limit, and has had characters truncated.");
- }
-
- if (strlen(str) > MAX_DATA_SIZE)
- {
- str[MAX_DATA_SIZE] = '\0';
- result = chanserv_asprintf(NULL, "Data is over the limit, and has had characters truncated.");
- }
-
- strlwr(topic);
-
- /* Don't allow the topic to be an rdb file name. */
- if (*topic == '~')
- return chanserv_asprintf(result, "Rdb files can only be called from the data of a topic, they cannot be used in the topic itself.");
-
- if (LOG_ADD_DELETES)
- db_log(ADD_DELETES, "[%s] %s!%s ADD %s %s\n", date(), source,
- userhost, topic, str);
-
- ADDITIONS++;
-
- if ((strspn (topic, "ilc")) == 3 ||
- (strspn (topic, "iln")) == 3)
- {
- db_log(URL2, "%s ([%s] %s!%s): %s\n", topic, date(),
- source, userhost, str);
- }
- else
- {
- db_log(URL2, "%s %s\n", topic, str);
- }
- return chanserv_asprintf(result, "Okay.");
-}
-
-struct chanserv_output *chanserv_add_user(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char temp[1024] = { 0 };
- long sn = 0;
-
- if (!args || !args[0] || !args[1] || !args[2] || !args[3])
- return result;
- sn = atoi(args[2]);
- if (sn > 10 || sn <= 0)
- return result;
- if (strlen(args[1]) < 7)
- return result;
- snprintf(temp, sizeof (temp), "I haven't used \2%cSETINFO\2 yet!", *CMDCHAR);
- add_helper(args[0], mask_from_nick(args[1], target), sn, 0, temp, args[3], 0);
- save_changes();
-
- return chanserv_asprintf(NULL, "Added user: %s - level %d.", mask_from_nick(args[1], target), sn);
-}
-
-struct chanserv_output *chanserv_alarm(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- char temp[1024] = { 0 };
- time_t sn = 0, unixtime = 0;
- long i = 0;
-
- if (!args || !args[0] || !args[1] || (strlen(args[0]) < 2))
- return chanserv_asprintf(NULL, "Syntax: <time type: \2d/h/m/s\2><time> <text to say>");
-
- if (*args[0] == 'd')
- {
- /* Days. */
- sn = 86400;
- args[0]++;
- }
- else if (*args[0] == 'h')
- {
- /* Hours */
- sn = 3600;
- args[0]++;
- }
- else if (*args[0] == 'm')
- {
- /* Minutes */
- sn = 60;
- args[0]++;
- }
- else if (*args[0] == 's')
- {
- /* Seconds */
- sn = 1;
- args[0]++;
- }
- else
- {
- return chanserv_asprintf(NULL, "Syntax: <time type: \2d/h/m/s\2><time> <text to say>");
- }
-
-
- snprintf(temp, sizeof (temp), "%s/%ld",
- DBTIMERS_PATH,
- (atoi (args[0]) * sn) + time (NULL));
-
- db_log(temp, "PRIVMSG %s :\2ALARMCLOCK\2 by %s!%s: %s", target, source, userhost, args[1]);
-
- unixtime = atoi (args[0]) * sn;
-
- if (unixtime > 86400)
- result = chanserv_asprintf(NULL, "alarmclock set to go off in %d day%s, %02d:%02d.",
- unixtime / 86400,
- plural((unixtime / 86400)),
- (unixtime / 3600) % 24,
- (unixtime / 60) % 60);
- else if (unixtime > 3600)
- result = chanserv_asprintf(NULL, "alarmclock set to go off in %d hour%s, %d min%s.",
- unixtime / 3600,
- plural ((unixtime / 3600)),
- (unixtime / 60) % 60,
- plural (((unixtime / 60) % 60)));
- else
- result = chanserv_asprintf(NULL, "alarm clock set to go off in %d minute%s, %d sec%s.",
- unixtime / 60,
- unixtime / 60 == 1 ? "" : "s",
- unixtime % 60,
- unixtime % 60 == 1 ? "" : "s");
-
- return result;
-}
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_autotopic(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char topic [STRING_LONG] = {0};
-
- if (!args || !args[0])
- return result;
- if (db_argstostr(topic, args, 0, ' ') < 1)
- return result;
-
- set_autotopic (source, target, topic);
-
- return result;
-}
-#endif
-
-//#ifndef WIN32
-struct chanserv_output *chanserv_backup(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- char temp[1024] = { 0 };
-
- snprintf(temp, sizeof (temp), "/bin/cp -f %s %s_`date +%%F_%%R.bak`\n", URL2, URL2);
- system (temp);
-
- return chanserv_asprintf(NULL, "Backed up database.");
-}
-//#endif
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_ban_list(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- show_banlist (source);
- return result;
-}
-#endif
-
-#ifdef ENABLE_MATH
-struct chanserv_output *chanserv_calc(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result;
- if (strlen(args[0]) > 200)
- args[0][200] = '\0';
- do_math(source, target, args[0]);
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_chan_info(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result;
- else
- /* If args[0] is not a valid channel name, just use the current channel */
- show_chaninfo (source, ((*args[0] == '#' || *args[0] == '&' || *args[0] == '+') ? args[0] : target), target);
-
- return result;
-}
-
-struct chanserv_output *chanserv_chan_users(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- show_chanusers (source, target);
- else
- /* If args[0] is not a valid channel name, just use the current channel. */
- show_chanusers (source, ((*args[0] == '#' || *args[0] == '&' || *args[0] == '+') ? args[0] : target));
-
- return result;
-}
-
-struct chanserv_output *chanserv_char(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result;
-
- return chanserv_asprintf(NULL, "%c -> %d.", args[0][0], args[0][0]);
-}
-
-struct chanserv_output *chanserv_char_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- return chanserv_asprintf(NULL, "My command char is: %c.", *CMDCHAR);
-}
-
-struct chanserv_output *chanserv_cpu_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- getrusage(RUSAGE_SELF, &r_usage);
-
- return chanserv_asprintf(NULL, "CPU usage: %ld.%06ld, System = %ld.%06ld.", r_usage.ru_utime.tv_sec, r_usage.ru_utime.tv_usec, r_usage.ru_stime.tv_sec, r_usage.ru_stime.tv_usec);
-}
-
-struct chanserv_output *chanserv_cycle(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
- int i = 0;
-
- /* Check for channel list parameter being specified. */
- if (!args | !args[0])
- {
- S ("PART %s\n", target);
- S ("JOIN %s\n", target);
- }
- else
- {
- result = chanserv_asprintf(NULL, "Cycling %s.", args[0]);
- S("PART %s\n", args[0]);
- S("JOIN %s\n", args[0]);
- }
-
- return result;
-}
-
-struct chanserv_output *chanserv_data_search(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "What should I be %sing for?", cmd);
- printf ("args[0] = %s\n", args[0]);
- datasearch (source, args[0], target);
-
- return result;
-}
-
-struct chanserv_output *chanserv_date(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- return chanserv_asprintf(NULL, "%s.", date());
-}
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_delban(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Enter the user@host to purge!");
- if (del_permban(source, args[0]) == 1)
- S("MODE %s -b %s\n", target, args[0]);
- else
- result = chanserv_asprintf(NULL, "No such ban.");
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_delete(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "%s what?", cmd);
- if (strlen (args[0]) > MAX_TOPIC_SIZE)
- args[0][MAX_TOPIC_SIZE] = '\0';
- if (LOG_ADD_DELETES)
- db_log (ADD_DELETES, "[%s] %s!%s DEL %s\n", date (), source, userhost, args[0]);
- if (*args[0] == '~')
- { /* need level 2 to delete .rdb files */
- if (invoked == MSG_INVOKE)
- {
- if (check_access (userhost, "#*", 0, source) >= 2)
- delete_url (source, args[0], source);
- }
- else
- {
- if (check_access (userhost, target, 0, source) >= 2)
- delete_url (source, args[0], target);
- }
- return result;
- }
- if (invoked == MSG_INVOKE)
- delete_url (source, args[0], source);
- else
- delete_url (source, args[0], target);
-
- return result;
-}
-
-struct chanserv_output *chanserv_deluser(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Enter the user@host to delete!");
- delete_user_ram (source, args[0]);
-
- return result;
-}
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_deop(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0}, chan[STRING_LONG] = {0};
-
- /* Make sure first arg, which should be target chan, is there. */
- if (!args || !args[0])
- return result;
-
- strncpy (chan, args[0], sizeof (chan));
-
- /* Chop of first arg, since we have a copy as chan. */
- args++;
-
- db_argstostr (str, args, 0, ' ');
-
- if ((invoked == MSG_INVOKE) || (*chan == '#'))
- {
- if (check_access (userhost, chan, 0, source) >= 3)
- {
- if (str[0] == '\0')
- return result;
- S ("MODE %s -oooooo %s\n", chan, str);
- }
- }
- else
- {
- if (str[0] == '\0')
- S ("MODE %s -oooooo %s\n", target, chan);
- else
- S ("MODE %s -oooooo %s %s\n", target, chan, str);
- }
-
- return result;
-}
-
-struct chanserv_output *chanserv_devoice(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char chan [STRING_LONG] = {0}, str [STRING_LONG] = {0};
-
- if (!args || !args[0])
- return result;
-
- strncpy (chan, args[0], sizeof (chan));
- args++;
- db_argstostr (str, args, 0, ' ');
-
- if ((invoked == MSG_INVOKE) || (*chan == '#'))
- {
- if (check_access (userhost, chan, 0, source) >= 3)
- {
- if (str[0] == '\0')
- return result;
- S ("MODE %s -vvvvvv %s\n", chan, str);
- }
- }
- else
- {
- if (str[0] == '\0')
- S ("MODE %s -vvvvvvv %s\n", target, chan);
- else
- S ("MODE %s -vvvvvvv %s %s\n", target, chan, str);
- }
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_die(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
- long unixtime = 0;
-
- if (!args || !args[0])
- Snow("QUIT :K\2\2illed (%s (cause I say so!))\n", source);
- else
- {
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- return result;
- Snow("QUIT :K\2\2illed (%s (%s))\n", source, str);
- }
-
- db_sleep (1);
-
- printf ("\n\nGood-bye! %s (c) Jason Hamilton\n\n", dbVersion);
- uptime = time (NULL) - uptime;
- printf("Time elapsed: %ld hour%s, %ld min%s\n\n",
- uptime / 3600,
- uptime / 3600 == 1 ? "" : "s",
- (uptime / 60) % 60, (uptime / 60) % 60 == 1 ? "" : "s");
- db_sleep (5);
- exit (0);
-
- return result;
-}
-
-struct chanserv_output *chanserv_display(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- if (!args || !args[0])
- return result;
- display_url(target, source, args[0]);
-
- return result;
-}
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_down(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- S ("MODE %s -o %s\n", target, source);
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_darkbot(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (Sleep_Toggle == 1)
- return result;
- if (cf (userhost, source, target))
- return result;
-
- return chanserv_asprintf(NULL, "%s reporting! My cmdchar is %c.", dbVersion, *CMDCHAR);
-}
-
-#ifdef ENABLE_GOOGLE
-struct chanserv_output *chanserv_google(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if(!args || !args[0])
- return chanserv_asprintf(NULL, "Google what?");
- web_post_query(cmd, source, userhost, target, args[0], strlen(args[0]));
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_help(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
-
- if (!args || !args[0])
- {
- result = chanserv_asprintf(result, "I can be triggered by various forms of speech, all which must be addressed to me, in one of the following formats: %s %s %s or even %s . In my database, you can find a topic by saying my nick, <topic> . eg; \37%s nuke\37 . To do a search on a word, or partial text, just type: search <text> or dsearch <text> , eg; \37search nuke\37.",
- NICK_COMMA, COLON_NICK, BCOLON_NICK, Mynick, NICK_COMMA);
- if (cf (userhost, source, target))
- return result;
- result = chanserv_asprintf(result, "I can also be triggered with even more human formats: \37%s who is bill gates?\37 . You can also phrase it as a question: \37%s where is msie?\37 . For a list of commands use \37help commands\37 . For a list of setup parameters use \37help parameters\37 . For more info about me, visit http://www.freezedown.org/ .",
- NICK_COMMA, NICK_COMMA, NICK_COMMA);
- return (result);
- }
-
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- return;
-
- result = chanserv_show_help(str, check_access(userhost, (invoked == MSG_INVOKE) ? "#*" : target, 0, source));
- return result;
-}
-
-struct chanserv_output *chanserv_idle(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- long unixtime = 0;
-
- if (!args || !args[0])
- return result;
- if (strcasecmp (args[0], source) == 0)
- return chanserv_asprintf(NULL, "Don't be lame.");
- unixtime = return_useridle (target, args[0], 0);
- if (unixtime == 0)
- return chanserv_asprintf(NULL, "I do not see %s in %s.", args[0], target);
- unixtime = time (NULL) - unixtime;
- if (unixtime > 86400)
- result = chanserv_asprintf(result, " %s has been idle %d day%s, %02d:%02d.",
- args[0], unixtime / 86400,
- (unixtime / 86400 == 1) ? "" : "s",
- (unixtime / 3600) % 24, (unixtime / 60) % 60);
- else if (unixtime > 3600)
- result = chanserv_asprintf(result, "%s has been idle %d hour%s, %d min%s.",
- args[0], unixtime / 3600,
- unixtime / 3600 == 1 ? "" : "s",
- (unixtime / 60) % 60, (unixtime / 60) % 60 == 1 ? "" : "s");
- else
- result = chanserv_asprintf(result, " %s has been idle %d minute%s, %d sec%s.",
- args[0], unixtime / 60,
- unixtime / 60 == 1 ? "" : "s", unixtime % 60, unixtime % 60 == 1 ? "" : "s");
-
- return result;
-}
-
-struct chanserv_output *chanserv_ignore(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Ignore who?");
- if ( add_ignore_user_ram(args[0]) > 0 )
- result = chanserv_asprintf(result, "Ignoring %s.", args[0]);
- else
- result = chanserv_asprintf(result, "Unable to ignore %s.", args[0]);
-
- return result;
-}
-
-struct chanserv_output *chanserv_info(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- info (source, (invoked == MSG_INVOKE) ? source : target);
- return result;
-}
-
-struct chanserv_output *chanserv_info_2(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- show_info2 ((invoked == MSG_INVOKE) ? source : target, source, invoked);
- return result;
-}
-
-struct chanserv_output *chanserv_info_size(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- struct stat statbuf;
-
- if (stat (URL2, &statbuf) == 0)
- result = chanserv_asprintf(NULL, "My database file is presently %ld byte%s in size.", statbuf.st_size, ((statbuf.st_size == 1) ? "" : "s"));
-
- return result;
-}
-
-struct chanserv_output *chanserv_isop(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result;
- result = chanserv_asprintf(NULL, "%s is %san op in channel %s.", args[0], is_op(args[0], target) ? "" : "not ", target);
-
- return result;
-}
-
-struct chanserv_output *chanserv_join(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- S ("JOIN %s\n", target);
- else
- {
- S ("JOIN %s\n", args[0]);
- result = chanserv_asprintf(NULL, "Joining %s.", args[0]);
- }
-
- return result;
-}
-
-struct chanserv_output *chanserv_joins_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- return chanserv_asprintf(NULL, "I have seen %d joins thus far.", JOINs);
-}
-
-struct chanserv_output *chanserv_jump(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char server [STRING_LONG] = {0}, str [STRING_LONG] = {0};
- long sn = 0;
-
- if (!args || !args[0])
- return result;
-
- strncpy (server, args[0], sizeof (server));
- args++;
-
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- sn = 6667;
- else
- sn = atoi(str);
-
- S ("QUIT :Jumping to %s:%d\n", server, sn);
- db_sleep (1);
-
- strncpy (BS, server, sizeof (BS));
- BP = sn;
-
- prepare_bot ();
- register_bot ();
-
- return result;
-}
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_kick(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char chan[STRING_LONG] = {0}, nick[STRING_LONG] = {0},
- reason [STRING_LONG] = {0};
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Specify a nick/channel!");
-
- if (invoked == MSG_INVOKE)
- {
- /* Copy channel variable and chuck it. */
- strncpy (chan, args[0], sizeof (chan));
- args++;
-
- /* Make sure first parameter is a channel name. */
- if ((*chan != '#') && (*chan != '&'))
- return chanserv_asprintf (NULL, "You must specify a channel name first.");
-
- if (check_access (userhost, chan, 0, source) >= 3)
- {
- if (!args[0])
- return chanserv_asprintf(NULL, "You must specity a nickname to kick!");
-
- strncpy (nick, args[0], sizeof (nick));
- args++;
-
- /* Remaining args are fed into reason. */
- if ((db_argstostr (reason, args, 0, ' ')) < 1)
- S ("KICK %s %s %s\n", chan, nick, DEFAULT_KICK);
- else
- S ("KICK %s %s :%s\n", chan, nick, reason);
-
- return result;
- }
- }
- else
- {
- if (*args[0] != '#' && *args[0] != '&')
- {
- strncpy (nick, args[0], sizeof (nick));
- args++;
-
- if (strcasecmp (nick, Mynick) == 0)
- S ("KICK %s %s :hah! As *IF*\n", target, source);
- if ((db_argstostr (reason, args, 0, ' ')) < 1)
- S ("KICK %s %s :\2%s\2'ed: %s\n", target, nick, cmd, DEFAULT_KICK);
- else
- S ("KICK %s %s :\2%s\2'ed: %s\n", target, nick, cmd, reason);
- }
- else
- {
- if (!args[0] || !args[1])
- return chanserv_asprintf(result, "You must specify a nickname to kick!");
-
- strncpy (chan, args[0], sizeof chan);
- args++;
- strncpy (nick, args[0], sizeof nick);
- args++;
-
- if (strcasecmp (nick, Mynick) == 0)
- S ("KICK %s %s :hah! As *IF*\n", target, nick);
-
- if ((db_argstostr (reason, args, 0, ' ')) < 1)
- S ("KICK %s %s :\2%s\2ed: %s\n", chan, nick, cmd, DEFAULT_KICK);
- else
- S ("KICK %s %s :\2%s\2ed: %s\n", chan, nick, cmd, reason);
- }
- }
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_language(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- return chanserv_asprintf(NULL, "I speak English.");
-}
-
-struct chanserv_output *chanserv_leave(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char chan [STRING_LONG] = {0},
- reason [STRING_LONG] = {0};
-
- if (!args || !args[0])
- S ("PART %s\n", target);
- else
- {
- strncpy (chan, args[0], sizeof chan);
- args++;
-
- /* Don't bother telling the channel we left about it. */
- if ((strcasecmp (target, chan)) != 0)
- result = chanserv_asprintf(result, "Leaving %s.", chan);
-
- if ((db_argstostr (reason, args, 0, ' ')) < 1)
- S ("PART %s :Requested!\n", chan);
- else
- S ("PART %s :%s\n", chan, reason);
- }
-
- return (result);
-}
-
-struct chanserv_output *chanserv_length(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result;
-
- return chanserv_asprintf(NULL, "It was %d chars long.", strlen (args[0]));
-}
-
-struct chanserv_output *chanserv_level(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char *uh;
-
- if (!args || !args[0])
- return result;
- uh = uh_from_nick(args[0], target);
- if (uh)
- result = chanserv_asprintf(result, "%s is level %d in channel %s.", args[0], check_access(uh, target, 0, args[0]), target);
-
- return result;
-}
-
-struct chanserv_output *chanserv_location_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- return chanserv_asprintf(NULL, "There %s %d server%s in my server list. I am currently on server #%d.", (snr == 1) ? "is" : "are", snr, (snr == 1) ? "" : "s", spr);
-}
-
-struct chanserv_output *chanserv_login(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result;
- do_login (source, args[0]);
-
- return result;
-}
-
-struct chanserv_output *chanserv_mask(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- int i = 0;
- struct chanserv_output *result = NULL;
-
- if(!args || !args[0])
- return result;
-
- return chanserv_asprintf(NULL, " %s",
- (invoked == MSG_INVOKE) ? mask_from_nick(args[0], "#*") : mask_from_nick(args[0], target));
-}
-
-//#ifndef WIN32
-struct chanserv_output *chanserv_memory(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- char temp[1024] = { 0 };
-
- snprintf(temp, sizeof (temp), "ps u -p %d\n", getpid());
-
- const char *ptr = run_program (temp);
- if (ptr == NULL)
- return chanserv_asprintf(NULL, "Unable to gather data for mem output.\n");
- else
- return chanserv_asprintf(NULL, "ps: %s", ptr);
-}
-//#endif
-
-#ifdef ENABLE_METAR
-struct chanserv_output *chanserv_metar(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if(!args || !args[0])
- return chanserv_asprintf(NULL, "Metar what?");
- web_post_query (cmd, source, userhost, target, args[0], strlen(args[0]));
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_nick(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- // If no nick was specified...
- if(!args || !args[0])
- return chanserv_asprintf(NULL, "Specify a nick!");
-
- // If the nick specified contains illegal characters...
- if(strspn(args[0], LEGAL_NICK_TEXT) != strlen(args[0]))
- return chanserv_asprintf(NULL, "The nickname %s contains illegal characters.", args[0]);
-
- strncpy(Mynick, args[0], sizeof (Mynick));
- strncpy(s_Mynick, Mynick, sizeof (s_Mynick));
- snprintf(NICK_COMMA, sizeof (NICK_COMMA), "%s,", Mynick);
- snprintf(COLON_NICK, sizeof (COLON_NICK), "%s:", Mynick);
- snprintf(BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", Mynick);
- // FIXME: This should be sent before the NICK attempt, and/or complain if the NICK doesn't work.
- result = chanserv_asprintf(result, "Attempting to /nick %s.", Mynick);
- S("NICK %s\n", Mynick);
-
- return result;
-}
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_op(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char nicks [STRING_LONG] = {0}, chan [STRING_LONG] = {0};
- int ischan = 0;
-
- if (!args[0])
- return chanserv_asprintf (NULL, "You must specify a nickname/channel!.");
-
- /* Check for channel name specified, set up args accordingly. */
- if ((*args[0] == '#') || (*args[0] == '&'))
- {
- ischan = 1; /* channel specified */
- strncpy (chan, args[0], sizeof chan);
- args++;
- }
-
- if ((db_argstostr (nicks, args, 0, ' ')) < 1)
- return chanserv_asprintf (NULL, "You must specify a nickname to op.");
-
- if ((invoked == MSG_INVOKE) || (ischan == 1))
- {
- /* If MSG_INVOKE, make sure chan == 1. This seems weird, but
- * we could have MSG_INVOKE without channel specified. */
- if (ischan != 1)
- return chanserv_asprintf (NULL, "You must specify a channel to deop people on.");
-
- if (check_access (userhost, chan, 0, source) >= 3)
- {
- S ("MODE %s +oooooo %s\n", chan, nicks);
- return result;
- }
- }
- else
- S ("MODE %s +oooooo %s\n", target, nicks);
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_os_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char temp[1024] = { 0 };
- char *reply = NULL;
-
-#ifdef WIN32
- snprintf (temp, sizeof (temp), "cmd /c ver\n");
-#else
- snprintf (temp, sizeof (temp), "uname\n");
-#endif
-
- return chanserv_asprintf(NULL, "I am running %s.", run_program(temp));
-}
-
-struct chanserv_output *chanserv_password(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (args[0] == NULL || args[1] == NULL)
- return result;
- if (strlen(args[1]) > 25)
- args[1][25] = '\0';
- set_pass(source, userhost, args[0], args[1]);
-
- return result;
-}
-
-struct chanserv_output *chanserv_performs(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- /* Set the default umodes */
- S ("MODE %s %s\n", Mynick, DEFAULT_UMODE);
- run_perform ();
-
- return chanserv_asprintf(NULL, "Performs have been executed.");
-}
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_perm_ban(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char reason [STRING_LONG] = {0}, host [STRING_LONG] = {0};
-
- if (!args || !args[0])
- return result = chanserv_asprintf(result, "Type !help permbans");
-
- strncpy (host, args[0], sizeof host);
- args++;
-
- if ((db_argstostr (reason, args, 0, ' ')) < 1)
- strncpy (reason, "Permbanned!", sizeof reason);
-
- add_permban(host, 0, reason);
- result = chanserv_asprintf(result, "Added in permban #%d, %s; reason: %s.",
- PERMBAN_counter, host, reason);
- save_permbans();
- S("MODE %s +b %s\n", target, host);
-
- /* FIXME: Scan for user in room and kick them with reason. */
- return result;
-}
-
-struct chanserv_output *chanserv_perm_bans_list(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- return chanserv_asprintf(NULL, "There %s %d permban%s loaded into ram.", (PERMBAN_counter == 1) ? "is" : "are", PERMBAN_counter, (PERMBAN_counter == 1) ? "" : "s");
-}
-#endif
-
-#ifdef ENABLE_CTCP
-struct chanserv_output *chanserv_ping(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (cf(userhost, source, target))
- return result;
- if (cf(userhost, source, target))
- return result;
- if (args[0] != NULL)
- {
- if (strlen (args[0]) > 21)
- args[0][21] = '\0';
- S ("NOTICE %s :\1PING %s\n", source, args[0]);
- }
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_ping2(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- return chanserv_asprintf(NULL, "PONG!");
-}
-
-struct chanserv_output *chanserv_queue_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- return chanserv_asprintf(NULL, "There is currently %d item%s in queue.", get_sendq_count(2), (get_sendq_count(2) == 1) ? "" : "s");
-}
-
-#ifdef ENABLE_QUIZ
-struct chanserv_output *chanserv_quiz(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (quiz_halt == 0)
- run_quiz_question (target);
-
- return result;
-}
-#endif
-
-#ifdef ENABLE_RANDQ
-struct chanserv_output *chanserv_quote(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- do_randq(args[0], RANDQ_RAND, target, source);
-
- return result;
-}
-
-struct chanserv_output *chanserv_random_quote(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result = chanserv_asprintf (NULL, "You must specify a search string.");
-
- // RANDQ_NORMAL
- do_randq(args[0], RANDQ_NORMAL, target, source);
-
- return result;
-}
-
-struct chanserv_output *chanserv_random_quote_2(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result = chanserv_asprintf (NULL, "You must specify a search string.");
-
- // RANDQ_CASE
- do_randq(args[0], RANDQ_CASE, target, source);
-
- return result;
-}
-#endif
-
-#ifdef ENABLE_RANDOM
-struct chanserv_output *chanserv_random_stuff(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
-
- /* Fill argument buffer, if it's empty we return a message to
- * the user asking for input. */
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "What do you want to add?");
-
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- return result;
-
- if (invoked == MSG_INVOKE)
- {
- if (check_access (userhost, "#*", 0, source) >= RAND_LEVEL)
- {
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- return chanserv_asprintf(NULL, "What do you want to add?");
- add_randomstuff(source, source, str);
- }
- }
- else
- add_randomstuff(source, target, str);
-
- return result;
-}
-
-struct chanserv_output *chanserv_random_stuff_list(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- return chanserv_asprintf(NULL, "%d seconds left till randstuff.", Rand_Stuff);
-}
-#endif
-
-struct chanserv_output *chanserv_raw(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
-
- if (!args || !args[0])
- return result;
-
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- return result;
-
- Snow("%s\n", str);
-
- return result;
-}
-
-//#ifndef WIN32
-struct chanserv_output *chanserv_rdb(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char temp[1024] = { 0 };
- char str [STRING_LONG] = {0};
-
- /* Check for arguments */
-
- if (!args || !args[0])
- {
- snprintf(temp, sizeof (temp), "ls %s/*.rdb | wc\n", RDB_DIR);
- result = chanserv_asprintf(result, "RDB: %s.", run_program(temp));
- }
- else
- {
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- return result;
- if (strspn(str, SAFE_LIST) != strlen(str))
- return chanserv_asprintf(NULL, "Rdb files are made up of letters and or numbers, no other text is accepted.");
- snprintf(temp, sizeof (temp), "cat %s/%s.rdb | wc -l\n", RDB_DIR, str);
- result = chanserv_asprintf(result, "%s", run_program(temp));
- }
-
- return result;
-}
-//#endif
-
-struct chanserv_output *chanserv_repeat(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- long sn2 = 0, sn = 0;
- char str [STRING_LONG] = {0};
-
- if (!args || !args[0] || !args[1] || !args[2])
- return result;
- sn = atoi (args[0]);
- sn2 = atoi (args[1]);
- if ((db_argstostr (str, args, 2, ' ')) < 1)
- return result;
-
- while (sn > 0)
- {
- S ("%s\n", str);
- db_sleep (sn2);
- sn--;
- }
-
- return result;
-}
-
-struct chanserv_output *chanserv_replace(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char topic [STRING_LONG] = {0}, str [STRING_LONG] = {0};
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Replace what?");
-
- if (strlen(args[0]) > MAX_TOPIC_SIZE)
- args[0][MAX_TOPIC_SIZE] = '\0';
-
- /* Copy topic, and traverse args for data to be replaced. */
- strncpy (topic, args[0], sizeof topic);
- args++;
-
- /* Make sure there's information to be replaced. */
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- return chanserv_asprintf(NULL, "What info should replace %s?",
- topic);
-
- /* Don't let str go over MAX_DATA_SIZE characters. */
- if (strlen(str) > MAX_DATA_SIZE)
- str[MAX_DATA_SIZE] = '\0';
-
- strlwr(topic);
-
- if (check_existing_url(source, topic, target) != 1)
- return chanserv_asprintf(NULL, "%s \37%s\37", NO_ENTRY, topic);
-
- /* Replace the data. */
- delete_url (source, topic, target);
- if (LOG_ADD_DELETES)
- db_log (ADD_DELETES, "[%s] %s!%s REPLACE %s %s\n", date (), source, userhost, topic, str);
-
- ADDITIONS++;
-
- db_log (URL2, "%s %s\n", topic, str);
-
- return chanserv_asprintf(NULL, "%s has been updated.", topic);
-}
-
-struct chanserv_output *chanserv_reserved_1(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result;
- call_reserved_1(source, target, args[0]);
-
- return result;
-}
-
-struct chanserv_output *chanserv_reserved_2(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result;
- call_reserved_2(source, target, args[0]);
-
- return result;
-}
-
-struct chanserv_output *chanserv_restart(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char temp[1024] = { 0 };
-
- S("QUIT :Restarting %s ...\n", dbVersion);
- db_sleep(2);
- snprintf(temp, sizeof (temp), "%s", DARKBOT_BIN);
- system(temp);
- db_sleep(1);
- exit(0);
-
- return result;
-}
-
-struct chanserv_output *chanserv_search(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- {
- if (strcasecmp(cmd, "FIND") == 0)
- result = chanserv_asprintf(NULL, "%s?", TRY_FIND);
- else
- result = chanserv_asprintf(NULL, "What should I be %sing for?", cmd);
- return result;
- }
- find_url(source, args[0], target);
-
- return result;
-}
-
-struct chanserv_output *chanserv_seen(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- {
- count_seen(source, target);
- return result;
- }
- if (return_useridle (target, args[0], 1) == 1)
- return chanserv_asprintf(NULL, "%s is right here in the channel!", args[0]);
- show_seen(args[0], source, target);
-
- return result;
-}
-
-struct chanserv_output *chanserv_set(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- struct setup_parameter *param = NULL;
-
- if (!args || !args[0])
- return result;
-
- param = set_parameter(args[0]);
- if (param)
- {
- switch (param->type)
- {
- case ST_BOOLEAN :
- {
- bool *variable = param->value;
-
- result = chanserv_asprintf(result, "Setting %s = %s", param->summary, (*variable) ? "true" : "false");
- break;
- }
-
- case ST_INTEGER :
- {
- long *variable = param->value;
-
- result = chanserv_asprintf(result, "Setting %s = %ld", param->summary, *variable);
- break;
- }
-
- case ST_STRING :
- {
- char *variable = param->value;
-
- result = chanserv_asprintf(result, "Setting %s = %s", param->summary, variable);
- break;
- }
- }
- save_setup();
- }
- else
- result = chanserv_asprintf(result, "Unknown parameter.");
-
- return result;
-}
-
-struct chanserv_output *chanserv_setinfo(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
-
- if (!args)
- return chanserv_asprintf (NULL, "My %s variables are: ^ nick, %% number of joins, & Channel, $ user@host. Example: !setinfo ^ has joined & %% times (also, if you make the first char of your %s a \"+\", the %s will be shown as an ACTION).", cmd, cmd, cmd);
-
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- return;
-
- update_setinfo (userhost, str, source);
- save_changes();
- return (result);
-}
-struct chanserv_output *chanserv_sleep(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
-
- Sleep_Toggle = 1;
-
- /* Copy arguments to buffer, if there is one convert to long
- * and use it as the sleep time in seconds. */
-
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- Sleep_Time = SLEEP_TIME;
- else if ((Sleep_Time = strtol (str, (char **) NULL, 10)) < 1)
- Sleep_Time = SLEEP_TIME;
-
- S ("PRIVMSG %s :%s\n", target, GOSLEEP_ACTION);
- strncpy (sleep_chan, target, sizeof (sleep_chan));
-
- /* If the user has specified a custom length of time to sleep for, send
- * a notice reminding the user how long the bot will be asleep, in a
- * more readible format.
- */
- if (Sleep_Time != SLEEP_TIME)
- {
- if (Sleep_Time > 86400)
- result = chanserv_asprintf(result, "Sleeping for %ld day%s, %02ld:%02ld.",
- Sleep_Time / 86400,
- (Sleep_Time / 86400 == 1) ? "" : "s",
- (Sleep_Time / 3600) % 24,
- (Sleep_Time / 60) % 60);
- else if (Sleep_Time > 3600)
- result = chanserv_asprintf(result, "Sleeping for %ld hour%s, %ld min%s.",
- Sleep_Time / 3600,
- Sleep_Time / 3600 == 1 ? "" : "s",
- (Sleep_Time / 60) % 60,
- (Sleep_Time/ 60) % 60 == 1 ? "" : "s");
- else
- result = chanserv_asprintf(result, "Sleeping for %ld minute%s, %ld sec%s.",
- Sleep_Time / 60,
- Sleep_Time / 60 == 1 ? "" : "s",
- Sleep_Time % 60,
- Sleep_Time % 60 == 1 ? "" : "s");
- }
-
- return result;
-}
-
-#ifdef ENABLE_STATS
-struct chanserv_output *chanserv_stats(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return result = chanserv_asprintf (NULL, "Syntax: %s <nick>", cmd);
- get_stats(target, args[0]);
- return result;
-}
-#endif
-
-#ifdef ENABLE_TAF
-struct chanserv_output *chanserv_taf(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if(!args || !args[0])
- return chanserv_asprintf(NULL, "Taf what?");
- web_post_query(cmd, source, userhost, target, args[0], strlen(args[0]));
-
- return result;
-}
-#endif
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_teaseop(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Specify a nick!");
- if (strcasecmp (args[0], Mynick) == 0)
- result = chanserv_asprintf(result, "How about I not do that?");
- else
- S ("MODE %s +o-o+o-o+o-o %s %s %s %s %s %s\n", target, args[0], args[0], args[0], args[0], args[0], args[0]);
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_tell(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Tell who?");
- if (!args[1])
- return chanserv_asprintf(NULL, "What do you want me to tell %s?", args[0]);
- if (strcasecmp (args[1], Mynick) == 0)
- return result; /* don't bother telling myself about stuff */
-
- if (strcasecmp (args[1], "ABOUT") == 0)
- {
- if ((db_argstostr (str, args, 2, '+')) < 1)
- return chanserv_asprintf(NULL, "Tell %s about what?", args[0]);
-
- strlwr(str);
- if (invoked == MSG_INVOKE)
- show_url (source, get_multiword_topic (str), args[0], 1, 0, userhost, 1);
- else
- show_url (args[0], get_multiword_topic (str), target, 1, 0, userhost, 1);
- }
- else
- {
- if ((db_argstostr (str, args, 1, '+')) < 1)
- return chanserv_asprintf (NULL, "Tell %s about what?", args[0]);
-
- strlwr(str);
-
- if (invoked == MSG_INVOKE)
- show_url (source, get_multiword_topic (str), args[0], 1, 0, userhost, 1);
- else
- show_url (args[0], get_multiword_topic (str), target, 1, 0, userhost, 1);
- }
-
- return result;
-}
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_topic(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
-
- if ((db_argstostr (str, args, 0, ' ')) < 1)
- return chanserv_asprintf (NULL, "What do you want the topic changed to?");
- else
- S ("TOPIC %s :%s\n", target, str);
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_unignore(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Unignore who?");
- if ( delete_ignore_user_ram (args[0]) > 0 )
- result = chanserv_asprintf(result, "Unignoring %s.", args[0]);
- else
- result = chanserv_asprintf(result, "Unable to unignore %s. :(", args[0]);
-
- return result;
-}
-
-struct chanserv_output *chanserv_unixtime(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- time_t unixtime = 0, input_t = 0, cur_t = 0;
- char *things = NULL;
- int errno;
-
- /* Check if anything was given as input and only do stuff
- * (in this function, anyway) if so. */
-
- if (!args || !args[0])
- return result;
-
- /* Make sure current time is available while acquiring it. */
- if ((cur_t = time (NULL)) < 0)
- {
- result = chanserv_asprintf (result, "Unable to produce results because current system time is unavailable.");
- return (result);
- }
-
- /* Convert input value to time_t. We check if the return value is
- * 0 here, but our main concern is if things is NULL, because that
- * would mean the function converted a string value "0", instead
- * of returning a failing code. Set errno to 0 first as for a
- * precautionary measure.
- */
-
- errno = 0;
-
- if ((input_t = (time_t) strtol (args[0], &things, 10)) == 0)
- {
- if (things == NULL)
- {
- result = chanserv_asprintf (result, "%s (things = %s)", strerror (errno), things);
- return (result);
- }
-
- /* things was not NULL, this is "0" converted to long.
- * So we continue as if nothing happened. */
- }
-
- /* Check for out of range values, tell the user which range
- * was exceeded, perhaps for debugging purposes. */
- if (errno == ERANGE)
- {
- result = chanserv_asprintf (result, "Your implementation does not support numeric ranges beyond %ld for this function.",
- input_t);
- return (result);
- }
-
- unixtime = input_t - cur_t;
-
- if (unixtime > 86400)
- result = chanserv_asprintf(result, "%d day%s, %02d:%02d.",
- unixtime / 86400,
- plural (unixtime / 86400),
- (unixtime / 3600) % 24,
- (unixtime / 60) % 60);
- else if (unixtime > 3600)
- result = chanserv_asprintf(result, "%d hour%s, %d min%s.",
- unixtime / 3600,
- plural(unixtime / 3600),
- (unixtime / 60) % 60,
- plural(unixtime / 60));
- else
- result = chanserv_asprintf(result, "%d minute%s, %d sec%s.",
- unixtime / 60,
- plural(unixtime / 60),
- unixtime % 60,
- plural(unixtime % 60));
-
- return result;
-}
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_up(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- S ("MODE %s +o %s\n", target, source);
- return result;
-}
-#endif
-
-//#ifndef WIN32
-struct chanserv_output *chanserv_uptime(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- char temp[1024] = { 0 };
-
- snprintf(temp, sizeof (temp), "uptime\n");
- return chanserv_asprintf(NULL, "Uptime: %s.", run_program(temp));
-}
-//#endif
-
-struct chanserv_output *chanserv_user_list(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
- int i = 0;
-
- if (!args)
- {
- show_helper_list (source, 0);
- return result;
- }
- else
- {
- int level = 0;
- for (i = 0; args[i]; i++)
- show_helper_list (source, atoi (args[i]));
- }
-
- return result;
-}
-
-#ifdef ENABLE_STATUS
-struct chanserv_output *chanserv_users_list(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- S ("LUSERS\n");
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_variables(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- return chanserv_asprintf(NULL, "Data variables are: N~ (Nick), C~ (Chan), T~ (Time/date) B~ (Botnick), Q~ (Question asked), R~ (random nick), !~ (command char), S~ (current Server), P~ (current port) V~ (botVer), W~ (db WWW site), H~ (u@h), t~ (unixtime), BAN (sets a ban), TEMPBAN (bans for 60 sec).");
-}
-
-#ifdef ENABLE_CTCP
-struct chanserv_output *chanserv_version(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
-
- if (cf (userhost, source, target))
- return result;
- if (cf (userhost, source, target))
- return result;
-
- return chanserv_asprintf(NULL, "\1VERSION Hi, I'm a Darkbot. Download me from http://www.darkbot.org\1.");
-}
-#endif
-
-#ifdef ENABLE_CHANNEL
-struct chanserv_output *chanserv_voice(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char nicks [STRING_LONG] = {0}, chan [STRING_LONG] = {0},
- str [STRING_LONG] = {0};
- int ischan = 0;
-
- if (!args[0])
- return result;
-
- db_argstostr (str, args, 0, ' ');
-
- /* Check for channel name specified, set up args accordingly. */
- if ((*args[0] == '#') || (*args[0] == '&'))
- {
- ischan = 1; /* channel specified */
- strncpy (chan, args[0], sizeof chan);
- args++;
- }
-
- if ((db_argstostr (nicks, args, 0, ' ')) < 1)
- return chanserv_asprintf (NULL, "You must specify a nickname to voice.");
-
- if ((invoked == MSG_INVOKE) || (ischan == 1))
- {
- /* If MSG_INVOke, make sure chan ==1. This seems weird,
- * but we could have MSG_INVOKE without a channel given,
- * and this is an error. */
- if (ischan != 1)
- return chanserv_asprintf (NULL, "You must specify a channel to give voice on.");
-
- if (check_access (userhost, chan, 0, source) >= 3)
- {
- S ("MODE %s +vvvvvv %s\n", chan, nicks);
- return result;
- }
- }
- else
- S ("MODE %s +vvvvvv %s\n", target, nicks);
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_wakeup(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- if (Sleep_Toggle == 0)
- return result;
- Sleep_Toggle = 0;
- AIL4 = 0;
- S ("PRIVMSG %s :%s\n", target, WAKEUP_ACTION);
- if (strcasecmp (sleep_chan, target) != 0)
- S ("PRIVMSG %s :%s\n", sleep_chan, WAKEUP_ACTION);
-
- return result;
-}
-
-#ifdef ENABLE_WEATHER
-struct chanserv_output *chanserv_weather(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Show weather from where?");
- web_post_query(cmd, source, userhost, target, args[0], strlen(args[0]));
-
- return result;
-}
-#endif
-
-struct chanserv_output *chanserv_where(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
- char *ptr3 = NULL;
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "You were asking?");
- if (args[1] == NULL)
- return result;
- strlwr (args[1]);
- ptr3 = strchr (args[1], '?');
- if (ptr3 != NULL)
- memmove (ptr3, ptr3 + 1, strlen (ptr3 + 1) + 1);
- ptr3 = strchr (args[1], '!');
- if (ptr3 != NULL)
- memmove (ptr3, ptr3 + 1, strlen (ptr3 + 1) + 1);
- if (strcasecmp (args[1], "A") == 0 || strcasecmp (args[1], "AN") == 0)
- {
- if ((db_argstostr (str, args, 2, ' ')) < 1)
- return chanserv_asprintf(NULL, "%s %s %s? Mind rephrasing that? (Type %cHELP for syntax hints).", cmd, args[0], args[1], *CMDCHAR);
- show_url (source, get_multiword_topic (str), (invoked == MSG_INVOKE) ? source : target, 1, 0, userhost, 0);
- }
- else
- show_url (source, get_multiword_topic (args[1]), (invoked == MSG_INVOKE) ? source : target, 1, 0, userhost, 0);
-
- return result;
-}
-
-struct chanserv_output *chanserv_whisper(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
-{
- struct chanserv_output *result = NULL;
- char str [STRING_LONG] = {0};
-
- if (!args || !args[0])
- return chanserv_asprintf(NULL, "Whisper to who?");
- if (args[1] == NULL)
- return chanserv_asprintf(NULL, "What do you want me to whisper to %s?", args[0]);
- if (strcasecmp (args[1], Mynick) == 0)
- return result; /* don't bother telling myself about stuff */
- if (strcasecmp (args[1], "ABOUT") == 0)
- {
- if ((db_argstostr (str, args, 2, ' ')) < 1)
- return chanserv_asprintf(NULL, "Whisper to %s about what?", args[0]);
- strlwr(str);
- show_url(source, get_multiword_topic(str), args[0], 1, 0, userhost, 1);
- }
- else
- {
- strlwr (args[1]);
- show_url(source, get_multiword_topic(args[1]), args[0], 1, 0, userhost, 1);
- }
-
- return result;
-}
-
-/* The help system uses the first alias for each command for the list of commands.
- * So make the first alias the most meaningful, and keep the list sorted by that first alias.
- */
-struct chanserv_command chanserv_commands[] =
-{
- {NORMAL_COMMAND, ADD_LEVEL, 1, 0, chanserv_add, {"ADD", "REMEMBER", "SAVE", "STORE", NULL}, "<topic> <text>", "Add a topic and it's text."},
- {PASSWORD_COMMAND, 3, 4, 0, chanserv_add_user, {"ADDUSER", NULL, NULL, NULL, NULL}, "<#channel|#*> <user@host> <level> [password]", "Add a user to the access list."},
- {SAFE_COMMAND, 2, 2, 0, chanserv_alarm, {"ALARM", "ALARMCLOCK", NULL, NULL, NULL}, "<time type: d/h/m><time> <text to say>", "Set some text to be said by the bot at a later time."},
-#ifdef ENABLE_CHANNEL
- {DANGER_COMMAND, 3, 1, 0, chanserv_autotopic, {"AUTOTOPIC", NULL, NULL, NULL, NULL}, "<channel topic>", "Refreshes the channel topic every thirty minutes (set to \"0\" to turn off)."},
-#endif
-//#ifndef WIN32
- {DANGER_COMMAND, 3, 0, 0, chanserv_backup, {"BACKUP", NULL, NULL, NULL, NULL}, NULL, "Create a backup of the database."},
-//#endif
-#ifdef ENABLE_CHANNEL
- {INFO_COMMAND, 1, 0, 0, chanserv_ban_list, {"BANLIST", NULL, NULL, NULL, NULL}, NULL, "Displays permanent bans."},
-#endif
-#ifdef ENABLE_MATH
- {INFO_COMMAND, 0, 1, 0, chanserv_calc, {"CALC", "MATH", NULL, NULL, NULL}, "<expression>", "Very basic calculator."},
-#endif
- {INFO_COMMAND, 0, 1, 0, chanserv_chan_info, {"CHANINFO", NULL, NULL, NULL, NULL}, "<#channel>", "Displays number of users in channel and in ram."},
- {INFO_COMMAND, 0, 1, 0, chanserv_chan_users, {"CHANUSERS", NULL, NULL, NULL, NULL}, "<#channel>", "Displays names of users in channel."},
- {INFO_COMMAND, 0, 1, 0, chanserv_char, {"CHAR", NULL, NULL, NULL, NULL}, "<character>", "Show the ascii code of the character."},
- {INFO_COMMAND, 0, 0, 1, chanserv_char_show, {"CMDCHAR?", NULL, NULL, NULL, NULL}, NULL, "Show command character."},
- {INFO_COMMAND, 0, 0, 1, chanserv_cpu_show, {"CPU?", NULL, NULL, NULL, NULL}, NULL, "Show the cpu usage of the bot."},
- {DANGER_COMMAND, 2, 0, 0, chanserv_cycle, {"CYCLE", "CYC", NULL, NULL, NULL}, "[#channel]", "Leave and rejoin the channel."},
- {INFO_COMMAND, 0, 1, 0, chanserv_data_search, {"DATASEARCH", "DSEARCH", "DFIND", NULL, NULL}, "<topic>", "Search in the replies."},
- {INFO_COMMAND, 0, 0, 0, chanserv_date, {"DATE", "TIME", NULL, NULL, NULL}, NULL, "Show the current date and time."},
- {DANGER_COMMAND, 0, 1, 0, chanserv_reserved_2, {RESERVED2, NULL, NULL, NULL, NULL}, "<>", ""},
-#ifdef ENABLE_CHANNEL
- {DANGER_COMMAND, 3, 1, 0, chanserv_delban, {"DELBAN", NULL, NULL, NULL, NULL}, "<user@host>", "Delete a user from the permanent ban list."},
-#endif
- {NORMAL_COMMAND, DEL_LEVEL, 1, 0, chanserv_delete, {"DELETE", "DEL", "REMOVE", "FORGET", NULL}, "<topic>", "Delete a topic."},
- {DANGER_COMMAND, 3, 1, 0, chanserv_deluser, {"DELUSER", NULL, NULL, NULL, NULL}, "<user@host>", "Delete a user from the access list."},
-#ifdef ENABLE_CHANNEL
- {DANGER_COMMAND, 3, 1, 0, chanserv_deop, {"DEOP", NULL, NULL, NULL, NULL}, "[#channel] <nicks>", "Remove channel operator status from users."},
- {NORMAL_COMMAND, 3, 1, 0, chanserv_devoice, {"DEVOICE", "DV", "DEV", "DVOICE", NULL}, "[#channel] <nicks>", "Remove channel voice status from users."},
-#endif
- {DANGER_COMMAND, 3, 0, 0, chanserv_die, {"DIE", "QUIT", NULL, NULL, NULL}, NULL, "Stop bot from running."},
- {INFO_COMMAND, 0, 1, 0, chanserv_display, {"DISPLAY", NULL, NULL, NULL, NULL}, "<topic>", "Display the text for a topic."},
-#ifdef ENABLE_CHANNEL
- {DANGER_COMMAND, 2, 0, 0, chanserv_down, {"DOWN", NULL, NULL, NULL, NULL}, NULL, "Remove channel operator status from yourself."},
-#endif
- {INFO_COMMAND, 0, 0, 0, chanserv_darkbot, {"\2\2DARKBOT", NULL, NULL, NULL, NULL}, NULL, ""},
- {DANGER_COMMAND, 0, 1, 0, chanserv_reserved_1, {RESERVED1, NULL, NULL, NULL, NULL}, "<>", ""},
-#ifdef ENABLE_GOOGLE
- {NORMAL_COMMAND, 0, 1, 0, chanserv_google, {"GOOGLE", NULL, NULL, NULL, NULL}, "<text>", "Look up the text on google."},
-#endif
- {INFO_COMMAND, 0, 0, 0, chanserv_help, {"HELP", NULL, NULL, NULL, NULL}, "[command]", "Show some help text to the user."},
- {INFO_COMMAND, 0, 1, 0, chanserv_idle, {"IDLE", NULL, NULL, NULL, NULL}, "<nick>", "Shows how long the user has been idle."},
- {DANGER_COMMAND, 1, 1, 0, chanserv_ignore, {"IGNORE", NULL, NULL, NULL, NULL}, "<nick>", "Get bot to ignore a user."},
- {INFO_COMMAND, 0, 0, 1, chanserv_info, {"INFO", NULL, NULL, NULL, NULL}, NULL, "Shows some information about bot and it's activity."},
- {INFO_COMMAND, 0, 0, 1, chanserv_info_2, {"INFO2", NULL, NULL, NULL, NULL}, NULL, "Shows when the bot was compiled, and lines processed since startup."},
- {INFO_COMMAND, 2, 0, 1, chanserv_info_size, {"INFOSIZE", "DBSIZE", NULL, NULL, NULL}, NULL, "Show size of the database."},
- {INFO_COMMAND, 0, 1, 0, chanserv_isop, {"ISOP", NULL, NULL, NULL, NULL}, "<nick>", "Is user a channel op?"},
- {DANGER_COMMAND, 2, 1, 0, chanserv_join, {"JOIN", "J", NULL, NULL, NULL}, "<#channel>", "Get bot to join a channel."},
- {INFO_COMMAND, 0, 0, 1, chanserv_joins_show, {"JOINS?", NULL, NULL, NULL, NULL}, NULL, "Shows the number of user joins bot has seen in this channel since startup."},
-#ifdef ENABLE_CHANNEL
- {DANGER_COMMAND, 3, 1, 0, chanserv_kick, {"KICK", "WHACK", "K", "NAIL", NULL}, "[#channel] <nick> [reason]", "Kick a user off the channel."},
-#endif
- {INFO_COMMAND, 0, 0, 0, chanserv_language, {"LANGUAGE", "LANG", NULL, NULL, NULL}, NULL, "Shows the language that bot is currently speaking."},
- {DANGER_COMMAND, 2, 0, 0, chanserv_leave, {"LEAVE", "PART", "L", "P", NULL}, "[#channel]", "Get bot to leave the channel."},
- {INFO_COMMAND, 0, 1, 0, chanserv_length, {"LENGTH", NULL, NULL, NULL, NULL}, "<text>", "Show the length of the text."},
- {INFO_COMMAND, 0, 1, 0, chanserv_level, {"LEVEL", NULL, NULL, NULL, NULL}, "<nick>", "Show users level."},
- {INFO_COMMAND, 0, 0, 0, chanserv_location_show, {"LOCATION?", NULL, NULL, NULL, NULL}, NULL, "Shows what servers are available and in use."},
- {PASSWORD_COMMAND, 0, 1, 0, chanserv_login, {"LOGIN", NULL, NULL, NULL, NULL}, "<password>", "Gives you access to high level bot commands if you are on the access list."},
-#ifdef ENABLE_STATUS
- {INFO_COMMAND, 1, 0, 0, chanserv_users_list, {"LUSERS", NULL, NULL, NULL, NULL}, NULL, ""},
-#endif
- {INFO_COMMAND, 0, 1, 0, chanserv_mask, {"MASK", NULL, NULL, NULL, NULL}, "<nick>", "Show the users user@host mask."},
-//#ifndef WIN32
- {INFO_COMMAND, 3, 0, 1, chanserv_memory, {"MEM", "RAM", NULL, NULL, NULL}, NULL, "Shows some memory usage and process statistics."},
-//#endif
-#ifdef ENABLE_METAR
- {NORMAL_COMMAND, 0, 1, 0, chanserv_metar, {"METAR", NULL, NULL, NULL, NULL}, "<city or code>", "Get raw METAR weather data."},
-#endif
- {DANGER_COMMAND, 3, 1, 0, chanserv_nick, {"NICK", "N", NULL, NULL, NULL}, "<newnick>", "Change bot's nickname, but not the default."},
-#ifdef ENABLE_CHANNEL
- {DANGER_COMMAND, 3, 1, 0, chanserv_op, {"OP", NULL, NULL, NULL, NULL}, "[#channel] <nicks>", "Add channel operator status to users."},
-#endif
- {INFO_COMMAND, 0, 0, 1, chanserv_os_show, {"OS", NULL, NULL, NULL, NULL}, NULL, "Show the operating system that bot is running on."},
- {PASSWORD_COMMAND, 0, 2, 0, chanserv_password, {"PASSWORD", "PASS", "PASSWD", NULL, NULL}, "<old password> <new password>", "Change your bot access list password."},
- {DANGER_COMMAND, 3, 0, 0, chanserv_performs, {"PERFORMS", NULL, NULL, NULL, NULL}, NULL, "Perform the tasks in the perform.ini startup script."},
-#ifdef ENABLE_CHANNEL
- {DANGER_COMMAND, 3, 1, 0, chanserv_perm_ban, {"PERMBAN", "SHITLIST", NULL, NULL, NULL}, "<user@host> [reason]", "Adds a user to the permanent ban list."},
- {INFO_COMMAND, 0, 0, 0, chanserv_perm_bans_list, {"PERMBANS?", NULL, NULL, NULL, NULL}, NULL, "Shows how many permanent bans there are."},
-#endif
-#ifdef ENABLE_CTCP
- {INFO_COMMAND, 0, 1, 0, chanserv_ping, {"\1PING", NULL, NULL, NULL, NULL}, "<>", ""},
-#endif
- {INFO_COMMAND, 0, 0, 0, chanserv_ping2, {"PING", NULL, NULL, NULL, NULL}, NULL, "Replies with \"PONG\" to see how lagged the bot is.."},
- {INFO_COMMAND, 0, 0, 0, chanserv_queue_show, {"SENDQ?", "QUE?", NULL, NULL, NULL}, NULL, "Shows how many items are ready to be displayed."},
-#ifdef ENABLE_QUIZ
- {SAFE_COMMAND, 0, 0, 0, chanserv_quiz, {"QUIZ", NULL, NULL, NULL, NULL}, NULL, ""},
-#endif
-#ifdef ENABLE_RANDQ
- {NORMAL_COMMAND, 0, 1, 0, chanserv_quote, {"QUOTE", NULL, NULL, NULL, NULL}, "[text]", "Shows a random quote."},
- {NORMAL_COMMAND, 0, 1, 0, chanserv_random_quote, {"RANDQUOTE", "RANDQ", NULL, NULL, NULL}, "[text]", "Shows a random quote."},
- {NORMAL_COMMAND, 0, 1, 0, chanserv_random_quote_2, {"RANDQUOTE2", "RANDQ2", NULL, NULL, NULL}, "[text]", "Shows a random quote."},
-#endif
-#ifdef ENABLE_RANDOM
- {NORMAL_COMMAND, RAND_LEVEL, 1, 0, chanserv_random_stuff, {"RANDOMSTUFF", "RANDSTUFF", "RS", NULL, NULL}, "<text>", "Add random stuff to say."},
- {INFO_COMMAND, 0, 0, 0, chanserv_random_stuff_list, {"RANDOMSTUFF?", "RANDSTUFF?", NULL, NULL, NULL}, NULL, "Shows time until next random thing is said."},
-#endif
- {DANGER_COMMAND, 3, 1, 0, chanserv_raw, {"RAW", NULL, NULL, NULL, NULL}, "<raw data>", "Get bot to send raw IRC data."},
-//#ifndef WIN32
- {INFO_COMMAND, 0, 0, 0, chanserv_rdb, {"RDB", NULL, NULL, NULL, NULL}, "[topic]", "Display information about the random databases."},
-//#endif
- {DANGER_COMMAND, 3, 3, 0, chanserv_repeat, {"REPEAT", "TIMER", NULL, NULL, NULL}, "<number> <delay> <raw data>", "Get bot to send raw IRC data a number of times."},
- {NORMAL_COMMAND, 1, 1, 0, chanserv_replace, {"REPLACE", NULL, NULL, NULL, NULL}, "<topic> <text>", "Replace the text of a topic."},
- {DANGER_COMMAND, 3, 0, 0, chanserv_restart, {"RESTART", "REHASH", NULL, NULL, NULL}, NULL, "Restart the bot."},
- {INFO_COMMAND, 0, 1, 0, chanserv_search, {"SEARCH", "LOOK", "FIND", NULL, NULL}, "<text>", "Search in the topics."},
- {INFO_COMMAND, 0, 1, 0, chanserv_seen, {"SEEN", NULL, NULL, NULL, NULL}, "<nick>", "Show the last time a user was seen."},
- {DANGER_COMMAND, 3, 1, 0, chanserv_jump, {"SERVER", "JUMP", NULL, NULL, NULL}, "<server> [port]", "Switch bot to a different server."},
- {DANGER_COMMAND, 3, 1, 0, chanserv_set, {"SET", NULL, NULL, NULL, NULL}, "<parameter>[=<new value>]", "Set or show the value of a setup.ini parameter. Usually requires a restart."},
- {DANGER_COMMAND, 1, 1, 0, chanserv_setinfo, {"SETINFO", NULL, NULL, NULL, NULL}, "<new user greeting|0>", "Set your greeting from the bot when you join a channel."},
- {SAFE_COMMAND, SLEEP_LEVEL, 0, 1, chanserv_sleep, {"SLEEP", "HUSH", NULL, NULL, NULL}, NULL, "Deactivate bot for a period."},
-#ifdef ENABLE_STATS
- {INFO_COMMAND, 0, 0, 0, chanserv_stats, {"STATS", NULL, NULL, NULL, NULL}, "[nick]", "Shows statistics about questions answered."},
-#endif
-#ifdef ENABLE_TAF
- {NORMAL_COMMAND, 0, 1, 0, chanserv_taf, {"TAF", NULL, NULL, NULL, NULL}, "<city or code>", "Get raw TAF weather data."},
-#endif
-#ifdef ENABLE_CHANNEL
- {DANGER_COMMAND, 2, 1, 0, chanserv_teaseop, {"TEASEOP", "TO", NULL, NULL, NULL}, "<nick>", "Tease a user with channel operator status."},
-#endif
- {INFO_COMMAND, 0, 2, 0, chanserv_tell, {"TELL", NULL, NULL, NULL, NULL}, "<nick> [ABOUT] <topic>", "Get bot to recall a topic to a user."},
-#ifdef ENABLE_CHANNEL
- {DANGER_COMMAND, 2, 0, 0, chanserv_topic, {"TOPIC", "T", NULL, NULL, NULL}, "<channel topic>", "Change the channels topic."},
-#endif
- {DANGER_COMMAND, 1, 1, 0, chanserv_unignore, {"UNIGNORE", NULL, NULL, NULL, NULL}, "<nick>", "Get bot to stop ignoring a user."},
- {INFO_COMMAND, 0, 1, 0, chanserv_unixtime, {"UNIXTIME", NULL, NULL, NULL, NULL}, "<time>", "Shows unixtime."},
-#ifdef ENABLE_CHANNEL
- {DANGER_COMMAND, 2, 0, 0, chanserv_up, {"UP", NULL, NULL, NULL, NULL}, NULL, "Add channel operator status to yourself."},
-#endif
-//#ifndef WIN32
- {INFO_COMMAND, 0, 0, 0, chanserv_uptime, {"UPTIME", NULL, NULL, NULL, NULL}, NULL, "Shows the uptime statistics for the computer the bot is running on."},
-//#endif
- {INFO_COMMAND, 1, 0, 0, chanserv_user_list, {"USERLIST", "HLIST", "ACCESS", NULL, NULL}, NULL, "Show the bot's access list."},
- {INFO_COMMAND, 0, 0, 0, chanserv_variables, {"VARIABLES", NULL, NULL, NULL, NULL}, NULL, "Displays variables you can use."},
-#ifdef ENABLE_CTCP
- {INFO_COMMAND, 0, 0, 0, chanserv_version, {"\1VERSION\1", NULL, NULL, NULL, NULL}, NULL, ""},
-#endif
-#ifdef ENABLE_CHANNEL
- {NORMAL_COMMAND, 3, 1, 0, chanserv_voice, {"VOICE", "V", NULL, NULL, NULL}, "[#channel] <nicks>", "Add channel voice status to users."},
-#endif
- {SAFE_COMMAND, SLEEP_LEVEL, 0, 0, chanserv_wakeup, {"WAKEUP", NULL, NULL, NULL, NULL}, NULL, "Reactivates bot from sleep mode."},
-#ifdef ENABLE_WEATHER
- {NORMAL_COMMAND, 0, 1, 0, chanserv_weather, {"WEATHER", NULL, NULL, NULL, NULL}, "<city or code>", "Get decoded weather data."},
-#endif
- {SAFE_COMMAND, 0, 2, 0, chanserv_where, {"WHAT", "WHO", "WHERE", NULL, NULL}, "<IS> [A|AN] <topic>", "Recall a topic."},
- {SAFE_COMMAND, 0, 2, 0, chanserv_whisper, {"WHISPER", NULL, NULL, NULL, NULL}, "<nick> [ABOUT] <topic>", "Get bot to recall a topic to a user privately."},
- {INFO_COMMAND, 4, 0, 0, NULL, {NULL, NULL, NULL, NULL, NULL}, NULL, NULL}
-};
-
-void chanserv(char *source, char *target, char *buf)
-{
- struct chanserv_output *result = NULL;
- char *cmd = NULL, *userhost = NULL, oldbuf[BUFSIZ] = {"NULL"},
- *ptr = NULL;
- int i = 0, j = 0, found = -1, command = 0, wakeup = 0, exempt = 0,
- more_needed = 0, too_many = 0, check_too_many = 0, arg_count = 0;
- enum chanserv_invoke_type input_type = DIRECT_INVOKE;
- enum chanserv_command_type command_type = NORMAL_COMMAND;
-
-#ifdef ENABLE_RANDOM
- if (strcasecmp (target, CHAN) == 0)
- Rand_Idle = 0;
-#endif
- stripline (buf);
- stripline (source);
- if (buf == NULL || target == NULL || source == NULL)
- return;
-
- /* Make a copy of the original buffer in a safe location for
- * later use. Strip the : if there is one.
- */
-
- strncpy (oldbuf, buf, sizeof (oldbuf));
-
- /* Pointer to oldbuf */
- ptr = oldbuf;
-
- if (*ptr == ':')
- ptr++;
-
- cmd = strtok (buf, " ");
-
- if (!cmd)
- return;
- if (*cmd == ':')
- cmd++;
-
- if ((userhost = strchr (source, '!')) != NULL)
- *userhost++ = '\0';
-
- if (check_ignore_user_ram(source) > 0)
- return;
-
- if (*target != '#' && *target != '&' && *target != '+')
- {
- input_type = MSG_INVOKE;
- }
- else if (strcasecmp (cmd, NICK_COMMA) == 0 ||
- strcasecmp (cmd, COLON_NICK) == 0 ||
- strcasecmp (cmd, BCOLON_NICK) == 0 ||
- strcasecmp (cmd, Mynick) == 0)
- {
- input_type = ADDRESS_INVOKE;
- cmd = strtok (NULL, " ");
- }
-
- if (cmd)
- {
- if (*cmd == *CMDCHAR)
- {
- cmd++;
- command = 1;
- input_type = CHAR_INVOKE;
- }
-
- strupr (cmd);
- for (i = 0; chanserv_commands[i].func != NULL; i++)
- {
- for (j = 0; chanserv_commands[i].command[j] != NULL; j++)
- {
- if (strcmp(cmd, chanserv_commands[i].command[j]) == 0)
- {
- found = i;
- command_type = chanserv_commands[found].type;
- check_too_many = chanserv_commands[found].too_many;
- if (strcmp(cmd, "WAKEUP") == 0)
- wakeup = 1;
- break;
- }
- }
- if (found != -1)
- break;
- }
- }
-
- if (input_type != MSG_INVOKE)
- {
- if (((Sleep_Toggle == 1) && (wakeup != 1)) || (cf(userhost, source, target)))
- return;
- add_user(target, source, userhost, 0); /* Unidle */
- }
-
- if (found != -1)
- {
- /*
- * password related commands can ONLY be done privately.
- * Every command can be done by /msg bot !command.
- * Every command can be done by /query bot !command.
- * Every command can be done by /msg bot !command.
- * Every danger command can be done by bot: !command.
- * Every danger command can be done by !command.
- * Every normal command can be done by /query bot command.
- * Every normal command can be done by /msg bot command.
- * Every safe command can be done by bot: command.
- * Every information command can be done by command.
- */
-
- switch (command_type)
- {
- case INFO_COMMAND :
- break;
-
- case SAFE_COMMAND :
- {
- if (input_type == DIRECT_INVOKE)
- return;
- break;
- }
-
- case NORMAL_COMMAND :
- {
- if (input_type == DIRECT_INVOKE)
- return;
- break;
- }
-
- case DANGER_COMMAND :
- {
- if (command != 1)
- return;
- break;
- }
-
- case PASSWORD_COMMAND :
- {
- if (input_type != MSG_INVOKE)
- return;
- break;
- }
- }
-
- if (check_access(userhost, (input_type == MSG_INVOKE) ? "#*" : target, 0, source) >= chanserv_commands[found].access)
- {
- char **args = NULL;
- int k = 0;
-
- /* Use the char count of spaces in our oldbuf ptr. Since
- * it has the cmd tacked on the beginning, the number of
- * spaces gives us an accurate early number of arguments
- * supplied by the user, because the count of spaces will
- * return one more than the actual number of args supplied.
- * The first word is the cmd, so we don't want this counted.
- * This is sort of a lazy way of counting arguments before
- * they're actually read into a buffer and dealt with.
- *
- * This allows us to "break out" of the command routine if
- * we've entered accidentally by user input. Such instances
- * may be if the user says "info things stuff", the bot
- * realizes this is not a command, but normal conversation,
- * and will respond if the topic is in it's database. If it's
- * not found, the bot either ignores it or responds with a
- * whut reply if addressed directly. This code is only
- * intended for commands which have no arguments.
- */
-
- if (*ptr == '!')
- ptr++;
-
- /* Actual number of arguments supplied. */
- k = count_char (ptr, ' ');
-
- /* Number of arguments expected. */
- arg_count = chanserv_commands[found].arg_count;
-
- if (k > 0)
- {
- args = calloc(k, sizeof(char *));
- if (args)
- {
- for (i = 0; i < k; i++)
- {
- args[i] = strtok(NULL, " ");
- }
- args[i++] = NULL;
-
- /* Check for more arguments needed, but don't
- * bail out, we'll take care of it later. */
- if (i < arg_count)
- more_needed = 1;
- }
- else
- return;
-
- /* Check for too many args on special cases. */
- if (check_too_many == 1)
- {
- if ((input_type == ADDRESS_INVOKE) && (k > (arg_count+1)))
- too_many = 1;
- if ((k > arg_count) && (input_type == DIRECT_INVOKE))
- too_many = 1;
- if ((k > arg_count) && (input_type == MSG_INVOKE))
- too_many = 1;
- if ((k > arg_count) && (input_type == CHAR_INVOKE))
- return;
- }
- }
-
- if (too_many == 1)
- {
- int i = 0;
- char *ptr2 = NULL;
-
- strlwr (ptr);
-
- for (i = 0; i < strlen (ptr); i++)
- {
- if (ptr[i] == ' ')
- ptr[i] = '+';
- }
-
-
- /* Strip the bot's nickname if ADDRESS_INVOKE */
-
- if (input_type == ADDRESS_INVOKE)
- {
- ptr2 = strtok (ptr, "+");
- ptr = strtok (NULL, "");
- }
-
- /* Output only if the topic exists. If the bot was
- * addressed by nickname (ADDRESS_INVOKE), output
- * anyway because show_url will supply a DUNNO
- * response.
-
- * If the input_type was MSG_INVOKE, we use the
- * source as a target, because the target ends up
- * being set to the bot's own nickname due to the
- * parsing under certain conditions.
- */
-
- if (check_existing_url(source, ptr, target) == 1)
-// || (input_type == ADDRESS_INVOKE)
-// || (input_type == MSG_INVOKE))
- {
- show_url(source, ptr,
- ((input_type == MSG_INVOKE)
- ? source : target), 1, 0, userhost, 0);
- return;
- }
- /* No matching database entry. */
- return;
- }
- else if ((more_needed == 1) && chanserv_commands[found].syntax)
- {
- result = chanserv_show_help(cmd, check_access(userhost, (input_type == MSG_INVOKE) ? "#*" : target, 0, source));
- }
- else
- {
- /* We call this to give the command a chance to supply
- * a custom error msg if there are not enough
- * arguments. Because it fell through the loop
- * this far, we assume it's a normal command with
- * arguments to be parsed.
- */
-
- result = chanserv_commands[found].func(source, target, cmd, args, input_type, userhost);
- }
-
- if (result)
- {
- struct chanserv_output *output = result;
-
- i = 1;
- while (output)
- {
- char *s, *s2, c;
- int length, len;
-
-/* RFC2812 says max packet length is 512, including CR-LF at end.
- * Also a colon and a space at the beginning.
- */
-//#define MAX_IRC_LEN 507 // This doesn't work.
-#define MAX_IRC_LEN 475 // This works.
-
- s = output->output;
- length = strlen(s);
- if (input_type == MSG_INVOKE)
- {
- len = 12 + strlen(source);
- while ((len + length) > MAX_IRC_LEN)
- {
- c = s[MAX_IRC_LEN - len];
- s[MAX_IRC_LEN - len] = '\0';
- s2 = strrchr(s, ' ');
- *s2 = '\0';
- S("NOTICE %s :%s\n", source, s);
- db_sleep(2);
- *s2 = ' ';
- s[MAX_IRC_LEN - len] = c;
- s = s2 + 1;
- length = strlen(s);
- }
- S("NOTICE %s :%s\n", source, s);
- }
- else
- {
- len = 16 + strlen(target) + strlen(source);
- while ((len + length) > MAX_IRC_LEN)
- {
- c = s[MAX_IRC_LEN - len];
- s[MAX_IRC_LEN - len] = '\0';
- s2 = strrchr(s, ' ');
- *s2 = '\0';
- S("PRIVMSG %s :%s: %s\n", target, source, s);
- db_sleep(2);
- *s2 = ' ';
- s[MAX_IRC_LEN - len] = c;
- s = s2 + 1;
- length = strlen(s);
- }
- S("PRIVMSG %s :%s: %s\n", target, source, s);
- }
- output = output->next;
- }
- chanserv_output_free(result);
- }
- free(args);
- }
- }
- else if (input_type != CHAR_INVOKE)
- {
- if ((input_type == ADDRESS_INVOKE) && (cmd == NULL))
- {
- if (RANDOM_WHUT == true)
- do_randomtopic(WHUTR, target, WHUT_FILE, source, cmd);
- else
- {
- if (input_type == MSG_INVOKE)
- S("NOTICE %s :%s\n", source, WHUT);
- else
- S("PRIVMSG %s :%s: %s\n", target, source, WHUT);
- }
- }
- else if ((GENERAL_QUESTIONS) && (cmd))
- {
- show_url(source, get_multiword_topic(cmd),
- (input_type == MSG_INVOKE) ? source : target,
- (! (input_type == DIRECT_INVOKE)),
- (input_type == DIRECT_INVOKE),
- userhost, 0);
- }
- }
-}
-
-struct chanserv_output *chanserv_show_help(char *cmd, int user_level)
-{
- struct chanserv_output *result = NULL;
- char temp[10 * 1024] = { 0 }, cmdchar[2] = "\0\0";
- int i, j, found = -1;
-
- if (*cmd == *CMDCHAR)
- cmd++;
- strupr(cmd);
- for (i = 0; chanserv_commands[i].func != NULL; i++)
- {
- for (j = 0; chanserv_commands[i].command[j] != NULL; j++)
- {
- if (strcmp(cmd, chanserv_commands[i].command[j]) == 0)
- {
- found = i;
- break;
- }
- }
- if (found != -1)
- break;
- }
-
- if (found != -1)
- {
- if (chanserv_commands[found].type == DANGER_COMMAND)
- cmdchar[0] = *CMDCHAR;
- else
- cmdchar[0] = '\0';
- for (j = 0; chanserv_commands[found].command[j] != NULL; j++)
- {
- if (j)
- strcat(temp, " | ");
- if (chanserv_commands[i].type == DANGER_COMMAND)
- strcat(temp, cmdchar);
- strcat(temp, chanserv_commands[found].command[j]);
- }
- result = chanserv_asprintf(result, "%s [level %d] - %s SYNTAX - %s%s %s", temp, chanserv_commands[found].access, chanserv_commands[found].summary, cmdchar, cmd,
- (chanserv_commands[found].syntax != NULL) ? chanserv_commands[found].syntax : "");
- }
- else if (strcmp(cmd, "COMMANDS") == 0)
- {
- cmdchar[0] = *CMDCHAR;
- for (i = 0; chanserv_commands[i].func != NULL; i++)
- {
- if (chanserv_commands[i].access <= user_level)
- {
- if (chanserv_commands[i].command[0][0] > 10)
- {
- if (i)
- strcat(temp, " ");
- if (chanserv_commands[i].type == DANGER_COMMAND)
- strcat(temp, cmdchar);
- strcat(temp, chanserv_commands[i].command[0]);
- }
- }
- }
- result = chanserv_asprintf(result, "%s", temp);
- }
- else if (strcmp(cmd, "PARAMETERS") == 0)
- {
- for (i = 0; parameters[i].parameter[0] != NULL; i++)
- {
- if (parameters[i].access <= user_level)
- {
- if (i)
- strcat(temp, " ");
- strcat(temp, parameters[i].parameter[0]);
- }
- }
- result = chanserv_asprintf(result, "%s", temp);
- }
- else
- {
- for (i = 0; parameters[i].parameter[0] != NULL; i++)
- {
- for (j = 0; parameters[i].parameter[j] != NULL; j++)
- {
- if (strcmp(cmd, parameters[i].parameter[j]) == 0)
- {
- found = i;
- break;
- }
- }
- if (found != -1)
- break;
- }
-
- if (found != -1)
- {
- for (j = 0; parameters[found].parameter[j] != NULL; j++)
- {
- if (j)
- strcat(temp, " | ");
- strcat(temp, parameters[found].parameter[j]);
- }
-
- switch (parameters[found].type)
- {
- case ST_BOOLEAN :
- {
- bool *variable = parameters[found].value;
-
- result = chanserv_asprintf(result, "%s [level %d] - %s VALUE - %s = %s", temp, parameters[found].access, parameters[found].summary, cmd, (*variable) ? "true" : "false");
- break;
- }
-
- case ST_INTEGER :
- {
- long *variable = parameters[found].value;
-
- result = chanserv_asprintf(result, "%s [level %d] - %s VALUE - %s = %ld", temp, parameters[found].access, parameters[found].summary, cmd, *variable);
- break;
- }
-
- case ST_STRING :
- {
- char *variable = parameters[found].value;
-
- result = chanserv_asprintf(result, "%s [level %d] - %s VALUE - %s = %s", temp, parameters[found].access, parameters[found].summary, cmd, variable);
- break;
- }
- }
- }
- }
-
- return result;
-}
-
-int check_exempt (char *cmd)
-{
- int i = 0;
- int j = 0;
- int k = 0;
-
- char *exempt_items[] = {
- "CYCLE",
- "HELP",
-#ifdef ENABLE_STATS
- "STATS",
-#endif
- NULL
- };
-
- strupr(cmd);
-
- for (i = 0; chanserv_commands[i].func != NULL; i++)
- {
- for (j = 0; chanserv_commands[i].command[j] != NULL; j++)
- {
- if (strcmp (cmd, chanserv_commands[i].command[j]) == 0)
- {
- for (k = 0; exempt_items[k] != NULL; k++)
- {
- if (strcmp (chanserv_commands[i].command[j], exempt_items[k]) == 0)
- {
- strlwr(cmd);
- return 1;
- }
- }
- }
- }
- }
-
- strlwr(cmd);
- return 0;
-}
-
diff --git a/beta/source/comm.c b/beta/source/comm.c
deleted file mode 100755
index 5bd4f66..0000000
--- a/beta/source/comm.c
+++ /dev/null
@@ -1,451 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-/**
- * Delete one or more elements from the sendq
- * 1 = delete all pri/not's
- * 0 = delete first in queue
- * 6/23/00 Dan
- * - Updated to use head and tail pointer queue
- * - All variables now initialized when declared
- * - Optimized the main while loop a bit, reduced amount of code
- */
-void
-del_sendq (long toggle)
-{
- struct sendq *pNode = sendqhead, *pPrev = 0;
-
- if (NULL == sendqhead)
- {
- return;
- }
-
- if (toggle == 0)
- {
- /* Just delete the head */
- pNode = sendqhead;
- sendqhead = sendqhead->next;
-
- free (pNode);
- }
- else
- {
- /* Iterate through the queue and delete each element which is
- * a PRIVMSG or NOTICE
- */
- for (; pNode != NULL; pPrev = pNode, pNode = pNode->next)
- {
- if (0 == strncmp (pNode->data, "PRI", 3) || 0 == strncmp (pNode->data, "NOT", 3))
- {
- /* Found one, let's delete it */
- if (pPrev != NULL)
- {
- pPrev->next = pNode->next;
- }
- else
- {
- sendqhead = pNode->next;
- }
- free (pNode);
- pNode = NULL;
- break;
- }
- } /* for */
- } /* else */
-
- /* Update the tail pointer if needed */
- if (NULL == sendqhead)
- {
- sendqtail = NULL;
- }
-}
-
-int
-get_sendq_count (long toggle)
-{
- struct sendq *c;
- long i = 0, x = 0;
-
- c = sendqhead;
- while (c != NULL)
- {
- i++;
- if (c->data[0] == 'P' && c->data[1] == 'R' && c->data[2] == 'I')
- x++;
- else if (c->data[0] == 'N' && c->data[1] == 'O' && c->data[2] == 'T')
- x++;
- c = c->next;
- }
- if (toggle == 1)
- clear_sendq (i, 1);
- if (toggle == 2)
- return i;
-
- if (i < OUTPUT1_COUNT)
- SEND_DELAY = OUTPUT1_DELAY;
- else if (i < OUTPUT2_COUNT)
- SEND_DELAY = OUTPUT2_DELAY;
- else
- SEND_DELAY = OUTPUT3_DELAY;
- if (x > OUTPUT_PURGE_COUNT)
- clear_sendq (x, 0);
- return i;
-}
-
-void
-clear_sendq (long count, long toggle)
-{
- long i = 0;
-
- i = count;
- while (i > 1)
- {
- i--;
- del_sendq (1);
- }
- send_tog = 1;
- if (toggle != 1)
- L090 (CHAN, count);
-}
-
-long
-setinfo_lastcomm (char *rest)
-{ /* Disallows joins to more than one channel (or the same chan)
- * to artifically raise join counters */
- long c_uptime = 0;
-
- if (strcasecmp (rest, slc1) == 0)
- return 1; /* don't reply if already asked in LASTCOMM_TIME sec */
- if (strcasecmp (rest, slc2) == 0)
- return 1;
- if (strcasecmp (rest, slc3) == 0)
- return 1;
- if (strcasecmp (rest, slc4) == 0)
- return 1;
- if (*slc1 == '0')
- { /* init lastcomms */
- strncpy (slc1, rest, sizeof (slc1));
- slcn1 = time (NULL);
- }
- if (*slc2 == '0')
- {
- strncpy (slc2, rest, sizeof (slc2));
- slcn2 = time (NULL);
- }
- if (*slc3 == '0')
- {
- strncpy (slc3, rest, sizeof (slc3));
- slcn3 = time (NULL);
- }
- if (*slc4 == '0')
- {
- strncpy (slc4, rest, sizeof (slc4));
- slcn4 = time (NULL);
- }
- if ((c_uptime = time (NULL) - slcn1) > SLASTCOMM_TIME)
- { /* reinit old data */
- slcn1 = 0;
- *slc1 = '0';
- }
- if ((c_uptime = time (NULL) - slcn2) > SLASTCOMM_TIME)
- {
- slcn2 = 0;
- *slc2 = '0';
- }
- if ((c_uptime = time (NULL) - slcn3) > SLASTCOMM_TIME)
- {
- slcn3 = 0;
- *slc3 = '0';
- }
- if ((c_uptime = time (NULL) - slcn4) > SLASTCOMM_TIME)
- {
- slcn4 = 0;
- *slc4 = '0';
- }
- strncpy (slc4, slc3, sizeof (slc4)); /* no matches, move em on
- down */
- strncpy (slc3, slc2, sizeof (slc3));
- strncpy (slc2, slc1, sizeof (slc2));
- strncpy (slc1, rest, sizeof (slc1));
- slcn4 = slcn3;
- slcn3 = slcn2;
- slcn2 = slcn1;
- slcn1 = time (NULL);
- return 0;
-}
-
-long
-do_lastcomm (char *nick, char *target, char *rest)
-{
- long c_uptime = 0;
-
- if (strcasecmp (rest, lc1) == 0)
- return 1; /* don't reply if already asked in LASTCOMM_TIME sec */
- if (strcasecmp (rest, lc2) == 0)
- return 1;
- if (strcasecmp (rest, lc3) == 0)
- return 1;
- if (strcasecmp (rest, lc4) == 0)
- return 1;
- if (*lc1 == '0')
- { /* init lastcomms */
- strncpy (lc1, rest, sizeof (lc1));
- lcn1 = time (NULL);
- }
- if (*lc2 == '0')
- {
- strncpy (lc2, rest, sizeof (lc2));
- lcn2 = time (NULL);
- }
- if (*lc3 == '0')
- {
- strncpy (lc3, rest, sizeof (lc3));
- lcn3 = time (NULL);
- }
- if (*lc4 == '0')
- {
- strncpy (lc4, rest, sizeof (lc4));
- lcn4 = time (NULL);
- }
- if ((c_uptime = time (NULL) - lcn1) > LASTCOMM_TIME)
- { /* reinit old data */
- lcn1 = 0;
- *lc1 = '0';
- }
- if ((c_uptime = time (NULL) - lcn2) > LASTCOMM_TIME)
- {
- lcn2 = 0;
- *lc2 = '0';
- }
- if ((c_uptime = time (NULL) - lcn3) > LASTCOMM_TIME)
- {
- lcn3 = 0;
- *lc3 = '0';
- }
- if ((c_uptime = time (NULL) - lcn4) > LASTCOMM_TIME)
- {
- lcn4 = 0;
- *lc4 = '0';
- }
- strncpy (lc4, lc3, sizeof (lc4)); /* no matches, move em on
- down */
- strncpy (lc3, lc2, sizeof (lc3));
- strncpy (lc2, lc1, sizeof (lc2));
- strncpy (lc1, rest, sizeof (lc1));
- lcn4 = lcn3;
- lcn3 = lcn2;
- lcn2 = lcn1;
- lcn1 = time (NULL);
- return 0;
-}
-
-void
-prepare_bot (void)
-{
- int esc = 0;
-
- while (!esc)
- {
- gs26 ();
- printf (".: Connecting to %s:%ld\t\r", BS, BP);
- fflush (stdout);
- db_sleep (2);
-
- socketfd = create_connection (BS, VHOST, BP);
-
- switch (socketfd)
- {
-
- case ERR_TIMED_OUT:
- printf (".: Connection to %s:%ld timed out!\t\r", BS, BP);
- fflush (stdout);
- db_sleep (2);
- break;
-
- case ERR_CONN_REFUSED:
- printf (".: Connection to %s:%ld was refused!\t\r", BS, BP);
- fflush (stdout);
- db_sleep (2);
- break;
-
- case ERR_NOT_ADDR:
- printf ("Address not in range!\n");
- exit (1);
-
- case ERR_NO_REACH:
- printf ("Address not reachable!\n");
- exit (1);
-
- default:
- esc = 1;
- printf
- (".: Connected to %s:%ld! [%ld]\t\n", BS, BP, (long) getpid ());
-
- fflush (stdout);
- db_sleep (5);
- break;
- }
- }
-
- /* set the socket to BLOCK */
- if (fcntl (socketfd, F_SETFL, 0) < 0)
- {
- printf ("\n");
- perror ("fcntl");
- exit (EXIT_FAILURE);
- }
-}
-
-int
-create_connection (char *server, char *virtualhost, long port)
-{
- struct sockaddr_in name;
- struct hostent *hostname;
- struct timeval timeout;
- fd_set set;
- int sock = 0, vhost = 1, sockerr = 0,
- optlen = sizeof (sockerr);
-
- if ((!virtualhost) || (strlen (virtualhost) < 1))
- vhost = 0;
-
- if ((sock = socket (AF_INET, SOCK_STREAM, 0)) < 0)
- return -1;
-
- memset (&name, 0, sizeof (struct sockaddr_in));
-
- setsockopt (sock, SOL_SOCKET, SO_LINGER, 0, 0);
- setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, 0, 0);
- setsockopt (sock, SOL_SOCKET, SO_KEEPALIVE, 0, 0);
-
- name.sin_family = AF_INET;
- name.sin_addr.s_addr = (vhost ? inet_addr (virtualhost) : INADDR_ANY);
-
- if ((name.sin_addr.s_addr == -1) && vhost)
- {
- hostname = gethostbyname (virtualhost);
- if (hostname)
- {
- name.sin_addr = *(struct in_addr *) hostname->h_addr;
- }
- else
- {
- name.sin_addr.s_addr = INADDR_ANY;
- }
- }
- if (bind (sock, (struct sockaddr *) &name, sizeof (struct sockaddr_in)) < 0)
- {
- printf ("\n");
- perror ("bind");
- close (sock);
- exit (EXIT_FAILURE);
- }
-
- memset (&name, 0, sizeof (struct sockaddr_in));
- name.sin_family = AF_INET;
- name.sin_port = htons (port);
-
- if(!(hostname = gethostbyname (server)))
- {
- printf ("\nCan't create the connection!\n");
- // FIXME: This is obsolete, and solaris doesn't know about it.
-// herror ("hostname");
- exit (EXIT_FAILURE);
- }
-
- name.sin_addr = *(struct in_addr *) hostname->h_addr;
-
- /* set the file descriptor to non blocking mode so that connect()
- returns immediately.
- */
-
- if (fcntl (sock, F_SETFL, O_NONBLOCK) < 0)
- {
- printf ("\n");
- perror ("fcntl");
- exit (EXIT_FAILURE);
- }
-
- if (connect (sock, (struct sockaddr *) &name, sizeof (name)) < 0)
- {
- if ((errno != EINPROGRESS) && (errno != ENOENT))
- {
- printf ("\n");
- perror ("connect");
- exit (EXIT_FAILURE);
- }
- }
-
- alarm (0);
-
- while (1)
- {
- /* set the timeout */
- timeout.tv_sec = CONNECT_WAIT_TIMEOUT;
- timeout.tv_usec = 0;
-
- /* set the file descriptor to be empty */
- FD_ZERO (&set);
-
- /* add our socket to the file descriptor set */
- FD_SET (sock, &set);
-
- /* select will let us know when our socket is ready (connected) */
- switch (select (FD_SETSIZE, (fd_set *) NULL, &set, (fd_set *) NULL, &timeout))
- {
- /* if select returns 0, our timeout was reached */
- case 0:
- alarm (AIL);
- return ERR_TIMED_OUT;
-
- /* -1 means we are not connected */
- case -1:
- break;
-
- /* we MIGHT be connected */
- default:
-
- /* get the socket errno so we can check if we are connected */
- switch (getsockopt (sock, SOL_SOCKET, SO_ERROR, &sockerr, &optlen))
- {
- case -1:
- alarm (AIL);
- return ERR_SOCK_OPT;
-
- case 0:
- switch (sockerr)
- {
- case ECONNREFUSED:
- alarm (AIL);
- return ERR_CONN_REFUSED;
-
- case EADDRNOTAVAIL:
- alarm (AIL);
- return ERR_NOT_ADDR;
-
- case ENETUNREACH:
- alarm (AIL);
- return ERR_NO_REACH;
-
- case SUCCESS:
- alarm (AIL);
- return sock;
- }
- }
- }
- }
-}
-
-
-void
-register_bot (void)
-{
- get_sendq_count (1);
- Snow ("NICK %s\n", Mynick);
- strlwr (UID);
- Snow ("USER %s %d %d :%s \2%d\2\n", UID, time (NULL), time (NULL), REALNAME, NUM_HELPER);
-
- if (BPASS != NULL)
- Snow ("PASS :%s\n", BPASS);
-}
diff --git a/beta/source/convertdb.c b/beta/source/convertdb.c
deleted file mode 100755
index 0e3ca10..0000000
--- a/beta/source/convertdb.c
+++ /dev/null
@@ -1,106 +0,0 @@
-#include "defines.h"
-
-#define STRING_SHORT 512
-char DAT_DIR[STRING_SHORT] = { 0 };
-
-// FIXME: This may not be compatible with putting all exes into $prefix/bin.
-// Under cygwin the executable should be placed on Darkbot's root dir
-// due to the necessity of cygwin dynamic library.
-
-int main(int argc, char *argv[])
-{
- FILE *in, *out;
- char *ptr = NULL;
- const char *salt = "8fei3k";
- char userlist[STRING_SHORT] = { 0 };
- char tempfile[STRING_SHORT] = { 0 };
- char temp[STRING_SHORT] = { 0 };
- char channel[1024] = { 0 };
- char uh[1024] = { 0 };
- char level[10] = { 0 };
- char joins[10] = { 0 };
- char pass[1024] = { 0 };
- char setinfo[1024] = { 0 };
- struct stat st;
-
- printf("\nDarkbot USERLIST.DB < 7f0 conversion utility.\n");
- printf("IMPORTANT :: READ THIS!\n\n");
- printf("This UTILITY is for converting *OLD* (pre 7f0) userlist's\n");
- printf("to the new encrypted format.\n\n");
- printf("Use this utility ONLY if:\n");
- printf(" - You have copied your pre 7f0 userlist.db in to the dat directory\n\n");
- printf("DO NOT use this utility if:\n");
- printf(" - You have created a brand new darkbot, and have no users\n\n");
-
- if(argc < 2)
- {
- printf("Syntax: %s -convert\n\n", argv[0]);
- return 0;
- }
-
- if(argc > 1)
- {
- if(strcmp(argv[1], "-convert") != 0)
- {
- printf("Syntax: %s -convert\n\n", argv[0]);
- return 0;
- }
- }
-
-#ifdef DATABASEDIR
- strncpy (DAT_DIR, DATABASEDIR, sizeof (DAT_DIR));
-#else
- strncpy (DAT_DIR, "dat", sizeof (DAT_DIR));
-#endif
-#ifdef SOURCEDIR
- /* Check if this is being run from the build directory before being installed. */
- snprintf(temp, sizeof(temp), "%s/dat/setup.ini", SOURCEDIR);
- if (stat(temp, &st) >= 0)
- {
- snprintf(temp, sizeof(temp), "%s/dat", SOURCEDIR);
- strncpy(DAT_DIR, temp, sizeof (DAT_DIR));
- }
-#endif
-
- snprintf(userlist, sizeof(userlist), "%s/userlist.db", DAT_DIR);
- snprintf(tempfile, sizeof(tempfile), "%s/temp.db", DAT_DIR);
-
- printf("Converting %s ...\n", userlist);
-
- if((in = fopen(userlist, "r")) == NULL)
- {
- printf("\nCan't open %s for reading!\n", userlist);
- return EXIT_FAILURE;
- } if((out = fopen(tempfile, "wt")) == NULL)
- {
- printf("\nCan't open %s for writing!\n", tempfile);
- return EXIT_FAILURE;
- }
-
- snprintf(temp, sizeof(temp), "cp %s %s/backup.db", userlist, DAT_DIR);
- system(temp);
-
- while(!feof(in))
- {
- fscanf(in, "%s %s %s %s %s %[^\n]s", channel, uh, level, joins, pass, setinfo);
-
-#ifdef ENABLE_ENCRYPT
- if ((ptr = crypt(pass, salt)) == NULL)
- {
- printf("\ncrypt() error\n");
- return EXIT_FAILURE;
- }
-#endif
- if(!feof(in))
- fprintf(out, "%s %s %s %s %s %s\n", channel, uh, level, joins, ptr, setinfo);
- }
- fclose(in);
- fclose(out);
-
- remove(userlist);
- rename(tempfile, userlist);
-
- printf("Conversion Complete.\n");
-
- return EXIT_SUCCESS;
-}
diff --git a/beta/source/defines.h b/beta/source/defines.h
deleted file mode 100755
index 7f8a607..0000000
--- a/beta/source/defines.h
+++ /dev/null
@@ -1,344 +0,0 @@
-/* @configure_input@ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-/* defines.h
- *** Darkbot (c) 2002
- * The Internet Relay Chat Talking Robot
- *
- *** Darkbot Creator - Jason Hamilton (play) Jason@superlink.net
- * Project Administrator - LuizCB (Pincel) LuizCB@darkbot.info
- * Recent Code Modifications - Ron (`ron) ron@freezedown.org
- *
- * Official Sites: http://www.freezedown.org
- * http://darkbot.sourceforge.net
- *
- *** For any questions, suggestions, malfunctions, etc
- * Use our support forum at http://forum.freezedown.org
- *
- * *******************************---******************************* */
-/*
- *** NOTES - READ before you start:
- *** Lines beginning by # (hash) are peprocessor directives, they are not
- * comments. You should NOT remove them.
- *** #defines should only be changed to ON, OFF, #define, #undef
- * or it's value defined on the very right end.
- *** Areas between " " are messages Darkbot will send. Do not remove " ".
- *** Double slash characters on de beginning of a line or slaches followed
- * or preceded by * on the beginning and end of lines envolving some
- * portion of text are comment characters combinations with help
- * information for the delelopers or users. They do not have any effect
- * in the behavior of the program.
- *
- ,-----------------------------------------------------------------,
- | Note that the defines bellow are the RECOMMENDED settings! |
- | Modify it by changing it's values of the data. This file will |
- | instruct the compiler to build the executable file. If you're |
- | not sure of what to do, leave the default settings alone :) |
- `-----------------------------------------------------------------' */
-
-#define ON 1
-#define OFF 0
-
-
-/* ================ SYSTEM REQUIREMENTS ================ */
-
-/*
- * Change the Ansi C signal handling below if it's not in the standard place,
- * usually on include/. Leave it as is if you don't know what that is. Type
- * 'man signal' on your unix box for more info.
- * (default = <signal.h>)
- */
-//#include <signal.h>
-
-/*
- * Most BSD systems will not need this. If your bot will
- * connect but don't react at all try turning this ON.
- * (default = OFF)
- */
-
-//#define NEED_LIBC5 OFF
-
-/*
- * SGI boxes (ie; IRIX system) need this
- * define to run. (default = OFF)
- */
-//#define SGI OFF
-
-
-/*
- * If you change anything on the next 5 directives be careful not to
- * remove or change the position of '%s' nor anything outside quotes.
- */
-#define L100(s,a,b,c,d,e,f) S("NOTICE %s :I can be triggered by various \
-forms of speech, all which must be addressed to me, in one of the \
-following formats: %s %s %s or even %s .... In my database, you can \
-find a topic by saying my nick, <topic> . eg; \37%s nuke\37 ..... \
-to do a search on a word, or partial text, just type: <mynick>, search \
-<text> ... eg; \37%s search nuke\37\n",s,a,b,c,d,e,f)
-
-#define L101(a,b,c,d) S("NOTICE %s :I can also be triggered with even more \
-human formats: \37%s who is bill gates?\37 .. You can also phrase it \
-in a question: \37%s where is msie?\37 ...For more info \
-about me, visit http://www.freezedown.org\n",a,b,c,d)
-
-#define L102(a,b,c,d) S("NOTICE %s :Welcome to %s, %s. Before \
-asking your question, type %cHELP for a list of help topics.\n", a,b,c,d)
-
-/* *******************************---******************************* */
-/* --------------- Don't change anything else below! --------------- */
-/* ***************************************************************** */
-
-
-//#include <sys/cdefs.h>
-//#include <sys/param.h>
-//#include <pwd.h>
-
-
-/* Here we sort out what to do based on some autoconf detected things. */
-#if defined _WIN32 || defined __CYGWIN__ || defined __CYGWIN32__ || defined __MINGW32__
-# ifndef WIN32
-# define WIN32
-# endif
-#endif
-
-#define _GNU_SOURCE 1
-
-#if HAVE_ANSIDECL_H
-#include <ansidecl.h>
-#endif
-#include <ctype.h>
-#include <limits.h>
-#include <stddef.h>
-
-#if HAVE_ERRNO_H
-# include <errno.h>
-#endif
-#ifndef errno
-extern int errno;
-#endif
-
-#if HAVE_NETDB_H
-# include <netdb.h>
-#endif
-#if HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-#if HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-#endif
-#include <assert.h>
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-#ifdef WIN32
-# include <windows.h>
-#endif
-
-#include <signal.h>
-#include <sys/stat.h>
-
-#include <stdio.h> /* The only one we can guarantee. */
-
-#if HAVE_STDBOOL_H
-# include <stdbool.h>
-#else
-# if ! HAVE__BOOL
-# ifdef __cplusplus
-typedef bool _Bool;
-# else
-typedef unsigned char _Bool;
-# endif
-# endif
-# define bool _Bool
-# define false 0
-# define true 1
-# define __bool_true_false_are_defined 1
-#endif
-
-#if STDC_HEADERS
-# include <string.h>
-# include <stdarg.h>
-# include <stdlib.h>
-#else
-# if !HAVE_STRCHR
-# define strchr index
-# define strrchr rindex
-# endif
-char *strchr (), *strrchr ();
-# if !HAVE_MEMMOVE
-# define memcpy(d, s, n) bcopy ((s), (d), (n))
-# define memmove(d, s, n) bcopy ((s), (d), (n))
-# endif
-#endif
-
-#if HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-
-#if HAVE_UNISTD_H
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif
-
-/* MacOS X is happier with this one AFTER timeval is declared. */
-#include <sys/resource.h>
-
-#include "stat-macros.h"
-#include "minmax.h"
-
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# define EXIT_FAILURE 1
-#endif
-
-#if !LSTAT_FOLLOWS_SLASHED_SYMLINK
-extern int rpl_lstat (const char *name, struct stat *buf);
-# undef lstat
-# define lstat rpl_lstat
-#endif
-
-#if !HAVE_MEMSET
-# define memset rpl_memset
-#endif
-
-#if !HAVE_NANOSLEEP
-# define nanosleep rpl_nanosleep
-#endif
-
-#if !HAVE_SNPRINTF
-# define snprintf rpl_snprintf
-#endif
-
-#if !HAVE_STRCASECMP
-# define strcasecmp rpl_strcasecmp
-#endif
-
-#if !HAVE_STRCASESTR
-# define strcasestr rpl_strcasestr
-#endif
-
-#if !HAVE_STRNDUP
-extern char *rpl_strndup (const char *dupMe, size_t maxBytes);
-# undef strndup
-# define strndup rpl_strndup
-#endif
-
-#if !HAVE_STRSPN
-# define strspn rpl_strspn
-#endif
-
-#if !HAVE_STRSTR
-# define strstr rpl_strstr
-#endif
-
-#if !HAVE_VPRINTF
-# define vsprintf rpl_vsprintf
-# define vfprintf rpl_vfprintf
-#endif
-
-#if !HAVE_LIBCRYPT
-# if !HAVE_CRYPT
-# define crypt rpl_crypt
-# endif
-#endif
-
-
-/* -------------------------------------------------- */
-
-
-#define FR 3 /* these two are the # of lines per secs */
-#define FT 3
-#define AIL 1
-#define WSEC 10
-#define USEC 0
-#define RECHECK 45
-#define DEFAULT_DBTIMERS_PATH "timers"
-#define DEFAULT_LOG_DIR "logs/"
-#define DEFAULT_RDB_DIR "rdb"
-#ifdef ENABLE_STATS
-#define DEFAULT_STATS_FILE "stats.db"
-#endif
-#define DEFAULT_SEEN_FILE "seen.db"
-#define DEFAULT_URL2 "info2.db"
-#define DUNNO_FILE "dunno"
-#define WHUT_FILE "whut"
-#define DEFAULT_BACKUP_DUP "backup_dups.db"
-#define DEFAULT_ADD_DELETES "logs/add_delete.log"
-#define TMP_URL ".info.tmp"
-#define TMP_FILE ".file.tmp"
-#define DEFAULT_AUTOTOPIC_F "autotopic.ini"
-#define DEFAULT_HELPER_LIST "userlist.db"
-#define DEFAULT_QUIZ_FILE "quiz.db"
-#define DEFAULT_PERFORM "perform.ini"
-#define DEFAULT_DEOP "deop.ini"
-#define DEFAULT_RAND_SAY "random.ini"
-#define DEFAULT_RAND_FILE "randomstuff.ini"
-#define DEFAULT_RANDQ_TEMPFILE "randq.tmp"
-#define DEFAULT_RAND_BACKUP_FILE "randomstuff.bak"
-#define DEFAULT_SERVERS "servers.ini"
-#define DEFAULT_PERMBAN "permbans.db"
-#define DEFAULT_SETUP "setup.ini"
-#define MAX_SEARCH_LENGTH 350
-#define ERR_SOCK_OPT -1
-#define ERR_TIMED_OUT -1
-#define ERR_CANT_MALLOC -1
-#define ERR_OPEN_SOCKET -2
-#define ERR_CONN_REFUSED -2
-#define ERR_NOT_ADDR -3
-#define ERR_WRITE_SOCKET -3
-#define ERR_NO_REACH -4
-#define ERR_CANT_CONNECT -5
-#define ERR_READ_SOCKET -5
-#define ERR_SERVER_BUSY -6
-#define ERR_NO_DOCUMENTS -6
-#define ERR_NO_DATA -7
-#define SUCCESS 0
-
-#define LEGAL_TEXT "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-"
-#define SAFE_LIST "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-#define LEGAL_NICK_TEXT "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-\\|[]{}`"
-
-#define NUMBER_LIST "1234567890"
-#define MAX_NICK_LENGTH 35
-
-#ifndef LANG /* If not defined, default to english */
-#define LANG 1
-#endif
-
-#define NORMALR 0
-#define WHUTR 1
-#define DUNNOR 2
-
-#define RAND_NORMAL 0
-#define RAND_ACTION 1
-#define RAND_RAW 2
-
-#define RANDQ_NORMAL 0
-#define RANDQ_CASE 1
-#define RANDQ_RAND 2
-
-#define RDB_NORMAL 0
-#define RDB_ACTION 1
-#define RDB_RAW 2
-
-/* ////////////////////////////////////////////////////////////////////// */
-
-#define RESERVED1 "EXPLAIN"
-#define RESERVED2 "DECLARE"
-
-#include "langs/lang.h"
diff --git a/beta/source/general.c b/beta/source/general.c
deleted file mode 100755
index 007f532..0000000
--- a/beta/source/general.c
+++ /dev/null
@@ -1,595 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-#if HAVE_DIRENT_H
-# include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
-#else
-# define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
-# if HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif
-# if HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif
-# if HAVE_NDIR_H
-# include <ndir.h>
-# endif
-#endif
-
-#if !HAVE_NANOSLEEP
-# include "timespec.h"
-#endif
-
-/**
- * Removed trailing newline and carriage returns.
- * 6/22/00 Dan
- * Rewrote to be more efficient, reduced from O(2n) to O(n)
- */
-void
-stripline (char *ptr)
-{
- for (; ptr && *ptr; ++ptr)
- {
- if ('\r' == *ptr || '\n' == *ptr)
- {
- *ptr = 0;
- return;
- }
- }
-}
-
-void
-db_log (const char *filename, const char *format,...)
-{
- va_list arglist;
- FILE *fp;
-
- fp = fopen (filename, "a");
- if (NULL == fp)
- {
- /* I guess there's no sense in trying to log the error :) */
- return;
- }
-
- va_start (arglist, format);
- vfprintf (fp, format, arglist);
- va_end (arglist);
- fclose (fp);
-}
-
-/**
- * Convert a character array to all lowercase.
- * 6/23/00 Dan:
- * - Rewrote to be more compact and a bit more efficient
- */
-char *
-strlwr (char *buf)
-{
- char *ptr = buf;
-
- for (; ptr && *ptr; ++ptr)
- {
- *ptr = tolower (*ptr);
- }
- return buf;
-}
-
-/**
- * Convert a character array to all uppercase.
- * 6/23/00 Dan:
- * - Rewrote to be more compact and a bit more efficient
- */
-char *
-strupr (char *buf)
-{
- char *ptr = buf;
-
- for (; ptr && *ptr; ++ptr)
- {
- *ptr = toupper (*ptr);
- }
- return buf;
-}
-
-/*
- * Added cast to str[i -1] to prevent warnings on Solaris.
- * -ron
- */
-
-void
-trailing_blanks (char *str)
-{
- int i = 0;
-
- if (str == NULL)
- return;
- for (i = strlen (str); i > 0; i--)
- {
- if (isspace ( (int) str[i - 1]))
- str[i - 1] = '\0';
- else
- return;
- }
-}
-
-
-void
-save_changes (void)
-{
- long i = 0;
- struct helperlist *c;
-#ifdef ENABLE_STATS
- struct statslist *d;
-
- d = statshead;
-#endif
- c = helperhead;
- remove (TMP_FILE);
- while (c != NULL)
- {
- i++;
- db_log (TMP_FILE, "%s %s %d %d %s %s\n",
- c->chan, c->uh, c->level, c->num_join, c->pass, c->greetz);
- c = c->next;
- }
- rename (TMP_FILE, HELPER_LIST);
-
-#ifdef ENABLE_STATS
- while (d != NULL)
- {
- i++;
- db_log (TMP_FILE, "%s %s %ld %ld %ld\n",
- d->nick, d->uh, d->total, d->added_time, d->last_time);
- d = d->next;
- }
- rename (TMP_FILE, STATS_FILE);
-#endif
-}
-
-char *
-date (void)
-{
- time_t timer;
-
- time (&timer);
- strncpy (strbuff, ctime (&timer), sizeof (strbuff));
- stripline (strbuff);
- return strbuff;
-}
-
-
-int
-match_wild (const char *pattern, const char *str)
-{
- char c = 0;
- const char *s = NULL;
-
- for (;;)
- {
- switch (c = *pattern++)
- {
- case 0:
- if (!*str)
- return 1;
- return 0;
- case '?':
- ++str;
- break;
- case '*':
- if (!*pattern)
- return 1;
- s = str;
- while (*s)
- {
- if (*s == *pattern && match_wild (pattern, s))
- return 1;
- ++s;
- }
- break;
- default:
- if (*str++ != c)
- return 0;
- break;
- } /* switch */
- }
-}
-
-char **
-tokenize (char *theString, size_t * numTokens)
-{
- static char *tokens[STRING_SHORT] = { 0 };
-
- assert (numTokens != NULL && theString != NULL);
- memset (tokens, 0, STRING_SHORT * sizeof (char *));
-
- tokens[(*numTokens = 0)] = strtok (theString, " ");
- if (NULL == tokens[0])
- {
- /* 0 tokens */
- return tokens;
- }
-
- while ((tokens[++(*numTokens)] = strtok (NULL, " ")) != NULL)
- {
- /* NO-OP */ ;
- }
- tokens[*numTokens] = 0;
-
- return tokens;
-}
-
-void
-get_s (void)
-{
- char temp[50] = { 0 };
- long i = 0;
-
- i = strlen (rp391);
- while (i > 0)
- {
- i--;
- snprintf (temp, sizeof (temp), "%s%c", dbVersion, rp391[i]);
- strncpy (dbVersion, temp, sizeof (dbVersion));
- }
-}
-
-const char *
-run_program (const char *input)
-{
- FILE *read_fp;
-
- read_fp = popen (input, "r");
- if (read_fp != NULL)
- {
- int length = 0;
-
- while ( fgets(f_tmp + length, sizeof(f_tmp - length), read_fp) )
- {
- length = strlen(f_tmp);
- while ((f_tmp[length - 1] == '\n') || (f_tmp[length - 1] == '\r'))
- {
- f_tmp[length - 1] = '\0';
- length--;
- }
- }
-
- pclose (read_fp);
- if (f_tmp)
- {
- return f_tmp;
- }
- return "No match";
- }
- return NULL;
-}
-
-/**
- * 6/22/00 Dan
- * - Removed srand(), should only be done once, in main()
- * - Changed while to for loop
- */
-char *
-get_rand_nick (const char *chan)
-{
- size_t x = 0;
- size_t i = 0;
- const struct userlist *c = userhead;
-
- /* Iterate through the userlist */
- for (; c != NULL; c = c->next)
- {
- /* Check if this user is on the channel */
- if (strcasecmp (chan, c->chan) == 0)
- {
- if (strcasecmp (Mynick, c->nick) != 0)
- {
- strncpy (f_tmp, c->nick, sizeof (f_tmp));
- i++;
- }
- }
- }
-
- x = 2 + get_random_integer(i);
- i = 0; /* reinit! */
-
- for (c = userhead; c != NULL; c = c->next)
- {
- if (strcasecmp (chan, c->chan) == 0)
- {
- i++;
- if (i == x)
- {
- if (*c->nick == '0')
- {
- return f_tmp;
- }
- if (strcasecmp (Mynick, c->nick) != 0)
- {
- strncpy (f_tmp, c->nick, sizeof (f_tmp));
- return f_tmp;
- }
- }
- }
- }
- return f_tmp;
-}
-
-void
-check_dbtimers (void)
-{
- DIR *dp;
- long i = 0;
- char filename[STRING_SHORT] = { 0 };
- struct dirent *entry;
- struct stat statbuf;
- FILE *fp;
- char b[STRING_LONG] = { 0 }, output[STRING_LONG] =
- {
- 0};
-
- if ((dp = opendir (DBTIMERS_PATH)) == NULL)
- {
- return;
- }
- while ((entry = readdir (dp)) != NULL)
- {
- stat (entry->d_name, &statbuf);
- if (S_ISDIR (statbuf.st_mode) && *entry->d_name == '.')
- {
- continue; /* it's a dir, ignore it */
- }
- if (S_ISDIR (statbuf.st_mode) && strcasecmp(entry->d_name, "CVS") == 0)
- {
- /* Ignore the CVS directory */
- continue;
- }
- i = time (NULL);
- if (i >= atoi (entry->d_name))
- {
- snprintf (filename, sizeof (filename), "%s/%s", DBTIMERS_PATH, entry->d_name);
- if ((fp = fopen (filename, "r")) == NULL)
- {
- return;
- }
- while (fgets (b, STRING_LONG, fp))
- {
- stripline (b);
- snprintf (output, sizeof (output), "%s\n", b);
- S (output);
- }
- fclose (fp);
- remove (filename);
- }
- }
- // FIXME: if CLOSEDIR_VOID is not defined, check the return value.
- closedir (dp);
-}
-
-int
-add_ignore_user_ram (char *nick)
-{
- struct ignorelist *n, *c;
-
- c = ignorehead;
-
- while (c)
- {
- if (strcasecmp (c->nick, nick) == 0)
- {
- return 1;
- }
- c = c->next;
- }
-
- if ( ( n = malloc (sizeof (struct ignorelist))) == NULL )
- {
- db_log ("error.log", "AHHH! No ram left! in add_ignore_user!\n");
- return 0;
- }
-
- memset (n, 0, sizeof (struct ignorelist));
-
- if (n != NULL)
- {
- strncpy (n->nick, nick, sizeof (n->nick));
-
- n->next = ignorehead;
- ignorehead = n;
- }
- return 1;
-}
-
-int
-check_ignore_user_ram (char *nick)
-{
- struct ignorelist *c;
-
- c = ignorehead;
-
- while (c)
- {
- if (strcasecmp (c->nick, nick) == 0)
- {
- return 1;
- }
- c = c->next;
- }
- return 0;
-}
-
-int
-delete_ignore_user_ram (char *nick)
-{
- struct ignorelist *pNode, *pPrev;
-
- pNode = ignorehead;
- pPrev = NULL;
-
- while (pNode)
- {
- if (strcasecmp (pNode->nick, nick) == 0)
- {
- if (pPrev != NULL)
- {
- pPrev->next = pNode->next;
- }
- else
- ignorehead = pNode->next;
- free (pNode);
- pNode = NULL;
- return 1;
- }
- pPrev = pNode;
- pNode = pNode->next;
- }
- return 0;
-}
-
-/* Count lines in a given filename. */
-size_t count_lines (char *filename)
-{
- FILE *fp = NULL;
-
- size_t lines = 0;
- char b [STRING_LONG] = {0};
-
- if((fp = fopen(filename, "r")) == NULL)
- {
- db_log("error.log", "Failed to open %s in count_lines()",
- filename);
- return (-1);
- }
-
- while(fgets(b, STRING_LONG, fp))
- {
- /* Ignore comments! */
- if((*b != '/') && (*b != '\n'))
- lines++;
-
- if(*b == '\n')
- continue;
- }
-
- /* Close the file. */
- fclose(fp);
-
- return(lines);
-}
-
-/* Self explanatory. */
-void reverse (char *pString)
-{
- size_t nLength = strlen(pString);
- char *endptr = pString + nLength - 1;
-
- for(;pString < endptr; ++pString, --endptr)
- {
- char c = *pString;
- *pString = *endptr;
- *endptr = c;
- }
-}
-
-
-/* Count how many times the character nChar exists in szStuff
- * return that number.
- */
-
-size_t count_char (const char *pStuff, const char nChar)
-{
- char szStuff [STRING_LONG] = {0};
- int nIndex = 0;
- int nCount = 0;
-
- strcpy(szStuff, pStuff);
-
- for(nIndex = 0; nIndex <= (size_t) strlen(szStuff); nIndex++)
- {
- if(szStuff[nIndex] == nChar)
- nCount++;
- }
-
- return(nCount);
-}
-
-/* I wrote this for my matrix-RAD.net project, this is translated from the Java.
- *
- * Try to turn all sorts of string things into a boolean. Only the first character is considered.
- */
-
-// true 1 yes ack ok one positive absolutely affirmative 'ah ha' 'shit yeah' 'why not'
-static const char *IS_TRUE = "t1aopswy";
-// false 0 no nack nope zero negative nah 'no way' 'get real' 'uh uh' 'fuck off' 'bugger off'
-static const char *IS_FALSE = "f0bgnuz";
-bool isBoolean(char *aBoolean)
-{
- bool result = false;
-
- if ((aBoolean != NULL) && (aBoolean[0] != '\0'))
- {
- char test = aBoolean[0];
-
- result = (strchr(IS_TRUE, tolower(test)) != NULL);
- }
-
- return result;
-}
-
-void db_sleep(unsigned long seconds)
-{
- struct timespec req, rem;
-
- req.tv_sec = seconds;
- nanosleep(&req, &rem);
-}
-
-/* plural(): This function returns "s", or "" (empty string),
- * depending on the plurality of the number specified by 'i'.
- * Used for beautification purposes in output that involves
- * showing a numeric count of objects.
- */
-
-char *plural (size_t i)
-{
- /* We only need to return "" if 'i' is equal to 1 or -1. */
- if (i == 1 || i == -1)
- return ("");
-
- /* Everything else is considered plural. */
- return ("s");
-}
-
-/* db_argstostr(): This function takes char **args and fills the buffer
- * pointed to by 'str' with a 'delim' delimited string of each element
- * in the argument buffer. A pointer to 'str' is returned for value
- * checking.
- */
-
-int db_argstostr(char *str, char **args, size_t startarg, char delim)
-{
- int i = 0, j = 0, tc = 0;
-
- /* Bail out if no args. */
- if (args[0] == NULL)
- return (0);
-
- /* Iterate words. */
- for (i = startarg; args[i]; i++)
- {
- /* Go through the letters and fill str buffer. */
- for (j = 0; args[i][j]; j++)
- {
- str[tc++] = args[i][j];
-
- if (args[i+1] && !(args[i][j+1]))
- str[tc++] = delim;
- }
- }
-
- str[tc] = '\0';
-
- return (tc);
-}
diff --git a/beta/source/helpers.c b/beta/source/helpers.c
deleted file mode 100755
index 4244722..0000000
--- a/beta/source/helpers.c
+++ /dev/null
@@ -1,479 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-/**
- * Add a channel helper.
- * 6/22/00 Dan
- * n now initialized where declared
- * All pointer arguments now received as pointer to const data.
- */
-void
-add_helper (const char *chan,
- const char *uh, long level, size_t num_join, const char *greetz, const char *pass, char mode)
-{
- struct helperlist *n = 0;
- char *ptr = NULL;
-#ifdef ENABLE_ENCRYPT
- const char *salt = "8fei3k";
-
- if ( mode == 0 )
- {
- if ((ptr = crypt (pass, salt)) == NULL) /* encrypt password */
- return;
- }
- else
- ptr = (char *)pass;
-#else
- ptr = (char *)pass;
-#endif
-
-
- n = malloc (sizeof (struct helperlist));
- if (n == NULL)
- {
- db_log ("error.log", "AHHH! No ram left! in add_helper!\n");
- return;
- }
-
- memset (n, 0, sizeof (struct helperlist));
- NUM_HELPER++;
- if (chan[0] == '#')
- {
- strncpy (n->chan, chan, sizeof (n->chan));
- }
- else
- {
- strncpy (n->chan, "#*", sizeof (n->chan));
- }
-
- strncpy (n->uh, uh, sizeof (n->uh));
- strlwr (n->uh);
- strncpy (n->pass, ptr, sizeof (n->pass));
- n->num_join = num_join;
- n->level = level;
- strncpy (n->greetz, greetz, MIN(sizeof(n->greetz) - 1, strlen(greetz)));
- n->next = helperhead;
- helperhead = n;
-}
-
-/**
- * Output the helper list to a nickname.
- * 6/22, Dan:
- * - Changed helperlist* c to be a pointer to const data
- * - Changed initialization of DATA, and size to be a
- * power of 2
- * - Added initialization of c
- * - Changed while loop to for loop
- * - Changed types of i, x to size_t since they should be
- * unsigned.
- * - Added reinitialization of DATA using memset() (changed from
- * strcpy(DATA,""))
- */
-void
-show_helper_list (const char *nick, long level)
-{
- char DATA [STRING_SHORT * 7] = { 0 };
- char tmp [STRING_SHORT] = { 0 };
- size_t i = 0, x = 0;
- const struct helperlist *c = NULL;
-
-
- for (c = helperhead; c != NULL; c = c->next)
- {
- // If we're displaying users at all levels...
- if ((level == 0) || (level == c->level))
- {
- i++; x++;
-
- snprintf (tmp, sizeof(tmp), "%s", DATA);
- snprintf (DATA, (sizeof(DATA) + sizeof(tmp)),
- "%s %s[%s:%ld:%d]",
- tmp, c->uh, c->chan, c->level, c->num_join);
-
- memset (tmp, 0, sizeof(tmp));
-
- if (i > 6)
- {
- i = 0;
- S ("NOTICE %s :%s\n", nick, DATA);
- memset (DATA, 0, sizeof(DATA));
- db_sleep(2);
- }
- }
- } /* for() */
-
- if (x != 0)
- S ("NOTICE %s :%s\n", nick, DATA);
-
- S ("NOTICE %s :End of Helper Userlist; %d user%s found.\n",
- nick, x,
- (x == 1) ? "" : "s");
-}
-
-void
-load_helpers (void)
-{
- FILE *fp;
- char b[STRING_LONG], *user_host, *greetz, *numb_join, *chan, *w_level, *pass;
- long num_join = 0, i = 0, level = 0;
-
- if ((fp = fopen (HELPER_LIST, "r")) == NULL)
- {
- printf ("Unable to open %s! Aborting connection.\n", HELPER_LIST);
- printf ("Please run ./configure to setup your darkbot.\n");
- exit (0);
- }
- printf ("Loading %s file ", HELPER_LIST);
- while (fgets (b, STRING_LONG, fp))
- {
- if (b == NULL)
- continue;
- stripline (b);
- if (*b == '/')
- continue;
- i++;
- printf (".");
- fflush (stdout);
- chan = strtok (b, " ");
- if (chan == NULL)
- continue;
- user_host = strtok (NULL, " ");
- if (user_host == NULL)
- continue;
- w_level = strtok (NULL, " ");
- if (w_level == NULL)
- continue;
- numb_join = strtok (NULL, " ");
- if (numb_join == NULL)
- continue;
- pass = strtok (NULL, " ");
- if (pass == NULL)
- {
- pass = "0"; /* duh */
- }
- greetz = strtok (NULL, "");
- if (greetz == NULL)
- greetz = "I haven't used \2SETINFO\2 yet!";
- if (w_level != NULL)
- level = atoi (w_level);
- else
- level = 1;
- if (numb_join != NULL)
- num_join = atoi (numb_join);
- else
- num_join = 0;
- if (strlen (pass) > 25)
- pass[25] = '\0';
- if (DebuG == 1)
- printf
- ("loading helperlist: %s %s l:%d j:%d %s\n",
- chan, user_host, (int) level, (int) num_join, greetz);
- add_helper (chan, user_host, level, num_join, greetz, pass, 1);
- }
- printf ("done(%d), ", (int) i);
- fclose (fp);
- save_changes ();
- if (DebuG == 1)
- db_sleep (2);
-}
-
-void
-set_pass (char *nick, char *uh, char *pass, char *newpass)
-{
- struct helperlist *c;
- char *ptr = NULL;
-#ifdef ENABLE_ENCRYPT
- char *salt = "8fei3k";
-#endif
-
- c = helperhead;
- strlwr (uh);
-
-
-#ifdef ENABLE_ENCRYPT
- if ((ptr = crypt (pass, salt)) == NULL) /* encrypt old password */
- return;
-#else
- ptr = (char *)pass;
-#endif
-
- while (c)
- {
- if (!match_wild (c->uh, uh) == 0)
- {
- if (strcmp (c->pass, ptr) == 0 || strcmp (c->pass, "0") == 0)
- {
-#ifdef ENABLE_ENCRYPT
- if ((ptr = crypt (newpass, salt)) == NULL) /* encrypt new password */
- return;
-#else
- ptr = (char *)newpass;
-#endif
- strncpy (c->pass, ptr, sizeof (c->pass));
- L012 (nick, uh);
- save_changes ();
- return;
- }
- else
- {
- L013 (nick);
- return;
- }
- }
- c = c->next;
- }
- L014 (nick);
-}
-
-long
-verify_pass (char *nick, char *chan, char *uh, char *pass)
-{
- struct helperlist *c;
- char *ptr = NULL;
-#ifdef ENABLE_ENCRYPT
- char *salt = "8fei3k";
-#endif
-
- c = helperhead;
- strlwr (uh);
-
-#ifdef ENABLE_ENCRYPT
- if ((ptr = crypt (pass, salt)) == NULL)
- return 0;
-#else
- ptr = (char *)pass;
-#endif
-
- while (c)
- {
- if (!match_wild (c->uh, uh) == 0)
- {
- if (*c->pass == '0')
- return 0; /* no pass set */
- if (strcmp (c->pass, ptr) == 0)
- {
- if (c->chan[0] == '#' && c->chan[1] == '*')
- return c->level;
-
- if (*chan == '*')
- return c->level;
-
- if (strcasecmp (c->chan, chan) == 0)
- return c->level;
-
- return 0; /* don't match chan access */
- }
- }
- c = c->next;
- }
- return 0;
-}
-
-long
-get_pass (char *data)
-{
- /* returns 0 for no data */
- /* returns 1 for just pass */
- /* returns 2 for pass and data */
- char b[STRING_SHORT] = { 0 }, b2[STRING_SHORT] =
- {
- 0}
- , *temp = NULL;
- long i = 0;
-
- strncpy (pass_data, "0", sizeof (pass_data)); /* init */
- strncpy (pass_pass, "0", sizeof (pass_pass));
- if (data == NULL)
- return 0;
- strncpy (b2, data, sizeof (b2));
- temp = strtok (data, " ");
- if (temp == NULL)
- return -1;
- strncpy (b, temp, sizeof (b));
- while (temp != NULL)
- {
- i++;
- strncpy (pass_pass, temp, sizeof (pass_pass));
- temp = strtok (NULL, " ");
- if (temp == NULL)
- break;
- snprintf (b, sizeof (b), "%s %s", b, temp);
- }
- strncpy (b, "", sizeof (b)); /* reinit */
- temp = strtok (b2, " ");
- strncpy (b, temp, sizeof (b));
- while (i > 2)
- {
- i--;
- temp = strtok (NULL, " ");
- snprintf (b, sizeof (b), "%s %s", b, temp);
- }
- if (strcasecmp (b, pass_pass) == 0)
- {
- strncpy (pass_data, "0", sizeof (pass_data));
- return 1;
- }
- strncpy (pass_data, b, sizeof (pass_data));
- return 2;
-}
-
-void
-do_login (char *nick, char *pass)
-{
- long i = 0, x = 0, D = 0;
- char Data[STRING_SHORT] = { 0 }, b[STRING_SHORT] =
- {
- 0};
- struct userlist *c;
-
- c = userhead;
- while (c)
- {
- if (strcasecmp (nick, c->nick) == 0)
- {
- x = verify_pass (c->nick, c->chan, c->uh, pass);
- if (x > 0)
- {
- i++;
- if (c->level == 0 && x >= 2)
- {
-#ifdef ENABLE_CHANNEL
- if (OP_USERS_ON_LOGIN)
- {
- /* only if not already authed */
- S ("MODE %s +ov %s %s\n", c->chan, c->nick, c->nick);
- }
-#endif
- D = 1;
- }
- c->level = x;
- snprintf (b, sizeof (b), "%s[%d] %s", c->chan, (int) c->level, Data);
- strncpy (Data, b, sizeof (Data));
- }
- }
- c = c->next;
- }
- if (i != 0)
- {
- if (!D)
- {
- S ("NOTICE %s :Already authed on %s\n", nick, Data);
- }
- else
- S ("NOTICE %s :Verified: %s\n", nick, Data);
- }
-}
-
-int
-check_access (char *uh, char *chan, int toggle, char *nick)
-{
- long i = 0, length = 0, A = 0, X = 0, Y = 0;
- struct helperlist *c;
- struct userlist *c2;
- char temp[STRING_LONG] = { 0 };
-
- c = helperhead;
- c2 = userhead;
- strlwr (uh);
-
- if (toggle == 0)
- { /* get access level */
- while (c2)
- {
- if (strcasecmp (c2->uh, uh) == 0)
- {
- if (((strcasecmp (c2->chan, chan) == 0) || (strcasecmp ("#*", chan) == 0))) /* privmsg */
- {
- if (strcasecmp (c2->nick, nick) == 0)
- {
- return c2->level;
- }
- }
- }
- c2 = c2->next;
- }
- return 0; /* no matches? */
- }
- else
- while (c != NULL)
- {
- if (!match_wild (c->uh, uh) == 0)
- {
- if (*c->pass == '0')
- {
- L001 (nick, Mynick);
- return 0;
- }
- if (c->chan[1] != '*')
- if (strcasecmp (c->chan, chan) != 0)
- return 0;
- c->num_join++;
- if (*c->greetz == '+')
- A = 1;
- strncpy (data, "", sizeof (data));
- length = Y = strlen (c->greetz);
- if (length > 1)
- {
- while (length > 0)
- {
- length--;
- X++;
- if (c->greetz[length] == '^')
- {
- i++;
- snprintf (temp, sizeof (temp), "%s%s", nick, data);
- }
- else if (c->greetz[length] == '%')
- {
- i++;
- snprintf (temp, sizeof (temp), "%u%s", c->num_join, data);
- }
- else if (c->greetz[length] == '$')
- {
- i++;
- snprintf (temp, sizeof (temp), "%s%s", uh, data);
- }
- else if (c->greetz[length] == '&')
- {
- i++;
- snprintf (temp, sizeof (temp), "%s%s", chan, data);
- }
- else
- snprintf (temp, sizeof (temp), "%c%s", c->greetz[length], data);
- if (X == Y && A == 1)
- continue;
- strncpy (data, temp, sizeof (data));
- } /* While */
- if (JOIN_GREET)
- {
- if (i == 0)
- {
- if (setinfo_lastcomm (uh) == 0)
- {
- S ("PRIVMSG %s :%ld\2!\2\37(\37%s\37)\37\2:\2 %s\n",
- chan, c->num_join, nick, c->greetz);
- }
- }
- else if (A == 1)
- {
- if (setinfo_lastcomm (uh) == 0)
- {
- S ("PRIVMSG %s :\1ACTION %s\1\n", chan, data);
- }
- }
- else
- {
- if (setinfo_lastcomm (uh) == 0)
- {
- S ("PRIVMSG %s :%s\n", chan, data);
- }
- }
- }
- return c->level;
- }
- }
- c = c->next;
- }
- return 0;
-}
diff --git a/beta/source/langs/arabic.h b/beta/source/langs/arabic.h
deleted file mode 100755
index 804bc25..0000000
--- a/beta/source/langs/arabic.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#define I_SPEAK "I speak Arabic."
-#define L001(a,b) S("PRIVMSG %s :Lam tada3 kalimate Morour, Li wad3i Kalimate Morour: \2/msg %s PASS <kalimate Morour 9adima> <kalimate Morour Jadida>\2 (Bima Anaha hya Al Marra Oula Allati takhtaro fiha kalimate Morour , Ista3mile '0' Sifr Ka kalimate Morour 9adima)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :7odifa Ban Da4im #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Ghayr 9adir 3ala fat7 %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, honaka %d SEEN's fi 9a3idat bayanati.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :3alayka an ta3rifa akthar mini 7awla hada al mawdou3, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Lam ara %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic 3ala %s hia OFF\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic on %s hya l4an OFF\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ON: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s 7odetha: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, Anhayte. Honaka l2ana %d min al achya2 al 3achwa2iya.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :kalimte Morour li %s 9ad Jodithate.\n",a,b)
-#define L013(a) S("NOTICE %s :kalimate Morour khat2a!\n",a)
-#define L014(a) S("NOTICE %s :ghayr mawjood!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :7odifa al Mostakhdim: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: ta9ssim bi Sifr khata2!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: 3amalia ghayr 9anounia!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (idafatoka il tajahol #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :idafatoka ila tajahol #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :7oditha #%d: \37[\37%s\37]\37 Ma3loumate\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d Madda bo7itate.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Wajadto akthar min \37%d\37 min fadlek ij3al ba7thaka akthar di9a\2:\2 \%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :wajadto \37Motatabi9\37 Wa7eda, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :wajadto \37%d\37 Motatabi9, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :wajadto %ld madkhal motachabih. 9ad 7odifou.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Astakhdimo %s. Ladaya %ld mawadee3 fi 9a3idate bayanaty, moshaghal limodaate: %d yawm%, %02d:%02d, honaka %ld as2ila tori7at, %ld mawdoo3 odifa, and %ld mawdoo3 7odifa, Mondo an Wasalte. Wa9te Al 3amalia: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Astakhdimo %s. ladaya %ld mawadee3 fi 9a3idate bayanaty, moshaghal limodaate: %d sa3at%s, %d da9i9a%s, honaka %ld as2ila tori7at, %ld mawdoo3 odifa, and %ld mawdoo3 7odifa, Mondo an Wasalte. wa9t al 3amalia: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Astakhdimo %s. Ladaya %ld mawadee3 fi 9a3idate bayanaty, moshaghal limodaate: %d min%s, %d sec%s, honaka %ld as2ila tori7at, %ld mawdoo3 odifa, and %ld mawdoo3 7odifa, Mondo an Wasalte. wa9t al 3amalia: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: La9ad 7adaftou al mawdou3 #%ld, \2%s\2.\n",a,b,c,d)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: La9ad 7adaftou al mawdou3 #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 lam yakoun fii stita3aty woujouda al mawdou3 %s. 3amaliyat al 7adf fashilate.\n",a,b,c)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 lam yakoun fii stita3aty woujouda al mawdou3 %s. 3amaliyat al 7adf fashilate.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :A Tari9a: \2/msg %s PASS <kalimate Morour 9adima> <kalimate Morour Jadida>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (li anani 9olto kadalik!))\n",a)
-#define L033(a) S("NOTICE %s :A Tari9a: UP <#chan> <kalimate Morour>\n",a)
-#define L034(a) S("NOTICE %s :A Tari9a: OP <#chan> [la9ab] <kalimate Morour>\n",a)
-#define L035(a) S("NOTICE %s :A Tari9a: DEOP <#chan> [la9ab] <kalimate Morour>\n",a)
-#define L036(a) S("NOTICE %s :7adid la9ab!\n",a)
-#define L037(a,b) S("NOTICE %s :Asta3id li /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :O7awil /nick %s-dork.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Moghadir %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Dokhoul %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :7adid la9ab/9anate!\n",a)
-#define L042(a) S("NOTICE %s :Adkhil user@host Li takhaloss minh!\n",a)
-#define L043(a) S("NOTICE %s :La youjad ayo ban.\n",a)
-#define L044(a) S("NOTICE %s :Adkhil user@host Lil 7adf!\n",a)
-#define L045(a) S("NOTICE %s :wa ida lam af3al kadalik??\n",a)
-#define L046(a) S("PRIVMSG %s :9a3idate al bayanate 9ad do3imate.\n",a)
-#define L047(a,b) S("NOTICE %s :A Tari9a: %cAUTOTOPIC <Mawdou3> (Da3 \"0\" Lil 2itfa2)\n",a,b)
-#define L048(a) S("NOTICE %s :A Tari9a: SETCHAN <9anate jadida>\n",a)
-#define L049(a,b) S("NOTICE %s :9anat Ra2issiya: %s\n",a,b)
-#define L050(a) S("NOTICE %s :A Tari9a: SETCHAR <ARRamz al jadid>\n",a)
-#define L051(a,b) S("NOTICE %s :Ramz al 9iyada al aana: %c\n",a,b)
-#define L052(a) S("NOTICE %s :A Tari9a: SETUSER <howia jadida> (Yatattalab I3adat Atachghil)\n",a)
-#define L053(a,b) S("NOTICE %s :al hawia al asslia l'aan: %s\n",a,b)
-#define L054(a) S("NOTICE %s :A Tari9a: SETNICK <La9ab Jadid>\n",a)
-#define L055(a) S("NOTICE %s :A Tari9a: ADDUSER <#9anate> <*user@*.host> <Daraja> <Kalimate Morour>. ie; ADDUSER #darkbot *bot@*.darkbot.info 3 kalimate Morourih... Ista3mil #* Ida Aradta i3ta2aho Madkhal Fi Jamee3 al 9anawate.\n",a)
-#define L056(a) sprintf(temp, "Lam astakhdim \2%cSETINFO\2 Ba3d!",a)
-#define L057(a,b,c) S("NOTICE %s :Odifa Al Mostakhdem: %s - level %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :A Tari9a: %c%s <user@host> [Sabab]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Odifa fi al ban Da2im #%d, %s; Sabab: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :A Tari9a: I3adat <Kam min Marra> <Modda> <bayanate-raw>\n",a)
-#define L061(a) S("NOTICE %s :Otmima.\n",a)
-#define L062(a) S("QUIT :I3ada Tachghil %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, Mada Torido An Todife?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, Mada Torido An Todife?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Idafate Mada, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Ayate ma3loumate yajibe an todafa %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :7assanan, %s :)\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Assif %s, Lakena Daa3ma Li dalika al Mawdou3 9ad Ozile.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Assif %s, Lakena Daa3ma Li dalika al Mawdou3 9ad Ozile.\n",a,b);
-#define L065n(a,b) S("NOTICE %s :Idafate Mada, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Ayate ma3loumate yajibe an todafa %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :7assanan, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Astabdile Mada, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Ayate ma3loumate yajibe an astabdile %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s 9ad Joddida.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Honaka %d ban Da2im%s fi Dakira.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d tania marrate 9able al achya2 al 3achwa2iya\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: Fiha %d Ramz.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Honaka 7aalian %d mawdou3%s fi 7alate intidar.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Ra2ayto %d yandam 7ata al ana.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Honaka %s %d khadim%s Fi 9a2imate khoddami. Ana 7alian Fi Al khadim #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, Ramz 9iyadaty howa: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Mada yajib An %O7arrire li, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, Ta7taj lita7did 3onwane!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Ghayre 9adir 3ala Nadar a3la %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Mada torido an Okhbir %s?\n",a,b,c)
-#define L083n(a,b,c) S("NOTICE %s :%s: Mada torido an Okhbir %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Okhbir %s 7awla Mada?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Okhbir %s 7awla Mada?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Okhbir Man, %s?\n",a,b)
-#define L085n(a,b) S("NOTICE %s :Okhbir Man, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 A tas2ale?\n",a,b)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 A tas2ale?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? A3id siyaghate dalika? (A tari9a %cHELP Lilmossa3ada 7awla Na7we)\n",a,b,c,d,e)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? A3id siyaghate dalika? (A tari9a %cHELP Lilmossa3ada 7awla Na7we)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s Mo7ashashe!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION Yastay9id...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Ata3arad lil'flood. Irssal 9a2imate al intidar (al ma3loumate fi intidar al irssal). %d Band 7odifa.\n",a,b)
diff --git a/beta/source/langs/chinese.h b/beta/source/langs/chinese.h
deleted file mode 100755
index ad406f1..0000000
--- a/beta/source/langs/chinese.h
+++ /dev/null
@@ -1,112 +0,0 @@
-#define I_SPEAK "ÎÒ˵ÖÐÎÄ."
-#define L001(a,b) S("PRIVMSG %s : Ä㻹ûÓÐÉèÖÿÚÁî. ÒªÉèÖÿÚÁî,Çë´ò: \2/msg %s PASS \
-<¾É¿ÚÁî> <пÚÁî>\2 (Èç¹ûÊǵÚÒ»´ÎÉèÖÿÚÁî,¾É¿ÚÁîÓ¦ÌîΪ 0 )\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Òѳɹ¦É¾³ý½ûÓÃÓû§ #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :ÎÞ·¨´ò¿ª%s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, ÔÚÎÒµÄÊý¾Ý¿âÀïÒ»¹²ÓÐ%dÌõÀúÊ·Óû§¼Ç¼.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :ÄãÒѾ­ÖªµÀµÃ±ÈÎÒ¶àÁË, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, ÎÒûÓмû¹ý%s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :×Ô¶¯Ö÷Ìâ %s ¸Õ²ÅÊǹرյÄ\n",a,b)
-#define L008(a,b) S("NOTICE %s :×Ô¶¯Ö÷Ìâ %s ÏÖÔڹرÕ\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :×Ô¶¯Ö÷Ìâ@ %s ´ò¿ª: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :×Ô¶¯Ö÷Ìâ@ %s ÒѸüÐÂ: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, ÒÑÍê³É. ÏÖ¹²ÓÐ %d ÌõËæ»úÄÚÈÝ.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :%sµÄ¿ÚÁîÒѸüÐÂ.\n",a,b)
-#define L013(a) S("NOTICE %s :¿ÚÁî´íÎó!\n",a)
-#define L014(a) S("NOTICE %s :ÎÞÆ¥Åä¼Ç¼!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Óû§ÒÑɾ³ý: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: ±»Áã³ý´íÎó!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: ·Ç·¨²Ù×÷!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (Ôö¼Ó×Ô¶¯ºöÂÔÓû§#%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Ôö¼Ó×Ô¶¯ºöÂÔÓû§#%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :ÒѸüР#%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d Ìõ¼Ç¼ÒÑËÑË÷.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :ÒÑ·¢ÏÖ³¬¹ý\37%d\37 ÌõÆ¥Åä¼Ç¼, ÇëÊäÈë¸ü¶àÌõ¼þÒÔËõСËÑË÷·¶Î§\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :ÎÒÕÒµ½ \37Ò»Ìõ\37 ·ûºÏÌõ¼þµÄ¼Ç¼, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :ÎÒÕÒµ½\37%d\37 Ìõ·ûºÏÌõ¼þµÄ¼Ç¼, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :ÕÒµ½%ldÌõÖØ¸´¼Ç¼,ÒÑɾ³ý.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :ÕýÔÚÔËÐÐ %s. ÎÒµÄÊý¾Ý¿âÖÐÓÐ%ldÌõ¼Ç¼, ÒÑÔËÐÐʱ¼ä: \
-%d Ìì%s, %02d:%02d, ±»ÌáÎÊ%ld´Î, Ôö¼Ó%ldÌõ¼Ç¼, ɾ³ý%ldÌõ¼Ç¼. \
-´¦Àíʱ¼ä: %1.4lf Ãë%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :ÕýÔÚÔËÐÐ %s. ÎÒµÄÊý¾Ý¿âÖÐÓÐ%ldÌõ¼Ç¼, ÒÑÔËÐÐʱ¼ä: \
-%d Сʱ%s, %d ·ÖÖÓ%s, ±»ÌáÎÊ%ld´Î, Ôö¼Ó%ldÌõ¼Ç¼, ɾ³ý%ldÌõ¼Ç¼. \
-´¦Àíʱ¼ä: %1.4lf Ãë%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :ÕýÔÚÔËÐÐ %s. ÎÒµÄÊý¾Ý¿âÖÐÓÐ%ldÌõ¼Ç¼, ÒÑÔËÐÐʱ¼ä: \
-%d ·ÖÖÓ%s, %d Ãë%s, ±»ÌáÎÊ%ld´Î, Ôö¼Ó%ldÌõ¼Ç¼, ɾ³ý%ldÌõ¼Ç¼. \
-´¦Àíʱ¼ä: %1.4lf Ãë%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: ÎÒÒÑɾ³ýÁ˼Ǽ#%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 ÕÒ²»µ½¼Ç¼%s. ɾ³ýʧ°Ü.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: ÎÒÒÑɾ³ýÁ˼Ǽ#%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 ÕÒ²»µ½¼Ç¼%s. ɾ³ýʧ°Ü.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Ó÷¨: \2/msg %s PASS <¾É¿ÚÁî> <пÚÁî>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (cause I say so!))\n",a)
-#define L033(a) S("NOTICE %s :Ó÷¨: UP <#ƵµÀ> <¿ÚÁî>\n",a)
-#define L034(a) S("NOTICE %s :Ó÷¨: OP <#ƵµÀ> [êdzÆ] <¿ÚÁî>\n",a)
-#define L035(a) S("NOTICE %s :Ó÷¨: DEOP <#ƵµÀ> [êdzÆ] <¿ÚÁî>\n",a)
-#define L036(a) S("NOTICE %s :ÇëÖ¸¶¨Ò»¸öêdzÆ!\n",a)
-#define L037(a,b) S("NOTICE %s :ÊÔͼ /êÇ³Æ %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Çë³¢ÊÔÔ /êÇ³Æ %s-dork.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :À뿪 %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :¼ÓÈë%s\n",a,b)
-#define L041(a) S("PRIVMSG %s :ÇëÖ¸¶¨Ò»¸öêdzÆ/ƵµÀ!\n",a)
-#define L042(a) S("NOTICE %s :ÊäÈëҪɾ³ýµÄu@h!\n",a)
-#define L043(a) S("NOTICE %s :ûÕÒµ½Äã˵µÄ½ûÓÃÓû§.\n",a)
-#define L044(a) S("NOTICE %s :ÊäÈëҪɾ³ýµÄu@h!\n",a)
-#define L045(a) S("NOTICE %s :²»ÄÇô×öÐв»ÐÐ?\n",a)
-#define L046(a) S("PRIVMSG %s :Êý¾Ý¿âÒѾ­±¸·Ý.\n",a)
-#define L047(a,b) S("NOTICE %s :Ó÷¨: %cAUTOTOPIC <Ö÷Ìâ> (ÉèÖÃΪ\"0\"±íʾÇå¿ÕÖ÷Ìâ)\n",a,b)
-#define L048(a) S("NOTICE %s :Ó÷¨: SETCHAN <ÐÂÆµµÀ>\n",a)
-#define L049(a,b) S("NOTICE %s :ȱʡƵµÀ: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Ó÷¨: SETCHAR <еÄÃüÁî·û>\n",a)
-#define L051(a,b) S("NOTICE %s :ÏÖÔÚµÄÃüÁî·ûÊÇ: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Ó÷¨: SETUSER <еÄÓû§ID> (ÐèÒªÖØÐÂÆô¶¯»úÆ÷ÈË)\n",a)
-#define L053(a,b) S("NOTICE %s :ÏÖÔÚµÄȱʡÓû§IDÊÇ: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Ó÷¨: SETNICK <еÄêdzÆ>\n",a)
-#define L055(a) S("NOTICE %s :Ó÷¨: ADDUSER <#ƵµÀ> <*user@*.host> <¼¶±ð> <¿ÚÁî>. ÀýÈç, ADDUSER #darkbot \
-*jason@*.superlink.net 3 hisPasswd ... ʹÓÃ#*½«Ê¹¸ÃÓû§µÄȨÏÞÊÊÓÃÓÚËùÓÐµÄÆµµÀ.\n",a)
-#define L056(a) sprintf(temp, "Ä㻹ûÓÐÓÃ\2%cSETINFO\2 ÉèÖû¶Ó­ÐÅÏ¢!",a)
-#define L057(a,b,c) S("NOTICE %s :Óû§ÒÑÌí¼Ó: %s - ¼¶±ð%d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Ó÷¨: %c%s <u@h> [ÀíÓÉ]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :¼ÓÈë½ûÓÃÓû§Áбí#%d, %s; ÀíÓÉ: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Ó÷¨: REPEAT <number> <delay> <raw-data>\n",a)
-#define L061(a) S("NOTICE %s :ÒÑÍê³É.\n",a)
-#define L062(a) S("QUIT :ÖØÐÂÆô¶¯ %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, ÄãÏëÌí¼Óʲô?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, ÄãÏëÌí¼Óʲô?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Ìí¼Óʲô, %s?\n",a,b);
-#define L065n(a,b) S("NOTICE %s :Ìí¼Óʲô, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: ÒªÌí¼ÓʲôÐÅÏ¢¸ø%s?\n",a,b,c)
-#define L066n(a,b,c) S("NOTICE %s :%s: ÒªÌí¼ÓʲôÐÅÏ¢¸ø%s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Ok, %s :)\n",a,b)
-#define L067n(a,b) S("NOTICE %s :Ok, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Ìæ»»Ê²Ã´, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: ÓÃʲôÐÅÏ¢Ìæ»»%s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s Òѱ»¸üÐÂ.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :ÓÐ %s %d ½ûÓÃÓû§¼Ç¼%s ÔØÈëÄÚ´æ.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, »¹ÓÐ%d ÃëÎÒ¾ÍÒªºúÑÔÂÒÓïÁË \n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: ³¤¶ÈΪ%d×Ö½Ú.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, ¶ÓÁÐÖÐÏÖÓÐ %d ¼Ç¼%s.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :µ½ÏÖÔÚÎÒÒѾ­¿´¼û%d¸öÓû§¼ÓÈë.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :ÎҵķþÎñÆ÷ÁбíÖÐÓÐ %s %d ¸ö·þÎñÆ÷%s. ÎÒÏÖÔÚÔÚ\
-·þÎñÆ÷ #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, ÎÒµÄÃüÁî·ûÊÇ: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :%sʲô, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, ÄãµÃÖ¸¶¨Ò»¸öµØÖ·!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :ÎÞ·¨²éÕÒ%s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: ÄãÏëÈÃÎÒ¸æËß%sʲô?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, ¸æËß %s ʲô?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :¸æËßË­, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: ÄãÏëÈÃÎÒ¸æËß%sʲô?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, ¸æËß %s ʲô?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :¸æËßË­, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 ÄãÔÚÎÊÂð?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? ÇëÖØÐÂÊäÈëÃüÁî(´ò %cHELP ¿ÉÒÔ¿´µ½Ó÷¨Ìáʾ\
-hints)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 ÄãÔÚÎÊÂð?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? ÇëÖØÐÂÊäÈëÃüÁî(´ò %cHELP ¿ÉÒÔ¿´µ½Ó÷¨Ìáʾ\
-hints)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s ÒѾ­×íÁË!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION ÐÑÀ´ÁË...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :ÎÒÕýÔÚ±»¹àË®...ÎÒÍÂ.... \
-ÒÑɾ³ý%d Ìõ¼Ç¼.\n",a,b)
diff --git a/beta/source/langs/dutch.h b/beta/source/langs/dutch.h
deleted file mode 100755
index 3754715..0000000
--- a/beta/source/langs/dutch.h
+++ /dev/null
@@ -1,120 +0,0 @@
-#define I_SPEAK "I speak Dutch."
-#define L001(a,b) S("PRIVMSG %s :U heeft geen wachtwoord gezet, om een wachtwoord te zetten: \
-\2/msg %s PASS <oudwachtwoord> <nieuwwachtwoord>\2 (Omdat dit de eerste keer is \
-dat U een wachtwoord zet, gebruik dan '0' als uw oude wachtwoord)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Permban #%d verwijderd, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Niet mogelijk %s te openen:(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Er zijn %d SEEN's in mijn database.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Dat zou jij toch beter moeten weten, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Ik heb %s niet gezien%s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic op %s was UIT\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic op %s is nu UIT\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s AAN: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s AANGEPAST: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, gedaan. Er zijn nu %d randomstuffs.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Wachtwoord voor %s is veranderd.\n",a,b)
-#define L013(a) S("NOTICE %s :Foutief wachtwoord!\n",a)
-#define L014(a) S("NOTICE %s :Geen gelijkenis!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Gebruiker verwijderd: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Deling door nul fout!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Illegale bewerking!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (U wordt genegeerd #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Negeren toegevoegd voor #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :#%d aangepast: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d records doorzocht.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Meer dan \37%d\37 onderwerpen gevonden, verklein uw \
-zoekgebied a.u.b.\2:\2 %s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Ik heb \37een\37 onderwep gevonden, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Ik heb \37%d\37 onderwerp gevonden, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :%ld onderwerp duplicaten gevonden. Ze zijn verwijderd.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Actief %s. Ik heb %ld onderwerpen in mijn \
-database, Uptime: %d dagen%s, %02d:%02d, Er zijn %ld vragen gesteld, %ld onderwerpen \
-toegevoegd, en %ld onderwerpen verwijderd. Verwerkingstijd: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Actief %s. Ik heb %ld onderwerpen in mijn \
-database, Uptime: %d uur%s, %d min%s, Er zijn %ld vragen gesteld, %ld onderwerpen \
-toegevoegd, en %ld onderwerpen verwijderd. Verwerkingstijd: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Actief %s. Ik heb %ld onderwerpen in mijn \
-database, Uptime: %d min%s, %d sec%s, Er zijn %ld vragen gesteld, %ld onderwerpen \
-toegevoegd, en %ld onderwerpen verwijderd. Verwerkingstijd: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Ik heb onderwerp #%ld verwijderd, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 Ik was niet in staat om onderwerp \37%s\37 te \
-vinden. Verwijdering gefaald.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Ik heb onderwerp #%ld verwijderd, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 Ik was niet in staat om onderwerp \37%s\37 te \
-vinden. Verwijdering gefaald.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Syntax: \2/msg %s PASS <oudwachtwoord> <nieuwwachtwoord>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (omdat ik het zeg!))\n",a)
-#define L033(a) S("NOTICE %s :Syntax: UP <#chan> <wachtwoord>\n",a)
-#define L034(a) S("NOTICE %s :Syntax: OP <#chan> [nicks] <wachtwoord>\n",a)
-#define L035(a) S("NOTICE %s :Syntax: DEOP <#chan> [nicks] <wachtwoord>\n",a)
-#define L036(a) S("NOTICE %s :Specificeer een nick!\n",a)
-#define L037(a,b) S("NOTICE %s :Probeer /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Probeer /nick %s-eikel.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Ik verlaat %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Ik kom binnen in %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Specificeer een nick/kanaal!\n",a)
-#define L042(a) S("NOTICE %s :Vul de u@h om te verwijderen!\n",a)
-#define L043(a) S("NOTICE %s :Geen ban van bekend.\n",a)
-#define L044(a) S("NOTICE %s :Vul de u@h in om te verwijderen!\n",a)
-#define L045(a) S("NOTICE %s :Wat vind je ervan als ik dat nou eens niet doe?\n",a)
-#define L046(a) S("PRIVMSG %s :Database gebackupt.\n",a)
-#define L047(a,b) S("NOTICE %s :SYNTAX: %cAUTOTOPIC <onderwerp> (zet hem op \"0\" om hem uit \
-te zetten)\n",a,b)
-#define L048(a) S("NOTICE %s :Syntax: SETCHAN <nieuwe kanalen>\n",a)
-#define L049(a,b) S("NOTICE %s :Standaard kanaal: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Syntax: SETCHAR <nieuwe commando karakter>\n",a)
-#define L051(a,b) S("NOTICE %s :Het nieuwe commando karakter is nu: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Syntax: SETUSER <nieuwe gebruikersid> (vereist een herstart)\n",a)
-#define L053(a,b) S("NOTICE %s :Standaard gebruikersid is nu: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Syntax: SETNICK <nieuwenick>\n",a)
-#define L055(a) S("NOTICE %s :Syntax: ADDUSER <#chan> <*user@*.host> <niveau> \
-<wachtwoord>. ie; ADDUSER #darkbot *jason@*.superlink.net 3 zijnwachtwoord ... gebruik #* \
-als je rechten in alle kanalen wilt geven.\n",a)
-#define L056(a) sprintf(temp, "Ik heb \2%cSETINFO\2 nog niet gebruikt!",a)
-#define L057(a,b,c) S("NOTICE %s :Gebruiker toegevoegd: %s - niveau %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Syntax: %c%s <u@h> [reden]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Toegevoegd aan permban #%d, %s; reden: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Syntax: REPEAT <nummer> <vertaling> <ruwe-data>\n",a)
-#define L061(a) S("NOTICE %s :Klaar.\n",a)
-#define L062(a) S("QUIT :Aan het herstarten %s ...\n",a)
-#define L064(a,b) S("PRIVMSG %s :%s, wat wil je toevoegen?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, wat wil je toevoegen?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Voeg wat informatie toe, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Welke informatie moet worden%s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :OK, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Voeg wat informatie toe, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Welke informatie moet worden%s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :OK, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Vervang wat, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Welke informatie moet vervangen worden%s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s is aangepast.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Er %s %d permban%s in RAM geladen.\n",a,b,c,d)
-#define L072(a,b) S("PRIVMSG %s :Ik heb momenteel %d banserv's geladen.\n",a,b)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d seconden tot de volgende randstuff\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: het was %d karakters lang.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Er zijn momenteel %d item%s in Que.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Ik heb %d binnenkomsten gezien tot nu toe.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Er zijn %s %d server%s in mijn server lijst. Ik zit \
-momenteel op server #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, mijn commando karakter is: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Waarom zou ik moeten %sing, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, je moet een adres specificeren!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Was niet in staat om %s op te zoeken.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Wat wil je dat ik vertel %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Vertel %s wat?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Vertel wie, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Wat wil je dat ik vertel %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Vertel %s wat?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Vertel wie, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 je zei?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Vind je het erg om dat te herformuleren? \
-(Type %cHELP voor syntax hints)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 je zei?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Vind je het erg om dat te herformuleren? \
-(Type %cHELP voor syntax hints)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s is stoned!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION wordt wakker...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Ik wordt geflood. Output-rij gedumpt (data dat klaarstond om \
-verzonden te worden). %d opdrachten.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Helaas %s, ondersteuning voor dat onderwerp is verwijderd.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Helaas %s, ondersteuning voor dat onderwerp is verwijderd.\n",a,b);
diff --git a/beta/source/langs/ebonics.h b/beta/source/langs/ebonics.h
deleted file mode 100755
index 6edc109..0000000
--- a/beta/source/langs/ebonics.h
+++ /dev/null
@@ -1,114 +0,0 @@
-#define I_SPEAK "Iz be speakin' Ebonic"
-#define L001(a,b) S("PRIVMSG %s :Yo, you aint be havin no passwerd yet, to be settin one..: \2/msg %s PASS \
-<oldpass> <newpass>\2 (since you aint be havin one yet, you bes' be usin '0' as yo' old pass)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Deleted permban: #%d, %s, werd to yo mutha!\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Can't be openin %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, There be %d SEEN's in mah database.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Why you be axin me about dat foo, youd be knowin mo' than anybody about %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, I dunno bout %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic on %s was OFF\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic on %s is now OFF\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ON: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s UPDATED: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, werd! There be %d randomstuffs now.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Passwerd fo %s has been changed.\n",a,b)
-#define L013(a) S("NOTICE %s :Dat aint da right passwerd foo!\n",a)
-#define L014(a) S("NOTICE %s :Yo I aint be seein what you're lookin fo!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Dat foo: %s [%d:%d] has been tkain care of...\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Man I cant be doin no math by zero's!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Yo i can't be doin dat, itz illegal and I be on probation already!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (talk to da hand cuz da bot aint listenin' #%d: %s IGNORED)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Talk to da hand cuz da bot aint listenin' #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Updated #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37 .. %d entries i jus' be lookin thru.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Found mo than \37%d\37 matches, gimmie sumptin betta to work wit\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Yo, I found \37one\37 match, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Yo, I found \37%d\37 matches, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Dayem, I jus found %ld topic duplicates. They was removed.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Runnin %s. Iz be havin %ld topics in mah database, Uptime: \
-%d day%s, %02d:%02d, youz mofo's axed me %ld questions, made me rememba %ld things, and fo'get %ld things. \
-This wasted: %1.4lf sec%s of mah time\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Runnin %s. Iz be havin %ld topics in mah database, Uptime: \
-%d hour%s, %d min%s, youz mofo's axed me %ld questions, made me rememba %ld things, and fo'get %ld things. \
-This wasted: %1.4lf sec%s of mah time\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Runnin %s. Iz be havin %ld topics in mah database, Uptime: \
-%d min%s, %d sec%s, youz mofo's axed me %ld questions, made me rememba %ld things, and fo'get %ld things. \
-This wasted: %1.4lf sec%s of mah time\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Yo, i deleted topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 I aint be findin' %s, so I cant be delete'n it!\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Yo, i deleted topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 I aint be findin' %s, so I cant be delete'n it!\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Dis be how ya do it: \2/msg %s PASS <oldpass> <newpass>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (DAMN COPS!))\n",a)
-#define L033(a) S("NOTICE %s :Dis be how ya do it: UP <#chan> <pass>\n",a)
-#define L034(a) S("NOTICE %s :Dis be how ya do it: OP <#chan> [nicks] <pass>\n",a)
-#define L035(a) S("NOTICE %s :Dis be how ya do it: DEOP <#chan> [nicks] <pass>\n",a)
-#define L036(a) S("NOTICE %s :Yo, you might wanna gimmie a nick to do it to foo!\n",a)
-#define L037(a,b) S("NOTICE %s :Gonna try ta /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Yo, /nick %s's-momma.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Takin off from %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Steppin up into %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Might wanna gimie a nick/channel to do dat to foo!\n",a)
-#define L042(a) S("NOTICE %s :Might wanna gimmie a u@h to get rid of foo!!\n",a)
-#define L043(a) S("NOTICE %s :Aint no such ban.\n",a)
-#define L044(a) S("NOTICE %s :Try givin me tha u@h to delete foo!\n",a)
-#define L045(a) S("NOTICE %s :Howz bout I bitch smack your punk ass instead?\n",a)
-#define L046(a) S("PRIVMSG %s :Yo, I backed up database.\n",a)
-#define L047(a,b) S("NOTICE %s :Dis be how ya do it: %cAUTOTOPIC <topic> (set to \"0\" to be turnin it off)\n",a,b)
-#define L048(a) S("NOTICE %s :Dis be how ya do it: SETCHAN <new channels>\n",a)
-#define L049(a,b) S("NOTICE %s :Default channel: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Dis be how ya do it: SETCHAR <new command char>\n",a)
-#define L051(a,b) S("NOTICE %s :Tha new command char now iz: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Dis be how ya do it: SETUSER <new userid> (requires a restart)\n",a)
-#define L053(a,b) S("NOTICE %s :Default userid now: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Dis be how ya do it: SETNICK <newnick>\n",a)
-#define L055(a) S("NOTICE %s :Dis be how ya do it: ADDUSER <#chan> <*user@*.host> <level> <pass>. ie; ADDUSER #ghetto \
-*icecube@*.compton.net 3 hisPasswd ... use #* if you wants to be givin' access in all chans.\n",a)
-#define L056(a) sprintf(temp, "I aint used \2%cSETINFO\2 yet!",a)
-#define L057(a,b,c) S("NOTICE %s :Added user: %s - level %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Dis be how ya do it: %c%s <u@h> [reason]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Added in permban #%d, %s; reason: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Dis be how ya do it: REPEAT <number> <delay> <raw-data>\n",a)
-#define L061(a) S("NOTICE %s :Done.\n",a)
-#define L062(a) S("QUIT :Restarting %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, might wanna tell me wut to add foo!\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, might wanna tell me wut to add foo!\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Add wut, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Might wanna tell me wut info to be addin fo %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Otay, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Add wut, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Might wanna tell me wut info to be addin fo %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Otay, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Replace wut, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Wut info should replace %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s be done gettin updated.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :There be %s %d permban's%s loaded into ram.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d seconds left till Iz be doin sumptin stupid fly!\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: it waz %d chars long, wut da hell does it matta to you anyway, foo.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, There be currently %d item%s in Que.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :I've seen you mofo's come and go %d times.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :There be %s %d server%s in mah server list, but I be chillin on \
-server #%d wit all da homiez right now.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, my command char be: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Yo, wut should i be %sing fo, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, gimmie a address foo!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :I aint bein able to look up %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Yo, wut you want me to be tellin' %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Tell %s about wut?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Tell who, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Yo, wut you want me to be tellin' %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Tell %s about wut?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Tell who, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 you wuz asking?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Mind puttin dat differently? (Type %cHELP for syntax \
-hints)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 you wuz asking?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Mind puttin dat differently? (Type %cHELP for syntax \
-hints)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s is stoned more than i am!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION wakes up from a drunken haze...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Iz bein flooded. Dumpin output Que. %d items wuz deleted.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Damn nigs %s, we did done took out dat topic.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Damn nigs %s, we did done took out dat topic.\n",a,b);
-
diff --git a/beta/source/langs/english.h b/beta/source/langs/english.h
deleted file mode 100755
index 9aded66..0000000
--- a/beta/source/langs/english.h
+++ /dev/null
@@ -1,114 +0,0 @@
-#define I_SPEAK "I speak English."
-#define L001(a,b) S("PRIVMSG %s :You have not set a password, to set a pass: \2/msg %s PASS \
-<oldpass> <newpass>\2 (since this is your first time setting a pass, use '0' as your old pass)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Deleted permban #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Unable to open %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, There are %d SEEN's in my database.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :You'd know more about that than I do, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, I have not seen %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic on %s was OFF\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic on %s is now OFF\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ON: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s UPDATED: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, done. There are now %d randomstuffs.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Password for %s has been updated.\n",a,b)
-#define L013(a) S("NOTICE %s :Incorrect password!\n",a)
-#define L014(a) S("NOTICE %s :No match!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Deleted user: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Division by zero error!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Illegal operation!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (adding ignore #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Adding ignore #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Updated #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d entries searched.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Found more than \37%d\37 matches, please narrow down your search\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :I found \37one\37 match, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :I found \37%d\37 matches, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Found %ld topic duplicates. They were removed.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Running %s. I have %ld topics in my database, Uptime: \
-%d day%s, %02d:%02d, There have been %ld questions asked, %ld topic additions, and %ld topic deletions, since I connected. \
-Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Running %s. I have %ld topics in my database, Uptime: \
-%d hour%s, %d min%s, There have been %ld questions asked, %ld topic additions, and %ld topic deletions, since I connected. \
-Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Running %s. I have %ld topics in my database, Uptime: \
-%d min%s, %d sec%s, There have been %ld questions asked, %ld topic additions, and %ld topic deletions, since I connected. \
-Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: I have deleted topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: I have deleted topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 I was unable to find the topic %s. Delete failed.\n",a,b,c)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 I was unable to find the topic %s. Delete failed.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Syntax: \2/msg %s PASS <oldpass> <newpass>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (cause I say so!))\n",a)
-#define L033(a) S("NOTICE %s :Syntax: UP <#chan> <pass>\n",a)
-#define L034(a) S("NOTICE %s :Syntax: OP <#chan> [nicks] <pass>\n",a)
-#define L035(a) S("NOTICE %s :Syntax: DEOP <#chan> [nicks] <pass>\n",a)
-#define L036(a) S("NOTICE %s :Specify a nick!\n",a)
-#define L037(a,b) S("NOTICE %s :Attempting to /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Try /nick %s-dork.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Leaving %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Joining %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Specify a nick/chan!\n",a)
-#define L042(a) S("NOTICE %s :Enter the u@h to purge!\n",a)
-#define L043(a) S("NOTICE %s :No such ban.\n",a)
-#define L044(a) S("NOTICE %s :Enter the u@h to delete!\n",a)
-#define L045(a) S("NOTICE %s :How about I not do that?\n",a)
-#define L046(a) S("PRIVMSG %s :Backed up database.\n",a)
-#define L047(a,b) S("NOTICE %s :SYNTAX: %cAUTOTOPIC <topic> (set to \"0\" to turn off)\n",a,b)
-#define L048(a) S("NOTICE %s :Syntax: SETCHAN <new channels>\n",a)
-#define L049(a,b) S("NOTICE %s :Default channel: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Syntax: SETCHAR <new command char>\n",a)
-#define L051(a,b) S("NOTICE %s :New command char now: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Syntax: SETUSER <new userid> (requires a restart)\n",a)
-#define L053(a,b) S("NOTICE %s :Default userid now: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Syntax: SETNICK <newnick>\n",a)
-#define L055(a) S("NOTICE %s :Syntax: ADDUSER <#chan> <*user@*.host> <level> <pass>. ie; ADDUSER #darkbot \
-*jason@*.superlink.net 3 hisPasswd ... use #* if you want to give access in all chans.\n",a)
-#define L056(a) sprintf(temp, "I haven't used \2%cSETINFO\2 yet!",a)
-#define L057(a,b,c) S("NOTICE %s :Added user: %s - level %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Syntax: %c%s <u@h> [reason]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Added in permban #%d, %s; reason: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Syntax: REPEAT <number> <delay> <raw-data>\n",a)
-#define L061(a) S("NOTICE %s :Done.\n",a)
-#define L062(a) S("QUIT :Restarting %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, what do you want to add?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, what do you want to add?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Add what, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: What info to be added for %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Okay, %s :)\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Sorry %s, but support for that topic has been removed.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Sorry %s, but support for that topic has been removed.\n",a,b);
-#define L065n(a,b) S("NOTICE %s :Add what, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: What info to be added for %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Okay, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Replace what, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: What info should replace %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s has been updated.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :There %s %d permban%s loaded into ram.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d seconds left till randstuff\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: it was %d chars long.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, There is currently %d item%s in queue.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :I have seen %d joins thus far.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :There %s %d server%s in my server list. I am currently on \
-server #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, my command char is: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :What should i be %sing for, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, you need to specify an address!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Was unable to look up %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: What do you want me to tell %s?\n",a,b,c)
-#define L083n(a,b,c) S("NOTICE %s :%s: What do you want me to tell %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Tell %s about what?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Tell %s about what?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Tell who, %s?\n",a,b)
-#define L085n(a,b) S("NOTICE %s :Tell who, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 you were asking?\n",a,b)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 you were asking?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Mind rephrasing that? (Type %cHELP for syntax \
-hints)\n",a,b,c,d,e)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Mind rephrasing that? (Type %cHELP (in channel) for syntax \
-hints)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s is stoned!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION wakes up...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :I'm being flooded. Dumping output queue. \
-%d items deleted.\n",a,b)
diff --git a/beta/source/langs/french.h b/beta/source/langs/french.h
deleted file mode 100755
index 2c9b1e0..0000000
--- a/beta/source/langs/french.h
+++ /dev/null
@@ -1,119 +0,0 @@
-#define I_SPEAK "I speak French."
-#define L001(a,b) S("PRIVMSG %s :Vous n'avez pas de mot de passe, pour en choisir un: \
-\2/msg %s PASS <Ancien mot de passe> <Nouveau mot de passe>\2 (Puisque c'est la première \
-fois que vous choisissez un mot de passe, utilisez '0' comme ancien mot de passe)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Ban permanent éffacé: #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Incapable d'ouvrir %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Il y a %d SEEN dans ma base de données.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Vous devriez en connaitre plus a ce sujet que moi, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Je n'ai pas vu %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic sur %s étais DÉSACTIVÉ\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic sur %s est maintenant DÉSACTIVÉ\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ACTIF: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s MIS À JOUR: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, terminé. Il y a maintenant %d items aléatoires.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s : Le mot de passe pour %s a été mis à jour.\n",a,b)
-#define L013(a) S("NOTICE %s :Mot de passe incorrect!\n",a)
-#define L014(a) S("NOTICE %s :Aucune entrée similaire!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Usager supprimé: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Erreur! Division par zéro!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Opération illégale!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (Ajout d'ignore: #%d:%s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Ignore ajoutée #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Mis à jour #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d entrées recherchés.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Trouvé plus que \37%d\37 correspondances, restreignez votre \
-recherche...\2:\2 %s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Trouvé \37une\37 correspondance, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Trouvé \37%d\37 correspondances, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Trouvé %ld entrées dupliquées. Elles ont été retirées.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Utilise %s. J'ai %ld entrées dans ma base de \
-données, Actif depuis: %d jours%s, %02d:%02d, Il y a eu %ld questions posées, %ld additions \
-d'informations et %ld entrées retirées. Temp de travail: %1.4lf seconde%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Utilise %s. J'ai %ld entrées dans ma base de \
-données, Actif depuis: %d heure%s, %d minute%s, Il y a eu %ld questions posées, %ld additions \
-d'informations, et %ld entrées retirées. Temp de travail: %1.4lf seconde%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Utilise %s. J'ai %ld entrées dans ma base de \
-données, Actif depuis: %d minute%s, %d seconde%s, Il y a eu %ld questions posées, %ld additions \
-d'informations, et %ld entrées retirées. Temp de travail: %1.4lf seconde%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: J'ai effacé l'entrée #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 J'ai été incapable de trouvé le topic \37%s\37. Impossible \
-d'éffacer.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: J'ai effacé l'entrée #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 J'ai été incapable de trouvé le topic \37%s\37. Impossible \
-d'éffacer.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Syntaxe: \2/msg %s PASS <ancien mot de passe> <nouveau mot de passe>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (Parce que je l'ai décidé!))\n",a)
-#define L033(a) S("NOTICE %s :Syntaxe: UP <#Canal> <Mot de passe>\n",a)
-#define L034(a) S("NOTICE %s :Syntaxe: OP <#Canal> [alias] <Mot de passe>\n",a)
-#define L035(a) S("NOTICE %s :Syntaxe: DEOP <#Canal> [alias] <Mot de passe>\n",a)
-#define L036(a) S("NOTICE %s :Specifiez un alias!\n",a)
-#define L037(a,b) S("NOTICE %s :Tentative de /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Essayez /nick %s-Épais.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Je quitte %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :J'entre %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Specifiez un alias ou un canal!\n",a)
-#define L042(a) S("NOTICE %s :Entrez le user@host à purger!\n",a)
-#define L043(a) S("NOTICE %s :Aucun ban de ce type.\n",a)
-#define L044(a) S("NOTICE %s :Entrez le user@host à effacer!\n",a)
-#define L045(a) S("NOTICE %s :Et si je ne le ferais pas?\n",a)
-#define L046(a) S("PRIVMSG %s :Copie de sauvegarde de la base de donnée completé.\n",a)
-#define L047(a,b) S("NOTICE %s :SYNTAXE: %cAUTOTOPIC <topic> (mettre à \"0\" pour désactiver)\n",a,b)
-#define L048(a) S("NOTICE %s :Syntaxe: SETCHAN <nouveau canal>\n",a)
-#define L049(a,b) S("NOTICE %s :Canal par défault: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Syntaxe: SETCHAR <nouveau caractère de commande>\n",a)
-#define L051(a,b) S("NOTICE %s :Le caractère de commande est maintenant: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Syntaxe: SETUSER <Nouveau ID> (nécessite un redémarage)\n",a)
-#define L053(a,b) S("NOTICE %s :ID d'usager par défaut: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Syntaxe: SETNICK <Nouveau nick>\n",a)
-#define L055(a) S("NOTICE %s :Syntaxe: ADDUSER <#Canal> <*user@*.host> <Niveau> <Mot de passe>. \
-Exemple; ADDUSER #Darkbot *jason@*.superlink.net 3 SonPass ... Utiliser #* pour donner accès à tout \
-les canaux.\n",a)
-#define L056(a) sprintf(temp, "Je n'ai pas encore utilisé \2%cSETINFO\2!",a)
-#define L057(a,b,c) S("NOTICE %s :Usager ajouté: %s - Niveau %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Syntaxe: %c%s <user@host> [Raison]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Ban permanent ajouté #%d, %s; Raison:%s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Syntaxe: REPEAT <Nombre de fois> <Délai> <Information RAW>\n",a)
-#define L061(a) S("NOTICE %s :Complété.\n",a)
-#define L062(a) S("QUIT :Redémarage de %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, que voulez-vous ajouter?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, que voulez-vous ajouter?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Que devrais-je ajouter, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Quelle information devrait être ajoutée pour %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :D'accord, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Que devrais-je ajouter, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Quelle information devrait être ajoutée pour %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :D'accord, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Remplacer quoi, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Quelle information devrait remplacer %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s a été mis à jour.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Il y a %s %d ban%s permanent en mémoire.\n",a,b,c,d,d)
-#define L072(a,b) S("PRIVMSG %s :J'ai présentement %d bans par serveurs en mémoire.\n",a,b)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d secondes restantes avant items aléatoires\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: Il y avait %d caractères de longs.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Il y a présentements %d objets%s en liste d'attente.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :J'ai pu observer %d arrivées jusqu'à maintenant.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Il y a %s %d serveur%s dans ma liste de serveurs. Je suis \
-présentement sur le serveur #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, mon caractère de commande est: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Que devrais-je %siser pour, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, vous devez spécifier une addresse!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Je ne suis pas parvenu à convertir %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Que voulez-vous que je dise à %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Informer %s de%s?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Dire à qui, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Que voulez-vous que je dise à %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Informer %s de%s?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Dire à qui, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 vous demandiez?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Pourriez-vous reformuler celà? (Tappez %cHELP pour de \
-l'aide sur la syntaxe)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 vous demandiez?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Pourriez-vous reformuler celà? (Tappez %cHELP pour de \
-l'aide sur la syntaxe)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s est mort!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION se réveille...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Je me fais flooder. Envoie de la liste d'attente (l'information en attente \
-d'être envoyée). %d objets.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Désolé %s, mais soutien de cette matière a été enlevé.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Désolé %s, mais soutien de cette matière a été enlevé.\n",a,b);
diff --git a/beta/source/langs/german.h b/beta/source/langs/german.h
deleted file mode 100755
index e0cbfb6..0000000
--- a/beta/source/langs/german.h
+++ /dev/null
@@ -1,115 +0,0 @@
-#define I_SPEAK "Ich spreche deutsch."
-#define L001(a,b) S("PRIVMSG %s :Sie haben kein Passwort gesetzt. Um dies nachzuholen: \2/msg %s PASS \
-<altpasswort> <neupasswort>\2 (Da dies ihr erstes Passwort sein wird, verwenden sie '0' als altpasswort)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Permanenten Bann geloescht #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Kann %s nicht oeffnen :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Es gibt %d SEEN's in meiner Datenbank.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Darueber wissen Sie mehr als ich, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Ich habe %s nicht gesehen in %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic auf %s wurde abgestellt (OFF)\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic aud %s ist nun abgestellt (OFF)\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s angestellt (ON): %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s aktualisiert (UPDATED): %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, erledigt. Es gibt nun %d Sprueche.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Passwort fuer %s wurde aktualisiert.\n",a,b)
-#define L013(a) S("NOTICE %s :Falsches Passwort!\n",a)
-#define L014(a) S("NOTICE %s :kein Treffer!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Nutzer geloescht: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Teilen durch 0 aus politischen Gruenden derzeit nicht moeglich!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Unzulaessige Aktion!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (Fuege ignoriere #%d: %s hinzu)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Ignore ab sofort #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Aktualisiere #%d: \37[\37%s\37]\37 Info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d Eintraege durchsucht.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Habe mehr als \37%d\37 Treffer gefunden, bitte grenzen sie die Suche ein\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Ich habe \37einen\37 Treffer, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Ich habe \37%d\37 Treffer gefunden, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :%ld Themenduplikate gefunden. Sie wurden geloescht.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Lasse %s laufen. Ich habe %ld Themen in meiner Datenbank, Laufzeit: \
-%d Tage%s, %02d:%02d, Es wurden %ld Fragen gestellt, %ld Themen ergaenzt und %ld Themen geloescht. \
-Prozess Zeit: %1.4lf sek%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Lasse %s laufen. I habe %ld Themen in meiner Datenbank, Laufzeit: \
-%d Stunden%s, %d Minuten%s, Es wurden %ld Fragen gestellt, %ld Themen ergaenzt und %ld Themen geloescht. \
-Prozesszeit: %1.4lf Sekunden%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Lasse %s laufen. Ich habe %ld Themen in meiner Datenbank, Laufzeit: \
-%d Minuten%s, %d Sekunden%s, Es wurden %ld Fragen gestellt, %ld Themen hinzugefuegt und %ld Themen geloescht. \
-Prozesszeit: %1.4lf Sekunden%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Ich habe #%ld Themen geloescht, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 Ich kann Themaeintrag %s nicht finden. Loeschen gescheitert.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Ich habe #%ld Themen geloescht, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 Ich kann Themaeintrag %s nicht finden. Loeschen gescheitert.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Syntax: \2/msg %s PASS <oldpass> <newpass>\2\n",a,b)
-#define L032(a) Snow("QUIT :G\2\2etoetet (%s (weil ich es so sage!))\n",a)
-#define L033(a) S("NOTICE %s :Syntax: UP <#chan> <pass>\n",a)
-#define L034(a) S("NOTICE %s :Syntax: OP <#chan> [nicks] <pass>\n",a)
-#define L035(a) S("NOTICE %s :Syntax: DEOP <#chan> [nicks] <pass>\n",a)
-#define L036(a) S("NOTICE %s :Spezifiziere einen nick!\n",a)
-#define L037(a,b) S("NOTICE %s :Versuche /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Versuche /nick %s-dummy.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Verlasse %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Betrete %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Spezifiziere einen nick/chan!\n",a)
-#define L042(a) S("NOTICE %s :Geben sie u@h um zu loeschen!\n",a)
-#define L043(a) S("NOTICE %s :Keine solche Verbannung vorhanden.\n",a)
-#define L044(a) S("NOTICE %s :Geben sie u@h um sie zu loeschen!\n",a)
-#define L045(a) S("NOTICE %s :Wie waers wenn ich dass nicht tue?\n",a)
-#define L046(a) S("PRIVMSG %s :Datenbank gesichert.\n",a)
-#define L047(a,b) S("NOTICE %s :SYNTAX: %cAUTOTOPIC <topic> (setze \"0\" um abzuschalten)\n",a,b)
-#define L048(a) S("NOTICE %s :Syntax: SETCHAN <new channels>\n",a)
-#define L049(a,b) S("NOTICE %s :Standard Raum: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Syntax: SETCHAR <new command char>\n",a)
-#define L051(a,b) S("NOTICE %s :Neues Kommandozeichen nun: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Syntax: SETUSER <new userid> (benoetigt einen Neustart)\n",a)
-#define L053(a,b) S("NOTICE %s :Standard NutzerID jetzt: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Syntax: SETNICK <newnick>\n",a)
-#define L055(a) S("NOTICE %s :Syntax: ADDUSER <#chan> <*user@*.host> <level> <pass>. ie; ADDUSER #darkbot \
-*user@*.somewhere 3 hisPasswd ... nutzen #* um ihm die komplette Kontrolle ueber alle Raeume zu uebertragen.\n",a)
-#define L056(a) sprintf(temp, "Ich habe \2%cSETINFO\2 noch nicht benutzt!",a)
-#define L057(a,b,c) S("NOTICE %s :Nutzer hinzugefuegt: %s - Ebene %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Syntax: %c%s <u@h> [Begruendung]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Ergaenzt in Ausschlussliste #%d, %s; Begruendung: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Syntax: REPEAT <number> <delay> <raw-data>\n",a)
-#define L061(a) S("NOTICE %s :Erledigt.\n",a)
-#define L062(a) S("QUIT :Starte wieder %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, was moechten sie hinzufuegen?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, was moechten sie hinzufuegen?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Was hinzufuegen, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Welcher Infoblock soll zu %s hinzugefuegt werden?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Okay, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Was hinzufuegen, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Welcher Infoblock soll zu %s hinzugefuegt werden?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Okay, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Ersetze was, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Welcher Infoblock soll durch %s ersetzt werden?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s wurde aktualisiert.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Es gibt %s %d permanente Ausschluesse%s in den Speicher geladen.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d Sekunden bis zum blafaseln\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: es war %d Zeichen lang.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Es gibt derzeit %d Artikel %s in der Warteschlange.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :%d Benutzer kamen bisher in den Raum.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Es gibt %s %d Server%s in meiner Serverliste. Ich bin derzeit auf \
-Server #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, mein Kommandozeichen lautet: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Was soll fuer %sing verwendet werden, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, geben sie eine Addresse an!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Konnte %s nicht finden.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Was wollen sie mir erzaehlen %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Sagen sie %s ueber was?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Wer, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Was wollen sie mir erzaehlen %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Sagen sie %s ueber was?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Wer, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 fragten sie?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? In Gedanken umbauen? (Tippen sie %cHELP fuer die Syntax \
-Hinweise)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 fragten sie?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? In Gedanken umbauen? (Tippen sie %cHELP fuer die Syntax \
-Hinweise)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s ist total abgedreht!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION erwacht...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Ich wurde geflutet. Gebe Ausgabeschlange aus. \
-%d Eintraege geloescht.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Leider %s, wurde die Unterstützung für dieses thema entfernt.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Leider %s, wurde die Unterstützung für dieses thema entfernt.\n",a,b);
-
diff --git a/beta/source/langs/greek.h b/beta/source/langs/greek.h
deleted file mode 100755
index ccf6ed1..0000000
--- a/beta/source/langs/greek.h
+++ /dev/null
@@ -1,117 +0,0 @@
-#define I_SPEAK "I speak Greek."
-#define L001(a,b) S("PRIVMSG %s :Den exis vali kodiko, gian na valis grapse: \2/msg %s PASS \
-<palioskodikos> <kainourioskodikos>\2 (epidi auti ine i prota sou fora pou vazi kodiko, \
-xrisimopia '0' san ton palio sou kodiko)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :To monimo ban exi svisti #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Den mporesa na anixo to %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Eparxoun %d SEEN's stin lista mou.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Den tha xeris perissotera aposa xero ego, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Den ida to nick %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic gia to %s itan apenergepiimeno\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic gia to %s einai to apenergepiimeno\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s Energopieimeno: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s UPDATED: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, Egine. Iparxoun tora %d randomstuffs.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :O kodikos gia to nick %s exi exixronisti.\n",a,b)
-#define L013(a) S("NOTICE %s :Lathos Kodikos!\n",a)
-#define L014(a) S("NOTICE %s :Den Vrethike!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Svismeni xristes: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Upodieresi apo to miden eine lanthasmeni!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Paranomi epixirisi!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (Prostheto to ignore #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Prostheto to ignore #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Exixronismos gia #%d: \37[\37%s\37]\37 plirofories\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d dedomena anazytithikan.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Vrika perissotore apo \37%d\37 dedomena, parakalo perioriste \
-thn anazitisi sas\2:\2 %s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Vrika \37one\37 dedomena, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Vrika \37%d\37 dedomena, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Vrika %ld themata. Exoun svisti.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Letourgiko %s. +Ellinika Exo %ld themata stin lista my, Eime energepioimenos gia: \
-%d day%s, %02d:%02d, Exoun rotithi %ld erotisis,Exoun prosthethi %ld \
-themata, kai exoun aferethi %ld themata. Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Letourgiko %s.+ Ellinika Exo % ld themata stin lista my, Eime energepioimenos gia: \
-%d day % s, %02 d: %02 d, Exoun rotithi % ld erotisis, Exoun prosthethi % ld themata, kai exoun aferethi % ld themata.Process time: \
-%1.4l f sec %s \n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Letourgiko %s. \
-+Ellinika Exo %ld themata stin lista my, Eime energepioimenos gia: %d day%s, %02d:%02d, \
-Exoun rotithi %ld erotisis,Exoun prosthethi %ld themata, kai exoun \
-aferethi %ld themata. Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Exo svisi to thema #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 Den moris na vro to thema \37%s\37. Delete failed.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Exo svisi to thema #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 Den moris na vro to thema \37%s\37. Delete failed.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Syntaxi: \2/msg %s PASS <palioskodikos> <kainourios>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (epidi etsi leo!))\n",a)
-#define L033(a) S("NOTICE %s :Syntaxi: UP <#Kanali> <kodikos>\n",a)
-#define L034(a) S("NOTICE %s :Syntaxi: OP <#Kanali> [nicks] <kodikos>\n",a)
-#define L035(a) S("NOTICE %s :Syntaxi: DEOP <#Kanali> [nicks] <kodikos>\n",a)
-#define L036(a) S("NOTICE %s :Kathorise ena nick!\n",a)
-#define L037(a,b) S("NOTICE %s :Dokimazo na kano /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Dokimase /nick %s-gios-ths-poutanas.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Fevgo apo to %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Mpeno sto %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Kathorise ena paratsoukli/Kanali!\n",a)
-#define L042(a) S("NOTICE %s :Vale to u@h pou tha dioxo\n",a)
-#define L043(a) S("NOTICE %s :Den vrika etsi ban.\n",a)
-#define L044(a) S("NOTICE %s :Vale to u@h pou thes na svisti!\n",a)
-#define L045(a) S("NOTICE %s :Pos sou fenete i idea na min to kano?\n",a)
-#define L046(a) S("PRIVMSG %s :Exo filaxi thn lista mou.\n",a)
-#define L047(a,b) S("NOTICE %s :Syntaxi: %cAUTOTOPIC <epikefalida> (vale \"0\" gia \
-na to apenergopiisis)\n",a,b)
-#define L048(a) S("NOTICE %s :Syntaxi: SETCHAN <Nea kanalia>\n",a)
-#define L049(a,b) S("NOTICE %s :Proepilegmeno kanali: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Syntaxi: SETCHAR <Nea anagnorisi gia ths entoles>\n",a)
-#define L051(a,b) S("NOTICE %s :I nea anagnorisi einai: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Syntaxi: SETUSER <Neon userid> (Prepi na xanaxekinisi to bot)\n",a)
-#define L053(a,b) S("NOTICE %s :Proepilegmeno userid: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Syntaxi: SETNICK <neoparatsoukli>\n",a)
-#define L055(a) S("NOTICE %s :Syntaxi: ADDUSER <#kanali> <*user@*.host> <dinami> <kodikos>. \
-diladi; ADDUSER #darkbot *jason@*.superlink.net 3 tonkodikotou ... xrisimopia #* gia na dosi \
-kapion dinami se ola ta kanalia.\n",a)
-#define L056(a) sprintf(temp, "Den exo xrisimopioisi to \2%cSETINFO\2 akoma!",a)
-#define L057(a,b,c) S("NOTICE %s :Prosthesa ton: %s - me dinami %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Syntaxi: %c%s <u@h> [dikeologia]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Proshethike sti lista ton monimon ban #%d, %s; logos: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Syntax: REPEAT <arithmos> <kathisterisi> <entoli-gia-ton-server>\n",a)
-#define L061(a) S("NOTICE %s :Egine.\n",a)
-#define L062(a) S("QUIT :Epanarxisi %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, ti thelis na prosthesis?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, ti thelis na prosthesis?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Ti na prostheso, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Ti proforia na protheso gia to %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Egine, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Ti na prostheso, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Ti proforia na protheso gia to %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Egine, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Ti na alaxo, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Ti pliroforia na alaxo %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s exis anavathimisti.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Iparxoun %s %d permban%s stin mnimi mou.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d defteropta exoun mini gia na xekiniso to randstuff\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: eixen %d xaraktires.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Epourxou %d pragmata%s sto Que.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Exo thi di %d na erxontai mexri tora.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Iparxoun %s %d server%s stin lista ton server. Eime ston \
-server #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, oi ento les arxizou apo: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :What should i be %sing for, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, prepi na pis mian diefthisi!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Den mporesa na to vro %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Ti thelis na po %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Na po ston %s giati pragma?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Se pion na po, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Ti thelis na po %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Na po ston %s giati pragma?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Se pion na po, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 ti rotises?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Se piraza na to xanapis? (Grapse %cHELP \
-gia thn syntaxi tou)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 ti rotises?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Se piraza na to xanapis? (Grapse %cHELP \
-gia thn syntaxi tou)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s eine stoned!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION xipna...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Exo gini flood. %d items.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Signomi %s, ala den iparhi boithia gia afto to thema pia.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Signomi %s, ala den iparhi boithia gia afto to thema pia.\n",a,b);
diff --git a/beta/source/langs/italian.h b/beta/source/langs/italian.h
deleted file mode 100755
index a773563..0000000
--- a/beta/source/langs/italian.h
+++ /dev/null
@@ -1,115 +0,0 @@
-#define I_SPEAK "Io parlo italiano."
-#define L001(a,b) S("PRIVMSG %s :Non hai ancora una password settata, per farlo: \2/msg %s PASS \
-<vecchiapass> <nuovapass>\2 (siccome e' la prima volta che lo fai, usa '0' come vecchia password)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Permban #%d eliminato, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Impossibile aprire %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, ci sono %d SEEN nel mio database.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Credo che tu ne sappia sicuramente piu' di me, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, non ho visto %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic su %s era OFF\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic su %s e' ora OFF\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ON: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s AGGIORNATO: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, fatto. Ora ci sono %d randomstuff.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :La password di %s e' stata modificata.\n",a,b)
-#define L013(a) S("NOTICE %s :Password errata! Ora chiamo la polizia per intrusioni in sistema informatico \
-altrui!\n",a)
-#define L014(a) S("NOTICE %s :Nessun riferimento!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Eliminato utente: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Errore di divisione per zero!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Operazione illegale!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (aggiunto l'ignore #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Aggiungo l'ignore #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Aggiornato #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d riferimenti inclusi nella ricerca.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Trovati piu' di \37%d\37 riferimenti, per favore riduci la ricerca\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Ho trovato \37un\37 riferimento, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Ho trovato \37%d\37 riferimenti, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Ho trovato %ld topic duplicati e li ho rimossi.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Sono un %s. Ho %ld topic nel mio database. Uptime: \
-%d day%s, %02d:%02d. Ci sono state %ld cose chieste, %ld aggiunte, e %ld eliminate. \
-Tempo di risposta: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Sono un %s. Ho %ld topic nel mio database. Uptime: \
-%d hour%s, %d min%s. Ci sono state %ld cose chieste, %ld aggiunte, e %ld eliminate. \
-Tempo di risposta: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Sono un %s. Ho %ld topic nel mio database. Uptime: \
-%d min%s, %d sec%s. Ci sono state %ld cose chieste, %ld aggiunte, e %ld eliminate. \
-Tempo di risposta: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Ho eliminato il topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 Non esiste il topic %s. Eliminazione fallita.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Ho eliminato il topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 Non esiste il topic %s. Eliminazione fallita.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Sintassi: \2/msg %s PASS <vecchiapass> <nuovapass>\2\n",a,b)
-#define L032(a) Snow("QUIT :C'e' \2%s\2 che mi dice di shtutarmi e io mi shtuto ...\n",a)
-#define L033(a) S("NOTICE %s :Sintassi: UP <#chan> <pass>\n",a)
-#define L034(a) S("NOTICE %s :Sintassi: OP <#chan> [nicks] <pass>\n",a)
-#define L035(a) S("NOTICE %s :Sintassi: DEOP <#chan> [nicks] <pass>\n",a)
-#define L036(a) S("NOTICE %s :Specifica un nick!\n",a)
-#define L037(a,b) S("NOTICE %s :Provo a fare /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Prova /nick %s-lamer.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Esco da %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Entro in %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Specifica un nick/chan!\n",a)
-#define L042(a) S("NOTICE %s :Inserisci la hostmask (u@h) da eliminare!\n",a)
-#define L043(a) S("NOTICE %s :Ban inesistente.\n",a)
-#define L044(a) S("NOTICE %s :Inserisci la hostmask (u@h) da cancellare!\n",a)
-#define L045(a) S("NOTICE %s :Come mai non lo faccio?\n",a)
-#define L046(a) S("PRIVMSG %s :Copia di riserva del database effettuata.\n",a)
-#define L047(a,b) S("NOTICE %s :Sintassi: %cAUTOTOPIC <topic> (settalo a \"0\" per disattivare)\n",a,b)
-#define L048(a) S("NOTICE %s :Sintassi: SETCHAN <nuovi canali>\n",a)
-#define L049(a,b) S("NOTICE %s :Canale di default: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Sintassi: SETCHAR <nuovo command char>\n",a)
-#define L051(a,b) S("NOTICE %s :Il nuovo command char ora e': %c\n",a,b)
-#define L052(a) S("NOTICE %s :Sintassi: SETUSER <nuovo ident> (richiede un !restart)\n",a)
-#define L053(a,b) S("NOTICE %s :L'ident di default ora e': %s\n",a,b)
-#define L054(a) S("NOTICE %s :Sinstassi: SETNICK <nuovonick>\n",a)
-#define L055(a) S("NOTICE %s :Sintassi: ADDUSER <#chan> <*user@*.host> <level> <pass>. Es: ADDUSER #darkbot \
-*jason@*.superlink.net 3 suaPasswd ... usa #* se vuoi dare accesso su tutti i canali.\n",a)
-#define L056(a) sprintf(temp, "Non ho ancora usato \2%cSETINFO\2!",a)
-#define L057(a,b,c) S("NOTICE %s :Aggiunto l'utente %s con level %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Sintassi: %c%s <u@h> [motivo]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Aggiunto in permban #%d, %s; motivo: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Sintassi: REPEAT <numero> <intervallo> <dati raw>\n",a)
-#define L061(a) S("NOTICE %s :Fatto.\n",a)
-#define L062(a) S("QUIT :Coi superpoteri, il %s si shtuta e si rippiccia !!\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, cosa vuoi aggiungere?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, cosa vuoi aggiungere?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Aggiungere cosa, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: che info devo aggiungere per %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Okay, %s, ho imparato una cosa nuova! :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Aggiungere cosa, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: che info devo aggiungere per %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Okay, %s, ho imparato una cosa nuova! :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Sostiuire cosa, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: quale info deve andare a sostituire %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s e' stato aggiornato.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Ci \"%s\" (licenza poetica) %d permban%s caricati in ram.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, mancano %d secondi al prossimo randstuff\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: era lungo %d caratteri.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, ci sono %d item%s in coda.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Finora ho visto %d joins.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Ci \"%s\" (licenza poetica) %d server%s nella mia lista. Al momento sono \
-sul server #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, il mio command char e': %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Che cosa dovrei %sare, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, devi specificare un indirizzo!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Non riesco a risolvere %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: cosa vuoi che dica a %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, che devo dire a %s?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :A chi devo dirlo, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: cosa vuoi che dica a %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, che devo dire a %s?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :A chi devo dirlo, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 chiedevi?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Ti spiacerebbe richiedermelo? (Usa %cHELP per avere \
-suggerimenti sulla sintassi)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 chiedevi?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Ti spiacerebbe richiedermelo? (Usa %cHELP per avere \
-suggerimenti sulla sintassi)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s e' rincoglionito!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION si sveglia da un brutto sogno...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Sono sotto flood. Sputo fuori tutta la queue. \
-%d oggetti eliminati.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Spiacente %s, ma sostegno quel soggetto è stato rimosso.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Spiacente %s, ma sostegno quel soggetto è stato rimosso.\n",a,b);
diff --git a/beta/source/langs/lang.h b/beta/source/langs/lang.h
deleted file mode 100755
index 4f88c4c..0000000
--- a/beta/source/langs/lang.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#if LANG == 1
-#include "english.h"
-#endif
-#if LANG == 2
-#include "french.h"
-#endif
-#if LANG == 3
-#include "spanish.h"
-#endif
-#if LANG == 4
-#include "dutch.h"
-#endif
-#if LANG == 5
-#include "latin.h"
-#endif
-#if LANG == 6
-#include "greek.h"
-#endif
-#if LANG == 7
-#include "ebonics.h"
-#endif
-#if LANG == 8
-#include "latin2.h"
-#endif
-#if LANG == 9
-#include "russian.h"
-#endif
-#if LANG == 10
-#include "russian2.h"
-#endif
-#if LANG == 11
-#include "portuguese.h"
-#endif
-#if LANG == 12
-#include "german.h"
-#endif
-#if LANG == 13
-#include "italian.h"
-#endif
-#if LANG == 14
-#include "chinese.h"
-#endif
-#if LANG == 15
-#include "swedish.h"
-#endif
-#if LANG == 16
-#include "norwegian.h"
-#endif
-#if LANG == 17
-#include "romanian.h"
-#endif
-#if LANG == 18
-#include "arabic.h"
-#endif
-#if LANG == 19
-#include "taiwanish.h"
-#endif
-
-#ifndef L091
-#define L091(a) S("NOTICE %s :Syntax: SETVHOST <new Vhost> (requires a restart)\n",a)
-#endif
-#ifndef L092
-#define L092(a,b) S("NOTICE %s :Default Vhost now: %s\n",a,b)
-#endif
diff --git a/beta/source/langs/latin.h b/beta/source/langs/latin.h
deleted file mode 100755
index 62beaca..0000000
--- a/beta/source/langs/latin.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#define I_SPEAK "I speak Latin"
-#define L001(a,b) S("PRIVMSG %s :Non posuisti tesserae, ut ponere tesserae: \2/msg %s PASS \
-<tessera senex> <tessera nova>\2 (quod hoc est tempus primum tuum ponendo tesseram, uti '0' \
-quam tesserae tua senex)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Delevi permban #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Non possum aperire %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Habeo %d SEEN's in basis factorum mea.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Scis plus illius quam scio, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Non vidi %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic in %s erat OFF\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic in %s modo est OFF\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ON: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s MUTABAT: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, peragebam. Habeo %d randomstuffs.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Tessera pro %s mutavit.\n",a,b)
-#define L013(a) S("NOTICE %s :Tessera mendosa!\n",a)
-#define L014(a) S("NOTICE %s :Non habeo pari!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Cliens delevit: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Divisio pro nihil error!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Effectio illicita!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (addendo praeteriendo #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Addendo praeteriendo #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Mutabam #%d: \37[\37%s\37]\37 res\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d nomina investigabant.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Inveniebam plus quam \37%d\37 para, si placet coarcta \
-investigatio tua\2:\2 %s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Inveniebam \37unum\37 par, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Inveniebam \37%d\37 para, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Inveniebam %ld res duplices. Amovebantur.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Utiendo %s. Habeo %ld res in basis \
-factorum mea, Confui: %d dies%s, %02d:%02d, Habeo %ld quaestiones rogabant, %ld res addebant, \
-et %ld res delebant. Tempus de ratio: %1.4lf momenta%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Utiendo %s. Habeo %ld res in basis factorum \
-mea, Confui: %d horae%s, %d temporis momenta%s, Habeo %ld quaestiones rogabant, %ld res addebant, \
-et %ld res delebant. Tempus de ratio: %1.4lf momenta%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Utiendo %s. Habeo %ld res in basis factorum \
-mea, Confui: %d temporis momenta%s, %d momenta%s, Habeo %ld quaestiones rogabant, %ld res addebant, \
-et %ld res delebant. Tempus de ratio: %1.4lf momenta%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Delevi res #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 Non possum invenire res \37%s\37. Delendo deficiebat.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Delevi res #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 Non possum invenire res \37%s\37. Delendo deficiebat.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Syntaxis: \2/msg %s PASS <tessera senexa> <tessera nova>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (Quod dico!))\n",a)
-#define L033(a) S("NOTICE %s :Syntaxis: UP <canalis> <tessera>\n",a)
-#define L034(a) S("NOTICE %s :Syntaxis: OP <canalis> [agnomina] <tessera>\n",a)
-#define L035(a) S("NOTICE %s :Syntaxis: DEOP <canalis> [agnomina] <tessera>\n",a)
-#define L036(a) S("NOTICE %s :Subtiliter enumera agnomen!\n",a)
-#define L037(a,b) S("NOTICE %s :Temptando /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Tenta /nick %s-baro.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Relinquendo %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Subtiliter enumera agnomen/canalis!\n",a)
-#define L042(a) S("NOTICE %s :Intra cliens@hospes purgare!\n",a)
-#define L043(a) S("NOTICE %s :Non quam interdictum.\n",a)
-#define L040(a,b) S("PRIVMSG %s :Jungiendo %s\n",a,b)
-#define L044(a) S("NOTICE %s :Intra cliens@hospes delere!\n",a)
-#define L045(a) S("NOTICE %s :Quidni ago hoc?\n",a)
-#define L046(a) S("PRIVMSG %s :Exscribebam ex base factorum.\n",a)
-#define L047(a,b) S("NOTICE %s :SYNTAX: %cAUTOTOPIC <res> (pone ad \"0\" vertere \"off\")\n",a,b)
-#define L048(a) S("NOTICE %s :Syntaxis: SETCHAN <canales novi>\n",a)
-#define L049(a,b) S("NOTICE %s :Canalis delictum: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Syntaxis: SETCHAR <littera jussum nova>\n",a)
-#define L051(a,b) S("NOTICE %s :Littera jussum nova jam: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Syntaxis: SETUSER <cliens novus> (poscit reinitium)\n",a)
-#define L053(a,b) S("NOTICE %s :Cliens delictum jam: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Syntaxis: SETNICK <agnomen novum>\n",a)
-#define L055(a) S("NOTICE %s :Syntaxis: ADDUSER <canalis> <*cliens@*.hospes> <planities> <tessera>. \
-ie; ADDUSER #darkbot *jason@*.superlink.net 3 tessera-sui ... uti #* si vis dare penetrare ad canales \
-omnes.\n",a)
-#define L056(a) sprintf(temp, "Non utuvi \2%cSETINFO\2 tamen!",a)
-#define L057(a,b,c) S("NOTICE %s :Addebam cliens: %s - planities %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Syntaxis: %c%s <cliens@hospes> [ratio]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Addebam in permban #%d, %s; ratio: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Syntaxis: REPEAT <numerus> <mora> <facta crudi>\n",a)
-#define L061(a) S("NOTICE %s :Termino.\n",a)
-#define L062(a) S("QUIT :Reinitium %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, quid vis addere?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, quid vis addere?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Addere quid, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Quid res addere pro %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Ita, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Quid reponit, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Quid res debet reponere %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s mutavit.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Habeo %s %d permban%s onerant in RAM.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d momenta usque ad randstuff\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: erat %d lettrae.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Habeo %d res%s in Que.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Vidui %d jungendis adhuc.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Habeo %s %d societates%s in numerus de societas mea. Sum in \
-societas #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, Littera jussum mea est: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Quid debeo %sing pro, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, requiris subtiliter enumerare alloquio!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Non possum convidere %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Quid me vis dicere %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Dico %s de quid?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Dico quis, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Quid me vis dicere %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Dico %s de quid?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Dico quis, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 rogas?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Potes verbis rexprimere illud? (Exara in machinam \
-scriptoriam %cHELP pro significationes syntaxium)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 rogas?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Potes verbis rexprimere illud? (Exara in machinam \
-scriptoriam %cHELP pro significationes syntaxium)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s est lapidando!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION expergit...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Inundo. demittendi fructus Que (facta illa exspectabante mandare). \
-%d res.\n",a,b)
diff --git a/beta/source/langs/latin2.h b/beta/source/langs/latin2.h
deleted file mode 100755
index 310b7af..0000000
--- a/beta/source/langs/latin2.h
+++ /dev/null
@@ -1,114 +0,0 @@
-#define I_SPEAK "I speak Pig Latin."
-#define L001(a,b) S("PRIVMSG %s :Youway avehay otnay etsay away asswordpay, otay etsay away asspay: \2/msg %s PASS \
-<oldpass> <newpass>\2 (incesay isthay isway yourway irstfay imetay ettingsay away asspay, usewau '0' asway yourway oldway asspay)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Eletedday ermbanpay #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Unableway otay openway %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Ereth areway %d EENSAY'say inway ymay atabaseday.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :You'dway owknay oremay aboutway atthay anthay Iway oday, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Iway avehay otnay eensay %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopicway onway %s asway OFFWAY\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopicway onway %s isway ownay OFFWAY\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPICWAY @ %s ONWAY: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPICWAY @ %s UPDATEDWAY: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, oneday. Erethay areway ownay %d andomstuffsray.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Asswordpay orfay %s ashay eenbay updatedway.\n",a,b)
-#define L013(a) S("NOTICE %s :Incorrectway asswordpay!\n",a)
-#define L014(a) S("NOTICE %s :Onay atchmay!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Eletedday userway: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Ivisionday ybay erozay errorway!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Illegalway operationway!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (addingway ignoreway #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Addingway ignoreway #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Updatedway #%d: \37[\37%s\37]\37 infoway\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d entriesway earchedsay.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Oundfay oremau anthay \37%d\37 atchesmay, easeplay arrownay ownday yourway earchsay\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Iway oundfay \37oneway\37 atchmay, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Iway oundfay \37%d\37 atchesmay, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Oundfay %ld opictay uplicatesday. Eythay ereway emovedray.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Unningray %s. Iway avehay %ld opicstay inway ymay atabaseday, Uptimeway: \
-%d ayday%s, %02d:%02d, Erethay avehay eenbay %ld uestionsqay askedway, %ld opictay additionsway, andway %ld opictay eletionsday. \
-Rocesspay imetay: %1.4lf ecsay%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Unningray %s. Iway avehay %ld opicstay inway ymay atabaseday, Uptimeway: \
-%d ourhay%s, %d inmay%s, Erethay avehay eenbay %ld uestionsqay askedway, %ld opictay additionsway, andway %ld opictay eletionsday. \
-Rocesspay imetay: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Unningray %s. Iway avehay %ld opicstay inway ymay atabaseday, Uptimeway: \
-%d inmay%s, %d ecsay%s, Erethay avehay eenbay %ld uestionsqay askedway, %ld opictay additionsway, andway %ld opictay eletionsday. \
-Rocesspay imetay: %1.4lf ecsay%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Iway avehay eletedday opictay #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 Iway asway unableway otay indfay ethay opictay %s. Eleteday ailedfay.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Iway avehay eletedday opictay #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 Iway asway unableway otay indfay ethay opictay %s. Eleteday ailedfay.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Yntaxsay: \2/msg %s PASS <oldpass> <newpass>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (ausecay Iway aysay osay!))\n",a)
-#define L033(a) S("NOTICE %s :Yntaxsay: UP <#chan> <pass>\n",a)
-#define L034(a) S("NOTICE %s :Yntaxsay: OP <#chan> [nicks] <pass>\n",a)
-#define L035(a) S("NOTICE %s :Yntaxsay: DEOP <#chan> [nicks] <pass>\n",a)
-#define L036(a) S("NOTICE %s :Ecifyspay away icknay!\n",a)
-#define L037(a,b) S("NOTICE %s :Attemptingway otay /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Ytray /nick %s-orkday.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Eavinglay %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Oiningjay %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Ecifyspay away icknay/anchay!\n",a)
-#define L042(a) S("NOTICE %s :Enterway ethay u@h otay urgepay!\n",a)
-#define L043(a) S("NOTICE %s :Onay uchsay anbay.\n",a)
-#define L044(a) S("NOTICE %s :Enterway ethay u@h otay eleteday!\n",a)
-#define L045(a) S("NOTICE %s :Owhay aboutway Iway otnay oday atthay?\n",a)
-#define L046(a) S("PRIVMSG %s :Ackedbay upway atabaseday.\n",a)
-#define L047(a,b) S("NOTICE %s :YNTAXSAY: %cAUTOTOPIC <topic> (etsay otay \"0\" otay urntay offway)\n",a,b)
-#define L048(a) S("NOTICE %s :Yntaxsay: SETCHAN <new channels>\n",a)
-#define L049(a,b) S("NOTICE %s :Efaultday annelchay: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Yntaxsay: SETCHAR <new command char>\n",a)
-#define L051(a,b) S("NOTICE %s :Ewnay ommandcay archay ownay: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Yntaxsay: SETUSER <new userid> (equiresray away estartray)\n",a)
-#define L053(a,b) S("NOTICE %s :Efaultday useridway ownay: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Yntaxsay: SETNICK <newnick>\n",a)
-#define L055(a) S("NOTICE %s :Yntaxsay: ADDUSER <#chan> <*user@*.host> <level> <pass>. ie; ADDUSER #darkbot \
-*jason@*.superlink.net 3 hisPasswd ... useway #* ifway youway antway otay ivegay accessway inway allway anschay.\n",a)
-#define L056(a) sprintf(temp, "Iway avenhay'tay usedway \2%cSETINFO\2 yet!",a)
-#define L057(a,b,c) S("NOTICE %s :Addedway userway: %s - evellay %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Yntaxsay: %c%s <u@h> [reason]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Addedway inway ermbanpay #%d, %s; easonray: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Yntaxsay: REPEAT <number> <delay> <raw-data>\n",a)
-#define L061(a) S("NOTICE %s :Oneday.\n",a)
-#define L062(a) S("QUIT :Estartingray %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, atwhay oday youway antway otay addway?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, atwhay oday youway antway otay addway?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Addway atwhay, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Atwhay infoway otay ebay addedway orfay %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Okayway, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Addway atwhay, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Atwhay infoway otay ebay addedway orfay %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Okayway, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Eplaceray atwhay, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Atwhay infoway ouldshay eplaceray %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s ashay eenbay updatedway.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Erethay %s %d ermbanpay%s oadedlay intoway amray.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d econdssay eftlay illtay andstuffray\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: itway asway %d arschay onglay.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Erethay isway urrentlycay %d itemway%s inway Que.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Iway avehay eensay %d oinsjay usthay arfay.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Erethay %s %d erversay%s inway ymau erversay istlay. Iway amway urrentlycay onway \
-erversay #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, ymay ommandcay archay isway: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Atwhay ouldshay Iway ebay %sing orfay, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, youway eednay otay ecifyspay anway addressway!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Asway unableway otay ooklay upway %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Atwhay oday youway antway emay otay elltay %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Elltay %s aboutway atwhay?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Elltay owhay, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Atwhay oday youway antway emay otay elltay %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Elltay %s aboutway atwhay?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Elltay owhay, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 youway ereway askingway?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Indmay ephrasingray atthay? (Ypetay %cHELP orfay yntaxsay \
-hints)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 youway ereway askingway?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Indmay ephrasingray atthay? (Ypetay %cHELP orfay yntaxsay \
-hints)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s isway onedstay!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION akesway upway...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Iway'may eingbay oodedflay. Umpingday outputway Que. \
-%d itemsway eletedday.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Orrysay %s, utbay upportsay orfay atthay opictay ashay eenbay emovedray.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Orrysay %s, utbay upportsay orfay atthay opictay ashay eenbay emovedray.\n",a,b);
\ No newline at end of file
diff --git a/beta/source/langs/norwegian.h b/beta/source/langs/norwegian.h
deleted file mode 100755
index b2988f1..0000000
--- a/beta/source/langs/norwegian.h
+++ /dev/null
@@ -1,113 +0,0 @@
-#define I_SPEAK "Jeg snakker norsk."
-#define L001(a,b) S("PRIVMSG %s :Du har ikke satt noe passord, for å sette passord: \2/msg %s PASS \
- <gammeltpassord> <nyttpassord>\2 (siden dette er første gang du setetr passord, bruk '0' som gammeltpassord)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Slettet permanent ban #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Kan ikke åpne %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Det finnes %d SEENs i min database.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Du vet mere om det enn hva jeg gjør, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Jeg har ikke sett %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic on %s var OFF\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic on %s er nå OFF\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ON: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s OPPDATERT: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, ferdig. Det finnes nå %d random-ting.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Passord for %s er oppdatert.\n",a,b)
-#define L013(a) S("NOTICE %s :Feil passord!\n",a)
-#define L014(a) S("NOTICE %s :Ingen som passer!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Slettet bruker: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Divisjon med null!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Ugyldig operasjon!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (du er herved ignorert #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Du er herved ignorert #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Oppdatert #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d antall linjer søkt.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Fant mer enn \37%d\37 treff, venligst vær mer spesifikk\2:\2 \%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Jeg fant \37one\37 treff, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Jeg fant \37%d\37 treff, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :jeg fant %ld duplikate temaer, som ble fjernet.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Kjører %s. Jeg har %ld temaer i databasen min, Oppetid: \
-%d dager%s, %02d:%02d, Det har vært %ld spørsmål, %ld topic tillegg, og %ld topic deklerasjoner. \
-Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Kjører %s. Jeg har %ld temaer i databasen min, Oppetid: \
-%d timer%s, %d min%s, Det har vært %ld spørsmål, %ld topic tillegg, og %ld topic deklerasjoner. \
-Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Kjører %s. Jeg har %ld temaer i databasen min, Oppetid: \
-%d min%s, %d sek%s, Det har vært %ld spørsmål, %ld topic tillegg, og %ld topic deklerasjoner. \
-Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Jeg har slettet topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 I Kunne ikke finne tema %s. Delete failed.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Jeg har slettet topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 I Kunne ikke finne tema %s. Delete failed.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Syntax: \2/msg %s PASS <gammeltpassord> <nyttpassord>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (Fordi, derfor!))\n",a)
-#define L033(a) S("NOTICE %s :Syntaks: UP <#chan> <passord>\n",a)
-#define L034(a) S("NOTICE %s :Syntaks: OP <#chan> [nicks] <passord>\n",a)
-#define L035(a) S("NOTICE %s :Syntaks: DEOP <#chan> [nicks] <passord>\n",a)
-#define L036(a) S("NOTICE %s :Spessifiser et nick!\n",a)
-#define L037(a,b) S("NOTICE %s :Forsøker å gjøre /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Prøv /nick %s-dork.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Forlater %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s : %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Spessifiser et nick/kanal!\n",a)
-#define L042(a) S("NOTICE %s :Skriv inn u@h for å sjekke!\n",a)
-#define L043(a) S("NOTICE %s :Finnes ikke et slikt ban.\n",a)
-#define L044(a) S("NOTICE %s :Skriv inn u@h som skal slettes!\n",a)
-#define L045(a) S("NOTICE %s :Hva med at jeg ikke gjør det?\n",a)
-#define L046(a) S("PRIVMSG %s :Sikkerhetskopierte databasen.\n",a)
-#define L047(a,b) S("NOTICE %s :SYNTAX: %cAUTOTOPIC <topic> (satt til \"0\" for å slå av)\n",a,b)
-#define L048(a) S("NOTICE %s :Syntaks: SETCHAN <nye kanaler>\n",a)
-#define L049(a,b) S("NOTICE %s :Standard kanal: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Syntaks: SETCHAR <ny kommando tegn>\n",a)
-#define L051(a,b) S("NOTICE %s :nytt kommando tegn nå: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Syntaks: SETUSER <ny userid> (behøver en restart)\n",a)
-#define L053(a,b) S("NOTICE %s :Standard userid nå: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Syntaks: SETNICK <nyttnick>\n",a)
-#define L055(a) S("NOTICE %s :Syntaks: ADDUSER <#kanal> <*user@*.host> <level> <passord>. mao; ADDUSER #darkbot \
-*jason@*.superlink.net 3 PassordetHans ... bruk #* hvis du vil at han skal ha tilgang på alle kanaler.\n",a)
-#define L056(a) sprintf(temp, "Jeg har ikke brukt \2%cSETINFO\2 enda!",a)
-#define L057(a,b,c) S("NOTICE %s :La til bruker: %s - level %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Syntaks: %c%s <u@h> [begrunnelse]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :La til i permanentban #%d, %s; begrunnelse: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Syntaks: REPEAT <nummer> <forsinkelse> <rå-data>\n",a)
-#define L061(a) S("NOTICE %s :Ferdig.\n",a)
-#define L062(a) S("QUIT :Restarter %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, hva vil du legge til?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, hva vil du legge til?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Legge til hva, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Hvilken info skal legges til for %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Greit, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Legge til hva, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Hvilken info skal legges til for %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Greit, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Erstatte hva, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Hvilken info skal erstattes %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s har blitt oppdatert.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Det er %s %d permanentebans%s lastet i minnet.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d sekunder igjen til randstuff\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: den var %d tegn lang.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Der finnes %d objekter%s i køen.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Jeg har ikke sett %d vært her til nå.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Det finnes %s %d servere%s i min server liste. Jeg bruker nå \
-server #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, mitt kommando tegn er: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Hva burde jeg %sing for, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, du må spessifisere en adresse!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Kunne ikke finne %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Hva vil du jeg skal fortelle %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Fortell %s om hva?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Fortelle hvem, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Hva vil du jeg skal fortelle %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Fortell %s om hva?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Fortelle hvem, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 du spurte?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Ehh, gjenta? (skriv %cHELP for syntaks \
-hints)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 du spurte?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Ehh, gjenta? (skriv %cHELP for syntaks \
-hints)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s is stoned!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION våkner opp...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :jeg blir floodet. Dumper utgående kø. \
- %d objekter slettet.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Beklager %s, men støtten for det emnet har blitt fjernet.\n",a,b);
- #define Lbadtopic2(a,b) S("NOTICE %s :Beklager %s, men støtten for det emnet har blitt fjernet.\n",a,b);
\ No newline at end of file
diff --git a/beta/source/langs/portuguese.h b/beta/source/langs/portuguese.h
deleted file mode 100755
index 9e375ee..0000000
--- a/beta/source/langs/portuguese.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#define I_SPEAK "Falo português e um pouco de inglês."
-#define L001(a,b) S("PRIVMSG %s :Não foi ainda definida a senha, para o fazer: \2/msg %s PASS \
-<senha_anterior> <senha_nova>\2 (já que esta é a primeira vez que a senha é configurada, usar '0' como senha anterior)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Removido ban permanente (permban) #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Não foi possível abrir %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Há %d SEENs na minha base de dados.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Sabes melhor que eu acerca disso, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Não vi %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Tópico automático (Autotopic) em %s estava desligado\n",a,b)
-#define L008(a,b) S("NOTICE %s :Tópico automático (Autotopic) em %s foi desligado\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :Tópico automático (Autotopic) em %s LIGADO: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :Tópico automático (Autotopic) em %s ACTUALIZADO: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, Processado! Há agora %d frases para execução casual (randomstuffs).\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Senha de %s actualizada.\n",a,b)
-#define L013(a) S("NOTICE %s :Senha incorrecta!\n",a)
-#define L014(a) S("NOTICE %s :Nada encontrado!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Usuário removido: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Erro de divisão por zero!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Operação Incorrecta! (Usar entre os números +, -, *, /, para somar, subtrair, multiplicar e dividir respectivamente)!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (Adicionado usuário a ser ignorado #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Adicionado usuário a ser ignorado #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Actualizado #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d itens verificados.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Encontrados mais que \37%d\37 itens, por favor tentar ser-se mais específico\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Encontrei \37um\37 item, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Encontrados \37%d\37 itens, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Encontrados %ld temas repetidos. Foram removidos.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Análise a %s. Tenho %ld temas na minha Base de Dados. Tempo desde que me liguei: \
-%d dias%s, %02d:%02d, Foram feitas %ld perguntas, adicionados %ld temas e removidos %ld. \
-Tempo de processamento: %1.4lf segundo%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Análise a %s. Tenho %ld temas na minha Base de Dados. Tempo desde que me liguei: \
-%d horas%s, %d minuto%s, Foram feitas %ld perguntas, adicionados %ld temas e removidos %ld. \
-Tempo de processamento: %1.4lf segundo%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Análise a %s. Tenho %ld temas na minha Base de Dados. Tempo desde que me liguei: \
-%d minuto%s, %d segundo%s, Foram feitas %ld perguntas, adicionados %ld temas e removidos %ld. \
-Tempo de processamento: %1.4lf segundo%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Removido o tópico #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 Não consegui encontrar o tópico %s. Remoção abortada.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Removido o tópico #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 Não consegui encontrar o tópico %s. Remoção abortada.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Sintaxe: \2/msg %s SENHA <senha_anterior> <senha_nova>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (manutenção!)\n",a)
-#define L033(a) S("NOTICE %s :Sintaxe: UP <#canal> <senha>\n",a)
-#define L034(a) S("NOTICE %s :Sintaxe: OP <#canal> [nicks] <senha>\n",a)
-#define L035(a) S("NOTICE %s :Sintaxe: DEOP <#canal> [nicks] <senha>\n",a)
-#define L036(a) S("NOTICE %s :Especificar um nick!\n",a)
-#define L037(a,b) S("NOTICE %s :Mudança para /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Tentar /nick %s-idiota.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Saindo %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Entrando %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Especificar um nick/canal!\n",a)
-#define L042(a) S("NOTICE %s :Especificar o u@h para remoção!\n",a)
-#define L043(a) S("NOTICE %s :Ban não existente.\n",a)
-#define L044(a) S("NOTICE %s :Especificar o u@h para remover!\n",a)
-#define L045(a) S("NOTICE %s :Faz isso a outro nick, não a mim\n",a)
-#define L046(a) S("PRIVMSG %s :Processamento de cópia da Base de Dados executada.\n",a)
-#define L047(a,b) S("NOTICE %s :Sintaxe: %cAUTOTOPIC <tópico> (escrever um \"0\" (zero) para desligar a função)\n",a,b)
-#define L048(a) S("NOTICE %s :Sintaxe: SETCHAN <#canal>\n",a)
-#define L049(a,b) S("NOTICE %s :Canal inicial: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Sintaxe: SETCHAR <novo caracter de comando>\n",a)
-#define L051(a,b) S("NOTICE %s :Novo caracter de comando é agora: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Sintaxe: SETUSER <novo userid> (necessário reiniciar)\n",a)
-#define L053(a,b) S("NOTICE %s :userid é agora: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Sintaxe: SETNICK <novo_nick>\n",a)
-#define L055(a) S("NOTICE %s :Sintaxe: ADDUSER <#canal> <*user@*.host> <nível> <senha>. ex; ADDUSER #darkbot \
-*jason@*.superlink.net 3 sua_senha ... usar #* se pretende dar-se acesso a todos os canais.\n",a)
-#define L056(a) sprintf(temp, "Não foi feito \2%cSETINFO\2 ainda!",a)
-#define L057(a,b,c) S("NOTICE %s :Adicionado usuário: %s - nível %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Sintaxe: %c%s <u@h> [razão]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Adicionado em permban #%d, %s; razão: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Sintaxe: REPEAT <número de vezes> <intervalo> <data>\n",a)
-#define L061(a) S("NOTICE %s :Feito.\n",a)
-#define L062(a) S("QUIT :Reiniciando %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, o que é necessário adicionar?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, o que é necessário adicionar?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Adicionar o quê, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Que informação é para ser adicionada ao tópico %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Ok, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Adicionar o quê, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Que informação é para ser adicionada ao tópico %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Ok, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Substituir o quê, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Que informação deve ser substituída %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s substituído com sucesso.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :%s há %d Ban permanente%s em memória.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, faltam %d segundos até á próxima frase casual (randstuff)\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: tinha %d caracteres.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, há neste momento %d iten%s no ponto.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Vi %d entradas de usuários no canal até ao momento.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Há %s %d server%s na minha lista de servers. Encontro-me neste momento no \
-server #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, o meu caracter de comando é: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :%s??? Procuro o quê %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, é necessário especificar um endereço!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :impossibilitado em verificar %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: O que digo a %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Digo a %s o quê?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Digo a quem, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: O que digo a %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Digo a %s o quê?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Digo a quem, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 é uma pergunta?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Por favor repetir a pergunta (escrever %cHELP para o sintaxe ta mesma \
-hints)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 é uma pergunta?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Por favor repetir a pergunta (escrever %cHELP para o sintaxe ta mesma \
-hints)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s está lento!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION acorda...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :estou a ser alvo de flood. Esvaziando itens do ponto. \
-%d itens removidos.\n",a,b)
-#define L091(a) S("NOTICE %s :Sintaxe: SETVHOST <Vhost novo> (requer que se reinicie)\n",a)
-#define L092(a,b) S("NOTICE %s :Vhost está agora configurado para: %s\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Pesaroso %s, mas sustentação para esse tópico foi removido.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Pesaroso %s, mas sustentação para esse tópico foi removido.\n",a,b);
\ No newline at end of file
diff --git a/beta/source/langs/romanian.h b/beta/source/langs/romanian.h
deleted file mode 100755
index 69f5108..0000000
--- a/beta/source/langs/romanian.h
+++ /dev/null
@@ -1,114 +0,0 @@
-#define I_SPEAK "Vorbesc Romana."
-#define L001(a,b) S("PRIVMSG %s :Inca nu ai stabilit o parola, pentru a stabili una: \2/msg %s PASS \
-<parolaVeche> <parolaNoua>\2 (pentru ca este prima data cand stabilesti o parola, foloseste '0' pentru parolaVeche)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Am anulat ban-ul permanent #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Nu pot deschide %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Am %d SEEN'uri in baza de date.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Tu ar trebui sa stii mai multe decat mine, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, N-am dat cu ochii de %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic in %s era dezactivat \n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic in %s este acum dezactivat\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s Activ: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s actualizat: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, s-a facut! Acum am %d randomstuffs.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Parola pentru %s a fost actualizata.\n",a,b)
-#define L013(a) S("NOTICE %s :Parola incorecta!\n",a)
-#define L014(a) S("NOTICE %s :Nici o potrivire!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Am sters user-ul: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Nu se imparte prin 0!!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Operatie ilegala!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (adding ignore #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Ignor pe #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Actualizat: #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. am cautat in %d inregistrari.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Am gasit mai mult de \37%d\37 potriviri, te rog incearca sa reduci numarul\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Am gasit \37o\37 potrivire, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Am gasit \37%d\37 potriviri, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Am gasit %ld inregistrari dedublate...si le-am sters.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Rulez %s. Am %ld inregistrari in baza de date, Uptime: \
-%d zile%s, %02d:%02d, Am fost intrebat %ld intrebari, %ld inregistrari adaugate, si %ld inregistrari sterse. \
-Timp de procesare: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Rulez %s. Am %ld topics in baza de date, Uptime: \
-%d ore%s, %d min%s, Au fost puse %ld intrebari, %ld inregistrari noi, si %ld inregistrari sterse. \
-Timp de procesare: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Rulez %s. Am %ld inregistrari in baza de date, Uptime: \
-%d min%s, %d sec%s, S-au pus %ld intrebari, %ld inregistrari au fost adaugate, si %ld inregistrari au fost sterse. \
-Timp de procesare: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Am sters inregistrarea #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 Nu am gasit nici o inregistrare %s. Suprimare ratata.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Am sters inregistrarea #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 Nu am gasit nici o inregistrare %s. Suprimare ratata.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Syntax: \2/msg %s PASS <parolaVeche> <parolaNoua>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (pentru ca am zis eu!))\n",a)
-#define L033(a) S("NOTICE %s :Syntax: UP <#chan> <parola>\n",a)
-#define L034(a) S("NOTICE %s :Syntax: OP <#chan> [nicks] <parola>\n",a)
-#define L035(a) S("NOTICE %s :Syntax: DEOP <#chan> [nicks] <parola>\n",a)
-#define L036(a) S("NOTICE %s :Specifica un nick!\n",a)
-#define L037(a,b) S("NOTICE %s :Incerc /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Incearca /nick %s-fraiere.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Plec din %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Intru in %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Specifica un nick/canal!\n",a)
-#define L042(a) S("NOTICE %s :Specifica u@h-ul de sters!\n",a)
-#define L043(a) S("NOTICE %s :Acest ban nu exista.\n",a)
-#define L044(a) S("NOTICE %s :Specifica u@h-ul de sters!\n",a)
-#define L045(a) S("NOTICE %s :Ce-ar fi sa NU fac asta?\n",a)
-#define L046(a) S("PRIVMSG %s :Am facut copie de siguranta pentru baza de date.\n",a)
-#define L047(a,b) S("NOTICE %s :SINTAXA: %cAUTOTOPIC <topic> (seteaza-l \"0\" pentru a-l dezactiva)\n",a,b)
-#define L048(a) S("NOTICE %s :Sintaxa: SETCHAN <canalNou>\n",a)
-#define L049(a,b) S("NOTICE %s :Canalul implicit: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Sintaxa: SETCHAR <nou caracter de comanda>\n",a)
-#define L051(a,b) S("NOTICE %s :Noul caracter de comanda este: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Sintaxa: SETUSER <nou userID> (trebuie restart)\n",a)
-#define L053(a,b) S("NOTICE %s :userID-ul actual este: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Sintaxa: SETNICK <noulNick>\n",a)
-#define L055(a) S("NOTICE %s :Sintaxa: ADDUSER <#canal> <*user@*.host> <nivel> <parola>. exemplu; ADDUSER #darkbot \
-*jason@*.superlink.net 3 parolaLui ... foloseste #* daca vrei sa-i acorzi acces in toate canalele.\n",a)
-#define L056(a) sprintf(temp, "nu am folosit \2%cSETINFO\2 inca!",a)
-#define L057(a,b,c) S("NOTICE %s :Am adaugat userul: %s - nivel %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Sintaxa: %c%s <u@h> [motiv]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Am adugat ban-ul permanent #%d, %s; motiv: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Sintaxa: REPEAT <numar> <durataRepetitiei> <comanda irc>\n",a)
-#define L061(a) S("NOTICE %s :S-a facut.\n",a)
-#define L062(a) S("QUIT :Fac un restart %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, ce vrei sa adaugi?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, ce vrei sa adaugi?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Ce adaug, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Ce sa adaug pentru %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Okay, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Ce adaug, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Ce sa adaug pentru %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Okay, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Ce sa inlocuiesc, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Ce ar trebui sa inlocuiasca %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s a fost actualizat.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Am %s %d ban-uri permanente%s incarcate in ram.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d secunde ramase pana la randstuff\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: are %d caractere.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Sunt %d lucruri de zis%s in coada.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Am vazut %d join-uri pana acum.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Am %s %d servere%s in lista. Acum sunt pe server-ul \
-#%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, caracterul meu de comanda este: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Ce ar trebui sa %s, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, trebuie sa specifici o adresa!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Nu am putut sa caut %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Ce vrei sa-i spun lu' %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Sa-i spun lu' %s CE?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :CUI sa-i spun, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Ce vrei sa-i spun lu' %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Sa-i spun lu' %s CE?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :CUI sa-i spun, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 ce intrebai?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Ce-ar fi sa reformulezi? (scrie %cHELP pentru sintaxa \
-)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 ce intrebai?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Ce-ar fi sa reformulezi? (scrie %cHELP pentru sintaxa \
-)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s e inaccesibil!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION se trezeste...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Ma flood-eaza. Renunt la coada de comenzi. \
-%d comenzi sterse.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Ne pare rau %s, dar suportul pentru acel topic a fost anulat.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Ne pare rau %s, dar suportul pentru acel topic a fost anulat.\n",a,b);
\ No newline at end of file
diff --git a/beta/source/langs/russian.h b/beta/source/langs/russian.h
deleted file mode 100755
index 4122d3a..0000000
--- a/beta/source/langs/russian.h
+++ /dev/null
@@ -1,114 +0,0 @@
-#define I_SPEAK "ñ ÇÏ×ÏÒÀ ÐÏ ÒÕÓÓËÉ."
-#define L001(a,b) S("PRIVMSG %s :îÅ ÚÁÄÁÎ ÐÁÒÏÌØ, ÄÌÑ ÚÁÄÁÎÉÑ ÐÁÒÏÌÑ: \2/msg %s PASS \
-<ÓÔÁÒÙÊÐÁÒÏÌØ> <ÎÏ×ÙÊÐÁÒÏÌØ>\2 (Ô.Ë ÐÁÒÏÌØ ÚÁÄÁÅÔÓÑ ×ÐÅÒ×ÙÅ, ÕËÁÖÉÔÅ '0' ×ÍÅÓÔÏ ÓÔÁÒÏÇÏ ÐÁÒÏÌÑ)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :õÄÁÌÅÎ permban #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :îÅ ÍÏÇÕ ÏÔËÒÙÔØ %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, ñ ×ÉÖÕ %d SEEN'Ï× × ÍÏÅÊ ÂÁÚÅ.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :ôÙ ÚÎÁÅÛØ ÂÏÌØÛÅ, ÞÅÍ Ñ, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, ñ ÎÅ ×ÉÄÅÌ %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic on %s was OFF\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic on %s is now OFF\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ON: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s UPDATED: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, ÇÏÔÏ×Ï. ôÅÐÅÒØ Õ ÍÅÎÑ ÅÓÔØ %d ÈÏÈÍ.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :ðÁÒÏÌØ ÄÌÑ %s ÏÂÎÏ×ÌÅÎ.\n",a,b)
-#define L013(a) S("NOTICE %s :îÅ×ÅÒÎÙÊ ÐÁÒÏÌØ!\n",a)
-#define L014(a) S("NOTICE %s :îÅ ÍÏÇÕ ÎÁÊÔÉ!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :õÄÁÌÅÎ ÐÏÌØÚÏ×ÁÔÅÌØ: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: äÅÌÅÎÉÅ ÎÁ ÎÏÌØ!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: îÅ×ÅÒÎÁÑ ÏÐÅÒÁÃÉÑ!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (adding ignore #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Adding ignore #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :ïÂÎÏ×ÌÅÎÏ #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d ÚÁÐÉÓÅÊ ÐÒÏÓÍÏÔÒÅÎÏ.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :îÁÊÄÅÎÏ ÂÏÌÅÅ, ÞÅÍ \37%d\37 ÚÁÐÉÓÅÊ, ÓÕÚØÔÅ ÕÓÌÏ×ÉÑ ÐÏÉÓËÁ\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :ñ ÎÁÛÅÌ \37ÏÄÎÕ\37 ÚÁÐÉÓØ, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :ñ ÎÁÛÅÌ \37%d\37 ÚÁÐÉÓÅÊ, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :îÁÊÄÅÎÏ %ld ÐÏ×ÔÏÒÑÀÝÉÈÓÑ ÔÅÍ. õÄÁÌÅÎÙ.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :úÁÐÕÝÅÎ ÎÁ %s. õ ÍÅÎÑ ÅÓÔØ %ld ÔÅÍ × ÂÁÚÅ ÄÁÎÎÙÈ, ÷ÒÅÍÑ ÒÁÂÏÔÙ: \
-%d ÄÎÅÊ%s, %02d:%02d, âÙÌÏ ÚÁÄÁÎÏ %ld ×ÏÐÒÏÓÏ×, %ld ÔÅÍ ÄÏÂÁ×ÌÅÎÏ, É %ld ÔÅÍ ÕÄÁÌÅÎÏ. \
-÷ÒÅÍÑ ÉÓÐÏÌÎÅÎÉÑ: %1.4lf ÓÅËÕÎÄ%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :úÁÐÕÝÅÎ ÎÁ %s. õ ÍÅÎÑ ÅÓÔØ %ld ÔÅÍ × ÂÁÚÅ ÄÁÎÎÙÈ, ÷ÒÅÍÑ ÒÁÂÏÔÙ: \
-%d ÞÁÓÏ×%s, %d ÍÉÎÕÔ%s, âÙÌÏ ÚÁÄÁÎÏ %ld ×ÏÐÒÏÓÏ×, %ld ÔÅÍ ÄÏÂÁ×ÌÅÎÏ, É %ld ÔÅÍ ÕÄÁÌÅÎÏ. \
-÷ÒÅÍÑ ÉÓÐÏÌÎÅÎÉÑ: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :úÁÐÕÝÅÎ ÎÁ %s. õ ÍÅÎÑ ÅÓÔØ %ld ÔÅÍ × ÂÁÚÅ ÄÁÎÎÙÈ, ÷ÒÅÍÑ ÒÁÂÏÔÙ: \
-%d min%s, %d sec%s, âÙÌÏ ÚÁÄÁÎÏ %ld ×ÏÐÒÏÓÏ×, %ld ÔÅÍ ÄÏÂÁ×ÌÅÎÏ, É %ld ÔÅÍ ÕÄÁÌÅÎÏ. \
-÷ÒÅÍÑ ÉÓÐÏÌÎÅÎÉÑ: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: õÄÁÌÅÎÁ ÔÅÍÁ #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 îÅ ÍÏÇÕ ÎÁÊÔÉ ÔÅÍÕ %s. õÄÁÌÅÎÉÅ ÎÅÕÄÁÌÏÓØ.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: õÄÁÌÅÎÁ ÔÅÍÁ #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 îÅ ÍÏÇÕ ÎÁÊÔÉ ÔÅÍÕ %s. õÄÁÌÅÎÉÅ ÎÅÕÄÁÌÏÓØ.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :óÉÎÔÁËÓÉÓ: \2/msg %s PASS <oldpass> <newpass>\2\n",a,b)
-#define L032(a) Snow("QUIT :õ\2\2ÂÉÔ (%s (ÐÏÔÏÍÕ ÞÔÏ Ñ ÔÁË ÓËÁÚÁÌ!))\n",a)
-#define L033(a) S("NOTICE %s :óÉÎÔÁËÓÉÓ: UP <#chan> <pass>\n",a)
-#define L034(a) S("NOTICE %s :óÉÎÔÁËÓÉÓ: OP <#chan> [nicks] <pass>\n",a)
-#define L035(a) S("NOTICE %s :óÉÎÔÁËÓÉÓ: DEOP <#chan> [nicks] <pass>\n",a)
-#define L036(a) S("NOTICE %s :õËÁÖÉ ÎÉË!\n",a)
-#define L037(a,b) S("NOTICE %s :ðÙÔÁÀÓØ /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :ðÏÐÒÏÂÕÊ /nick %s-dork.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :ðÏËÉÄÁÀ %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :óÏÅÄÉÎÑÀÓØ Ó %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :õËÁÖÉ ÎÉË/ËÁÎÁÌ!\n",a)
-#define L042(a) S("NOTICE %s :÷×ÅÄÉ u@h ÄÌÑ ÏÞÉÓÔËÉ!\n",a)
-#define L043(a) S("NOTICE %s :îÅÔ ÔÁËÏÇÏ ÂÁÎÁ.\n",a)
-#define L044(a) S("NOTICE %s :÷×ÅÄÉ u@h ÄÌÑ ÕÄÁÌÅÎÉÑ!\n",a)
-#define L045(a) S("NOTICE %s :ëÁË ÎÁÞÓÅÔ ÂÏÌØÛÅ ÔÁËÏÇÏ ÎÅ ÄÅÌÁÔØ?\n",a)
-#define L046(a) S("PRIVMSG %s :óÏÈÒÁÎÉÌÉ ÂÁÚÕ ÄÁÎÎÙÈ.\n",a)
-#define L047(a,b) S("NOTICE %s :óÉÎÔÁËÓÉÓ: %cAUTOTOPIC <topic> (ÕÓÔÁÎÏ×É × \"0\" ÞÔÏÂÙ ×ÙËÌÀÞÉÔØ)\n",a,b)
-#define L048(a) S("NOTICE %s :óÉÎÔÁËÓÉÓ: SETCHAN <ÎÏ×ÙÅ ËÁÎÁÌÙ>\n",a)
-#define L049(a,b) S("NOTICE %s :ëÁÎÁÌ ÐÏ ÕÍÏÌÞÁÎÉÀ: %s\n",a,b)
-#define L050(a) S("NOTICE %s :óÉÎÔÁËÓÉÓ: SETCHAR <ÎÏ×ÙÊ ËÏÍÁÎÄÎÙÊ ÓÉÍ×ÏÌ>\n",a)
-#define L051(a,b) S("NOTICE %s :îÏ×ÙÊ ËÏÍÁÎÄÎÙÊ ÓÉÍ×ÏÌ ÔÅÐÅÒØ: %c\n",a,b)
-#define L052(a) S("NOTICE %s :óÉÎÔÁËÓÉÓ: SETUSER <ÎÏ×ÙÊ userid> (ÔÒÅÂÕÅÔÓÑ ÒÅÓÔÁÒÔ)\n",a)
-#define L053(a,b) S("NOTICE %s :userid ÐÏ ÕÍÏÌÞÁÎÉÀ ÔÅÐÅÒØ: %s\n",a,b)
-#define L054(a) S("NOTICE %s :óÉÎÔÁËÓÉÓ: SETNICK <ÎÏ×ÙÊ ÎÉË>\n",a)
-#define L055(a) S("NOTICE %s :óÉÎÔÁËÓÉÓ: ADDUSER <#chan> <*user@*.host> <level> <pass>. ie; ADDUSER #darkbot \
-*jason@*.superlink.net 3 hisPasswd ... use #* if you want to give access in all chans.\n",a)
-#define L056(a) sprintf(temp, "I haven't used \2%cSETINFO\2 yet!",a)
-#define L057(a,b,c) S("NOTICE %s :äÏÂÁ×ÌÅÎ ÐÏÌØÚÏ×ÁÔÅÌØ: %s - ÕÒÏ×ÅÎØ %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :óÉÎÔÁËÓÉÓ: %c%s <u@h> [ÐÒÉÞÉÎÁ]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :äÏÂÁ×ÌÅÎ Ë permban #%d, %s; ÐÒÉÞÉÎÁ: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :óÉÎÔÁËÓÉÓ: REPEAT <ÞÉÓÌÏ> <ÚÁÄÅÒÖËÁ> <ÄÁÎÎÙÅ>\n",a)
-#define L061(a) S("NOTICE %s :çÏÔÏ×Ï.\n",a)
-#define L062(a) S("QUIT :òÅÓÔÁÒÔÕÀ %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, ÞÔÏ ÔÙ ÈÏÞÅÛØ ÄÏÂÁ×ÉÔØ?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, ÞÔÏ ÔÙ ÈÏÞÅÛØ ÄÏÂÁ×ÉÔØ?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :äÏÂÁ×ÉÔØ ÞÔÏ, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: ëÁËÏÅ ÐÒÉ×ÅÔÓÔ×ÉÅ ÄÏÂÁ×ÉÔØ ÄÌÑ %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Ok, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :äÏÂÁ×ÉÔØ ÞÔÏ, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: ëÁËÏÅ ÐÒÉ×ÅÔÓÔ×ÉÅ ÄÏÂÁ×ÉÔØ ÄÌÑ %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Ok, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :úÁÍÅÎÉÔØ ÞÔÏ, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: ëÁËÁÑ ÉÎÆÏÒÍÁÃÉÑ ÄÏÌÖÎÁ ÚÁÍÅÎÉÔØ %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s ÏÂÎÏ×ÌÅÎÏ.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :%s %d permban%s ÚÁÇÒÕÖÅÎÏ × ÐÁÍÑÔØ.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d ÓÅËÕÎÄ ÏÓÔÁÌÏÓØ ÄÏ ÓÌÅÄÕÀÝÅÊ ÈÏÈÍÙ\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: ÜÔÏ ÂÙÌÏ ÄÌÉÎÎÏÊ %d ÓÉÍ×ÏÌÏ×.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, õ ÍÅÎÑ ÓÅÊÞÁÓ %d ÐÒÅÄÍÅÔÏ×%s × ÏÞÅÒÅÄÉ.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :ñ ×ÉÄÅÌ %d ÐÒÉÓÏÅÄÉÎÑÅÔÓÑ Ë ÎÁÍ, ÐÏËÁ ÞÔÏ.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :%s %d ÓÅÒ×ÅÒÏ×%s × ÍÏÅÍ ÓÐÉÓËÅ. óÅÊÞÁÓ Ñ ÎÁ \
-ÓÅÒ×ÅÒÅ #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, ÍÏÊ ËÏÍÁÎÄÎÙÊ ÓÉÍ×ÏÌ: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :What should i be %sing for, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, îÅÏÂÈÏÄÉÍÏ ÕËÁÚÁÔØ ÁÄÒÅÓ!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :îÅ ÍÏÇÕ ×ÙÑÓÎÉÔØ %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: é ÞÔÏ ÍÎÅ ÓËÁÚÁÔØ %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, òÁÓÓËÁÚÁÔØ %s Ï ÞÅÍ?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :óËÁÚÁÔØ ËÏÍÕ, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: é ÞÔÏ ÍÎÅ ÓËÁÚÁÔØ %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, òÁÓÓËÁÚÁÔØ %s Ï ÞÅÍ?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :óËÁÚÁÔØ ËÏÍÕ, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 ÔÙ ÓÐÒÏÓÉÌ?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? ðÅÒÅÆÒÁÚÉÒÕÊ? (ÎÁÂÅÒÉ %cHELP ÄÌÑ ÐÏÍÏÝÉ × ÓÉÎÔÁËÓÉÓÅ)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 ÔÙ ÓÐÒÏÓÉÌ?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? ðÅÒÅÆÒÁÚÉÒÕÊ? (ÎÁÂÅÒÉ %cHELP ÄÌÑ ÐÏÍÏÝÉ × ÓÉÎÔÁËÓÉÓÅ)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s ÚÁÍÅÒÚ!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION ÐÒÏÓÎÙÐÁÅÔÓÑ...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :íÅÎÑ ÆÌÕÄÑÔ. ïÞÉÝÁÀ ×ÙÈÏÄÎÕÀ ÏÞÅÒÅÄØ. \
-%d ÚÁÐÉÓÅÊ ÕÄÁÌÅÎÏ.\n",a,b)
-#define L091(a) S("NOTICE %s :óÉÎÔÁËÓÉÓ: SETVHOST <ÎÏ×ÙÊ Vhost> (ÎÕÖÅÎ ÒÅÓÔÁÒÔ)\n",a)
-#define L092(a,b) S("NOTICE %s :Vhost ÐÏ ÕÍÏÌÞÁÎÉÀ ÔÅÐÅÒØ: %s\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Izveni %s, nu poderjka dla etoy temi bil udalen.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Izveni %s, nu poderjka dla etoy temi bil udalen.\n",a,b);
diff --git a/beta/source/langs/russian2.h b/beta/source/langs/russian2.h
deleted file mode 100755
index 8eef3df..0000000
--- a/beta/source/langs/russian2.h
+++ /dev/null
@@ -1,112 +0,0 @@
-#define I_SPEAK "ß ãîâîðþ ïî ðóññêè."
-#define L001(a,b) S("PRIVMSG %s :Íå çàäàí ïàðîëü, äëÿ çàäàíèÿ ïàðîëÿ: \2/msg %s PASS \
-<ñòàðûéïàðîëü> <íîâûéïàðîëü>\2 (ò.ê ïàðîëü çàäàåòñÿ âïåðâûå, óêàæèòå '0' âìåñòî ñòàðîãî ïàðîëÿ)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Óäàëåí permban #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Íå ìîãó îòêðûòü %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, ß âèæó %d SEEN'îâ â ìîåé áàçå.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Òû çíàåøü áîëüøå, ÷åì ÿ, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, ß íå âèäåë %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic on %s was OFF\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic on %s is now OFF\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ON: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s UPDATED: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, ãîòîâî. Òåïåðü ó ìåíÿ åñòü %d õîõì.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Ïàðîëü äëÿ %s îáíîâëåí.\n",a,b)
-#define L013(a) S("NOTICE %s :Íåâåðíûé ïàðîëü!\n",a)
-#define L014(a) S("NOTICE %s :Íå ìîãó íàéòè!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Óäàëåí ïîëüçîâàòåëü: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Äåëåíèå íà íîëü!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Íåâåðíàÿ îïåðàöèÿ!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (adding ignore #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Adding ignore #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Îáíîâëåíî #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d çàïèñåé ïðîñìîòðåíî.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Íàéäåíî áîëåå, ÷åì \37%d\37 çàïèñåé, ñóçüòå óñëîâèÿ ïîèñêà\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :ß íàøåë \37îäíó\37 çàïèñü, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :ß íàøåë \37%d\37 çàïèñåé, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Íàéäåíî %ld ïîâòîðÿþùèõñÿ òåì. Óäàëåíû.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Çàïóùåí íà %s. Ó ìåíÿ åñòü %ld òåì â áàçå äàííûõ, Âðåìÿ ðàáîòû: \
-%d äíåé%s, %02d:%02d, Áûëî çàäàíî %ld âîïðîñîâ, %ld òåì äîáàâëåíî, è %ld òåì óäàëåíî. \
-Âðåìÿ èñïîëíåíèÿ: %1.4lf ñåêóíä%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Çàïóùåí íà %s. Ó ìåíÿ åñòü %ld òåì â áàçå äàííûõ, Âðåìÿ ðàáîòû: \
-%d ÷àñîâ%s, %d ìèíóò%s, Áûëî çàäàíî %ld âîïðîñîâ, %ld òåì äîáàâëåíî, è %ld òåì óäàëåíî. \
-Âðåìÿ èñïîëíåíèÿ: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Çàïóùåí íà %s. Ó ìåíÿ åñòü %ld òåì â áàçå äàííûõ, Âðåìÿ ðàáîòû: \
-%d min%s, %d sec%s, Áûëî çàäàíî %ld âîïðîñîâ, %ld òåì äîáàâëåíî, è %ld òåì óäàëåíî. \
-Âðåìÿ èñïîëíåíèÿ: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Óäàëåíà òåìà #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 Íå ìîãó íàéòè òåìó %s. Óäàëåíèå íåóäàëîñü.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Óäàëåíà òåìà #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 Íå ìîãó íàéòè òåìó %s. Óäàëåíèå íåóäàëîñü.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Ñèíòàêñèñ: \2/msg %s PASS <oldpass> <newpass>\2\n",a,b)
-#define L032(a) Snow("QUIT :Ó\2\2áèò (%s (ïîòîìó ÷òî ÿ òàê ñêàçàë!))\n",a)
-#define L033(a) S("NOTICE %s :Ñèíòàêñèñ: UP <#chan> <pass>\n",a)
-#define L034(a) S("NOTICE %s :Ñèíòàêñèñ: OP <#chan> [nicks] <pass>\n",a)
-#define L035(a) S("NOTICE %s :Ñèíòàêñèñ: DEOP <#chan> [nicks] <pass>\n",a)
-#define L036(a) S("NOTICE %s :Óêàæè íèê!\n",a)
-#define L037(a,b) S("NOTICE %s :Ïûòàþñü /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Ïîïðîáóé /nick %s-dork.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Ïîêèäàþ %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Ñîåäèíÿþñü ñ %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Óêàæè íèê/êàíàë!\n",a)
-#define L042(a) S("NOTICE %s :Ââåäè u@h äëÿ î÷èñòêè!\n",a)
-#define L043(a) S("NOTICE %s :Íåò òàêîãî áàíà.\n",a)
-#define L044(a) S("NOTICE %s :Ââåäè u@h äëÿ óäàëåíèÿ!\n",a)
-#define L045(a) S("NOTICE %s :Êàê íà÷ñåò áîëüøå òàêîãî íå äåëàòü?\n",a)
-#define L046(a) S("PRIVMSG %s :Ñîõðàíèëè áàçó äàííûõ.\n",a)
-#define L047(a,b) S("NOTICE %s :Ñèíòàêñèñ: %cAUTOTOPIC <topic> (óñòàíîâè â \"0\" ÷òîáû âûêëþ÷èòü)\n",a,b)
-#define L048(a) S("NOTICE %s :Ñèíòàêñèñ: SETCHAN <íîâûå êàíàëû>\n",a)
-#define L049(a,b) S("NOTICE %s :Êàíàë ïî óìîë÷àíèþ: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Ñèíòàêñèñ: SETCHAR <íîâûé êîìàíäíûé ñèìâîë>\n",a)
-#define L051(a,b) S("NOTICE %s :Íîâûé êîìàíäíûé ñèìâîë òåïåðü: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Ñèíòàêñèñ: SETUSER <íîâûé userid> (òðåáóåòñÿ ðåñòàðò)\n",a)
-#define L053(a,b) S("NOTICE %s :userid ïî óìîë÷àíèþ òåïåðü: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Ñèíòàêñèñ: SETNICK <íîâûé íèê>\n",a)
-#define L055(a) S("NOTICE %s :Ñèíòàêñèñ: ADDUSER <#chan> <*user@*.host> <level> <pass>. ie; ADDUSER #darkbot \
-*jason@*.superlink.net 3 hisPasswd ... use #* if you want to give access in all chans.\n",a)
-#define L056(a) sprintf(temp, "I haven't used \2%cSETINFO\2 yet!",a)
-#define L057(a,b,c) S("NOTICE %s :Äîáàâëåí ïîëüçîâàòåëü: %s - óðîâåíü %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Ñèíòàêñèñ: %c%s <u@h> [ïðè÷èíà]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Äîáàâëåí ê permban #%d, %s; ïðè÷èíà: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Ñèíòàêñèñ: REPEAT <÷èñëî> <çàäåðæêà> <äàííûå>\n",a)
-#define L061(a) S("NOTICE %s :Ãîòîâî.\n",a)
-#define L062(a) S("QUIT :Ðåñòàðòóþ %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, ÷òî òû õî÷åøü äîáàâèòü?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, ÷òî òû õî÷åøü äîáàâèòü?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Äîáàâèòü ÷òî, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Êàêîå ïðèâåòñòâèå äîáàâèòü äëÿ %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Ok, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Äîáàâèòü ÷òî, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Êàêîå ïðèâåòñòâèå äîáàâèòü äëÿ %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Ok, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Çàìåíèòü ÷òî, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Êàêàÿ èíôîðìàöèÿ äîëæíà çàìåíèòü %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s îáíîâëåíî.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :%s %d permban%s çàãðóæåíî â ïàìÿòü.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d ñåêóíä îñòàëîñü äî ñëåäóþùåé õîõìû\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: ýòî áûëî äëèííîé %d ñèìâîëîâ.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Ó ìåíÿ ñåé÷àñ %d ïðåäìåòîâ%s â î÷åðåäè.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :ß âèäåë %d ïðèñîåäèíÿåòñÿ ê íàì, ïîêà ÷òî.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :%s %d ñåðâåðîâ%s â ìîåì ñïèñêå. Ñåé÷àñ ÿ íà \
-ñåðâåðå #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, ìîé êîìàíäíûé ñèìâîë: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :What should i be %sing for, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, Íåîáõîäèìî óêàçàòü àäðåñ!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Íå ìîãó âûÿñíèòü %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: È ÷òî ìíå ñêàçàòü %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Ðàññêàçàòü %s î ÷åì?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Ñêàçàòü êîìó, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: È ÷òî ìíå ñêàçàòü %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Ðàññêàçàòü %s î ÷åì?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Ñêàçàòü êîìó, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 òû ñïðîñèë?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Ïåðåôðàçèðóé? (íàáåðè %cHELP äëÿ ïîìîùè â ñèíòàêñèñå)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 òû ñïðîñèë?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Ïåðåôðàçèðóé? (íàáåðè %cHELP äëÿ ïîìîùè â ñèíòàêñèñå)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s çàìåðç!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION ïðîñíûïàåòñÿ...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Ìåíÿ ôëóäÿò. Î÷èùàþ âûõîäíóþ î÷åðåäü. \
-%d çàïèñåé óäàëåíî.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Izveni %s, nu poderjka dla etoy temi bil udalen.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Izveni %s, nu poderjka dla etoy temi bil udalen.\n",a,b);
diff --git a/beta/source/langs/spanish.h b/beta/source/langs/spanish.h
deleted file mode 100755
index d622166..0000000
--- a/beta/source/langs/spanish.h
+++ /dev/null
@@ -1,119 +0,0 @@
-#define I_SPEAK "I speak Spanish."
-#define L001(a,b) S("PRIVMSG %s :No has elegido una contraseña, para poner una \
-contraseña: \2/msg %s PASS <oldpass> <newpass>\2 (Como es tu primera \
-vez en poner una contraseña, debes usar '0' en la opcion de oldpass)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Permban ha sido borrado #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Error en abrir %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Se encuentan %d VISTOS dentro de mi base de datos.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Tu debes saber mas sobre eso que yo, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Yo no he visto %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic activado %s estaba APAGADO\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic activado %s ahora esta APAGADO\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ACTIVADO: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s UPDATED: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, completo. Ahora se encuentan %d randomstuffs [cosas al lazar].\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Contraseña de %s ahora esta updated.\n",a,b)
-#define L013(a) S("NOTICE %s :Contraseña incorecta!\n",a)
-#define L014(a) S("NOTICE %s :Nada encontrado!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Usuario borrado: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Error de division entre cero!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Operacion Ilegal!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (Adicion de ignore #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :Adicion de ignore #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Updated #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d entradas revisadas.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :He encontrado mas de \37%d\37 entradas, por favor reducir tu \
-busqueda\2:\2 %s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :He encontrado \37one\37 combinaciones, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :He encontrado \37%d\37 combinaciones, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Encontre %ld topic duplicados. Han sido eliminados.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Ejecutando %s. Yo tengo %ld \
-topics en mis base de datos, Uptime: %d dias%s, %02d:%02d, \
-Han habido %ld preguntas hechas, %ld adiciones de topic, y %ld topic \
-borrados. Tiempo de Proceso: %1.4lf seg%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Ejecutando %s. He encontrado \
-%ld topics en mis base de datos, Uptime: %d horas%s, %d min%s, \
-Han habido %ld preguntas hechas, %ld topics nuevos, y %ld topics \
-borrados. Tiempo de Proceso: %1.4lf seg%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Ejecutando %s. Yo tengo %ld topics en mis \
-base de datos, Uptime: %d min%s, %d seg%s, Han habido %ld preguntas hechas, %ld topics nuevos, y %ld topics \
-borrados. Tiempo de Proceso: %1.4lf seg%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: He eliminado el topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 No he podido encontrar el topic \37%s\37. Error en \
-eliminacion.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: He eliminado el topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 No he podido encontrar el topic \37%s\37. Error en \
-eliminacion.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Syntax: \2/msg %s PASS <Vieja-contraseña> <nueva-contraseña>\2\n",a,b)
-#define L032(a) Snow("QUIT :K\2\2illed (%s (cause I say so!))\n",a)
-#define L033(a) S("NOTICE %s :Syntax: UP <#canal> <contaseña>\n",a)
-#define L034(a) S("NOTICE %s :Syntax: OP <#canal> [nicks] <contraseña>\n",a)
-#define L035(a) S("NOTICE %s :Syntax: DEOP <#canal> [nicks] <contraseña>\n",a)
-#define L036(a) S("NOTICE %s :Favor especificar un nick!\n",a)
-#define L037(a,b) S("NOTICE %s :Tratando de /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Favor tratar /nick %s-dork.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Saliendo %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Entrando %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Favor especificar un nick/canal!\n",a)
-#define L042(a) S("NOTICE %s :Entrar al u@h para hacer la eliminacion!\n",a)
-#define L043(a) S("NOTICE %s :No se encuenta el ban.\n",a)
-#define L044(a) S("NOTICE %s :Entrar al u@h para borrar!\n",a)
-#define L045(a) S("NOTICE %s :Que tal no hago eso?\n",a)
-#define L046(a) S("PRIVMSG %s :Backup de base de dato completo.\n",a)
-#define L047(a,b) S("NOTICE %s :SYNTAX: %cAUTOTOPIC <topic> (Poner en \"0\" para apagar)\n",a,b)
-#define L048(a) S("NOTICE %s :Syntax: SETCHAN <nuevos canales>\n",a)
-#define L049(a,b) S("NOTICE %s :Canal por defecto: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Syntax: SETCHAR <nuevo caracter de comando>\n",a)
-#define L051(a,b) S("NOTICE %s :Nuevo commando ya: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Syntax: SETUSER <nuevo userid> (Se requiere un restart)\n",a)
-#define L053(a,b) S("NOTICE %s :Userid por defecto: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Syntax: SETNICK <nuevonick>\n",a)
-#define L055(a) S("NOTICE %s :Syntax: ADDUSER <#canal> <*user@*.host> <nival> <contraseña>. ie; ADDUSER \
-#darkbot *jason@*.superlink.net 3 Su contraseña ... usar #* Si deseas darle acceso en todo los canales.\n",a)
-#define L056(a) sprintf(temp, "No he usado \2%cSETINFO\2 todavia!",a)
-#define L057(a,b,c) S("NOTICE %s :Usurario Agregado: %s - Nivel %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Syntax: %c%s <u@h> [razon]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Agregado en permban #%d, %s; razon: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Syntax: REPEAT <numero> <delay> <raw-data>\n",a)
-#define L061(a) S("NOTICE %s :Listo.\n",a)
-#define L062(a) S("QUIT :Re-iniciando %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, que deseas agregar?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, que deseas agregar?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Agregar que, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Que informacion deseas agregada para %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :OK, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Agregar que, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Que informacion deseas agregada para %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :OK, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Cambiar que, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Que informacion debe cambiar %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s ha sido updated.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Se encuentan %s %d permban%s cargados en memoria.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d segundos restante antes de randstuff\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: era de %d caracteres de largo.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, Se encuentran ahora mismo %d itemes%s en el Que.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Yo he visto %d joins hasta el momento.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Hay %s %d servidores%s en mi lista de servidores. Me encuentro en el \
-servidor #%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, mi caracter de comando es: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :What should i be %sing for, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, Necesitas poner una direcion!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :No logre encontrar %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Que deseas que yo diga %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Decir %s sobre que?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Decirle a quien, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Que deseas que yo diga %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Decir %s sobre que?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Decirle a quien, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 estabas preguntando?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Puedes reformular eso? (Escribir %cHELP para ayuda en \
-syntax)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 estabas preguntando?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Puedes reformular eso? (Escribir %cHELP para ayuda en \
-syntax)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s estoy drogado!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION se despierta...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Estoy siendo flooded. Vaciando output Que (data que esta esperando \
-para ser mandado). %d itemes.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Apesadumbrado %s, pero ayuda para ese asunto se ha quitado.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Apesadumbrado %s, pero ayuda para ese asunto se ha quitado.\n",a,b);
diff --git a/beta/source/langs/swedish.h b/beta/source/langs/swedish.h
deleted file mode 100755
index 6cb1e44..0000000
--- a/beta/source/langs/swedish.h
+++ /dev/null
@@ -1,107 +0,0 @@
-#define I_SPEAK "Jag talar svenska."
-#define L001(a,b) S("PRIVMSG %s :Du har inte satt något lösenord, för att sätta ett lösenord: \2/msg %s PASS \ <gammalt lösendord> <nytt lösenord>\2 (Eftersom det här är den första gången du sätter ett lösenord, använd '0' som ditt gamla lösenord)\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :Tog bort den permanenta bannlysningen #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :Kan inte öppna %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, Det finns %d SEENs i min databas.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :Du vet mer om det än jag, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, Jag har inte sett %s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :Autotopic på %s var AV\n",a,b)
-#define L008(a,b) S("NOTICE %s :Autotopic på %s är nu AV\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s PÅ: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s UPPDATERAD: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, klart. Det finns nu %d slumpsaker.\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :Lösenordet för användare %s är uppdaterat.\n",a,b)
-#define L013(a) S("NOTICE %s :Felaktigt lösenord!\n",a)
-#define L014(a) S("NOTICE %s :Ingen träff!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :Tog bort användare %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: Division by zero-fel!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: Felaktig handling.\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (ignorerar nu #%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :ignorerar nu #%d: %s!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :Uppdaterade #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d söktes igenom.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :Fann mer än \37%d\37 träffar, sök lite mer precist.\2:\2 \ %s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :Jag fann \37en\37 träff, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :Jag fann \37%d\37 träffar, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :Hittade %ld topic-dubbletter. De togs bort.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Kör %s. Jag har %ld topics i min databas, en upptid på \ %d dagar, %02d:%02d. Det har frågats %ld frågor, lagts till %ld topics, och tagits bort %ld. \ Processtid: %1.4lf sekunder%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Kör %s. Jag har %ld topics i min databas, Upptid: \ %d timmar och %d minuter%s. Det har frågats %ld frågor, lagts till %ld topics och tagits bort %ld. \ Processtid: %1.4lf sekunder%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Kör %s. Jag har %ld topics i min databas, Upptid: \ %d minuter%s, %d sekunder%s. Det har frågats %ld frågor, lagts till %ld topics och tagits bort %ld. \ Processtid: %1.4lf sekunder%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: Jag tog bort topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 Jag hittade inte topicen %s. Radering misslyckades.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s: Jag tog bort topic #%ld, \2%s\2.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 Jag hittade inte topicen %s. Radering misslyckades.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :Syntax: \2/msg %s PASS <gammalt lösenord> <nytt lösenord>\2\n",a,b)
-#define L032(a) Snow("QUIT :D\2\2ödad (%s (För att jag säger det!))\n",a)
-#define L033(a) S("NOTICE %s :Syntax: UP <#kanal> <lösenord>\n",a)
-#define L034(a) S("NOTICE %s :Syntax: OP <#kanal> [namn] <lösenord>\n",a)
-#define L035(a) S("NOTICE %s :Syntax: DEOP <#kanal> [namn] <lösenord>\n",a)
-#define L036(a) S("NOTICE %s :Ange ett namn!\n",a)
-#define L037(a,b) S("NOTICE %s :Försöker med /nick %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :Försök med /nick %s-pucko.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :Lämnar %s\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :Går in i %s\n",a,b)
-#define L041(a) S("PRIVMSG %s :Ange ett namn/kanal!\n",a)
-#define L042(a) S("NOTICE %s :Skriv den u@h du vill rensa bort. \n",a)
-#define L043(a) S("NOTICE %s :Det finns ingen sådan bannlysning.\n",a)
-#define L044(a) S("NOTICE %s :Skriv vilken u@h du vill ta bort.\n",a)
-#define L045(a) S("NOTICE %s :Hur vore det om jag inte gjorde så?\n",a)
-#define L046(a) S("PRIVMSG %s :Sparade databasen.\n",a)
-#define L047(a,b) S("NOTICE %s :SYNTAX: %cAUTOTOPIC <topic> (sätt till \"0\" för att stänga av)\n",a,b)
-#define L048(a) S("NOTICE %s :Syntax: SETCHAN <nya kanaler>\n",a)
-#define L049(a,b) S("NOTICE %s :Default-kanal: %s\n",a,b)
-#define L050(a) S("NOTICE %s :Syntax: SETCHAR <nytt kommandotecken>\n",a)
-#define L051(a,b) S("NOTICE %s :Nytt kommandotecken: %c\n",a,b)
-#define L052(a) S("NOTICE %s :Syntax: SETUSER <ny användarid> (kräver en omstart)\n",a)
-#define L053(a,b) S("NOTICE %s :Default-användarid är nu: %s\n",a,b)
-#define L054(a) S("NOTICE %s :Syntax: SETNICK <nytt namn>\n",a)
-#define L055(a) S("NOTICE %s :Syntax: ADDUSER <#kanal>
-< *anv ä ndare @ *.v ä rddator.se > <niv å ><l ö senord >.t.ex;
-ADDUSER
-#darkbot \ *jason@*.superlink.net 3 hansLösenord ... använd #* om du vill ge tillgång till alla kanaler.\n",a)
-#define L056(a) sprintf(temp, "Jag har inte använt \2%cSETINFO\2 ännu!",a)
-#define L057(a,b,c) S("NOTICE %s :La till användare: %s - nivå %d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :Syntax: %c%s <u@h> [anledning]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :Lade till i den permanenta bannlysningslistan: #%d, %s; anledning: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :Syntax: REPEAT <nummer> <fördröjning> <rådata>\n",a)
-#define L061(a) S("NOTICE %s :Klart.\n",a)
-#define L062(a) S("QUIT :Startar om %s ...\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, vad vill du lägga till?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, vad vill du lägga till?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :Lägga till vad, %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: Vilken information ska läggas till för %s?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :Okej, %s :)\n",a,b)
-#define L065n(a,b) S("NOTICE %s :Lägga till vad, %s?\n",a,b);
-#define L066n(a,b,c) S("NOTICE %s :%s: Vilken information ska läggas till för %s?\n",a,b,c)
-#define L067n(a,b) S("NOTICE %s :Okej, %s :)\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :Byta ut vad, %s?\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: Vilken information skulle jag byta ut %s?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :%s, %s är uppdaterad.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :Det finns %s %d permanenta bannlysningar%s laddade i ram-minnet.\n",a,b,c,d)
-#define L073(a,b,c) S("PRIVMSG %s :%s, %d sekunder kvar till en slumpsak.\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: den var %d tecken lång.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, De finns för närvarande %d saker%s i kö.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :Jag har sett %d folk som kommit hit än så länge.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :Det finns %s %d server%s i min serverlista. Jag är för närvarande på \
- server
-#%d.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, mitt kommandotecken är: %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :Vad ska jag %sing för, %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, du måste ange en address!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :Kunde inte kolla upp %s.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: Vad vill du att jag ska säga %s?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, Berätta för %s om vad?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :Säga till vem, %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: Vad vill du att jag ska säga %s?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, Berätta för %s om vad?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :Säga till vem, %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 du frågade mig?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Vill du omformulera det där? (Skriv %cHELP för syntax-tips)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 du frågade mig?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Vill du omformulera det där? (Skriv %cHELP för syntax-tips)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s är brutalt hög!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION vaknar upp...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :Jag blir floodad. Dumpar kön. \
-%d saker togs bort.\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :Tyvärr %s, support för det området har tagits bort.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :Tyvärr %s, support för det området har tagits bort.\n",a,b);
\ No newline at end of file
diff --git a/beta/source/langs/taiwanish.h b/beta/source/langs/taiwanish.h
deleted file mode 100755
index 33f252a..0000000
--- a/beta/source/langs/taiwanish.h
+++ /dev/null
@@ -1,114 +0,0 @@
-#define I_SPEAK "§Ú»¡¤¤¤å."
-#define L001(a,b) S("PRIVMSG %s : §AÁÙ¨S¦³³]¸m±K½X. ­n³]¸m±K½X,½Ð¥´: \2/msg %s PASS \
-<±K½X> <·s±K½X>\2 (¦pªG¬O²Ä¤@¦¸³]¸m±K½X,±K½XÀ³¶ñ¬° 0 )\n",a,b)
-#define L002(a,b,c) S("NOTICE %s :¤w§¹¦¨§R°£¸T¥Î¥Î¤á #%d, %s.\n",a,b,c)
-#define L003(a,b) S("NOTICE %s :µLªk¥´¶} %s :(\n",a,b)
-#define L004(a,b,c) S("PRIVMSG %s :%s, ¦b§Úªº²Â¸£³U¥Ê¤¤¦@°O¿ý¤F %d ³o»ò¦hµo¥Í¹Lªº¨Æ.\n",a,b,c)
-#define L005(a,b) S("PRIVMSG %s :§A¤w¸gª¾¹D±o¤ñ§Ú¦h¤F, %s.\n",a,b)
-#define L006(a,b,c,d) S("PRIVMSG %s :%s, ¹ï¤£°_³á! §Ú¨S¦³¨£¹L%s %s\n",a,b,c,d)
-#define L007(a,b) S("NOTICE %s :¦Û°Ê¥DÃD %s ­è¤~¬OÃö³¬ªº\n",a,b)
-#define L008(a,b) S("NOTICE %s :¦Û°Ê¥DÃD %s ²{¦bÃö³¬\n",a,b);
-#define L009(a,b,c) S("NOTICE %s :¦Û°Ê¥DÃD@ %s ¥´¶}: %s\n",a,b,c)
-#define L010(a,b,c) S("NOTICE %s :¦Û°Ê¥DÃD@ %s ¤w§ó·s: %s\n",a,b,c)
-#define L011(a,b,c) S("PRIVMSG %s :%s, ÁÂÁ§AÄ@·N±Ð§Ú. §Ú²{¦b¤w¸g¦³ %d ¥y¥i¥HÀH¾÷»¡ªº¸Ü¤F. :=]\n",a,b,c)
-#define L012(a,b) S("NOTICE %s :%s ªº±K½X¤w§ó·s¤F.\n",a,b)
-#define L013(a) S("NOTICE %s :³á~±K½X¿ù»~³á~ ½Ð¦A¥J²Ó·Q¤@·Q!\n",a)
-#define L014(a) S("NOTICE %s :¹ï¤£°_! §Ú§ä¤£¨ì¾A¦X§Aªº¸ê®Æ!\n",a)
-#define L015(a,b,c,d) S("NOTICE %s :¥Î¤á¤w§R°£: %s [%d:%d]\n",a,b,c,d)
-#define L016(a,b) S("PRIVMSG %s :%s: ³Q¹s°£¿ù»~!\n",a,b)
-#define L017(a,b) S("PRIVMSG %s :%s: «Dªk¾Þ§@!\n",a,b)
-#define L018(a,b,c,d,e) S("KICK %s %s :%s (¼W¥[¦Û°Ê©¿²¤¥Î¤á#%d: %s)\n",a,b,c,d,e)
-#define L019(a,b,c) S("PRIVMSG %s :§Ú¤w¸g§â #%d ªº %s ²¤¹L¤F!\n",a,b,c);
-#define L020(a,b,c,d) S("NOTICE %s :§Ú¤w§ó·s #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
-#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. §Ú¦@§ä¤F %d ³o»ò¦hµ§¸ê®Æ.\n",a,b,c,d)
-#define L022(a,b,c) S("PRIVMSG %s :§Ú©Òª¾¹Dªº¨Æ¦³¤U¦C³o \37%d\37 ¥ó²Å¦X§Aªº±ø¥ó, ¦p¤U\2:\2 \
-%s\n",a,b,c);
-#define L023(a,b,c) S("PRIVMSG %s :®¥³ß§A! ¦b§Úªº¸£³U¸Ì¥u¦³¤@¥ó²Å¦X§A±ø¥óªº¨Æ±¡³á, %s\2:\2 %s\n",a,b,c)
-#define L024(a,b,c,d) S("PRIVMSG %s :§Ú¤@¦@¦³ \37%d\37 ¥ó§A·Qª¾¹Dªº¨Æ±¡, %s\2:\2 %s\n",a,b,c,d)
-#define L025(a,b) S("PRIVMSG %s :¦b§Úªº°O¾Ð¤¤¦@¦³ %ld ±ø­«´_ªº¸ê®Æ,§Ú¤w¸g±N­«´_ªº°ÝÃD§R°£¤F.\n",a,b)
-#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :§Ú¬O¨Ï¥Î %s ·í§Úªº¸£³U¥Ê. §Ú©Òª¾¹Dªº¨Æ¦@¦³ %ld ³o»ò¦h, §Ú¤w¸g¬°¥ÁªA°È¤F \
-%d ¤Ñ, %02d:%02d ³o»ò¤[, ¬° %ld ¦ì¦bºô¸ô¤W°g¥¢¤è¦Vªº¤H«üÂI°g¬z, ¦b³o¬q®É¶¡¸Ì, §Úµo²{¤F %ld ¥ó·sÂA¨Æ, ¦P®É¤]§â %ld ¥ó¤£¾A¦X³o®É¥Nªº¨Æ§Ñ±¼. \
-¥­§¡°_¨Ó§Ú´À¤@­Ó¤H¦^µª°ÝÃD¥u»Ý­n«ä¦Ò %1.4lf ¬í\n",a,b,c,d,f,g,h,i,j,k)
-#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :§Ú¬O¨Ï¥Î %s ·í§Úªº¸£³U¥Ê. §Ú©Òª¾¹Dªº¨Æ¦@¦³ %ld ³o»ò¦h, §Ú¤w¸g¬°¥ÁªA°È¤F \
-%d ¤p®É, %d ¤ÀÄÁ ³o»ò¤[, ¬° %ld ¦ì¦bºô¸ô¤W°g¥¢¤è¦Vªº¤H«üÂI°g¬z, ¦b³o¬q®É¶¡¸Ì, §Úµo²{¤F %ld ¥ó·sÂA¨Æ, ¦P®É¤]§â %ld ¥ó¤£¾A¦X³o®É¥Nªº¨Æ§Ñ±¼. \
-¥­§¡°_¨Ó§Ú´À¤@­Ó¤H¦^µª°ÝÃD¥u»Ý­n«ä¦Ò %1.4lf ¬í\n",a,b,c,d,f,h,i,j,k)
-#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :§Ú¬O¨Ï¥Î %s ·í§Úªº¸£³U¥Ê. §Ú©Òª¾¹Dªº¨Æ¦@¦³ %ld ³o»ò¦h, §Ú¤w¸g¬°¥ÁªA°È¤F \
-%d ¤ÀÄÁ, %d ¬í ³o»ò¤[, ¬° %ld ¦ì¦bºô¸ô¤W°g¥¢¤è¦Vªº¤H«üÂI°g¬z, ¦b³o¬q®É¶¡¸Ì, §Úµo²{¤F %ld ¥ó·sÂA¨Æ, ¦P®É¤]§â% ld ¥ó¤£¾A¦X³o®É¥Nªº¨Æ§Ñ±¼. \
-¥­§¡°_¨Ó§Ú´À¤@­Ó¤H¦^µª°ÝÃD¥u»Ý­n«ä¦Ò %1.4lf ¬í\n",a,b,c,d,f,h,i,j,k)
-#define L029(a,b,c,d) S("PRIVMSG %s :%s: §Ú¤w¸g·Ó§Aªº¸Ü§â¦b§Ú°O¾Ð¤¤ªº²Ä #%ld µ§¥s°µ \2%s\2 ªº¸ê®Æ§R°£¤F.\n",a,b,c,d)
-#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 §Ú¨Ã¤£ª¾¹D¦³ %s ³o¥ó¨Æ°Ú.\n",a,b,c)
-#define L029n(a,b,c,d) S("NOTICE %s :%s:§Ú¤w¸g·Ó§Aªº¸Ü§â¦b§Ú°O¾Ð¤¤ªº²Ä#%ldµ§¥s°µ\2%s\2ªº¸ê®Æ§R°£¤F.\n",a,b,c,d)
-#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 §Ú¨Ã¤£ª¾¹D¦³ %s ³o¥ó¨Æ°Ú.\n",a,b,c)
-#define L031(a,b) S("NOTICE %s :¥Îªk: \2/msg %s PASS <±K½X> <·s±K½X>\2\n",a,b)
-#define L032(a) Snow("QUIT :°Ú!§Ú¥X°ÝÃD¤F, §Ú¥D¤H %s ¥¿¦bÀ°§Ú­×²z¤¤..\n",a)
-#define L033(a) S("NOTICE %s :¥Îªk: UP <#ÀW¹D> <±K½X>\n",a)
-#define L034(a) S("NOTICE %s :¥Îªk: OP <#ÀW¹D> [ÎîºÙ] <±K½X>\n",a)
-#define L035(a) S("NOTICE %s :¥Îªk: DEOP <#ÀW¹D> [ÎîºÙ] <±K½X>\n",a)
-#define L036(a) S("NOTICE %s :½Ð«ü©w¤@­ÓÎîºÙ!\n",a)
-#define L037(a,b) S("NOTICE %s :¸Õ¹Ï /ÎîºÙ %s\n",a,b)
-#define L038(a,b) S("NOTICE %s :½Ð¹Á¸Õ /ÎîºÙ %s-dork.\n",a,b)
-#define L039(a,b) S("PRIVMSG %s :¶â! °¨¤WÂ÷¶} %s ³o­Ó²á¤Ñ«Ç!\n",a,b)
-#define L040(a,b) S("PRIVMSG %s :³á! ¨º§Ú»°§Ö¶i¥h %s ²á¤Ñ«Ç¸Ì­±!\n",a,b)
-#define L041(a) S("PRIVMSG %s :§A­n¹ï½Ö©Î¬O¨º¶¡²á¤Ñ«Ç»¡°Ú?\n",a)
-#define L042(a) S("NOTICE %s :¿é¤J­n§R°£ªºu@h!\n",a)
-#define L043(a) S("NOTICE %s :¨S§ä¨ì§A»¡ªº¸T¥Î¥Î¤á.\n",a)
-#define L044(a) S("NOTICE %s :¿é¤J­n§R°£ªºu@h!\n",a)
-#define L045(a) S("NOTICE %s :¤£¨º»ò°µ¦æ¤£¦æ?\n",a)
-#define L046(a) S("PRIVMSG %s :µ¥µ¥, §Ú¥ý±N§Úª¾¹Dªº¨Æµ¹¼g¤U¨Ó.\n",a)
-#define L047(a,b) S("NOTICE %s :¥Îªk: %cAUTOTOPIC <¥DÃD> (³]¸m¬°\"0\"ªí¥Ü²MªÅ¥DÃD)\n",a,b)
-#define L048(a) S("NOTICE %s :¥Îªk: SETCHAN <·sÀW¹D>\n",a)
-#define L049(a,b) S("NOTICE %s :·s³]©wÀW¹D: %s\n",a,b)
-#define L050(a) S("NOTICE %s :¥Îªk: SETCHAR <·sªº©R¥O²Å>\n",a)
-#define L051(a,b) S("NOTICE %s :²{¦bªº©R¥O²Å¬O: %c\n",a,b)
-#define L052(a) S("NOTICE %s :¥Îªk: SETUSER <·sªº¥Î¤áID> (»Ý­n­«·s±Ò°Ê¾÷¾¹¤H)\n",a)
-#define L053(a,b) S("NOTICE %s :²{¦bªº¯Ê¬Ù¥Î¤áID¬O: %s\n",a,b)
-#define L054(a) S("NOTICE %s :¥Îªk: SETNICK <·sªºÎîºÙ>\n",a)
-#define L055(a) S("NOTICE %s :¥Îªk: ADDUSER <#ÀW¹D> <*user@*.host> <¯Å§O> <±K½X>. ¨Ò¦p, ADDUSER #darkbot \
-*jason@*.superlink.net 3 hisPasswd ... ¨Ï¥Î#*±N¨Ï¸Ó¥Î¤áªºÅv­­¾A¥Î¤_©Ò¦³ªºÀW¹D.\n",a)
-#define L056(a) sprintf(temp, "§AÁÙ¨S¦³¥Î\2%cSETINFO\2 ³]¸mÅwªï«H®§!",a)
-#define L057(a,b,c) S("NOTICE %s :¥Î¤á¤w²K¥[: %s - ¯Å§O%d\n",a,b,c)
-#define L058(a,b,c) S("NOTICE %s :¥Îªk: %c%s <u@h> [²z¥Ñ]\n",a,b,c)
-#define L059(a,b,c,d) S("NOTICE %s :¥[¤J¸T¥Î¥Î¤á¦Cªí#%d, %s; ²z¥Ñ: %s\n",a,b,c,d)
-#define L060(a) S("NOTICE %s :¥Îªk: REPEAT <number> <delay> <raw-data>\n",a)
-#define L061(a) S("NOTICE %s :¤w§¹¦¨.\n",a)
-#define L062(a) S("QUIT :§Ú­«·s³s½u¤@¤U... %s\n",a);
-#define L064(a,b) S("PRIVMSG %s :%s, §A·Q±Ð§Ú¬Æ»ò¨Æ±¡°Ú?\n",a,b)
-#define L064n(a,b) S("NOTICE %s :%s, §A·Q±Ð§Ú¬Æ»ò¨Æ±¡°Ú?\n",a,b)
-#define L065(a,b) S("PRIVMSG %s :§A·Q±Ð§Ú¬Æ»ò¤H¥Íªº¤j¹D²z¶Ü? %s?\n",a,b);
-#define L065n(a,b) S("NOTICE %s :§A·Q±Ð§Ú¬Æ»ò¤H¥Íªº¤j¹D²z¶Ü? %s?\n",a,b);
-#define L066(a,b,c) S("PRIVMSG %s :%s: §A·Q´À %s ³]©w¬Æ»ò¸ê®Æ°Ú?\n",a,b,c)
-#define L066n(a,b,c) S("NOTICE %s :%s: §A·Q´À %s ³]©w¬Æ»ò¸ê®Æ°Ú?\n",a,b,c)
-#define L067(a,b) S("PRIVMSG %s :ÁÂÁ %s ±Ð§Ú, §Ú¤S¦hÁA¸Ñ¤F¤@¥ó¨Æ¤F! :=]\n",a,b)
-#define Lbadtopic(a,b) S("PRIVMSG %s :%s ¹ï¤£°_³á, §Ú¦³¤ä´©ªº¼ÐÃD¤w¸g³Q§R°£¤F.\n",a,b);
-#define Lbadtopic2(a,b) S("NOTICE %s :%s ¹ï¤£°_³á, §Ú¦³¤ä´©ªº¼ÐÃD¤w¸g³Q§R°£¤F.\n",a,b);
-#define L067n(a,b) S("NOTICE %s :ÁÂÁ %s ±Ð§Ú, §Ú¤S¦hÁA¸Ñ¤F¤@¥ó¨Æ¤F! :=]\n",a,b)
-#define L068(a,b) S("PRIVMSG %s :§A·QªÈ¥¿¨º­Ó°ÝÃDªºµª®×©O? %s.\n",a,b)
-#define L069(a,b,c) S("PRIVMSG %s :%s: §A·Q±N %s ³o­Ó°ÝÃD´«¦¨¬Æ»òµª®×?\n",a,b,c)
-#define L070(a,b,c) S("PRIVMSG %s :ÁÂÁ %s ªÈ¥¿§Ú %s ³o­Óµª®×ªº¿ù»~.\n",a,b,c)
-#define L071(a,b,c,d) S("PRIVMSG %s :¦b§Úªº¦L¶H¤¤¦@¦³ %d ­Ó¤H§Ú¤£·Q¸ò¥L­Ì»¡¸Ü.\n",a,c,c,c)
-#define L073(a,b,c) S("PRIVMSG %s :%s, ¦A¹L %d ¬í§Ú´N­n­J¨¥¶Ã»y¤F.\n",a,b,c)
-#define L074(a,b,c) S("PRIVMSG %s :%s: ³o¥y¸ÜÁ`¦@¦³ %d ­Ó¦ì¤¸²Õ.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, ²{¦b¦@¦³ %d ªº°O¿ýµ¥§Ú³B²z %s.\n",a,b,c,d)
-#define L076(a,b) S("PRIVMSG %s :±q§Ú¶i¨Ó¨ì²{¦b, §ÚÁ`¦@¬Ý¨ì %d ­Ó¤H¶i¤J³o²á¤Ñ«Ç.\n",a,b)
-#define L077(a,b,c,d,e) S("PRIVMSG %s :§ÚÁ`¦@¥i¥H¥h %s %d ­Ó²á¤Ñºô¯¸%s. §Ú²{¦b¥¿¦b\
-²Ä #%d ­Ó²á¤Ñºô¯¸.\n",a,b,c,d,e)
-#define L078(a,b,c) S("PRIVMSG %s :%s, ±±¨î§Úªº«ü¥O¬O %c\n",a,b,c)
-#define L079(a,b,c) S("PRIVMSG %s :%s ¬Æ»ò°Ú? %s?\n",a,b,c)
-#define L080(a,b) S("PRIVMSG %s :%s, §A±o«ü©w¤@­Ó¦a§}µ¹§Ú°Ú!\n",a,b)
-#define L081(a,b) S("PRIVMSG %s :§Ú¨S¦³¿ìªk§ä¨ì %s ªº¸ê®Æ³á.\n",a,b)
-#define L083(a,b,c) S("PRIVMSG %s :%s: §A­n§Ú§i¶D %s ¬Æ»ò¨Æ°Ú?\n",a,b,c)
-#define L084(a,b,c) S("PRIVMSG %s :%s, §A­n§Ú§i¶D %s ¬Æ»ò¨Æ°Ú?\n",a,b,c)
-#define L085(a,b) S("PRIVMSG %s :§A·Q­n§i¶D½Ö°Ú? %s?\n",a,b)
-#define L083n(a,b,c) S("NOTICE %s :%s: §A·QÅý§Ú§i¶D %s ¬Æ»ò?\n",a,b,c)
-#define L084n(a,b,c) S("NOTICE %s :%s, §A­nÅý§Ú§i¶D %s ¬Æ¨Æ°Ú?\n",a,b,c)
-#define L085n(a,b) S("NOTICE %s :§A­nÅý§Ú§i¶D½Ö? %s?\n",a,b)
-#define L086(a,b) S("PRIVMSG %s :%s\2:\2 §A¦b°Ý§Ú°ÝÃD¶Ü?\n",a,b)
-#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? ½Ð­«·s¿é¤J©R¥O(¥´ %cHELP Åý§Ú±Ð§A«ç»ò¨Ï¥Î\
-hints)\n",a,b,c,d,e)
-#define L086n(a,b) S("NOTICE %s :%s\2:\2 §A¦b°Ý¶Ü?\n",a,b)
-#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? ½Ð­«·s¿é¤J©R¥O(¥´ %cHELP Åý§Ú±Ð§A«ç»ò¨Ï¥Î\
-hints)\n",a,b,c,d,e)
-#define L088(a) S("QUIT :%s §Ú¤w¸g¾K¨ì¨S¿ìªk¦AÀ°§A­Ì¸Ñµª¤F!\n",a)
-#define L089(a) S("PRIVMSG %s :\1ACTION §Ú´_¬¡¤F!!!!\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :½Ö¦b¤@ª½±Ð§Ú¤@¨Ç¨S¥ÎªºªF¦è \
-§Ú¤w¸g§â %d¥ó¨S¥Îªº¨Æ§R°£¤F.\n",a,b)
diff --git a/beta/source/main.c b/beta/source/main.c
deleted file mode 100755
index 1a0482f..0000000
--- a/beta/source/main.c
+++ /dev/null
@@ -1,210 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-/**
- * 6/23/00 Dan:
- * - Moved declaration of newact into #ifdef
- */
-int
-main (int argc, char **argv)
-{
- char temp[STRING_SHORT] = { 0 };
- char exe[STRING_SHORT] = { 0 };
- struct timeval timeout;
- int i = 0;
- fd_set fdvar;
- struct stat st;
-#ifdef SA_NOCLDSTOP
- struct sigaction newact;
-#endif
-
-#ifdef DEBUG
- DebuG = 1;
-#endif
-
- get_s ();
- srand (time (0));
- uptime = time (NULL);
-
- strncpy (DARKBOT_BIN, argv[0], sizeof (DARKBOT_BIN));
- strncpy (exe, argv[0], sizeof (exe)); /* Coz basename() may modify it's argument. */
-
-#ifdef DATABASEDIR
- strncpy (DAT_DIR, DATABASEDIR, sizeof (DAT_DIR));
-#else
- strncpy (DAT_DIR, "dat", sizeof (DAT_DIR));
-#endif
-#ifdef SOURCEDIR
- /* Check if this is being run from the build directory before being installed. */
- snprintf(temp, sizeof(temp), "%s/dat/setup.ini", SOURCEDIR);
- if (stat(temp, &st) >= 0)
- {
- snprintf(temp, sizeof(temp), "%s/dat", SOURCEDIR);
- strncpy(DAT_DIR, temp, sizeof (DAT_DIR));
- }
-#endif
-
- /* Parse the command line arguements, if there are any. */
- if (argv[1] != NULL)
- {
- for (i = 1; i < argc; i++)
- {
- if (argv[i][0] == '-')
- {
- if (argv[i][1] == 'S')
- {
- SeeN = true;
- }
- else if (argv[i][1] == 'D')
- {
- DebuG = 1;
- }
- else if (argv[i][1] == 'I')
- {
- strcpy (DAT_DIR, argv[++i]);
- printf ("DAT_DIR: Using %s.\n", DAT_DIR);
- }
- else
- {
- printf ("\n\n%s HELP:\n\n", dbVersion);
- printf ("%s (Launches Darkbot to IRC)\n", argv[0]);
- printf ("%s -SEEN (Enables SEEN [Even if SEEN is undefined])\n", argv[0]);
- printf ("%s -DEBUG (Launch in debug mode)\n", argv[0]);
- exit (0);
- }
- }
- }
- }
-
- if (SeeN)
- {
- printf ("\nSEEN ENABLED.\n");
- }
- if (DebuG == 1)
- {
- printf ("\nDEBUG ENABLED.\n");
- }
-
- set_paths ();
-
-/* This is the best way to deternmine if sigaction() can be used.
- * sigaction() is more portable than signal(), so use it if we can. */
-#ifdef SA_NOCLDSTOP
- newact.sa_handler = sig_alrm;
- sigemptyset (&newact.sa_mask);
- newact.sa_flags = 0;
- sigaction (SIGALRM, &newact, NULL);
- newact.sa_handler = sig_segv;
- sigemptyset (&newact.sa_mask);
- newact.sa_flags = 0;
- sigaction (SIGSEGV, &newact, NULL);
- newact.sa_handler = sig_hup;
- sigemptyset (&newact.sa_mask);
- newact.sa_flags = 0;
- sigaction (SIGHUP, &newact, NULL);
-#else
- signal (SIGALRM, sig_alrm);
- signal (SIGSEGV, sig_segv);
- signal (SIGHUP, sig_hup);
-#endif
-
-#ifdef ENABLE_RANDOM
- get_rand_stuff_time ();
-#endif
-
- printf ("\n\n\n");
- printf (" * * * * * * * * Darkbot (c) 1996 v8 Release Candidate 4 * * * * * * * * * \n");
- printf (" * The IRC Talking Robot * \n");
- printf (" * * \n");
- printf (" * Creator/Author: Jason <jason@superlink.net> * \n");
- printf (" * Project Administrator: juice <juice@freezedown.org> * \n");
- printf (" * Last major code changes: ron <ron@freezedown.org> * \n");
- printf (" * Last major code changes: onefang <onefang@gmail.com> * \n");
- printf (" * Please check docs/contributors for a list of collaborators * \n");
- printf (" * * \n");
- printf (" * Eventual malfunction, suggestions or patches use only * \n");
- printf (" * Support Forum @ http://forum.freezedown.org * \n");
- printf (" * * \n");
- printf (" * By running this installation you agree that this program is provided * \n");
- printf (" * free for non-commercial use only; - Distribution of modified source * \n");
- printf (" * code or binaries compiled from modified source code for any platform * \n");
- printf (" * or OS is expressly forbidden. - This program is only available at * \n");
- printf (" * http://www.freezedown.org * \n");
- printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n");
-
-#ifndef WIN32
-# ifdef ENABLE_VERSION_CHECK
- snprintf (temp, sizeof (temp), "lynx -source http://www.freezedown.org/cgi/laun.cgi?%s &", dbVersion);
- system (temp);
-# endif
- db_sleep (2);
- if (SORT)
- {
- printf ("Sorting database...\n");
- snprintf (temp, sizeof (temp), "sort %s -o %s\n", URL2, URL2);
- system (temp);
- }
-#endif
- load_helpers ();
-#ifdef ENABLE_STATS
- load_stats ();
-#endif
- check_files ();
- raw_now ("SERVERS");
- raw_now ("SETUP");
- raw_now ("PERMBAN");
- alarm (AIL);
- prepare_bot ();
- register_bot ();
-
- while (1)
- {
- timeout.tv_sec = WSEC;
- timeout.tv_usec = USEC;
- FD_ZERO (&fdvar);
- FD_SET (socketfd, &fdvar);
- switch (select (NFDBITS, &fdvar, (fd_set *) NULL, (fd_set *) NULL, &timeout))
- {
- case 0:
- break;
- case -1:
- if (!alarmed)
- {
- db_sleep (RECHECK);
- }
- else
- alarmed = 0;
- break;
- default:
- parse_server_msg (&fdvar);
- break;
- }
- }
-}
-
-void set_paths (void)
-{
- snprintf (DBTIMERS_PATH, sizeof (DBTIMERS_PATH), "%s/%s", DAT_DIR, DEFAULT_DBTIMERS_PATH);
- snprintf (LOG_DIR, sizeof (LOG_DIR), "%s/%s", DAT_DIR, DEFAULT_LOG_DIR);
- snprintf (RDB_DIR, sizeof (RDB_DIR), "%s/%s", DAT_DIR, DEFAULT_RDB_DIR);
-#ifdef ENABLE_STATS
- snprintf (STATS_FILE, sizeof (STATS_FILE), "%s/%s", DAT_DIR, DEFAULT_STATS_FILE);
-#endif
- snprintf (SEEN_FILE, sizeof (SEEN_FILE), "%s/%s", DAT_DIR, DEFAULT_SEEN_FILE);
- snprintf (URL2, sizeof (URL2), "%s/%s", DAT_DIR, DEFAULT_URL2);
- snprintf (BACKUP_DUP, sizeof (BACKUP_DUP), "%s/%s", DAT_DIR, DEFAULT_BACKUP_DUP);
- snprintf (AUTOTOPIC_F, sizeof (AUTOTOPIC_F), "%s/%s", DAT_DIR, DEFAULT_AUTOTOPIC_F);
- snprintf (HELPER_LIST, sizeof (HELPER_LIST), "%s/%s", DAT_DIR, DEFAULT_HELPER_LIST);
- snprintf (QUIZ_FILE, sizeof (QUIZ_FILE), "%s/%s", DAT_DIR, DEFAULT_QUIZ_FILE);
- snprintf (PERFORM, sizeof (PERFORM), "%s/%s", DAT_DIR, DEFAULT_PERFORM);
- snprintf (DEOP, sizeof (DEOP), "%s/%s", DAT_DIR, DEFAULT_DEOP);
- snprintf (RAND_SAY, sizeof (RAND_SAY), "%s/%s", DAT_DIR, DEFAULT_RAND_SAY);
- snprintf (RAND_FILE, sizeof (RAND_FILE), "%s/%s", DAT_DIR, DEFAULT_RAND_FILE);
- snprintf (RANDQ_TEMPFILE, sizeof (RANDQ_TEMPFILE), "%s/%s", DAT_DIR, DEFAULT_RANDQ_TEMPFILE);
- snprintf (RAND_BACKUP_FILE, sizeof (RAND_BACKUP_FILE), "%s/%s", DAT_DIR, DEFAULT_RAND_BACKUP_FILE);
- snprintf (SERVERS, sizeof (SERVERS), "%s/%s", DAT_DIR, DEFAULT_SERVERS);
- snprintf (PERMBAN, sizeof (PERMBAN), "%s/%s", DAT_DIR, DEFAULT_PERMBAN);
- snprintf (SETUP, sizeof (SETUP), "%s/%s", DAT_DIR, DEFAULT_SETUP);
-}
-
diff --git a/beta/source/parse.c b/beta/source/parse.c
deleted file mode 100755
index ee9d492..0000000
--- a/beta/source/parse.c
+++ /dev/null
@@ -1,504 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-/**
- * TODO: No function should ever be this long...move to the Command Pattern
- */
-void
-parse (char *line)
-{
- char *s = NULL, *s1 = NULL, *s2 = NULL, *s3 = NULL, *s4 = NULL, *cmd = NULL, *ptr = NULL;
- long TOG = 0, seen_value = 0;
-
- LastInput = 0;
- if (DebuG == 1)
- printf ("IN: %s", line);
-#ifdef DEBUG2
- db_log ("darkbot_debug.log", "IN: %s", line);
-#endif
- stripline (line);
- s = strtok (line, " ");
- if (strcasecmp (s, "PING") == 0)
- {
- s1 = strtok (NULL, " ");
- Snow ("PONG %s\n", s1);
- }
- else if (strcasecmp (s, "ERROR") == 0)
- {
- s1 = strtok (NULL, "");
- if (s1 != NULL)
- {
- if (strstr (s1, "Excess Flood") != NULL)
- {
- prepare_bot ();
- register_bot ();
- }
- else if (strstr (s1, "throttled") != NULL)
- {
- prepare_bot ();
- register_bot ();
- }
- else if (strstr (s1, "oo many c") != NULL)
- {
- prepare_bot ();
- register_bot ();
- }
- else if (strstr (s1, "o more c") != NULL)
- {
- prepare_bot ();
- register_bot ();
- }
- else
- {
- S ("QUIT :Caught ERROR from %s :(\n", BS);
- db_sleep (5);
- prepare_bot ();
- register_bot ();
- }
- }
- }
- else if (strstr (s, "!") == NULL)
- { /* From Server */
- cmd = strtok (NULL, " ");
- if (strcasecmp (cmd, "004") == 0)
- { /* Connected! */
- save_changes ();
- s2 = strtok (NULL, " "); /* Copy the current nick */
- strncpy (Mynick, s2, sizeof (Mynick));
- snprintf (NICK_COMMA, sizeof (NICK_COMMA), "%s,", Mynick);
- snprintf (COLON_NICK, sizeof (COLON_NICK), "%s:", Mynick);
- snprintf (BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", Mynick);
- s2 = strtok (NULL, " "); /* Got server name */
- }
- else if (strcasecmp (cmd, "315") == 0)
- {
- if (DISPLAY_SYNC)
- {
- s2 = strtok (NULL, " "); /*mynick */
- strncpy (Mynick, s2, sizeof (Mynick));
- s2 = strtok (NULL, " "); /* chan */
- S ("PRIVMSG %s :Sync with %s completed.\n", s2, s2);
- }
- }
- else if (strcasecmp (cmd, "311") == 0)
- {
- s1 = strtok (NULL, " ");
- s1 = strtok (NULL, " ");
- s1 = strtok (NULL, " ");
- s1 = strtok (NULL, " ");
- strncpy (g_host, s1, sizeof (g_host));
- }
- else if (strcasecmp (cmd, "319") == 0)
- {
- s1 = strtok (NULL, " ");
- s1 = strtok (NULL, " ");
- s2 = strtok (NULL, "");
- if (*s2 == ':')
- s2++;
- strlwr (s2);
- if (strstr (s2, "arez") != NULL)
- TOG = 1;
- if (strstr (s2, "kidd") != NULL)
- TOG = 1;
- if (strstr (s2, "hack") != NULL)
- TOG = 1;
- if (strstr (s2, "sex") != NULL)
- TOG = 1;
- if (strstr (s2, "fuck") != NULL)
- TOG = 1;
- if (strstr (s2, "porn") != NULL)
- TOG = 1;
- if (strstr (s2, "pic") != NULL)
- TOG = 1;
- if (TOG == 1)
- {
- S ("NOTICE @%s :%s is on \2%s\2\n", g_chan, s1, s2);
- return;
- }
- }
- else if (strcasecmp (cmd, "432") == 0 || strcasecmp (cmd, "468") == 0)
- { /* Invalid nick/user */
- s2 = strtok (NULL, "");
- printf ("Server Reported error %s\n\nDarkbot exiting.\n", s2);
- db_sleep (2);
- exit (0);
- }
- else if ((strcasecmp (cmd, "376") == 0) || (strcasecmp(cmd, "422") == 0))
- {
- /* Set default umodes */
- S ("MODE %s %s\n", Mynick, DEFAULT_UMODE);
- run_perform (); /* Run performs */
- S ("JOIN %s\n", CHAN);
- }
- else if (strcasecmp (cmd, "482") == 0)
- {
-#ifdef ENABLE_CHANNEL
- if (BITCH_ABOUT_DEOP)
- {
- s2 = strtok (NULL, " "); /* mynick */
- strncpy (Mynick, s2, sizeof (Mynick));
- s2 = strtok (NULL, " "); /* chan */
- /* We used to run the DEOP.INI here */
- }
-#endif
- }
- else if (strcasecmp (cmd, "352") == 0)
- {
- s2 = strtok (NULL, "");
- parse_who (s2);
-#ifdef ENABLE_STATUS
- }
- else if (strcasecmp (cmd, "252") == 0)
- {
- s2 = strtok (NULL, "");
- parse_252 (s2);
- }
- else if (strcasecmp (cmd, "404") == 0
- || strcasecmp (cmd, "475") == 0
- || strcasecmp (cmd, "474") == 0 || strcasecmp (cmd, "473") == 0)
- { /* Can't join? */
- s2 = strtok (NULL, " ");
- s2 = strtok (NULL, " ");
- db_sleep (5);
- S ("JOIN %s\n", s2);
- }
- else if (strcasecmp (cmd, "251") == 0)
- {
- s2 = strtok (NULL, "");
- parse_251 (s2);
- }
- else if (strcasecmp (cmd, "255") == 0)
- {
- s2 = strtok (NULL, "");
- parse_255 (s2);
-#endif
- }
- else if (strcasecmp (cmd, "433") == 0)
- {
- s2 = strtok (NULL, " ");
- if (*s2 != '*')
- {
- strncpy (Mynick, s2, sizeof (Mynick));
- snprintf (NICK_COMMA, sizeof (NICK_COMMA), "%s,", Mynick);
- snprintf (COLON_NICK, sizeof (COLON_NICK), "%s:", Mynick);
- snprintf (BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", Mynick);
- s3 = strtok (NULL, " ");
- }
- else
- {
- Snow ("NICK %s%d\n", Mynick, xtried);
- xtried++;
- if (xtried > 15)
- Snow ("NICK _`^%s%d\n", Mynick, xtried);
- if (xtried > 5)
- Snow ("NICK _%s%d\n", Mynick, xtried);
- }
- }
- }
- else
- { /* Info from user */
- if (*s == ':') /* Remove the colon prefix */
- s++;
- cmd = strtok (NULL, " "); /* Read in command */
- if (strcasecmp (cmd, "NOTICE") == 0)
- {
-#ifdef ENABLE_CHANNEL
- s2 = strtok (NULL, " "); /* target */
- if ((KICK_ON_CHANNEL_NOTICE) && (*s2 == '#'))
- {
- s3 = strtok (s, "!");
- if (BAN_ON_CHANNEL_NOTICE)
- {
- if (BAN_BY_HOST)
- {
- s4 = strtok (NULL, "@");
- s4 = strtok (NULL, "");
- S ("MODE %s +b *!*@%s\n", s2, s4);
- }
- else /* ban just by u@h */
- S ("MODE %s +b *%s\n", s2, strtok (NULL, ""));
- }
- S ("KICK %s %s :Punt\n", s2, s3);
- }
-#endif
- }
- else if (strcasecmp (cmd, "PRIVMSG") == 0)
- { /* PRIVMSG */
- s1 = strtok (NULL, " "); /* Target */
- s2 = strtok (NULL, ""); /* Rest */
- if ((LOG_PRIVMSG) && (*s1 != '#') && (*s1 != '&'))
- {
- db_log (privmsg_log, "[%s] %s %s %s\n", date (), s, s1, s2);
- }
- if (*s1 == '#' || *s1 == '&' || *s1 == '+')
- if (do_lastcomm (s, s1, s2) == 1)
- return;
- chanserv (s, s1, s2); /* Process PRIVMSG commands */
- }
- else if (strcasecmp (cmd, "KILL") == 0)
- {
- s1 = strtok (NULL, " "); /* Kill nick */
- if (strcasecmp (s1, Mynick) == 0)
- {
- do_quit (s1, 3); /* delete all users from ram since I'm gone */
-
- prepare_bot ();
- register_bot ();
- }
- }
- else if (strcasecmp (cmd, "KICK") == 0)
- {
- s1 = strtok (NULL, " "); /* #chan */
- s2 = strtok (NULL, " "); /* Who got kicked? */
- if (strcasecmp (s2, Mynick) == 0)
- { /* Rejoin if I was
- * kicked */
- do_quit (s1, 2);
- db_sleep (5);
- S ("JOIN %s\n", s1);
- S ("PRIVMSG %s :%s\n", s1, COMPLAIN_REASON);
- }
- else
- delete_user (s2, s1);
- }
- else if (strcasecmp (cmd, "INVITE") == 0)
- {
- s1 = strtok (NULL, " "); /* Mynick */
- s2 = strtok (NULL, " "); /* Target */
- if (*s2 == ':')
- s2++;
- if (strcasecmp (s2, CHAN) == 0)
- S ("JOIN %s\n", s2);
- }
- else if (strcasecmp (cmd, "PART") == 0)
- {
-
- if ((ptr = strchr (s, '!')) != NULL)
- *ptr++ = '\0';
-
- // Channel
- s1 = strtok (NULL, " ");
-
- // Make sure the first character in the target operative is not a :.
-
- if (*s1 == ':')
- s1++;
-
- /*
- * If we are parting the channel, remove all users in that channel from
- * memory. If someone else is parting, only remove them from memory.
- */
-
- if (strcasecmp (s, Mynick) != 0)
- delete_user (s, s1);
- else
- do_quit (s1, 2);
-
- }
- else if (strcasecmp (cmd, "QUIT") == 0)
- {
- if ((ptr = strchr (s, '!')) != NULL)
- *ptr++ = '\0';
- do_quit (s, 1);
- }
- else if (strcasecmp (cmd, "MODE") == 0)
- {
- do_modes (s, strtok (NULL, ""));
- }
- else if (strcasecmp (cmd, "NICK") == 0)
- {
- if ((ptr = strchr (s, '!')) != NULL)
- *ptr++ = '\0';
- s1 = strtok (NULL, " ");
- process_nick (s, s1);
- }
- else if (strcasecmp (cmd, "JOIN") == 0)
- {
- JOINs++;
- s1 = strtok (NULL, " "); /* TARGET */
- if (*s1 == ':')
- s1++;
- if ((ptr = strchr (s, '!')) != NULL)
- *ptr++ = '\0';
- strlwr (ptr);
- if ((SeeN) && (*s1 == '#'))
- seen_value = save_seen (s, ptr, s1);
- if (strcasecmp (s, Mynick) != 0)
- {
- if (check_permban (ptr, s1, s) == 1)
- return;
- add_user (s1, s, ptr, 1);
-
- if ((AUTOHELP_GUESTS) && (strstr(s, "Guest") != NULL))
- S ("PRIVMSG %s :hello %s. need any help?\n", s);
-
- if (DO_WHOIS)
- {
- strncpy (g_chan, s1, sizeof (g_chan));
- S ("WHOIS %s\n", s);
- }
-
- if (check_access (ptr, s1, 0, s) >= 4)
- {
- S ("MODE %s +o %s\n", s1, s);
- }
- else if (check_access (ptr, s1, 1, s) >= 1)
- {
-#ifdef ENABLE_CHANNEL
- if (VOICE_USERS_ON_JOIN)
- S ("MODE %s +v %s\n", s1, s);
-#endif
- }
- else if ((HELP_GREET) && (check_access(ptr, s1, 0, s) >= 1))
- {
- return; /* don't greet if the guy has
- * access (and no setinfo) */
- }
- else if ((HELP_GREET) && (strcasecmp(s1, CHAN) == 0))
- {
- if (SeeN)
- {
- if (seen_value == 0) /* don't show people the
- * notice every join */
- if (setinfo_lastcomm (s1) == 0) /* don't do it if you just did it! */
- L102 (s, s1, s, *CMDCHAR);
- }
- else
- {
- if (setinfo_lastcomm (s1) == 0)
- L102 (s, s1, s, *CMDCHAR);
- }
- }
- }
- else
- S ("WHO %s\n", s1); /* Check who is in the
- * chan */
- } /* JOIN */
- }
-}
-
-void
-parse_who (char *data)
-{
- char *chan = NULL, *nick = NULL, *ptr = NULL, *flags = NULL, b[STRING_SHORT] = { 0 };
-
- nick = strtok (data, " "); /* botnick */
- strncpy (Mynick, nick, sizeof (Mynick));
- chan = strtok (NULL, " ");
- ptr = strtok (NULL, " ");
- snprintf (b, sizeof (b), "%s@%s", ptr, strtok (NULL, " "));
- nick = strtok (NULL, " "); /* server */
- nick = strtok (NULL, " ");
- flags = strtok (NULL, " ");
- add_user (chan, nick, b, 1);
-
- if (strstr (flags, "@") != NULL)
- do_op(nick, chan, 1);
-}
-
-#ifdef ENABLE_STATUS
-void
-parse_252 (char *s)
-{
- char *tmp = NULL;
- int numb = 0;
-
- tmp = strtok (s, " ");
- tmp = strtok (NULL, " ");
- sscanf (tmp, "%d", &numb);
- IRCOPS = numb;
-}
-
-void
-parse_251 (char *s)
-{
- char *tmp = NULL;
- int numb = 0, r = 0, i = 0;
-
- /*- Read and chuck useless data from line 'b' -*/
- tmp = strtok (s, " ");
- tmp = strtok (NULL, " ");
- tmp = strtok (NULL, " ");
- tmp = strtok (NULL, " ");
- sscanf (tmp, "%d", &r);
- tmp = strtok (NULL, " ");
- tmp = strtok (NULL, " ");
- tmp = strtok (NULL, " ");
- sscanf (tmp, "%d", &i);
- tmp = strtok (NULL, " ");
- tmp = strtok (NULL, " ");
- tmp = strtok (NULL, " ");
- sscanf (tmp, "%d", &numb);
- NUM_SERV = numb;
- G_USERS = r + i;
-}
-
-void
-parse_255 (char *s)
-{
- char *tmp = NULL, Stat[1] = { 0 };
- int numb = 0, pre_CLIENTS = 0;
-
- /* test321 :I have 1313 clients and 1 servers */
- strlwr (s);
- tmp = strtok (s, " ");
- tmp = strtok (NULL, " ");
- tmp = strtok (NULL, " ");
- tmp = strtok (NULL, " ");
- numb = atoi (tmp);
- pre_CLIENTS = L_CLIENTS;
- L_CLIENTS = numb;
- if (L_CLIENTS < pre_CLIENTS)
- {
- strncpy (Stat, "-", sizeof (Stat));
- pre_CLIENTS = pre_CLIENTS - L_CLIENTS;
- }
- else
- {
- strncpy (Stat, "+", sizeof (Stat));
- pre_CLIENTS = L_CLIENTS - pre_CLIENTS;
- }
- snprintf (tmp, sizeof (tmp), "%3.2f", (float) (((float) L_CLIENTS / (float) G_USERS) * 100));
-/* FIXME: I don't see PLAY defined anywhere, is it left over from something else? */
-#if PLAY == 1
-#define PBOT "ArchFiend"
- if (pre_CLIENTS == 0 || pre_CLIENTS == L_CLIENTS)
- {
- S ("PRIVMSG %s :!SENDQ %d srvs, %d ops, %d users (%s%% of %d, %ld avg)\n", PBOT, NUM_SERV,
- IRCOPS, L_CLIENTS, tmp, G_USERS, G_USERS / NUM_SERV);
- }
- else
- S ("PRIVMSG %s :!SENDQ %d srvs, %d ops, %d users [%c%2d] (%s%% of %d, %ld avg)\37\n", PBOT,
- NUM_SERV, IRCOPS, L_CLIENTS, Stat[0], pre_CLIENTS, tmp, G_USERS, G_USERS / NUM_SERV);
- db_log (".ubcount", "%d\n%d\n0\n0\n", L_CLIENTS, L_CLIENTS);
- rename (".ubcount", "/usr/local/apache/htdocs/usage/userbase/userbase.dat");
- db_log (".glcount", "%d\n%d\n0\n0\n", G_USERS, G_USERS);
- rename (".glcount", "/usr/local/apache/htdocs/usage/global/global.dat");
-#else
- if (pre_CLIENTS == 0 || pre_CLIENTS == L_CLIENTS)
- {
- S ("PRIVMSG %s :\1ACTION \37(\37%2d servers\37)\37: %2d opers + \2%4d\2 users \37(\37%s%% %5d global \2!\2 %3ld avg\37)\37\1\n", CHAN, NUM_SERV, IRCOPS, L_CLIENTS, tmp, G_USERS, NUM_SERV ? (G_USERS / NUM_SERV) : 0);
- }
- else
- S ("PRIVMSG %s :\1ACTION \37(\37%2d servers\37)\37: %2d opers + \2%4d\2 users [\37%c%2d\37] \37(\37%s%% %5d global \2!\2 %3ld avg\37)\37\1\n", CHAN, NUM_SERV, IRCOPS, L_CLIENTS, Stat[0], pre_CLIENTS, tmp, G_USERS, NUM_SERV ? (G_USERS / NUM_SERV) : 0);
-#endif
-}
-#endif
-
-void
-parse_server_msg (fd_set * read_fds)
-{
- if (FD_ISSET (socketfd, read_fds))
- {
- if (readln () > 0)
- {
- NUMLINESSEEN++;
- parse (L);
- }
- else
- {
- close (socketfd);
- }
- }
-}
diff --git a/beta/source/permbans.c b/beta/source/permbans.c
deleted file mode 100755
index f7a4415..0000000
--- a/beta/source/permbans.c
+++ /dev/null
@@ -1,219 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-/**
- * Add a permban to the permban list.
- * 6/23/00 Dan:
- * - Both pointer variables are now received as pointer to const data
- * - Changed counter to type size_t, this should be an unsigned type
- * - Initialiazed n to 0 on declaration
- * - Added support for dynamically allocated uh and reason fields
- * in the struct permban list
- * - Did some extra memory leak prevention
- */
-
-void
-add_permban (const char *uh, size_t counter, const char *reason)
-{
- struct permbanlist *n = 0;
-
- n = malloc (sizeof (struct permbanlist));
- if (n == NULL)
- {
- db_log ("error.log", "AHHH! no ram left! in add_permban!\n");
- return;
- }
-
- memset (n, 0, sizeof (struct permbanlist));
- n->uh = strndup (uh, STRING_SHORT);
- if (NULL == n->uh)
- {
- db_log ("error.log", "add_permban> Memory allocation failure\n");
- /* Prevent memory leaks */
- free (n);
- return;
- }
-
- n->reason = strndup (reason, STRING_SHORT);
- if (NULL == n->reason)
- {
- db_log ("error.log", "add_permban> Memory allocation failure\n");
- /* Prevent memory leaks */
- free (n->uh);
- free (n);
- return;
- }
-
- strlwr (n->uh);
- n->counter = counter;
- PERMBAN_counter++;
- n->next = permbanhead;
- permbanhead = n;
-}
-
-/**
- * Check if a permban exists for a given uh/channel/nick set.
- * 6/23/00 Dan:
- * - Changed all method arguments to be pointers to const data
- * - Return type is now bool, returns true if ban is found,
- * false otherwise
- */
-bool
-check_permban (const char *uh, const char *chan, const char *nick)
-{
- char tmpBuf[STRING_SHORT + 1] = { 0 };
- struct permbanlist *c = permbanhead;
- size_t len = 0;
-
- len = MIN(STRING_SHORT, strlen(uh));
-
- strncpy (tmpBuf, uh, len);
- tmpBuf[len] = '\0';
- strlwr (tmpBuf);
- for (; c != NULL; c = c->next)
- {
- if (!match_wild (c->uh, tmpBuf) == 0)
- {
- c->counter++;
- S ("MODE %s +b %s\n", chan, c->uh);
- S ("KICK %s %s :\2[\2%d\2]\2: %s\n", chan, nick, c->counter, c->reason);
- return true;
- }
- }
- return false;
-}
-
-#ifdef ENABLE_CHANNEL
-
-/**
- * Remove a permban based on nickname and user@host.
- * 6/23/00 Dan:
- * - Both arguments are now pointers to const data
- * - Added free() for both pNode->uh and pNode->reason now
- * that the permbanlist has dynamically allocated fields
- * - Changed type of toggle from long to bool
- * - Changed name of toggle variable to (foundBan)
- * - permbanlist pointers are now initialized when declared
- * - Added if statement at end of method, this will only save
- * the bans if a ban was removed
- */
-int
-del_permban (const char *nick, const char *uh)
-{
- bool foundBan = false;
- struct permbanlist *pNode = permbanhead, *pPrev = 0;
- int i = 0;
-
- while (pNode)
- {
- if (strcasecmp (pNode->uh, uh) == 0)
- {
- L002 (nick, PERMBAN_counter, uh);
- PERMBAN_counter--;
- if (pPrev != NULL)
- {
- pPrev->next = pNode->next;
- }
- else
- {
- permbanhead = pNode->next;
- }
-
- free (pNode->uh);
- free (pNode->reason);
- free (pNode);
- foundBan = true;
- pNode = NULL;
- break;
- }
- pPrev = pNode;
- pNode = pNode->next;
- }
-
- if (foundBan)
- {
- /* Only need to save bans if ban list has changed */
- save_permbans ();
- }
- return foundBan;
-}
-
-
-/**
- * Save the permban list to file.
- * 6/23/00 Dan:
- * - the permbanlist pointer (c) is now pointer to const, because
- * this is a read only method, and that is a read only variable
- * - Initialized c when it is declared
- */
-void
-save_permbans (void)
-{
- const struct permbanlist *c = permbanhead;
-
- remove (TMP_FILE);
-
- printf ("*** Writing permbans: %s (%s)\n", PERMBAN, date ());
-
- for (; c != NULL; c = c->next)
- {
- db_log (TMP_FILE, "%s %d %s\n", c->uh, c->counter, c->reason);
- }
- rename (TMP_FILE, PERMBAN);
-
- if (PERMBAN_counter == 0)
- remove (PERMBAN);
-}
-#endif
-
-/**
- * 6/22 Dan
- * - Changed DATA to be 512 bytes, a power of 2
- * - DATA now initialized properly
- * - c is now a pointer to const, this is a read only method
- * - c is now initialized where declared
- * - Changed type of i, x to size_t, these variables should be
- * unsigned.
- * - Changed while loop to for loop.
- * - Changed reinitialization of DATA to use memset()
- */
-
-void
-show_banlist (const char *nick)
-{
- char DATA[STRING_SHORT * 7] = { 0 };
- char tmp [STRING_SHORT * 7] = { 0 };
- size_t i = 0, x = 0;
- const struct permbanlist *c = 0;
-
- for (c = permbanhead; c != NULL; c = c->next)
- {
- i++;
- ++x;
-
- snprintf (tmp, sizeof (tmp), "%s", DATA);
- snprintf (DATA, sizeof(DATA), "%s %s:%u",
- tmp, c->uh, c->counter);
- memset (tmp, 0, sizeof (tmp));
-
- /* Only show at max 6 bans per message sent. */
- if (i >= 6)
- {
- S ("NOTICE %s :%s\n", nick, DATA);
- i = 0;
- memset (DATA, 0, sizeof (DATA));
- }
- }
-
- /* If 'i' never reaches 6 on the last pass through the while loop,
- * and there are bans yet to be shown, act accordingly.
- */
-
- if (i > 0)
- {
- S ("NOTICE %s :%s\n", nick, DATA);
- }
-
- S ("NOTICE %s :End of PERMBAN list; %d ban%s found.\n", nick, x, (x == 1) ? "" : "s");
-}
diff --git a/beta/source/prototypes.h b/beta/source/prototypes.h
deleted file mode 100755
index d75ed3c..0000000
--- a/beta/source/prototypes.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/* ------------ Below are function declarations --------------- */
-
-#ifdef ENABLE_STATUS
-void parse_252 (char *),
- parse_251 (char *),
- parse_255 (char *);
-#endif
-
-char **tokenize (char *, size_t *);
-size_t count_lines (char *);
-void show_seen (char *, char *, char *),
- count_seen (char *, char *),
- show_info2 (const char *, const char *, enum chanserv_invoke_type);
-
-long save_seen (char *, char *, char *);
-void do_randomtopic (int, char *, char *, char *, char *);
-
-
-int get_random_integer (int max);
-
-#ifdef ENABLE_RANDOM
-
-void do_random_stuff (void),
- check_idle_channels (void),
- get_rand_stuff_time (void),
- del_autotopic (const char *),
- add_randomstuff (char *, char *, char *),
- do_autotopics (void);
-#endif
-
-#ifdef ENABLE_RANDQ
-void do_randq (char *, const int, const char *, const char *);
-#endif
-
-void datasearch (const char *, char *, char *),
- display_url (char *, char *, char *),
- set_pass (char *, char *, char *, char *),
- do_modes (char *, char *),
- process_nick (char *, char *);
-long verify_pass (char *, char *, char *, char *),
- ifexist_autotopic (char *);
-
-#ifdef ENABLE_CHANNEL
-void save_permbans (void);
-#endif
-
-void do_quit (const char *, long);
-
-#ifdef ENABLE_MATH
-void do_math (const char *, char *, char *);
-#endif
-
-void parse_who (char *);
-void set_autotopic (char *, char *, char *);
-void delete_user_ram (char *, char *),
- get_s (void),
- delete_url (const char *, char *, char *),
- update_setinfo (const char *, const char *, const char *);
-
-#ifdef ENABLE_CHANNEL
-void add_permban (const char *, size_t, const char *);
-int del_permban (const char *, const char *);
-#endif
-
-int check_existing_url (const char *, char *, char *);
-void *check_nick_parameter (struct setup_parameter *parameter, char *ptr);
-void show_helper_list (const char *, long),
- set_paths (void),
- show_banlist (const char *),
- chanserv (char *, char *, char *),
- raw_now (char *),
- find_url (const char *, char *, char *),
- save_changes (void),
- show_url (char *, char *, char *, long, long, char *, long);
-char *strlwr (char *),
- *rand_reply (const char *),
- *date (void),
- *get_multiword_topic (char *),
- *revert_topic (char *),
- *get_rand_nick (const char *),
- *get_word (long, char *, char *);
-
-void info (const char *, char *),
- load_helpers (void),
- scan_chan_users (char *, char *, char *),
- do_login (char *, char *);
-long do_lastcomm (char *, char *, char *),
- setinfo_lastcomm (char *);
-void parse (char *),
- add_helper (const char *, const char *, long, size_t,
- const char *, const char *, char);
-
-int get_connection (const char *, const char *, int),
- readln (void),
- writeln (const char *);
-
-bool check_permban (const char *, const char *, const char *);
-long cf (char *, char *, char *),
- f_f (char *),
- get_passwd (char *);
-time_t return_useridle (const char *, const char *, int);
-void a_f (char *),
- reset_ (void),
- delete_user (const char *, char *),
- add_user (char *, char *, char *, long);
-void set_fds (void),
- sig_hup (int),
- sig_segv (int),
- save_setup (void);
-void stripline (char *),
- init_bot (void),
- sig_alrm (int);
-void parse_server_msg (fd_set *);
-void trailing_blanks (char *),
- db_log (const char *, const char *,...),
- gs26 (void),
- add_s25 (char *, long, char *),
- add_banned_server (char *, char *),
- S (const char *,...),
- del_sendq (long),
- clear_sendq (long, long);
-
-char L[524],
- *random_word (char **),
- *plural (size_t);
-
-int socketfd,
- alarmed,
- check_access (char *, char *, int, char *),
- match_wild (const char *, const char *),
- Send (void),
- get_sendq_count (long);
-void check_dbtimers (void);
-
-void register_bot (void);
-void prepare_bot (void);
-int create_connection (char *, char *, long);
-int Snow (const char *, ...);
-void show_chaninfo (const char *, const char *, const char *);
-void show_chanusers (const char *, const char *);
-
-const char *run_program (const char *);
-
-void do_autotopics (void);
-
-#ifdef ENABLE_STATS
-void add_stats (char *, char *, long, long, long);
-void load_stats (void);
-void get_stats (char *, char *);
-#endif
-
-#ifdef ENABLE_QUIZ
-void run_quiz_question (char *);
-void run_quiz_answer (void);
-#endif
-void check_files (void);
-void run_perform (void);
-int web_post_query (char *trigger, char *source, char *uh, char *target, char *query, int size);
-int add_ignore_user_ram (char *);
-int delete_ignore_user_ram (char *);
-int check_ignore_user_ram (char *);
-int check_exempt (char *);
-void call_reserved_1 (char *, char *, char *);
-void call_reserved_2 (char *, char *, char *);
-size_t count_char (const char *, const char);
-bool isBoolean (char *aBoolean);
-void db_sleep (unsigned long seconds);
-void reverse (char *);
-char *mask_from_nick (char *, const char *);
-char *uh_from_nick (char *, const char *);
-int db_argstostr (char *, char **, size_t, char);
-long is_op (char *, const char *);
-void do_op (char *, const char *, long);
-
-struct setup_parameter *set_parameter (char *input);
diff --git a/beta/source/quiz.c b/beta/source/quiz.c
deleted file mode 100755
index 12cbcd5..0000000
--- a/beta/source/quiz.c
+++ /dev/null
@@ -1,108 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-#ifdef ENABLE_QUIZ
-void
-run_quiz_question (char *target)
-{
- FILE *fp;
- int i = 0;
- int j = 0;
- int k = 0;
- int size = 0;
- static int pos = 0;
- char b[STRING_LONG] = { 0 };
- char *ptr = NULL;
-
- if (quiz_timer > 0)
- return; /* timer already running */
-
- if ((fp = fopen (QUIZ_FILE, "r")) == NULL)
- return;
-
- while (fgets (b, sizeof (b), fp))
- {
- i++; /* count questions */
- }
-
- fseek (fp, 0L, SEEK_SET);
- j = get_random_integer(i);
- size = sizeof (recent_questions) / sizeof (recent_questions[0]);
-
- if (i < size)
- size = i / 2;
-
- while (k <= size)
- {
- if (j == recent_questions[k])
- {
- j = get_random_integer(i);
- k = 0;
- continue;
- }
- k++;
- }
-
- if (pos == size)
- pos = 0;
-
- recent_questions[pos] = j;
- quiz_line = j;
- pos++;
- i = 0;
-
- while (fgets (b, sizeof (b), fp))
- {
- if (i == quiz_line)
- break;
- i++;
- }
-
- if ((ptr = strtok (b, "@")) == NULL)
- {
- fclose (fp);
- return;
- }
-
- S ("PRIVMSG %s :%s\n", target, ptr);
- strncpy (quiz_target, target, sizeof (quiz_target));
- quiz_answer = 1; /* switch on timer */
-
- fclose (fp);
-}
-
-void
-run_quiz_answer (void)
-{
- FILE *fp;
- int i = 0;
- char b[STRING_LONG] = { 0 };
- char *ptr = NULL;
-
- if ((fp = fopen (QUIZ_FILE, "r")) == NULL)
- return;
-
- while (fgets (b, sizeof (b), fp))
- {
- if (i == quiz_line)
- break;
- i++;
- }
-
- if ((ptr = strtok (b, "@")) == NULL)
- {
- fclose (fp);
- return;
- }
- if ((ptr = strtok (NULL, "")) == NULL)
- {
- fclose (fp);
- return;
- }
-
- S ("PRIVMSG %s :%s\n", quiz_target, ptr);
-
- fclose (fp);
-}
-#endif
diff --git a/beta/source/random.c b/beta/source/random.c
deleted file mode 100755
index 41fb670..0000000
--- a/beta/source/random.c
+++ /dev/null
@@ -1,688 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-int get_random_integer(int max)
-{
- int result;
-
- result = ((float) max) * (rand() / (RAND_MAX + 1.0));
- if (result >= max) // Paranoid check.
- result = max - 1;
-
- return result;
-}
-
-
-#ifdef ENABLE_RANDOM
-void add_randomstuff (char *source, char *target, char *data)
-{
- char *ptr = NULL;
- char file [STRING_LONG] = {0};
- size_t nLines = 0;
- int toggle = 1;
-
-
-//#ifndef WIN32
- if (BACKUP_RANDOMSTUFF)
- {
- // Backup randomstuff file to a temporary file.
- unlink(RAND_BACKUP_FILE);
- snprintf(file, sizeof(file), "cp %s %s\n", RAND_FILE, RAND_BACKUP_FILE);
- system(file);
- }
-//#endif
-
- if(*data == '~')
- {
- data++;
- ptr = strtok(data, " ");
- if(ptr != NULL)
- strlwr(ptr);
-
- if(strspn(ptr, LEGAL_TEXT) != strlen(ptr))
- {
- S("privmsg %s :%s, rdb files must be made up of letters and or numbers, no other text is accepted.\n",
- target, source);
- return;
- }
-
- snprintf(file, sizeof(file), "%s/%s.rdb", RDB_DIR, ptr);
- data = strtok(NULL, "");
- toggle = 0;
- }
- else
- {
- snprintf(file, sizeof(file), "%s", RAND_FILE);
- nRandStuffs++;
- }
-
- db_log(file, "%s\n", data);
-
- nLines = count_lines(file);
-
- L011(target, source, nLines);
-}
-
-void get_rand_stuff_time (void)
-{
- Rand_Stuff = 2 + get_random_integer(RAND_STUFF_TIME);
- if (Rand_Stuff < RAND_STUFF_TIME / 2)
- Rand_Stuff = RAND_STUFF_TIME;
-}
-
-void do_random_stuff (void)
-{
- FILE *fp = 0;
- size_t nLine = 0, nLength = 0, nIndex = 0;
- int nIsAction = 0;
- char temp [STRING_SHORT] = {0};
- char szBuffer [STRING_LONG] = {0};
- char *b2 = NULL;
-
- // Count the randomstuffs.
- if ((nRandStuffs = count_lines(RAND_FILE)) < 1)
- return;
-
- // Get a random line number to display.
- nLine = 1 + (size_t) get_random_integer(nRandStuffs);
-
- // If nLine is less than 1, nLine becomes equal to 1
- if(nLine < 1)
- nLine = 1;
-
- // Complain if we can't open the randomstuff file.
- if((fp = fopen(RAND_FILE, "r")) == NULL)
- {
- S("privmsg %s :Unable to open %s for reading in do_random_stuff()\n",
- CHAN, RAND_FILE);
-
- return;
- }
-
- while(fgets(szBuffer, STRING_LONG, fp))
- {
- // Ignore lines that start with a /, treat as comments.
- if((*szBuffer != '/') && (*szBuffer != '\n'))
- nIndex++;
- else
- continue;
-
- stripline(szBuffer);
-
- if(nIndex == nLine)
- {
- nLength = strlen(szBuffer);
- nIndex = 0;
-
- memset(data, 0, sizeof(data));
-
- nIsAction = (*szBuffer == '+' ? 1 : 0);
-
- while(nLength > 0)
- {
- nIndex++;
- nLength--;
-
- // Parse data for channel name variable. replace accordingly.
- if(szBuffer[nLength] == '~')
- snprintf(temp, sizeof(temp), "%s%s", CHAN, data);
- else
- snprintf(temp, sizeof(temp), "%c%s", szBuffer[nLength], data);
-
- strncpy(data, temp, sizeof(data));
- }
-
- // Make sure the file is closed!
- fclose (fp);
-
- if(nIsAction == 1)
- {
- b2 = data;
- b2++;
- S("privmsg %s :\1ACTION %s\1\n", CHAN, b2);
-
- return;
- }
- else
- {
- S("privmsg %s :%s\n", CHAN, data);
-
- return;
- }
- }
- }
- fclose(fp);
-}
-#endif
-
-void do_randomtopic (int type, char *target, char *file, char *nick, char *topic)
-{
- FILE *fp = 0;
- char file2 [FILENAME_MAX] = {0};
- char szBuffer2 [STRING_LONG] = {0};
- char Data [STRING_LONG] = {0};
- char temp [STRING_LONG] = {0};
- char crm1 [STRING_LONG] = {0};
- char crm2 [STRING_LONG] = {0};
- char bFirst = 1;
- char *pBuffer = NULL, *ptr = NULL, *pDefault = NULL;
- size_t nLength = 0, nRandTopics = 0, nLine = 0,
- nIndex = 0;
- int toggle = 0, nType = 0, F = 0;
-
- // This ends up being the response, if we're doing a dunno, or whut reply, and the file
- // containing the random responses can't be opened.
-
- pDefault = (type == DUNNOR ? DUNNO_Q : WHUT);
-
- if(file != NULL)
- snprintf(file2, sizeof(file2), "%s/%s.rdb", RDB_DIR, file);
-
- if ((nRandTopics = count_lines(file2)) < 1)
- {
- S("privmsg %s :Sorry, I cannot answer that topic because "
- "darkbot random text file (rdb) \"%s\" has no lines in it.\n",
- target, file2);
- return;
- }
-
- if ((fp = fopen(file2, "r")) == NULL)
- {
- // If this is a dunno, or whut response, instead we say our default reply.
- if (type == NORMALR)
- {
- S("privmsg %s :Sorry, I cannot answer that topic because "
- "darkbot random text file (rdb) \"%s\" was not found.\n",
- target, file2);
- }
- else
- {
- S ("privmsg %s :%s\n", target, pDefault);
- }
-
- return;
- }
-
- /* db_sleep(1) */
-
- // Get line number that we are searching for in the file.
- nLine = 1 + (size_t) get_random_integer(nRandTopics);
-
- while(fgets(szBuffer2, STRING_LONG, fp))
- {
- if((*szBuffer2 != '/') && (*szBuffer2 != '\n'))
- nIndex++;
- else
- continue;
-
- stripline(szBuffer2);
-
- // This is our line!
- if(nIndex == nLine)
- {
- nIndex = 0;
- pBuffer = szBuffer2;
-
- /* if ((*pBuffer == '+') || (*pBuffer == '-'))
- {
- pBuffer++;
- nType = ((*pBuffer == '+') ? RDB_ACTION : RDB_RAW);
- }
- else
- nType = RDB_NORMAL;
- */
-
- if (*pBuffer == '+')
- {
- pBuffer++;
- nType = RDB_ACTION;
- }
- else if (*pBuffer == '-')
- {
- pBuffer++;
- nType = RDB_RAW;
- }
- else
- {
- nType = RDB_NORMAL;
- }
-
- nLength = (size_t) strlen(pBuffer);
-
- while(nLength > 0)
- {
- nLength--;
- if (toggle == 1)
- {
- toggle = 0;
- // Support for tokens
- if (pBuffer[nLength] == '1' || pBuffer[nLength] == '2' || pBuffer[nLength] == '3' ||
- pBuffer[nLength] == '4' || pBuffer[nLength] == '5' || pBuffer[nLength] == '6' ||
- pBuffer[nLength] == '7' || pBuffer[nLength] == '8' || pBuffer[nLength] == '9')
- {
- /* The first time around, we just store the topic in a "safe place" */
-
- if (bFirst == 1)
- {
- strncpy (crm1, topic, sizeof(crm1));
- bFirst = 0;
- }
-
- /* Each time around, get a new copy from the "safe place". */
-
- strncpy (crm2, crm1, sizeof(crm2));
- snprintf (temp, sizeof(temp), "%s%s", get_word (pBuffer[nLength], crm2, "+"), Data);
- }
-
- else if(pBuffer[nLength] == 'N')
- { // nick
- snprintf(temp, sizeof(temp), "%s%s", nick, Data);
- }
- else if ((pBuffer[nLength] == 'H') && (*target == '#'))
- { /* u@h of user */
- snprintf (temp, sizeof (temp), "%s%s", mask_from_nick (nick, target), Data);
-
- }
- else if ((pBuffer[nLength] == 'C') && (*target == '#'))
- { // channel or nick.
- snprintf(temp, sizeof(temp), "%s%s", target, Data);
- }
- else if (pBuffer[nLength] == 'T')
- { // time
- snprintf(temp, sizeof(temp), "%s%s", date(), Data);
- }
- else if (pBuffer[nLength] == 't')
- { /* unixtime */
- snprintf (temp, sizeof (temp), "%ld%s", (long) time (NULL), Data);
- }
- else if ((pBuffer[nLength] == 'R') && (*target == '#'))
- { // Random nick (not if this is not a channel
- snprintf(temp, sizeof(temp), "%s%s",
- get_rand_nick(target), Data);
- }
- else if (pBuffer[nLength] == 'S')
- { // Server
- snprintf(temp, sizeof(temp), "%s%s", BS, Data);
- }
- else if (pBuffer[nLength] == 'P')
- { // Port
- snprintf(temp, sizeof(temp), "%d%s", (int) BP, Data);
- }
- else if(pBuffer[nLength] == 'Q')
- { // Question
- snprintf(temp, sizeof(temp), "%s%s", revert_topic(topic), Data);
- }
- else if(pBuffer[nLength] == 'W')
- { // WWW page
- snprintf(temp, sizeof(temp), "http://freezedown.org%s", Data);
- }
- else if(pBuffer[nLength] == '!')
- { // cmdchar
- snprintf(temp, sizeof(temp), "%c%s", *CMDCHAR, Data);
- }
- else if(pBuffer[nLength] == 'V')
- { // Version
- snprintf(temp, sizeof(temp), "%s%s", dbVersion, Data);
- }
- else if(pBuffer[nLength] == 'B')
- { // Mynick
- snprintf(temp, sizeof(temp), "%s%s", Mynick, Data);
- }
- else
- {
- snprintf(temp, sizeof(temp), "%c~%s", pBuffer[nLength], Data);
- }
- }
- else if(pBuffer[nLength] == '~')
- {
- toggle = 1;
- }
- else
- {
- snprintf(temp, sizeof(temp), "%c%s", pBuffer[nLength], Data);
- }
- strncpy(Data, temp, sizeof(Data));
- }
-
- switch (nType)
- {
- case RDB_ACTION:
- S ("privmsg %s :\1ACTION %s\1\n", target, Data);
- break;
-
- case RDB_NORMAL:
- S ("privmsg %s :%s\n", target, Data);
- break;
-
- case RDB_RAW:
- ptr = strtok (Data, "|");
-
- while (ptr != NULL)
- {
- if (ptr[0] == ' ')
- ptr++;
-
- if (ptr[0] == 'B' && ptr[1] == 'A' && ptr[2] == 'N')
- { // Ban the user, if the target is a channel.
- if (*target == '#')
- S ("mode %s +b *%s\n", target, mask_from_nick (nick, target));
- else
- S ("privmsg %s :Sorry, %s, I can't respond to that topic in private.\n",
- target, nick);
- }
-
- if (ptr[0] == 'T' && ptr[1] == 'E' && ptr[2] == 'M' && ptr[3] == 'P' &&
- ptr[4] == 'B' && ptr[5] == 'A' && ptr[6] == 'N')
- { // Ban user for 60 seconds, if the target is a channel.
- if (*target == '#')
- {
- S ("mode %s +b *%s\n", target, mask_from_nick (nick, target));
- snprintf (temp, sizeof (temp), "%s/%ld", DBTIMERS_PATH, (long) time (NULL) + 60);
- db_log (temp, "MODE %s -b *%s\n", target, mask_from_nick (nick, target));
-
- }
- else
- S ("privmsg %s :Sorry, %s, I can't respond to that topic in private.\n",
- target, nick);
- }
-
- ptr[0] = tolower (ptr[0]);
- ptr[1] = tolower (ptr[1]);
-
- if (ptr[0] == 'p' && ptr[1] == 'r')
- F = 1;
- if (ptr[0] == 'k' && ptr[1] == 'i')
- F = 1;
- if (ptr[0] == 'n' && ptr[1] == 'o')
- F = 1;
- if (ptr[0] == 't' && ptr[1] == 'o')
- F = 1;
-
- if (F == 1)
- {
- S ("%s\n", ptr);
- F = 0;
- }
-
- ptr = strtok (NULL, "|");
- }
- break;
-
- } // End switch.
-
- fclose (fp);
- return;
-
- }
- }
- fclose(fp);
-}
-
-/**
- * 05/27/02 Ron
- * - Recoded this function, random.ini no longer needs a number
- * at the top.
- * 6/22/00 Dan
- * - Function argument is now pointer to const
- * - Fixed a problem where the file was never closed
- * - All variables are now initialized when declared
- * - Removed an unused variable
- * - Changed long variables to type size_t, they should be
- * unsigned
- * - Changed reinitialization of data
- * - Moved the big if/else structure to a switch
- */
-
-char *rand_reply (const char *nick)
-{
- FILE *fp = 0;
- char temp [STRING_SHORT] = {0};
- size_t nIndex = 0, nRandTopics = 0, nLine = 0,
- nLength = 0;
-
- // Count how many lines are in the RAND_SAY file, if can't be
- // counted, just return.
- if((nRandTopics = count_lines(RAND_SAY)) < 1)
- return(0);
-
- // set nLine to be a random number between 1 and nRandTopics.
- nLine = 1 + (size_t) get_random_integer(nRandTopics);
-
- // If the RAND_SAY file can't be opened, just return.
- if((fp = fopen(RAND_SAY, "r")) == NULL)
- return(0);
-
- while(fgets(r_reply, STRING_SHORT, fp))
- {
- // Ignore comments
- if((*r_reply != '/' ) && (*r_reply != '\n'))
- nIndex++;
- else
- continue;
-
- stripline(r_reply);
-
- if(nIndex != nLine)
- continue;
- else
- {
- // This is our line.
- fclose(fp);
- nLength = (size_t) strlen(r_reply);
- nIndex = 0;
- data[0] = 0;
-
- while(nLength > 0)
- {
- nIndex++;
- nLength--;
- switch(r_reply[nLength])
- {
- case '^':
- snprintf(temp, sizeof(temp), "%s%s", nick, data);
- break;
- case '%':
- snprintf(temp, sizeof(temp), "\2%s", data);
- break;
- case '&':
- snprintf(temp, sizeof(temp), "\37%s", data);
- break;
- case '~':
- snprintf(temp, sizeof(temp), "\26%s", data);
- break;
- default:
- snprintf(temp, sizeof(temp), "%c%s", r_reply[nLength], data);
- break;
- }
-
- strncpy(data, temp, sizeof(data));
- }
- // Return our fully parsed line.
- return(data);
- }
- }
-
- // Unable to find a match
- fclose(fp);
-
- // A space is returned to prevent crashing
- return(" ");
-}
-
-#ifdef ENABLE_RANDQ
-
-/*
- * do_randq():
- *
- * Types = RANDQ_NORMAL, RANDQ_CASE, RANDQ_RAND
- */
-
-void do_randq (char *text, const int type, const char *target, const char *nick)
-{
- FILE *fp = 0;
- size_t nLine = 0, length = 0, nNumMatches = 0,
- nIndex2 = 0, nIndex3 = 0;
- int nIsAction = 0;
- char *b2 = NULL;
- char temp [STRING_SHORT] = { 0 };
- char szBuffer[STRING_LONG] = { 0 };
-
- /*
- * Check for RANDQ_RAND, and just do_random_stuff() if it's specified.
- */
- if (type == RANDQ_RAND)
- {
- do_random_stuff ();
- return;
- }
-
- if (text == NULL)
- {
- if(((nNumMatches = count_lines(RAND_FILE)) == -1) ||
- (nNumMatches == 0))
- {
- S ("privmsg %s :%s, There are no randomstuffs, or %s cannot be accessed.\n",
- target, nick, RAND_FILE);
-
- return;
- }
-
- S("privmsg %s :%s, there %s %d randomstuff%s\n",
- target,
- nick,
- nNumMatches == 1 ? "is" : "are",
- nNumMatches,
- nNumMatches == 1 ? "." : "s."
- );
-
- return;
- }
-
- /* Remove the temporary file. */
-
- remove(RANDQ_TEMPFILE);
-
- if((fp = fopen(RAND_FILE, "r")) == NULL)
- {
- S("privmsg %s :%s, I was unable to open %s for reading.\n",
- target, nick, RAND_FILE);
- return;
- }
-
- while(!feof(fp))
- {
- while(fgets(szBuffer, STRING_LONG, fp))
- {
- if(*szBuffer == '/')
- continue;
-
- stripline(szBuffer);
-
- /*
- * If type is specified as being case sensitive, use strstr,
- * otherwise, use strcasestr
- */
-
- if (type == RANDQ_CASE)
- {
- if (strstr(szBuffer, text))
- {
- nNumMatches++;
- db_log(RANDQ_TEMPFILE, "%s\n", szBuffer);
- }
- }
- else /* if (type == RANDQ_NORMAL) */
- {
- if (strcasestr(szBuffer, text) != 0)
- {
- nNumMatches++;
- db_log(RANDQ_TEMPFILE, "%s\n", szBuffer);
- }
- }
- }
- }
-
- // Close randomstuff file.
- fclose(fp);
-
- // If no matches are present, return that.
- if(nNumMatches == 0)
- {
- S("privmsg %s :%s, I didn't find any matches for your search.\n",
- target, nick);
- return;
- }
-
- nLine = 1 + (size_t) get_random_integer(nNumMatches);
-
- // If we can't open the temporary file, complain about it.
- if((fp = fopen(RANDQ_TEMPFILE, "r")) == 0)
- {
- S("privmsg %s :%s, I was unable to open %s for reading.\n",
- target, nick, RANDQ_TEMPFILE);
- return;
- }
-
- while(!feof(fp))
- {
- while(fgets(szBuffer, STRING_LONG, fp))
- {
- if((*szBuffer != '/' ) || (*szBuffer != '\n'))
- nIndex2++;
- else
- continue;
-
- stripline(szBuffer);
-
- // This is the line we have chosen.
- if(nIndex2 == nLine)
- {
-
- // Check if this is an action.
- nIsAction = (*szBuffer == '+' ? 1 : 0);
-
- length = strlen(szBuffer);
- nIndex3 = 0;
-
- memset(data, 0, sizeof(data));
- while(length > 0)
- {
- nIndex3++;
- length--;
- if(szBuffer[length] == '~')
- {
- // Replace occurance of this char with chan name
- snprintf(temp, sizeof(temp), "%s%s", target, data);
- }
- else
- {
- snprintf(temp, sizeof(temp), "%c%s", szBuffer[length], data);
- }
- strncpy(data, temp, sizeof(data));
- }
-
- // Make sure the file is closed.
- fclose (fp);
-
- if(nIsAction == 1)
- {
- b2 = data;
- b2++;
-
- S("privmsg %s :\1ACTION %s (%d/%d)\1\n",
- target, b2, nLine, nNumMatches);
- return;
- }
- else
- {
- S("privmsg %s :(%d/%d): %s\n",
- target, nLine, nNumMatches, data);
- return;
- }
- }
- }
- }
- fclose(fp);
-}
-#endif
diff --git a/beta/source/raw.c b/beta/source/raw.c
deleted file mode 100755
index 4e2fca4..0000000
--- a/beta/source/raw.c
+++ /dev/null
@@ -1,220 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-void
-check_files (void)
-{
- FILE *fp;
-
- if ((fp = fopen (PERFORM, "r")) == NULL)
- {
- if ((fp = fopen (PERFORM, "w")) == NULL)
- {
- printf ("Can't read/write %s! Exiting ...\n", PERFORM);
- exit (EXIT_FAILURE);
- }
- else
- fclose (fp);
- }
-
- if ((fp = fopen (URL2, "r")) == NULL)
- {
- if ((fp = fopen (URL2, "w")) == NULL)
- {
- printf ("Can't read/write %s! Exiting ...\n", URL2);
- exit (EXIT_FAILURE);
- }
- else
- fclose (fp);
- }
-
- fclose(fp);
-
-}
-
-
-void *check_nick_parameter(struct setup_parameter *parameter, char *ptr)
-{
- if (strspn (ptr, LEGAL_NICK_TEXT) != strlen (ptr))
- {
- printf("The nickname %s contains illegal characters.", ptr);
- return NULL;
- }
-
- strncpy (s_Mynick, ptr, sizeof (s_Mynick));
- snprintf(NICK_COMMA, sizeof (NICK_COMMA), "%s,", s_Mynick);
- snprintf(COLON_NICK, sizeof (COLON_NICK), "%s:", s_Mynick);
- snprintf(BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", s_Mynick);
- S("NICK %s\n", s_Mynick);
-
- if(LOG_PRIVMSG)
- snprintf (privmsg_log, sizeof (privmsg_log), "%s%s-privmsg.log", LOG_DIR, s_Mynick);
-
- return ptr;
-}
-
-/**
- * 6/23/00 Dan:
- * - Initialized all variables
- */
-void
-raw_now (char *type)
-{
- FILE *fp = NULL;
- long i = 0, counter = 0;
- char str[STRING_LONG] = { 0 }, *dat = NULL, *ptr = NULL, *tmp1 =
- NULL, *tmp2 = NULL, *tmp3 = NULL;
-
- if (strcasecmp (type, "PERMBAN") == 0)
- if ((fp = fopen (PERMBAN, "r")) == NULL)
- return;
- if (strcasecmp (type, "DEOP") == 0)
- if ((fp = fopen (DEOP, "r")) == NULL)
- return;
- if (strcasecmp (type, "SERVERS") == 0)
- if ((fp = fopen (SERVERS, "r")) == NULL)
- {
- printf ("%s not found. You must create the file with format:\n", SERVERS);
- printf ("server port ...this list can be as long as you want.\n");
- exit (0);
- }
- if (strcasecmp (type, "SETUP") == 0)
- if ((fp = fopen (SETUP, "r")) == NULL)
- {
- printf ("Unable to locate %s! You must run configure!.\n", SETUP);
- exit (0);
- }
- while (!feof (fp))
- {
- if (strcasecmp (type, "SETUP") == 0)
- {
- SeeN = true;
- while (fgets (str, STRING_LONG, fp))
- {
- stripline (str);
- set_parameter(str);
- }
- }
- else if (strcasecmp (type, "PERMBAN") == 0)
- {
- while (fgets (str, STRING_LONG, fp))
- {
- stripline (str);
-
- /* Allow comments */
-
- if (*str == '#')
- continue;
-
- tmp1 = strtok (str, " ");
- if (tmp1 == NULL)
- continue;
- tmp2 = strtok (NULL, " ");
- if (tmp2 == NULL)
- tmp2 = "0";
- tmp3 = strtok (NULL, "");
- if (tmp3 == NULL)
- tmp3 = "Permbanned!";
- strlwr (tmp1);
- counter = atoi (tmp2);
- add_permban (tmp1, counter, tmp3);
- }
- }
- else if (strcasecmp (type, "SERVERS") == 0)
- {
- printf ("Loading %s file ", SERVERS);
- while (fgets (str, STRING_LONG, fp))
- {
- /* Ignore comment lines */
-
- if (*str == '#' || *str == '/')
- continue;
-
- printf (".");
- fflush (stdout);
- stripline (str);
-
- /* Watch out for blank lines. Since fgets
- returns on NULL, we're checking for NULL
- within the fget'd data, which would indicate
- a line containing NULL data in the file, not
- EOF (Wrote this as a reminder). Ignore these
- lines and move on.
- */
-
- if ((tmp1 = strtok (str, " ")) == NULL)
- continue;
- else
- tmp2 = strtok (NULL, " ");
-
- i++;
-
- if (tmp2 == NULL)
- {
- printf ("%s has no matching port in %s!\n", tmp1, SERVERS);
- exit (0);
- }
-
- tmp3 = strtok (NULL, "");
- add_s25 (tmp1, atoi (tmp2), tmp3);
- }
-
- if (i > 0)
- printf ("done(%d).\n", (int) i);
- else
- {
- printf ("ERROR! No servers found in %s! Please edit this file. Aborting!\n", SERVERS);
- exit (0);
- }
- }
- else if (fgets (str, STRING_LONG, fp))
- S ("%s\n", str);
- }
- fclose (fp);
-}
-
-void
-run_perform (void)
-{
- FILE *fp;
- char str [STRING_LONG] = {0},
- temp [STRING_LONG] = {0};
- size_t len = 0;
-
- if ((fp = fopen (PERFORM, "r")) == NULL)
- return;
-
- while (fgets (str, sizeof (str), fp))
- {
- /* Allow comments */
-
- if (*str == '#')
- continue;
-
- len = strlen (str);
- memset (data, 0, sizeof (data));
-
- while (len > 0)
- {
- len--;
- if ((str[len] == '~') && (str[len-1] == 'B'))
- {
- len--;
- snprintf (temp, sizeof (temp), "%s%s", Mynick, data);
- }
- else
- {
- snprintf (temp, sizeof (temp), "%c%s", str[len], data);
- }
-
- strncpy (data, temp, sizeof (data));
- }
-
- if (data != NULL)
- {
- S ("%s\n", data);
- }
- }
- fclose (fp);
-}
diff --git a/beta/source/reserved.c b/beta/source/reserved.c
deleted file mode 100755
index e96aa73..0000000
--- a/beta/source/reserved.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-void
-call_reserved_1 ( char *source, char *target, char *param )
-{
- FILE *fp;
- char buffer[STRING_SHORT] = { 0 };
- char input[STRING_SHORT] = { 0 };
-
- if ( strlen ( param ) == 0 )
- return;
-
- snprintf ( buffer, sizeof ( buffer ), "./cdecl -a -q explain \"%s\"\n", param );
-
- if ( ( fp = popen ( buffer, "r" ) ) == NULL )
- return;
-
- fgets ( input, sizeof ( input ), fp );
-
- if ( strlen ( input ) > 0 )
- S ( "PRIVMSG %s :%s%s\n", target, rand_reply(source), input );
-
- pclose ( fp );
-}
-
-void
-call_reserved_2 ( char *source, char *target, char *param )
-{
- FILE *fp;
- char buffer[STRING_SHORT] = { 0 };
- char input[STRING_SHORT] = { 0 };
-
- if ( strlen ( param ) == 0 )
- return;
-
- snprintf ( buffer, sizeof ( buffer ), "./cdecl -a -q declare \"%s\"\n", param );
-
- if ( ( fp = popen ( buffer, "r" ) ) == NULL )
- return;
-
- fgets ( input, sizeof ( input ), fp );
-
- if ( strlen ( input ) > 0 )
- S ( "PRIVMSG %s :%s%s\n", target, rand_reply(source), input );
-
- pclose ( fp );
-}
diff --git a/beta/source/seen.c b/beta/source/seen.c
deleted file mode 100755
index 6f84ca5..0000000
--- a/beta/source/seen.c
+++ /dev/null
@@ -1,145 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-void
-count_seen (char *source, char *target)
-{
- FILE *fp = 0;
- char temp [STRING_LONG] = { 0 };
- size_t nCount = 0;
-
- // Complain if we can't open the file.
- if ((fp = fopen (SEEN_FILE, "r")) == NULL)
- {
- L003 (source, SEEN_FILE);
- return;
- }
-
- while (fgets (temp, STRING_LONG, fp))
- {
- ++nCount;
- }
-
- fclose (fp);
- L004 (target, source, nCount);
-}
-
-void
-show_seen (char *nick, char *source, char *target)
-{
- FILE *fp = 0;
- char temp[STRING_LONG] = { 0 }, *intime = NULL, *r_nick = NULL, *uh =
- NULL, *chan = NULL, *ptr = NULL;
- time_t unixtime = 0;
-
- if ((nick == NULL) || (strlen(nick) > MAX_NICK_LENGTH))
- return;
-
- // Looking for yourself, eh?
- if (strcasecmp (nick, source) == 0)
- {
- L005 (target, source);
- return;
- }
-
- if ((ptr = strchr (nick, '?')) != NULL)
- memmove (ptr, ptr + 1, strlen (ptr + 1) + 1);
-
- if ((fp = fopen (SEEN_FILE, "r")) == NULL)
- {
- L003 (source, SEEN_FILE);
- return;
- }
-
- while (fgets (temp, STRING_LONG, fp))
- {
- stripline (temp);
- r_nick = strtok (temp, " ");
- if (strcasecmp (nick, r_nick) == 0)
- {
- uh = strtok (NULL, " ");
- chan = strtok (NULL, " ");
-
- if ((uh == NULL) || (chan == NULL))
- continue;
-
- intime = strtok (NULL, " ");
-
- if (intime == NULL)
- continue;
-
- unixtime = time (NULL) - atoi (intime);
-
- if (unixtime > 86400)
- S ("PRIVMSG %s :%s, I last saw %s (%s) %d day%s, %02d:%02d ago in %s\n", target,
- source, r_nick, uh, unixtime / 86400, (unixtime / 86400 == 1) ? "" : "s",
- (unixtime / 3600) % 24, (unixtime / 60) % 60, chan);
- else if (unixtime > 3600)
- S ("PRIVMSG %s :%s, I last saw %s (%s) %d hour%s, %d min%s ago in %s\n", target,
- source, r_nick, uh, unixtime / 3600, unixtime / 3600 == 1 ? "" : "s",
- (unixtime / 60) % 60, (unixtime / 60) % 60 == 1 ? "" : "s", chan);
- else
- S ("PRIVMSG %s :%s, I last saw %s (%s) %d minute%s, %d sec%s ago in %s\n", target,
- source, r_nick, uh, unixtime / 60, unixtime / 60 == 1 ? "" : "s", unixtime % 60,
- unixtime % 60 == 1 ? "" : "s", chan);
- fclose (fp);
- return;
- }
- }
- fclose (fp);
- L006 (target, source, nick, SEEN_REPLY);
-}
-
-long
-save_seen (char *nick, char *uh, char *chan)
-{
- FILE *fp = 0;
- char temp[STRING_LONG] = { 0 }, *r_nick = NULL, *r_chan = NULL, *r_uh = NULL, *r_time = NULL;
- long toggle = 0;
- time_t unixtime = 0;
-
- printf ("\n*** Writing seen file: %s (%s) [%s]\n", CHAN, SEEN_FILE, date ());
-
- unlink (TMP_FILE);
-
- if ((fp = fopen (SEEN_FILE, "r")) == NULL)
- {
- db_log (SEEN_FILE, "%s %s %s %d\n", nick, uh, chan, (time_t) time (NULL));
- return (-1);
- }
-
- while (fgets (temp, STRING_LONG, fp))
- {
- stripline (temp);
- r_nick = strtok (temp, " ");
- if (strcasecmp (nick, r_nick) == 0)
- {
- toggle = 1;
- db_log (TMP_FILE, "%s %s %s %d\n", nick, uh, chan, (time_t) time (NULL));
- }
- else
- {
- r_uh = strtok (NULL, " ");
- r_chan = strtok (NULL, " ");
- r_time = strtok (NULL, " ");
-
- if (r_uh == NULL || r_chan == NULL || r_time == NULL)
- continue;
-
- unixtime = (time_t) time (NULL) - (time_t) atoi (r_time);
-
- if (unixtime < MAX_LASTSEEN)
- db_log (TMP_FILE, "%s %s %s %s\n", r_nick, r_uh, r_chan, r_time);
- }
- }
- fclose (fp);
- if (toggle == 0)
- {
- db_log (TMP_FILE, "%s %s %s %d\n", nick, uh, chan, (time_t) time (NULL));
- }
-
- rename (TMP_FILE, SEEN_FILE);
-
- return toggle;
-}
diff --git a/beta/source/server.c b/beta/source/server.c
deleted file mode 100755
index ed369fd..0000000
--- a/beta/source/server.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-void
-gs26 (void)
-{
- long i = 0;
- struct sl124 *c;
-
- c = sh124;
- spr++;
- if (spr > snr)
- spr = 1;
- while (c != NULL)
- {
- i++;
- if (i == spr)
- {
- strncpy (BS, c->name, sizeof (BS));
- BP = c->port;
- strncpy (BPASS, c->pass, sizeof (BPASS));
- }
- c = c->next;
- }
-}
-
-void add_s25 (char *server, long port, char *pass)
-{
- struct sl124 *n;
-
- n = malloc (sizeof (struct sl124));
- if (n == NULL)
- {
- db_log ("error.log", "AHHH! No ram left! in add_s25!\n");
- return;
- }
- memset (n, 0, sizeof (struct sl124));
- snr++;
- if (n != NULL)
- {
- strncpy (n->name, server, sizeof (n->name));
- n->port = port;
- if (pass != NULL)
- strncpy (n->pass, pass, sizeof (n->pass));
- n->next = sh124;
- sh124 = n;
- }
-}
diff --git a/beta/source/signals.c b/beta/source/signals.c
deleted file mode 100755
index a1a781e..0000000
--- a/beta/source/signals.c
+++ /dev/null
@@ -1,179 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-void
-sig_alrm (int notUsed)
-{
- alarmed = 1;
- alarm (AIL);
- check_dbtimers (); /* timers :) */
- AIL8 += AIL;
-
-#ifdef ENABLE_QUIZ
- if (quiz_halt == 1)
- {
- AIL13++;
- if (AIL13 >= QUIZ_REPEAT_TIMER)
- {
- AIL13 = 0;
- quiz_halt = 0;
- }
- }
-
- if (quiz_answer == 1 && quiz_halt == 0)
- {
- if (quiz_timer >= QUIZ_TIMER)
- {
- quiz_answer = 0;
- quiz_timer = 0;
- quiz_halt = 1;
- run_quiz_answer ();
- }
- else
- quiz_timer++;
- }
-#endif
-
- if (AIL8 >= SEND_DELAY)
- {
- AIL8 = 0;
- Send ();
- }
- LastInput += AIL;
- if (LastInput >= 500)
- {
- LastInput = 0;
-#ifdef ENABLE_STONED_CHECK
- L088 (BS);
- printf ("\nNo response from %s in 5 mins, reconnecting...\n", BS);
- prepare_bot ();
- register_bot ();
-#endif
- }
- AIL10 += AIL;
- if (AIL10 >= 900)
- { /* 15 mins */
- AIL10 = 0;
- if (MARK_CHANGE == 1)
- {
- MARK_CHANGE = 0;
- save_setup (); /* save settings */
- }
- }
- AIL666 += AIL;
- if (AIL666 >= 60)
- { /* 60 sec timer */
- AIL666 = 0;
- S ("PING :%s\n", BS);
-
- }
- AIL9 += AIL;
- if (AIL9 >= 30)
- {
- AIL9 = 0;
- if (strcasecmp (s_Mynick, Mynick) != 0)
- {
- S ("NICK %s\n", s_Mynick);
- strncpy (Mynick, s_Mynick, sizeof (Mynick));
- snprintf (NICK_COMMA, sizeof (NICK_COMMA), "%s,", Mynick);
- snprintf (COLON_NICK, sizeof (COLON_NICK), "%s:", Mynick);
- snprintf (BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", Mynick);
- }
- }
- if (Sleep_Toggle == 1)
- {
- AIL4 += AIL;
- if (AIL4 >= Sleep_Time)
- {
- Sleep_Toggle = 0;
- AIL4 = 0;
- L089 (sleep_chan);
- }
- }
- AIL2 += AIL;
- AIL3 += AIL;
-#ifdef ENABLE_RANDOM
- Rand_Idle++;
- if (RAND_IDLE <= Rand_Idle)
- {
- Rand_Idle = 0;
- do_random_stuff ();
- get_rand_stuff_time ();
- }
- Rand_Stuff -= AIL;
- if (Rand_Stuff <= 0)
- {
- if (Sleep_Toggle != 1)
- do_random_stuff ();
- get_rand_stuff_time ();
- }
-#endif
-#ifdef ENABLE_CHANNEL
- if (AIL3 >= AUTOTOPIC_TIME)
- {
- AIL3 = 0;
- do_autotopics ();
- }
-#endif
- AIL5 += AIL;
- if (AIL5 >= 600)
- {
- if (ANTI_IDLE)
- S ("PRIVMSG ! :\2\n");
- AIL5 = 0;
- }
- if (AIL2 >= 300)
- {
- AIL2 = 0;
-#ifdef ENABLE_STATUS
- S ("LUSERS\n");
-#endif
- S ("MODE %s %s\n", Mynick, DEFAULT_UMODE);
- S ("JOIN %s\n", CHAN);
- reset_ ();
- save_changes ();
-
- if (PERFORM_TIMER)
- run_perform ();
- }
-}
-
-void
-sig_segv (int notUsed)
-{
- long uptime2 = 0, p = 0;
-
- uptime2 = time (NULL) - uptime;
- printf
- ("ERROR! Aborting program. (SIG_SEGV) Uptime: %d hour%s, %d min%s\n",
- (int) (uptime2 / 3600),
- (uptime2 / 3600 == 1) ? "" : "s",
- (int) ((uptime2 / 60) % 60), ((uptime2 / 60) % 60) == 1 ? "" : "s");
- Snow ("QUIT :Caught SIG_SEGV! Aborting connection. Uptime: %d hour%s, %d min%s\n",
- uptime2 / 3600,
- uptime2 / 3600 == 1 ? "" : "s", (uptime2 / 60) % 60, (uptime2 / 60) % 60 == 1 ? "" : "s");
- db_sleep (2);
- p = getpid ();
- // FIXME: Not sure about this, maybe we can live without the fork, maybe without the kills.
- if (fork () > 0)
- {
- db_log ("error.log", "Caught SIGSEGV.. Sent kill -3 and kill -9...\n");
- kill (p, 3); /* SIGQUIT - terminate process and dump core. */
- kill (p, 9); /* SIGKILL */
- }
- db_sleep (1);
- exit (0);
-}
-
-void
-sig_hup (int notUsed)
-{
- char temp[STRING_LONG];
-
- S ("QUIT :SIGHUP - Restarting %s ...\n", dbVersion);
- snprintf (temp, sizeof (temp), "sleep 2; %s", DARKBOT_BIN);
- system (temp);
- db_sleep (1);
- exit (0);
-}
diff --git a/beta/source/sockets.c b/beta/source/sockets.c
deleted file mode 100755
index 11b0187..0000000
--- a/beta/source/sockets.c
+++ /dev/null
@@ -1,123 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-/**
- * Write a character array to a socket connection.
- * 6/22/00 Dan
- * Method argument now pointer to const data.
- */
-int
-writeln (const char *b)
-{
- return (write (socketfd, b, strlen (b)) < 0) ? 0 : 1;
-}
-
-int
-readln (void)
-{
- char ch = 0;
- int i = 0;
-
- do
- {
- if (read (socketfd, &ch, 1) < 1)
- return 0;
- if (ch >= 32 || ch <= 126)
- if (i < 524 - 1)
- L[i++] = ch;
- }
- while (ch != '\n');
- L[i] = '\0';
- return 1;
-}
-
-/**
- * 6/23/00 Dan
- * - Changed method argument to be pointer to const data
- * - Initialized variables when declared
- * - Changed b to a power of 2
- */
-void
-S (const char *format, ...)
-{
- va_list arglist;
- char b[STRING_LONG] = { 0 };
- struct sendq *n = 0;
-
- va_start (arglist, format);
- vsprintf (b, format, arglist);
- va_end (arglist);
-
- if (send_tog == 0)
- {
- send_tog = 1;
- if (DebuG == 1)
- {
- printf ("OUT: %s", b);
- }
- writeln (b);
- return;
- }
-
- n = malloc (sizeof (struct sendq));
- if (n == NULL)
- {
- db_log ("error.log", "AHH! no ram left! in S!\n");
- return;
- }
-
- memset (n, 0, sizeof (struct sendq));
- strncpy (n->data, b, sizeof (n->data));
-
- if (sendqhead == NULL)
- {
- sendqhead = sendqtail = n;
- }
- else
- {
- sendqtail->next = n;
- sendqtail = sendqtail->next;
- }
-}
-
-/**
- * 6/23/00 Dan
- * - Changed method argument to be pointer to const data
- * - Initialized b
- */
-int
-Snow (const char *format, ...)
-{
- va_list arglist;
- char b[STRING_LONG] = { 0 };
-
- va_start (arglist, format);
- vsprintf (b, format, arglist);
- va_end (arglist);
- if (DebuG == 1)
- printf ("OUT: %s", b);
- return (writeln (b));
-}
-
-int
-Send ()
-{
- struct sendq *c;
- char output[STRING_LONG];
- c = sendqhead;
- get_sendq_count (0);
- if (c == NULL)
- {
- send_tog = 0;
- return -1;
- }
- if (DebuG == 1)
- printf ("OUT: %s", c->data);
-#ifdef DEBUG2
- db_log ("darkbot_debug.log", "OUT: %s", c->data);
-#endif
- strncpy (output, c->data, sizeof (output));
- del_sendq (0);
- return (writeln (output));
-}
diff --git a/beta/source/stats.c b/beta/source/stats.c
deleted file mode 100755
index 6ea5341..0000000
--- a/beta/source/stats.c
+++ /dev/null
@@ -1,167 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-#ifdef ENABLE_STATS
-void
-get_stats (char *target, char *user)
-{
- struct statslist *c;
- char temp[50] = { 0 };
- char *ptr = NULL;
- long total = 0;
- time_t oldtime = 0;
- time_t added_time = 0;
- time_t last_time = 0;
-
- c = statshead;
-
- if (c)
- oldtime = c->added_time;
-
- while (c)
- {
- if (user == NULL)
- {
- total += c->total;
- if (c->added_time < oldtime)
- oldtime = c->added_time;
- }
- else
- {
- if (strcasecmp (c->nick, user) == 0)
- {
- added_time = c->added_time;
- last_time = c->last_time;
- strncpy (temp, ctime (&added_time), sizeof (temp));
- if ((ptr = strchr (temp, '\n')) != NULL)
- *ptr = '\0';
- S ("PRIVMSG %s :%s has asked %ld questions since %s, %s's last question was asked on %s", target, user, c->total, temp, user, ctime (&last_time));
- return;
- }
- }
- c = c->next;
- }
- if (user)
- {
- S ("PRIVMSG %s :I have no data on %s\n", target, user);
- }
- else
- {
- S ("PRIVMSG %s :There have been %ld questions asked by %ld people, since I began recording on %s", target, total, NUM_USER, ctime (&oldtime));
- }
-}
-
-void
-add_stats (char *nick, char *uh, long total, long added_time, long last_time)
-{
- struct statslist *n, *c;
-
- c = statshead;
- if (strlen (uh) > 399)
- uh[399] = '\0';
-
- while (c)
- {
- if (strcasecmp (c->nick, nick) == 0)
- {
- strncpy (c->uh, uh, sizeof (c->uh));
- c->total++;
- c->last_time = last_time;
- save_changes ();
- return;
- }
- c = c->next;
- }
-
- n = malloc (sizeof (struct statslist));
- if (n == NULL)
- {
- db_log ("error.log", "AHHH! No ram left! in add_stats!\n");
- return;
- }
- NUM_USER++;
- memset (n, 0, sizeof (struct statslist));
- if (n != NULL)
- {
- strncpy (n->nick, nick, sizeof (n->nick));
- strncpy (n->uh, uh, sizeof (n->uh));
- strlwr (n->uh);
- n->total = total;
- n->added_time = added_time;
- n->last_time = last_time;
- n->next = statshead;
- statshead = n;
- }
-
- free (n);
-}
-
-void
-load_stats (void)
-{
- FILE *fp;
- char b[STRING_LONG] = { 0 }, *user_host = NULL;
- char *nick = NULL, *w_total = NULL, *w_added_time = NULL, *w_last_time = NULL;
- long last_time = 0, added_time = 0, i = 0, total = 0;
-
- if ((fp = fopen (STATS_FILE, "r")) == NULL)
- {
- if ((fp = fopen (STATS_FILE, "w")) == NULL)
- {
- printf ("Unable to create %s!\n", STATS_FILE);
- exit (0);
- }
- fclose (fp);
- return;
- }
- while (fgets (b, STRING_LONG, fp))
- {
- if (b == NULL)
- continue;
- stripline (b);
- if (*b == '/')
- continue;
- i++;
- printf (".");
- fflush (stdout);
- nick = strtok (b, " ");
- if (nick == NULL)
- continue;
- user_host = strtok (NULL, " ");
- if (user_host == NULL)
- continue;
- w_total = strtok (NULL, " ");
- if (w_total == NULL)
- continue;
- w_added_time = strtok (NULL, " ");
- if (w_added_time == NULL)
- continue;
- w_last_time = strtok (NULL, "");
- if (w_last_time == NULL)
- continue;
- if (w_total != NULL)
- total = atoi (w_total);
- else
- total = 0;
- if (w_added_time != NULL)
- added_time = atoi (w_added_time);
- else
- added_time = 0;
- if (w_added_time != NULL)
- last_time = atoi (w_last_time);
- else
- last_time = 0;
- if (DebuG == 1)
- printf
- ("loading statslist: %s %s total:%ld add:%ld last:%ld\n",
- nick, user_host, total, added_time, last_time);
- add_stats (nick, user_host, total, added_time, last_time);
- }
- printf ("done(%d), ", (int) i);
- fclose (fp);
- save_changes ();
- if (DebuG == 1)
- db_sleep (2);
-}
-#endif
diff --git a/beta/source/topics.c b/beta/source/topics.c
deleted file mode 100755
index def37c1..0000000
--- a/beta/source/topics.c
+++ /dev/null
@@ -1,176 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-/**
- * Remove the autotopic for a particular channel.
- * 6/23/00 Dan:
- * - Method argument is now pointer to const data
- * - All variables are now initialized when declared
- * - Changed size of b to be power of 2
- * - Changed variable types of toggle and x in accordance
- * with their use
- */
-void
-del_autotopic (const char *chan)
-{
- FILE *fp;
- char b[STRING_LONG] = { 0 }, *r_chan = 0, *r_data = 0;
- bool toggle = false;
- size_t x = 0;
-
- remove (TMP_FILE);
- fp = fopen (AUTOTOPIC_F, "r");
- if (NULL == fp)
- {
- return;
- }
-
- while (fgets (b, STRING_LONG, fp))
- {
- x++;
- stripline (b);
-
- r_chan = strtok (b, " ");
- r_data = strtok (NULL, "");
-
- if (strcasecmp (r_chan, chan) == 0)
- {
- /* Found the channel */
- toggle = true;
- }
- else
- {
- db_log (TMP_FILE, "%s %s\n", r_chan, r_data);
- }
- }
-
- fclose (fp);
- if (x == 1 && toggle)
- {
- /* The autotopic file is now empty */
- remove (AUTOTOPIC_F);
- remove (TMP_FILE);
- return;
- }
-
- if (toggle)
- {
- /* We found the topic, change the temp file to the
- * the name of the autotopic file */
- rename (TMP_FILE, AUTOTOPIC_F);
- }
- else
- {
- /* We were unable to find the channel, just
- * return */
- remove (TMP_FILE);
- }
-}
-
-void
-do_autotopics (void)
-{
- FILE *fp;
- char b[STRING_LONG] = { 0 }, *r_chan = NULL, *r_data = NULL;
-
- if ((fp = fopen (AUTOTOPIC_F, "r")) == NULL)
- return;
- while (fgets (b, STRING_LONG, fp))
- {
- stripline (b);
- r_chan = strtok (b, " ");
- r_data = strtok (NULL, "");
- if (*r_data != '0')
- {
- db_sleep (1);
- S ("TOPIC %s :%s\n", r_chan, r_data);
- }
- }
- fclose (fp);
-}
-
-long
-ifexist_autotopic (char *chan)
-{
- FILE *fp;
- char b[STRING_LONG] = { 0 }, *r_chan = NULL;
-
- if ((fp = fopen (AUTOTOPIC_F, "r")) == NULL)
- return -1;
- while (fgets (b, STRING_LONG, fp))
- {
- stripline (b);
- if (*b == '/')
- continue;
- r_chan = strtok (b, " ");
- if (strcasecmp (r_chan, chan) == 0)
- {
- fclose (fp);
- return 1; /* exists */
- }
- }
- fclose (fp);
- return 0; /* doesn't exist */
-}
-
-void
-set_autotopic (char *source, char *target, char *topic)
-{
- long exist = 0;
-
- exist = ifexist_autotopic (target);
- if (exist == 0 && *topic == '0')
- { /* never existed, lets humor
- * the guy */
- L007 (source, target);
- return;
- }
- else if (exist == 1 && *topic == '0')
- { /* delete it! */
- L008 (source, target);
- S ("TOPIC %s :\n", target);
- del_autotopic (target);
- return;
- }
-
- if (strlen (topic) >= 400) /* make sure no overflow */
- topic[400] = '\0';
- if (exist == 0)
- { /* no such autotopic, so add it */
- L009 (source, target, topic);
- db_log (AUTOTOPIC_F, "%s %s\n", target, topic);
- return;
- }
- /* only thing left is if topic exists and you want to update it */
- del_autotopic (target);
- L010 (source, target, topic);
- S ("TOPIC %s :%s\n", target, topic);
- db_log (AUTOTOPIC_F, "%s %s\n", target, topic);
-}
-
-char *
-revert_topic (char *input)
-{
- char *ptr = NULL, b[STRING_SHORT] = { 0 };
-
- ptr = strtok (input, "+");
-
- snprintf (f_tmp, sizeof (f_tmp), "%s", ptr);
-
- if (ptr != NULL)
- {
- while (ptr != NULL)
- {
- ptr = strtok (NULL, "+");
- if (ptr != NULL)
- {
- snprintf (b, sizeof (b), "%s %s", f_tmp, ptr);
- snprintf (f_tmp, sizeof (f_tmp), "%s", b);
- }
- }
- return f_tmp;
- }
- else
- return f_tmp;
-}
diff --git a/beta/source/url.c b/beta/source/url.c
deleted file mode 100755
index 3452972..0000000
--- a/beta/source/url.c
+++ /dev/null
@@ -1,647 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-int
-check_existing_url (const char *source, char *topic, char *target)
-{
- FILE *fp;
- char b[STRING_LONG] = { 0 }, *subj = NULL;
-
- if ((fp = fopen (URL2, "r")) == NULL)
- {
- L003 (source, URL2);
- return 0;
- }
- while (fgets (b, STRING_LONG, fp))
- {
- stripline (b);
- subj = strtok (b, " ");
- if (strcasecmp (subj, topic) == 0)
- {
- fclose (fp);
- return 1;
- }
- }
- fclose (fp);
- return 0;
-}
-
-void
-find_url (const char *nick, char *topic, char *target)
-{
- FILE *fp = NULL;
- long i = 0, FOUND = 0, x = 0;
- char b [STRING_LONG] = {0}, DATA [STRING_SHORT] = {0};
- char *subj = NULL, *ptr2 = NULL;
-
- if (strlen (topic) > MAX_TOPIC_SIZE)
- topic[MAX_TOPIC_SIZE] = '\0';
-
- strlwr (topic);
-
- if ((fp = fopen (URL2, "r")) == NULL)
- {
- L003 (nick, URL2);
- return;
- }
-
- while (fgets (b, STRING_LONG, fp))
- {
- x++;
-
- if (*b == '\n')
- continue; /* Just pass over empty lines */
-
- stripline (b);
-
- subj = strtok (b, " ");
- strlwr (subj);
- ptr2 = strstr (subj, topic);
-
- if (ptr2 != NULL)
- {
- i++;
- FOUND = 1;
- sprintf (DATA, "%s %s", DATA, subj);
- if (strlen (DATA) >= MAX_SEARCH_LENGTH)
- break;
- }
- }
-
- fclose (fp);
-
- if (FOUND == 0)
- {
- L021 (target, NO_TOPIC, topic, x);
- }
- else if (i > 19)
- {
- L022 (target, i, DATA);
- }
- else if (i == 1)
- {
- L023 (target, nick, DATA);
- }
- else
- L024 (target, i, nick, DATA);
-}
-
-void
-display_url (char *target, char *nick, char *topic)
-{
- FILE *fp;
- long x = 0;
- char b[STRING_LONG] = { 0 }, *subj = NULL, *ptr = NULL;
-
- strlwr (topic);
- if ((fp = fopen (URL2, "r")) == NULL)
- {
- S ("%s %s :%s, there was an error displaying data for \"%s\".\n",
- (target == nick) ? "notice" : "privmsg", target,
- nick, topic);
- return;
- }
- while (fgets (b, STRING_LONG, fp))
- {
- x++;
- stripline (b);
- subj = strtok (b, " ");
- ptr = strtok (NULL, "");
- if (strcasecmp (subj, topic) == 0 || !match_wild (subj, topic) == 0)
- {
- QUESTIONS++;
- S ("PRIVMSG %s :Raw data for %s is: %s\n", target, topic, ptr);
- fclose (fp);
- return;
- } /* Subject match */
- }
- fclose (fp);
- S ("PRIVMSG %s :%s, I do not know of any topic named %s\n", target, nick, topic);
-}
-
-void
-delete_url (const char *nick, char *topic, char *target)
-{
- FILE *fp = 0;
- size_t i = 0;
- size_t FOUND = 0;
- char b [STRING_LONG] = { 0 };
- char DATA [STRING_SHORT] = { 0 };
- char *subj = NULL;
- char *ptr = NULL;
-
- if (*topic == '~')
- {
- topic++;
- if (topic != NULL)
- strlwr (topic);
- snprintf (DATA, sizeof (DATA), "%s/%s.rdb", RDB_DIR, topic);
- if (strspn (topic, LEGAL_TEXT) != strlen (topic))
- {
- if (strcasecmp (nick, target) == 0)
- S ("NOTICE %s :%s, rdb files are made up of letters and or numbers, no other text is accepted.\n", nick, nick);
- else
- S ("PRIVMSG %s :%s, rdb files are made up of letters and or numbers, no other text is accepted.\n", target, nick);
- return;
- }
-
- if ((fp = fopen (DATA, "r")) == NULL)
- {
- if (strcasecmp (nick, target) == 0)
- S ("NOTICE %s :%s, %s.rdb does not exist.\n", nick, nick, topic);
- else
- S ("PRIVMSG %s :%s, %s.rdb does not exist.\n", target, nick, topic);
- return;
- }
-
- fclose (fp);
- remove(DATA);
-
- if (strcasecmp (nick, target) == 0)
- S ("NOTICE %s :I have unlinked %s.\n", nick, DATA);
- else
- S ("PRIVMSG %s :I have unlinked %s.\n", target, DATA);
- return;
- }
-
- if ((fp = fopen (TMP_URL, "w")) == NULL) /* fixes the 'must have at least 1 topic' problem. */
- {
- L003 (nick, TMP_URL);
- return;
- }
-
- fclose (fp);
-
- if ((fp = fopen (URL2, "r")) == NULL)
- {
- L003 (nick, URL2);
- return;
- }
-
- while (fgets (b, STRING_LONG, fp))
- {
- stripline (b);
- subj = strtok (b, " ");
- ptr = strtok (NULL, "");
- i++;
- if (strcasecmp (subj, topic) == 0)
- {
- FOUND = 1;
- DELETIONS++;
- if (strcasecmp (nick, target) == 0)
- L029n (nick, nick, i, topic);
- else
- L029 (target, nick, i, topic);
- }
- else if (strstr (subj, " ") == NULL)
- db_log (TMP_URL, "%s %s\n", subj, ptr);
- }
-
- fclose (fp);
-
- remove(URL2);
- rename(TMP_URL, URL2);
-
- if (FOUND == 0)
- {
- if (strcasecmp (nick, target) == 0)
- L030n (nick, nick, topic);
- else
- L030 (target, nick, topic);
- }
-}
-
-
-
-void
-show_url (char *nick, char *topic, char *target, long donno, long floodpro, char *uh, long no_pipe)
-{
- FILE *fp;
- long x = 0, length = 0, toggle = 0, A = 0, gotit = 0, D = 0, F = 0, Tog = 0;
- char b[STRING_LONG] = { 0 }, *subj = NULL, *ptr = NULL;
- char temp[STRING_LONG] = { 0 };
- char Data[STRING_LONG] = { 0 }, *ptr8 = NULL;
- char crm1[STRING_LONG] = { 0 };
- char crm2[STRING_LONG] = { 0 }, bFirst = 1;
-
- strlwr (topic);
-
- /* removes the question mark */
- if ((ptr = strchr (topic, '?')) != NULL)
- memmove (ptr, ptr + 1, strlen (ptr + 1) + 1);
-
- if ((fp = fopen (URL2, "r")) == NULL)
- {
- if (donno == 1)
- L003 (nick, URL2);
- return;
- }
- while (fgets (b, STRING_LONG, fp))
- {
- x++;
- stripline (b);
- subj = strtok (b, " ");
- if (subj == NULL)
- continue;
- ptr = strtok (NULL, "");
- if (ptr == NULL)
- continue;
- if (strcasecmp (subj, topic) == 0 || !match_wild (subj, topic) == 0)
- {
- QUESTIONS++;
- if (floodpro == 1)
- if (cf (uh, nick, nick))
- {
- fclose (fp);
- return;
- }
- gotit = 1;
- if (*ptr == '+')
- {
- ptr++;
- A = 1;
- }
- else if (*ptr == '-')
- {
- if (strstr (nick, "|") != NULL)
- return;
- if (no_pipe == 1)
- {
- fclose (fp);
- return;
- }
- ptr++;
- D = 1;
- }
- else if (*ptr == '~')
- {
- ptr++;
- fclose (fp);
- do_randomtopic (NORMALR, target, ptr, nick, topic);
- return;
- }
- length = strlen (ptr);
- if (length > 3)
- {
- if (ptr[0] == 'i' && ptr[1] == 'l' && ptr[2] == 'c')
- {
- toggle++;
- }
- }
- while (length > 0)
- {
- length--;
- if (Tog == 1)
- {
- Tog = 0;
- if (ptr[length] == 'N')
- { /* nick */
- toggle++;
- snprintf (temp, sizeof (temp), "%s%s", nick, Data);
- }
- else if (ptr[length] == 'C')
- { /* chan */
- toggle++;
- snprintf (temp, sizeof (temp), "%s%s", target, Data);
- }
- else if (ptr[length] == '1'
- || ptr[length] == '2'
- || ptr[length] == '3'
- || ptr[length] == '4'
- || ptr[length] == '5'
- || ptr[length] == '6'
- || ptr[length] == '7' || ptr[length] == '8' || ptr[length] == '9')
- {
- toggle++;
- /* The first time around, we just store the topic in a
- "safe place" */
- if (bFirst == 1)
- {
- strncpy (crm1, topic, sizeof (crm1));
- bFirst = 0;
- }
- /* Each time around, get a new copy from the "safe place." */
- strncpy (crm2, crm1, sizeof (crm2));
- snprintf (temp, sizeof (temp), "%s%s", get_word (ptr[length], crm2, "+"), Data);
- }
- else if (ptr[length] == 'H')
- { /* u@h of user */
- toggle++;
- snprintf (temp, sizeof (temp), "%s%s", uh, Data);
- }
- else if (ptr[length] == 'h')
- { /* u@h (no ident) */
- toggle++;
- if (*uh == '~')
- {
- uh++;
- }
- snprintf (temp, sizeof (temp), "%s%s", uh, Data);
- }
- else if (ptr[length] == 'T')
- { /* time */
- toggle++;
- snprintf (temp, sizeof (temp), "%s%s", date (), Data);
- }
- else if (ptr[length] == 't')
- { /* unixtime */
- toggle++;
- snprintf (temp, sizeof (temp), "%ld%s", (long)time (NULL), Data);
- }
- else if (ptr[length] == 'W')
- { /* WWW page */
- toggle++;
- snprintf (temp, sizeof (temp), "http://freezedown.org%s", Data);
- }
- else if (ptr[length] == 'S')
- { /* server */
- toggle++;
- snprintf (temp, sizeof (temp), "%s%s", BS, Data);
- }
- else if (ptr[length] == 'R')
- { /* rand */
- toggle++;
- /* The first time around, we just store the topic in a
- "safe place" */
- if (bFirst == 1)
- {
- strncpy (crm1, topic, sizeof (crm1));
- bFirst = 0;
- }
- // Don't do random nicknames if the target isn't a channel!!
- snprintf (temp, sizeof (temp), "%s%s",
- ((*target != '#') ? "R~" : get_rand_nick (target)),
- Data);
-
- }
- else if (ptr[length] == 'P')
- { /* port */
- toggle++;
- snprintf (temp, sizeof (temp), "%ld%s", BP, Data);
- }
- else if (ptr[length] == 'Q')
- { /* question */
- toggle++;
- snprintf (temp, sizeof (temp), "%s%s", revert_topic (topic), Data);
- }
- else if (ptr[length] == 'V')
- { /* version */
- toggle++;
- snprintf (temp, sizeof (temp), "%s%s", dbVersion, Data);
- }
- else if (ptr[length] == '!')
- { /* cmdchar */
- toggle++;
- snprintf (temp, sizeof (temp), "%c%s", *CMDCHAR, Data);
- }
- else if (ptr[length] == 'B')
- { /* mynick */
- toggle++;
- snprintf (temp, sizeof (temp), "%s%s", Mynick, Data);
- }
- else
- snprintf (temp, sizeof (temp), "%c~%s", ptr[length], Data);
- }
- else if (ptr[length] == '~')
- {
- Tog = 1;
- }
- else
- snprintf (temp, sizeof (temp), "%c%s", ptr[length], Data);
- strncpy (Data, temp, sizeof (Data));
- } /* While */
- if (D == 1)
- {
- ptr8 = strtok (Data, "|");
- while (ptr8 != NULL)
- {
- if (ptr8[0] == ' ')
- ptr8++;
- if (ptr8[0] == 'B' && ptr8[1] == 'A' && ptr8[2] == 'N')
- { /* ban user */
- S ("MODE %s +b *%s\n", target, uh);
- }
- if (ptr8[0] == 'T' && ptr8[1] == 'E' && ptr8[2] == 'M' &&
- ptr8[3] == 'P' && ptr8[4] == 'B' && ptr8[5] == 'A' && ptr8[6] == 'N')
- { /* temp ban user for 60 sec */
- S ("MODE %s +b *%s\n", target, uh);
- snprintf (temp, sizeof (temp), "%s/%ld", DBTIMERS_PATH, (long)time (NULL) + 60);
- db_log (temp, "MODE %s -b *%s\n", target, uh);
- }
- ptr8[0] = tolower (ptr8[0]);
- ptr8[1] = tolower (ptr8[1]);
- if (ptr8[0] == 'p' && ptr8[1] == 'r')
- F = 1;
- if (ptr8[0] == 'k' && ptr8[1] == 'i' && !is_op(nick, target))
- F = 1;
- if (ptr8[0] == 'n' && ptr8[1] == 'o')
- F = 1;
- if (ptr8[0] == 't' && ptr8[1] == 'o')
- F = 1;
- if (F == 1)
- S ("%s\n", ptr8);
- F = 0;
- ptr8 = strtok (NULL, "|");
- }
- fclose (fp);
- return;
- }
- if (toggle == 0)
- {
-#ifdef ENABLE_STATS
- add_stats (nick, uh, 1, time (NULL), time (NULL));
-#endif
- if (A == 0)
- {
- if ((*target == '#') || (*target == '+') || (*target == '&'))
- S ("PRIVMSG %s :%s%s\n", target, rand_reply (nick), Data);
- else
- {
- S ("NOTICE %s :%s%s\n", target, rand_reply(target), temp, Data);
- }
- }
- else if ((*target == '#') || (*target == '+') || (*target == '&'))
- S ("PRIVMSG %s :\1ACTION %s\1\n", target, Data);
- else
- {
- S ("NOTICE %s :%s%s\n", target, rand_reply(target), Data);
- }
- }
- else if (A == 0)
- {
-#ifdef ENABLE_STATS
- add_stats (nick, uh, 1, time (NULL), time (NULL));
-#endif
- if ((*target == '#') || (*target == '+') || (*target == '&'))
- S ("PRIVMSG %s :%s\n", target, Data);
- else
- {
- S ("NOTICE %s :%s\n", target, Data);
- }
- }
- else if ((*target == '#') || (*target == '+') || (*target == '&'))
- {
-#ifdef ENABLE_STATS
- add_stats (nick, uh, 1, time (NULL), time (NULL));
-#endif
- S ("PRIVMSG %s :\1ACTION %s\1\n", target, Data);
- }
- else if (MSG_RESPONSES)
- {
-#ifdef ENABLE_STATS
- add_stats (nick, uh, 1, time (NULL), time (NULL));
-#endif
- S ("NOTICE %s :%s\n", target, Data);
- }
- fclose (fp);
- return;
- } /* Subject match */
- }
- fclose (fp);
- if (donno == 1)
- {
- if (strlen (topic) > 3)
- {
- strlwr (topic);
- if (topic[0] == 'i' && topic[1] == 'l' && topic[2] == 'c')
- {
- if ((*target == '#') || (*target == '+') || (*target == '&'))
- S ("PRIVMSG %s :%s, I found no matching ILC for that channel.\n", target, nick);
- return;
- }
- }
- if ((*target == '#') || (*target == '+') || (*target == '&'))
- {
- if (RANDOM_DUNNO == true)
- do_randomtopic (DUNNOR, target, DUNNO_FILE, nick, topic);
- else
- S ("PRIVMSG %s :%s, %s\n", target, nick, DUNNO_Q);
- }
- else
- S ("NOTICE %s :%s, %s\n", nick, nick, DUNNO_Q);
- }
-}
-
-char *
-get_multiword_topic (char *first)
-{
- char *tmp2 = NULL;
-
- tmp2 = strtok (NULL, " ");
- if (tmp2 != NULL)
- {
- sprintf (f_tmp, "%s", first);
- while (tmp2 != NULL)
- {
- sprintf (f_tmp, "%s+%s", f_tmp, tmp2);
- tmp2 = strtok (NULL, " ");
- }
- return f_tmp;
- }
- else
- return first;
-}
-
-void
-datasearch (const char *nick, char *topic, char *target)
-{
- FILE *fp = NULL;
- size_t i = 0, FOUND = 0, x = 0;
- char b[STRING_LONG] = { 0 }, *dorf = NULL, *subj = NULL, *ptr2 = NULL, DATA[STRING_SHORT] =
- {
- 0};
-
- /* Make sure topic is not NULL.*/
- if (topic == NULL)
- {
- return;
- }
-
- if (strlen (topic) > MAX_TOPIC_SIZE)
- topic[MAX_TOPIC_SIZE] = '\0';
-
- strlwr (topic);
-
- if ((fp = fopen (URL2, "r")) == NULL)
- {
- L003 (nick, URL2);
- return;
- }
- while (fgets (b, STRING_LONG, fp))
- {
- x++;
-
- if (*b == '\n')
- continue; /* Just pass over blank lines */
-
- stripline (b);
- strlwr (b);
-
- subj = strtok (b, " ");
- dorf = strtok (NULL, "");
- ptr2 = strstr (dorf, topic);
- if (ptr2 != NULL)
- {
- i++;
- FOUND = 1;
- sprintf (DATA, "%s %s", DATA, subj);
- if (strlen (DATA) >= MAX_SEARCH_LENGTH)
- break;
- }
- }
- fclose (fp);
- if (FOUND == 0)
- {
- L021 (target, NO_TOPIC, topic, x);
- }
- else if (i > 19)
- {
- L022 (target, i, DATA);
- }
- else if (i == 1)
- {
- L023 (target, nick, DATA);
- }
- else
- L024 (target, i, nick, DATA);
-}
-
-char *
-get_word (long number, char *string, char *seperator)
-{ /* gets a specific word requested */
- long i = 0;
- char *ptr = NULL;
-
- number = number - 49;
-
- ptr = strtok (string, "+");
-
- strncpy (f_tmp, ptr, sizeof (f_tmp));
- if (ptr != NULL)
- {
- while (ptr != NULL)
- {
- i++; /* word number */
- ptr = strtok (NULL, seperator);
- if (ptr != NULL)
- {
- if (i == number)
- {
- snprintf (f_tmp, sizeof (f_tmp), "%s", ptr);
- return f_tmp;
- }
- }
- }
- return f_tmp;
- }
- else
- { /* only one word */
- if (number == 1)
- {
- return f_tmp;
- }
- else
- return ""; /* no match */
- }
-}
diff --git a/beta/source/users.c b/beta/source/users.c
deleted file mode 100755
index f61f48e..0000000
--- a/beta/source/users.c
+++ /dev/null
@@ -1,269 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-void
-scan_chan_users (char *chan, char *nick, char *banned)
-{
- struct userlist *c;
-
- c = userhead;
- if (banned[0] == '*' && banned[1] == '!' && banned[2] == '*' && banned[3] == '\0')
- {
- S ("MODE %s -ob %s %s\n", chan, nick, banned);
- return;
- }
-#ifdef ENABLE_CHANNEL
- if (KICK_ON_BAN)
- {
- while (c)
- {
- if (!match_wild (banned, c->uh) == 0)
- {
- if (strcasecmp (c->nick, Mynick) != 0)
- {
- S ("KICK %s %s :BANNED\n", chan, c->nick);
- }
- else
- {
- S ("MODE %s -ob %s %s\n", chan, nick, banned);
- return;
- }
- }
- c = c->next;
- }
- }
-#endif
-}
-
-void
-delete_user (const char *nick, char *chan)
-{
- struct userlist *pNode, *pPrev;
-
- pNode = userhead;
- pPrev = NULL;
-
- while (pNode)
- {
- if (strcasecmp (pNode->nick, nick) == 0 && strcasecmp (pNode->chan, chan) == 0)
- {
- save_seen (pNode->nick, pNode->uh, pNode->chan);
- if (pPrev != NULL)
- {
- pPrev->next = pNode->next;
- }
- else
- {
- userhead = pNode->next;
- }
- free (pNode);
- pNode = NULL;
- break;
- }
- pPrev = pNode;
- pNode = pNode->next;
- }
-}
-
-void
-add_user (char *chan, char *nick, char *uh, long tog)
-{
- /* toggle of 0 means to unidle the client */
- struct userlist *n, *c;
-
- c = userhead;
- if (strlen (uh) > 399)
- uh[399] = '\0';
- while (c)
- { /* don't readd data that already exists */
- if (tog == 0)
- {
- if (strcasecmp (c->nick, nick) == 0 && strcasecmp (c->chan, chan) == 0)
- {
- c->idle = time (NULL);
- }
- }
- if (tog == 1)
- {
- if (strcasecmp (c->nick, nick) == 0 && strcasecmp (c->chan, chan) == 0)
- {
- /* If user is somehow already here, just update his data instead
- of readding */
- strncpy (c->chan, chan, sizeof (c->chan));
- strncpy (c->uh, uh, sizeof (c->uh));
- strlwr (c->uh);
- strncpy (c->nick, nick, sizeof (c->nick));
- c->idle = time (NULL);
- c->level = 0;
- return;
- }
- }
- c = c->next;
- }
- if (tog == 0)
- {
- /* all we wanted to do was unidle, so we can quit now */
- return;
- }
- n = malloc (sizeof (struct userlist));
- if (n == NULL)
- {
- db_log ("error.log", "AHHH! No ram left! in add_user!\n");
- return;
- }
- memset (n, 0, sizeof (struct userlist));
- if (n != NULL)
- {
- strncpy (n->chan, chan, sizeof (n->chan));
- strncpy (n->uh, uh, sizeof (n->uh));
- strlwr (n->uh);
- strncpy (n->nick, nick, sizeof (n->nick));
- n->idle = time (NULL);
- n->level = 0;
-
- n->next = userhead;
- userhead = n;
- }
-}
-
-void
-delete_user_ram (char *source, char *uh)
-{
- struct helperlist *pNode, *pPrev;
-
- pNode = helperhead;
- pPrev = NULL;
- while (pNode)
- {
- if (strcasecmp (pNode->uh, uh) == 0)
- {
- L015 (source, pNode->uh, pNode->level, pNode->num_join);
- if (pPrev != NULL)
- {
- pPrev->next = pNode->next;
- }
- else
- helperhead = pNode->next;
- free (pNode);
- pNode = NULL;
- break;
- }
- pPrev = pNode;
- pNode = pNode->next;
- }
- save_changes ();
-}
-
-char *mask_from_userhost (char *uh)
-{
- char *ptr1 = NULL;
- char *ptr2 = NULL;
- char *user = NULL;
- char *host = NULL;
- char userhost [STRING_LONG] = {0};
- size_t nParts = 0;
-
- if (userhost == NULL)
- return(" ");
-
- strcpy (userhost, mask_tmp);
-
- if ((user = strtok (userhost, "@")) == NULL)
- return (" ");
-
- // Strip off any tilde on the username.
- if (*user == '~')
- user++;
-
- // Hostname
- host = strtok (NULL, " ");
-
- // If there are less than three parts to this hostname, return
- // the full hostname.
- if ((nParts = count_char (host, '.')) < 3)
- {
- snprintf (mask_tmp, sizeof (mask_tmp), "*%s@%s", user, host);
- return (mask_tmp);
- }
-
- // If the host is composed entirely of numbers and dots, assume
- // it is a numeric IP. Parse that accordingly (203.203.203.*)
- if (strspn (host, "1234567890.") == strlen (host))
- {
- reverse (host);
- ptr1 = strtok (host, ".");
- ptr1 = strtok (NULL, " ");
- reverse (ptr1);
- snprintf (mask_tmp, sizeof (mask_tmp), "*%s@%s.*", user, ptr1);
- return (mask_tmp);
- }
-
- // It has to be an actual hostname now, so let's parse it.
- reverse (host);
- ptr2 = strtok (host, ".");
- ptr1 = strtok (NULL, ".");
- reverse (ptr2);
- reverse (ptr1);
- snprintf (mask_tmp, sizeof (mask_tmp), "*%s@*.%s.%s", user, ptr1, ptr2);
- return (mask_tmp);
-}
-
-long is_op(char *who, const char *chan)
-{
- const struct userlist *c = userhead;
- for (; c != NULL; c = c->next)
- {
- if (!strcasecmp (who, c->nick) && !strcasecmp (chan, c->chan))
- {
- return (c->flags & FLAG_CHANOP);
- }
- }
- return (0);
-}
-
-void
-do_op(char *who, const char *chan, long tog)
-{
- struct userlist *c = userhead;
- for (; c != NULL; c = c->next)
- {
- if (!strcasecmp (who, c->nick) && !strcasecmp (chan, c->chan))
- {
- if (tog == 1)
- c->flags |= FLAG_CHANOP;
- else
- c->flags &= ~FLAG_CHANOP;
- }
- }
- return;
-}
-
-char *uh_from_nick (char *who, const char *chan)
-{
- const struct userlist *c = userhead;
- for (; c != NULL; c = c->next)
- {
- if (!strcasecmp (who, c->nick) && !strcasecmp (chan, "#*"))
- {
- strcpy (mask_tmp, c->uh);
- return (mask_tmp);
- }
-
- if (!strcasecmp (who, c->nick) && !strcasecmp (chan, c->chan))
- {
- strcpy (mask_tmp, c->uh);
- return (mask_tmp);
- }
- }
- return (0);
-}
-
-char *mask_from_nick (char *who, const char *chan)
-{
- char *s;
-
- if ((s = uh_from_nick(who, chan)) == NULL)
- return (who);
- return (mask_from_userhost (s));
-}
diff --git a/beta/source/vars.c b/beta/source/vars.c
deleted file mode 100755
index 019295a..0000000
--- a/beta/source/vars.c
+++ /dev/null
@@ -1,468 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-int wsock = 0;
-int sockerr = 0;
-int optlen = sizeof(sockerr);
-size_t nRandStuffs = 0;
-long QUESTIONS = 0;
-long ADDITIONS = 0;
-long DELETIONS = 0;
-long uptime = 0;
-long NO_FLOOD = 0;
-long NUM_SERV = 0;
-long L_CLIENTS = 0;
-long IRCOPS = 0;
-long xtried = 0;
-long G_USERS = 0;
-long rt = 120;
-long fc = 0;
-long spr = 0;
-long snr = 0;
-long BP = 6667;
-long CHECKED = 1;
-long SEND_DELAY = 1;
-long send_tog = 0;
-long NUM_HELPER = 0;
-long NUMLINESSEEN = 0;
-long NUM_USER = 0;
-#ifdef ENABLE_QUIZ
-long quiz_timer = 0;
-long quiz_line = 0;
-bool quiz_answer = 0;
-bool quiz_halt = 0;
-char quiz_target[STRING_SHORT] = { 0 };
-long recent_questions[10] = { 0 };
-#endif
-
-#ifdef ENABLE_RANDOM
-long Rand_Stuff = 0;
-long Rand_Idle = 0;
-#endif
-long AIL4 = 0;
-long Sleep_Toggle = 0;
-long Sleep_Time = 0;
-long AIL3 = 0;
-long AIL2 = 0;
-long AIL5 = 0;
-long JOINs = 0;
-long PERMBAN_counter = 0;
-long ram_load_time = 0;
-long AIL9 = 0;
-long AIL666 = 0;
-long AIL8 = 0;
-#ifdef ENABLE_QUIZ
-long AIL13 = 0;
-#endif
-long LastInput = 0;
-long AIL10 = 0;
-long MARK_CHANGE = 0;
-long html_counter = 0;
-char NICK_COMMA[32] = { 0 };
-char COLON_NICK[33] = { 0 };
-char pass_data[512] = { 0 };
-char pass_pass[STRING_SHORT] = { 0 };
-char rword[STRING_SHORT] = { 0 };
-char lc1[STRING_SHORT] = "0";
-char lc2[STRING_SHORT] = "0";
-char lc4[STRING_SHORT] = "0";
-char lc3[STRING_SHORT] = "0";
-char BPASS[STRING_SHORT] = "0";
-char mask_tmp[STRING_LONG] = "0";
-long lcn1 = 0;
-long lcn2 = 0;
-long lcn4 = 0;
-long lcn3 = 0;
-bool SeeN = false;
-long DebuG = 0;
-char slc1[STRING_SHORT] = "0";
-char slc2[STRING_SHORT] = "0";
-char slc4[STRING_SHORT] = "0";
-char slc3[STRING_SHORT] = "0";
-long slcn1 = 0;
-long slcn2 = 0;
-long slcn4 = 0;
-long slcn3 = 0;
-
-#ifdef WIN32
-char *rp391 = "niW-4cr8 tobkraD";
-#else
-char *rp391 = "4cr8 tobkraD";
-#endif
-char BCOLON_NICK[STRING_SHORT] = { 0 };
-char DARKBOT_BIN[STRING_SHORT] = { 0 };
-char URL2[STRING_SHORT] = { 0 };
-char DBTIMERS_PATH[STRING_SHORT] = { 0 };
-char LOG_DIR[STRING_SHORT] = { 0 };
-char RDB_DIR[STRING_SHORT] = { 0 };
-#ifdef ENABLE_STATS
-char STATS_FILE[STRING_SHORT] = { 0 };
-#endif
-char SEEN_FILE[STRING_SHORT] = { 0 };
-char BACKUP_DUP[STRING_SHORT] = { 0 };
-char ADD_DELETES[STRING_SHORT] = { 0 };
-char AUTOTOPIC_F[STRING_SHORT] = { 0 };
-char HELPER_LIST[STRING_SHORT] = { 0 };
-char QUIZ_FILE[STRING_SHORT] = { 0 };
-char PERFORM[STRING_SHORT] = { 0 };
-char DEOP[STRING_SHORT] = { 0 };
-char RAND_SAY[STRING_SHORT] = { 0 };
-char RAND_FILE[STRING_SHORT] = { 0 };
-char RANDQ_TEMPFILE[STRING_SHORT] = { 0 };
-char RAND_BACKUP_FILE[STRING_SHORT] = { 0 };
-char SERVERS[STRING_SHORT] = { 0 };
-char PERMBAN[STRING_SHORT] = { 0 };
-char SETUP[STRING_SHORT] = { 0 };
-char DAT_DIR[STRING_SHORT] = { 0 };
-char r_reply[STRING_SHORT] = { 0 };
-char data[STRING_SHORT] = { 0 };
-char g_chan[STRING_SHORT] = { 0 };
-char dbVersion[STRING_SHORT] = { 0 };
-char strbuff[STRING_SHORT] = { 0 };
-char f_tmp[STRING_LONG] = { 0 };
-char UID[STRING_SHORT] = "database";
-char BS[STRING_SHORT] = "irc.undernet.org";
-char CMDCHAR[2] = "!";
-char CHAN[STRING_SHORT] = "#darkbot";
-char s_Mynick[STRING_SHORT] = "darkbot";
-char g_host[STRING_SHORT] = { 0 };
-char Mynick[STRING_SHORT] = "darkbot";
-char sleep_chan[STRING_SHORT] = { 0 };
-char VHOST[STRING_SHORT] = "0";
-char REALNAME[STRING_SHORT] = "http://www.freezedown.org";
-char privmsg_log[STRING_SHORT] = { 0 };
-
-long CONNECT_WAIT_TIMEOUT = 10;
-bool PERFORM_TIMER = true;
-char DEFAULT_UMODE[STRING_SHORT] = "+i-ds";
-bool ANTI_IDLE = false;
-bool DISPLAY_SYNC = false;
-
-bool SORT = false;
-bool FIND_DUPS = false;
-bool SAVE_DUPS = true;
-bool GENERAL_QUESTIONS = true;
-//bool ALLOW_ADD_IN_MSG = false;
-//bool ALLOW_DEL_IN_MSG = false;
-bool MSG_RESPONSES = false;
-
-bool LOG_ADD_DELETES = true;
-bool LOG_PRIVMSG = true;
-
-long SLEEP_TIME = 300;
-char GOSLEEP_ACTION[STRING_SHORT] = "\1ACTION falls asleep... ZzzZZzzZZzz\1";
-char WAKEUP_ACTION[STRING_SHORT] = "\1ACTION wakes up from a snooze..\1";
-
-long LASTCOMM_TIME = 5;
-long OUTPUT1_COUNT = 4;
-long OUTPUT1_DELAY = 1;
-long OUTPUT2_COUNT = 6;
-long OUTPUT2_DELAY = 2;
-long OUTPUT3_DELAY = 3;
-long OUTPUT_PURGE_COUNT = 7;
-
-char EXISTING_ENTRY[STRING_SHORT] = "Sorry, there is an existing entry under keyword";
-char NO_ENTRY[STRING_SHORT] = "I was unable to find entry:";
-//char CANT_FIND[STRING_SHORT] = "Was unable to find"; /* ... */
-char NO_TOPIC[STRING_SHORT] = "Sorry, I don't have any entry for"; /* ... */
-char TRY_FIND[STRING_SHORT] = "What am I trying to find";
-char WHUT[STRING_SHORT] = "hmmm?";
-char DUNNO_Q[STRING_SHORT] = "*shrug*";
-bool RANDOM_DUNNO = true;
-bool RANDOM_WHUT = true;
-
-#ifdef ENABLE_RANDOM
-//bool RANDOM_STUFF = true;
-long RAND_STUFF_TIME = 3600;
-long RAND_IDLE = 1800;
-//long RAND_LEVEL = 2;
-//bool RANDQ = true;
-bool BACKUP_RANDOMSTUFF = false;
-#endif
-
-bool JOIN_GREET = true;
-long SLASTCOMM_TIME = 60;
-bool VOICE_USERS_ON_JOIN = false;
-bool OP_USERS_ON_LOGIN = false;
-
-bool DO_WHOIS = false;
-long MAX_LASTSEEN = 604800;
-char SEEN_REPLY[STRING_SHORT] = "in the last 7 days.";
-
-char COMPLAIN_REASON[STRING_SHORT] = "grrr, kick me again and I'm going to...";
-bool BITCH_ABOUT_DEOP = false;
-char BITCH_DEOP_REASON[STRING_SHORT] = "grr, someone op me!";
-
-long AUTOTOPIC_TIME = 1800;
-char DEFAULT_KICK[STRING_SHORT] = "Requested!";
-bool KICK_ON_BAN = false;
-
-bool KICK_ON_CHANNEL_NOTICE = true;
-bool BAN_ON_CHANNEL_NOTICE = false;
-bool BAN_BY_HOST = false;
-
-bool FLOOD_KICK = true;
-char FLOOD_REASON[STRING_SHORT] = "Don't flood!";
-
-#ifdef ENABLE_QUIZ
-long QUIZ_TIMER = 25;
-long QUIZ_REPEAT_TIMER = 20;
-#endif
-
-bool HELP_GREET = false;
-bool AUTOHELP_GUESTS = false;
-
-char mySetinfo[STRING_SHORT] = "My !setinfo variables are: ^ nick, % Number of joins, & \
-Channel, $ user@host. Example: !setinfo ^ has joined & % times!! (also, if \
-you make the first char of your SETINFO a \"+\" the setinfo will be shown \
-as an ACTION)";
-
-char myVariables[STRING_SHORT] = "Data variables are: N~ (Nick), C~ (Chan), T~ \
-(Time/date) B~ (Botnick), Q~ (Question asked), R~ (random nick), !~ \
-(command char), S~ (current Server), P~ (current port) V~ (botVer), W~ \
-(db WWW site), H~ (u@h), t~ (unixtime), BAN (sets a ban), TEMPBAN (bans \
-for 60 sec)";
-
-
-struct rusage r_usage;
-
-struct ignorelist *ignorehead = NULL;
-
-struct sendq *sendqhead = NULL, *sendqtail = NULL;
-
-struct userlist *userhead = NULL;
-
-struct helperlist *helperhead = NULL;
-
-struct permbanlist *permbanhead = NULL;
-
-struct old ood[STRING_SHORT];
-
-struct sl124 *sh124 = NULL;
-
-#ifdef ENABLE_STATS
-struct statslist *statshead = NULL;
-#endif
-
-struct webinfo
- GOOGLE_webinfo = { "GOOGLE", "www.google.com", 80, "/search?q=" } ,
- METAR_webinfo = { "METAR", "weather.noaa.gov", 80, "/cgi-bin/mgetmetar.pl?cccc=" } ,
- TAF_webinfo = { "TAF", "weather.noaa.gov", 80, "/cgi-bin/mgettaf.pl?cccc=" } ,
- WEATHER_webinfo = { "WEATHER", "mobile.wunderground.com", 80, "/cgi-bin/findweather/getForecast?brand=mobile&query=" };
-
-
-struct setup_parameter parameters[] =
-{
-// I managed to eliminate these options when I rewrote chansrv.c.
-// {ST_BOOLEAN, 3, sizeof(ALLOW_ADD_IN_MSG), {"ALLOW_ADD_IN_MSG", NULL, NULL, NULL, NULL}, "allowing ADD command in private", &ALLOW_ADD_IN_MSG, NULL},
-// {ST_BOOLEAN, 3, sizeof(ALLOW_DEL_IN_MSG), {"ALLOW_DEL_IN_MSG", NULL, NULL, NULL, NULL}, "allowing DEL command in private", &ALLOW_DEL_IN_MSG, NULL},
- {ST_BOOLEAN, 3, sizeof(ANTI_IDLE), {"ANTI_IDLE", NULL, NULL, NULL, NULL}, "idling for less than ten minutes", &ANTI_IDLE, NULL},
-#ifdef ENABLE_CHANNEL
- {ST_BOOLEAN, 3, sizeof(BITCH_ABOUT_DEOP), {"BITCH_DEOP", NULL, NULL, NULL, NULL}, "bitch about deop", &BITCH_ABOUT_DEOP, NULL},
- {ST_STRING, 3, sizeof(BITCH_DEOP_REASON), {"BITCH_DEOP_TEXT", NULL, NULL, NULL, NULL}, "deop complaint", BITCH_DEOP_REASON, NULL},
-#endif
- {ST_STRING, 3, sizeof(COMPLAIN_REASON), {"BITCH_KICK_TEXT", NULL, NULL, NULL, NULL}, "bot kicked message", COMPLAIN_REASON, NULL},
- {ST_STRING, 3, sizeof(CMDCHAR), {"BOT_CMD_CHAR", NULL, NULL, NULL, NULL}, "bot's command char", CMDCHAR, NULL},
- {ST_STRING, 3, sizeof(Mynick), {"BOT_NICK", NULL, NULL, NULL, NULL}, "bot's nickname", Mynick, check_nick_parameter},
- {ST_STRING, 3, sizeof(REALNAME), {"BOT_NAME", NULL, NULL, NULL, NULL}, "bot's real name", REALNAME, NULL},
- {ST_STRING, 3, sizeof(UID), {"BOT_USER_ID", NULL, NULL, NULL, NULL}, "bot's user ID", UID, NULL},
- {ST_STRING, 3, sizeof(DEFAULT_UMODE), {"BOT_USER_MODE", NULL, NULL, NULL, NULL}, "bot's user modes", DEFAULT_UMODE, NULL},
- {ST_STRING, 3, sizeof(VHOST), {"BOT_VHOST", NULL, NULL, NULL, NULL}, "bot's virtual host", VHOST, NULL},
- {ST_INTEGER, 3, sizeof(CONNECT_WAIT_TIMEOUT), {"CONNECT_TIME", NULL, NULL, NULL, NULL}, "server connection timeout", &CONNECT_WAIT_TIMEOUT, NULL},
- {ST_STRING, 3, sizeof(CHAN), {"DEFAULT_CHANNEL", NULL, NULL, NULL, NULL}, "channel", CHAN, NULL},
- {ST_BOOLEAN, 3, sizeof(DISPLAY_SYNC), {"DISPLAY_SYNC", NULL, NULL, NULL, NULL}, "tell channel bot has finished syncing", &DISPLAY_SYNC, NULL},
- {ST_BOOLEAN, 3, sizeof(DO_WHOIS), {"DO_WHOIS", NULL, NULL, NULL, NULL}, "questionable channel alert", &DO_WHOIS, NULL},
- {ST_STRING, 3, sizeof(DUNNO_Q), {"DUNNO_TEXT", NULL, NULL, NULL, NULL}, "no answer complaint", DUNNO_Q, NULL},
- {ST_BOOLEAN, 3, sizeof(RANDOM_DUNNO), {"DUNNO_RANDOM_TEXT", NULL, NULL, NULL, NULL}, "random no answer complaint", &RANDOM_DUNNO, NULL},
- {ST_BOOLEAN, 3, sizeof(FIND_DUPS), {"DUPS_REMOVE", NULL, NULL, NULL, NULL}, "remove duplicates in hatabase", &FIND_DUPS, NULL},
- {ST_BOOLEAN, 3, sizeof(SAVE_DUPS), {"DUPS_SAVE", NULL, NULL, NULL, NULL}, "save duplicates in database", &SAVE_DUPS, NULL},
- {ST_STRING, 3, sizeof(EXISTING_ENTRY), {"ENTRY_EXISTS_TEXT", NULL, NULL, NULL, NULL}, "replacing existing complaint", EXISTING_ENTRY, NULL},
- {ST_STRING, 3, sizeof(NO_ENTRY), {"ENTRY_NOT_EXIST_TEXT", NULL, NULL, NULL, NULL}, "non-existing topic complaint", NO_ENTRY, NULL},
- {ST_STRING, 3, sizeof(NO_TOPIC), {"FIND_NO_TEXT", NULL, NULL, NULL, NULL}, "no topic search complaint", NO_TOPIC, NULL},
- {ST_STRING, 3, sizeof(TRY_FIND), {"FIND_WHAT_TEXT", NULL, NULL, NULL, NULL}, "try find search complaint", TRY_FIND, NULL},
-#ifdef ENABLE_CHANNEL
- {ST_BOOLEAN, 3, sizeof(KICK_ON_CHANNEL_NOTICE), {"FLOOD_NOTICE_KICK", NULL, NULL, NULL, NULL}, "kick on channel notice flood", &KICK_ON_CHANNEL_NOTICE, NULL},
- {ST_BOOLEAN, 3, sizeof(BAN_ON_CHANNEL_NOTICE), {"FLOOD_NOTICE_BAN", NULL, NULL, NULL, NULL}, "ban on channel notice flood", &BAN_ON_CHANNEL_NOTICE, NULL},
- {ST_BOOLEAN, 3, sizeof(BAN_BY_HOST), {"FLOOD_NOTICE_BAN_HOST", NULL, NULL, NULL, NULL}, "ban by host on channel notice flood", &BAN_BY_HOST, NULL},
- {ST_BOOLEAN, 3, sizeof(FLOOD_KICK), {"FLOOD_KICK", NULL, NULL, NULL, NULL}, "kick if bot is flooded", &FLOOD_KICK, NULL},
- {ST_STRING, 3, sizeof(FLOOD_REASON), {"FLOOD_TEXT", NULL, NULL, NULL, NULL}, "flooded bot complaint", FLOOD_REASON, NULL},
-#endif
- {ST_BOOLEAN, 3, sizeof(AUTOHELP_GUESTS), {"GREET_GUESTS_TEXT", NULL, NULL, NULL, NULL}, "give guests help", &AUTOHELP_GUESTS, NULL},
- {ST_BOOLEAN, 3, sizeof(HELP_GREET), {"GREET_NEW_TEXT", NULL, NULL, NULL, NULL}, "give new users help", &HELP_GREET, NULL},
- {ST_BOOLEAN, 3, sizeof(JOIN_GREET), {"GREET_USER_TEXT", NULL, NULL, NULL, NULL}, "registered user greeting", &JOIN_GREET, NULL},
- {ST_INTEGER, 3, sizeof(LASTCOMM_TIME), {"IGNORE_TIME", NULL, NULL, NULL, NULL}, "seconds to ignore repeated topics", &LASTCOMM_TIME, NULL},
- {ST_INTEGER, 3, sizeof(SLASTCOMM_TIME), {"IGNORE_USER_TIME", NULL, NULL, NULL, NULL}, "registered user delay seconds", &SLASTCOMM_TIME, NULL},
-#ifdef ENABLE_CHANNEL
- {ST_STRING, 3, sizeof(DEFAULT_KICK), {"KICK_TEXT", NULL, NULL, NULL, NULL}, "kick message", DEFAULT_KICK, NULL},
- {ST_BOOLEAN, 3, sizeof(KICK_ON_BAN), {"KICK_ON_BAN", NULL, NULL, NULL, NULL}, "kick when banned", &KICK_ON_BAN, NULL},
-#endif
- {ST_BOOLEAN, 3, sizeof(LOG_ADD_DELETES), {"LOG_CHANGES", NULL, NULL, NULL, NULL}, "logging of database changes", &LOG_ADD_DELETES, NULL},
- {ST_BOOLEAN, 3, sizeof(LOG_PRIVMSG), {"LOG_PRIVATE", NULL, NULL, NULL, NULL}, "logging of private messages", &LOG_PRIVMSG, NULL},
-#ifdef ENABLE_CHANNEL
- {ST_BOOLEAN, 3, sizeof(OP_USERS_ON_LOGIN), {"OP_ON_LOGIN", NULL, NULL, NULL, NULL}, "op users on login", &OP_USERS_ON_LOGIN, NULL},
-#endif
- {ST_INTEGER, 3, sizeof(OUTPUT1_COUNT), {"OUTPUT1_COUNT", NULL, NULL, NULL, NULL}, "output delay threshold", &OUTPUT1_COUNT, NULL},
- {ST_INTEGER, 3, sizeof(OUTPUT1_DELAY), {"OUTPUT1_TIME", NULL, NULL, NULL, NULL}, "output delay seconds", &OUTPUT1_DELAY, NULL},
- {ST_INTEGER, 3, sizeof(OUTPUT2_COUNT), {"OUTPUT2_COUNT", NULL, NULL, NULL, NULL}, "long output delay threshold", &OUTPUT2_COUNT, NULL},
- {ST_INTEGER, 3, sizeof(OUTPUT2_DELAY), {"OUTPUT2_TIME", NULL, NULL, NULL, NULL}, "long output delay seconds", &OUTPUT2_DELAY, NULL},
- {ST_INTEGER, 3, sizeof(OUTPUT_PURGE_COUNT), {"OUTPUT_PURGE_COUNT", NULL, NULL, NULL, NULL}, "purge output delay threshold", &OUTPUT_PURGE_COUNT, NULL},
- {ST_INTEGER, 3, sizeof(OUTPUT3_DELAY), {"OUTPUT3_TIME", NULL, NULL, NULL, NULL}, "purge output delay seconds", &OUTPUT3_DELAY, NULL},
- {ST_BOOLEAN, 3, sizeof(PERFORM_TIMER), {"PERFORM_TIME", NULL, NULL, NULL, NULL}, "sending perform.ini to server reqularly", &PERFORM_TIMER, NULL},
- {ST_BOOLEAN, 3, sizeof(GENERAL_QUESTIONS), {"QUESTIONS_GENERAL", NULL, NULL, NULL, NULL}, "bot responds without being asked", &GENERAL_QUESTIONS, NULL},
- {ST_BOOLEAN, 3, sizeof(MSG_RESPONSES), {"QUESTIONS_PRIVATE", NULL, NULL, NULL, NULL}, "bot responds to private questions", &MSG_RESPONSES, NULL},
-#ifdef ENABLE_QUIZ
- {ST_INTEGER, 3, sizeof(QUIZ_TIMER), {"QUIZ_TIME", NULL, NULL, NULL, NULL}, "quiz answer seconds", &QUIZ_TIMER, NULL},
- {ST_INTEGER, 3, sizeof(QUIZ_REPEAT_TIMER), {"QUIZ_REPEAT_TIME", NULL, NULL, NULL, NULL}, "next quiz delay seconds", &QUIZ_REPEAT_TIMER, NULL},
-#endif
-#ifdef ENABLE_RANDOM
-// This one is currently ./configure --enable-random
-// {ST_BOOLEAN, 3, sizeof(RANDOM_STUFF), {"RANDOM_STUFF", NULL, NULL, NULL, NULL}, "random utterences", &RANDOM_STUFF, NULL},
- {ST_BOOLEAN, 3, sizeof(BACKUP_RANDOMSTUFF), {"RANDOM_BACKUP", NULL, NULL, NULL, NULL}, "enable random stuff auto backups", &BACKUP_RANDOMSTUFF, NULL},
- {ST_INTEGER, 3, sizeof(RAND_IDLE), {"RANDOM_IDLE_TIME", NULL, NULL, NULL, NULL}, "seconds idle before random utterences", &RAND_IDLE, NULL},
-// This one is currently ./configure --with-random=level
-// {ST_INTEGER, 3, sizeof(RAND_LEVEL), {"RANDOM_LEVEL", NULL, NULL, NULL, NULL}, "level for adding random things", &RAND_LEVEL, NULL},
-// This one is currently ./configure --enable-randq
-// {ST_BOOLEAN, 3, sizeof(RANDQ), {"RANDOM_Q", NULL, NULL, NULL, NULL}, "enable RANDQ command", &RANDQ, NULL},
- {ST_INTEGER, 3, sizeof(RAND_STUFF_TIME), {"RANDOM_TIME", NULL, NULL, NULL, NULL}, "seconds between random utterences", &RAND_STUFF_TIME, NULL},
-#endif
- {ST_BOOLEAN, 3, sizeof(SeeN), {"SEEN_MODE", NULL, NULL, NULL, NULL}, "seen mode", &SeeN, NULL},
- {ST_INTEGER, 3, sizeof(MAX_LASTSEEN), {"SEEN_TIME", NULL, NULL, NULL, NULL}, "maximum last seen seconds", &MAX_LASTSEEN, NULL},
- {ST_STRING, 3, sizeof(SEEN_REPLY), {"SEEN_TEXT", NULL, NULL, NULL, NULL}, "maximum last seen reply", SEEN_REPLY, NULL},
- {ST_STRING, 3, sizeof(mySetinfo), {"SETINFO_TEXT", NULL, NULL, NULL, NULL}, "setinfo variables help text", mySetinfo, NULL},
- {ST_INTEGER, 3, sizeof(SLEEP_TIME), {"SLEEP_TIME", NULL, NULL, NULL, NULL}, "seconds to sleep for", &SLEEP_TIME, NULL},
- {ST_STRING, 3, sizeof(GOSLEEP_ACTION), {"SLEEP_TEXT", NULL, NULL, NULL, NULL}, "sleep action", GOSLEEP_ACTION, NULL},
- {ST_STRING, 3, sizeof(WAKEUP_ACTION), {"SLEEP_WAKE_TEXT", NULL, NULL, NULL, NULL}, "wakeup action", WAKEUP_ACTION, NULL},
- {ST_BOOLEAN, 3, sizeof(SORT), {"SORT_DB", NULL, NULL, NULL, NULL}, "sort database on startup", &SORT, NULL},
-#ifdef ENABLE_CHANNEL
- {ST_INTEGER, 3, sizeof(AUTOTOPIC_TIME), {"TOPIC_TIME", NULL, NULL, NULL, NULL}, "topic setting seconds", &AUTOTOPIC_TIME, NULL},
-#endif
- {ST_STRING, 3, sizeof(myVariables), {"VARIABLES_TEXT", NULL, NULL, NULL, NULL}, "data variables help text", myVariables, NULL},
-#ifdef ENABLE_CHANNEL
- {ST_BOOLEAN, 3, sizeof(VOICE_USERS_ON_JOIN), {"VOICE_ON_JOIN", NULL, NULL, NULL, NULL}, "voice users on join", &VOICE_USERS_ON_JOIN, NULL},
-#endif
- {ST_STRING, 3, sizeof(WHUT), {"WHUT_TEXT", NULL, NULL, NULL, NULL}, "no text complaint", WHUT, NULL},
- {ST_BOOLEAN, 3, sizeof(RANDOM_WHUT), {"WHUT_RANDOM_TEXT", NULL, NULL, NULL, NULL}, "random no text complaint", &RANDOM_WHUT, NULL},
-// Cant find CANT_FIND. B-)
-// {ST_STRING, 3, sizeof(CANT_FIND), {"CANT_FIND", NULL, NULL, NULL, NULL}, "can't find search complaint", CANT_FIND, NULL},
- {ST_STRING, 4, 0, {NULL, NULL, NULL, NULL, NULL}, NULL, NULL, NULL}
-};
-
-
-struct setup_parameter *
-set_parameter(char *input)
-{
- struct setup_parameter *result = NULL;
-
- /* ignore comments. */
- if (*input != '#')
- {
- int i, found = -1;
- char *dat = NULL, *ptr = NULL;
-
- dat = strdup(input);
- if ((ptr = strchr(dat, '=')) != NULL)
- *ptr++ = '\0';
- for (result = &parameters[0]; result->parameter[0] != NULL; result++)
- {
- for (i = 0; result->parameter[i] != NULL; i++)
- {
- if (strcasecmp(dat, result->parameter[i]) == 0)
- {
- found = i;
- break;
- }
- }
- if (found != -1)
- break;
- }
-
- if (found == -1)
- result = NULL;
- else
- {
- if ((ptr) && (result->func))
- {
- ptr = result->func(result, ptr);
- if (ptr == NULL)
- result = NULL;
- }
- if (ptr)
- {
-#ifdef ENABLE_VERBOSE
- printf("Setting %s = %s\n", result->summary, ptr);
-#endif
- switch (result->type)
- {
- case ST_BOOLEAN :
- {
- bool *variable = result->value;
-
- *variable = isBoolean(ptr);
- break;
- }
-
- case ST_INTEGER :
- {
- long *variable = result->value;
-
- *variable = atoi(ptr);
- break;
- }
-
- case ST_STRING :
- {
- char *variable = result->value;
-
- strncpy(variable, ptr, result->max_size);
- break;
- }
- }
- }
- }
- free(dat);
- }
-
- return result;
-}
-
-void
-save_setup (void)
-{
- struct setup_parameter *result = NULL;
-
- printf("*** Writing setup file: %s (%s)\n", SETUP, date());
- remove(TMP_FILE);
-
- for (result = &parameters[0]; result->parameter[0] != NULL; result++)
- {
- switch (result->type)
- {
- case ST_BOOLEAN :
- {
- bool *variable = result->value;
-
- db_log(TMP_FILE, "%s=%d\n", result->parameter[0], (*variable) ? 1 : 0);
- break;
- }
-
- case ST_INTEGER :
- {
- long *variable = result->value;
-
- db_log(TMP_FILE, "%s=%ld\n", result->parameter[0], *variable);
- break;
- }
-
- case ST_STRING :
- {
- char *variable = result->value;
-
- db_log(TMP_FILE, "%s=%s\n", result->parameter[0], variable);
- break;
- }
- }
- }
-
- rename(TMP_FILE, SETUP);
-}
diff --git a/beta/source/vars.h b/beta/source/vars.h
deleted file mode 100755
index 57de48a..0000000
--- a/beta/source/vars.h
+++ /dev/null
@@ -1,357 +0,0 @@
-#define STRING_SHORT 512
-#define STRING_LONG 2048
-
-#define FLAG_CHANOP 0x0001
-#define FLAG_CHANVOICE 0x0002
-
-extern int wsock;
-extern int sockerr;
-extern int optlen;
-extern size_t nRandStuffs;
-extern long QUESTIONS;
-extern long ADDITIONS;
-extern long DELETIONS;
-extern long uptime;
-extern long NO_FLOOD;
-extern long NUM_SERV;
-extern long L_CLIENTS;
-extern long IRCOPS;
-extern long xtried;
-extern long G_USERS;
-extern long rt;
-extern long fc;
-extern long spr;
-extern long snr;
-extern long BP;
-extern long CHECKED;
-extern long SEND_DELAY;
-extern long send_tog;
-extern long NUM_HELPER;
-extern long NUM_USER;
-extern long NUMLINESSEEN;
-extern long Rand_Stuff;
-extern long Rand_Idle;
-extern long AIL4;
-extern long Sleep_Toggle;
-extern long Sleep_Time;
-extern long AIL3;
-extern long AIL2;
-extern long AIL5;
-extern long JOINs;
-extern long PERMBAN_counter;
-extern long RAND_CHANS;
-extern long ram_load_time;
-extern long AIL9;
-extern long AIL666;
-extern long AIL8;
-#ifdef ENABLE_QUIZ
-extern long AIL13;
-#endif
-extern long LastInput;
-extern long AIL10;
-extern long MARK_CHANGE;
-extern long html_counter;
-extern long lcn1;
-extern long lcn2;
-extern long lcn4;
-extern long lcn3;
-extern bool SeeN;
-extern long DebuG;
-#ifdef ENABLE_QUIZ
-extern long quiz_timer;
-extern long quiz_line;
-extern bool quiz_answer;
-extern bool quiz_halt;
-extern long recent_questions[10];
-#endif
-extern char NICK_COMMA[32];
-extern char COLON_NICK[33];
-extern char BPASS[STRING_SHORT];
-extern char pass_data[512];
-extern char pass_pass[STRING_SHORT];
-extern char rword[STRING_SHORT];
-extern char lc1[STRING_SHORT];
-extern char lc2[STRING_SHORT];
-extern char lc4[STRING_SHORT];
-extern char lc3[STRING_SHORT];
-extern char slc1[STRING_SHORT];
-extern char slc2[STRING_SHORT];
-extern char slc4[STRING_SHORT];
-extern char slc3[STRING_SHORT];
-extern char mask_tmp[STRING_LONG];
-extern char quiz_target[STRING_SHORT];
-extern long slcn1;
-extern long slcn2;
-extern long slcn4;
-extern long slcn3;
-extern char *rp391;
-extern char BCOLON_NICK[STRING_SHORT];
-extern char DARKBOT_BIN[STRING_SHORT];
-extern char URL2[STRING_SHORT];
-extern char DBTIMERS_PATH[STRING_SHORT];
-extern char LOG_DIR[STRING_SHORT];
-extern char RDB_DIR[STRING_SHORT];
-#ifdef ENABLE_STATS
-extern char STATS_FILE[STRING_SHORT];
-#endif
-extern char SEEN_FILE[STRING_SHORT];
-extern char BACKUP_DUP[STRING_SHORT];
-extern char ADD_DELETES[STRING_SHORT];
-extern char AUTOTOPIC_F[STRING_SHORT];
-extern char HELPER_LIST[STRING_SHORT];
-extern char QUIZ_FILE[STRING_SHORT];
-extern char PERFORM[STRING_SHORT];
-extern char DEOP[STRING_SHORT];
-extern char RAND_SAY[STRING_SHORT];
-extern char RAND_FILE[STRING_SHORT];
-extern char RANDQ_TEMPFILE[STRING_SHORT];
-extern char RAND_BACKUP_FILE[STRING_SHORT];
-extern char SERVERS[STRING_SHORT];
-extern char PERMBAN[STRING_SHORT];
-extern char SETUP[STRING_SHORT];
-extern char DAT_DIR[STRING_SHORT];
-extern char r_reply[STRING_SHORT];
-extern char data[STRING_SHORT];
-extern char g_chan[STRING_SHORT];
-extern char dbVersion[STRING_SHORT];
-extern char strbuff[STRING_SHORT];
-extern char f_tmp[STRING_LONG];
-extern char UID[STRING_SHORT];
-extern char BS[STRING_SHORT];
-extern char CMDCHAR[2];
-extern char CHAN[STRING_SHORT];
-extern char s_Mynick[STRING_SHORT];
-extern char g_host[STRING_SHORT];
-extern char Mynick[STRING_SHORT];
-extern char sleep_chan[STRING_SHORT];
-extern char VHOST[STRING_SHORT];
-extern char REALNAME[STRING_SHORT];
-extern char privmsg_log[STRING_SHORT];
-
-extern long CONNECT_WAIT_TIMEOUT;
-extern bool PERFORM_TIMER;
-extern char DEFAULT_UMODE[STRING_SHORT];
-extern bool ANTI_IDLE;
-extern bool DISPLAY_SYNC;
-
-extern bool SORT;
-extern bool FIND_DUPS;
-extern bool SAVE_DUPS;
-extern bool GENERAL_QUESTIONS;
-extern bool ALLOW_ADD_IN_MSG;
-extern bool ALLOW_DEL_IN_MSG;
-extern bool MSG_RESPONSES;
-
-extern bool LOG_ADD_DELETES;
-extern bool LOG_PRIVMSG;
-
-extern long SLEEP_TIME;
-extern char GOSLEEP_ACTION[STRING_SHORT];
-extern char WAKEUP_ACTION[STRING_SHORT];
-
-extern long LASTCOMM_TIME;
-extern long OUTPUT1_COUNT;
-extern long OUTPUT1_DELAY;
-extern long OUTPUT2_COUNT;
-extern long OUTPUT2_DELAY;
-extern long OUTPUT3_DELAY;
-extern long OUTPUT_PURGE_COUNT;
-
-extern char EXISTING_ENTRY[STRING_SHORT];
-extern char NO_ENTRY[STRING_SHORT];
-//extern char CANT_FIND[STRING_SHORT]; /* ... */
-extern char NO_TOPIC[STRING_SHORT]; /* ... */
-extern char TRY_FIND[STRING_SHORT];
-extern char WHUT[STRING_SHORT];
-extern bool RANDOM_WHUT;
-extern char DUNNO_Q[STRING_SHORT];
-extern bool RANDOM_DUNNO;
-
-#ifdef ENABLE_RANDOM
-//extern bool RANDOM_STUFF;
-extern long RAND_STUFF_TIME;
-extern long RAND_IDLE;
-//extern long RAND_LEVEL;
-//extern bool RANDQ;
-extern bool BACKUP_RANDOMSTUFF;
-#endif
-
-extern bool JOIN_GREET;
-extern long SLASTCOMM_TIME;
-#ifdef ENABLE_CHANNEL
-extern bool VOICE_USERS_ON_JOIN;
-extern bool OP_USERS_ON_LOGIN;
-#endif
-
-extern bool DO_WHOIS;
-extern long MAX_LASTSEEN;
-extern char SEEN_REPLY[STRING_SHORT];
-
-extern char COMPLAIN_REASON[STRING_SHORT];
-#ifdef ENABLE_CHANNEL
-extern bool BITCH_ABOUT_DEOP;
-extern char BITCH_DEOP_REASON[STRING_SHORT];
-
-extern long AUTOTOPIC_TIME;
-extern char DEFAULT_KICK[STRING_SHORT];
-extern bool KICK_ON_BAN;
-
-extern bool KICK_ON_CHANNEL_NOTICE;
-extern bool BAN_ON_CHANNEL_NOTICE;
-extern bool BAN_BY_HOST;
-
-extern bool FLOOD_KICK;
-extern char FLOOD_REASON[STRING_SHORT];
-#endif
-
-#ifdef ENABLE_QUIZ
-extern long QUIZ_TIMER;
-extern long QUIZ_REPEAT_TIMER;
-#endif
-
-extern bool HELP_GREET;
-extern bool AUTOHELP_GUESTS;
-
-extern char mySetinfo[STRING_SHORT];
-extern char myVariables[STRING_SHORT];
-
-extern struct rusage r_usage;
-
-extern struct ignorelist
-{
- char nick[STRING_SHORT];
- struct ignorelist *next;
-}
- *ignorehead;
-
-extern struct sendq
-{
- char data[STRING_SHORT];
- struct sendq *next;
-}
- *sendqhead, *sendqtail;
-
-extern struct userlist
-{ /* internal userlist */
- char chan[STRING_SHORT];
- char nick[STRING_SHORT];
- char uh[STRING_SHORT];
- long flags; /* op/voice/etc */
- long level; /* auth */
- short global; /* Global user? */
- long idle;
- struct userlist *next;
-}
- *userhead;
-
-extern struct helperlist
-{
- char chan[STRING_SHORT];
- char uh[STRING_SHORT];
- char nick[STRING_SHORT];
- long level;
- size_t num_join;
- char greetz[STRING_SHORT];
- char pass[STRING_SHORT];
- struct helperlist *next;
-}
- *helperhead;
-
-/**
- * 6/23/00 Dan
- * - Changed permbanlist to have dynamically allocated
- * userhost and reason fields.
- * - Changed type of counter to size_t, this should be an
- * unsigned type.
- */
-extern struct permbanlist
-{
- char *uh;
- char *reason;
- size_t counter;
-
- struct permbanlist *next;
-}
- *permbanhead;
-
-extern struct old
-{
- char host[200];
- long time;
- int count;
- int value;
- int kick;
-}
- ood[STRING_SHORT];
-
-extern struct sl124
-{
- char name[STRING_SHORT];
- long port;
- char pass[STRING_SHORT];
- struct sl124 *next;
-}
- *sh124;
-
-#ifdef ENABLE_STATS
-extern struct statslist
-{
- char nick[STRING_SHORT];
- char uh[STRING_SHORT];
- long total;
- long added_time;
- long last_time;
-
- struct statslist *next;
-}
- *statshead;
-#endif
-
-extern struct randstats
-{
- char chan [STRING_SHORT];
- size_t Rand_Stuff;
- size_t Rand_Idle;
- size_t refnum;
- size_t nCount; /* Number of times we outputted to this channel. */
- struct randstats *next;
-/* struct randstats *prev; */
-}
- *randstatshead;
-
-extern struct webinfo
-{
- char trigger[STRING_SHORT];
- char host[STRING_SHORT];
- int port;
- char url[STRING_SHORT];
-}
- GOOGLE_webinfo, METAR_webinfo, TAF_webinfo, WEATHER_webinfo;
-
-
-enum setup_type
-{
- ST_BOOLEAN = 0,
- ST_INTEGER = 1,
- ST_STRING = 2
-};
-
-enum chanserv_invoke_type
-{
- DIRECT_INVOKE = 0, // command
- ADDRESS_INVOKE = 1, // bot: command
- MSG_INVOKE = 2, // /msg bot command
- CHAR_INVOKE = 3 // !command
-};
-
-extern struct setup_parameter
-{
- enum setup_type type;
- int access; /* Access level required to change the value. */
- size_t max_size;
- char *parameter[5];
- char *summary;
- void *value; /* Where the value is stored. */
- void *(*func) (struct setup_parameter *parameter, char *ptr); /* Optional function that can do other things with the value, and veto the change by returning NULL. */
-}
-parameters[];
diff --git a/beta/source/web.c b/beta/source/web.c
deleted file mode 100755
index fa8860f..0000000
--- a/beta/source/web.c
+++ /dev/null
@@ -1,631 +0,0 @@
-#include "defines.h"
-#include "vars.h"
-#include "prototypes.h"
-
-#if defined ENABLE_GOOGLE || defined ENABLE_METAR || defined ENABLE_TAF || defined ENABLE_WEATHER
-
-static void init_sockaddr (struct sockaddr_in *, char *, unsigned short int);
-static int web_open_socket (char *host, int port);
-static int web_write_server (int filedes, char *format,...);
-static int web_read_server (char *source, char *uh, char *target, int filedes, char *host);
-static int google_parse_query (char *source, char *uh, char *target, char *data);
-static int weather_parse_query (char *source, char *uh, char *target, char *data);
-static int metar_parse_query (char *source, char *uh, char *target, char *data);
-static int taf_parse_query (char *source, char *uh, char *target, char *data);
-
-int
-web_post_query(char *trigger, char *source, char *uh, char *target, char *query, int size)
-{
- char *ptr = NULL;
- char *mem = NULL;
- struct webinfo *wi = NULL;
-
- if(strcasecmp (trigger, GOOGLE_webinfo.trigger) == 0)
- {
- wi = (struct webinfo *) &GOOGLE_webinfo;
- }
- else if(strcasecmp (trigger, METAR_webinfo.trigger) == 0)
- {
- wi = (struct webinfo *) &METAR_webinfo;
- }
- else if(strcasecmp (trigger, TAF_webinfo.trigger) == 0)
- {
- wi = (struct webinfo *) &TAF_webinfo;
- }
- else if(strcasecmp (trigger, WEATHER_webinfo.trigger) == 0)
- {
- wi = (struct webinfo *) &WEATHER_webinfo;
- }
- else
- {
- return SUCCESS;
- }
-
- size++; // for null
-
- if((ptr = calloc(size, sizeof(char))) == NULL)
- {
- return ERR_CANT_MALLOC;
- }
- mem = ptr;
-
- if(web_open_socket(wi->host, wi->port) != SUCCESS)
- {
- free (mem);
- return ERR_OPEN_SOCKET;
- }
- snprintf(ptr, size + 1, "%s", query);
-
- while(*ptr != '\0')
- {
- if(*ptr == ' ')
- {
- *ptr = '+';
- }
- ptr++;
- }
-
- if(web_write_server(wsock, "GET %s%s HTTP/1.0\n\n", wi->url, mem) != SUCCESS)
- {
- free (mem);
- return ERR_WRITE_SOCKET;
- }
-
- /* i'm passing the trigger instead of the host to web_read_server
- because the hostnames could be equal (see METAR & TAF) */
- if(web_read_server(source, uh, target, wsock, wi->trigger) != SUCCESS)
- {
- free (mem);
- return ERR_READ_SOCKET;
- }
- close(wsock);
- free (mem);
-
- return SUCCESS;
-}
-
-static void
-init_sockaddr (struct sockaddr_in *name, char *host, unsigned short int port)
-{
- struct hostent *hostinfo;
-
- name->sin_family = AF_INET;
- name->sin_port = htons (port);
- hostinfo = gethostbyname (host);
-
- if (!hostinfo)
- {
- return;
- }
- name->sin_addr = *(struct in_addr *) hostinfo->h_addr;
-}
-
-static int
-web_open_socket(char *host, int port)
-{
- extern void init_sockaddr (struct sockaddr_in *name, char *host, unsigned short int port);
-
- struct sockaddr_in name;
- struct timeval timeout;
- int result = 0;
- int esc = 0;
- fd_set set;
-
- if((wsock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- {
- return ERR_CANT_CONNECT;
- }
-
- if((result = fcntl(wsock, F_SETFL, O_NONBLOCK)) < 0)
- {
- return ERR_CANT_CONNECT;
- }
-
- init_sockaddr (&name, host, port);
-
- if(connect(wsock, (struct sockaddr *) & name, sizeof(name)) != -1)
- {
- return ERR_CANT_CONNECT;
- }
-
- if(errno != EINPROGRESS)
- {
- return ERR_CANT_CONNECT;
- }
-
- while(!esc)
- {
- timeout.tv_sec = 10;
- timeout.tv_usec = 0;
-
- FD_ZERO(&set);
- FD_SET(wsock, &set);
-
- switch(select(FD_SETSIZE, (fd_set *) NULL, &set, (fd_set *) NULL, &timeout))
- {
- case 0:
- return ERR_TIMED_OUT;
-
- case -1:
- break;
-
- default:
- esc++;
-
- switch(getsockopt(wsock, SOL_SOCKET, SO_ERROR, &sockerr, &optlen))
- {
- case -1:
- break;
-
- case 0:
- switch(sockerr)
- {
- case ECONNREFUSED:
- break;
-
- case EADDRNOTAVAIL:
- break;
-
- case ENETUNREACH:
- break;
-
- case SUCCESS:
- if((result = fcntl(wsock, F_SETFL, 0)) < 0)
- {
- return ERR_CANT_CONNECT;
- }
- return SUCCESS;
- }
- }
- }
- }
- return SUCCESS;
-}
-
-static int
-web_write_server (int filedes, char *format,...)
-{
- int nbytes = 0;
- va_list arglist;
- char message[STRING_LONG] = {0};
- struct timeval timeout;
- fd_set set;
-
- va_start(arglist, format);
- vsprintf(message, format, arglist);
- va_end(arglist);
-
- while(1)
- {
- timeout.tv_sec = 10;
- timeout.tv_usec = 0;
- FD_ZERO(&set);
- FD_SET(filedes, &set);
-
- switch (select(FD_SETSIZE, (fd_set *) NULL, &set, (fd_set *) NULL, &timeout))
- {
- case 0:
- close(filedes);
- return ERR_SERVER_BUSY;
-
- case -1:
- if (!alarmed)
- {
- db_sleep(RECHECK);
- }
- else
- {
- alarmed = 0;
- }
- break;
-
- default:
- if((nbytes = write(filedes, message, strlen(message) + 1)) < 0)
- {
- return ERR_SERVER_BUSY;
- }
- else
- {
- return SUCCESS;
- }
- }
- }
-}
-
-static int
-web_read_server(char *source, char *uh, char *target, int filedes, char *host)
-{
- int nbytes = 0;
- int esc = 0;
- char packet[STRING_LONG] = { 0 };
- char *mem = NULL;
- char *ptr = NULL;
- struct timeval timeout;
- fd_set set;
-
- if((mem = calloc(sizeof(packet) + 1, sizeof(char))) == NULL)
- {
- return ERR_READ_SOCKET;
- }
- alarm(0);
-
- while(!esc)
- {
- timeout.tv_sec = 10;
- timeout.tv_usec = 0;
- FD_ZERO(&set);
- FD_SET(filedes, &set);
-
- switch(select(FD_SETSIZE, &set, (fd_set *) NULL, (fd_set *) NULL, &timeout))
- {
- case 0:
- close(filedes);
- alarm(AIL);
- free (mem);
- return ERR_SERVER_BUSY;
-
- case -1:
- break;
-
- default:
- alarm(AIL);
- esc = 1;
- break;
- }
- }
-
- while((nbytes = recv(filedes, packet, sizeof(packet), 0)) > 0)
- {
- strncat(mem, packet, sizeof(packet));
-
- if((ptr = realloc(mem, strlen(mem) + sizeof(packet) + 1)) == NULL)
- {
- free ( mem );
- return ERR_CANT_MALLOC;
- }
- else
- {
- mem = ptr;
- }
- memset(packet, 0, sizeof(packet));
- }
-
- if(nbytes < 0)
- {
- free ( mem );
- return ERR_SERVER_BUSY;
- }
- close(filedes);
-
-
- if(strcasecmp (host, GOOGLE_webinfo.trigger) == 0)
- {
- google_parse_query(source, uh, target, mem);
- }
- else if(strcasecmp (host, METAR_webinfo.trigger) == 0)
- {
- metar_parse_query(source, uh, target, mem);
- }
- else if(strcasecmp (host, TAF_webinfo.trigger) == 0)
- {
- taf_parse_query(source, uh, target, mem);
- }
- else if (strcasecmp (host, WEATHER_webinfo.trigger) == 0)
- {
- weather_parse_query (source, uh, target, mem);
- }
-
- free(mem);
-
- return SUCCESS;
-}
-static int
-weather_parse_query (char *source, char *uh, char *target, char *data)
-{
- char *s1 = NULL, *s2 = NULL;
- char *tmp = NULL, *temp = NULL, *city = NULL;
- char *humid = NULL, *dew = NULL;
- char *wind = NULL, *pres = NULL, *cond = NULL;
- char *vis = NULL, *cloud = NULL, *wind2 = NULL;
- char *sunr = NULL, *suns = NULL;
-
- char sub1[] = "<b>";
- char sub2[] = "<span class=\"nowrap\"><b>";
-
-
- if ((s1 = strstr (data, "Observed at")) != NULL)
- {
- s2 += 8;
- if ((s2 = strstr (s1, sub1)) != NULL)
- {
- city = strtok (s2, "</b>");
- data = strtok (NULL, "");
- }
- }
-
- if ((s1 = strstr (data, "Temperature")) != NULL)
- {
- if ((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen (sub1);
-
- temp = strtok (s2, "</b>");
- data = strtok (NULL, "");
- }
- }
-
- if ((s1 = strstr (data, "Humidity")) != NULL)
- {
- if ((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen (sub1);
-
- humid = strtok (s2, "</b>");
- data = strtok (NULL, "");
- }
- }
-
- if ((s1 = strstr (data, "Dew Point")) != NULL)
- {
- if ((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen (sub1);
-
- dew = strtok (s2, "</b>");
- data = strtok (NULL, "");
- }
- }
-
- if ((s1 = strstr (data, "Wind")) != NULL)
- {
- if ((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen (sub1);
-
- wind = strtok (s2, "</b>");
- data = strtok (NULL, "");
-
- if ((tmp = strstr (data, sub2)) != NULL)
- {
- tmp += strlen (sub2);
- wind2 = strtok (tmp, "</b>");
- data = strtok (NULL, "");
- }
-
- }
- }
-
- if ((s1 = strstr (data, "Pressure")) != NULL)
- {
- if ((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen (sub1);
-
- pres = strtok (s2, "</b>");
-
- data = strtok (NULL, "");
- }
- }
-
- if ((s1 = strstr (data, "Conditions")) != NULL)
- {
- if ((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen (sub1);
-
- cond = strtok (s2, "</b>");
- data = strtok (NULL, "");
- }
- }
-
- if ((s1 = strstr (data, "Visibility")) != NULL)
- {
- if ((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen (sub1);
-
- vis = strtok (s2, "</b>");
- data = strtok (NULL, "");
- }
- }
-
- if ((s1 = strstr (data, "Clouds")) != NULL)
- {
- if ((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen (sub1);
-
- cloud = strtok (s2, "</b>");
- data = strtok (NULL, "");
- }
- }
-
- if ((s1 = strstr (data, "Sunrise")) != NULL)
- {
- if ((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen (sub1);
-
- sunr = strtok (s2, "</b>");
- data = strtok (NULL, "");
- }
- }
-
- if ((s1 = strstr (data, "Sunset")) != NULL)
- {
- if ((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen (sub1);
-
- suns = strtok (s2, "</b>");
- data = strtok (NULL, "");
- }
- }
-
- /* Display stuff to target. */
- S ("PRIVMSG %s :%s: Temperature (%s%cF) Humidity (%s) DewPoint (%s%cF) Wind (%s at %smph) Pressure (%s in) Conditions (%s) Visibility (%s miles) Clouds (%sft) Sunrise (%s) Sunset (%s)\n",
- target, city, temp, 176, humid, dew, 176, wind, wind2, pres,
- cond, vis, cloud, sunr, suns);
-
-}
-static int
-google_parse_query(char *source, char *uh, char *target, char *data)
-{
- char *s1 = NULL;
- char *s2 = NULL;
- char *s3 = NULL;
- char *s4 = NULL;
- char url[STRING_LONG] = { 0 };
- char sub1[] = "<p class=g><a href=";
-
- if(strstr(data, "did not match any documents") != NULL)
- {
- S("PRIVMSG %s :Sorry, your search did not match any documents.\n", target);
- return ERR_NO_DOCUMENTS;
- }
-
- if((s1 = strstr(data, "Results ")) != NULL)
- {
- if((s2 = strstr(s1, sub1)) != NULL)
- {
- s2 += strlen(sub1);
-
- if((s4 = strstr(s2, "http")) == NULL)
- {
- S("PRIVMSG %s :Try again later.\n", target);
- return ERR_NO_DOCUMENTS;
- }
- if((s3 = strchr(s4, '\"')) != NULL)
- {
- *s3 = '\0';
- }
- if((s3 = strstr(s4, "&e=")) != NULL)
- {
- *s3 = '\0';
- }
- snprintf(url, sizeof(url), "%s", s4);
- }
- if(url[0] != 'h')
- {
- S("PRIVMSG %s :Try again later.\n", target);
- return ERR_NO_DOCUMENTS;
- }
-
- S("PRIVMSG %s :%s%s\n", target, rand_reply(source), url);
-#ifdef ENABLE_STATS
- add_stats (source, uh, 1, time (NULL), time (NULL));
-#endif
- }
- else
- {
- S("PRIVMSG %s :Sorry, your search did not match any documents.\n", target);
- return ERR_NO_DOCUMENTS;
- }
- return SUCCESS;
-}
-
-static int
-metar_parse_query(char *source, char *uh, char *target, char *data)
-{
- char *s1 = NULL;
- char *s2 = NULL;
- char metardata[STRING_LONG] = { 0 };
- int i = 0;
-
- if((s1 = strstr(data, "The observation is:")) != NULL)
- {
- /* skip the next 3 html tags */
- while(i<3)
- {
- while(*s1 != '>')
- {
- s1++;
- }
- s1++;
- i++;
- }
- while((*s1 == 0x0D) || (*s1 == 0x0A))
- {
- s1++;
- }
- if((s2 = strchr(s1, '<')) != NULL)
- {
- *s2 = '\0';
- }
- s2 = s1;
- while (*s2 != '\0')
- {
- if ((*s2 == 0x0D) || (*s2 == 0x0A))
- {
- *s2 = ' ';
- }
- s2++;
- }
- snprintf(metardata, sizeof(metardata), "%s", s1);
-
- S("PRIVMSG %s :%s%s\n", target, rand_reply(source), metardata);
-#ifdef ENABLE_STATS
- add_stats (source, uh, 1, time (NULL), time (NULL));
-#endif
- }
- else
- {
- S("PRIVMSG %s :Sorry, no METAR data available.\n", target);
- return ERR_NO_DOCUMENTS;
- }
- return SUCCESS;
-}
-
-static int
-taf_parse_query(char *source, char *uh, char *target, char *data)
-{
- char *s1 = NULL;
- char *s2 = NULL;
- char tafdata[STRING_LONG] = { 0 };
- int i = 0;
-
- if((s1 = strstr(data, "The observation is:")) != NULL)
- {
- /* skip the next 4 html tags */
- while(i<4)
- {
- while(*s1 != '>')
- {
- s1++;
- }
- s1++;
- i++;
- }
- while((*s1 == 0x0D) || (*s1 == 0x0A))
- {
- s1++;
- }
- if((s2 = strchr(s1, '<')) != NULL)
- {
- *s2 = '\0';
- }
- s2 = s1;
- while (*s2 != '\0')
- {
- if ((*s2 == 0x0D) || (*s2 == 0x0A) || (*s2 == 0x09))
- {
- *s2 = ' ';
- }
- s2++;
- }
- snprintf(tafdata, sizeof(tafdata), "%s", s1);
-
- S("PRIVMSG %s :%s%s\n", target, rand_reply(source), tafdata);
-#ifdef ENABLE_STATS
- add_stats (source, uh, 1, time (NULL), time (NULL));
-#endif
- }
- else
- {
- S("PRIVMSG %s :Sorry, no TAF data available.\n", target);
- return ERR_NO_DOCUMENTS;
- }
- return SUCCESS;
-}
-
-#endif
diff --git a/beta/bootstrap.sh b/bootstrap.sh
similarity index 100%
rename from beta/bootstrap.sh
rename to bootstrap.sh
diff --git a/beta/build.sh b/build.sh
similarity index 100%
rename from beta/build.sh
rename to build.sh
diff --git a/beta/build_small.sh b/build_small.sh
similarity index 100%
rename from beta/build_small.sh
rename to build_small.sh
diff --git a/beta/clean.sh b/clean.sh
similarity index 100%
rename from beta/clean.sh
rename to clean.sh
diff --git a/configure b/configure
deleted file mode 100755
index 08002ae..0000000
--- a/configure
+++ /dev/null
@@ -1,806 +0,0 @@
-#!/bin/sh
-PNCFG="
-Darkbot Configuration Utility
-<************_~_************>
-"
-PID=0624022000
-lparen='('
-rparen=')'
-# Configures Darkbot
-# to do: correcting user entry errors on the fly
-
-ENVIRONMENT () {
-BASE_WORKDIR="scripts/.scriptutils"
-TMP=$BASE_WORKDIR/._tmp/cfg$$
-mkdir -p $BASE_WORKDIR/._tmp/
-cfg_vars=$BASE_WORKDIR/.cfg_vars
-trap 'rm -fr $BASE_WORKDIR/._tmp* >/dev/null 2>&1' 0
-m_trap="echo -e \n\n -- `basename $0` terminated by `whoami` --\n\n"
-trap '$m_trap 1>&2; exit' 1 2 3 13 15
-# load vars
-# utility vars
-if [ -e "$cfg_vars" ]; then
-. "$cfg_vars"; fi
-# setup.ini
-if [ -s dat/setup.ini ]; then
-cat dat/setup.ini | sed -e s/=/=\"/ -e s/$/\"/ > $TMP-setup.ini
-. $TMP-setup.ini
-fi
-if [ -z "$NICK" ]; then NICK="Darkbot"; fi
-if [ -z "$USERID" ]; then USERID="darkbot"; fi
-if [ -z "$CHAN" ]; then CHAN="#Darkbot"; fi
-if [ -z "$REALNAME" ]; then REALNAME="Get info about me at \
-http://darkbot.info "; fi
-if [ -z "$CMDCHAR" ]; then CMDCHAR="!"; fi
-if [ -z "$VHOST" ]; then VHOST="0"; fi
-if [ -z "$AUTOTOPIC" ]; then AUTOTOPIC="0"; fi
-if [ -z "$SEEN" ]; then SEEN="0"; fi
-}
-
-CFG_INTRO () {
-clear
-echo -e "\n$PNCFG
---------------------------------------------------------------------------"
-if [ ! -s "$cfg_vars" ]; then
-echo -e "
- Welcome to "$cfg_dbrev" configuration, `whoami`.\n
- This will lead you through the setup of your Darkbot wich requires your
- input during a few minutes.\n
- During this process you could change the directives on defines.h file and
- edit 3 essential files: setup.ini, servers.ini and userlist.db.
- Additionally, perform.ini and deop.ini could also be edited from here.\n
- If for any reason after configuring your Darkbot you would like to use
- this utility again, previously configured items will be shown as session
- defaults."
-else
-echo -e "
- Welcome back to "$cfg_dbrev" configuration, `whoami`.\n"
-if [ "$CFG_DEFINES" = "defined" ] && [ "$cfg_dbrev" != "$CFG_LAST_REV" ]; then
-echo " Since this is a new Darkbot revision you might want to take a look on \
-your
- defines.h file again."; fi
-echo -e "\n All previously entered information will be used now as session \
-defaults.
- You can bypass the items you don't want to change by hitting ENTER key.
- That data on your \""$NICK"\" will not be modified."
-fi
-echo -e "\n Where shown, [defaults] can be used by hitting ENTER.
- -------------------------------------------------------------------------- \n
- [ Hit ENTER to start the configuration, `whoami` ]"
-read PTR
-}
-
-CFG_VARS () {
-# configuration vars
-if [ ! -s "$cfg_vars" ]; then
-touch $cfg_vars
-fi
- # CFG_EDITOR
-if [ "$1" = "CFG_EDITOR" ]; then
- if [ "`grep 'CFG_EDITOR' $cfg_vars`" ]; then
- grep -v 'CFG_EDITOR' "$cfg_vars" > $TMP
- cat $TMP > $cfg_vars
- fi
-echo "CFG_EDITOR=\"$CFG_EDITOR\"" >> $cfg_vars
-fi
- # CFG_DEFINES
-if [ "$1" = "CFG_DEFINES" ]; then
- if [ "`grep 'CFG_DEFINES' $cfg_vars`" ]; then
- grep -v 'CFG_DEFINES' "$cfg_vars" > $TMP
- cat $TMP > $cfg_vars
-fi
-echo "CFG_DEFINES=\"defined\"" >> $cfg_vars
-fi
- # CFG_LAST_REV
-if [ "$1" = "CFG_LAST_REV" ]; then
- if [ "`grep 'CFG_LAST_REV' $cfg_vars`" ]; then
- grep -v 'CFG_LAST_REV' "$cfg_vars" > $TMP
- cat $TMP > $cfg_vars
-fi
-echo "CFG_LAST_REV=\""$cfg_dbrev"\"" >> $cfg_vars
-fi
- # CFG_SETUP_INI
-if [ "$1" = "CFG_SETUP_INI" ]; then
- if [ "`grep 'CFG_SETUP_INI' $cfg_vars`" ]; then
- grep -v 'CFG_SETUP_INI' "$cfg_vars" > $TMP
- cat $TMP > $cfg_vars
- fi
-echo "CFG_SETUP_INI=\"set\"" >> $cfg_vars
-fi
-}
-
-# PROGRAM SETTINGS #
-CFG_EDITOR () {
-if [ -x "`type -p pico`" ]; then CFG_EDITOR="pico"
-else
- if [ -x "`type -p emacs`" ]; then CFG_EDITOR="emacs"
- else
- if [ -x "`type -p vi`" ]; then CFG_EDITOR="vi"
- else
- if [ -x "`type -p vim`" ]; then CFG_EDITOR="vim"
- fi
- fi
- fi
-fi
-clear
-echo -e "\n$PNCFG\n* choosing text editor *\n
- In order to adjust Darkbot to your needs some files might need to
- to be chamged so it's necessary to know which text editor to use.\n"
-if [ -n "$CFG_EDITOR" ]; then
-sleep 2
-echo -e " Detected '"$CFG_EDITOR"' installed on your system, but you can \
-use other
- editor of your choice, providing it is installed and working."
-else
-# no popular editor detected so have pico as (symbolic) default leaving up to
-# the user to decide what to do
-sleep 1
-echo -e "\n Default one is 'pico' but you can use other editor of your choice,
- providing it is present on this system."
-CFG_EDITOR="pico"
-fi
-echo
-while [ -z "$EEDITOR" ]
-do
- sleep 1
- echo -n "- Write the name of the text editor you would like to \
- use ["$CFG_EDITOR"]: "
- read EEDITOR
- if [ -z "$EEDITOR" ]; then
- echo -e " No editor specified, defaulting to "$CFG_EDITOR". \n"
- EEDITOR="$CFG_EDITOR"
- fi
-done
-# put it in var
-CFG_EDITOR="$EEDITOR"
-CFG_VARS CFG_EDITOR
-}
-
-CFG_DEFINES () {
-EEDITOR="$CFG_EDITOR"
-
-echo -e "\n Okay, now you will update the directives in defines.h file, changing
- the options you want or your system requires by enabling or disabling
- it's defines. It is an important file where instructions are given to
- create the final executable program.\n
-[ Hit ENTER to start editing. ]"
-read tmp
-# put the file in a TMP for modification comparison
-cp -p source/defines.h $TMP.defines.h
-$EEDITOR source/defines.h
-# if 1 is newer than 2
-if [ source/defines.h -nt $TMP.defines.h ]; then
-CFG_VARS CFG_DEFINES
-CFG_VARS CFG_LAST_REV
-# var to instruct new compilation
-CFG_DEFINES_CHANGED=y
-echo " Changes on defines.h saved!"
-else
-echo " No changes made on defines.h!"
-fi
-sleep 3
-}
-
-CFG_CMDCHAR () {
-while [ -z "$CFG_CMDCHAR" ]
-do
-clear
-echo -e "
-$PNCFG
-* editing SETUP.ini *
-"
-echo -n "- Write the command character (CMDCHAR) your Darkbot should respond to
- or press ENTER to use pre-defined ["$CMDCHAR"]: "
-read CFG_CMDCHAR
- if [ -z "$CFG_CMDCHAR" ]; then
- CFG_CMDCHAR="$CMDCHAR"
- fi
- echo -e "
- Setting command prefix to '"$CFG_CMDCHAR"'...
-
- To change it online use command "$CFG_CMDCHAR"SETCHAR
- "
-done
-sleep 3
-}
-
-CFG_NICK () {
-while [ -z "$CFG_NICK" ]
-do
-clear
-echo "
-$PNCFG
-* editing SETUP.ini *
-"
-echo -n "- Write the nickname (NICK) you would like to use on your Darkbot
- or press ENTER to use pre-defined ["$NICK"]: "
-read CFG_NICK
- if [ -z "$CFG_NICK" ]; then
- CFG_NICK="$NICK"
- fi
- echo -e "\n Setting nick to '"$CFG_NICK"'...\n
- To set it online use the command "$CFG_CMDCHAR"SETNICK \n"
-done
-sleep 3
-}
-
-CFG_USID () {
-while [ -z "$CFG_USERID" ]
-do
-clear
-echo "
-$PNCFG
-* editing SETUP.ini *
-"
-echo -n "- Write the user id (USERID) you would like to use on "$CFG_NICK"
- or press ENTER to use pre-defined ["$USERID"]: "
-read CFG_USERID
- if [ -z "$CFG_USERID" ]; then
- CFG_USERID="$USERID"
-fi
- echo -e "\n Setting user id to "$CFG_USERID"...\n
- To set it online use the command "$CFG_CMDCHAR"SETUSER \n"
-done
-sleep 3
-}
-
-CFG_CHAN () {
-while [ -z "$CFG_CHAN" ]
-do
-clear
-echo "
-$PNCFG
-* editing SETUP.ini *
-"
-echo -n "- Write the default channel (CHAN) "$CFG_NICK" should use
- or press ENTER to use pre-defined ["$CHAN"]: "
-read CFG_CHAN
- if [ -z "$CFG_CHAN" ]; then
- CFG_CHAN="$CHAN"
- fi
- echo -e "\n Setting default channel to "$CFG_CHAN"...\n
- To set it online use the command "$CFG_CMDCHAR"SETCHAN \n"
-done
-sleep 3
-}
-
-CFG_RNAME () {
-while [ -z "$CFG_REALNAME" ]
-do
-clear
-echo "
-$PNCFG
-* editing SETUP.ini *
-"
-echo -n "- Write the 'real name' (REALNAME) info for "$CFG_NICK"
- or press ENTER to use pre-defined one: "
-read CFG_REALNAME
- if [ -z "$CFG_REALNAME" ]; then
- CFG_REALNAME="$REALNAME"
- fi
- echo -e "\n Setting 'realname' to '"$CFG_REALNAME"'...\n"
-done
-sleep 3
-}
-
-CFG_VHOST () {
-while [ -z "$CFG_VHOST" ]
-do
-clear
-echo "
-$PNCFG
-* editing SETUP.ini *
-"
-echo -n "- Write the virtual host (VHOST) you want "$CFG_NICK" to use. (0 = no VHOST)
- Hit ENTER to use pre-defined one ["$VHOST"]:"
-read CFG_VHOST
- if [ -z "$CFG_VHOST" ]; then
- CFG_VHOST="$VHOST"
- fi
- echo -e "\n Setting VHOST to "$CFG_VHOST"...\n
- To change it online use command "$CFG_CMDCHAR"VHOST \n"
-done
-sleep 3
-}
-
-CFG_WRITE_SETUP_INI () {
-clear
-echo -e "\n$PNCFG\n* editing SETUP.ini *\n
-Writing data settings to setup.ini \n Please wait...\n"
-echo "NICK=$CFG_NICK" > dat/setup.ini
-echo "USERID=$CFG_USERID" >> dat/setup.ini
-echo "CHAN=$CFG_CHAN" >> dat/setup.ini
-echo "REALNAME=$CFG_REALNAME" >> dat/setup.ini
-echo "CMDCHAR=$CFG_CMDCHAR" >> dat/setup.ini
-echo "VHOST=$CFG_VHOST" >> dat/setup.ini
-echo "AUTOTOPIC="$AUTOTOPIC"" >> dat/setup.ini
-echo "SEEN="$SEEN"" >> dat/setup.ini
-sleep 3
-CFG_VARS CFG_SETUP_INI
-}
-
-CFG_ADDSERVER () {
-
-_CFG_COUNT_SRV () {
-srv_num_entries="$(cat dat/servers.ini 2>/dev/null | wc -l \
-| tr -cd '[:alnum:]')"
-if [ "$srv_num_entries" = "0" ] || [ -z "$srv_num_entries" ]; then
-srv_entry_s="You have currently NO server entries in your servers.ini file."
-entry_s="entry"
-fi
-ONLY_1_NET="ATTENTION: Make sure you have servers for ONLY 1 network."
-if [ "$srv_num_entries" = "1" ]; then
-srv_entry_s="You have currently "$srv_num_entries" server entry \
-in your servers.ini. file.\n\n
- "$ONLY_1_NET""
-entry_s="entry"
-fi
-if [ "$srv_num_entries" -gt "1" ]; then
-srv_entry_s="You have currently "$srv_num_entries" servers entries \
-in your servers.ini file.\n\n
- "$ONLY_1_NET""
-entry_s="entries"
-fi
-}
-_CFG_COUNT_SRV
-
-_CFG_SRV_MENU () {
-
-clear
-echo -e "
-$PNCFG
-* SERVERS.ini *
-
- "$NICK" needs servers addresses to connect to IRC (as many as you want).
- "$srv_entry_s"
-
- Select one of the following 4 options:
-1) - Write only one server or use the default [irc.freezedown.org] `if [ ! -z \
-"$srv_num_entries" ] && [ "$srv_num_entries" != "0" ]; then \
-echo -e "\n ${lparen}This option will overwrite \
-the existent "$entry_s" on your servers file${rparen}"; fi`
-2) - Use AddServer utility which gives you many options to manage \
-your servers
-3) - Import a servers.ini file from another location
-4) - or hit ENTER to proceed with no changes."
-echo -n "
- [ Type 1, 2, 3 or press ENTER to proceed ] "
-read CHOICE
-}
-
-_ADD_1_SERVER () {
-while [ -z "$SERVER" ]
-do
-
-clear
-echo -e "\n$PNCFG\n* SERVERS *\n
-- Enter the server your Darkbot should connect to [irc.freezedown.org]: "
-read SERVER
-if [ -z "$SERVER" ]; then
-echo -e " No server specified. defaulting to irc.freezedown.org
- You can add servers by running scripts/AddServer
- or by editing dat/servers.ini\n"
-sleep 2
-SERVER=irc.freezedown.org
-PORT=6667
-fi
-done
-while [ -z "$PORT" ]
-do
-echo -n "- Enter the port to connect to on $SERVER [6667]: "
-read PORT
-if [ -z "$PORT" ]; then
-echo -e " No port specified, defaulting to 6667\n"
-sleep 2
-PORT=6667
-fi
-done
-
-if [ ! -z "$SERVER" ] || [ ! -z "$PORT" ]; then
-echo -e "\nWriting data settings to servers.ini ....."
-sleep 2
-echo "$SERVER $PORT (Added: `date`)" > dat/servers.ini
-fi
-}
-
-# START SRV GROUP FUNCTION
-while [ -z "$srv_done" ] || [ "$srv_num_entries" = "0" ] || [ -z "$srv_num_entries" ]; do
-_CFG_SRV_MENU
-
-if [ "$CHOICE" = "1" ]; then
-unset srv_done
-_ADD_1_SERVER
-srv_done="y"
-_CFG_COUNT_SRV
-fi
-
-if [ "$CHOICE" = "2" ]; then
-unset srv_done
- if [ -s "scripts/AddServer" ]; then
- cd scripts
- ./AddServer
- cd ..
-else echo "#### ERROR #### UTILITY NOT INSTALLED"; sleep 2
- fi
-srv_done="y"
-_CFG_COUNT_SRV
-fi
-
-if [ "$CHOICE" = "3" ]; then
-unset srv_done
-echo -n "
-Write the complete path of servers.ini file to import.
-EX: `pwd`/dat/servers.ini : "
-read CFG_IMPORT_SRVINI
-if [ ! -z "$CFG_IMPORT_SRVINI" ]; then
- if [ "`echo "$CFG_IMPORT_SRVINI" | grep 'servers.ini$'`" ]; then
- cp -f "$CFG_IMPORT_SRVINI" "`pwd`/dat/servers.ini"
- else
- echo "#### ERROR #### Invalid servers.ini file!"
- fi
-sleep 2
-else
-echo "#### INVALID ENTRY ####"
-sleep 2
-fi
-srv_done="y"
-_CFG_COUNT_SRV
-fi # end of CHOICE 3
-
-if [ "$CHOICE" = "4" ] || [ "$CHOICE" = "" ]; then
-unset srv_done
-if [ "$srv_num_entries" != "0" ] && [ ! -z "$srv_num_entries" ]; then
-echo -n "
-Bypassing servers configuration..."; sleep 1
-fi
-srv_done="y"
-fi
-
-_CFG_COUNT_SRV
-if [ "$srv_num_entries" = "0" ] || [ -z "$srv_num_entries" ]; then
- echo -n "
-## WARNING #########################################################
-## You need to have at least one server in your servers.ini file! ##
-######################################################################"
-sleep 3
-fi
-
-done # END OF SRV GROUP FUNCTION
-}
-
-CFG_ADDUSER () {
-while [ "$usr_num_entries" = "0" ] || [ -z "$usr_num_entries" ]; do
-
-_CFG_COUNT_USR () {
-usr_num_entries="$(cat dat/userlist.db 2>/dev/null | wc -l \
-| tr -cd '[:alnum:]')"
-if [ "$usr_num_entries" != "0" ] || [ -z "$usr_num_entries" ]; then
-usr_entry_s="You have currently NO user entries in your userlist.db file."
-entry_s="entry"
-fi
-if [ "$usr_num_entries" = "1" ]; then
-usr_entry_s="You have currently "$usr_num_entries" user entry in \
-your userlist.db file."
-entry_s="entry"
-fi
-if [ "$usr_num_entries" -gt "1" ]; then
-usr_entry_s="You have currently "$usr_num_entries" users entries in \
-your userlist.db file."
-entry_s="entries"
-fi
-}
-_CFG_COUNT_USR
-
-
-clear
-echo -e "
-$PNCFG
-* USERLIST.db *
-
- "$NICK" needs at least one user as Darkbot administrator.
- "$usr_entry_s"
-
- Select one of the following 4 options:
-1) - Add yourself or someone else as administrator `if [ ! -z \
-"$usr_num_entries" ] && [ "$usr_num_entries" != "0" ]; then \
-echo "\n ${lparen}This option will overwrite \
-the existent "$entry_s" on your user list file${rparen}"; fi`
-2) - Use AddUser utility with several options to manage "$NICK"'s users
-3) - Import a userlist.db file from another location
-4) - or hit ENTER to proceed with no changes."
-echo -n "
- [ Type 1, 2, 3 or press ENTER to proceed ] "
-read CHOICE
-
-_ADD_1_USER () {
-while [ -z "$ADDUSER" ]
-do
-
-clear
-echo -e "\n$PNCFG\n* USERS *\n
-The format of the user@host is *userid@*.host.isp
- Examples:
- *jason@*.superlink.net <-- dyanmic ip
- *mtr@darkmind.eclipse.net <-- static host
- *darkmind@204.127.145.* <-- unresolved host\n
-- Enter the *user@host of the administrator you'd like to add: "
-read ADDUSER
-if [ -z "$ADDUSER" ]; then
-echo -e " No *user@host specified. Changing to AddUser utility.\n"
-ADDUSER=none
-else
-echo -e " Writing data to userlist.db ..."
-sleep 1
-echo "#* $ADDUSER 3 0 0 I need to use SETINFO" > dat/userlist.db
-echo -e "
- Added to "$NICK"'s userlist.db file as administrator \
-(level 3) hostmask:
-\"$ADDUSER\". Default password is 0 (zero).
- To set your new encrypted password online write:
- /msg "$NICK" pass 0 New_Password (then /msg "$NICK" login New_Password)
- "
-echo -n "[ Hit ENTER to continue ]"
-read PTR
-fi
-done
-}
-
-if [ "$CHOICE" = "1" ]; then _ADD_1_USER; _CFG_COUNT_USR; fi
-
-if [ "$CHOICE" = "2" ]; then
- if [ -s "scripts/AddUser" ]; then
- cd scripts
- ./AddUser
- cd ..
- else echo "#### ERROR #### UTILITY NOT INSTALLED;"; sleep 2
- fi
-_CFG_COUNT_USR
-fi
-
-if [ "$CHOICE" = "3" ]; then
-echo -n "
-Write the complete path of userlist.db file to import.
-EX: `pwd`/dat/userlist.db : "
-read CFG_IMPORT_USRLST
- if [ ! -z "$CFG_IMPORT_USRLST" ]; then
- if [ "`echo "$CFG_IMPORT_USRLST" | grep 'userlist.db$'`" ]; then
- cp -f "$CFG_IMPORT_USRLST" "`pwd`/dat/userlist.db"
- else
- echo "#### ERROR #### Invalid userlist.db file!"
- fi
- sleep 2
- else
- echo "#### INVALID ENTRY ####"
- sleep 2
- fi
-fi # end of CHOICE 3
-
-if [ "$CHOICE" = "4" ] || [ "$CHOICE" = "" ]; then
-_CFG_COUNT_USR
-if [ "$usr_num_entries" != "0" ] && [ ! -z "$usr_num_entries" ]; then
-echo "
-Bypassing user list configuration..."; sleep 1
-fi
-fi
-if [ "$usr_num_entries" = "0" ] || [ -z "$usr_num_entries" ]; then
- echo "
-## WARNING ###############################################################
-## You need to add at least one administrator in your userlist.db file! ##
-############################################################################"
-sleep 3
-fi
-done
-}
-
-
-CFG_MENU () {
-clear
-while [ -z $QUITIT ]
-do
-
-echo -e "\n$PNCFG\n* Darkbot configuration menu *\n
-
- 1) Setup deop.ini and perform.ini files
- 2) Read the README files
- 3) Quit configuration"
-echo -n "
-Select one: "
-read CHOICE
-case $CHOICE in
- 1)
- clear
- echo -e "
- * Darkbot configuration menu *
-
-
- The .ini's are all in RAW format... so when you
- want the bot to MSG your channel \"hello!\", you'd
- have to enter something like:
-
- PRIVMSG $CHAN :hello!
-
- (Note the :colon after $CHAN, it is required)
- Check http://help.darkbot.info for examples
-
- The first .ini you will need to setup, is the perform.ini.
- Perform list is a set of commands you'd like your Darkbot
- to do when it connects online. This can range from /msging
- the channel service login commands (so your Darkbot can
- auto get ops), to /joining other channels....
- You can later modify this list by editing the perform.ini
-
-
- [ Hit ENTER to begin editing your perform.ini ]"
- read x
- $CFG_EDITOR dat/perform.ini
- clear
- echo -e "\n* Darkbot configuration menu * \n\n
- Okay, next is the deop.ini, the format is the same as
- perform.ini. What deop.ini is, is a list of commands
- you would like your darkbot to do, when it finds itself
- deoped in $CHAN. This can range from /msging $CHAN OP ME!
- to using other bots/channel services to regain ops.
-
-\n[ Hit ENTER to begin editing your deop.ini ]"
- read x
- $CFG_EDITOR dat/deop.ini
- clear
- ;;
- 2)
-clear
-echo -e "\n$PNCFG\n* reading documents *\n\n
- First take a look at the README file...
- (use arrow keys to scroll and press Q when you are done)
- \n[ Hit ENTER to continue ]"
- read PTR
- cat README.txt | less -deXF
- clear
-echo -e "\n$PNCFG\n* reading documents *\n\n
- You should take a look also on README_UTILS file...
- (use arrow keys to scroll and press Q when you are done)
- \n[ Hit ENTER to continue ]"
- read PTR
- cat docs/README_UTILS | less -deXF
- clear
-echo -e "\n$PNCFG\n* reading documents *\n\n
- Check out what is new in Darkbot!
- (use arrow keys to scroll and press Q when you are done)
- \n[ Hit ENTER to continue ]"
- read PTR
- cat docs/WHATSNEW | less -deXF
- clear
-echo -e "\n$PNCFG\n* reading documents *\n\n
- Finally, be aware of who makes this program possible.
- (use arrow keys to scroll and press Q when you are done)
- \n[ Hit ENTER to continue ]"
- read PTR
- cat docs/contributors.txt | less -deXF
- ;;
- 3)
- clear
- echo -e "\n$PNCFG * end of configuration *"
- if [ ! -e "darkbot" ]; then
- echo -e "\nThere is no darkbot binary present.
- You'll need to compile the code for Darkbot to run."
- else
- # if defines.h were changed
- if [ -n "$CFG_DEFINES_CHANGED" ]; then
- echo -e "\nYour changes made on defines.h file will only take
-effect after compiling the code!"
- fi
- sleep 1
- fi
-echo "
- Darkbot is ready to compile.
- If you get any error during compilation process recheck
- the changes you made on defines.h reading the comments
- next to each directive, starting at 'SYSTEM REQUIREMENTS'.
-
- In case you run into problems, type 'make clean' then 'make
- debug' following it's instructions and if Darkbot crashes
- type 'backtrace' to find out exactly why it happened.
-
- If you need further assistance use the support forum at
- http://www.freezedown.org/forum providing detailed information.
-
- Linux/BSD/Unix users type: make
- Windows users type: make win
- "
- sleep 1
- QUITIT=yes
- ;;
- *)
- echo
-
-if [ "$CHOICE" != 1-3 ]; then echo "That's not a valid selection. \
-Select 1 or 2. 3 to quit."; fi
- sleep 1
- echo
- clear
- ;;
- esac
-done
-}
-
-DB_REV () {
-unset cfg_dbrev
-cfg_dbrev="$(grep -r obkra sou*/*va*c|rev|tac|cut -d \" -f2|head -n1)"
-if [ -z "$cfg_dbrev" ]; then cfg_dbrev=Darkbot; fi
-}
-
-START_CFG () {
-# if there are no vars means didn't run before so do it all
-ENVIRONMENT
-DB_REV 2>/dev/null
-CFG_INTRO
-if [ -z "$CFG_EDITOR" ]; then
-CFG_EDITOR
-else
-clear
-echo "
-$PNCFG
-* Text Editor *
-
-Looks like you have already chosen your default text editor.
-Do you want to choose another one instead of '"$CFG_EDITOR"'?
-"
-echo -n "[ Type Y if you want to select another one or hit ENTER to proceed ] "
-read EditorChoice
- if [ "$EditorChoice" = "y" ] || [ "$EditorChoice" = "Y" ]; then
- CFG_EDITOR
- else
- echo "
- Bypassing editor choice..."; sleep 1
- fi
-fi
-
-if [ -z "$CFG_DEFINES" ]; then
-CFG_DEFINES
-else
-clear
-echo "
-$PNCFG
-* DEFINES.h *
-
-Do you want to edit your directives on defines.h again?
-"
-echo -n " [ Type Y if you want to edit defines.h or hit ENTER to proceed ] "
-read DefinesChoice
- if [ "$DefinesChoice" = "y" ] || [ "$DefinesChoice" = "Y" ]; then
- CFG_DEFINES
- else
- echo "
- Bypassing defines.h editing..."; sleep 1
- fi
-fi
-# SETUP.INI -------------------
-CFG_SETINI () {
-CFG_CMDCHAR; CFG_NICK; CFG_USID; CFG_CHAN; CFG_RNAME; CFG_VHOST
-CFG_WRITE_SETUP_INI
-}
-if [ -z "$CFG_SETUP_INI" ]; then
-CFG_SETINI
-else
-clear
-echo "
-$PNCFG
-* SETUP.ini *
-
-This utility records show you have edited already your setup.ini file.
-Do you want to change some settings?
-"
-echo -n "[ Type Y if you want to edit setup.ini again or hit ENTER to proceed ] "
-read SetupChoice
- if [ "$SetupChoice" = "y" ] || [ "$SetupChoice" = "Y" ]; then
- CFG_SETINI
- else
- echo "
- Bypassing setup.ini configuration..."; sleep 1
- fi
-fi
-CFG_ADDSERVER
-CFG_ADDUSER
-CFG_MENU
-}
-START_CFG
-exit 0
diff --git a/beta/darkbot-8rc2-CVS-SNAPSHOT.tar.gz b/darkbot-8rc2-CVS-SNAPSHOT.tar.gz
similarity index 100%
rename from beta/darkbot-8rc2-CVS-SNAPSHOT.tar.gz
rename to darkbot-8rc2-CVS-SNAPSHOT.tar.gz
diff --git a/dat/random.ini b/dat/random.ini
index c9e2efd..577eedc 100755
--- a/dat/random.ini
+++ b/dat/random.ini
@@ -1,22 +1,22 @@
/* This is the random prefix said before answering a
/* question that uses no variables.
/* Put a space after each reply line...
/*
/* Nick = ^
/* Bold = %
/* Underline = &
/* Inverse = ~
-/*
+/*
hmmmmm... ^,
well, ^%:%
^ I think
heh&,&
^ heh,
^: well,
welp... ^:
&(&^&)&%:%
%[%^%]%
^:
^
~(^)~
%=%^%=%:
diff --git a/dat/servers.ini b/dat/servers.ini
index 2f43b12..e841a3a 100755
--- a/dat/servers.ini
+++ b/dat/servers.ini
@@ -1 +1,3 @@
+# Freezedown "Darkbot" Server
irc.freezedown.org 6667 nopass
+
diff --git a/dat/setup.ini b/dat/setup.ini
old mode 100755
new mode 100644
index 3b34d0e..a2141e7
--- a/dat/setup.ini
+++ b/dat/setup.ini
@@ -1,8 +1,62 @@
-NICK=Darkbot
-USERID=database
-CHAN=#darkbot
-REALNAME=Get info about me at http://www.freezedown.org
-CMDCHAR=!
-VHOST=0
-AUTOTOPIC=0
-SEEN=0
+ANTI_IDLE=0
+BITCH_DEOP=0
+BITCH_DEOP_TEXT=grr, someone op me!
+BITCH_KICK_TEXT=grrr, kick me again and I'm going to...
+BOT_CMD_CHAR=!
+BOT_NICK=Darkbot
+BOT_NAME=http://www.freezedown.org
+BOT_USER_ID=database
+BOT_USER_MODE=+i-ds
+BOT_VHOST=0
+CONNECT_TIME=10
+DEFAULT_CHANNEL=#darkbot
+DISPLAY_SYNC=0
+DO_WHOIS=0
+DUNNO_TEXT=*shrug*
+DUNNO_RANDOM_TEXT=1
+DUPS_REMOVE=0
+DUPS_SAVE=1
+ENTRY_EXISTS_TEXT=Sorry, there is an existing entry under keyword
+ENTRY_NOT_EXIST_TEXT=I was unable to find entry:
+FIND_NO_TEXT=Sorry, I don't have any entry for
+FIND_WHAT_TEXT=What am I trying to find
+FLOOD_NOTICE_KICK=1
+FLOOD_NOTICE_BAN=0
+FLOOD_NOTICE_BAN_HOST=0
+FLOOD_KICK=1
+FLOOD_TEXT=Don't flood!
+GREET_GUESTS_TEXT=0
+GREET_NEW_TEXT=0
+GREET_USER_TEXT=1
+IGNORE_TIME=5
+IGNORE_USER_TIME=60
+KICK_TEXT=Requested!
+KICK_ON_BAN=0
+LOG_CHANGES=1
+LOG_PRIVATE=1
+OP_ON_LOGIN=0
+OUTPUT1_COUNT=4
+OUTPUT1_TIME=1
+OUTPUT2_COUNT=6
+OUTPUT2_TIME=2
+OUTPUT_PURGE_COUNT=7
+OUTPUT3_TIME=3
+PERFORM_TIME=1
+QUESTIONS_GENERAL=1
+QUESTIONS_PRIVATE=0
+RANDOM_BACKUP=0
+RANDOM_IDLE_TIME=1800
+RANDOM_TIME=3600
+SEEN_MODE=1
+SEEN_TIME=604800
+SEEN_TEXT=in the last 7 days.
+SETINFO_TEXT=My !setinfo variables are: ^ nick, % Number of joins, & Channel, $ user@host. Example: !setinfo ^ has joined & % times!! (also, if you make the first char of your SETINFO a "+" the setinfo will be shown as an ACTION)
+SLEEP_TIME=300
+SLEEP_TEXT=ACTION falls asleep... ZzzZZzzZZzz
+SLEEP_WAKE_TEXT=ACTION wakes up from a snooze..
+SORT_DB=0
+TOPIC_TIME=1800
+VARIABLES_TEXT=Data variables are: N~ (Nick), C~ (Chan), T~ (Time/date) B~ (Botnick), Q~ (Question asked), R~ (random nick), !~ (command char), S~ (current Server), P~ (current port) V~ (botVer), W~ (db WWW site), H~ (u@h), t~ (unixtime), BAN (sets a ban), TEMPBAN (bans for 60 sec)
+VOICE_ON_JOIN=0
+WHUT_TEXT=hmmm?
+WHUT_RANDOM_TEXT=1
diff --git a/dat/userlist.db b/dat/userlist.db
old mode 100755
new mode 100644
index 5cc1f4f..99cc1b2
--- a/dat/userlist.db
+++ b/dat/userlist.db
@@ -1 +1,5 @@
-#* *jason@*.superlink.net 3 0 password I haven't used SETINFO yet!
+#* *juice@*.dhcp.embarqhsd.net 3 1 password I haven't used !SETINFO yet!
+#* *dvs1@58.165.* 3 278 password How's it hangin' ^, welcome to &.
+#* *dvs1@124.176.* 3 278 password How's it hangin' ^, welcome to &.
+#* *dvs1@124.109.* 3 278 password How's it hangin' ^, welcome to &.
+#* *dvs1@202.155.* 3 278 password How's it hangin' ^, welcome to &.
diff --git a/beta/distribute.sh b/distribute.sh
similarity index 100%
rename from beta/distribute.sh
rename to distribute.sh
diff --git a/beta/docs/AUTHORS b/docs/AUTHORS
similarity index 100%
rename from beta/docs/AUTHORS
rename to docs/AUTHORS
diff --git a/beta/docs/HACKING b/docs/HACKING
similarity index 100%
rename from beta/docs/HACKING
rename to docs/HACKING
diff --git a/beta/docs/INSTALL b/docs/INSTALL
similarity index 100%
rename from beta/docs/INSTALL
rename to docs/INSTALL
diff --git a/docs/INSTALL.txt b/docs/INSTALL.txt
deleted file mode 100755
index 3b6bbc9..0000000
--- a/docs/INSTALL.txt
+++ /dev/null
@@ -1,525 +0,0 @@
- ##################################################################################
-
- Darkbot, Talking Robot - Copyright (c) 2006 Darkbot Project
-
- Welcome to the Darkbot install file. This will be a step by step guide to
- installing your Darkbot, so read it all, before you do anything.
-
- If you have not read this file and come into the help channel on the Darkbot
- Network, we will know, and it might mean you will be helped last.
-
- With that out of the way, if you have done every thing in this file and still
- can not get your Darkbot running, feel free to join #Darkbot on the Darkbot
- Network, and we will do our best to help you. Keep in mind that we are not
- there to set up and run your bot for you. One or two questions about commands
- are okay, but if you have to ask about every command, then maybe you shouldn't
- be running a bot.
-
- Note: There are many builds of Linux out in the world today. The coders try and
- build Darkbot to be run on as many as possible but some times it doesn't work
- out that way. If there is a problem with compiling Darkbot on your Linux build,
- please let us know.
-
- Help can be found for Darkbot either by irc, or from our web page.
-
- Irc: Servers irc.freezedown.org, eu.undernet.org, us.undernet.org
- Channel: #darkbot
-
- Web page: http://www.freezedown.org Forum: http://www.freezedown.org/forum/
-
- We do not support any Darkbot code that has been downloaded from any site other
- then the official one. Any code that has been modified by anyone other than an
- official Darkbot coder, will also not be supported. (If you have a good idea
- for a modification, please share it with us. If it makes the final code, you
- will be given credit.)
-
- ###############################################################
-
- Follow the order of events described here, and you'll have your Darkbot up and
- running!
-
- DOWNLOAD
- Download to your shell compressed archive from
- http://www.freezedown.org/
-
- INSTALLATION
- De-compress the downloaded archive (tar -zxvf *.tar.gz)
-
- tar -zxvf darkbot-6f6.tar.gz
-
- - Change to the newly created directory
-
- Note: For older Darkbots, this dir will be (darkbot6f6), for new or beta builds,
- it will be (darkbot)
-
- cd darkbot6f6 or cd darkbot
-
- BASIC CONFIGURATION
-
- Starting configuration process.
- ./configure
-
- You do need to run ./configure - Darkbot does not build itself into your system
- without that step.
- We are not going into detail and repeating the instructions shown when you run
- ./configure, because they are self-explanatory.
- Most of the doubts and frequently asked questions on that, only rely on Linux,
- and not Darkbot matters. For instance, the default text editor is pico, but you
- can use any other text-mode editor that comes with your distribution, like vi,
- less, Emacs, XEmacs, NEdit or others. "That stripping thing" on the end of
- compilation process - it shrinks a little bit the size of the executable, and
- some extra and non necessary codes are removed; makes no difference on Darkbot's
- performance, so do whatever you want with it.
-
- At any point during the configuration process you can abort (by pressing CTRL +
- C or other way your system or editor allows) and start again.
- If for some reason you have an error and the compilation process is not
- completed, correct the error and after saving your changes type 'make'.
- If you want to run Darkbot after answering 'no' to run on the end of
- compilation process just type './darkbot'.
-
- Have this in mind: Darkbot should work if you follow ./configure instructions.
- So, if isn't working, try again and read those carefully.
- If you want to personalize more or change specific items to your Darkbot after
- ./configure you have two choices: run 'configure' again or you can edit the
- files. All files on darkbot\dat\ are offline hand editable and all have basic
- syntax examples in it. Do not leave empty lines and disconnect your Darkbot from
- IRC before editing configuration files.
-
- OFFLINE CONFIGURATION SETTINGS
- (follow the samples in the files and don't leave any empty lines)
- How to do it.
-
- [userlist.db]
- Adding users to Darkbot's user list.
- Open darkbot\dat\userlist.db and check this sample line: '#*
- *user@*.yourhostmask.com 3 0 mypass I need to use SETINFO' with your
- information.
-
- #* = (with asterisk) adds user to all channels; #channel1 adds user to channel1
- *user@*.yourhostmask.com = is the mask of the user to add
-
- 3 = user level -- You should always be Darkbot's administrator (level 3) on your
- darkbot\dat\userlist.db [Level 3 is the highest, allows you to control all
- Darkbot functions; level 2 gives access to channel operation commands plus level
- 1 commands; level 1 only permits to manage Darkbot's database - it's the so
- called helper level; all other commands are public, meaning everyone can perform
- them].
-
- 0 = number of times Darkbot saw that user on the default channel
-
- mypass = If you want to define a password for you can do it replacing 'mypass'
- with user's one.
-
- 'I need to use SETINFO' = is a message Darkbot sends to newly registered users
- in order to remind them to define or not it's greeting message. Leave it as is
- or write, for example, "Hi Boss ;)". You can also replace 'setinfo' message with
- a 0 (zero) to disable it.
-
- (You can add more users from online with the !adduser command or delete with the
- !deluser command)
-
- [setup.ini]
- Open darkbot\dat\setup.ini.
- This is the file you need to edit to setup your Darkbot's nickname, username,
- realname, default channel to join, virtual host, command character prefix and
- seen users switch. Change the contents of the file as you need overwriting
- existing parameters. Do not remove anything before '='. Do not leave extra
- spaces or lines. Do not use carriage returns. Save and exit.
-
- Obs.:
- 'VHOST= ' to set your virtual host (must be a registered domain pointed to the
- same computer as Darkbot and configured for IRC)
-
- 'CHAN=#ChannelHere' sets Darkbot's default channel. If you want to add
- more channels use perform.ini.
-
- 'CMDCHAR= ' to set Darkbot's command prefix to trigger most of it's commands.
-
- 'NICK='This is the nick your bot will have when it joins irc, default is Darkbot
-
- 'USERID='This will be the name before the @ in the bots user host
-
- 'REALNAME=' This will be the info after your bots user host
-
- 'AUTOTOPIC='Automatically cycles channel's topic every 30 minutes. To turn
- autotopic off, use "0" (zero) in place of the topic.
-
- 'SEEN='Turns seen on or off. 1= on, 0= off
-
- [perform.ini]
- Having Darkbot performing IRC commands automatically.
- You can make Darkbot perform a list of raw IRC commands when it connects to the
- server (as mIRC's perform function). You can make your Darkbot join other
- channels, perform mode changes, login to channel services with it. Depending on
- each network, your IRC knowledge and your imagination depends the commands you can
- add.
- Open and edit darkbot\dat\perform.ini. Write one command per line.
-
- Examples:
- - to join an additional channel besides default one
- JOIN #Channel_here
-
- - to set modes
- MODE #Channel +nt
-
- - to set a topic as soon as enters a channel
- TOPIC #Channel_here :this is a test topic
-
- - to send a message to you as soon as it connects
- PRIVMSG YourNick :hey... I'm here
-
- - to send a notice to you
- NOTICE YourNick :be ready to feed me :p
-
- - to authenticate on Superchat.org
- PRIVMSG serv@superchat.org :login #darkbot blahblah
-
- - to authenticate on Undernet's CService
- PRIVMSG x@channels.undernet.org :login username password
-
- - to have bot X giving op to your Darkbot
- PRIVMSG X :op #channel_here username
-
- - to login and get Ops on a eggdrop
- PRIVMSG Eggdrop_nick :op password #channel
-
- General rule to send raw IRC messages is preceding the message with ':'. However
- there are situations where you might be able to perform commands without it.
-
- - to identity your Darkbot on some servers
- NICKSERV IDENTIFY darkbot_password
-
- - for some channel services
- CHANSERV OP #channel_here Darkbot
-
- [deop.ini]
- Changing Darkbot's behavior when is not Op.
- You can have your Darkbot perform commands when it loses channel Op like messaging
- you, automatically asking Op to the channel service or another bot or Ops. Open
- and edit darkbot\dat\deop.ini. Check the examples below. Leave this file blank
- if you want it to do nothing. (see also examples used on perform.ini)
-
- PRIVMSG #channel_here :Hmm, wish I had ops...
-
- NOTICE Your_nick : I lost Ops :(
-
- PRIVMSG x@channels.undernet.org :login username password
-
- PRIVMSG X :op username
-
- PRIVMSG serv@superchat.org :login #darkbot blahblah
-
- chanserv op #channel_here Darkbot
-
- PRIVMSG Eggdrop_nick :op password #channel
-
- [servers.ini]
- Changing or adding servers to Darkbot.
- By default Darkbot connects to one of UnderNets servers
- us.undernet.org 6667
- eu.undernet.org 6667
-
- Open and edit darkbot\dat\servers.ini. You can list as many servers as you want,
- so if it's disconnected, it'll switch to others. Do not leave empty lines. Do
- not mix servers, like us.undernet.org and dal.net. Save and exit.
-
- GOING ONLINE
-
- Write on your shell './darkbot' in order to have it connect to the Internet.
- Wait a little bit and if you didn't change servers.ini in order to use another
- network, Darkbot will join channel #Darkbot at Undernet.org. (To join this
- network type in your IRC client /server us.undernet.org and /join #darkbot)
- If you did change the servers.ini and the CHAN= in the setup.ini then Darkbot
- will join that server and channel that you set there.
- If another nick Darkbot is already there, your Darkbot will take nick Darkbot0,
- Darkbot1 etc. (You can see which one is yours by doing /whois and looking at the
- output info. It will have the same hostmask as yours or the machine where it is
- running).
-
- You can have Darkbot jump to another server by performing !JUMP command.
-
- Setting or changing the password to access Darkbot (25 characters maximum). If
- you didn't change 'mypass' on userlist.db write
- /msg Darkbot pass mypass my_new_pass.
-
- After changing it you'll receive a notice like this:
- -- Password for youruserid@yourhostmask.com has been updated.
-
- Login to Darkbot:
- Now you have to authenticate yourself to Darkbot to perform some commands. To do
- so type
- /msg Darkbot LOGIN YourPass
- You'll receive a notice like this from Darkbot:
- -- Verified: #darkbot[3]
-
- Notes: have in mind - for security reasons - if you or Darkbot leaves the channel
- you have to login again when returning.
-
- ONLINE ADDITIONAL CONFIGURATION SETTINGS
-
- Set greeting message
-
- If you want Darkbot to greet you when you join the channel and you didn't
- already edit it in the userlist.db 'I need to use SETINFO' type, for example,
- !SETINFO I think I know you ;P
-
- (!setinfo 0 disables the function; typing !setinfo without any parameters gives
- you some help about the command)
- Next time you join the channel Darkbot will greet you with that mesage.
-
- Set Darkbot's nick name
- In order to have Darkbot with a nick you like, you only need to type,
- !SETNICK MyDarkbot
-
- Set userid
- If you want to change Darkbot's user id type,
- !SETUSER newuserid
-
- Set default channel
- To instruct Darkbot what channel must be the default one, type,
- !SETCHAN #YourChannel
-
- Set Command Character
- If you want to change the default command prefix [ ! ] issued to Darkbot to
- execute some commands and, for instance, you want to use command character '>'
- type,
- !SETCHAR >
-
- Set auto topic
- Auto-topic function makes Darkbot repeat channel's topic you specify every 30
- seconds (default). To do so type, for example,
- !AUTOTOPIC Visit http://www.freezedown.org for complete Darkbot
-information.
-
- Set virtual host
- If you want to set a virtual host to Darkbot type (must be a registered domain
- pointed to the same computer as Darkbot and configured for IRC)
- !VHOST your.vhost.com
-
- --**--
- The remaining files within the \dat folder can also been edited offline. info2.db
- (stores topics and corresponding replies), randomstuff.ini (stores random
- replies), seen.db (stores the list of users seen by Darkbot) and perbans.db
- (stores permanent bans)
-
- START ADDING TOPICS
-
- As all commands in this document YOU MUST LOGIN (/msg BotNick LOGIN yourpass)
- before you can execute any Darkbot's command)! Also, you need to read the complete
- command list document where you find a more detailed explanation about each one.
- This is only a superficial help file to get you to add, modify and delete basic
- topic replies.
-
- Login to your Darkbot
- Type:
- YourBotNick ADD hello hello N~
- (now type 'hello' and Darkbot will reply 'Hello YourNick')
-
- Type:
- YourBotNick MODIFY hello Hi N~, thanks for coming to C~
- (now type 'hello' and the Darkbot's reply was modified to 'Hello YourNick,
- thanks for coming to #YourChannel')
-
- Type:
- YourBotNick DELETE hello
- (Darkbot deletes the topic 'hello'. If you type hello he don't answer)
-
- YOU MUST READ
-
- Darkbots Commands List and all help documents. This is only a short
- file to get your Darkbot up and running.
- ------------------ " -------------------
-
- OTHER FILES
-
- info2.db - This is the information your darkbot learns and replys to when asked
- questions. It's the main database.
- A topic can be more than one word, but will be separated with +'s instead of
- spaces. If a data starts with a +, the reply will be in the form of an action.
- If the data starts with a -, the output can be stacked using PIPES and you can
- use raw data, to do things such as NOTICE, PRIVMSG and even KICK. The symbol "^"
- is the $nickname variable. The ^R (reverse control char) is the $chan variable.
- While this may seem a bit confusing... don't worry about it, It's very simple,
- just hard to explain in words without SHOWING you the bot in action.
-
- randomstuff.ini - List of random things to say. You can add more online by
- saying: BotNick RANDOMSTUFF information to add.
-
- permbans.db - This is a text file, just a .db (database) file name extension.
- Use the !PERMBAN and !DELBAN commands from on-line to add\delete.
-
- seen.db - This is a list of people your bot has seen. You can access it with
- !SEEN , seen's over one week old are deleted.
-
- SOMETHING WRONG
- All suggestions here are proved to work on several linux flavors and several
- machines. Although we believe there are no side effects to your computer or to
- yourself in doing it, follow them at your own risk. Do not blame your Darkbot in
- case he decides not answering you.
-
- (A) - Before proceed:
- - Turn off your Darkbot by issuing command 'kill' (do ps x to see Darkbot's
- process id and kill -9 pidNumber or killall darkbot)
-
- (B) - Always make a backup of the file you want to work with before any change
- or make a copy of Darkbot's folder using command 'cp'. Leave the file or 'Copy
- of darkbot' as a safe backup in case you need to restore a file, you already have
- it.
-
- (C) - Use linux text editors if you can to edit Darkbot files. If you can't use
- another text editor; the one you are using might be adding hidden codes or
- changing the format of the original files. Check if file extension is the same.
- For instance, if you are using Windows Notepad and file userlist.db extension
- after editing and saving is userlist.db.txt rename it to userlist.db.
-
- (D) - Do not leave empty lines on the middle of others or on the end of the
- text.
-
- ============================
-
- A Few F.A.Q's
-
- I can't read and edit some files that have kind of strange black squares. Is
- that Code Black virus?
- -Darkbot is done in a way that is very safe in all aspects not only on IRC but
- also on it's invulnerability to virus or trojans. So no, it's not any virus or
- nothing like that. Those are codes left by your editor when tabs and carriage
- returns are used. Looks like you are editing those files in Windows so use
- Wordpad. You can also use Notepad but in some files you need to reconstruct the
- lines in a way of having each command line on a separated line. Never leave
- empty lines.
-
- My Darkbot don't connect at all.
-
- - Run Darkbot with minimal configuration (no hand editing at all) to see if
- connects to Undernet.org and goes to channel #darkbot. If you go there, Darkbot
- should react with a short answer if you write it's nick.
-
- - if not, install Darkbot again from the original compressed file. If problem
- persists your original compressed Darkbot file or some of it's contents might be
- corrupted so download it again from Darkbot's official site.
-
- My Darkbot don't recognizes me when I /msg Darkbot login mypassword.
-
- - After following procedures on (A) add yourself to darkbot\dat\userlist.db -
- Save and exit - Connect Darkbot again and try to /msg Darkbot login
- yourpassword.
-
- - if Darkbot notices you as accepting your login, write on the public window
- 'Darkbot add test 123'. Darkbot should answer 'Okay'. Write 'test'. Darkbot
- should answer '123'.
-
- - if not, follow procedures on A, B, C and D.
-
- - if Darkbot is still not accepting your login
- - Open your darkbot\dat\userlist.db
- On the sample line '*user@*.yourhostmask.com 3 0 mypass I need to use SETINFO'
- You only need to overwrite *user@*.yourhostmask.com and 'mypass' in order to get
- your Darkbot online and access to it.
- The mask *user@*.yourhostmask.com should match the one you have when you connect
- to the same network where your Darkbot is (do /whois to_ yournick to compare
- it). You must use a wildcard * on all portions of the mask that change in every
- time you connect. General concept is you should substitute all changing items on
- your mask with an asterisk (*).
-
- - While connected do /whois YourNickHere and check the first line of the output.
-
- On the userid/ident side (the one on the left of @) you must use one * right
- before of it on your userlist.db entry. If that ident has a leading ~ don't use
- it. ~myident@blah.blah.blah or myident@blah.blah.blah should go to userlist as
- *myident@blah.blah.blah. If your ident changes at times (some characters are
- missing like this ~myid@blah.blah.blah) on the right side, right before @, use
- the wildcard on both ends, i.e., *myid*@blah.blah.blah.
- On the IP address side, right of @, compare what you have with the examples
- bellow.
-
- Static IPs (never changes):
-
- - if your IP looks like this: myident@myhost123.mydomain.com
- you shoud add as *myident@myhost123.mydomain.com
-
- - if your IP looks like this: myident@11.222.12.123
- you should add as *myident@11.222.12.123
-
- Dynamic IPs (changes with each connection):
-
- - if your IP looks like this: myident@myhost123.mydomain.com and the portion
- that changes for every connection is '123'
- you'll add *myident@myhost*.mydomain.com
-
- - if your IP looks like this: myident@11.222.12.123 if the portion that changes
- for every connection is 12.123 you'll add *myident@11.222.*
-
- My Darkbot don't connect to the servers I want.
- Write on darkbot/scripts directory ./AddServer and follow instructions
- or
- - follow procedures on A, B, C and D.
-
- - open servers.ini and remove the servers in there adding those you would like
- Darkbot to connect to. Syntax must be .irc.server.here 6667' and NOT
- irc.server.here:6667' . Save and connect.
-
- My Darkbot is not giving me the greeting message (setinfo).
- Darkbot ignores whoever rejoins a channel for a period of time. The default
- length of time to not recount someone when rejoins the channel is set to 60
- seconds.
-
- My Darkbot is not accepting commands if I repeat them in a short period of time.
-
- Darkbot ignores for a certain period of time repeated commands to avoid
- flooding. Use one command alias or wait a couple minutes.
-
- My Darkbot is not answering when someone asks the same question.
- Darkbot will not reply to a topic already asked (with same syntax) during a
- certain period. By default that length of time is set to 5 seconds.
-
- I'm stuck... I don't know how to turn off my Darkbot
- You can use command !die online or on your shell kill -9 pidNumber after doing
- 'ps x' do check it's pid, or killall darkbot.
-
- // ================ SYSTEM REQUIREMENTS ================
-
- /*
- * Change the Ansi C signal handling below if it's not in the standard place,
- * usually on include/. Leave it as is if you don't know what that is. Type
- * 'man signal' on your unix box for more info.
- * (default = <signal.h>)
- */
- #include <signal.h>
-
- /*
- * If you are getting errors during compilation about clock_t
- * and clocks_per_sec not being available, turn this option ON.
- * This includes <time.h> in addition to <sys/time.h>.
- * (default = OFF)
- */
- #define NEED_CLOCK_T ON
-
- /*
- * If your compiler does not support snprintf() turn this
- * option ON. (default = OFF)
- */
- #define SNPRINTF_SUPPORT ON
-
- /*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/README_UTILS b/docs/README_UTILS
index 10a6ed4..5500f9c 100755
--- a/docs/README_UTILS
+++ b/docs/README_UTILS
@@ -1,373 +1,373 @@
-
+:::WARNING::: Do not use these script with darkbot they need updated.
Shell Utilities Help
All shell utilities mentioned here with exception to 'configure' must be
in /scripts directory.
For support, malfunctions, suggestions, please visit our forum.
http://forum.freezedown.org
----------------------------------------------------------------------
AddServer
AddUser
check-integrity
configure
convertdb (not a shell utility)
dbcron
download-databases
kill.darkbot
live-update
restart.darkbot
----------------------------------------------------------------------
###########
AddServer #
###########
Basically what this script does is managing your servers.ini file by adding
removing and changing servers and ports.
You have the option of manipulating only your local servers file or downloading
an updated server list from the International Federation of IRC and work with
those servers.
On all lists the servers are preceded by a number (which is not in fact part of
the files) to help you better choose or manage each entry.
On the remote servers list the ports displayed on the right are only for your
reference and corresponds to all available ports. It's recommendable to select
option 2 on the menu to load the external servers before changing local ports
so you'll have updated information to deal with.
If you decide to move all remote list to your local file, port 6667 will be
used for all servers. You can later change that port for each server on the
main menu, option 8.
On all lists PgUp/Down or arrow keys scrolls the text; Q quits from the list.
CTRL+C aborts at all times.
To launch the utility write ./AddServer. For a quick server entry write:
./AddServer server port (ex: ./AddServer irc.server.here 6667 )
----------------------------------------------------------------------
#########
AddUser #
#########
Manages user access on Darkbot
This utility displays, adds and removes user entries on your userlist.db file.
Usage: AddUser [-option|s]
To launch the utility and go to it's menu write $0
For a quick user entry write:
./AddUser userid@host level
Ex: ./AddUser *whateverid@*host.domain.net 2
(It will add an user with access level 2 to all channels).\n
./AddUser -h Shows this help information
While displaying file contents all entries are preceded by a number (which is
not in fact part of the files) to help you better choose or manage each user.
If the entries goes over screen size ( as this help text for sure will ) use
arrow keys or PgUp/Down to scroll and type Q to quit, or scroll the list to
it's very end so it will automatically exit and proceed to the next function.
CTRL + C aborts at all times.
How userlist.db is composed... How to enter values...
dat/userlist.db is the file where all user access records are stored.
Every entry should have:
<#channel(s)> <userid@host> <seen user> <level> <password> <greeting message>
When entered online the command line should be:
!ADDUSER #channel *userid@host.domain level 0 (where level must be 1,2 or 3)
- Channel field can be:
#* - it gives user access to all channels
#channelABC - it gives user access to #channelABC only
#channel1,#channel2,#etc - it gives user access to #channel1,#channel2,#etc
- On the user id field
correct - *userid (or) *useri*
not recommended - userid (or) *
incorrect - ~userid (or) *!*userid (or the use of ! and ~ anywhere)
- On the host field
Static IPs (IP never changes) - You should use it as is, i.e.:
if your IP is like this ...
myhost.123.mydomain.net
myhost.mydomain.net
11.222.12.123
... you can leave it as they are.
Dynamic IPs (IP is different on each connection)
You must use asterisks (*) and/or question marks (?) on the changeable areas
Examples:
on : myhost.123.mydomain.net
use: myhost.*.mydomain.net (or) myhost.???.mydomain.net
on : myhost.mydomain.net
use: *.mydomain.net
on : 11.222.12.123
use: 11.222.12.* (or) 11.222.*
Host Masks can NOT have spaces or any other characters or symbols besides the
ones mentioned above.
- Seen field
Starting as default value of 0 it will increase with the times Darkbot sees
the user accessing it's channels.
This field is automatically generated by Darkbot so no user intervention
is needed when adding an user online.
- Level field
User levels allowed are:
1 = Database Management commands
2 = Channel Operation + Database Management commands
3 = Administrator - All commands
- Password field
When added online trough the !ADDUSER command or entered directly on the file
for the first time while adding an user should be a zero (0).
When the user issues the online command /msg Darkbot pass 0 new_password
the new password will be encrypted on the file (on latest releases).
Be aware however if you have on defines.h LOGS activated, the message issued
by the user to Darkbot will not be encrypted. Turn LOGS off if you don't
want that to happen.
- Setinfo field
It will have a default message like 'I need to use !Setinfo'. When any
value entered could have a 0 (zero), which deactivates the function, or a
greeting message Darkbot displays when the user joins a channel.
You can see a short help online by typing !SETINFO
----------------------------------------------------------------------
#################
check-integrity #
#################
Checks all dat files for common mistakes/errors
Darkbot must be offline for most of saved information be effective.
Usage: <file|s|all> [-option|s]
Examples:
./check-integrity all
./check-integrity info2 userlist
./check-integrity all -nointro
./check-integrity random perform -nointro -quick
./check-integrity -report
Available command line triggers for files are:
all; info2; servers; setup; perform; userlist; random
(all checks all files; random checks all files with random entries)
Available command line triggers for options are:
-quick Speeds up the process bypassing pauses (sleep instances)
-nointro Bypasses introductory information *
-report Shows report file contents
-topicsize sets info2.db's topic length (default 50) *1
-replysize sets info2.db's reply length (default 400) *1
-default Returns program to it's default values removing all options
-h Shows a brief usage help
* The values of these options will be retained unless you use -default
*1 This setting is only necessary if you are using a different length
then the one defined on defines.h file
To trigger a parameter write ./check-integrity followed by one or as many
files or options you want.
- All operations are done on a working temporary file, leaving it's original
intact.
- All removed items/entries from any file are recorded on the report file.
- No files are definitely saved after changes without a prior bakup being made
on the original directory.
- This is a non interactive utility, i.e., no user intervention is needed.
However, all steps of the process are paused during up to 5 seconds so
the user can follow it's progress by reading it's messages. If the user
wants to speed up the process option '-quick' must be used at command line
so all sleep/pause instances will be bypassed.
Main Features
Line Feed check - verifies if there is a line feed at the end of files
Empty Lines - Cleans all empty lines wherever they are on the files
Incomplete Entries - Checks if there are topics with no replies on info2
Duplicate Entries - Checks for repeated lines on some files
Duplicate Topics - Checks for duplicate topics on info2
Topic Length - Checks if topic length on info2 is under the limit
Data Length - Checks if data length on info2 is under the limit
RDBs check - verifies if there are RDBs on info2 without links to files
and files on dat directory wihout RDB links
Random Files - Checks if total number of random entries is correctly
posted on the first line on randomstuff.ini, random.ini and all
RDB files or removes it in case local version is RC4 or later.
Setup.ini - Checks syntax; misplaced spaces; missing values
Servers.ini - Checks syntax; missing ports
Perform.ini - Default checks (empty lines and line feed)
Userlist.db - Checks for missing '#' on channels field; missing or
incorrect IPs; incorrect leading '~' and '*!' or missing '*' on userid
field; user levels; seen field; password field; setinfo field
This utility executes a considerable amount of operations during
file integrity verification. It depends on the size of the files
to be checked and errors to correct the time it takes to perform
all it's functions with accuracy.
All process is done without user intervention, so be patient and
wait until it is done or leave it working and check afterwards
it's final results on the integrity-report file or by typing
./check-integrity -report
If you are in a rush type ./check-integrity -quick
If you get wrong results on final counts due to unpredictable
characters or symbols you might have on your files please help
us correct the problem by participating it on the forum.
To abort all operations at any time press CTRL + C
----------------------------------------------------------------------
###########
configure #
###########
Goes over all basic configuration of your Darkbot.
You must run this script when on first installation of Darkbot.
----------------------------------------------------------------------
###########
convertdb #
###########
(Not a shell utility)
Syntax: ./convertdb -convert
It converts old Darkbot versions userlist.db passwords (prior to series 7.0)
into an encrypted format.
You have copied your pre 7f0 userlist.db in to the dat directory
DO NOT use this utility if You have created a brand new darkbot, and have no
users.
All users added with this script will have a password of 0
and should set their new password on IRC by issuing the command
/msg Darkbot pass 0 new_password.\n
Be aware if you are logging private messages the encryption
will not cover them, making it possible to see passwords
on the logs. So turn logs off on defines.h if you don't want
that to happen.
The file on scripts directory it's already compiled. However, if you
compile it's source on a non cygwin environment it's bin should
be placed on scripts directory and being so userlist relative path
should be "../dat/userlist.db" and "../dat/temp.db".
Under cygwin the executable should be placed on Darkbot's root dir
due to the necessity of cygwin dynamic library.
If that is the case read the instructions and edit source/convertdb.c
----------------------------------------------------------------------
########
dbcron #
########
Utility to auto generate crontab job on Darkbot checking if it is connected
during a cycled period of time.
When you first run it a new file is created overwriting original one and
the actual cron working engine is installed and it will remains active,
providing it's path and Darkbot's path remains the same.
If for any reason you've changed your Darkbot directory or it's binary
you'll need to modify the variables DBPATH DBBIN and DBPIDFILE on top of
the newly created file accordingly to the actual values.
Defaulty crontab job is of 10 mins interval. If you wish to change it
edit '0,10,20,30,40,50 * * * *'. If you don't understand it type 'man crontab'
How main engine works:
Changes to darkbot root dir; if pid file exists extracts pid number;
tests it by issuing an inoffensive kill; if pid is active exits, doing
nothing; if not means the file with pid is there but there is no active
process, so removes it. finally cheks if program bin exists then starts it.
----------------------------------------------------------------------
####################
download-databases #
####################
Downloads available pre made database files from Darkbot's site.
After download is made to your computer the pre-made database(s) will be
installed definetely on info2.db file after a series of integrity checks
done in conjunction with check-integrity utility.
----------------------------------------------------------------------
##############
kill.darkbot #
##############
Kills Darkbot pid
----------------------------------------------------------------------
#############
live-update #
#############
Updates local Darkbot files directly from Darkbot site
Program Usage:
./live-update [OPTION]
./live-update: (with no option) executes the program
./live-update -u Undo last changes
./live-update -n News - (latest news usually related to updates)
./live-update -v (v0, v1, v2) Verbose mode.
./live-update -h Help info (this one)
./live-update -o Turns Live Update ON or OFF
NOTE: - By switching live-update OFF you'll not be able to receive
live updates!
- Settings for verbose are 0=Stealth/silent; 1=Minimal messages
(default - no prompts if no updates present); 2=all available
program messages.
This script checks if there is any news update, pre-made database
or a most recent code release by comparing the contents of local
installation with the information obtained from the site.
In practice this utility starts by checking program integrity -
- if it passes goes to Darkbot site and downloads a piece of code
which contains the updates ids - those ids are compared with the
information stored locally - then checks if there is any news you
should read.
At the same time compares the installed code with most recent one -
- if there is necessity of code updates then patches all files with
the most current one, backing up all modified files. The update will
be done file by file on the same installation or by creating a new
directory with the name of the new release id on $HOME/darkbot-Ver
directory. Previous data files on dat directory are transferred to the
new installation. Old dynamic files like defines.h or darkbot.c are
transferred to the newly created source directory, with extensions .OLD.
The utility checks also if there is any new pre-made database in
conjuction with download-databases engine.
If the user wants to reverse (UNDO) the update process could do so with
the command ./live-update -u (not affecting downloaded databases).
A backup of all modified files/dirs is kept on .scriptutils/liveupdate/
working directory for the engine (do not remove it).
When typed ./liveupdate and nothing happens means there are no updates.
To do:
- automatic update of the new defines.h file;
- this utility being also integrated on a shell GUI.
Be advised that if you change Darkbot version from source files this
utility will not work. There is no reason to waste time and bandwidth
on an adultered program. The same will happen if you move or remove
source files from their original locations.
For support, use the forum at http://forum.freezedown.org
----------------------------------------------------------------------
#################
restart.darkbot #
#################
Restarts Darkbot
diff --git a/beta/docs/SETUP b/docs/SETUP
similarity index 100%
rename from beta/docs/SETUP
rename to docs/SETUP
diff --git a/docs/TODO b/docs/TODO
index ca23ba4..e60c290 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -1,20 +1,211 @@
----------------------------------------------------------
The TO-DO List For Darkbot
----------------------------------------------------------
These are features that are in the planning stages, or
that haven't been completely worked out, yet. Also, any
suggestions that people have made, that are planning to
be added, will be listed here.
+
+Features and bugs are also being tracked via the sf.net
+trackers at http://sourceforge.net/projects/darkbot
----------------------------------------------------------
+
+- Freenode uses different identd syntax n=blah@host, update
+ masking to use this and remove the n= part.
+
+- Make setnick command not spit out the message in room
+ about changing nicks after the effect.
+
+- Add escape character for | in topic responses so you can
+ output a | rather than use multiline replies. Other places
+ need escape character options too.
+
+- Add option to make the bot not kick/ban people who are
+ logged in with access to the bot.
+
+- Add googlesque queries to search command, so you can
+ excluse words from searches.
+- plural functions still needs to be implemented in spots,
+ about half of the functions use a different parsing
+ mechanism that still works, because I hadn't thought of
+ adding a "startarg" parameter to my db_argstostr()
+ function before that point. i will update these later.
+
+- chanserv_topic function needs to be a private message
+ command and accept channel arguments (easy, but to
+ remember for later).
+
+- atoi needs to be swapped for strtol in all places
+ since atoi isn't as safe.
+
+- Some kind of solution for large numbers needs to be
+ worked out for use with the unixtime user command.
+ Implementations with 32 bit instead of 64 bit longs
+ are limited to time representations in a range
+ consisting of only up to one more place value than
+ the current unixtime, and is a system dependant
+ value.
+
- Add some kind of escape sequence or special parsing
for topics that start with key words like "WHAT", these
words are also recognized internally by the bot for
answering questions.
- Multi-channel randomstuffs. I want to make it possible
for every channel specified in setup.ini as the home
channel, in the case of multiple home channels, has
their own randomstuff timers that output randomstuffs
according to the action going on, for each specific
channel.
+
+- Fix broken commands. weather.
+
+- Write things to replace the stuff that Windows can't do.
+ Backup command, etc.
+
+- Make the output of the MEM command more useful and friendly.
+
+- Make the google command (and maybe all other web
+ lookup commands) more robust.
+
+- Add internet movie database (http://www.imdb.com) and
+ slashdot news (http://slashdot.org) searches.
+
+- Single login, remembered across channel part/joins etc.
+
+- Changing the bot's nick needs some testing and tweaking.
+
+- IPv6.
+
+- Merge acronym, 21, lurker, syndet, pantheon, and serv
+ into darkbot. All are linked to from the darkbot pages.
+
+----------------------------------------------------------
+onefang's TO-DO List For Darkbot
+----------------------------------------------------------
+
+Add a show parameters command.
+
+Deal with scripts/dbcron one way or another.
+
+Update the INSTALL instructions.
+
+Double check the in code summaries for setup parameters.
+
+Allow multiple command characters - SETCHAR !'~
+
+Convert use of the obsolete gethostbyname() to getaddrinfo().
+
+The alarm() may not be portable enough. Replace multiple alarm() calls
+with a single setitimer() call. Give alarm() the benefit of the doubt
+for now.
+
+The first argument passed to the various select() calls could be better,
+it's more efficient to actually calculate that.
+
+Add a callback to the webinfo structure and otherwise restructure the
+web stuff so that disabling a web command can #ifdef out all the code for
+that command.
+
+Merge all the scripts plus convertdb into darkbot so that all admin
+stuff can be done from IRC, command line, or text UI.
+
+Make the replaceable params in responses consistant. X~ and %X.
+
+If possible, make all !set foo=bar stuff change the current state of the
+bot rather than requiring a restart.
+
+Scripting or modules. Scripting using embryo is a really good option.
+A limited subset could be used for the calc command as well.
+
+Find a cross pratform Windows/unix GUI toolkit we can live with and
+create a GUI for darkbot admin.
+
+Make multiple random responses easier to setup.
+ admin: bot add foo bar | baz | some other response
+ user: foo is also blah
+ admin: bot add foo | another answer
+
+Menu in PM. Plain one liner, colour one liner, multiple lines, colour multiple lines.
+ user: /msg bot menu
+ >bot<: Main menu - 1) factiod comands, 2) user commands, 3) channel commands, B) backup one menu, Q) quit menu.
+ user: /msg bot menu big
+ >bot<: Main menu -
+ >bot<: 1) factiod comands
+ >bot<: 2) user commands
+ >bot<: 3) channel commands
+ >bot<: B) backup one menu
+ >bot<: Q) quit menu.
+
+Don't give long answers in channel, only in PM. Instead, give a summary
+in channel, and inform user that a longer response is available via PM.
+ bot: summary of foo bar. (PM "foo bar" for more.)
+ luser: PM "foo bar"
+ bot: PM "foo bar" means to send me a private message you idiot. Try this command "/msg bot foo bar".
+
+Make the bot gender definable, defaulting to female. Allow users to
+register their gender. Auto convert all relevant text to proper gender.
+
+Add memos "tell onefang that foo", as opposed to factoid telling "tell
+onefang about bah". Allow memos to yourself. Fix alarm and tie that in
+as well, alarms to others and to self. Limit memos & alarms to karma
+memos & alarms per hour to limit abuse.
+
+Allow unlogged in users to create factiods, and change these factoids, plus
+make additions to factoids.
+ luser: blah is humbug.
+ user: blah?
+ bot: luser tells me that blah is humbug. luser may have been drunk at the time.
+ luser: known fact is wrong.
+ user: what is known fact?
+ bot: Known fact is correct. On the other hand, luser thinks that known fact is wrong.
+
+Channel logging, and playback to PM.
+
+wtf, add a karma system.
+ use it to sort the unlogged user added factoids.
+ bot: luser tells me that blah is humbug. Others have more to say, but I trust luser more. (PM "blah" for more.)
+ Use it to refer people to the highest karma person.
+ bot: Dunno, ask High_Karma_Dude.
+ Use no karma and negative karma as extra security levels. No karma = -1, negative karma = (karma / 100) - 2
+
+Keep track of how much she has been fed, deny taking food from strangers
+(low/no karama users). This implies that botsnack become an information command.
+
+data include files.
+ Keep track of what database include files are not used for a while, and unload
+ them, keeping the questions and a pointer to the file though.
+
+Multiple server/channel support like xchat.
+ Allow different data per server/channel, using includes for common stuff.
+ Allow different setup per server/channel.
+
+Keep track of unanswered questions, for two reasons -
+ So the admin can look through it later and add factiods if needed.
+ If the user is still around (and given a suitable timeout) answer the
+ question if an answer arrives.
+
+Implement the Porter-Stemmer algorithm to improve English-language
+searching as per the drupal module of the same name. It reduces each
+word in the index to its basic root or stem (e.g. 'blogging' to 'blog')
+so that variations on a word ('blogs', 'blogger', 'blogging', 'blog')
+are considered equivalent when searching. This generally results in
+more relevant results. Also, start by stripping out all punctuation.
+On the other hand, question marks mean it is more likely to be a
+question. Same applies to use of the W words near the beginning, they
+are more likely to be questions.
+
+Add a locale to weather codes database or search facility. Combine all
+the weather commands into one. Make it return metric results.
+
+Command to guess a users timezone, and show time in that zone.
+
+Random greetings, random channel topics, etc.
+
+Interface other shell commands, but be secure. In fact, setup a chroot
+for arbitrary shell commands.
+
+Allow DCC to and from a file server.
+
+Channel protection - mass join, mass kick.
diff --git a/docs/WHATSNEW b/docs/WHATSNEW
old mode 100755
new mode 100644
index f5c9b82..da7f014
--- a/docs/WHATSNEW
+++ b/docs/WHATSNEW
@@ -1,740 +1,988 @@
*******************************************************
Warnings, errors, malfunctions, code patches, suggestions
- Support Forum: http://forum.freezedown.org
- *******************************************************
+ Support Forum: http://www.freezedown.org/forum
+ (order is reverse-chronologic)
+ *******************************************************
+
+
+Darkbot 8rc4: May 13, 2009
+ - Fixed DIE, NICK, METAR, PART, RANDQ, RANDQ2, RDB, STATS, TAR,
+ TELL commands crashing with no args. I made a small change to
+ the initial command parsing function which rendered some things
+ improper and made many functions crash because they were no
+ longer receiving the arguments they expected before the change.
+ - Fixed CHAR_INVOKE'd commands to do nothing if given too many
+ arguments.
+ - INFO2 command now outputs correctly in privmsg.
+ - Added the "You must specify a search string" message to
+ RANDQ and RANDQ commands with no arguments.
+ - Sleep command now checks for too many args, this is part
+ of the command structure now, so more commands are to follow
+ probably.
+ - MSG_INVOKE'd commands now also check for too many arguments.
+ - Commands with less arguments than expected now show
+ help messages again.
+ - Fixed crash error on ADDUSER command.
+ - Fixed retarded error in MEM command where I was trying
+ to change the contents of a const variable.
+ - Made OS, MEM, CMDCHAR, and CPU commands check for too many arguments.
+ - Fixed OS command on Windows.
+ - Fixed chanserv_random_stuff.
+ - Fixed alarmclock function.
+ - Fixed permbans command not outputting help for null
+ input. More to come.
+ - Fixed several commands that crashed not checking for
+ a null argument array. The fix I did looks sort of
+ retarded, but I found if i didn't check args[0] and args
+ both, it would crash on different command types.
+ Go figure. This fix works and I'll work on bettering it.
+Darkbot 8rc4: April 30, 2009
+ - Fixed extensions.m4 file from discriminating against
+ me using a newer version of automake than 1.9.6, and
+ removed a few automake warnings.
+ - Fixed autotopic only using first word of input.
+ - Fixed crash on ADD command and probably others when msg
+ with no arguments.
+Darkbot 8rc3: Sep 17 2008
+ - Fixed USERLIST and SETINFO commands crashing with no args.
+ There's probably more of these to come.
+ - Topics can now start with these commands that check for too
+ many arguments. Say you want to do:
+
+ dbtest add info+things hey N~, I don't have info on things.
+
+ Before this, a parsing error would invoke the "info" command.
+ This has been fixed, and the bot will now either not respond
+ to these inquiries if they don't exist in it's database, or
+ provide the desired reply.
+ - Added "too_many" parameter into the chanserv_command struct.
+ This specifies to the command parser if a command sent to the
+ bot should be checked for having too many arguments. This
+ particular change helps fix a number of issues which would
+ cause headache, and will be fine tuned more thoroughly when
+ I get the chance.
+ - More parser errors fixed. Added ILN in additon to ILC.
+ - add stats function now has subsequent call to free()
+ after the malloc() call. (Duh? What happened to that?)
+ - Fixed ILC. Oops on my part for breaking it.
+ - Part command no longer tries to output "I left the room"
+ message to the channel it parts.
+ - Updated TODO.
+ - Changed all command function parsing. Things should hopefully
+ work more correctly again.
+ - HLIST (Helperlist) command now allows multiple arguments.
+ For instead if you want to list all users level 3 and level 3,
+ you would do !HLIST 3 2.
+ - Fixed tell command to tell people about topics without having
+ do delimit them with '+' signs, so it runs like normal text now
+ for multi-word topics.
+ - Fixed sleep command. It now actually sleeps for the specified
+ amount of time, if any is specified.
+ - Part message now accepted as a parameter to PART command.
+ - More work on unixtime function. It now has more complex error
+ checking for strtol. More work on this to come.
+ - Renamed pluralize function to plural.
+
+Darkbot 8rc3: Jan 16 2008
+ - Alarmclock function uses time_t variable now instead of long.
+ Also now accepts arguments specified in seconds.
+
+ - Bot no longer crashing during start if there's blank lines in
+ the servers file. It now ignores blank lines and comments
+ starting with '#' and '/'. If the server file is blank, it
+ aborts and tells the user to edit the file.
+
+ - Added pluralize() function for beautification purposes. See more
+ in general.c.
+
+
+Darkbot 8rc2: June 07, 2007
+ - The STATS command, and all overhead produced by this command
+ can now be disabled during compile like so:
+ ./configure --disable-stats
+ OR
+ ./configure --enable-stats=no
+
+ - Changed the RANDOMSTUFF command to be a NORMAL_COMMAND, so you
+ can use this command with ADDRESS_INVOKE again (address the bot
+ directly).
+
+ - Added a little thing at the top of docs/WHATSNEW that indicates
+ which order the lines therein consist of according to when the
+ changes they represent were implemented. Made this sound more
+ technical than it should for no reason at all.
+
+ - If the input type is ADDRESS_INVOKE (the bot was called upon by
+ name), the bot responds anyway now, because it's going to output
+ an "I don't know" response if the topic doesn't exist. This doesn't
+ happen with DIRECT_INVOKE because the text may have been normal
+ channel conversation that was mistakenly parsed as a command.
+
+ - Commands which require 0 parameters now act accordingly again
+ when supplied with too many arguments. In other words, "dbtest
+ info things" would trigger the info command before. Now, it
+ uses check_existing_url and outputs a response if the topic
+ exists, otherwise, it just ignores it.
+
-Darkbot 7f3: Jun 3, 2005
- - Restart and rehash commands should now work on all operating
- systems.
+Darkbot 8rc2: December 09, 2006
+ - Updated server and user lists.
+ - More fixes to random whut.
+ - Tweaked random number generation.
+ - Consistant random number generation throughout the code.
+
+Darkbot 8rc2: December 04, 2006
+ - Fixed some variable checking that was checking for integers
+ instead of bool values (random whut is fixed by this, flood
+ kick)
+ - Fixed Makefile.am file to produce DOS 8.3 file format
+ compliant config.h pre-file, and the copyright thingo
+ in the same file.
+
+Darkbot 8rc2: October 11, 2006
+ - Fixed some divide by zero errors.
+ - Cleaned up the logging.
+ - Cleaned up the output of the build system.
+ - Cleaned up the parameter names.
+ - Cleaned up some help text.
+ - Script for building minimal darkbot.
+ - Disabled more channel code.
+ - Started documenting what darkbot works on.
+
+Darkbot 8rc2: June 11, 2006
+ - Added docs/SETUP.
+
+Darkbot 8rc2: May 31, 2006
+ - A busy month.
+ - Completed the autofoo.
+ - Added compat directory full of replacement functions for
+ when autofoo decides that the users OS is missing stuff.
+ - Added a testing mode for developers.
+ - Cleaned up most OS dependant things so that they now work
+ everywhere.
+ - Converted some defines.h things into ./configure --enable-X
+ --with-X=Y things.
+ - Added !set foo=bar infrastructure and command. The contents
+ of setup.ini is now under the control of generic, array based
+ code. To add things to setup.ini, just add them to the array.
+ - Added setup.ini parameters to the internal help system.
+ - Moved the rest of defines.h to setup.ini.
+ - General clean up and lots of minor things that get fixed in
+ passing.
+ - Added docs/HACKING.
+ - Re arranged some files.
+ - New building scripts.
+ - Darkbot and convertdb are much cleverer about finding the data
+ files.
+ - Cleaned up vars.c and vars.h.
+ - Have the help system deal with the command character as needed.
+
+Darkbot 8rc2: May 04, 2006
+ - Cleaned generated files out of cvs and updated .cvsignore
+ files to match.
+
+Darkbot 8rc2: Apr 21, 2006
+ - Added most of the help command summaries.
+
+Darkbot 8rc2: Apr 19, 2006
+ - Fine tuned what commands can be done where. In particular
+ any password related commands can only be done in private
+ now.
+ - Made some commands behave consistantly no matter where they
+ are invoked from.
+ - Added HELP COMMANDS.
+ - Don't try to send oversize messages, split at a space.
+
+Darkbot 8rc2: Apr 16, 2006
+ - Rewrote chansrv.c to use an array of pointers instead
+ of a huge if-else-if.
+ - Added patch from nak that stops ops from kicking
+ themselves via a topic kick.
+ - Added HELP <command>.
+ - Added isop <nick>.
+ - Added level <nick>.
+
+Darkbot 8rc2: Mar 09, 2006
+ - Added !WEATHER <zipcode> command.
+
+Darkbot 8rc2: Nov 07, 2005
+ - Fixed spelling errors, the word 'queue' was mispelled
+ throughout the code and in comments.
+ - I apparently broke show_banlist() a few releases back
+ trying to eliminate a type conversion warning, so it's
+ fixed again.
+ - B~ (bot nickname) variable can now be used in perform.ini
+ - OS command now works on windows.
+ - Fixed google command. A search string used to determine
+ successful replies was changed by google.
+ - Changed "ugly" message responses.
+ - Restart and rehash commands should now work on all operating
+ systems, including Windows.
+
+Darkbot 8rc1: Mar 04, 2005
+ - Removed an unneeded line in main.c, that was used to "hide"
+ warnings on WIN32, which is a very bad idea.
+ - Changed check_dbtimers() so it ignores the CVS directory,
+ which contains information for the CVS server. This
+ fixes a situation that seems to have only presented itself
+ in FreeBSD, where it thinks the CVS directory is a
+ timer, and sends out random garble every few seconds.
+
+ - configure.ac and source/Makefile.am; very minor updates.
- - Changed check_dbtimers() so it ignores the CVS directory,
- which contains information for the CVS server. This
- fixes a situation that seems to have only presented itself
- in FreeBSD, where it thinks the CVS directory is a
- timer, and sends out random garble every few seconds.
+ - Fixed randq, which I accidentally broke when adding the
+ -I switch. This also fixes some problems that turned up
+ on FreeBSD.
- - Fixed randq. I broke it when I added the -I switch.
+ - Fixed a warning that came up in permbans.c about mixing
+ types when compiling on OS X. I changed %d on line 198
+ to %ud.
- - If the beta doesn't work on your system, run "autoreconf"
- if you have the autotools distribution. Then, run "make".
+ - configure now checks for clock_t.
- - Added a new beta version to the beta subdirectory in the
- repository. This should work pretty well for most people,
- and I recommend using it if it compiles on your system.
- If there are any problems, report them. A lot of the
- source/config.h defines aren't implemented yet, but as my
- ability to fill that part in increases, they will also be
- implemented.
+ - configure now automatically checks for snprintf, and
+ uses a replacement if it's not found.
-Darbkot 7f2: April 05, 2004
+ - docs/INSTALL.txt is now INSTALL in the toplevel dir.
+ Another thing for automake to stop complaining about.
+
+ - The original configure script is now located in the
+ scripts directory, and is called "Setup".
+
+ - docs/contributors.txt is now called AUTHORS in the
+ top level of the distribution. Another thing automake
+ complains about. I also worked on the appearance of
+ this file, hopefully it looks a little better now.
+
+ - README.txt in the toplevel is now called "README".
+ Automake complains about this file also, if it's not
+ found.
+
+ - This file is now called ChangeLog, and has been moved
+ to the toplevel distribution dir. The reason for this
+ is that automake complains, if it can't find this file.
+
+ - configure now checks for the presence of windows.h,
+ and defines WIN32, if it's found. This removes the
+ need to do "make win". Until I add the noconsole
+ option again, you can run darkbot with no console by
+ doing "./darkbot &" in your cygwin shell.
- - Fixed a possible crash scenario in do_random_stuff().
+ - The configure.ac file is not yet complete, and most
+ of the definitions listed in config.h are not completely
+ implemented into the code yet. If you have problems,
+ please let me know, and these files will become completely
+ implemented as demand is met.
- - You can now use !GOOGLE for google searches.
+ - Included premade Makefiles and configure script.
- - Hopefully fixed a bug that happened on BSD machines causing
- weirdness. Changed a strcpy to strncpy.
+ - Added "make convertdb", which will compile the database
+ conversion utility, which encrypts the passwords in your
+ userlist.db file.
- - Fixed the google function. Google changed some text that
- the bot was using to tell if the search was successful.
-
-Darkbot 7f1: March 30, 2004
+ - I added a Makefile.am in the toplevel, and in the source
+ directory. These files are used in conjunction with
+ GNU Automake to produce a Makefile.
+
+ - Added Makefile.ams and configure.ac for autoconf/automake.
+
+Darbkot 7f2: April 05, 2004
- - Fixed a bug that happened while make tried to cp the binary
- to the toplevel distribution directory. It now compiles the
- binary directory to the toplevel, and no longer needs to use
- "cp".
+ - Fixed the google function. Google changed some text that
+ the bot was using to tell if the search was successful.
- - You can make color specific responses now. Please let me
- know if any problems arise from this.
+Darkbot 7f1: Mar 06th, 2004
- - Made a quick fix to a bug which caused crashing in randq.
+ - Made a short dirty fix for "!randq *" crashing the bot.
+ If you do a randq query consisting entirely of * and ?
+ characters, the bot will now just spit out a random quote.
+ This needs to be fixed better, obviously, but this will
+ keep peoples' bots from crashing until the issue can be
+ properly addressed.
+
+ - Changed unlink() calls to remove(). remove() is ANSI C.
- Private message responses no longer have that "sent by"
thing on them. It was annoying, and pointless.
- Renamed the log() function db_log() to avoid a conflict
with a function internal with gcc. Apparently this only
affects newer versions of gcc.
- - Added "make convertdb", which will compile the database
- conversion utility, which encrypts the passwords in your
- userlist.db file.
-
- Removed two unused variables in convertdb.c. I also changed
'unlink' to 'remove', to comply with the ANSI standard.
- Changed forum URL to http://forum.freezedown.org, since that
works too, looks cooler, and is shorter. :)
- Fixed a bug that caused the bot to never respond to anything
after being killed. The same problem was also fixed in a
number of other situations that it was popping up. gs26()
was being called both before, and during prepare_bot(), so
I made the call happen only during prepare_bot().
- Fixed a minor flaw in convertdb.c. It said the syntax was
"convertdb -convert", even if the executable wasn't named
convertdb.
- Taiwanish file got dumped somehow, it's back now.
- New setting in defines.h, AUTOHELP_GUESTS, makes the bot send
a message to the channel, whenever a user with the word "Guest"
in their nickname joins, asking them if they need help. This
can be used in help channels, to avoid Guest users just joining
the channel, and moving on because nobody is talking.
- I'm fairly sure I have dbcron fixed now. I can't test it,
because I don't have a system with crond, but the fix was
made using basic shell syntax. >> instead of >. :)
- Please remember to include which operating system you're using
when reporting bugs. This information is crucial because (all?)
operating systems have subtle differences that can cause any
number of problems in various situations. It's impossible to
keep all of these conditions in mind when writing code, because
there's just so many of them. Any other information that you can
provide will, more than likely, be greatly appreciated.
- I don't see why this is a development version anymore, so
I've moved it to final. As always, any malfunctions or
problems may be reported via the forum.
- darkbot.info isn't resolving anymore, so references to this
site have been removed. I left the support emails, until
updated email addresses are known of. If your email needs
to be updated anywhere in the code, and I didn't realize it,
let me know.
- Changed setup.ini, WHATSNEW, according to previous statement.
- Updated some text in defines.h
- Updated the title screen in main.c
- Removed references of "make cygwin". Just use "make win"
from now on.
- Fixed a typo in the Makefile.
- You can use comments in the performs file now by appending
a '#' to the beginning of the line.
Darkbot 7.0-RC9: Oct 19th, 2003
- Added new channel command, "QUOTE". All this does right
now is display a random line from randomstuff.ini on
command.
Darkbot 7.0-RC9: Oct 5th, 2003
- This feature was already added, but I never documented it...
The R~ variable (random nickname) now works in RDB topic
responses. Look for randomstuff compatibility in the near
future, but first i have to rewrite do_random_stuff() to
accept a channel arguement.
- I was reading through this WHATSNEW file, and corrected
a few typos that were made.
- I removed the run_deop() code. It didn't work very
well anyway, or at all actually. I plan on reintroducing
this whenever I can get some free time.
- Fixed Ebonic language file.
- Added Taiwanish language option.
Darkbot 7.0-RC8: June 20th, 2003
- I screwed up the Makefile by accident, adding some
new features, and I hadn't finished yet when I
committed. OOPS. Fixed now.
- Updated more depricated URL strings.
- Updated language files.
- Minor changes on startup splash screen.
- Support forum URL is now http://www.freezedown.org/forum
- Updated the default servers.ini file to reflect the
changes.
- You can now use Darkbot on servers which require a
connection password. Check servers.ini for an
example.
- Updated some outdated text in the configure script.
- Darkbots now default to irc.freezedown.org #darkbot.
Please edit your setup.ini and servers.ini files to
minimize traffic, since that is also our help channel.
Darkbot 7.0-RC7: June 2nd, 2003
- Updated the INSTALL.txt file to reflect some support
changes.
- Fix for possible problems with counting in datasearch
algorithm. long was changed to size_t.
- Fixed bug that prevented ACTIONs from being used on
RDB responses.
- Suppressed more warnings when compiling on Solaris
from chan.c, in the do_math function.
- Removed another unused variable from url.c
- Removed an unused variable from random.c
- Removed the .runonce script from executing during the
"make" process. The funcionality this script produced
is depricated. Also removed this file from the distro.
- Darkbot will now properly compile on Solaris. To make
this happen, you need to manually edit source/Makefile,
and remove a comment symbol before the word "LIBS".
- Suppressed a warning message from main.h that happened
when compiling on Solaris.
- Makefile now works correctly on Solaris.
- The MEM command is now limited to only users with admin
(level 3) access on the bot.
- On startup, we now run_performs() BEFORE we join our home
channel. This fixes an issue that happened chiefly on
Undernet, and allows the bot to authenticate and set
umode +x, before it joins any channels. I hope to fix
this in a better way, but for now it's driving me nuts.
- The startup screen now actually reflects what version this
is. Sorry, I forgot all about that startup screen, because
it's hard coded. hehe.
- The Q~ variable in topic replies now works correctly. It
was chopping all but the first word off, before.
- Added MrSiMo to the list of contributors for his Arabic
translation.
- The sleep command now accepts an arguement for the number
of seconds you want the bot to sleep for.
- DEFAULT_UMODE is now set immediately upon connection.
Several users said this was not being done, it was. It was
just waiting >300 seconds, for whatever reason. Also, the
bot command PERFORMS now sets DEFAULT_UMODE in addition
to running the performs file.
- New command line option.
-I now specifies the location of the directory containing
the data files (by default, dat/).
- Multiple command line arguements are now supported.
I have no clue why this wasn't done before.
- The .debug and .debug2 scripts were missing from the
distribution. They're back now.
- Found another place where the bot wasn't deleting old
userlist entries. This has been fixed.
- Added the CHANUSERS command. All this does is return
a list of users on either the specified channel, or
the current channel, if none is specified. I may
remove this eventually, as i'm just using it for
debugging purposes right now.
- CHANINFO command will output to whatever channel it
received the command from now, instead of the channel
it's showing data about.
- The CHANINFO command now supports a channel name
parameter. Dunno why it didn't have that before...
- Darkbot is on CVS now at SourceForge!
- Soapta revamped the google module.
- The MEM command now displays the correct process. I removed
the -x flag from the ps command it was issuing, and it fixed
it. If anyone sees any reason the -x flag should be used,
let me know and i'll recode the whole thing.
- Added SETHOST alias for the VHOST command.
- Updates to the Ebonic and French languages which define
Lbadtopic and Lbadtopic2 now. Other languages still need
this added.
- The RDB command, which gives information about the number
of RDB files, can now be used with an arguement, to tell
how many lines are in a specific RDB file. It was supposed
to do this before, but it didn't work properly. This
command is still unavailable in Windows.
- Removed a warning concerning do_randq that happened if you
compiled with RANDOM_STUFF undefined.
- Fixed another bug that was causing the bot to never remove
old entries from it's internal user list. This time it wasn't
parsing the channel name for PARTs correctly. I also removed
some parsing being done on an unused variable whenever
someone parted a channel.
- Fix for RDB command... i forgot to change this when I moved
all of the RDB files to their own directory. OOPS! :)
Darkbot 7.0-RC6: Oct 30th, 2002
- Added Arabic language.
- You can now toggle the use of encrypted userlist.db passwords.
Check defines.h for this.
- Fix for the bot not executing performs when it connects to
a server which does not have an MOTD. Also cleaned up a small
amount of redundant code dealing with performs.
- The bot will no longer crash if it encounters blank lines in
the info2.db during data searches (DSEARCH and SEARCH commands).
Darkbot 7.0-RC5: Sep 24th, 2002
- Fixed do_randomtopic(), so it's now possible to output the first
quote. it never did this before (oops).
- Fixed the socket connection routines for windows.
- Fixed a rather large bug that caused the bot to never actually delete
users from the internal user list when necessary.
This also fixes another problem where the bot would put return a
nickname from R~ that is not actually on the channel.
- RDB topics now support the use of tokenized responses. This includes
the use of tokenized responses in the WHUT and DUNNO replies.
- Added timers directory to the distribution, it was missing.
- Got rid of the do_randomtopic2() function for the random dunno, and
random whut replies. do_randomtopic() now handles everything. This
cut down the size of the code a bit, and should have been how it was
done originally, anyway. This also means variables and also raw
commands can now be used in the replies for whut, and dunno, also.
- Added a level 3 helper command, "PERFORMS", which just executes all
all commands that are in the bot's performs.ini file, at any time.
- Fixed minor oversight that I created when adding a check for illegal
characters in !nick, it now lets you use all legal characters.
- RDB topic responses can now contain raw commands.
- RDB files are now stored in their own directory. By default, this is
dat/rdb.
- Changed get_word() function to make it a little more useful.
- Changed some error replies in the RANDQ function, and added a response
for the condition of randomstuff.ini being empty.
- Cleaned up the prototypes.h file, it looked really ugly. :)
This also reduced the total amount of code by a bit, but i'm not going
to bother checking just how much. :P
- Fixed an issue in seen, that might cause the bot to improperly count
the number of seens in the database.
- Fixed minor bug in add_randstuff() that caused the bot to say there was
one more randomstuff in the file it's adding to than there actually was.
- Fixed a bug in do_random_stuff() that prevented the bot from outputting
randomstuffs, in very rare instances. This suspectedly was causing some
strangeness noted in Debian, and some other OSs.
- Added a new alias for randomstuff, RS.
- Fixed a bug in !USERLIST, that caused the bot to flood itself, and not
show of all of the users it was supposed to show.
!USERLIST now works correctly, and hopefully on ALL OS.
- Fixed a bug in !BANLIST that caused it to not output correctly on some
OS.
- Due to abuse and channel cluttering, the !VARIABLES command now messages
the user with the output, instead of sending it to the current channel.
- Fixed a compilation error concerning BITCH_DEOP_REASON being undeclared.
What i did is remove this, and now if BITCH_ABOUT_DEOP is turned on, it
just runs the list of commands in deop.ini. If BITCH_ABOUT_DEOP is turned
off, it does nothing when the bot is deoped. Apparently, before this
version, it ALWAYS ran deop.ini, and the BITCH_ABOUT_DEOP just toggled the
bot saying whatever line was defined in BITCH_DEOP_REASON. That seemed kind
of pointless, to me, but i never noticed it before now.
Darkbot 7.0-RC4: Jun 24th, 2002
Again, Ron did a couple necessary and urgent changes and fixes:
- Finally, the bug in windows concerning DEL and REPLACE has
been corrected. A function which checks readability and
writeability was leaving the info2.db file open at startup,
and causing all sorts of problems, since the new code structure
was implemented.
- NO NEED FOR TOP LINE WITH NUMBER ANYMORE on random phrase files.
... After yet even more problems with randomstuffs being counted
improperly, I've recoded the entire randomstuff routine.
They no longer rely on any number at the top of the file, which
means you can remove that number from your randomstuff.ini.
Optimizations made to make randomstuff more random, also.
- Fixed a bug where Darkbot would crash when you use !nick
with illegal characters.
- Patched a socket issue in create_connection() that appeared
only in windows.
- Eliminated a warning dealing with the redefinition of size_t
when compiling the bot in windows.
- Eliminated all of the casting done on malloc in the program.
Casting malloc is totally unnecessary, and can mask other
errors.
- Improved the fix for topics that consist entirely of "*"
characters. It now checks for "?" also. This prevents
segmentation faults, and topics which are entirely wild-
cards are seriously annoying anyway. Sorry if it's in any
inconvenience to anyone.
- Minor cosmetic fix to the output of DBSIZE, it'll now say
that the database is "1 byte in size", instead of "1 bytes
in size", if it's only 1 byte. This should never happen,
but if it does, it'll look nice. :)
- Added #define MSG_RESPONSES to defines.h to have Darkbot
answering or not to private queries. Check next 2 defines.
(default is OFF)
- Added #define ALLOW_ADD_IN_MSG to turn ON or OFF the
possibility of ADDing database entries to Darkbot in
private message. (default = OFF)
- Added #define ALLOW_DEL_IN_MSG to turn ON or OFF the
possibility of DELeting database entries from Darkbot in
private message. (default = OFF)
- Added RANDQ function and alias RANDQUOTE, to output a random
line from your randomstuff.ini that contains a specified search
string.
RANDQ output returns a (11/23) type thing at the beginning of
the line, which tells which quote it's showing, out of how many
were matched in your search.
RANDQ can be used from any channel, and in MSG. It wont output
An obvious side effect to this, is that the ~ variable in
randomstuffs will evaluate to a nickname, if it's used in private
message (The nickname of whoever invoked it).
To make the function toggleable a directive with the same name
was made on defines.h (default = ON)
Try it out, !RANDQ <stuff>
- Added RANDQ2 command, which is the same as RANDQ, only it
matches case sensitively.
- Added BACKUP_RANDOMSTUFF define to backup randomstuff.ini
file every time a random phrase is added. This was done due
to missing contents when adding an entry on a file with a high
ammount of phrases. Latest fixes resolves the problem but this
define will stay to play on the safe side and/or if user likes
to backup changed files.
- Added hostmask code, where the bot converts hostmasks to
*jason@*.superlink.net, or *jason@203.203.203.*.
- After lots of complaints, the second line in the info reply
only shows up with the stats command now.
Shell utilities
- Adjusted check-integrity to the non necessity anymore of top
line with number of random entries on random phrases files.
- configure script now forces entering at least one server
and at least one user level 3, on servers.ini and userlist.db
files respectively, in case those files are empty.
(working on checking errors on user input).
- added an option on 'configure' to import servers.ini and
userlist.db from another location.
- Added BSDs compatibility to all shell scripts.
- Added Cygwin compatibility to AddServer, AddUser,
check-integrity and download-databases scripts (live-update
and dbcron not fully tested yet).
Darkbot 7.0-RC3: May 22nd, 2002
ron@freezedown.org has worked on the following 4 issues:
- Fixed a bug that caused crashes if the bot responds to a
topic containing R~ in private message.
- Fixed a bug that caused excess floods if the bot were to
send private messages to itself.
- Fixed a bug concerning topics that consists entirely of the
'*' character, which caused segmentation faults. Darkbot
will not allow you to add a topic like this now.
- Fixed the Makefile, on my computer it kept compiling all
of the source files seperately and then compiling them all
together instead of linking the .o files it made.
- Added directory logs lost in action. It is now within dat directory
- Fixed .Stripdb and .Stripdb2 - so now points to the correct bin path
Shell utilities: (all changed/improved - read docs/README_UTILS)
- Added README_UTILS to docs directory with information about shell utils
- Added compatibility to wget (besides lynx) on scripts that needs to
connect to internet
- All utility scripts now share working directory .scriptutils instead of
having dynamic files all over scripts directory
- download-databases now integrated on live-update (besides standalone)
(if updated on RC3 the change will take effect next time live-update
is executed)
- Added a couple more features and improved others for more accuracy on
check-integrity engine. USE IT before asking for help or going into
paranoia if you suspect you have data errors or even if you are not
sure eventual errors became from bad entries on data files.
- Added a few features to AddUser utility
- configure script now bypasses previously configured items. Just hit
ENTER key to go to the next setup. Also it gets already configured
parameters and use it as session defaults instead of the usual Darkbot
defaults. The script is now linked to AddUser and AddServer with all
features those utilities now have.
Darkbot 7.0-RC2: Apr 13th, 2002
- Windows port. Not much to do at this time. Last changes
on the core code made some commands not working properly.
Any interested coder... the affected commands
are DELETE, which do not delete, and REPLACE, which leaves
in info2.db 2 entries with the same topic. I should remind
all coders that the source must be sent together with it's
executable/bin files. Any coder willing to participate use
the email on top of this info or directly to me
at LuizCB@darkbot.info . (only development matters please)
- The following are a couple Unix scripts to help on Darkbot
management. Most are complete, some needs small adjustments
or more features. I've used basic sh technics on it's making,
I should say, while learning the language on the fly.
Please test them and send any modiffs in case you are able
to. The idea of these shell scripts is mainly to open a door
to C coders to implement them so it will be possible to port
it to other platforms.
- A more featured AddServer. Downloads and installs servers
of the network you choose. Thanks to the folks at the
International Federation of IRC - http://ifirc.com
for a job well done on your site! The merit of that will
go to our web page on the credits area as soon as stable
version 7 is released.
- New crontab setup utility. Run dbcron on scripts dir and
if crontab is active on your shell the script will do
everything for you (10 mins interval cron job).
- Implemented a new update utility. On scripts
directory type ./live-update -h for help on it's
usage. At this stage the update engine will not
transfer your previous directives on defines.h
or darkbot.c to the new file, so you'll have to
edit defines.h manually and compile Darkbot.
The script is compatible with all Darkbot releases
and can be launched standalone providing it's in
scripts directory. To install it ( in case you don't have
it with your Darkbot) type
lynx -source http://live-update.darkbot.info > live-update
then chmod +x live-update
(get-latest will no longer be available)
- New download-databases utility. ( it will be integrated soon on
live-update engine but can also work standalone).
- New file-integrity utility ( still needs some ajustments and
more features but you can use it already - works with
download-databases utility or by itself). Type
./check-integrity to check info2.db. Due to unpredictable
user entries on info2.db this utility could behave
abnormally on some special characters. Please send me all
info2.db file in case anything like that happens so I can
make exclusions on the code.
Changes applied by reet:
- Fixed major bug when adding users - the password wasn't
encrypted, thus user could never login.
- Added new commands IGNORE & UNIGNORE syntax is:
<bot> ignore <nick>
<bot> unignore <nick>
The ignore list is only stored in RAM, changing
nicks will get around this ignore. This is useful
to ignore people who query the bot too much.
- Applied code optimization patches on info and check_permban,
submited by Neil Darlow
- Preview for next full release: adjustments on shell utilities
and a full featured menu GUI might be finished. Minor
changes in meanwhile can be updated using live-update
engine.
Darkbot 7.0-RC1: Mar 2nd, 2002
- Fixed get-latest script; besides checking for code updates
also looks for latest news. Database files updates
will be also done/actualized soon. It's not linked
anywhere by now so if you want to use it type it's
name.
- Organized file structure; all scripts are now on scripts
directory, documents on docs except README which is
now on Darkbot's root dir. A new contributors file
was created with the list of colaborators.
- defines.h is now organized in different way and prepared
to a "shell GUI" to be released soon.
- Organized 'configure' in a different way. Now it starts
with defines.h editing and then it goes to data files.
- scripts/dbcron - a new script to execute crontab. There is
plenty of help how to use in it. Read it. Soon the
reconnection process will me automated.
- Updated makefile to reflect the new directory tree.
- Code contributors please use this release as the base of
your changes.
- The next changes are code modifications also in preparation
for release 7, mostly adapted, updated or implemented
by reet, paul @ darkbot.info
- Added GOOGLE feature. Simply type:
<bot> google <search string>
The bot will then return the first URL google
returns.
#define GOOGLE ON to use this feature.
- ********** IMPORTANT **********************************
- userlist.db passwords are now *ENCRYPTED*
If you are using an older version userlist.db
you MUST set all the passwords to 0 *** OR ***
Cygwin/Windows users run convert.exe
UNIX users run ./convert
and your userlist.db will be converted
*******************************************************
- #define PERFORM_TIMER ON if you want darkbot to send its
PERFORM.INI to the IRC server every 60 seconds, useful
if your bot is banned from a channel, or couldn't
log in to channel services due to a net split etc.
It's in defines.h
Darkbot 7 (alpha 2.1): Dec 23rd, 2001
- Fixed 'INFO2.DB must have at least one topic' problem. Bot
should work normally, even if INFO2.DB is empty.
- Added 'stats' support to darkbot, <botnick> stats will return
total number of questions asked since it started
recording. You can also do <botnick> stats <nickname>
to get indivdual stats from a user. dat/stats.db holds
the data.
- Added 'quiz' support to darkbot, <botnick> quiz to execute
the quiz, it will pick a random question/answer from
dat/quiz.db. The format of the question answer in the
file should be <question>@<answer>
e.g. What is 1+1?@The answer is 2!
quiz is still in experimental stages, check defines.h
to enable/set it up.
Darkbot 7 (alpha 2): Dec 17th, 2001
- New define - #define VOICE_USERS_ON_JOIN [on/off]
- New commands: /msg bot infosize or /msg bot dbsize
or in channel: bot infosize or bot dbsize
returns the file size of INFO2.DB
- New command: bot whisper <nick> about <topic>
darkbot will NOTICE the user, instead of PRIVMSG
- Moved source code and Makefile to source directory -
this keeps the root tree of darkbot clean, nothing
changes for the user, they still type make in the
darkbot root, and the binary will be copied there.
- Repaired get_rand_nick() problem - bot was still returning
it's own nick - *should* be ok now.
- Added Ron's random whut, and dunno function.
Darkbot 7 (alpha 2): Dec 16th, 2001
- Removed #ifdef WIN32 references for sprintf/snprintf,
have included the function snprintf() in general.c,
for older compilers - #define SNPRINTF_SUPPORT should
be switched OFF if your compiler supports snprintf()
this is quite a change.
- Due to lots of people not reading #defines.h and complaining
about make error (clock_t), the configure script
will display an alert about this just before defines.h
is about to be edited.
- New defines - #define CONNECT_WAIT_TIMEOUT [seconds]
#define OP_USERS_ON_LOGIN [on/off]
- New PRIVMSG commands - OP, DEOP, VOICE/V, DEVOICE/DEV/DV/,
DVOICE, KICK/WACK/K, DELETE/REMOVE/
FORGET/DEL, TELL, ADD/REMEMBER/SAVE,
WHERE/WHO, ADDUSER, DIE
Some of them aren't new, but didn't work, and are now fixed.
Just /msg bot tell nick about topic, these commands
usually NOTICE the user, rather than PRIVMSG.
- The connection routine to the server should be better -
instead of quitting after failing to connect, it
will constantly cycle all the servers.
- I've added CYGWIN support in the Makefile - just to hide
those size_t warnings if you get them. If you use
CYGWIN, just use make cygwin
- Permban bug fixed.
- Info/Info2 bug fixed.
- NICK bug fixed - bot will keep the new nick until it quits.
- There is a bug/feature where if a nick has a pipe (|) and
requests a topic that has raw - commands, it ignores
them - looking in to this.
diff --git a/docs/contributors.txt b/docs/contributors.txt
deleted file mode 100755
index b3230c2..0000000
--- a/docs/contributors.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-
- **** Darkbot Contributors ****
-[The following is a list of people who have contributed to Darkbot]
-( If I'm missing anyone please email juice@freezedown.org
-Hopefully this list will be complete by release 7. )
-
-Author/creator - Jason Hamilton (play) Jason @ superlink.net
-Project Administrator - juice (juice) - juice @ freezedown.org
-
-A big portion of Darkbot's code, although primarily and mainly done
-by Jason Hamilton, is also done with the expertise and donnation from
-several people.
-
-Thanks to all for the collaboration!
-
-**** Coders ****
-
-Ron (`ron, ronner) Ron @ freezedown.org - several features, changes and code
- fixes on 6f5,6 and RCs for release 7
-Paul (reet2) Paul @ darkbot.info - several major changes on 6f6 for release 7
-Neil Darlow - code optimization patches on info and check_permban
- on prep 7 - 3/22/2002
-Bart Jansens Typo correction on Dutch language / prep 7 April 10, 2000
-Dan ripper_ @ undernet several major changes - 5f21,22,23,26
-Kosh @ superchat - implementation of WIN32 port
-s0meguy @ undernet - found a missing variable April v. 5f22 -- 16, 23, 2000
-Oleg green @ crimea.edu - "repeated server stoned" and NEED_LIB5
- corrections - 5f18 5f15
-Fouton c592030@everest.cclabs.missouri.edu - #define SGI -f18
-nak @ superchat - VHOST support - 5f11
-Gator @ superchat - 'fclose' issue - 5f3
-[K]aka (at?) - a buffer overflow issue - 5-Beta7
-BLightnin @ undernet - datasearch fix; save topic duplicates
- suggestion of log PRIVMSG - 5-Beta7 4-Alpha2
-rewpaul rew @ undernet - fixed 'pipe' on topics; Q~ variable fix
- suggestion on mask function; Adduser fix; wildcards on topics
- RANDOM_STUFF OFF on 'Sleep' ON - 5-Beta6 - 5-Beta3 4-Beta2 4-Beta1
-gavers @ undernet - found 'pipe' on topics issue' - 5-Beta6 5-Beta1
-`Nenemis (at?) suggestion on notice help join greeting info - 5-Beta3
-wx @ undernet - CTCP replies fix; suggest UP command - 5-Beta1 5-Alpha4
-Zaf @ superchat - suggestion of RANDOM_STUFF Idle - 4-Beta1
-mark @ undernet - license usage agreement update - 4-Beta1
-bow @ undernet - AddServer fix - 4-Alpha2
-
-and several other anonymous contributors
-
-**** Translators ****
-ENGLISH - play <jason@superlink.net>
-FRENCH - Inajira <inajira@videotron.ca>
- - EfX <michel.efx@globetrotter.net>
- - eCHaLoTTe <echalotte@cablevision.qc.ca>
- - Raider <raider@superchat.ws>
-SPANISH - speed1 <speed@edure des.edu.do>
-DUTCH - Asmodai <asmodai@wxs.nl>
- - Dan <dan@ntlbusiness.com>
-LATIN - Otaku <otaku@unixgeek.ml.org>
-GREEK - Chris_CY <chriscy@cylink.net>
- - Raider <raider@superchat.ws>
-EBONICS - rapsux <bitter@ici.net>
-PIG LATIN - Cloud <burtner@usa.net>
-RUSSIAN - KOI8 encoding
-RUSSIAN - CP1251 encoding
- - Oleg Drokin <green@ccssu.crimea.ua>
-PORTUGUESE - Pincel <Pincel@darkbot.info>
-GERMAN - C.Hoegl@gmx.net & marc@reymann.net
- - Dan <dan@ntlbusiness.com>
-ITALIAN - daniele nicolucci <jollino@icemail.it>
-CHINISE - James <jamespower@263.net>
-SWEDISH - Ybznek <sunmo@seaside.se>
-NORWEGIAN - [SoHo] <soho@int19h.com>
-ROMANIAN - Radu <radu.negoescu@sante.univ-nantes.fr>
-ARABIC - MrSiMo <mrsimo7@yahoo.fr>
-
-Other Darkbot related projects
-Darkbot Commander - Alex99 <Alex99@darkbot.info>
-
-**** Helpers ****
-These are people who acknowledgedly colaborate with Darkbot Project
- guidind and helping users trough their difficulties
-... by alpha order...
-Alex99 Alex99@darkbot.info / @ undernet #darkbot
-Andre (Syntax6) Syntax6@darkbot.info / @ undernet #darkbot
-baphomet @ undernet #darkbot
-derv0 @ undernet #darkbot
-BLightnin @ undernet #darkbot
-juice @ undernet #darkbot
-Shaky @ undernet #darkbot
-TuEuR @ undernet #darkbot
-{SID_V} @ undernet #darkbot
-
-**** Special Donnations ****
-Andre (Syntax6) Syntax6@darkbot.info - has hosted Darkbot Web pages
- on his servers.
- Has also donated DNS hosting for Darkbot domains.
-SourceForge, for hosting one of our mirrors, and giving us nifty
-stats and ratings about the project, that we can gawk at and admire.
-LaZZ from www.chatcircuit.net for providing another one of our mirrors.
-
-
-**** " ****
-
-(PLEASE help reconstruct this list by e-mailing juice@freezedown.org)
-Is my intention not having MIA people. Without the due and full
-acknowledgment to whom is being cooperating with Darkbot Project
-this program would never be what it is.)
-
-
-
-
diff --git a/beta/m4/db_enable_command.m4 b/m4/db_enable_command.m4
similarity index 100%
rename from beta/m4/db_enable_command.m4
rename to m4/db_enable_command.m4
diff --git a/beta/m4/extensions.m4 b/m4/extensions.m4
similarity index 100%
rename from beta/m4/extensions.m4
rename to m4/extensions.m4
diff --git a/beta/m4/lib_socket_nsl.m4 b/m4/lib_socket_nsl.m4
similarity index 100%
rename from beta/m4/lib_socket_nsl.m4
rename to m4/lib_socket_nsl.m4
diff --git a/beta/m4/minmax.m4 b/m4/minmax.m4
similarity index 100%
rename from beta/m4/minmax.m4
rename to m4/minmax.m4
diff --git a/beta/m4/timespec.m4 b/m4/timespec.m4
similarity index 100%
rename from beta/m4/timespec.m4
rename to m4/timespec.m4
diff --git a/beta/rebuild_all.sh b/rebuild_all.sh
similarity index 100%
rename from beta/rebuild_all.sh
rename to rebuild_all.sh
diff --git a/scripts/.Launch b/scripts/.Launch
deleted file mode 100755
index 1340d0e..0000000
--- a/scripts/.Launch
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-# simple question script.
-echo
-echo -n "Type ./darkbot to Launch Darkbot"
-echo
-echo
diff --git a/scripts/.Stripdb b/scripts/.Stripdb
deleted file mode 100755
index e2fb72a..0000000
--- a/scripts/.Stripdb
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-# simple question script.
-
-echo
-echo "-----------------------------------------------"
-echo "stripping your darkbot deletes the relocation"
-echo "information and symbol table used by debuggers,"
-echo "This decreases the size of your darkbot bin."
-echo
-ls -l ../source/darkbot
-echo
-echo -n "Would you like to strip your darkbot? [Y/n] "
-read CHOICE
-echo
-case $CHOICE in
- n)
- echo
- echo "Skipping strip..."
- echo
- ;;
- N)
- echo
- echo "Skipping strip..."
- echo
- ;;
- *)
- strip ../source/darkbot
- ls -l ../source/darkbot
- echo
- echo "strip Completed."
- echo
- ;;
-esac
diff --git a/scripts/.Stripdb2 b/scripts/.Stripdb2
deleted file mode 100755
index db8bad5..0000000
--- a/scripts/.Stripdb2
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-# simple question script.
-
-echo
-echo "-----------------------------------------------"
-echo "stripping your darkbot deletes the relocation"
-echo "information and symbol table used by debuggers,"
-echo "This decreases the size of your darkbot bin."
-echo
-ls -l ../source/darkbot.exe
-echo
-echo -n "Would you like to strip your darkbot? [Y/n] "
-read CHOICE
-echo
-case $CHOICE in
- n)
- echo
- echo "Skipping strip..."
- echo
- ;;
- N)
- echo
- echo "Skipping strip..."
- echo
- ;;
- *)
- strip ../source/darkbot.exe
- ls -l ../source/darkbot.exe
- echo
- echo "strip Completed."
- echo
- ;;
-esac
diff --git a/scripts/.info b/scripts/.info
deleted file mode 100755
index d9558a3..0000000
--- a/scripts/.info
+++ /dev/null
@@ -1,9 +0,0 @@
-
- ,----------------------------------------------------,
- | Darkbot should now be compiled. |
- | |
- | If you haven't already, run ./configure |
- | to set up your darkbot. |
- `----------------------------------------------------'
-
-
diff --git a/beta/scripts/Setup b/scripts/Setup
similarity index 100%
rename from beta/scripts/Setup
rename to scripts/Setup
diff --git a/scripts/convertdb b/scripts/convertdb
deleted file mode 100755
index edd8d66..0000000
Binary files a/scripts/convertdb and /dev/null differ
diff --git a/source/Makefile b/source/Makefile
deleted file mode 100755
index 85476ad..0000000
--- a/source/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-# ------------------------------------------------ #
-# Darkbot Makefile (c) Jason Hamilton 07.06.98 #
-# several ongoing modifications by develop team #
-# ------------------------------------------------ #
-# To compile Darkbot, just type 'make' #
-# To compile for Win32 (9x/NT/XP) 'make win' #
-# To compile for Win32 with no console, type #
-# 'make win2' #
-# #
-# To compile in debug mode, type 'make debug' #
-# To compile and have all data be logged to #
-# ..darkbot_debug.log, 'make debug2' #
-# #
-# To compile the database conversion utility, #
-# type 'make convertdb' #
-# ------------------------------------------------ #
-
-CC = gcc
-CFLAGS = -DFORK -Wall -O3
-DFLAGS = -dm -pg -g -DDEBUG
-D2FLAG = -DDEBUG2 -DFORK
-LIBS = -lcrypt
-
-# If you're using Solaris, you'll need to uncomment this next line.
-# LIBS = -lcrypt -lsocket -lnsl -lresolv
-
-####################################################
-
-OBJECTS = main.o vars.o chansrv.o permbans.o helpers.o users.o general.o \
- url.o seen.o topics.o random.o sockets.o raw.o signals.o parse.o \
- chan.o server.o comm.o stats.o quiz.o web.o reserved.o
-
-ALL_SRC = main.c vars.c chansrv.c permbans.c helpers.c users.c general.c \
- url.c seen.c topics.c random.c sockets.c raw.c signals.c parse.c \
- chan.c server.c comm.c stats.c quiz.c web.c reserved.c
-
-all : ${OBJECTS}
- ${CC} ${CFLAGS} ${OBJECTS} ${LIBS} -o ../darkbot
- chmod +x .././configure;
- chmod +x ../scripts/.Stripdb; ../scripts/.Stripdb;
- chmod +x ../scripts/.Launch; ../scripts/.Launch;
-
-clean :
- rm -f ../darkbot ${OBJECTS} convertdb.o
-
-win : ${ALL_SRC}
- ${CC} ${CFLAGS} -DWIN32 ${ALL_SRC} ${LIBS} -o ../darkbot
- chmod +x ../configure;
- chmod +x ../scripts/.Stripdb2; ../scripts/.Stripdb2; cat ../scripts/.info;
- chmod +x ../scripts/.Launch; ../scripts/.Launch;
-
-win2 : ${ALL_SRC}
- ${CC} ${CFLAGS} -DWIN32 ${ALL_SRC} ${LIBS} -DNOCONSOLE -Wl,--subsystem,windows -o ../darkbot-noconsole -luser32
- chmod +x .././configure;
- chmod +x ../scripts/.Stripdb2; ../scripts/.Stripdb2; cat ../scripts/.info;
- chmod +x ../scripts/.Launch; ../scripts/.Launch;
-
-debug : ${OBJECTS}
- ${CC} ${DFLAGS} ${ALL_SRC} ${LIBS} -o ../darkbot
- cat ../.debug ; gdb ../darkbot;
-
-debug2 : ${OBJECTS}
- ${CC} ${LIBS} ${D2FLAGS} ${ALL_SRC} ${LIBS} -o ../darkbot
- cat ../.debug2;
-
-convertdb : convertdb.o
- ${CC} convertdb.c ${LIBS} -o ../convertdb
-
-
diff --git a/beta/source/Makefile.am b/source/Makefile.am
similarity index 100%
rename from beta/source/Makefile.am
rename to source/Makefile.am
diff --git a/source/chan.c b/source/chan.c
index 941a022..785ec26 100755
--- a/source/chan.c
+++ b/source/chan.c
@@ -1,622 +1,617 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
-#ifdef DO_MATH_STUFF
+#ifdef ENABLE_MATH
/* Changed input to be unsigned instead of signed. This
* suppressed warning messages when compiling on Solaris.
*/
void
do_math (const char *who, char *target, char *math)
{
char number_string[STRING_SHORT] = { 0 };
char op = 0;
unsigned char input[STRING_SHORT] = { 0 };
unsigned int index = 0;
unsigned int to = 0;
unsigned int input_length = 0;
unsigned int number_length = 0;
double result = 0.0;
double number = 0.0;
strncpy (input, math, sizeof (input));
input_length = strlen (input);
for (to = 0, index = 0; index <= input_length; index++)
if (*(input + index) != ' ')
*(input + to++) = *(input + index);
input_length = strlen (input);
index = 0;
if (input[index] == '=')
index++;
else
{
number_length = 0;
if (input[index] == '+' || input[index] == '-')
*(number_string + number_length++) = *(input + index++);
for (; isdigit (*(input + index)); index++)
*(number_string + number_length++) = *(input + index);
if (*(input + index) == '.')
{
*(number_string + number_length++) = *(input + index++);
for (; isdigit (*(input + index)); index++)
*(number_string + number_length++) = *(input + index);
}
*(number_string + number_length) = '\0';
if (number_length > 0)
result = atof (number_string);
}
for (; index < input_length;)
{
op = *(input + index++);
number_length = 0;
if (input[index] == '+' || input[index] == '-')
*(number_string + number_length++) = *(input + index++);
for (; isdigit (*(input + index)); index++)
*(number_string + number_length++) = *(input + index);
if (*(input + index) == '.')
{
*(number_string + number_length++) = *(input + index++);
for (; isdigit (*(input + index)); index++)
*(number_string + number_length++) = *(input + index);
}
*(number_string + number_length) = '\0';
number = atof (number_string);
switch (op)
{
case '+':
result += number;
break;
case '-':
result -= number;
break;
case '*':
result *= number;
break;
case '/':
if (number == 0)
{
L016 (target, who);
return;
}
else
result /= number;
break;
case '%':
if ((long) number == 0)
{
L016 (target, who);
return;
}
else
result = (double) ((long) result % (long) number);
break;
default:
L017 (target, who);
return;
}
}
S ("PRIVMSG %s :%s\2:\2 %f\n", target, who, result);
}
#endif
long
cf (char *host, char *nick, char *chan)
{
int f_n = 0;
if (check_access (host, chan, 0, nick) >= 3)
return 0;
f_n = f_f (host);
if (f_n == -1)
{
a_f (host);
return 0;
}
if (ood[f_n].value)
return 1;
ood[f_n].count++;
- if ((time (NULL) - ood[f_n].time) > ft)
+ if ((time (NULL) - ood[f_n].time) > FT)
ood[f_n].count = 0;
- else if ((time (NULL) - ood[f_n].time) <= ft && ood[f_n].count >= fr)
+ else if ((time (NULL) - ood[f_n].time) <= FT && ood[f_n].count >= FR)
{
ood[f_n].value = true;
if (!ood[f_n].kick)
{
ood[f_n].kick = 1;
-#ifdef FLOOD_KICK
if (*chan == '#' || *chan == '&')
{
+#ifdef ENABLE_CHANNEL
+ if (FLOOD_KICK == true)
L018 (chan, nick, FLOOD_REASON, fc, host);
- }
- else
- L019 (CHAN, fc, host);
-#else
- if (*chan == '#' || *chan == '&')
- {
+ else
+#endif
L019 (CHAN, fc, host);
}
else
- L019 (CHAN, fc, host);
-#endif
+ L019 (CHAN, fc, host);
}
return 1;
}
ood[f_n].time = time (NULL);
return 0;
}
/**
* Update a nick's channel greeting and user@host.
* 6/23/00 Dan:
* - All method arguments are now pointers to const data
* - Rewrote to use a for loop, and fewer variables
* - Info is only saved to disk if changes are made
*/
void
update_setinfo (const char *new_uh, const char *new_greetz, const char *nick)
{
struct helperlist *c = helperhead;
bool madeChange = false;
size_t i = 0;
for (; c != NULL; c = c->next)
{
++i;
if (!match_wild (c->uh, new_uh) == 0)
{
strncpy (c->greetz, new_greetz, sizeof (c->greetz));
strlwr (c->uh);
L020 (nick, i, c->uh, new_greetz);
madeChange = true;
}
}
if (madeChange)
{
save_changes ();
}
}
/**
* 6/23/00 Dan:
* - All variables now initialized when declared
* - Altered variable types to reflect usage
*/
void
info (const char *source, char *target)
{
FILE *fp;
clock_t starttime = 0;
char b[STRING_LONG] = { 0 };
size_t topics = 0, dup = 0;
time_t t2time = 0, c_uptime = 0;
-
-#ifdef FIND_DUPS
char *ptr = NULL, *subj = NULL;
- char last[STRING_LONG] = { 0 };
-#endif
+ char last[STRING_LONG] = { 0 };
t2time = time (NULL);
unlink (TMP_URL);
starttime = clock ();
fp = fopen (URL2, "r");
if (NULL == fp)
{
L003 (source, URL2);
return;
}
while (fgets (b, STRING_LONG, fp))
{
topics++;
-#ifdef FIND_DUPS
- if(*b == '\n')
- continue;
-
- stripline (b);
- subj = strtok (b, " ");
- ptr = strtok (NULL, "");
- strlwr (subj);
- if (stricmp (last, subj) == 0)
+ if (FIND_DUPS)
{
+ if(*b == '\n')
+ continue;
+
+ stripline (b);
+ subj = strtok (b, " ");
+ ptr = strtok (NULL, "");
+ strlwr (subj);
+ if (strcasecmp (last, subj) == 0)
+ {
dup++;
-#ifdef SAVE_DUPS
- db_log (BACKUP_DUP, "%s %s\n", subj, ptr);
-#endif
- }
- else
- {
+ if (SAVE_DUPS)
+ db_log (BACKUP_DUP, "%s %s\n", subj, ptr);
+ }
+ else
+ {
db_log (TMP_URL, "%s %s\n", subj, ptr);
+ }
+ strncpy (last, subj, sizeof (last));
+ last[sizeof (last) - 1] = '\0';
}
- strncpy (last, subj, sizeof (last));
- last[sizeof (last) - 1] = '\0';
-#endif
}
fclose (fp);
rename (TMP_URL, URL2);
-#ifdef FIND_DUPS
- if (dup > 0)
+ if ((FIND_DUPS) && (dup > 0))
{
L025 (target, dup);
}
-#endif
c_uptime = time (NULL) - uptime;
topics -= dup;
if (c_uptime > 86400)
{
L026 (target,
dbVersion,
topics,
c_uptime / 86400,
(c_uptime / 86400 ==
1) ? "" : "s",
(c_uptime / 3600) % 24,
(c_uptime / 60) % 60, QUESTIONS,
ADDITIONS, DELETIONS,
(double) (clock () -
starttime) /
CLOCKS_PER_SEC, (((double) (clock () - starttime) / CLOCKS_PER_SEC) == 1) ? "" : "s");
}
else if (c_uptime > 3600)
{
L027 (target,
dbVersion,
topics,
c_uptime / 3600,
c_uptime / 3600 == 1 ? "" : "s",
(c_uptime / 60) % 60,
(c_uptime / 60) % 60 ==
1 ? "" : "s", QUESTIONS,
ADDITIONS, DELETIONS,
(double) (clock () -
starttime) /
CLOCKS_PER_SEC, (((double) (clock () - starttime) / CLOCKS_PER_SEC) == 1) ? "" : "s");
}
else
{
L028 (target,
dbVersion,
topics,
c_uptime / 60,
c_uptime / 60 == 1 ? "" : "s",
c_uptime % 60,
c_uptime % 60 == 1 ? "" : "s",
QUESTIONS, ADDITIONS, DELETIONS,
(double) (clock () - starttime) / CLOCKS_PER_SEC, (((double)
(clock () -
starttime) /
CLOCKS_PER_SEC) == 1) ? "" : "s");
}
-/* get_stats(target, NULL); */
+//#ifdef ENABLE_STATS
+// get_stats(target, NULL); */
+//#endif
}
/**
* Output information about the bot's database to a target.
* 6/22 Dan:
* - Changed both method arguments to be pointers to const data,
* this is a read only method.
*/
void
-show_info2 (const char *target, const char *source)
+show_info2 (const char *target, const char *source, enum chanserv_invoke_type invoked)
{
- S ("PRIVMSG %s :%s, compiled on %s. "
+ S ("%s %s :%s, compiled on %s. "
"I have processed %ld lines of text since startup...\n",
- target, source, __DATE__, NUMLINESSEEN);
+ (invoked == MSG_INVOKE) ? "NOTICE" : "PRIVMSG", target,
+ source, __DATE__, NUMLINESSEEN);
}
/**
* 6/23/00 Dan:
* - All method arguments are now pointer to const
* - Return type is now time_t
* - A for loop is now used instead of a while loop
*/
time_t
return_useridle (const char *chan, const char *who, int toggle)
{ /* toggle=0 is for idle time, toggle=1 is to check if user
is in the chan */
const struct userlist *c = userhead;
for (; c != NULL; c = c->next)
{
- if (!stricmp (who, c->nick) && !stricmp (chan, c->chan))
+ if (!strcasecmp (who, c->nick) && !strcasecmp (chan, c->chan))
{
if (toggle == 1)
{
/* If we only care if user is present or not.. */
return 1;
}
else
return c->idle;
} /* if */
} /* for */
return 0;
}
void
process_nick (char *nick, char *newnick)
{
struct userlist *c;
c = userhead;
newnick++;
while (c)
{
- if (stricmp (nick, c->nick) == 0)
+ if (strcasecmp (nick, c->nick) == 0)
{
strncpy (c->nick, newnick, sizeof (c->nick));
}
c = c->next;
}
}
/**
* 6/23/00 Dan:
* - All method arguments are now pointer to const
* - A for loop is now used instead of a while loop
*/
void
show_chaninfo (const char *nick, const char *chan, const char *target)
{
size_t totalUsers = 0, foundUsers = 0;
const struct userlist *c = userhead;
for (; c != NULL; c = c->next)
{
++totalUsers;
- if (!stricmp (chan, c->chan))
+ if (!strcasecmp (chan, c->chan))
++foundUsers;
}
S ("PRIVMSG %s :%s, I see %d users in %s (%d users total in ram)\n",
target, nick, foundUsers, chan, totalUsers);
}
/*
* This function displays a list of users that are listed in the bot's internal user
* list as being on the channel pointed to by chan, to the nick pointed to by nick.
* Each message sent to the target should be no more than 200 characters in length.
*/
void show_chanusers (const char *nick, const char *chan)
{
const struct userlist *c = userhead;
char DATA [STRING_SHORT * 7] = {0},
tmp [STRING_SHORT] = {0};
size_t foundUsers = 0, len = 0;
for (; c != NULL; c = c->next)
{
- if (stricmp (chan, c->chan) == 0)
+ if (strcasecmp (chan, c->chan) == 0)
{
++foundUsers;
snprintf (tmp, sizeof (tmp), "%s", DATA);
/* The check for DATA being NULL is done to prevent ugly looking spaces
* at the beginning of the line when it's outputted.
*/
snprintf (DATA, (sizeof (DATA) + sizeof (tmp)),
"%s%s%s",
tmp,
(DATA == NULL ? "" : " "),
c->nick);
/* Add the length of the new nick and room for a space to the length
* of the current buffer.
*/
len += (strlen (c->nick) + 1);
memset (tmp, 0, sizeof (tmp));
if (len >= 200)
{
S ("NOTICE %s :%s\n", nick, DATA);
len = 0;
memset (DATA, 0, sizeof (DATA));
db_sleep (2);
}
}
}
/* If there's any leftover data in our buffer after we've reached the end of the list,
* send that as well.
*/
if (len > 0)
S ("NOTICE %s :%s\n", nick, DATA);
/* Even if no users were found... */
S ("NOTICE %s :End of CHANUSERS list; %d user%s found.\n",
nick, foundUsers, (foundUsers == 1 ? "" : "s"));
}
void
do_modes (char *source, char *data)
{
char *chan = NULL, *mode = NULL, *nick = NULL, *ptr = NULL;
long PM = 0, j = 0, i = 0;
chan = strtok (data, " ");
mode = strtok (NULL, " ");
if ((ptr = strchr (source, '!')) != NULL)
*ptr++ = '\0';
j = strlen (mode);
i = -1; /* i needs to start at 0 */
while (j > 0)
{
j--;
i++;
if (mode[i] == '+')
PM = 1;
if (mode[i] == '-')
PM = 0;
if (mode[i] == 'o')
{
nick = strtok (NULL, " ");
+ do_op(nick, chan, PM); /* flag this member as having been (De)OP'd/ */
continue;
}
if (mode[i] == 'v')
{ /* voice sucks, ignore it */
nick = strtok (NULL, " ");
continue;
}
if (mode[i] == 'k' || mode[i] == 'b')
{
nick = strtok (NULL, " ");
if (nick[0] == '*' && nick[1] == '!')
{
nick += 2;
}
strlwr (nick);
if (PM == 1)
scan_chan_users (chan, source, nick);
continue;
}
if (mode[i] == 'l' && PM == 1)
{ /* don't parse if -limit
* since no parms */
nick = strtok (NULL, " ");
continue;
}
}
}
/**
* do_quit
*
* Purpose:
* 1) delete all instances when a nick matches (nick)
* 2) delete all users off a given channel
* 2) delete everything (i.e., when the bot is disconnected from irc)
*
* toggle 1 = delete user.
* toggle 2 = delete chan
* toggle 3 = everything (when I'm killed).
*/
void
do_quit (const char *nick, long toggle)
{
struct userlist *pNode = userhead;
struct userlist *pPrev = NULL;
if (toggle == 1)
{
/* delete user */
while (pNode)
{
- if (stricmp (pNode->nick, nick) == 0)
+ if (strcasecmp (pNode->nick, nick) == 0)
{
/* found a match, remove it */
save_seen (pNode->nick, pNode->uh, pNode->chan);
if (pPrev != NULL)
{
pPrev->next = pNode->next;
free (pNode);
pNode = pPrev->next;
}
else
{
/* first node in the list */
userhead = pNode->next;
free (pNode);
pNode = userhead;
}
}
else
{
/* No match, continue to next node */
pPrev = pNode;
pNode = pNode->next;
}
}
}
else if (toggle == 2)
{
/* delete channel */
while (pNode)
{
- if (stricmp (pNode->chan, nick) == 0)
+ if (strcasecmp (pNode->chan, nick) == 0)
{
/* found a match, remove it */
save_seen (pNode->nick, pNode->uh, pNode->chan);
if (pPrev != NULL)
{
pPrev->next = pNode->next;
free (pNode);
pNode = pPrev->next;
}
else
{
/* first node in the list */
userhead = pNode->next;
free (pNode);
pNode = userhead;
}
}
else
{
/* No match, continue to next node */
pPrev = pNode;
pNode = pNode->next;
}
}
}
else if (toggle == 3)
{
struct userlist *tempPtr = userhead;
while (pNode)
{
tempPtr = pNode->next;
free (pNode);
pNode = tempPtr;
}
}
}
long
f_f (char *host)
{
int i = 0;
for (i = 0; i < fc; i++)
if (!strcasecmp (ood[i].host, host))
return i;
return -1;
}
void
a_f (char *host)
{
if (++fc > 100)
fc = 0;
fc--;
strncpy (ood[fc].host, host, sizeof (ood[fc].host));
ood[fc].time = time (NULL);
ood[fc].count = 0;
ood[fc].value = false;
fc++;
}
void
reset_ (void)
{
int i = 0;
for (i = 0; i < fc; i++)
{
if (ood[i].value && (time (NULL) - ood[i].time) > rt)
{
ood[i].count = 0;
ood[i].time = time (NULL);
ood[i].value = false;
ood[i].kick = 0;
}
}
}
diff --git a/source/chansrv.c b/source/chansrv.c
index 32592e5..f297238 100755
--- a/source/chansrv.c
+++ b/source/chansrv.c
@@ -1,1953 +1,2533 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
-void
-chanserv (char *source, char *target, char *buf)
+// FIXME: When the command is invoked in a channel, target is the channel name, otherwise target is the bots name?
+// Due to the original nature of this code, some of these routines assume the in channel case, others assume the /msg case.
+// Also check the commands that can have a channel argument work the same in and out of channel.
+
+enum chanserv_command_type
{
- char *cmd = NULL, *s = NULL, *s2 = NULL, *s3 = NULL, *s4 = NULL, *s5 = NULL;
- char *ptr3 = NULL, temp[1024] = { 0 }, *userhost = NULL;
- long sn2 = 0, sn = 0, i = 0, unixtime = 0;
- struct stat statbuf;
+ INFO_COMMAND = 0,
+ SAFE_COMMAND = 1,
+ NORMAL_COMMAND = 2,
+ DANGER_COMMAND = 3,
+ PASSWORD_COMMAND = 4
+};
-#ifdef RANDOM_STUFF
- if (stricmp (target, CHAN) == 0)
- Rand_Idle = 0;
-#endif
- stripline (buf);
- stripline (source);
- if (buf == NULL || target == NULL || source == NULL)
- return;
- cmd = strtok (buf, " ");
- if (cmd == NULL)
- return;
- if (*cmd == ':')
- cmd++;
- if ((userhost = strchr (source, '!')) != NULL)
+struct chanserv_command
+{
+ enum chanserv_command_type type;
+ int access;
+ int arg_count;
+ int too_many; /* Check for too many args */
+ struct chanserv_output *(*func) (char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost);
+ char *command[5];
+ char *syntax;
+ char *summary;
+};
+
+struct chanserv_output
+{
+ char *output;
+ struct chanserv_output *next;
+};
+
+struct chanserv_output *chanserv_show_help(char *cmd, int user_level);
+
+
+struct chanserv_output *chanserv_asprintf(struct chanserv_output *output, const char *format, ...)
+{
+ struct chanserv_output *result = NULL;
+ static char temp[BUFSIZ]; /* a temp buffer (8KB) */
+ va_list list;
+ int r;
+
+ va_start(list, format);
+ r = vsprintf(temp, format, list);
+ va_end(list);
+
+ if (r >= 0)
+ {
+ char *ptr;
+
+ ptr = malloc(r + 1);
+ if (ptr)
+ {
+ result = malloc(sizeof(struct chanserv_output));
+ if (result)
+ {
+ strncpy(ptr, temp, r); /* copy at most n */
+ ptr[r] = '\0'; /* ensure \0 at end */
+
+ result->output = ptr;
+ result->next = NULL;
+ if (output)
+ {
+ struct chanserv_output *next = output;
+
+ while (next->next)
+ next = next->next;
+ next->next = result;
+ result = output;
+ }
+ }
+ else
+ free(ptr);
+ }
+
+ }
+ if (result == NULL)
{
- *userhost++ = '\0';
+ ;// FIXME: Should bitch about lack of ram.
}
+ return result;
+}
- if ( check_ignore_user_ram ( source ) > 0 )
- return;
-
- /* ------ commands that require a privmsg ------ */
- if (*target != '#' && *target != '&' && *target != '+')
+void chanserv_output_free(struct chanserv_output *output)
+{
+ while (output)
+ {
+ struct chanserv_output *next = output->next;
+
+ free(output->output);
+ free(output);
+ output = next;
+ }
+}
+
+
+struct chanserv_output *chanserv_add(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = { 0 }, topic [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Add what?");
+
+ /* Save topic since we're chopping args[0] off later. */
+ strncpy (topic, args[0], sizeof (topic));
+
+ /* Check to make sure the topic doesn't exist first. */
+ if (check_existing_url(source, topic, target) == 1)
{
- if (stricmp (cmd, "PASS") == 0
- || stricmp (cmd, "PASSWORD") == 0 || stricmp (cmd, "PASSWD") == 0)
- {
- s = strtok (NULL, " ");
- s2 = strtok (NULL, " ");
- if (s == NULL || s2 == NULL)
- {
- L031 (source, Mynick);
- return;
- }
- if (strlen (s2) > 25)
- s2[25] = '\0';
- set_pass (source, userhost, s, s2);
- return;
- }
- else if (stricmp (cmd, "DBSIZE") == 0 || stricmp (cmd, "INFOSIZE") == 0)
- {
- if (check_access (userhost, "#*", 0, source) >= 2)
- {
- if (stat (URL2, &statbuf) == 0)
- {
- S ("NOTICE %s :My database file is presently %ld byte%s in size.\n",
- source,
- statbuf.st_size,
- statbuf.st_size == 1 ? "" : "s");
- }
- else
- {
- return;
- }
- }
- }
- else if (stricmp (cmd, "OP") == 0)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- return;
- if (check_access (userhost, s, 0, source) >= 3)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- {
- return;
- }
- S ("MODE %s +oooooo %s\n", s, s2);
- }
+ return chanserv_asprintf(result, "%s \37%s\37\n",
+ EXISTING_ENTRY, topic);
+ }
- }
-#ifdef RANDOM_STUFF
- else if (stricmp (cmd, "RANDOMSTUFF") == 0 || stricmp (cmd, "RANDSTUFF") == 0 ||
- stricmp (cmd, "RS") == 0)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- return;
- if (check_access (userhost, s, 0, source) >= RAND_LEVEL)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- {
- L064n (source, source);
- return;
- }
- add_randomstuff (source, source, s2);
- }
- }
+ /* Cut off the first argument (the topic) */
+ args++;
+
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ return chanserv_asprintf(result, "What info is to be added for %s?", topic);
+
+ // Fix for some segmentation fault problems
+ // concerning topics consisting entirely of
+ // wildcard characters.
+ if (strspn(topic, "*?") == strlen(topic))
+ return chanserv_asprintf(NULL, "Sorry, but support for that topic has been removed.");
+
+ /* FIXME: If both things happen, result is overwritten with
+ * the second event, and the first truncation isn't displayed
+ */
+ if (strlen(topic) > MAX_TOPIC_SIZE)
+ {
+ topic[MAX_TOPIC_SIZE] = '\0';
+ result = chanserv_asprintf(NULL, "Topic is over the limit, and has had characters truncated.");
+ }
+
+ if (strlen(str) > MAX_DATA_SIZE)
+ {
+ str[MAX_DATA_SIZE] = '\0';
+ result = chanserv_asprintf(NULL, "Data is over the limit, and has had characters truncated.");
+ }
+
+ strlwr(topic);
+
+ /* Don't allow the topic to be an rdb file name. */
+ if (*topic == '~')
+ return chanserv_asprintf(result, "Rdb files can only be called from the data of a topic, they cannot be used in the topic itself.");
+
+ if (LOG_ADD_DELETES)
+ db_log(ADD_DELETES, "[%s] %s!%s ADD %s %s\n", date(), source,
+ userhost, topic, str);
+
+ ADDITIONS++;
+
+ if ((strspn (topic, "ilc")) == 3 ||
+ (strspn (topic, "iln")) == 3)
+ {
+ db_log(URL2, "%s ([%s] %s!%s): %s\n", topic, date(),
+ source, userhost, str);
+ }
+ else
+ {
+ db_log(URL2, "%s %s\n", topic, str);
+ }
+ return chanserv_asprintf(result, "Okay.");
+}
+
+struct chanserv_output *chanserv_add_user(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char temp[1024] = { 0 };
+ long sn = 0;
+
+ if (!args || !args[0] || !args[1] || !args[2] || !args[3])
+ return result;
+ sn = atoi(args[2]);
+ if (sn > 10 || sn <= 0)
+ return result;
+ if (strlen(args[1]) < 7)
+ return result;
+ snprintf(temp, sizeof (temp), "I haven't used \2%cSETINFO\2 yet!", *CMDCHAR);
+ add_helper(args[0], mask_from_nick(args[1], target), sn, 0, temp, args[3], 0);
+ save_changes();
+
+ return chanserv_asprintf(NULL, "Added user: %s - level %d.", mask_from_nick(args[1], target), sn);
+}
+
+struct chanserv_output *chanserv_alarm(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ char temp[1024] = { 0 };
+ time_t sn = 0, unixtime = 0;
+ long i = 0;
+
+ if (!args || !args[0] || !args[1] || (strlen(args[0]) < 2))
+ return chanserv_asprintf(NULL, "Syntax: <time type: \2d/h/m/s\2><time> <text to say>");
+
+ if (*args[0] == 'd')
+ {
+ /* Days. */
+ sn = 86400;
+ args[0]++;
+ }
+ else if (*args[0] == 'h')
+ {
+ /* Hours */
+ sn = 3600;
+ args[0]++;
+ }
+ else if (*args[0] == 'm')
+ {
+ /* Minutes */
+ sn = 60;
+ args[0]++;
+ }
+ else if (*args[0] == 's')
+ {
+ /* Seconds */
+ sn = 1;
+ args[0]++;
+ }
+ else
+ {
+ return chanserv_asprintf(NULL, "Syntax: <time type: \2d/h/m/s\2><time> <text to say>");
+ }
+
+
+ snprintf(temp, sizeof (temp), "%s/%ld",
+ DBTIMERS_PATH,
+ (atoi (args[0]) * sn) + time (NULL));
+
+ db_log(temp, "PRIVMSG %s :\2ALARMCLOCK\2 by %s!%s: %s", target, source, userhost, args[1]);
+
+ unixtime = atoi (args[0]) * sn;
+
+ if (unixtime > 86400)
+ result = chanserv_asprintf(NULL, "alarmclock set to go off in %d day%s, %02d:%02d.",
+ unixtime / 86400,
+ plural((unixtime / 86400)),
+ (unixtime / 3600) % 24,
+ (unixtime / 60) % 60);
+ else if (unixtime > 3600)
+ result = chanserv_asprintf(NULL, "alarmclock set to go off in %d hour%s, %d min%s.",
+ unixtime / 3600,
+ plural ((unixtime / 3600)),
+ (unixtime / 60) % 60,
+ plural (((unixtime / 60) % 60)));
+ else
+ result = chanserv_asprintf(NULL, "alarm clock set to go off in %d minute%s, %d sec%s.",
+ unixtime / 60,
+ unixtime / 60 == 1 ? "" : "s",
+ unixtime % 60,
+ unixtime % 60 == 1 ? "" : "s");
+
+ return result;
+}
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_autotopic(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char topic [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ return result;
+ if (db_argstostr(topic, args, 0, ' ') < 1)
+ return result;
+
+ set_autotopic (source, target, topic);
+
+ return result;
+}
#endif
- else if (stricmp (cmd, "DEOP") == 0)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- return;
- if (check_access (userhost, s, 0, source) >= 3)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- {
- return;
- }
- S ("MODE %s -oooooo %s\n", s, s2);
- }
- }
- else if (stricmp (cmd, "VOICE") == 0 || stricmp (cmd, "V") == 0)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- return;
- if (check_access (userhost, s, 0, source) >= 3)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- {
- return;
- }
- S ("MODE %s +vvvvvv %s\n", s, s2);
- }
+//#ifndef WIN32
+struct chanserv_output *chanserv_backup(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ char temp[1024] = { 0 };
- }
- else if (stricmp (cmd, "DEV") == 0
- || stricmp (cmd, "DV") == 0
- || stricmp (cmd, "DEVOICE") == 0 || stricmp (cmd, "DVOICE") == 0)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- return;
- if (check_access (userhost, s, 0, source) >= 3)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- {
- return;
- }
- S ("MODE %s -vvvvvv %s\n", s, s2);
- }
- }
- else if ((stricmp (cmd, "KICK") == 0
- || stricmp (cmd, "WACK") == 0
- || stricmp (cmd, "K") == 0 || stricmp (cmd, "NAIL") == 0))
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- return;
- if (check_access (userhost, s, 0, source) >= 3)
- {
- s2 = strtok (NULL, " ");
- s3 = strtok (NULL, "");
- if (s2 == NULL)
- {
- S ("NOTICE %s :You must specity a nick to kick from %s!\n", source, s);
- return;
- }
- if (s3 == NULL)
- {
- S ("KICK %s %s %s\n", s, s2, DEFAULT_KICK);
- }
- else
- {
- S ("KICK %s %s %s\n", s, s2, s3);
- }
- }
- }
+ snprintf(temp, sizeof (temp), "/bin/cp -f %s %s_`date +%%F_%%R.bak`\n", URL2, URL2);
+ system (temp);
-#if ALLOW_DELETE_IN_MSG == ON
- else if (stricmp (cmd, "DELETE") == 0
- || stricmp (cmd, "REMOVE") == 0
- || stricmp (cmd, "FORGET") == 0 || stricmp (cmd, "DEL") == 0)
- {
-#ifdef REQ_ACCESS_DEL
- if (check_access (userhost, "#*", 0, source) >= 1)
- {
+ return chanserv_asprintf(NULL, "Backed up database.");
+}
+//#endif
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_ban_list(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ show_banlist (source);
+ return result;
+}
#endif
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- S ("NOTICE %s :%s what, %s?\n", source, cmd, source);
- return;
- }
- if (strlen (s2) > MAX_TOPIC_SIZE)
- s2[MAX_TOPIC_SIZE] = '\0';
-#ifdef LOG_ADD_DELETES
- db_log (ADD_DELETES, "[%s] %s!%s DEL %s\n", date (), source, userhost, s2);
+
+#ifdef ENABLE_MATH
+struct chanserv_output *chanserv_calc(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result;
+ if (strlen(args[0]) > 200)
+ args[0][200] = '\0';
+ do_math(source, target, args[0]);
+
+ return result;
+}
#endif
- if (*s2 == '~')
- { /* need level 2 to delete .rdb files */
- if (check_access (userhost, "#*", 0, source) >= 2)
- {
- delete_url (source, s2, source);
- }
- return;
- }
- delete_url (source, s2, source);
-#ifdef REQ_ACCESS_DEL
- }
+
+struct chanserv_output *chanserv_chan_info(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result;
+ else
+ /* If args[0] is not a valid channel name, just use the current channel */
+ show_chaninfo (source, ((*args[0] == '#' || *args[0] == '&' || *args[0] == '+') ? args[0] : target), target);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_chan_users(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ show_chanusers (source, target);
+ else
+ /* If args[0] is not a valid channel name, just use the current channel. */
+ show_chanusers (source, ((*args[0] == '#' || *args[0] == '&' || *args[0] == '+') ? args[0] : target));
+
+ return result;
+}
+
+struct chanserv_output *chanserv_char(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result;
+
+ return chanserv_asprintf(NULL, "%c -> %d.", args[0][0], args[0][0]);
+}
+
+struct chanserv_output *chanserv_char_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ return chanserv_asprintf(NULL, "My command char is: %c.", *CMDCHAR);
+}
+
+struct chanserv_output *chanserv_cpu_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ getrusage(RUSAGE_SELF, &r_usage);
+
+ return chanserv_asprintf(NULL, "CPU usage: %ld.%06ld, System = %ld.%06ld.", r_usage.ru_utime.tv_sec, r_usage.ru_utime.tv_usec, r_usage.ru_stime.tv_sec, r_usage.ru_stime.tv_usec);
+}
+
+struct chanserv_output *chanserv_cycle(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+ int i = 0;
+
+ /* Check for channel list parameter being specified. */
+ if (!args | !args[0])
+ {
+ S ("PART %s\n", target);
+ S ("JOIN %s\n", target);
+ }
+ else
+ {
+ result = chanserv_asprintf(NULL, "Cycling %s.", args[0]);
+ S("PART %s\n", args[0]);
+ S("JOIN %s\n", args[0]);
+ }
+
+ return result;
+}
+
+struct chanserv_output *chanserv_data_search(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "What should I be %sing for?", cmd);
+ printf ("args[0] = %s\n", args[0]);
+ datasearch (source, args[0], target);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_date(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ return chanserv_asprintf(NULL, "%s.", date());
+}
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_delban(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Enter the user@host to purge!");
+ if (del_permban(source, args[0]) == 1)
+ S("MODE %s -b %s\n", target, args[0]);
+ else
+ result = chanserv_asprintf(NULL, "No such ban.");
+
+ return result;
+}
#endif
+
+struct chanserv_output *chanserv_delete(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "%s what?", cmd);
+ if (strlen (args[0]) > MAX_TOPIC_SIZE)
+ args[0][MAX_TOPIC_SIZE] = '\0';
+ if (LOG_ADD_DELETES)
+ db_log (ADD_DELETES, "[%s] %s!%s DEL %s\n", date (), source, userhost, args[0]);
+ if (*args[0] == '~')
+ { /* need level 2 to delete .rdb files */
+ if (invoked == MSG_INVOKE)
+ {
+ if (check_access (userhost, "#*", 0, source) >= 2)
+ delete_url (source, args[0], source);
}
-#endif
- else if (stricmp (cmd, "TELL") == 0)
+ else
{
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- L085n (source, source);
- return;
- }
- s3 = strtok (NULL, " ");
- if (s3 == NULL)
- {
- L083n (source, source, s2);
- return;
- }
- if (stricmp (s3, Mynick) == 0)
- return; /* don't bother telling
- * myself about stuff */
- if (stricmp (s3, "ABOUT") == 0)
- {
- s4 = strtok (NULL, " ");
- if (s4 == NULL)
- {
- L084n (source, source, s2);
- return;
- }
- strlwr (s4);
- show_url (source, get_multiword_topic (s4), s2, 1, 0, userhost, 1);
- }
- else
- {
- strlwr (s3);
- show_url (source, get_multiword_topic (s3), s2, 1, 0, userhost, 1);
- }
+ if (check_access (userhost, target, 0, source) >= 2)
+ delete_url (source, args[0], target);
}
+ return result;
+ }
+ if (invoked == MSG_INVOKE)
+ delete_url (source, args[0], source);
+ else
+ delete_url (source, args[0], target);
-#if ALLOW_ADD_IN_MSG == ON
- else if (stricmp (cmd, "ADD") == 0
- || stricmp (cmd, "REMEMBER") == 0
- || stricmp (cmd, "SAVE") == 0 || stricmp (cmd, "STORE") == 0)
- {
-#ifdef REQ_ACCESS_ADD
- if (check_access (userhost, "#*", 0, source) >= 1)
- {
-#endif
- s2 = strtok (NULL, " ");
-
- if (s2 == NULL)
- {
- L065n (source, source);
- return;
- }
-
- // Fix for some segmentation fault problems
- // concerning topics consisting entirely of
- // wildcard characters.
- if (strspn(s2, "*?") == strlen(s2))
- {
- Lbadtopic2(source, source);
- return;
- }
-
- if (strlen (s2) > MAX_TOPIC_SIZE)
- {
- s2[MAX_TOPIC_SIZE] = '\0';
- S ("NOTICE %s :%s, topic is over the limit, and has characters truncated.\n",
- source, source);
- }
- s3 = strtok (NULL, "");
- if (s3 == NULL)
- {
- L066n (source, source, s2);
- return;
- }
- if (strlen (s3) > MAX_DATA_SIZE)
- s3[MAX_DATA_SIZE] = '\0';
- strlwr (s2);
- if (*s2 == '~')
- {
- S ("NOTICE %s :%s, rdb files can only be called from the data of a topic, they cannot be used in the topic itself.\n", source, source);
- return;
- }
- if (check_existing_url (source, s2, target) == 1)
- {
- S ("NOTICE %s :%s \37%s\37\n", source, EXISTING_ENTRY, s2);
- return;
- }
-#ifdef LOG_ADD_DELETES
- db_log (ADD_DELETES, "[%s] %s!%s ADD %s %s\n", date (), source, userhost, s2, s3);
-#endif
- ADDITIONS++;
- if (s2[0] == 'i' && s2[1] == 'l' && s2[2] == 'c')
- {
- db_log (URL2, "%s ([%s] %s!%s): %s\n", s2, date (), source, userhost, s3);
- }
- else
- db_log (URL2, "%s %s\n", s2, s3);
- L067n (source, source);
-#ifdef REQ_ACCESS_ADD
- }
-#endif
- }
+ return result;
+}
+
+struct chanserv_output *chanserv_deluser(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Enter the user@host to delete!");
+ delete_user_ram (source, args[0]);
+
+ return result;
+}
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_deop(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0}, chan[STRING_LONG] = {0};
+
+ /* Make sure first arg, which should be target chan, is there. */
+ if (!args || !args[0])
+ return result;
+
+ strncpy (chan, args[0], sizeof (chan));
+
+ /* Chop of first arg, since we have a copy as chan. */
+ args++;
+
+ db_argstostr (str, args, 0, ' ');
+
+ if ((invoked == MSG_INVOKE) || (*chan == '#'))
+ {
+ if (check_access (userhost, chan, 0, source) >= 3)
+ {
+ if (str[0] == '\0')
+ return result;
+ S ("MODE %s -oooooo %s\n", chan, str);
+ }
+ }
+ else
+ {
+ if (str[0] == '\0')
+ S ("MODE %s -oooooo %s\n", target, chan);
+ else
+ S ("MODE %s -oooooo %s %s\n", target, chan, str);
+ }
+
+ return result;
+}
+
+struct chanserv_output *chanserv_devoice(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char chan [STRING_LONG] = {0}, str [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ return result;
+
+ strncpy (chan, args[0], sizeof (chan));
+ args++;
+ db_argstostr (str, args, 0, ' ');
+
+ if ((invoked == MSG_INVOKE) || (*chan == '#'))
+ {
+ if (check_access (userhost, chan, 0, source) >= 3)
+ {
+ if (str[0] == '\0')
+ return result;
+ S ("MODE %s -vvvvvv %s\n", chan, str);
+ }
+ }
+ else
+ {
+ if (str[0] == '\0')
+ S ("MODE %s -vvvvvvv %s\n", target, chan);
+ else
+ S ("MODE %s -vvvvvvv %s %s\n", target, chan, str);
+ }
+
+ return result;
+}
#endif
- else if (stricmp (cmd, "WHERE") == 0
- || stricmp (cmd, "WHO") == 0 || stricmp (cmd, "WHAT") == 0)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- L086n (source, source);
- return;
- }
- s3 = strtok (NULL, " ");
- if (s3 == NULL)
- return;
- strlwr (s3);
- ptr3 = strchr (s3, '?');
- if (ptr3 != NULL)
- memmove (ptr3, ptr3 + 1, strlen (ptr3 + 1) + 1);
- ptr3 = strchr (s3, '!');
- if (ptr3 != NULL)
- memmove (ptr3, ptr3 + 1, strlen (ptr3 + 1) + 1);
- if (stricmp (s3, "A") == 0 || stricmp (s3, "AN") == 0)
- {
- s4 = strtok (NULL, " ");
- if (s4 == NULL)
- {
- L087n (source, cmd, s2, s3, *CMDCHAR);
- return;
- }
- show_url (source, get_multiword_topic (s4), source, 1, 0, userhost, 0);
- }
- else
- show_url (source, get_multiword_topic (s3), source, 1, 0, userhost, 0);
- }
- else if (stricmp (cmd, "ADDUSER") == 0)
- {
- if (check_access (userhost, "#*", 0, source) >= 3)
- {
- s4 = strtok (NULL, " ");
- s = strtok (NULL, " ");
- s2 = strtok (NULL, " ");
- s5 = strtok (NULL, " ");
- if (s == NULL || s4 == NULL || s2 == NULL || s5 == NULL)
- {
- L055 (source);
- return;
- }
- sn = atoi (s2);
- if (sn > 10 || sn <= 0)
- return;
- if (strlen (s) < 7)
- return;
- L056 (*CMDCHAR);
- add_helper (s4, mask_from_nick(s, target), sn, 0, temp, s5, 0);
- L057 (source, mask_from_nick(s, target), sn);
- save_changes ();
- }
- }
- else if (stricmp (cmd, "DIE") == 0 || stricmp (cmd, "QUIT") == 0)
- {
- s = strtok (NULL, "");
- if (check_access (userhost, "#*", 0, source) >= 3)
- {
- if (s == NULL)
- {
- L032 (source);
- }
- else
- Snow ("QUIT :K\2\2illed (%s (%s))\n", source, s);
- db_sleep (1);
-#ifdef WIN32
- printf ("\n\nGood-bye! %s (c) Jason Hamilton\n\n", dbVersion);
- uptime = time (NULL) - uptime;
- printf
- ("Time elapsed: %ld hour%s, %ld min%s\n\n",
- uptime / 3600,
- uptime / 3600 == 1 ? "" : "s",
- (uptime / 60) % 60, (uptime / 60) % 60 == 1 ? "" : "s");
- db_sleep (5);
+
+struct chanserv_output *chanserv_die(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+ long unixtime = 0;
+
+ if (!args || !args[0])
+ Snow("QUIT :K\2\2illed (%s (cause I say so!))\n", source);
+ else
+ {
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ return result;
+ Snow("QUIT :K\2\2illed (%s (%s))\n", source, str);
+ }
+
+ db_sleep (1);
+
+ printf ("\n\nGood-bye! %s (c) Jason Hamilton\n\n", dbVersion);
+ uptime = time (NULL) - uptime;
+ printf("Time elapsed: %ld hour%s, %ld min%s\n\n",
+ uptime / 3600,
+ uptime / 3600 == 1 ? "" : "s",
+ (uptime / 60) % 60, (uptime / 60) % 60 == 1 ? "" : "s");
+ db_sleep (5);
+ exit (0);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_display(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ if (!args || !args[0])
+ return result;
+ display_url(target, source, args[0]);
+
+ return result;
+}
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_down(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ S ("MODE %s -o %s\n", target, source);
+
+ return result;
+}
#endif
- exit (0);
- }
-#if CTCP == 1
- }
- else if (stricmp (cmd, "\1VERSION\1") == 0)
- {
- if (cf (userhost, source, target))
- return;
- if (cf (userhost, source, target))
- return;
- S ("NOTICE %s :\1VERSION Hi, I'm a Darkbot. Download me from http://www.freezedown.org\1\n", source);
- }
- else if (stricmp (cmd, "\1PING") == 0)
- {
- if (cf (userhost, source, target))
- return;
- if (cf (userhost, source, target))
- return;
- s2 = strtok (NULL, "");
- if (s2 != NULL)
- {
- if (strlen (s2) > 21)
- s2[21] = '\0';
- S ("NOTICE %s :\1PING %s\n", source, s2);
- }
+
+struct chanserv_output *chanserv_darkbot(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (Sleep_Toggle == 1)
+ return result;
+ if (cf (userhost, source, target))
+ return result;
+
+ return chanserv_asprintf(NULL, "%s reporting! My cmdchar is %c.", dbVersion, *CMDCHAR);
+}
+
+#ifdef ENABLE_GOOGLE
+struct chanserv_output *chanserv_google(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if(!args || !args[0])
+ return chanserv_asprintf(NULL, "Google what?");
+ web_post_query(cmd, source, userhost, target, args[0], strlen(args[0]));
+
+ return result;
+}
#endif
- }
- else if (stricmp (cmd, "LOGIN") == 0)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- return;
- do_login (source, s);
- }
- else
- show_url (source, get_multiword_topic (cmd), source, 1, 0, userhost, 0);
+
+struct chanserv_output *chanserv_help(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ {
+ result = chanserv_asprintf(result, "I can be triggered by various forms of speech, all which must be addressed to me, in one of the following formats: %s %s %s or even %s . In my database, you can find a topic by saying my nick, <topic> . eg; \37%s nuke\37 . To do a search on a word, or partial text, just type: search <text> or dsearch <text> , eg; \37search nuke\37.",
+ NICK_COMMA, COLON_NICK, BCOLON_NICK, Mynick, NICK_COMMA);
+ if (cf (userhost, source, target))
+ return result;
+ result = chanserv_asprintf(result, "I can also be triggered with even more human formats: \37%s who is bill gates?\37 . You can also phrase it as a question: \37%s where is msie?\37 . For a list of commands use \37help commands\37 . For a list of setup parameters use \37help parameters\37 . For more info about me, visit http://www.freezedown.org/ .",
+ NICK_COMMA, NICK_COMMA, NICK_COMMA);
+ return (result);
+ }
+
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
return;
+
+ result = chanserv_show_help(str, check_access(userhost, (invoked == MSG_INVOKE) ? "#*" : target, 0, source));
+ return result;
+}
+
+struct chanserv_output *chanserv_idle(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ long unixtime = 0;
+
+ if (!args || !args[0])
+ return result;
+ if (strcasecmp (args[0], source) == 0)
+ return chanserv_asprintf(NULL, "Don't be lame.");
+ unixtime = return_useridle (target, args[0], 0);
+ if (unixtime == 0)
+ return chanserv_asprintf(NULL, "I do not see %s in %s.", args[0], target);
+ unixtime = time (NULL) - unixtime;
+ if (unixtime > 86400)
+ result = chanserv_asprintf(result, " %s has been idle %d day%s, %02d:%02d.",
+ args[0], unixtime / 86400,
+ (unixtime / 86400 == 1) ? "" : "s",
+ (unixtime / 3600) % 24, (unixtime / 60) % 60);
+ else if (unixtime > 3600)
+ result = chanserv_asprintf(result, "%s has been idle %d hour%s, %d min%s.",
+ args[0], unixtime / 3600,
+ unixtime / 3600 == 1 ? "" : "s",
+ (unixtime / 60) % 60, (unixtime / 60) % 60 == 1 ? "" : "s");
+ else
+ result = chanserv_asprintf(result, " %s has been idle %d minute%s, %d sec%s.",
+ args[0], unixtime / 60,
+ unixtime / 60 == 1 ? "" : "s", unixtime % 60, unixtime % 60 == 1 ? "" : "s");
+
+ return result;
+}
+
+struct chanserv_output *chanserv_ignore(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Ignore who?");
+ if ( add_ignore_user_ram(args[0]) > 0 )
+ result = chanserv_asprintf(result, "Ignoring %s.", args[0]);
+ else
+ result = chanserv_asprintf(result, "Unable to ignore %s.", args[0]);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_info(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ info (source, (invoked == MSG_INVOKE) ? source : target);
+ return result;
+}
+
+struct chanserv_output *chanserv_info_2(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ show_info2 ((invoked == MSG_INVOKE) ? source : target, source, invoked);
+ return result;
+}
+
+struct chanserv_output *chanserv_info_size(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ struct stat statbuf;
+
+ if (stat (URL2, &statbuf) == 0)
+ result = chanserv_asprintf(NULL, "My database file is presently %ld byte%s in size.", statbuf.st_size, ((statbuf.st_size == 1) ? "" : "s"));
+
+ return result;
+}
+
+struct chanserv_output *chanserv_isop(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result;
+ result = chanserv_asprintf(NULL, "%s is %san op in channel %s.", args[0], is_op(args[0], target) ? "" : "not ", target);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_join(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ S ("JOIN %s\n", target);
+ else
+ {
+ S ("JOIN %s\n", args[0]);
+ result = chanserv_asprintf(NULL, "Joining %s.", args[0]);
}
- add_user (target, source, userhost, 0); /* Unidle */
- /* ------ Commands that require a CMDCHAR to activate ------ */
- if (*cmd == *CMDCHAR)
+ return result;
+}
+
+struct chanserv_output *chanserv_joins_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ return chanserv_asprintf(NULL, "I have seen %d joins thus far.", JOINs);
+}
+
+struct chanserv_output *chanserv_jump(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char server [STRING_LONG] = {0}, str [STRING_LONG] = {0};
+ long sn = 0;
+
+ if (!args || !args[0])
+ return result;
+
+ strncpy (server, args[0], sizeof (server));
+ args++;
+
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ sn = 6667;
+ else
+ sn = atoi(str);
+
+ S ("QUIT :Jumping to %s:%d\n", server, sn);
+ db_sleep (1);
+
+ strncpy (BS, server, sizeof (BS));
+ BP = sn;
+
+ prepare_bot ();
+ register_bot ();
+
+ return result;
+}
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_kick(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char chan[STRING_LONG] = {0}, nick[STRING_LONG] = {0},
+ reason [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Specify a nick/channel!");
+
+ if (invoked == MSG_INVOKE)
{
- if (Sleep_Toggle == 1)
- return;
- cmd++;
- if (cf (userhost, source, target))
- return;
- if (stricmp (cmd, "USERLIST") == 0
- || stricmp (cmd, "HLIST") == 0 || stricmp (cmd, "ACCESS") == 0)
- {
- if (check_access (userhost, target, 0, source) == 0)
- return;
-
- if ((s = strtok (NULL, " ")) != NULL)
- {
- show_helper_list (source, atoi (s));
- }
- else
- show_helper_list (source, 0);
- }
- else if (stricmp (cmd, "BANLIST") == 0)
- {
- if (check_access (userhost, target, 0, source) == 0)
- return;
- show_banlist (source);
- }
- else if (stricmp (cmd, "LANG") == 0 || stricmp (cmd, "LANGUAGE") == 0)
- {
- S ("PRIVMSG %s :%s, %s\n", target, source, I_SPEAK);
- }
- else if (stricmp (cmd, "MASK") == 0)
- {
- s2 = strtok(NULL, " ");
- if(s2 == NULL)
- return;
- S ("privmsg %s :%s: %s\n", target, source,
- mask_from_nick(s2, target));
- return;
- }
-#if GOOGLE == 1
- else if (stricmp (cmd, "GOOGLE") == 0)
- {
- s2 = strtok (NULL, "");
-
- if(s2 == NULL)
- {
- S("PRIVMSG %s :Google what?\n", target);
- return;
- }
-
- web_post_query(cmd, source, userhost, target, s2, strlen(s2));
- }
-#endif
- else if (stricmp (cmd, "CHANINFO") == 0)
+ /* Copy channel variable and chuck it. */
+ strncpy (chan, args[0], sizeof (chan));
+ args++;
+
+ /* Make sure first parameter is a channel name. */
+ if ((*chan != '#') && (*chan != '&'))
+ return chanserv_asprintf (NULL, "You must specify a channel name first.");
+
+ if (check_access (userhost, chan, 0, source) >= 3)
+ {
+ if (!args[0])
+ return chanserv_asprintf(NULL, "You must specity a nickname to kick!");
+
+ strncpy (nick, args[0], sizeof (nick));
+ args++;
+
+ /* Remaining args are fed into reason. */
+ if ((db_argstostr (reason, args, 0, ' ')) < 1)
+ S ("KICK %s %s %s\n", chan, nick, DEFAULT_KICK);
+ else
+ S ("KICK %s %s :%s\n", chan, nick, reason);
+
+ return result;
+ }
+ }
+ else
+ {
+ if (*args[0] != '#' && *args[0] != '&')
{
- if ((s2 = strtok (NULL, " ")) == NULL)
- {
- show_chaninfo (source, target, target);
- return;
- }
- else
- {
- /* If s2 is not a valid channel name, just use the current channel */
- show_chaninfo (source, ((*s2 == '#' || *s2 == '&' || *s2 == '+') ? s2 : target), target);
- return;
- }
+ strncpy (nick, args[0], sizeof (nick));
+ args++;
+ if (strcasecmp (nick, Mynick) == 0)
+ S ("KICK %s %s :hah! As *IF*\n", target, source);
+ if ((db_argstostr (reason, args, 0, ' ')) < 1)
+ S ("KICK %s %s :\2%s\2'ed: %s\n", target, nick, cmd, DEFAULT_KICK);
+ else
+ S ("KICK %s %s :\2%s\2'ed: %s\n", target, nick, cmd, reason);
}
- else if (stricmp (cmd, "CHANUSERS") == 0)
+ else
{
- if ((s2 = strtok (NULL, " ")) == NULL)
- {
- show_chanusers (source, target);
- return;
- }
+ if (!args[0] || !args[1])
+ return chanserv_asprintf(result, "You must specify a nickname to kick!");
+
+ strncpy (chan, args[0], sizeof chan);
+ args++;
+ strncpy (nick, args[0], sizeof nick);
+ args++;
+
+ if (strcasecmp (nick, Mynick) == 0)
+ S ("KICK %s %s :hah! As *IF*\n", target, nick);
+
+ if ((db_argstostr (reason, args, 0, ' ')) < 1)
+ S ("KICK %s %s :\2%s\2ed: %s\n", chan, nick, cmd, DEFAULT_KICK);
else
- {
- /* If s2 is not a valid channel name, just use the current channel. */
- show_chanusers (source, ((*s2 == '#' || *s2 == '&' || *s2 == '+') ? s2 : target));
- return;
- }
- }
-// --------------------- RANDQ STUFF --------------------- //
-
-#if RANDQ == ON
- else if ((stricmp (cmd, "RANDQ") == 0) ||
- (stricmp (cmd, "RANDQUOTE") == 0))
- { // RANDQ_NORMAL
- s2 = strtok (NULL, "");
- if (strspn(s2, "*?") == strlen(s2))
- {
- S ("NOTICE %s :Invalid request!\n",
- source);
- return;
- }
- do_randq (s2, RANDQ_NORMAL, target, source);
- }
- else if ((stricmp (cmd, "QUOTE") == 0))
- {
- do_randq (s2, RANDQ_RAND, target, source);
- }
- else if ((stricmp (cmd, "RANDQ2") == 0) ||
- (stricmp (cmd, "RANDQUOTE2") == 0))
- { // RANDQ_CASE
- s2 = strtok (NULL, "");
- if (strspn(s2, "*?") == strlen(s2))
- {
- S ("NOTICE %s :Invalid request!\n",
- source);
- return;
- }
- do_randq(s2, RANDQ_CASE, target, source);
+ S ("KICK %s %s :\2%s\2ed: %s\n", chan, nick, cmd, reason);
}
+ }
+ return result;
+}
#endif
-// ------------------------------------------------------- //
- else if (stricmp (cmd, "IDLE") == 0)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- return;
- if (stricmp (s2, source) == 0)
- {
- S ("PRIVMSG %s :%s, don't be lame.\n", target, source);
- return;
- }
- unixtime = return_useridle (target, s2, 0);
- if (unixtime == 0)
- {
- S ("PRIVMSG %s :%s, I do not see %s in %s.\n", target, source, s2, target);
- return;
- }
- unixtime = time (NULL) - unixtime;
- if (unixtime > 86400)
- S ("PRIVMSG %s :%s, %s has been idle %d day%s, %02d:%02d\n",
- target, source, s2, unixtime / 86400,
- (unixtime / 86400 == 1) ? "" : "s",
- (unixtime / 3600) % 24, (unixtime / 60) % 60);
- else if (unixtime > 3600)
- S ("PRIVMSG %s :%s, %s has been idle %d hour%s, %d min%s\n",
- target, source, s2, unixtime / 3600,
- unixtime / 3600 == 1 ? "" : "s",
- (unixtime / 60) % 60, (unixtime / 60) % 60 == 1 ? "" : "s");
- else
- S ("PRIVMSG %s :%s, %s has been idle %d minute%s, %d sec%s\n",
- target, source, s2, unixtime / 60,
- unixtime / 60 == 1 ? "" : "s", unixtime % 60, unixtime % 60 == 1 ? "" : "s");
- }
- else if (stricmp (cmd, "N") == 0 || stricmp (cmd, "NICK") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- // If no nick was specified...
- if((s = strtok (NULL, " ")) == NULL)
- {
- L036 (source);
- return;
- }
-
- // If the nick specified contains illegal characters...
- if(strspn(s, LEGAL_NICK_TEXT) != strlen(s))
- {
-// L036n (source);
- S ("notice %s :The nickname %s contains illegal characters.\n",
- source, s);
- return;
- }
+struct chanserv_output *chanserv_language(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ return chanserv_asprintf(NULL, "I speak English.");
+}
- strncpy (Mynick, s, sizeof (Mynick));
- strncpy (s_Mynick, Mynick, sizeof (s_Mynick));
- snprintf (NICK_COMMA, sizeof (NICK_COMMA), "%s,", Mynick);
- snprintf (COLON_NICK, sizeof (COLON_NICK), "%s:", Mynick);
- snprintf (BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", Mynick);
- L037 (source, Mynick);
- S ("NICK %s\n", Mynick);
- }
- else
- L038 (source, source);
- }
- else if (stricmp (cmd, "L") == 0
- || stricmp (cmd, "PART") == 0
- || stricmp (cmd, "LEAVE") == 0 || stricmp (cmd, "P") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 2)
- {
- s = strtok (NULL, "");
- if (s == NULL)
- {
- S ("PART %s\n", target);
- }
- else
- {
- S ("PART %s\n", s);
- L039 (target, s);
- }
- }
- }
- else if (stricmp (cmd, "VARIABLES") == 0)
- {
- S ("PRIVMSG %s :%s, %s\n", source, source, myVariables);
- }
- else if (stricmp (cmd, "JOIN") == 0 || stricmp (cmd, "J") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 2)
- {
- s = strtok (NULL, "");
- if (s == NULL)
- {
- S ("JOIN %s\n", target);
- }
- else
- {
- S ("JOIN %s\n", s);
- L040 (target, s);
- }
- }
-#if DO_CHANBOT_CRAP == 1
- }
- else if (stricmp (cmd, "OP") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 2)
- {
- s = strtok (NULL, "");
- if (s == NULL)
- {
- S ("PRIVMSG %s :Specify a nick!\n", target);
- return;
- }
- else
- {
- S ("MODE %s +oooooo %s\n", target, s);
- }
- }
- }
- else if (stricmp (cmd, "DEOP") == 0)
+struct chanserv_output *chanserv_leave(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char chan [STRING_LONG] = {0},
+ reason [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ S ("PART %s\n", target);
+ else
+ {
+ strncpy (chan, args[0], sizeof chan);
+ args++;
+
+ /* Don't bother telling the channel we left about it. */
+ if ((strcasecmp (target, chan)) != 0)
+ result = chanserv_asprintf(result, "Leaving %s.", chan);
+
+ if ((db_argstostr (reason, args, 0, ' ')) < 1)
+ S ("PART %s :Requested!\n", chan);
+ else
+ S ("PART %s :%s\n", chan, reason);
+ }
+
+ return (result);
+}
+
+struct chanserv_output *chanserv_length(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result;
+
+ return chanserv_asprintf(NULL, "It was %d chars long.", strlen (args[0]));
+}
+
+struct chanserv_output *chanserv_level(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char *uh;
+
+ if (!args || !args[0])
+ return result;
+ uh = uh_from_nick(args[0], target);
+ if (uh)
+ result = chanserv_asprintf(result, "%s is level %d in channel %s.", args[0], check_access(uh, target, 0, args[0]), target);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_location_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ return chanserv_asprintf(NULL, "There %s %d server%s in my server list. I am currently on server #%d.", (snr == 1) ? "is" : "are", snr, (snr == 1) ? "" : "s", spr);
+}
+
+struct chanserv_output *chanserv_login(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result;
+ do_login (source, args[0]);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_mask(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ int i = 0;
+ struct chanserv_output *result = NULL;
+
+ if(!args || !args[0])
+ return result;
+
+ return chanserv_asprintf(NULL, " %s",
+ (invoked == MSG_INVOKE) ? mask_from_nick(args[0], "#*") : mask_from_nick(args[0], target));
+}
+
+//#ifndef WIN32
+struct chanserv_output *chanserv_memory(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ char temp[1024] = { 0 };
+
+ snprintf(temp, sizeof (temp), "ps u -p %d\n", getpid());
+
+ const char *ptr = run_program (temp);
+ if (ptr == NULL)
+ return chanserv_asprintf(NULL, "Unable to gather data for mem output.\n");
+ else
+ return chanserv_asprintf(NULL, "ps: %s", ptr);
+}
+//#endif
+
+#ifdef ENABLE_METAR
+struct chanserv_output *chanserv_metar(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if(!args || !args[0])
+ return chanserv_asprintf(NULL, "Metar what?");
+ web_post_query (cmd, source, userhost, target, args[0], strlen(args[0]));
+
+ return result;
+}
+#endif
+
+struct chanserv_output *chanserv_nick(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ // If no nick was specified...
+ if(!args || !args[0])
+ return chanserv_asprintf(NULL, "Specify a nick!");
+
+ // If the nick specified contains illegal characters...
+ if(strspn(args[0], LEGAL_NICK_TEXT) != strlen(args[0]))
+ return chanserv_asprintf(NULL, "The nickname %s contains illegal characters.", args[0]);
+
+ strncpy(Mynick, args[0], sizeof (Mynick));
+ strncpy(s_Mynick, Mynick, sizeof (s_Mynick));
+ snprintf(NICK_COMMA, sizeof (NICK_COMMA), "%s,", Mynick);
+ snprintf(COLON_NICK, sizeof (COLON_NICK), "%s:", Mynick);
+ snprintf(BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", Mynick);
+ // FIXME: This should be sent before the NICK attempt, and/or complain if the NICK doesn't work.
+ result = chanserv_asprintf(result, "Attempting to /nick %s.", Mynick);
+ S("NICK %s\n", Mynick);
+
+ return result;
+}
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_op(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char nicks [STRING_LONG] = {0}, chan [STRING_LONG] = {0};
+ int ischan = 0;
+
+ if (!args[0])
+ return chanserv_asprintf (NULL, "You must specify a nickname/channel!.");
+
+ /* Check for channel name specified, set up args accordingly. */
+ if ((*args[0] == '#') || (*args[0] == '&'))
+ {
+ ischan = 1; /* channel specified */
+ strncpy (chan, args[0], sizeof chan);
+ args++;
+ }
+
+ if ((db_argstostr (nicks, args, 0, ' ')) < 1)
+ return chanserv_asprintf (NULL, "You must specify a nickname to op.");
+
+ if ((invoked == MSG_INVOKE) || (ischan == 1))
+ {
+ /* If MSG_INVOKE, make sure chan == 1. This seems weird, but
+ * we could have MSG_INVOKE without channel specified. */
+ if (ischan != 1)
+ return chanserv_asprintf (NULL, "You must specify a channel to deop people on.");
+
+ if (check_access (userhost, chan, 0, source) >= 3)
+ {
+ S ("MODE %s +oooooo %s\n", chan, nicks);
+ return result;
+ }
+ }
+ else
+ S ("MODE %s +oooooo %s\n", target, nicks);
+
+ return result;
+}
+#endif
+
+struct chanserv_output *chanserv_os_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char temp[1024] = { 0 };
+ char *reply = NULL;
+
+#ifdef WIN32
+ snprintf (temp, sizeof (temp), "cmd /c ver\n");
+#else
+ snprintf (temp, sizeof (temp), "uname\n");
+#endif
+
+ return chanserv_asprintf(NULL, "I am running %s.", run_program(temp));
+}
+
+struct chanserv_output *chanserv_password(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (args[0] == NULL || args[1] == NULL)
+ return result;
+ if (strlen(args[1]) > 25)
+ args[1][25] = '\0';
+ set_pass(source, userhost, args[0], args[1]);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_performs(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ /* Set the default umodes */
+ S ("MODE %s %s\n", Mynick, DEFAULT_UMODE);
+ run_perform ();
+
+ return chanserv_asprintf(NULL, "Performs have been executed.");
+}
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_perm_ban(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char reason [STRING_LONG] = {0}, host [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ return result = chanserv_asprintf(result, "Type !help permbans");
+
+ strncpy (host, args[0], sizeof host);
+ args++;
+
+ if ((db_argstostr (reason, args, 0, ' ')) < 1)
+ strncpy (reason, "Permbanned!", sizeof reason);
+
+ add_permban(host, 0, reason);
+ result = chanserv_asprintf(result, "Added in permban #%d, %s; reason: %s.",
+ PERMBAN_counter, host, reason);
+ save_permbans();
+ S("MODE %s +b %s\n", target, host);
+
+ /* FIXME: Scan for user in room and kick them with reason. */
+ return result;
+}
+
+struct chanserv_output *chanserv_perm_bans_list(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ return chanserv_asprintf(NULL, "There %s %d permban%s loaded into ram.", (PERMBAN_counter == 1) ? "is" : "are", PERMBAN_counter, (PERMBAN_counter == 1) ? "" : "s");
+}
+#endif
+
+#ifdef ENABLE_CTCP
+struct chanserv_output *chanserv_ping(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (cf(userhost, source, target))
+ return result;
+ if (cf(userhost, source, target))
+ return result;
+ if (args[0] != NULL)
+ {
+ if (strlen (args[0]) > 21)
+ args[0][21] = '\0';
+ S ("NOTICE %s :\1PING %s\n", source, args[0]);
+ }
+
+ return result;
+}
+#endif
+
+struct chanserv_output *chanserv_ping2(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ return chanserv_asprintf(NULL, "PONG!");
+}
+
+struct chanserv_output *chanserv_queue_show(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ return chanserv_asprintf(NULL, "There is currently %d item%s in queue.", get_sendq_count(2), (get_sendq_count(2) == 1) ? "" : "s");
+}
+
+#ifdef ENABLE_QUIZ
+struct chanserv_output *chanserv_quiz(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (quiz_halt == 0)
+ run_quiz_question (target);
+
+ return result;
+}
+#endif
+
+#ifdef ENABLE_RANDQ
+struct chanserv_output *chanserv_quote(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ do_randq(args[0], RANDQ_RAND, target, source);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_random_quote(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result = chanserv_asprintf (NULL, "You must specify a search string.");
+
+ // RANDQ_NORMAL
+ do_randq(args[0], RANDQ_NORMAL, target, source);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_random_quote_2(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result = chanserv_asprintf (NULL, "You must specify a search string.");
+
+ // RANDQ_CASE
+ do_randq(args[0], RANDQ_CASE, target, source);
+
+ return result;
+}
+#endif
+
+#ifdef ENABLE_RANDOM
+struct chanserv_output *chanserv_random_stuff(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+
+ /* Fill argument buffer, if it's empty we return a message to
+ * the user asking for input. */
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "What do you want to add?");
+
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ return result;
+
+ if (invoked == MSG_INVOKE)
+ {
+ if (check_access (userhost, "#*", 0, source) >= RAND_LEVEL)
+ {
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ return chanserv_asprintf(NULL, "What do you want to add?");
+ add_randomstuff(source, source, str);
+ }
+ }
+ else
+ add_randomstuff(source, target, str);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_random_stuff_list(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ return chanserv_asprintf(NULL, "%d seconds left till randstuff.", Rand_Stuff);
+}
+#endif
+
+struct chanserv_output *chanserv_raw(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ return result;
+
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ return result;
+
+ Snow("%s\n", str);
+
+ return result;
+}
+
+//#ifndef WIN32
+struct chanserv_output *chanserv_rdb(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char temp[1024] = { 0 };
+ char str [STRING_LONG] = {0};
+
+ /* Check for arguments */
+
+ if (!args || !args[0])
+ {
+ snprintf(temp, sizeof (temp), "ls %s/*.rdb | wc\n", RDB_DIR);
+ result = chanserv_asprintf(result, "RDB: %s.", run_program(temp));
+ }
+ else
+ {
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ return result;
+ if (strspn(str, SAFE_LIST) != strlen(str))
+ return chanserv_asprintf(NULL, "Rdb files are made up of letters and or numbers, no other text is accepted.");
+ snprintf(temp, sizeof (temp), "cat %s/%s.rdb | wc -l\n", RDB_DIR, str);
+ result = chanserv_asprintf(result, "%s", run_program(temp));
+ }
+
+ return result;
+}
+//#endif
+
+struct chanserv_output *chanserv_repeat(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ long sn2 = 0, sn = 0;
+ char str [STRING_LONG] = {0};
+
+ if (!args || !args[0] || !args[1] || !args[2])
+ return result;
+ sn = atoi (args[0]);
+ sn2 = atoi (args[1]);
+ if ((db_argstostr (str, args, 2, ' ')) < 1)
+ return result;
+
+ while (sn > 0)
+ {
+ S ("%s\n", str);
+ db_sleep (sn2);
+ sn--;
+ }
+
+ return result;
+}
+
+struct chanserv_output *chanserv_replace(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char topic [STRING_LONG] = {0}, str [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Replace what?");
+
+ if (strlen(args[0]) > MAX_TOPIC_SIZE)
+ args[0][MAX_TOPIC_SIZE] = '\0';
+
+ /* Copy topic, and traverse args for data to be replaced. */
+ strncpy (topic, args[0], sizeof topic);
+ args++;
+
+ /* Make sure there's information to be replaced. */
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ return chanserv_asprintf(NULL, "What info should replace %s?",
+ topic);
+
+ /* Don't let str go over MAX_DATA_SIZE characters. */
+ if (strlen(str) > MAX_DATA_SIZE)
+ str[MAX_DATA_SIZE] = '\0';
+
+ strlwr(topic);
+
+ if (check_existing_url(source, topic, target) != 1)
+ return chanserv_asprintf(NULL, "%s \37%s\37", NO_ENTRY, topic);
+
+ /* Replace the data. */
+ delete_url (source, topic, target);
+ if (LOG_ADD_DELETES)
+ db_log (ADD_DELETES, "[%s] %s!%s REPLACE %s %s\n", date (), source, userhost, topic, str);
+
+ ADDITIONS++;
+
+ db_log (URL2, "%s %s\n", topic, str);
+
+ return chanserv_asprintf(NULL, "%s has been updated.", topic);
+}
+
+struct chanserv_output *chanserv_reserved_1(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result;
+ call_reserved_1(source, target, args[0]);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_reserved_2(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result;
+ call_reserved_2(source, target, args[0]);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_restart(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char temp[1024] = { 0 };
+
+ S("QUIT :Restarting %s ...\n", dbVersion);
+ db_sleep(2);
+ snprintf(temp, sizeof (temp), "%s", DARKBOT_BIN);
+ system(temp);
+ db_sleep(1);
+ exit(0);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_search(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ {
+ if (strcasecmp(cmd, "FIND") == 0)
+ result = chanserv_asprintf(NULL, "%s?", TRY_FIND);
+ else
+ result = chanserv_asprintf(NULL, "What should I be %sing for?", cmd);
+ return result;
+ }
+ find_url(source, args[0], target);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_seen(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ {
+ count_seen(source, target);
+ return result;
+ }
+ if (return_useridle (target, args[0], 1) == 1)
+ return chanserv_asprintf(NULL, "%s is right here in the channel!", args[0]);
+ show_seen(args[0], source, target);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_set(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ struct setup_parameter *param = NULL;
+
+ if (!args || !args[0])
+ return result;
+
+ param = set_parameter(args[0]);
+ if (param)
+ {
+ switch (param->type)
+ {
+ case ST_BOOLEAN :
{
- if (check_access (userhost, target, 0, source) >= 2)
- {
- s = strtok (NULL, "");
- if (s == NULL)
- {
- S ("PRIVMSG %s :Specify a nick!\n", target);
- return;
- }
- else
- {
- S ("MODE %s -oooooo %s\n", target, s);
- }
- }
+ bool *variable = param->value;
+
+ result = chanserv_asprintf(result, "Setting %s = %s", param->summary, (*variable) ? "true" : "false");
+ break;
}
- else if (stricmp (cmd, "DOWN") == 0)
+
+ case ST_INTEGER :
{
- if (check_access (userhost, target, 0, source) >= 2)
- S ("MODE %s -o %s\n", target, source);
+ long *variable = param->value;
+
+ result = chanserv_asprintf(result, "Setting %s = %ld", param->summary, *variable);
+ break;
}
- else if (stricmp (cmd, "UP") == 0)
+
+ case ST_STRING :
{
- if (check_access (userhost, target, 0, source) >= 2)
- S ("MODE %s +o %s\n", target, source);
+ char *variable = param->value;
+
+ result = chanserv_asprintf(result, "Setting %s = %s", param->summary, variable);
+ break;
}
- else if ((stricmp (cmd, "KICK") == 0
- || stricmp (cmd, "WACK") == 0
- || stricmp (cmd, "K") == 0 || stricmp (cmd, "NAIL") == 0))
- {
- if (check_access (userhost, target, 0, source) >= 2)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- S ("PRIVMSG %s :Specify a nick/chan!\n", target);
- return;
- }
- else
- {
- if (*s != '#' && *s != '&')
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- {
- if (stricmp (s, Mynick) == 0)
- {
- S ("KICK %s %s :hah! As *IF*\n", target, source);
- }
- else
- S ("KICK %s %s :\2%s\2'ed: %s\n", target, s, cmd, DEFAULT_KICK);
- }
- else if (stricmp (s, Mynick) == 0)
- {
- S ("KICK %s %s :%s\n", target, s, s2);
- }
- else
- S ("KICK %s %s :\2%s\2'ed: %s\n", target, s, cmd, s2);
- }
- else
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- S ("NOTICE %s :You must specify a nick to kick from %s!\n", source, s);
- }
- else
- {
- s3 = strtok (NULL, "");
- if (s3 == NULL)
- {
- if (stricmp (s2, Mynick) == 0)
- {
- S ("KICK %s %s :hah! As *IF*\n", s, source);
- }
- else
- S ("KICK %s %s :\2%s\2ed: %s\n", s, s2, cmd, DEFAULT_KICK);
- }
- else
- {
-
- if (stricmp (s2, Mynick) == 0)
- {
- S ("KICK %s %s :hah! As *IF* (%s)\n", s, source);
- }
- else
- S ("KICK %s %s :\2%s\2ed: %s\n", s, s2, cmd, s3);
- }
- }
- }
- }
- }
+ }
+ save_setup();
+ }
+ else
+ result = chanserv_asprintf(result, "Unknown parameter.");
+
+ return result;
+}
+
+struct chanserv_output *chanserv_setinfo(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+
+ if (!args)
+ return chanserv_asprintf (NULL, "My %s variables are: ^ nick, %% number of joins, & Channel, $ user@host. Example: !setinfo ^ has joined & %% times (also, if you make the first char of your %s a \"+\", the %s will be shown as an ACTION).", cmd, cmd, cmd);
+
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ return;
+
+ update_setinfo (userhost, str, source);
+ save_changes();
+ return (result);
+}
+struct chanserv_output *chanserv_sleep(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+
+ Sleep_Toggle = 1;
+
+ /* Copy arguments to buffer, if there is one convert to long
+ * and use it as the sleep time in seconds. */
+
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ Sleep_Time = SLEEP_TIME;
+ else if ((Sleep_Time = strtol (str, (char **) NULL, 10)) < 1)
+ Sleep_Time = SLEEP_TIME;
+
+ S ("PRIVMSG %s :%s\n", target, GOSLEEP_ACTION);
+ strncpy (sleep_chan, target, sizeof (sleep_chan));
+
+ /* If the user has specified a custom length of time to sleep for, send
+ * a notice reminding the user how long the bot will be asleep, in a
+ * more readible format.
+ */
+ if (Sleep_Time != SLEEP_TIME)
+ {
+ if (Sleep_Time > 86400)
+ result = chanserv_asprintf(result, "Sleeping for %ld day%s, %02ld:%02ld.",
+ Sleep_Time / 86400,
+ (Sleep_Time / 86400 == 1) ? "" : "s",
+ (Sleep_Time / 3600) % 24,
+ (Sleep_Time / 60) % 60);
+ else if (Sleep_Time > 3600)
+ result = chanserv_asprintf(result, "Sleeping for %ld hour%s, %ld min%s.",
+ Sleep_Time / 3600,
+ Sleep_Time / 3600 == 1 ? "" : "s",
+ (Sleep_Time / 60) % 60,
+ (Sleep_Time/ 60) % 60 == 1 ? "" : "s");
+ else
+ result = chanserv_asprintf(result, "Sleeping for %ld minute%s, %ld sec%s.",
+ Sleep_Time / 60,
+ Sleep_Time / 60 == 1 ? "" : "s",
+ Sleep_Time % 60,
+ Sleep_Time % 60 == 1 ? "" : "s");
+ }
+
+ return result;
+}
+
+#ifdef ENABLE_STATS
+struct chanserv_output *chanserv_stats(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return result = chanserv_asprintf (NULL, "Syntax: %s <nick>", cmd);
+ get_stats(target, args[0]);
+ return result;
+}
#endif
- }
- else if (stricmp (cmd, "CYC") == 0 || stricmp (cmd, "CYCLE") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 2)
- {
- s = strtok (NULL, "");
- if (s == NULL)
- {
- S ("PART %s\n", target);
- S ("JOIN %s\n", target);
- }
- else
- {
- S ("PART %s\n", s);
- S ("JOIN %s\n", s);
- S ("PRIVMSG %s :Cycling %s\n", target, s);
- }
- }
- }
- else if (stricmp (cmd, "DIE") == 0 || stricmp (cmd, "QUIT") == 0)
- {
- s = strtok (NULL, "");
- if (check_access (userhost, target, 0, source) >= 3)
- {
- if (s == NULL)
- {
- L032 (source);
- }
- else
- Snow ("QUIT :K\2\2illed (%s (%s))\n", source, s);
- db_sleep (1);
-#ifdef WIN32
- printf ("\n\nGood-bye! %s (c) Jason Hamilton\n\n", dbVersion);
- uptime = time (NULL) - uptime;
- printf
- ("Time elapsed: %ld hour%s, %ld min%s\n\n",
- uptime / 3600,
- uptime / 3600 == 1 ? "" : "s",
- (uptime / 60) % 60, (uptime / 60) % 60 == 1 ? "" : "s");
- db_sleep (5);
+
+#ifdef ENABLE_TAF
+struct chanserv_output *chanserv_taf(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if(!args || !args[0])
+ return chanserv_asprintf(NULL, "Taf what?");
+ web_post_query(cmd, source, userhost, target, args[0], strlen(args[0]));
+
+ return result;
+}
#endif
- exit (0);
- }
-#if DO_CHANBOT_CRAP == 1
- }
- else if (stricmp (cmd, "DEV") == 0
- || stricmp (cmd, "DV") == 0
- || stricmp (cmd, "DEVOICE") == 0 || stricmp (cmd, "DVOICE") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 1)
- {
- s = strtok (NULL, "");
- if (s == NULL)
- {
- L041 (target);
- return;
- }
- else
- S ("MODE %s -vvvvvvv %s\n", target, s);
- }
- }
- else if (stricmp (cmd, "VOICE") == 0 || stricmp (cmd, "V") == 0)
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_teaseop(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Specify a nick!");
+ if (strcasecmp (args[0], Mynick) == 0)
+ result = chanserv_asprintf(result, "How about I not do that?");
+ else
+ S ("MODE %s +o-o+o-o+o-o %s %s %s %s %s %s\n", target, args[0], args[0], args[0], args[0], args[0], args[0]);
+
+ return result;
+}
+#endif
+
+struct chanserv_output *chanserv_tell(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Tell who?");
+ if (!args[1])
+ return chanserv_asprintf(NULL, "What do you want me to tell %s?", args[0]);
+ if (strcasecmp (args[1], Mynick) == 0)
+ return result; /* don't bother telling myself about stuff */
+
+ if (strcasecmp (args[1], "ABOUT") == 0)
+ {
+ if ((db_argstostr (str, args, 2, '+')) < 1)
+ return chanserv_asprintf(NULL, "Tell %s about what?", args[0]);
+
+ strlwr(str);
+ if (invoked == MSG_INVOKE)
+ show_url (source, get_multiword_topic (str), args[0], 1, 0, userhost, 1);
+ else
+ show_url (args[0], get_multiword_topic (str), target, 1, 0, userhost, 1);
+ }
+ else
+ {
+ if ((db_argstostr (str, args, 1, '+')) < 1)
+ return chanserv_asprintf (NULL, "Tell %s about what?", args[0]);
+
+ strlwr(str);
+
+ if (invoked == MSG_INVOKE)
+ show_url (source, get_multiword_topic (str), args[0], 1, 0, userhost, 1);
+ else
+ show_url (args[0], get_multiword_topic (str), target, 1, 0, userhost, 1);
+ }
+
+ return result;
+}
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_topic(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+
+ if ((db_argstostr (str, args, 0, ' ')) < 1)
+ return chanserv_asprintf (NULL, "What do you want the topic changed to?");
+ else
+ S ("TOPIC %s :%s\n", target, str);
+
+ return result;
+}
+#endif
+
+struct chanserv_output *chanserv_unignore(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Unignore who?");
+ if ( delete_ignore_user_ram (args[0]) > 0 )
+ result = chanserv_asprintf(result, "Unignoring %s.", args[0]);
+ else
+ result = chanserv_asprintf(result, "Unable to unignore %s. :(", args[0]);
+
+ return result;
+}
+
+struct chanserv_output *chanserv_unixtime(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ time_t unixtime = 0, input_t = 0, cur_t = 0;
+ char *things = NULL;
+ int errno;
+
+ /* Check if anything was given as input and only do stuff
+ * (in this function, anyway) if so. */
+
+ if (!args || !args[0])
+ return result;
+
+ /* Make sure current time is available while acquiring it. */
+ if ((cur_t = time (NULL)) < 0)
+ {
+ result = chanserv_asprintf (result, "Unable to produce results because current system time is unavailable.");
+ return (result);
+ }
+
+ /* Convert input value to time_t. We check if the return value is
+ * 0 here, but our main concern is if things is NULL, because that
+ * would mean the function converted a string value "0", instead
+ * of returning a failing code. Set errno to 0 first as for a
+ * precautionary measure.
+ */
+
+ errno = 0;
+
+ if ((input_t = (time_t) strtol (args[0], &things, 10)) == 0)
+ {
+ if (things == NULL)
{
- if (check_access (userhost, target, 0, source) >= 1)
- {
- s = strtok (NULL, "");
- if (s == NULL)
- {
- L041 (target);
- return;
- }
- else
- S ("MODE %s +vvvvvvv %s\n", target, s);
- }
+ result = chanserv_asprintf (result, "%s (things = %s)", strerror (errno), things);
+ return (result);
}
- else if (stricmp (cmd, "T") == 0 || stricmp (cmd, "TOPIC") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 2)
- {
- s = strtok (NULL, "");
- if (s == NULL)
- {
- S ("TOPIC %s :\n", target);
- return;
- }
- else
- {
- S ("TOPIC %s :%s\n", target, s);
- }
- }
+
+ /* things was not NULL, this is "0" converted to long.
+ * So we continue as if nothing happened. */
+ }
+
+ /* Check for out of range values, tell the user which range
+ * was exceeded, perhaps for debugging purposes. */
+ if (errno == ERANGE)
+ {
+ result = chanserv_asprintf (result, "Your implementation does not support numeric ranges beyond %ld for this function.",
+ input_t);
+ return (result);
+ }
+
+ unixtime = input_t - cur_t;
+
+ if (unixtime > 86400)
+ result = chanserv_asprintf(result, "%d day%s, %02d:%02d.",
+ unixtime / 86400,
+ plural (unixtime / 86400),
+ (unixtime / 3600) % 24,
+ (unixtime / 60) % 60);
+ else if (unixtime > 3600)
+ result = chanserv_asprintf(result, "%d hour%s, %d min%s.",
+ unixtime / 3600,
+ plural(unixtime / 3600),
+ (unixtime / 60) % 60,
+ plural(unixtime / 60));
+ else
+ result = chanserv_asprintf(result, "%d minute%s, %d sec%s.",
+ unixtime / 60,
+ plural(unixtime / 60),
+ unixtime % 60,
+ plural(unixtime % 60));
+
+ return result;
+}
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_up(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ S ("MODE %s +o %s\n", target, source);
+ return result;
+}
#endif
- }
- else if (stricmp (cmd, "JUMP") == 0 || stricmp (cmd, "SERVER") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- S ("NOTICE %s :Syntax: JUMP <server> [port]\n", source);
- return;
- }
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- sn = 6667;
- }
- else
- sn = atoi (s2);
- S ("QUIT :Jumping to %s:%d\n", s, sn);
- db_sleep (1);
- strcpy (BS, s);
- BP = sn;
- prepare_bot ();
- register_bot ();
- }
-#if DO_CHANBOT_CRAP == 1
- }
- else if (stricmp (cmd, "DELBAN") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- L042 (source);
- return;
- }
- if (del_permban (source, s) == 1)
- S ("MODE %s -b %s\n", target, s);
- else
- L043 (source);
- }
+
+//#ifndef WIN32
+struct chanserv_output *chanserv_uptime(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ char temp[1024] = { 0 };
+
+ snprintf(temp, sizeof (temp), "uptime\n");
+ return chanserv_asprintf(NULL, "Uptime: %s.", run_program(temp));
+}
+//#endif
+
+struct chanserv_output *chanserv_user_list(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+ int i = 0;
+
+ if (!args)
+ {
+ show_helper_list (source, 0);
+ return result;
+ }
+ else
+ {
+ int level = 0;
+ for (i = 0; args[i]; i++)
+ show_helper_list (source, atoi (args[i]));
+ }
+
+ return result;
+}
+
+#ifdef ENABLE_STATUS
+struct chanserv_output *chanserv_users_list(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ S ("LUSERS\n");
+
+ return result;
+}
#endif
- }
- else if (stricmp (cmd, "DELUSER") == 0)
+
+struct chanserv_output *chanserv_variables(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ return chanserv_asprintf(NULL, "Data variables are: N~ (Nick), C~ (Chan), T~ (Time/date) B~ (Botnick), Q~ (Question asked), R~ (random nick), !~ (command char), S~ (current Server), P~ (current port) V~ (botVer), W~ (db WWW site), H~ (u@h), t~ (unixtime), BAN (sets a ban), TEMPBAN (bans for 60 sec).");
+}
+
+#ifdef ENABLE_CTCP
+struct chanserv_output *chanserv_version(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+
+ if (cf (userhost, source, target))
+ return result;
+ if (cf (userhost, source, target))
+ return result;
+
+ return chanserv_asprintf(NULL, "\1VERSION Hi, I'm a Darkbot. Download me from http://www.darkbot.org\1.");
+}
+#endif
+
+#ifdef ENABLE_CHANNEL
+struct chanserv_output *chanserv_voice(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char nicks [STRING_LONG] = {0}, chan [STRING_LONG] = {0},
+ str [STRING_LONG] = {0};
+ int ischan = 0;
+
+ if (!args[0])
+ return result;
+
+ db_argstostr (str, args, 0, ' ');
+
+ /* Check for channel name specified, set up args accordingly. */
+ if ((*args[0] == '#') || (*args[0] == '&'))
+ {
+ ischan = 1; /* channel specified */
+ strncpy (chan, args[0], sizeof chan);
+ args++;
+ }
+
+ if ((db_argstostr (nicks, args, 0, ' ')) < 1)
+ return chanserv_asprintf (NULL, "You must specify a nickname to voice.");
+
+ if ((invoked == MSG_INVOKE) || (ischan == 1))
+ {
+ /* If MSG_INVOke, make sure chan ==1. This seems weird,
+ * but we could have MSG_INVOKE without a channel given,
+ * and this is an error. */
+ if (ischan != 1)
+ return chanserv_asprintf (NULL, "You must specify a channel to give voice on.");
+
+ if (check_access (userhost, chan, 0, source) >= 3)
{
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- L044 (source);
- return;
- }
- delete_user_ram (source, s);
- }
-#if DO_CHANBOT_CRAP == 1
+ S ("MODE %s +vvvvvv %s\n", chan, nicks);
+ return result;
}
- else if (stricmp (cmd, "TEASEOP") == 0 || stricmp (cmd, "TO") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 2)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- L036 (target);
- return;
- }
- if (stricmp (s, Mynick) == 0)
- {
- L045 (source);
- }
- else
- S ("MODE %s +o-o+o-o+o-o %s %s %s %s %s %s\n", target, s, s, s, s, s, s);
- }
+ }
+ else
+ S ("MODE %s +vvvvvv %s\n", target, nicks);
+
+ return result;
+}
#endif
-#ifndef WIN32
- }
- else if (stricmp (cmd, "BACKUP") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- snprintf (temp, sizeof (temp), "/bin/cp -rf %s \"%s.bak @ `date`\"\n", URL2, URL2);
- system (temp);
- L046 (target);
- }
+
+struct chanserv_output *chanserv_wakeup(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ if (Sleep_Toggle == 0)
+ return result;
+ Sleep_Toggle = 0;
+ AIL4 = 0;
+ S ("PRIVMSG %s :%s\n", target, WAKEUP_ACTION);
+ if (strcasecmp (sleep_chan, target) != 0)
+ S ("PRIVMSG %s :%s\n", sleep_chan, WAKEUP_ACTION);
+
+ return result;
+}
+
+#ifdef ENABLE_WEATHER
+struct chanserv_output *chanserv_weather(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Show weather from where?");
+ web_post_query(cmd, source, userhost, target, args[0], strlen(args[0]));
+
+ return result;
+}
#endif
- }
- else if (stricmp (cmd, "AUTOTOPIC") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s = strtok (NULL, "");
- if (s == NULL)
- {
- L047 (source, *CMDCHAR);
- return;
- }
- set_autotopic (source, target, s);
- }
- }
- else if (stricmp (cmd, "SETCHAN") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- L048 (source);
- return;
- }
- strncpy (CHAN, s, sizeof (CHAN));
- L049 (source, CHAN);
- save_setup ();
- }
- }
- else if (stricmp (cmd, "SETCHAR") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- L050 (source);
- return;
- }
- *CMDCHAR = *s;
- L051 (source, *CMDCHAR);
- save_setup ();
- }
- }
- else if (stricmp (cmd, "SETUSER") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- L052 (source);
- return;
- }
- strncpy (UID, s, sizeof (UID));
- L053 (source, UID);
- save_setup ();
- }
- }
- else if (stricmp (cmd, "VHOST") == 0 || stricmp (cmd, "SETHOST") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- L091 (source);
- return;
- }
- strncpy (VHOST, s, sizeof (VHOST));
- L092 (source, VHOST);
- save_setup ();
- }
- }
- else if (stricmp (cmd, "PERFORMS") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- /* Set the default umodes */
- S ("MODE %s %s\n", Mynick, DEFAULT_UMODE);
- /* Run performs */
- run_perform ();
- S ("privmsg %s :%s, performs have been executed.\n",
- target, source);
- return;
- }
- }
- else if (stricmp (cmd, "SETNICK") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- if ((s = strtok (NULL, " ")) == NULL)
- {
- L054 (source);
- return;
- }
+struct chanserv_output *chanserv_where(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+ char *ptr3 = NULL;
- if (strspn (s, LEGAL_NICK_TEXT) != strlen (s))
- {
- S ("notice %s :The nickname %s contains illegal characters.\n",
- source, s);
- return;
- }
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "You were asking?");
+ if (args[1] == NULL)
+ return result;
+ strlwr (args[1]);
+ ptr3 = strchr (args[1], '?');
+ if (ptr3 != NULL)
+ memmove (ptr3, ptr3 + 1, strlen (ptr3 + 1) + 1);
+ ptr3 = strchr (args[1], '!');
+ if (ptr3 != NULL)
+ memmove (ptr3, ptr3 + 1, strlen (ptr3 + 1) + 1);
+ if (strcasecmp (args[1], "A") == 0 || strcasecmp (args[1], "AN") == 0)
+ {
+ if ((db_argstostr (str, args, 2, ' ')) < 1)
+ return chanserv_asprintf(NULL, "%s %s %s? Mind rephrasing that? (Type %cHELP for syntax hints).", cmd, args[0], args[1], *CMDCHAR);
+ show_url (source, get_multiword_topic (str), (invoked == MSG_INVOKE) ? source : target, 1, 0, userhost, 0);
+ }
+ else
+ show_url (source, get_multiword_topic (args[1]), (invoked == MSG_INVOKE) ? source : target, 1, 0, userhost, 0);
- S ("NICK %s\n", s);
- strncpy (s_Mynick, s, sizeof (s_Mynick));
- strncpy (Mynick, s, sizeof (Mynick));
- snprintf (NICK_COMMA, sizeof (NICK_COMMA), "%s,", Mynick);
- snprintf (COLON_NICK, sizeof (COLON_NICK), "%s:", Mynick);
- snprintf (BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", Mynick);
- save_setup ();
- }
- }
- else if (stricmp (cmd, "RAW") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s = strtok (NULL, "");
- if (s != NULL)
- S ("%s\n", s);
- }
- }
- else if (stricmp (cmd, "SEEN") == 0 && SeeN == 1)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- count_seen (source, target);
- return;
- }
- if (return_useridle (target, s, 1) == 1)
- {
- S ("PRIVMSG %s :%s is right here in the channel!\n", target, s);
- return;
- }
- show_seen (s, source, target);
-#if STATUS == 1
- }
- else if (stricmp (cmd, "LUSERS") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 1)
- S ("LUSERS\n");
+ return result;
+}
+
+struct chanserv_output *chanserv_whisper(char *source, char *target, char *cmd, char **args, enum chanserv_invoke_type invoked, char *userhost)
+{
+ struct chanserv_output *result = NULL;
+ char str [STRING_LONG] = {0};
+
+ if (!args || !args[0])
+ return chanserv_asprintf(NULL, "Whisper to who?");
+ if (args[1] == NULL)
+ return chanserv_asprintf(NULL, "What do you want me to whisper to %s?", args[0]);
+ if (strcasecmp (args[1], Mynick) == 0)
+ return result; /* don't bother telling myself about stuff */
+ if (strcasecmp (args[1], "ABOUT") == 0)
+ {
+ if ((db_argstostr (str, args, 2, ' ')) < 1)
+ return chanserv_asprintf(NULL, "Whisper to %s about what?", args[0]);
+ strlwr(str);
+ show_url(source, get_multiword_topic(str), args[0], 1, 0, userhost, 1);
+ }
+ else
+ {
+ strlwr (args[1]);
+ show_url(source, get_multiword_topic(args[1]), args[0], 1, 0, userhost, 1);
+ }
+
+ return result;
+}
+
+/* The help system uses the first alias for each command for the list of commands.
+ * So make the first alias the most meaningful, and keep the list sorted by that first alias.
+ */
+struct chanserv_command chanserv_commands[] =
+{
+ {NORMAL_COMMAND, ADD_LEVEL, 1, 0, chanserv_add, {"ADD", "REMEMBER", "SAVE", "STORE", NULL}, "<topic> <text>", "Add a topic and it's text."},
+ {PASSWORD_COMMAND, 3, 4, 0, chanserv_add_user, {"ADDUSER", NULL, NULL, NULL, NULL}, "<#channel|#*> <user@host> <level> [password]", "Add a user to the access list."},
+ {SAFE_COMMAND, 2, 2, 0, chanserv_alarm, {"ALARM", "ALARMCLOCK", NULL, NULL, NULL}, "<time type: d/h/m><time> <text to say>", "Set some text to be said by the bot at a later time."},
+#ifdef ENABLE_CHANNEL
+ {DANGER_COMMAND, 3, 1, 0, chanserv_autotopic, {"AUTOTOPIC", NULL, NULL, NULL, NULL}, "<channel topic>", "Refreshes the channel topic every thirty minutes (set to \"0\" to turn off)."},
#endif
- }
- else if (stricmp (cmd, "ADDUSER") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s4 = strtok (NULL, " ");
- s = strtok (NULL, " ");
- s2 = strtok (NULL, " ");
- s5 = strtok (NULL, " ");
- if (s == NULL || s4 == NULL || s2 == NULL || s5 == NULL)
- {
- L055 (source);
- return;
- }
- sn = atoi (s2);
- if (sn > 10 || sn <= 0)
- return;
- if (strlen (s) < 7)
- return;
- L056 (*CMDCHAR);
- add_helper (s4, mask_from_nick(s, target), sn, 0, temp, s5, 0);
- L057 (source, mask_from_nick(s, target), sn);
- save_changes ();
- }
-#if DO_CHANBOT_CRAP == 1
- }
- else if (stricmp (cmd, "PERMBAN") == 0 || stricmp (cmd, "SHITLIST") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- s = strtok (NULL, " ");
- if (s == NULL)
- {
- L058 (source, *CMDCHAR, cmd);
- return;
- }
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- s2 = "Permbanned!";
- add_permban (s, 0, s2);
- L059 (source, PERMBAN_counter, s, s2);
- save_permbans ();
- S ("MODE %s +b %s\n", target, s);
- }
+//#ifndef WIN32
+ {DANGER_COMMAND, 3, 0, 0, chanserv_backup, {"BACKUP", NULL, NULL, NULL, NULL}, NULL, "Create a backup of the database."},
+//#endif
+#ifdef ENABLE_CHANNEL
+ {INFO_COMMAND, 1, 0, 0, chanserv_ban_list, {"BANLIST", NULL, NULL, NULL, NULL}, NULL, "Displays permanent bans."},
#endif
- }
- else if (stricmp (cmd, "ALARM") == 0 || stricmp (cmd, "ALARMCLOCK") == 0)
+#ifdef ENABLE_MATH
+ {INFO_COMMAND, 0, 1, 0, chanserv_calc, {"CALC", "MATH", NULL, NULL, NULL}, "<expression>", "Very basic calculator."},
+#endif
+ {INFO_COMMAND, 0, 1, 0, chanserv_chan_info, {"CHANINFO", NULL, NULL, NULL, NULL}, "<#channel>", "Displays number of users in channel and in ram."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_chan_users, {"CHANUSERS", NULL, NULL, NULL, NULL}, "<#channel>", "Displays names of users in channel."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_char, {"CHAR", NULL, NULL, NULL, NULL}, "<character>", "Show the ascii code of the character."},
+ {INFO_COMMAND, 0, 0, 1, chanserv_char_show, {"CMDCHAR?", NULL, NULL, NULL, NULL}, NULL, "Show command character."},
+ {INFO_COMMAND, 0, 0, 1, chanserv_cpu_show, {"CPU?", NULL, NULL, NULL, NULL}, NULL, "Show the cpu usage of the bot."},
+ {DANGER_COMMAND, 2, 0, 0, chanserv_cycle, {"CYCLE", "CYC", NULL, NULL, NULL}, "[#channel]", "Leave and rejoin the channel."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_data_search, {"DATASEARCH", "DSEARCH", "DFIND", NULL, NULL}, "<topic>", "Search in the replies."},
+ {INFO_COMMAND, 0, 0, 0, chanserv_date, {"DATE", "TIME", NULL, NULL, NULL}, NULL, "Show the current date and time."},
+ {DANGER_COMMAND, 0, 1, 0, chanserv_reserved_2, {RESERVED2, NULL, NULL, NULL, NULL}, "<>", ""},
+#ifdef ENABLE_CHANNEL
+ {DANGER_COMMAND, 3, 1, 0, chanserv_delban, {"DELBAN", NULL, NULL, NULL, NULL}, "<user@host>", "Delete a user from the permanent ban list."},
+#endif
+ {NORMAL_COMMAND, DEL_LEVEL, 1, 0, chanserv_delete, {"DELETE", "DEL", "REMOVE", "FORGET", NULL}, "<topic>", "Delete a topic."},
+ {DANGER_COMMAND, 3, 1, 0, chanserv_deluser, {"DELUSER", NULL, NULL, NULL, NULL}, "<user@host>", "Delete a user from the access list."},
+#ifdef ENABLE_CHANNEL
+ {DANGER_COMMAND, 3, 1, 0, chanserv_deop, {"DEOP", NULL, NULL, NULL, NULL}, "[#channel] <nicks>", "Remove channel operator status from users."},
+ {NORMAL_COMMAND, 3, 1, 0, chanserv_devoice, {"DEVOICE", "DV", "DEV", "DVOICE", NULL}, "[#channel] <nicks>", "Remove channel voice status from users."},
+#endif
+ {DANGER_COMMAND, 3, 0, 0, chanserv_die, {"DIE", "QUIT", NULL, NULL, NULL}, NULL, "Stop bot from running."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_display, {"DISPLAY", NULL, NULL, NULL, NULL}, "<topic>", "Display the text for a topic."},
+#ifdef ENABLE_CHANNEL
+ {DANGER_COMMAND, 2, 0, 0, chanserv_down, {"DOWN", NULL, NULL, NULL, NULL}, NULL, "Remove channel operator status from yourself."},
+#endif
+ {INFO_COMMAND, 0, 0, 0, chanserv_darkbot, {"\2\2DARKBOT", NULL, NULL, NULL, NULL}, NULL, ""},
+ {DANGER_COMMAND, 0, 1, 0, chanserv_reserved_1, {RESERVED1, NULL, NULL, NULL, NULL}, "<>", ""},
+#ifdef ENABLE_GOOGLE
+ {NORMAL_COMMAND, 0, 1, 0, chanserv_google, {"GOOGLE", NULL, NULL, NULL, NULL}, "<text>", "Look up the text on google."},
+#endif
+ {INFO_COMMAND, 0, 0, 0, chanserv_help, {"HELP", NULL, NULL, NULL, NULL}, "[command]", "Show some help text to the user."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_idle, {"IDLE", NULL, NULL, NULL, NULL}, "<nick>", "Shows how long the user has been idle."},
+ {DANGER_COMMAND, 1, 1, 0, chanserv_ignore, {"IGNORE", NULL, NULL, NULL, NULL}, "<nick>", "Get bot to ignore a user."},
+ {INFO_COMMAND, 0, 0, 1, chanserv_info, {"INFO", NULL, NULL, NULL, NULL}, NULL, "Shows some information about bot and it's activity."},
+ {INFO_COMMAND, 0, 0, 1, chanserv_info_2, {"INFO2", NULL, NULL, NULL, NULL}, NULL, "Shows when the bot was compiled, and lines processed since startup."},
+ {INFO_COMMAND, 2, 0, 1, chanserv_info_size, {"INFOSIZE", "DBSIZE", NULL, NULL, NULL}, NULL, "Show size of the database."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_isop, {"ISOP", NULL, NULL, NULL, NULL}, "<nick>", "Is user a channel op?"},
+ {DANGER_COMMAND, 2, 1, 0, chanserv_join, {"JOIN", "J", NULL, NULL, NULL}, "<#channel>", "Get bot to join a channel."},
+ {INFO_COMMAND, 0, 0, 1, chanserv_joins_show, {"JOINS?", NULL, NULL, NULL, NULL}, NULL, "Shows the number of user joins bot has seen in this channel since startup."},
+#ifdef ENABLE_CHANNEL
+ {DANGER_COMMAND, 3, 1, 0, chanserv_kick, {"KICK", "WHACK", "K", "NAIL", NULL}, "[#channel] <nick> [reason]", "Kick a user off the channel."},
+#endif
+ {INFO_COMMAND, 0, 0, 0, chanserv_language, {"LANGUAGE", "LANG", NULL, NULL, NULL}, NULL, "Shows the language that bot is currently speaking."},
+ {DANGER_COMMAND, 2, 0, 0, chanserv_leave, {"LEAVE", "PART", "L", "P", NULL}, "[#channel]", "Get bot to leave the channel."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_length, {"LENGTH", NULL, NULL, NULL, NULL}, "<text>", "Show the length of the text."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_level, {"LEVEL", NULL, NULL, NULL, NULL}, "<nick>", "Show users level."},
+ {INFO_COMMAND, 0, 0, 0, chanserv_location_show, {"LOCATION?", NULL, NULL, NULL, NULL}, NULL, "Shows what servers are available and in use."},
+ {PASSWORD_COMMAND, 0, 1, 0, chanserv_login, {"LOGIN", NULL, NULL, NULL, NULL}, "<password>", "Gives you access to high level bot commands if you are on the access list."},
+#ifdef ENABLE_STATUS
+ {INFO_COMMAND, 1, 0, 0, chanserv_users_list, {"LUSERS", NULL, NULL, NULL, NULL}, NULL, ""},
+#endif
+ {INFO_COMMAND, 0, 1, 0, chanserv_mask, {"MASK", NULL, NULL, NULL, NULL}, "<nick>", "Show the users user@host mask."},
+//#ifndef WIN32
+ {INFO_COMMAND, 3, 0, 1, chanserv_memory, {"MEM", "RAM", NULL, NULL, NULL}, NULL, "Shows some memory usage and process statistics."},
+//#endif
+#ifdef ENABLE_METAR
+ {NORMAL_COMMAND, 0, 1, 0, chanserv_metar, {"METAR", NULL, NULL, NULL, NULL}, "<city or code>", "Get raw METAR weather data."},
+#endif
+ {DANGER_COMMAND, 3, 1, 0, chanserv_nick, {"NICK", "N", NULL, NULL, NULL}, "<newnick>", "Change bot's nickname, but not the default."},
+#ifdef ENABLE_CHANNEL
+ {DANGER_COMMAND, 3, 1, 0, chanserv_op, {"OP", NULL, NULL, NULL, NULL}, "[#channel] <nicks>", "Add channel operator status to users."},
+#endif
+ {INFO_COMMAND, 0, 0, 1, chanserv_os_show, {"OS", NULL, NULL, NULL, NULL}, NULL, "Show the operating system that bot is running on."},
+ {PASSWORD_COMMAND, 0, 2, 0, chanserv_password, {"PASSWORD", "PASS", "PASSWD", NULL, NULL}, "<old password> <new password>", "Change your bot access list password."},
+ {DANGER_COMMAND, 3, 0, 0, chanserv_performs, {"PERFORMS", NULL, NULL, NULL, NULL}, NULL, "Perform the tasks in the perform.ini startup script."},
+#ifdef ENABLE_CHANNEL
+ {DANGER_COMMAND, 3, 1, 0, chanserv_perm_ban, {"PERMBAN", "SHITLIST", NULL, NULL, NULL}, "<user@host> [reason]", "Adds a user to the permanent ban list."},
+ {INFO_COMMAND, 0, 0, 0, chanserv_perm_bans_list, {"PERMBANS?", NULL, NULL, NULL, NULL}, NULL, "Shows how many permanent bans there are."},
+#endif
+#ifdef ENABLE_CTCP
+ {INFO_COMMAND, 0, 1, 0, chanserv_ping, {"\1PING", NULL, NULL, NULL, NULL}, "<>", ""},
+#endif
+ {INFO_COMMAND, 0, 0, 0, chanserv_ping2, {"PING", NULL, NULL, NULL, NULL}, NULL, "Replies with \"PONG\" to see how lagged the bot is.."},
+ {INFO_COMMAND, 0, 0, 0, chanserv_queue_show, {"SENDQ?", "QUE?", NULL, NULL, NULL}, NULL, "Shows how many items are ready to be displayed."},
+#ifdef ENABLE_QUIZ
+ {SAFE_COMMAND, 0, 0, 0, chanserv_quiz, {"QUIZ", NULL, NULL, NULL, NULL}, NULL, ""},
+#endif
+#ifdef ENABLE_RANDQ
+ {NORMAL_COMMAND, 0, 1, 0, chanserv_quote, {"QUOTE", NULL, NULL, NULL, NULL}, "[text]", "Shows a random quote."},
+ {NORMAL_COMMAND, 0, 1, 0, chanserv_random_quote, {"RANDQUOTE", "RANDQ", NULL, NULL, NULL}, "[text]", "Shows a random quote."},
+ {NORMAL_COMMAND, 0, 1, 0, chanserv_random_quote_2, {"RANDQUOTE2", "RANDQ2", NULL, NULL, NULL}, "[text]", "Shows a random quote."},
+#endif
+#ifdef ENABLE_RANDOM
+ {NORMAL_COMMAND, RAND_LEVEL, 1, 0, chanserv_random_stuff, {"RANDOMSTUFF", "RANDSTUFF", "RS", NULL, NULL}, "<text>", "Add random stuff to say."},
+ {INFO_COMMAND, 0, 0, 0, chanserv_random_stuff_list, {"RANDOMSTUFF?", "RANDSTUFF?", NULL, NULL, NULL}, NULL, "Shows time until next random thing is said."},
+#endif
+ {DANGER_COMMAND, 3, 1, 0, chanserv_raw, {"RAW", NULL, NULL, NULL, NULL}, "<raw data>", "Get bot to send raw IRC data."},
+//#ifndef WIN32
+ {INFO_COMMAND, 0, 0, 0, chanserv_rdb, {"RDB", NULL, NULL, NULL, NULL}, "[topic]", "Display information about the random databases."},
+//#endif
+ {DANGER_COMMAND, 3, 3, 0, chanserv_repeat, {"REPEAT", "TIMER", NULL, NULL, NULL}, "<number> <delay> <raw data>", "Get bot to send raw IRC data a number of times."},
+ {NORMAL_COMMAND, 1, 1, 0, chanserv_replace, {"REPLACE", NULL, NULL, NULL, NULL}, "<topic> <text>", "Replace the text of a topic."},
+ {DANGER_COMMAND, 3, 0, 0, chanserv_restart, {"RESTART", "REHASH", NULL, NULL, NULL}, NULL, "Restart the bot."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_search, {"SEARCH", "LOOK", "FIND", NULL, NULL}, "<text>", "Search in the topics."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_seen, {"SEEN", NULL, NULL, NULL, NULL}, "<nick>", "Show the last time a user was seen."},
+ {DANGER_COMMAND, 3, 1, 0, chanserv_jump, {"SERVER", "JUMP", NULL, NULL, NULL}, "<server> [port]", "Switch bot to a different server."},
+ {DANGER_COMMAND, 3, 1, 0, chanserv_set, {"SET", NULL, NULL, NULL, NULL}, "<parameter>[=<new value>]", "Set or show the value of a setup.ini parameter. Usually requires a restart."},
+ {DANGER_COMMAND, 1, 1, 0, chanserv_setinfo, {"SETINFO", NULL, NULL, NULL, NULL}, "<new user greeting|0>", "Set your greeting from the bot when you join a channel."},
+ {SAFE_COMMAND, SLEEP_LEVEL, 0, 1, chanserv_sleep, {"SLEEP", "HUSH", NULL, NULL, NULL}, NULL, "Deactivate bot for a period."},
+#ifdef ENABLE_STATS
+ {INFO_COMMAND, 0, 0, 0, chanserv_stats, {"STATS", NULL, NULL, NULL, NULL}, "[nick]", "Shows statistics about questions answered."},
+#endif
+#ifdef ENABLE_TAF
+ {NORMAL_COMMAND, 0, 1, 0, chanserv_taf, {"TAF", NULL, NULL, NULL, NULL}, "<city or code>", "Get raw TAF weather data."},
+#endif
+#ifdef ENABLE_CHANNEL
+ {DANGER_COMMAND, 2, 1, 0, chanserv_teaseop, {"TEASEOP", "TO", NULL, NULL, NULL}, "<nick>", "Tease a user with channel operator status."},
+#endif
+ {INFO_COMMAND, 0, 2, 0, chanserv_tell, {"TELL", NULL, NULL, NULL, NULL}, "<nick> [ABOUT] <topic>", "Get bot to recall a topic to a user."},
+#ifdef ENABLE_CHANNEL
+ {DANGER_COMMAND, 2, 0, 0, chanserv_topic, {"TOPIC", "T", NULL, NULL, NULL}, "<channel topic>", "Change the channels topic."},
+#endif
+ {DANGER_COMMAND, 1, 1, 0, chanserv_unignore, {"UNIGNORE", NULL, NULL, NULL, NULL}, "<nick>", "Get bot to stop ignoring a user."},
+ {INFO_COMMAND, 0, 1, 0, chanserv_unixtime, {"UNIXTIME", NULL, NULL, NULL, NULL}, "<time>", "Shows unixtime."},
+#ifdef ENABLE_CHANNEL
+ {DANGER_COMMAND, 2, 0, 0, chanserv_up, {"UP", NULL, NULL, NULL, NULL}, NULL, "Add channel operator status to yourself."},
+#endif
+//#ifndef WIN32
+ {INFO_COMMAND, 0, 0, 0, chanserv_uptime, {"UPTIME", NULL, NULL, NULL, NULL}, NULL, "Shows the uptime statistics for the computer the bot is running on."},
+//#endif
+ {INFO_COMMAND, 1, 0, 0, chanserv_user_list, {"USERLIST", "HLIST", "ACCESS", NULL, NULL}, NULL, "Show the bot's access list."},
+ {INFO_COMMAND, 0, 0, 0, chanserv_variables, {"VARIABLES", NULL, NULL, NULL, NULL}, NULL, "Displays variables you can use."},
+#ifdef ENABLE_CTCP
+ {INFO_COMMAND, 0, 0, 0, chanserv_version, {"\1VERSION\1", NULL, NULL, NULL, NULL}, NULL, ""},
+#endif
+#ifdef ENABLE_CHANNEL
+ {NORMAL_COMMAND, 3, 1, 0, chanserv_voice, {"VOICE", "V", NULL, NULL, NULL}, "[#channel] <nicks>", "Add channel voice status to users."},
+#endif
+ {SAFE_COMMAND, SLEEP_LEVEL, 0, 0, chanserv_wakeup, {"WAKEUP", NULL, NULL, NULL, NULL}, NULL, "Reactivates bot from sleep mode."},
+#ifdef ENABLE_WEATHER
+ {NORMAL_COMMAND, 0, 1, 0, chanserv_weather, {"WEATHER", NULL, NULL, NULL, NULL}, "<city or code>", "Get decoded weather data."},
+#endif
+ {SAFE_COMMAND, 0, 2, 0, chanserv_where, {"WHAT", "WHO", "WHERE", NULL, NULL}, "<IS> [A|AN] <topic>", "Recall a topic."},
+ {SAFE_COMMAND, 0, 2, 0, chanserv_whisper, {"WHISPER", NULL, NULL, NULL, NULL}, "<nick> [ABOUT] <topic>", "Get bot to recall a topic to a user privately."},
+ {INFO_COMMAND, 4, 0, 0, NULL, {NULL, NULL, NULL, NULL, NULL}, NULL, NULL}
+};
+
+void chanserv(char *source, char *target, char *buf)
+{
+ struct chanserv_output *result = NULL;
+ char *cmd = NULL, *userhost = NULL, oldbuf[BUFSIZ] = {"NULL"},
+ *ptr = NULL;
+ int i = 0, j = 0, found = -1, command = 0, wakeup = 0, exempt = 0,
+ more_needed = 0, too_many = 0, check_too_many = 0, arg_count = 0;
+ enum chanserv_invoke_type input_type = DIRECT_INVOKE;
+ enum chanserv_command_type command_type = NORMAL_COMMAND;
+
+#ifdef ENABLE_RANDOM
+ if (strcasecmp (target, CHAN) == 0)
+ Rand_Idle = 0;
+#endif
+ stripline (buf);
+ stripline (source);
+ if (buf == NULL || target == NULL || source == NULL)
+ return;
+
+ /* Make a copy of the original buffer in a safe location for
+ * later use. Strip the : if there is one.
+ */
+
+ strncpy (oldbuf, buf, sizeof (oldbuf));
+
+ /* Pointer to oldbuf */
+ ptr = oldbuf;
+
+ if (*ptr == ':')
+ ptr++;
+
+ cmd = strtok (buf, " ");
+
+ if (!cmd)
+ return;
+ if (*cmd == ':')
+ cmd++;
+
+ if ((userhost = strchr (source, '!')) != NULL)
+ *userhost++ = '\0';
+
+ if (check_ignore_user_ram(source) > 0)
+ return;
+
+ if (*target != '#' && *target != '&' && *target != '+')
+ {
+ input_type = MSG_INVOKE;
+ }
+ else if (strcasecmp (cmd, NICK_COMMA) == 0 ||
+ strcasecmp (cmd, COLON_NICK) == 0 ||
+ strcasecmp (cmd, BCOLON_NICK) == 0 ||
+ strcasecmp (cmd, Mynick) == 0)
+ {
+ input_type = ADDRESS_INVOKE;
+ cmd = strtok (NULL, " ");
+ }
+
+ if (cmd)
+ {
+ if (*cmd == *CMDCHAR)
+ {
+ cmd++;
+ command = 1;
+ input_type = CHAR_INVOKE;
+ }
+
+ strupr (cmd);
+ for (i = 0; chanserv_commands[i].func != NULL; i++)
+ {
+ for (j = 0; chanserv_commands[i].command[j] != NULL; j++)
+ {
+ if (strcmp(cmd, chanserv_commands[i].command[j]) == 0)
+ {
+ found = i;
+ command_type = chanserv_commands[found].type;
+ check_too_many = chanserv_commands[found].too_many;
+ if (strcmp(cmd, "WAKEUP") == 0)
+ wakeup = 1;
+ break;
+ }
+ }
+ if (found != -1)
+ break;
+ }
+ }
+
+ if (input_type != MSG_INVOKE)
+ {
+ if (((Sleep_Toggle == 1) && (wakeup != 1)) || (cf(userhost, source, target)))
+ return;
+ add_user(target, source, userhost, 0); /* Unidle */
+ }
+
+ if (found != -1)
+ {
+ /*
+ * password related commands can ONLY be done privately.
+ * Every command can be done by /msg bot !command.
+ * Every command can be done by /query bot !command.
+ * Every command can be done by /msg bot !command.
+ * Every danger command can be done by bot: !command.
+ * Every danger command can be done by !command.
+ * Every normal command can be done by /query bot command.
+ * Every normal command can be done by /msg bot command.
+ * Every safe command can be done by bot: command.
+ * Every information command can be done by command.
+ */
+
+ switch (command_type)
+ {
+ case INFO_COMMAND :
+ break;
+
+ case SAFE_COMMAND :
+ {
+ if (input_type == DIRECT_INVOKE)
+ return;
+ break;
+ }
+
+ case NORMAL_COMMAND :
+ {
+ if (input_type == DIRECT_INVOKE)
+ return;
+ break;
+ }
+
+ case DANGER_COMMAND :
+ {
+ if (command != 1)
+ return;
+ break;
+ }
+
+ case PASSWORD_COMMAND :
+ {
+ if (input_type != MSG_INVOKE)
+ return;
+ break;
+ }
+ }
+
+ if (check_access(userhost, (input_type == MSG_INVOKE) ? "#*" : target, 0, source) >= chanserv_commands[found].access)
+ {
+ char **args = NULL;
+ int k = 0;
+
+ /* Use the char count of spaces in our oldbuf ptr. Since
+ * it has the cmd tacked on the beginning, the number of
+ * spaces gives us an accurate early number of arguments
+ * supplied by the user, because the count of spaces will
+ * return one more than the actual number of args supplied.
+ * The first word is the cmd, so we don't want this counted.
+ * This is sort of a lazy way of counting arguments before
+ * they're actually read into a buffer and dealt with.
+ *
+ * This allows us to "break out" of the command routine if
+ * we've entered accidentally by user input. Such instances
+ * may be if the user says "info things stuff", the bot
+ * realizes this is not a command, but normal conversation,
+ * and will respond if the topic is in it's database. If it's
+ * not found, the bot either ignores it or responds with a
+ * whut reply if addressed directly. This code is only
+ * intended for commands which have no arguments.
+ */
+
+ if (*ptr == '!')
+ ptr++;
+
+ /* Actual number of arguments supplied. */
+ k = count_char (ptr, ' ');
+
+ /* Number of arguments expected. */
+ arg_count = chanserv_commands[found].arg_count;
+
+ if (k > 0)
{
- if (check_access (userhost, target, 0, source) >= 2)
+ args = calloc(k, sizeof(char *));
+ if (args)
+ {
+ for (i = 0; i < k; i++)
{
- s = strtok (NULL, " ");
- s2 = strtok (NULL, "");
- if (s == NULL || s2 == NULL)
- {
- S ("NOTICE %s :Syntax: <time type: d/h/m><time> <text to say>\n", source);
- return;
- }
- if (strlen (s) < 2)
- {
- S ("NOTICE %s :Syntax: <time type: d/h/m><time> <text to say>\n", source);
- return;
- }
- if (*s == 'd')
- {
- sn = 86400;
- s++;
- }
- else if (*s == 'h')
- {
- sn = 3600;
- s++;
- }
- else if (*s == 'm')
- {
- sn = 60;
- s++;
- }
- else
- {
- S ("NOTICE %s :Syntax: <time type: \2d/h/m\2><time> <text to say>\n", source);
- return;
- }
- if (strspn (s, NUMBER_LIST) != strlen (s))
- {
- S ("NOTICE %s :Time must be a number.\n", source);
- return;
- }
- i = (atoi (s) * sn) + time (NULL);
- snprintf (temp, sizeof (temp), "%s/%ld", DBTIMERS_PATH, i);
- db_log (temp,
- "PRIVMSG %s :\2ALARMCLOCK\2 by %s!%s: %s\n", target, source, userhost, s2);
- unixtime = atoi (s) * sn;
- if (unixtime > 86400)
- S ("PRIVMSG %s :%s, alarmclock set to go off in %d day%s, %02d:%02d\n", target,
- source, unixtime / 86400, (unixtime / 86400 == 1) ? "" : "s",
- (unixtime / 3600) % 24, (unixtime / 60) % 60);
- else if (unixtime > 3600)
- S ("PRIVMSG %s :%s, alarmclock set to go off in %d hour%s, %d min%s\n", target,
- source, unixtime / 3600, unixtime / 3600 == 1 ? "" : "s",
- (unixtime / 60) % 60, (unixtime / 60) % 60 == 1 ? "" : "s");
- else
- S ("PRIVMSG %s :%s, alarmclock set to go off in %d minute%s, %d sec%s\n",
- target, source, unixtime / 60, unixtime / 60 == 1 ? "" : "s", unixtime % 60,
- unixtime % 60 == 1 ? "" : "s");
+ args[i] = strtok(NULL, " ");
}
+ args[i++] = NULL;
+
+ /* Check for more arguments needed, but don't
+ * bail out, we'll take care of it later. */
+ if (i < arg_count)
+ more_needed = 1;
+ }
+ else
+ return;
+
+ /* Check for too many args on special cases. */
+ if (check_too_many == 1)
+ {
+ if ((input_type == ADDRESS_INVOKE) && (k > (arg_count+1)))
+ too_many = 1;
+ if ((k > arg_count) && (input_type == DIRECT_INVOKE))
+ too_many = 1;
+ if ((k > arg_count) && (input_type == MSG_INVOKE))
+ too_many = 1;
+ if ((k > arg_count) && (input_type == CHAR_INVOKE))
+ return;
+ }
}
- else if (stricmp (cmd, "REPEAT") == 0 || stricmp (cmd, "TIMER") == 0)
+
+ if (too_many == 1)
{
- if (check_access (userhost, target, 0, source) >= 3)
+ int i = 0;
+ char *ptr2 = NULL;
+
+ strlwr (ptr);
+
+ for (i = 0; i < strlen (ptr); i++)
{
- s = strtok (NULL, " ");
- s2 = strtok (NULL, " ");
- s3 = strtok (NULL, "");
- if (s == NULL || s2 == NULL || s3 == NULL)
- {
- L060 (source);
- return;
- }
- sn = atoi (s);
- sn2 = atoi (s2);
- while (sn > 0)
- {
- S ("%s\n", s3);
- sn--;
- db_sleep (sn2);
- }
+ if (ptr[i] == ' ')
+ ptr[i] = '+';
}
- }
- else if (stricmp (cmd, "REHASH") == 0 || stricmp (cmd, "RESTART") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
+
+
+ /* Strip the bot's nickname if ADDRESS_INVOKE */
+
+ if (input_type == ADDRESS_INVOKE)
{
- L062 (dbVersion);
- sleep (2);
- snprintf (temp, sizeof (temp), "%s", DARKBOT_BIN);
- system (temp);
- db_sleep (1);
- exit (0);
+ ptr2 = strtok (ptr, "+");
+ ptr = strtok (NULL, "");
}
+
+ /* Output only if the topic exists. If the bot was
+ * addressed by nickname (ADDRESS_INVOKE), output
+ * anyway because show_url will supply a DUNNO
+ * response.
+
+ * If the input_type was MSG_INVOKE, we use the
+ * source as a target, because the target ends up
+ * being set to the bot's own nickname due to the
+ * parsing under certain conditions.
+ */
+
+ if (check_existing_url(source, ptr, target) == 1)
+// || (input_type == ADDRESS_INVOKE)
+// || (input_type == MSG_INVOKE))
+ {
+ show_url(source, ptr,
+ ((input_type == MSG_INVOKE)
+ ? source : target), 1, 0, userhost, 0);
+ return;
+ }
+ /* No matching database entry. */
+ return;
}
- else if (stricmp (cmd, "PING") == 0)
+ else if ((more_needed == 1) && chanserv_commands[found].syntax)
{
- if (check_access (userhost, target, 0, source) == 0)
- {
- S ("NOTICE %s PONG!\n", source);
- }
- else
- S ("PRIVMSG %s :PONG!\n", target);
+ result = chanserv_show_help(cmd, check_access(userhost, (input_type == MSG_INVOKE) ? "#*" : target, 0, source));
}
- else if (stricmp (cmd, "HELP") == 0)
+ else
{
- L100 (source, NICK_COMMA, COLON_NICK, BCOLON_NICK, Mynick, NICK_COMMA, NICK_COMMA);
- db_sleep (3);
- if (cf (userhost, source, target))
- return;
- L101 (source, NICK_COMMA, NICK_COMMA, NICK_COMMA);
- db_sleep (2);
+ /* We call this to give the command a chance to supply
+ * a custom error msg if there are not enough
+ * arguments. Because it fell through the loop
+ * this far, we assume it's a normal command with
+ * arguments to be parsed.
+ */
+
+ result = chanserv_commands[found].func(source, target, cmd, args, input_type, userhost);
}
- else if (stricmp (cmd, "SETINFO") == 0)
+
+ if (result)
{
- if (check_access (userhost, target, 0, source) >= 1)
- {
- s = strtok (NULL, "");
- if (s == NULL)
- {
- S ("NOTICE %s :%s\n", source, mySetinfo);
- return;
- }
- update_setinfo (userhost, s, source);
- save_changes ();
+ struct chanserv_output *output = result;
+
+ i = 1;
+ while (output)
+ {
+ char *s, *s2, c;
+ int length, len;
+
+/* RFC2812 says max packet length is 512, including CR-LF at end.
+ * Also a colon and a space at the beginning.
+ */
+//#define MAX_IRC_LEN 507 // This doesn't work.
+#define MAX_IRC_LEN 475 // This works.
+
+ s = output->output;
+ length = strlen(s);
+ if (input_type == MSG_INVOKE)
+ {
+ len = 12 + strlen(source);
+ while ((len + length) > MAX_IRC_LEN)
+ {
+ c = s[MAX_IRC_LEN - len];
+ s[MAX_IRC_LEN - len] = '\0';
+ s2 = strrchr(s, ' ');
+ *s2 = '\0';
+ S("NOTICE %s :%s\n", source, s);
+ db_sleep(2);
+ *s2 = ' ';
+ s[MAX_IRC_LEN - len] = c;
+ s = s2 + 1;
+ length = strlen(s);
+ }
+ S("NOTICE %s :%s\n", source, s);
}
- }
-#if CTCP == 1
+ else
+ {
+ len = 16 + strlen(target) + strlen(source);
+ while ((len + length) > MAX_IRC_LEN)
+ {
+ c = s[MAX_IRC_LEN - len];
+ s[MAX_IRC_LEN - len] = '\0';
+ s2 = strrchr(s, ' ');
+ *s2 = '\0';
+ S("PRIVMSG %s :%s: %s\n", target, source, s);
+ db_sleep(2);
+ *s2 = ' ';
+ s[MAX_IRC_LEN - len] = c;
+ s = s2 + 1;
+ length = strlen(s);
+ }
+ S("PRIVMSG %s :%s: %s\n", target, source, s);
+ }
+ output = output->next;
+ }
+ chanserv_output_free(result);
+ }
+ free(args);
+ }
}
- else if (stricmp (cmd, "\1VERSION\1") == 0)
- { /* these are #chan
- * ctcp's */
- if (cf (userhost, source, target))
- return;
- if (cf (userhost, source, target))
- return;
- S ("NOTICE %s :\1VERSION %s\1\n", source,
- "Hi, I'm a Darkbot. Download me from http://www.freezedown.org");
+ else if (input_type != CHAR_INVOKE)
+ {
+ if ((input_type == ADDRESS_INVOKE) && (cmd == NULL))
+ {
+ if (RANDOM_WHUT == true)
+ do_randomtopic(WHUTR, target, WHUT_FILE, source, cmd);
+ else
+ {
+ if (input_type == MSG_INVOKE)
+ S("NOTICE %s :%s\n", source, WHUT);
+ else
+ S("PRIVMSG %s :%s: %s\n", target, source, WHUT);
+ }
+ }
+ else if ((GENERAL_QUESTIONS) && (cmd))
+ {
+ show_url(source, get_multiword_topic(cmd),
+ (input_type == MSG_INVOKE) ? source : target,
+ (! (input_type == DIRECT_INVOKE)),
+ (input_type == DIRECT_INVOKE),
+ userhost, 0);
+ }
}
- else if (stricmp (cmd, "\1PING") == 0)
+}
+
+struct chanserv_output *chanserv_show_help(char *cmd, int user_level)
+{
+ struct chanserv_output *result = NULL;
+ char temp[10 * 1024] = { 0 }, cmdchar[2] = "\0\0";
+ int i, j, found = -1;
+
+ if (*cmd == *CMDCHAR)
+ cmd++;
+ strupr(cmd);
+ for (i = 0; chanserv_commands[i].func != NULL; i++)
{
- if (cf (userhost, source, target))
- return;
- if (cf (userhost, source, target))
- return;
- s2 = strtok (NULL, "");
- if (s2 != NULL)
+ for (j = 0; chanserv_commands[i].command[j] != NULL; j++)
+ {
+ if (strcmp(cmd, chanserv_commands[i].command[j]) == 0)
{
- if (strlen (s2) > 21)
- s2[21] = '\0';
- S ("NOTICE %s :\1PING %s\n", source, s2);
+ found = i;
+ break;
}
-#endif
+ }
+ if (found != -1)
+ break;
}
- else if (stricmp (cmd, "\2\2DARKBOT") == 0)
+
+ if (found != -1)
{
- if (Sleep_Toggle == 1)
- return;
- if (cf (userhost, source, target))
- return;
- S ("PRIVMSG %s :%s reporting! My cmdchar is %c\n", target, dbVersion, *CMDCHAR);
+ if (chanserv_commands[found].type == DANGER_COMMAND)
+ cmdchar[0] = *CMDCHAR;
+ else
+ cmdchar[0] = '\0';
+ for (j = 0; chanserv_commands[found].command[j] != NULL; j++)
+ {
+ if (j)
+ strcat(temp, " | ");
+ if (chanserv_commands[i].type == DANGER_COMMAND)
+ strcat(temp, cmdchar);
+ strcat(temp, chanserv_commands[found].command[j]);
+ }
+ result = chanserv_asprintf(result, "%s [level %d] - %s SYNTAX - %s%s %s", temp, chanserv_commands[found].access, chanserv_commands[found].summary, cmdchar, cmd,
+ (chanserv_commands[found].syntax != NULL) ? chanserv_commands[found].syntax : "");
+ }
+ else if (strcmp(cmd, "COMMANDS") == 0)
+ {
+ cmdchar[0] = *CMDCHAR;
+ for (i = 0; chanserv_commands[i].func != NULL; i++)
+ {
+ if (chanserv_commands[i].access <= user_level)
+ {
+ if (chanserv_commands[i].command[0][0] > 10)
+ {
+ if (i)
+ strcat(temp, " ");
+ if (chanserv_commands[i].type == DANGER_COMMAND)
+ strcat(temp, cmdchar);
+ strcat(temp, chanserv_commands[i].command[0]);
+ }
+ }
+ }
+ result = chanserv_asprintf(result, "%s", temp);
}
- else if (stricmp (cmd, NICK_COMMA) == 0
- || stricmp (cmd, COLON_NICK) == 0
- || stricmp (cmd, BCOLON_NICK) == 0 || stricmp (cmd, Mynick) == 0)
+ else if (strcmp(cmd, "PARAMETERS") == 0)
{
- s = strtok (NULL, " ");
- if (s != NULL)
+ for (i = 0; parameters[i].parameter[0] != NULL; i++)
+ {
+ if (parameters[i].access <= user_level)
{
- if (stricmp (s, "WAKEUP") == 0)
- {
- if (Sleep_Toggle == 0)
- return;
- if (check_access (userhost, target, 0, source) >= SLEEP_LEVEL)
- {
- Sleep_Toggle = 0;
- AIL4 = 0;
- S ("PRIVMSG %s :%s\n", target, WAKEUP_ACTION);
- if (stricmp (sleep_chan, target) != 0)
- S ("PRIVMSG %s :%s\n", sleep_chan, WAKEUP_ACTION);
- return;
- }
- }
+ if (i)
+ strcat(temp, " ");
+ strcat(temp, parameters[i].parameter[0]);
}
- if (Sleep_Toggle == 1)
- return;
- if (cf (userhost, source, target))
- return;
- if (s != NULL)
+ }
+ result = chanserv_asprintf(result, "%s", temp);
+ }
+ else
+ {
+ for (i = 0; parameters[i].parameter[0] != NULL; i++)
+ {
+ for (j = 0; parameters[i].parameter[j] != NULL; j++)
+ {
+ if (strcmp(cmd, parameters[i].parameter[j]) == 0)
+ {
+ found = i;
+ break;
+ }
+ }
+ if (found != -1)
+ break;
+ }
+
+ if (found != -1)
+ {
+ for (j = 0; parameters[found].parameter[j] != NULL; j++)
{
-#ifdef RANDOM_STUFF
- if (stricmp (s, "RANDOMSTUFF") == 0 || stricmp (s, "RANDSTUFF") == 0 ||
- stricmp (s, "RS") == 0)
- {
- if (check_access (userhost, target, 0, source) >= RAND_LEVEL)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- {
- L064 (target, source);
- return;
- }
- add_randomstuff (source, target, s2);
- }
- }
- else
-#endif
- if (stricmp (s, "ADD") == 0
- || stricmp (s, "REMEMBER") == 0
- || stricmp (s, "SAVE") == 0 || stricmp (s, "STORE") == 0)
- {
-#ifdef REQ_ACCESS_ADD
- if (check_access (userhost, target, 0, source) >= 1)
- {
-#endif
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- L065 (target, source);
- return;
- }
-
- // Fix for some segmenation fault problems
- // concerning topics consisting entirely of
- // wildcard characters.
- if (strspn(s2, "*?") == strlen(s2))
- {
- Lbadtopic(target,source);
- return;
- }
-
- if (strlen (s2) > MAX_TOPIC_SIZE)
- {
- s2[MAX_TOPIC_SIZE] = '\0';
- S ("PRIVMSG %s :%s, topic is over the limit, and has characters truncated.\n", target, source);
- }
- s3 = strtok (NULL, "");
- if (s3 == NULL)
- {
- L066 (target, source, s2);
- return;
- }
- if (strlen (s3) > MAX_DATA_SIZE)
- s3[MAX_DATA_SIZE] = '\0';
- strlwr (s2);
- if (*s2 == '~')
- {
- S ("PRIVMSG %s :%s, rdb files can only be called from the data of a topic, they cannot be used in the topic itself.\n", target, source);
- return;
- }
- if (check_existing_url (source, s2, target) == 1)
- {
- S ("PRIVMSG %s :%s \37%s\37\n", target, EXISTING_ENTRY, s2);
- return;
- }
-#ifdef LOG_ADD_DELETES
- db_log (ADD_DELETES, "[%s] %s!%s ADD %s %s\n", date (), source, userhost, s2, s3);
-#endif
- ADDITIONS++;
- if (s2[0] == 'i' && s2[1] == 'l' && s2[2] == 'c')
- {
- db_log (URL2, "%s ([%s] %s!%s): %s\n", s2, date (), source, userhost, s3);
- }
- else
- db_log (URL2, "%s %s\n", s2, s3);
- L067 (target, source);
-#ifdef REQ_ACCESS_ADD
- }
-#endif
- }
- else if (stricmp (s, "DATE") == 0 || stricmp (s, "TIME") == 0)
- {
- S ("PRIVMSG %s :%s, %s\n", target, source, date ());
- }
- else if (stricmp (s, "REPLACE") == 0)
- {
-#ifdef REQ_ACCESS_ADD
- if (check_access (userhost, target, 0, source) >= 1)
- {
-#endif
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- L068 (target, source);
- return;
- }
- if (strlen (s2) > MAX_TOPIC_SIZE)
- s2[MAX_TOPIC_SIZE] = '\0';
- s3 = strtok (NULL, "");
- if (s3 == NULL)
- {
- L069 (target, source, s2);
- return;
- }
- if (strlen (s3) > MAX_DATA_SIZE)
- s3[MAX_DATA_SIZE] = '\0';
- strlwr (s2);
- if (check_existing_url (source, s2, target) != 1)
- {
- S ("PRIVMSG %s :%s \37%s\37\n", target, NO_ENTRY, s2);
- return;
- }
- delete_url (source, s2, target);
-#ifdef LOG_ADD_DELETES
- db_log (ADD_DELETES,
- "[%s] %s!%s REPLACE %s %s\n", date (), source, userhost, s2, s3);
-#endif
- ADDITIONS++;
- db_log (URL2, "%s %s\n", s2, s3);
- L070 (target, source, s2);
-#ifdef REQ_ACCESS_ADD
- }
-#endif
-#if DO_CHANBOT_CRAP == 1
- }
- else if (stricmp (s, "PERMBANS?") == 0)
- {
- L071 (target,
- (PERMBAN_counter ==
- 1) ? "is" : "are", PERMBAN_counter, (PERMBAN_counter == 1) ? "" : "s");
-#endif
-#ifdef RANDOM_STUFF
- }
- else if (stricmp (s, "RANDOMSTUFF?") == 0 || stricmp (s, "RANDSTUFF?") == 0)
- {
- L073 (target, source, Rand_Stuff);
-#endif
- }
-// --------------------- RANDQ STUFF --------------------- //
-#if RANDQ == ON
- else if ((stricmp (s, "RANDQ") == 0) ||
- (stricmp (s, "RANDQUOTE") == 0))
- { // RANDQ_NORMAL
- s2 = strtok (NULL, "");
- if (strspn(s2, "*?") == strlen(s2))
- {
- S ("NOTICE %s :Invalid request!\n",
- source);
- return;
- }
+ if (j)
+ strcat(temp, " | ");
+ strcat(temp, parameters[found].parameter[j]);
+ }
- do_randq (s2, RANDQ_NORMAL, target, source);
- }
- else if ((stricmp (s, "RANDQ2") == 0) ||
- (stricmp (s, "RANDQUOTE2") == 0))
- { // RANDQ_CASE
- s2 = strtok (NULL, "");
- if (strspn(s2, "*?") == strlen(s2))
- {
- S ("NOTICE %s :Invalid request!\n",
- source);
- return;
- }
- do_randq(s2, RANDQ_CASE, target, source);
- }
-#endif
-// ------------------------------------------------------- //
- else if (stricmp (s, "LENGTH") == 0)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- return;
- L074 (target, source, strlen (s2));
- }
- else if (stricmp (s, "CHAR") == 0)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- return;
- S ("PRIVMSG %s :%s, %c -> %d\n", target, source, s2[0], s2[0]);
- }
- else if (stricmp (s, "DBSIZE") == 0 || stricmp (s, "INFOSIZE") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 2)
- {
- if (stat (URL2, &statbuf) == 0)
- {
- S ("PRIVMSG %s :My database file is presently %ld bytes big.\n", target,
- statbuf.st_size);
- }
- else
- {
- return;
- }
- }
- }
- else if (stricmp (s, "SEEN") == 0 && SeeN == 1)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- return;
- show_seen (s2, source, target);
- }
- else if (stricmp (s, "SENDQ?") == 0 || stricmp (s, "QUE?") == 0)
- {
- L075 (target, source, get_sendq_count (2), (get_sendq_count (2) == 1) ? "" : "s");
- }
- else if (stricmp (s, "JOINS?") == 0)
- {
- L076 (target, JOINs);
- }
- else if (stricmp (s, "LOCATION?") == 0)
- {
- L077 (target, (snr == 1) ? "is" : "are", snr, (snr == 1) ? "" : "s", spr);
- }
- else if (stricmp (s, "CMDCHAR?") == 0)
- {
- L078 (target, source, *CMDCHAR);
- }
- else if (stricmp (s, "DATASEARCH") == 0
- || stricmp (s, "DSEARCH") == 0 || stricmp (s, "DFIND") == 0)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- {
- L079 (target, s, source);
- return;
- }
- datasearch (source, s2, target);
- }
- else if (stricmp (s, "SEARCH") == 0
- || stricmp (s, "LOOK") == 0 || stricmp (s, "FIND") == 0)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- if (stricmp (s, "FIND") == 0)
- {
- S ("PRIVMSG %s :%s, %s?\n", target, TRY_FIND, source);
- }
- else
- L079 (target, s, source);
- return;
- }
- find_url (source, s2, target);
- }
- else if (stricmp (s, "STATS") == 0)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- get_stats (target, NULL);
- else
- get_stats (target, s2);
- }
- else if (stricmp (s, "QUIZ") == 0)
- {
-#if QUIZ == 1
- if (quiz_halt == 0)
- run_quiz_question (target);
-#endif
- }
-#if GOOGLE == 1
- else if (stricmp (s, "GOOGLE") == 0)
- {
- s2 = strtok (NULL, "");
- if(s2 == NULL)
- {
- S("PRIVMSG %s :Google what?\n", target);
- return;
- }
- web_post_query(s, source, userhost, target, s2, strlen(s2));
- }
-#endif
-#if METAR == 1
- else if (stricmp (s, "METAR") == 0)
- {
- s2 = strtok (NULL, "");
- if(s2 == NULL)
- {
- S("PRIVMSG %s :Metar what?\n", target);
- return;
- }
- web_post_query(s, source, userhost, target, s2, strlen(s2));
- }
-#endif
-#if TAF == 1
- else if (stricmp (s, "TAF") == 0)
- {
- s2 = strtok (NULL, "");
- if(s2 == NULL)
- {
- S("PRIVMSG %s :Taf what?\n", target);
- return;
- }
- web_post_query(s, source, userhost, target, s2, strlen(s2));
- }
-#endif
- else if (stricmp (s, "INFO2") == 0)
- {
- show_info2 (target, source);
- }
- else if (stricmp (s, "INFO") == 0)
- {
- info (source, target);
-#ifdef DO_MATH_STUFF
- }
- else if (stricmp (s, "CALC") == 0 || stricmp (s, "MATH") == 0)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- return;
- if (strlen (s2) > 200)
- s2[200] = '\0';
- do_math (source, target, s2);
-#endif
- }
- else if (stricmp (s, RESERVED1) == 0)
- {
- s2 = strtok (NULL, "");
- if ( s2 == NULL )
- return;
- call_reserved_1 ( source, target, s2 );
- }
- else if (stricmp (s, RESERVED2) == 0)
- {
- s2 = strtok (NULL, "");
- if ( s2 == NULL )
- return;
- call_reserved_2 ( source, target, s2 );
- }
- else if (stricmp (s, "IGNORE") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 1)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- S ("PRIVMSG %s :ignore who %s?\n", target, source);
- return;
- }
- if ( add_ignore_user_ram (s2) > 0 )
- S ("PRIVMSG %s :%s, ignoring %s\n", target, source, s2 );
- else
- S ("PRIVMSG %s :%s, unable to ignore %s\n", target, source, s2 );
- }
- }
- else if (stricmp (s, "UNIGNORE") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 1)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- S ("PRIVMSG %s :unignore who %s?\n", target, source);
- return;
- }
- if ( delete_ignore_user_ram (s2) > 0 )
- S ("PRIVMSG %s :%s, unignoring %s\n", target, source, s2 );
- else
- S ("PRIVMSG %s :%s, unable to unignore %s :(\n", target, source, s2 );
- }
- }
- else if (stricmp (s, "SLEEP") == 0 || stricmp (s, "HUSH") == 0)
- {
- if (check_access (userhost, target, 0, source) >= SLEEP_LEVEL)
- {
- Sleep_Toggle = 1;
-
- if ((s2 = strtok (NULL, "")) == NULL)
- Sleep_Time = SLEEP_TIME;
- else
- if ((Sleep_Time = strtol (s2, (char **) NULL, Sleep_Time)) < 1)
- Sleep_Time = SLEEP_TIME;
-
- S ("PRIVMSG %s :%s\n", target, GOSLEEP_ACTION);
- strncpy (sleep_chan, target, sizeof (sleep_chan));
-
- /* If the user has specified a custom length of time to sleep for, send
- * a notice reminding the user how long the bot will be asleep, in a
- * more readible format.
- */
-
- if (Sleep_Time != SLEEP_TIME)
- {
- if (Sleep_Time > 86400)
- S ("NOTICE %s :Sleeping for %ld day%s, %02ld:%02ld.\n",
- source, Sleep_Time / 86400,
- (Sleep_Time / 86400 == 1) ? "" : "s",
- (Sleep_Time / 3600) % 24,
- (Sleep_Time / 60) % 60);
- else if (Sleep_Time > 3600)
- S ("NOTICE %s :Sleeping for %ld hour%s, %ld min%s.\n",
- source, Sleep_Time / 3600,
- Sleep_Time / 3600 == 1 ? "" : "s",
- (Sleep_Time / 60) % 60,
- (Sleep_Time/ 60) % 60 == 1 ? "" : "s");
- else
- S ("NOTICE %s :Sleeping for %ld minute%s, %ld sec%s.\n",
- source, Sleep_Time / 60,
- Sleep_Time / 60 == 1 ? "" : "s",
- Sleep_Time % 60,
- Sleep_Time % 60 == 1 ? "" : "s");
- }
+ switch (parameters[found].type)
+ {
+ case ST_BOOLEAN :
+ {
+ bool *variable = parameters[found].value;
- }
- }
- else if (stricmp (s, "UNIXTIME") == 0)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- return;
- unixtime = atoi (s2) - time (NULL);
- if (unixtime > 86400)
- S ("PRIVMSG %s :%s, %d day%s, %02d:%02d\n",
- target, source, unixtime / 86400,
- (unixtime / 86400 == 1) ? "" : "s",
- (unixtime / 3600) % 24, (unixtime / 60) % 60);
- else if (unixtime > 3600)
- S ("PRIVMSG %s :%s, %d hour%s, %d min%s\n",
- target, source, unixtime / 3600,
- unixtime / 3600 == 1 ? "" : "s",
- (unixtime / 60) % 60, (unixtime / 60) % 60 == 1 ? "" : "s");
- else
- S ("PRIVMSG %s :%s, %d minute%s, %d sec%s\n",
- target, source, unixtime / 60,
- unixtime / 60 == 1 ? "" : "s", unixtime % 60, unixtime % 60 == 1 ? "" : "s");
- }
- else if (stricmp (s, "CPU?") == 0)
- {
- getrusage (RUSAGE_SELF, &r_usage);
- S ("PRIVMSG %s :CPU usage: %ld.%06ld, System = %ld.%06ld\n",
- target, r_usage.ru_utime.tv_sec, r_usage.ru_utime.tv_usec);
- }
- else if (stricmp (s, "DISPLAY") == 0)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- return;
- display_url (target, source, s2);
-#ifndef WIN32
- }
- else if (stricmp (s, "UPTIME") == 0)
- {
- snprintf (temp, sizeof (temp), "uptime\n");
- S ("PRIVMSG %s :Uptime: %s\n", target, run_program (temp));
- }
- else if (stricmp (s, "OS") == 0)
- {
- snprintf (temp, sizeof (temp), "uname\n");
- S ("PRIVMSG %s :I am running %s\n", target, run_program (temp));
- }
- else if (stricmp (s, "MEM") == 0 || stricmp (s, "RAM") == 0)
- {
- if (check_access (userhost, target, 0, source) >= 3)
- {
- snprintf (temp, sizeof (temp), "ps -u -p %d\n", getpid ());
- S ("PRIVMSG %s :ps: %s\n", target, run_program (temp));
- }
- }
- else if (stricmp (s, "RDB") == 0)
- {
- s2 = strtok (NULL, "");
- if (s2 == NULL)
- {
- snprintf (temp, sizeof (temp), "ls %s/*.rdb | wc\n", RDB_DIR);
- S ("PRIVMSG %s :RDB: %s\n", target, run_program (temp));
- }
- else
- {
- if (strspn (s2, SAFE_LIST) != strlen (s2))
- {
- S ("PRIVMSG %s :%s, rdb files are made up of letters and or numbers, no other text is accepted.\n", target, source);
- return;
- }
- snprintf (temp, sizeof (temp), "cat %s/%s.rdb | wc -l\n", RDB_DIR, s2);
- S ("PRIVMSG %s :%s\n", target, run_program (temp));
- }
+ result = chanserv_asprintf(result, "%s [level %d] - %s VALUE - %s = %s", temp, parameters[found].access, parameters[found].summary, cmd, (*variable) ? "true" : "false");
+ break;
+ }
+
+ case ST_INTEGER :
+ {
+ long *variable = parameters[found].value;
+
+ result = chanserv_asprintf(result, "%s [level %d] - %s VALUE - %s = %ld", temp, parameters[found].access, parameters[found].summary, cmd, *variable);
+ break;
+ }
+
+ case ST_STRING :
+ {
+ char *variable = parameters[found].value;
+
+ result = chanserv_asprintf(result, "%s [level %d] - %s VALUE - %s = %s", temp, parameters[found].access, parameters[found].summary, cmd, variable);
+ break;
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+int check_exempt (char *cmd)
+{
+ int i = 0;
+ int j = 0;
+ int k = 0;
+
+ char *exempt_items[] = {
+ "CYCLE",
+ "HELP",
+#ifdef ENABLE_STATS
+ "STATS",
#endif
- }
- else if (stricmp (s, "DELETE") == 0
- || stricmp (s, "REMOVE") == 0
- || stricmp (s, "FORGET") == 0 || stricmp (s, "DEL") == 0)
+ NULL
+ };
+
+ strupr(cmd);
+
+ for (i = 0; chanserv_commands[i].func != NULL; i++)
+ {
+ for (j = 0; chanserv_commands[i].command[j] != NULL; j++)
+ {
+ if (strcmp (cmd, chanserv_commands[i].command[j]) == 0)
{
-#ifdef REQ_ACCESS_DEL
- if (check_access (userhost, target, 0, source) >= 1)
+ for (k = 0; exempt_items[k] != NULL; k++)
{
-#endif
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- S ("PRIVMSG %s :%s what, %s?\n", target, s, source);
- return;
- }
- if (strlen (s2) > MAX_TOPIC_SIZE)
- s2[MAX_TOPIC_SIZE] = '\0';
-#ifdef LOG_ADD_DELETES
- db_log (ADD_DELETES, "[%s] %s!%s DEL %s\n", date (), source, userhost, s2);
-#endif
- if (*s2 == '~')
- { /* need level 2 to delete .rdb files */
- if (check_access (userhost, target, 0, source) >= 2)
+ if (strcmp (chanserv_commands[i].command[j], exempt_items[k]) == 0)
{
- delete_url (source, s2, target);
+ strlwr(cmd);
+ return 1;
}
- return;
- }
- delete_url (source, s2, target);
-#ifdef REQ_ACCESS_DEL
- }
-#endif
- }
- else if (stricmp (s, "TELL") == 0)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- L085 (target, source);
- return;
- }
- s3 = strtok (NULL, " ");
- if (s3 == NULL)
- {
- L083 (target, source, s2);
- return;
- }
- if (stricmp (s3, Mynick) == 0)
- return; /* don't bother telling
- * myself about stuff */
- if (stricmp (s3, "ABOUT") == 0)
- {
- s4 = strtok (NULL, " ");
- if (s4 == NULL)
- {
- L084 (target, source, s2);
- return;
- }
- strlwr (s4);
- show_url (s2, get_multiword_topic (s4), target, 1, 0, userhost, 1);
- }
- else
- {
- strlwr (s3);
- show_url (s2, get_multiword_topic (s3), target, 1, 0, userhost, 1);
- }
- }
- else if (stricmp (s, "WHISPER") == 0)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- L085 (target, source);
- return;
- }
- s3 = strtok (NULL, " ");
- if (s3 == NULL)
- {
- L083 (target, source, s2);
- return;
- }
- if (stricmp (s3, Mynick) == 0)
- return; /* don't bother telling
- * myself about stuff */
- if (stricmp (s3, "ABOUT") == 0)
- {
- s4 = strtok (NULL, " ");
- if (s4 == NULL)
- {
- L084 (target, source, s2);
- return;
- }
- strlwr (s4);
- show_url (source, get_multiword_topic (s4), s2, 1, 0, userhost, 1);
- }
- else
- {
- strlwr (s3);
- show_url (source, get_multiword_topic (s3), s2, 1, 0, userhost, 1);
- }
- }
- else if (stricmp (s, "WHERE") == 0
- || stricmp (s, "WHO") == 0 || stricmp (s, "WHAT") == 0)
- {
- s2 = strtok (NULL, " ");
- if (s2 == NULL)
- {
- L086 (target, source);
- return;
- }
- s3 = strtok (NULL, " ");
- if (s3 == NULL)
- return;
- strlwr (s3);
- ptr3 = strchr (s3, '?');
- if (ptr3 != NULL)
- memmove (ptr3, ptr3 + 1, strlen (ptr3 + 1) + 1);
- ptr3 = strchr (s3, '!');
- if (ptr3 != NULL)
- memmove (ptr3, ptr3 + 1, strlen (ptr3 + 1) + 1);
- if (stricmp (s3, "A") == 0 || stricmp (s3, "AN") == 0)
- {
- s4 = strtok (NULL, " ");
- if (s4 == NULL)
- {
- L087 (target, s, s2, s3, *CMDCHAR);
- return;
- }
- show_url (source, get_multiword_topic (s4), target, 1, 0, userhost, 0);
}
- else
- show_url (source, get_multiword_topic (s3), target, 1, 0, userhost, 0);
}
- else
- show_url (source, get_multiword_topic (s), target, 1, 0, userhost, 0);
}
-#if RANDOM_WHUT == 1
- else
- {
- do_randomtopic (WHUTR, target, WHUT_FILE, source, s);
- }
-#else
- else
- S ("PRIVMSG %s :%s\n", target, WHUT);
-#endif
-
-#if GENERAL_QUESTIONS == 1
- }
- else
- {
- if (Sleep_Toggle == 1)
- return;
- show_url (source, get_multiword_topic (cmd), target, 0, 1, userhost, 0);
-#endif
- i = 0;
}
+
+ strlwr(cmd);
+ return 0;
}
+
diff --git a/source/comm.c b/source/comm.c
index 1f46dd6..5bd4f66 100755
--- a/source/comm.c
+++ b/source/comm.c
@@ -1,454 +1,451 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
/**
* Delete one or more elements from the sendq
* 1 = delete all pri/not's
* 0 = delete first in queue
* 6/23/00 Dan
* - Updated to use head and tail pointer queue
* - All variables now initialized when declared
* - Optimized the main while loop a bit, reduced amount of code
*/
void
del_sendq (long toggle)
{
struct sendq *pNode = sendqhead, *pPrev = 0;
if (NULL == sendqhead)
{
return;
}
if (toggle == 0)
{
/* Just delete the head */
pNode = sendqhead;
sendqhead = sendqhead->next;
free (pNode);
}
else
{
/* Iterate through the queue and delete each element which is
* a PRIVMSG or NOTICE
*/
for (; pNode != NULL; pPrev = pNode, pNode = pNode->next)
{
if (0 == strncmp (pNode->data, "PRI", 3) || 0 == strncmp (pNode->data, "NOT", 3))
{
/* Found one, let's delete it */
if (pPrev != NULL)
{
pPrev->next = pNode->next;
}
else
{
sendqhead = pNode->next;
}
free (pNode);
pNode = NULL;
break;
}
} /* for */
} /* else */
/* Update the tail pointer if needed */
if (NULL == sendqhead)
{
sendqtail = NULL;
}
}
int
get_sendq_count (long toggle)
{
struct sendq *c;
long i = 0, x = 0;
c = sendqhead;
while (c != NULL)
{
i++;
if (c->data[0] == 'P' && c->data[1] == 'R' && c->data[2] == 'I')
x++;
else if (c->data[0] == 'N' && c->data[1] == 'O' && c->data[2] == 'T')
x++;
c = c->next;
}
if (toggle == 1)
clear_sendq (i, 1);
if (toggle == 2)
return i;
if (i < OUTPUT1_COUNT)
SEND_DELAY = OUTPUT1_DELAY;
else if (i < OUTPUT2_COUNT)
SEND_DELAY = OUTPUT2_DELAY;
else
SEND_DELAY = OUTPUT3_DELAY;
if (x > OUTPUT_PURGE_COUNT)
clear_sendq (x, 0);
return i;
}
void
clear_sendq (long count, long toggle)
{
long i = 0;
i = count;
while (i > 1)
{
i--;
del_sendq (1);
}
send_tog = 1;
if (toggle != 1)
L090 (CHAN, count);
}
long
setinfo_lastcomm (char *rest)
{ /* Disallows joins to more than one channel (or the same chan)
* to artifically raise join counters */
long c_uptime = 0;
- if (stricmp (rest, slc1) == 0)
+ if (strcasecmp (rest, slc1) == 0)
return 1; /* don't reply if already asked in LASTCOMM_TIME sec */
- if (stricmp (rest, slc2) == 0)
+ if (strcasecmp (rest, slc2) == 0)
return 1;
- if (stricmp (rest, slc3) == 0)
+ if (strcasecmp (rest, slc3) == 0)
return 1;
- if (stricmp (rest, slc4) == 0)
+ if (strcasecmp (rest, slc4) == 0)
return 1;
if (*slc1 == '0')
{ /* init lastcomms */
strncpy (slc1, rest, sizeof (slc1));
slcn1 = time (NULL);
}
if (*slc2 == '0')
{
strncpy (slc2, rest, sizeof (slc2));
slcn2 = time (NULL);
}
if (*slc3 == '0')
{
strncpy (slc3, rest, sizeof (slc3));
slcn3 = time (NULL);
}
if (*slc4 == '0')
{
strncpy (slc4, rest, sizeof (slc4));
slcn4 = time (NULL);
}
if ((c_uptime = time (NULL) - slcn1) > SLASTCOMM_TIME)
{ /* reinit old data */
slcn1 = 0;
*slc1 = '0';
}
if ((c_uptime = time (NULL) - slcn2) > SLASTCOMM_TIME)
{
slcn2 = 0;
*slc2 = '0';
}
if ((c_uptime = time (NULL) - slcn3) > SLASTCOMM_TIME)
{
slcn3 = 0;
*slc3 = '0';
}
if ((c_uptime = time (NULL) - slcn4) > SLASTCOMM_TIME)
{
slcn4 = 0;
*slc4 = '0';
}
strncpy (slc4, slc3, sizeof (slc4)); /* no matches, move em on
down */
strncpy (slc3, slc2, sizeof (slc3));
strncpy (slc2, slc1, sizeof (slc2));
strncpy (slc1, rest, sizeof (slc1));
slcn4 = slcn3;
slcn3 = slcn2;
slcn2 = slcn1;
slcn1 = time (NULL);
return 0;
}
long
do_lastcomm (char *nick, char *target, char *rest)
{
long c_uptime = 0;
- if (stricmp (rest, lc1) == 0)
+ if (strcasecmp (rest, lc1) == 0)
return 1; /* don't reply if already asked in LASTCOMM_TIME sec */
- if (stricmp (rest, lc2) == 0)
+ if (strcasecmp (rest, lc2) == 0)
return 1;
- if (stricmp (rest, lc3) == 0)
+ if (strcasecmp (rest, lc3) == 0)
return 1;
- if (stricmp (rest, lc4) == 0)
+ if (strcasecmp (rest, lc4) == 0)
return 1;
if (*lc1 == '0')
{ /* init lastcomms */
strncpy (lc1, rest, sizeof (lc1));
lcn1 = time (NULL);
}
if (*lc2 == '0')
{
strncpy (lc2, rest, sizeof (lc2));
lcn2 = time (NULL);
}
if (*lc3 == '0')
{
strncpy (lc3, rest, sizeof (lc3));
lcn3 = time (NULL);
}
if (*lc4 == '0')
{
strncpy (lc4, rest, sizeof (lc4));
lcn4 = time (NULL);
}
if ((c_uptime = time (NULL) - lcn1) > LASTCOMM_TIME)
{ /* reinit old data */
lcn1 = 0;
*lc1 = '0';
}
if ((c_uptime = time (NULL) - lcn2) > LASTCOMM_TIME)
{
lcn2 = 0;
*lc2 = '0';
}
if ((c_uptime = time (NULL) - lcn3) > LASTCOMM_TIME)
{
lcn3 = 0;
*lc3 = '0';
}
if ((c_uptime = time (NULL) - lcn4) > LASTCOMM_TIME)
{
lcn4 = 0;
*lc4 = '0';
}
strncpy (lc4, lc3, sizeof (lc4)); /* no matches, move em on
down */
strncpy (lc3, lc2, sizeof (lc3));
strncpy (lc2, lc1, sizeof (lc2));
strncpy (lc1, rest, sizeof (lc1));
lcn4 = lcn3;
lcn3 = lcn2;
lcn2 = lcn1;
lcn1 = time (NULL);
return 0;
}
void
prepare_bot (void)
{
int esc = 0;
while (!esc)
{
gs26 ();
- printf (".: Connecting to %s:%ld \r", BS, BP);
+ printf (".: Connecting to %s:%ld\t\r", BS, BP);
fflush (stdout);
- sleep (2);
+ db_sleep (2);
socketfd = create_connection (BS, VHOST, BP);
switch (socketfd)
{
case ERR_TIMED_OUT:
- printf (".: Connection to %s:%ld timed out! \r", BS, BP);
+ printf (".: Connection to %s:%ld timed out!\t\r", BS, BP);
fflush (stdout);
- sleep (2);
+ db_sleep (2);
break;
case ERR_CONN_REFUSED:
- printf (".: Connection to %s:%ld was refused! \r", BS, BP);
+ printf (".: Connection to %s:%ld was refused!\t\r", BS, BP);
fflush (stdout);
- sleep (2);
+ db_sleep (2);
break;
case ERR_NOT_ADDR:
printf ("Address not in range!\n");
exit (1);
case ERR_NO_REACH:
printf ("Address not reachable!\n");
exit (1);
default:
esc = 1;
printf
- (".: Connected to %s:%ld! [%ld] \r", BS, BP, (long) getpid ());
+ (".: Connected to %s:%ld! [%ld]\t\n", BS, BP, (long) getpid ());
- sleep (5);
fflush (stdout);
+ db_sleep (5);
break;
}
}
/* set the socket to BLOCK */
if (fcntl (socketfd, F_SETFL, 0) < 0)
{
printf ("\n");
perror ("fcntl");
exit (EXIT_FAILURE);
}
}
int
create_connection (char *server, char *virtualhost, long port)
{
struct sockaddr_in name;
struct hostent *hostname;
struct timeval timeout;
fd_set set;
int sock = 0, vhost = 1, sockerr = 0,
optlen = sizeof (sockerr);
if ((!virtualhost) || (strlen (virtualhost) < 1))
vhost = 0;
if ((sock = socket (AF_INET, SOCK_STREAM, 0)) < 0)
return -1;
memset (&name, 0, sizeof (struct sockaddr_in));
setsockopt (sock, SOL_SOCKET, SO_LINGER, 0, 0);
setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, 0, 0);
setsockopt (sock, SOL_SOCKET, SO_KEEPALIVE, 0, 0);
name.sin_family = AF_INET;
name.sin_addr.s_addr = (vhost ? inet_addr (virtualhost) : INADDR_ANY);
if ((name.sin_addr.s_addr == -1) && vhost)
{
hostname = gethostbyname (virtualhost);
if (hostname)
{
name.sin_addr = *(struct in_addr *) hostname->h_addr;
}
else
{
name.sin_addr.s_addr = INADDR_ANY;
}
}
if (bind (sock, (struct sockaddr *) &name, sizeof (struct sockaddr_in)) < 0)
{
printf ("\n");
perror ("bind");
close (sock);
exit (EXIT_FAILURE);
}
memset (&name, 0, sizeof (struct sockaddr_in));
name.sin_family = AF_INET;
name.sin_port = htons (port);
if(!(hostname = gethostbyname (server)))
{
- printf ("\n");
- herror ("hostname");
+ printf ("\nCan't create the connection!\n");
+ // FIXME: This is obsolete, and solaris doesn't know about it.
+// herror ("hostname");
exit (EXIT_FAILURE);
}
name.sin_addr = *(struct in_addr *) hostname->h_addr;
/* set the file descriptor to non blocking mode so that connect()
returns immediately.
*/
if (fcntl (sock, F_SETFL, O_NONBLOCK) < 0)
{
- if ((errno != EINPROGRESS) && (errno != ENOENT))
- {
- printf ("\n");
- perror ("fcntl");
- exit (EXIT_FAILURE);
- }
+ printf ("\n");
+ perror ("fcntl");
+ exit (EXIT_FAILURE);
}
-
if (connect (sock, (struct sockaddr *) &name, sizeof (name)) < 0)
{
if ((errno != EINPROGRESS) && (errno != ENOENT))
{
printf ("\n");
perror ("connect");
exit (EXIT_FAILURE);
}
}
alarm (0);
while (1)
{
/* set the timeout */
timeout.tv_sec = CONNECT_WAIT_TIMEOUT;
timeout.tv_usec = 0;
/* set the file descriptor to be empty */
FD_ZERO (&set);
/* add our socket to the file descriptor set */
FD_SET (sock, &set);
/* select will let us know when our socket is ready (connected) */
- switch (select (FD_SETSIZE, (fd_set *) 0, &set, (fd_set *) 0, &timeout))
+ switch (select (FD_SETSIZE, (fd_set *) NULL, &set, (fd_set *) NULL, &timeout))
{
/* if select returns 0, our timeout was reached */
case 0:
alarm (AIL);
return ERR_TIMED_OUT;
/* -1 means we are not connected */
case -1:
break;
/* we MIGHT be connected */
default:
/* get the socket errno so we can check if we are connected */
switch (getsockopt (sock, SOL_SOCKET, SO_ERROR, &sockerr, &optlen))
{
case -1:
alarm (AIL);
return ERR_SOCK_OPT;
case 0:
switch (sockerr)
{
case ECONNREFUSED:
alarm (AIL);
return ERR_CONN_REFUSED;
case EADDRNOTAVAIL:
alarm (AIL);
return ERR_NOT_ADDR;
case ENETUNREACH:
alarm (AIL);
return ERR_NO_REACH;
case SUCCESS:
alarm (AIL);
return sock;
}
}
}
}
}
void
register_bot (void)
{
get_sendq_count (1);
Snow ("NICK %s\n", Mynick);
strlwr (UID);
Snow ("USER %s %d %d :%s \2%d\2\n", UID, time (NULL), time (NULL), REALNAME, NUM_HELPER);
if (BPASS != NULL)
Snow ("PASS :%s\n", BPASS);
}
diff --git a/beta/source/compat/crypt.c b/source/compat/crypt.c
similarity index 100%
rename from beta/source/compat/crypt.c
rename to source/compat/crypt.c
diff --git a/beta/source/compat/dummy.c b/source/compat/dummy.c
similarity index 100%
rename from beta/source/compat/dummy.c
rename to source/compat/dummy.c
diff --git a/beta/source/compat/lstat.c b/source/compat/lstat.c
similarity index 100%
rename from beta/source/compat/lstat.c
rename to source/compat/lstat.c
diff --git a/beta/source/compat/malloc.c b/source/compat/malloc.c
similarity index 100%
rename from beta/source/compat/malloc.c
rename to source/compat/malloc.c
diff --git a/beta/source/compat/memset.c b/source/compat/memset.c
similarity index 100%
rename from beta/source/compat/memset.c
rename to source/compat/memset.c
diff --git a/beta/source/compat/minmax.h b/source/compat/minmax.h
similarity index 100%
rename from beta/source/compat/minmax.h
rename to source/compat/minmax.h
diff --git a/beta/source/compat/nanosleep.c b/source/compat/nanosleep.c
similarity index 100%
rename from beta/source/compat/nanosleep.c
rename to source/compat/nanosleep.c
diff --git a/beta/source/compat/realloc.c b/source/compat/realloc.c
similarity index 100%
rename from beta/source/compat/realloc.c
rename to source/compat/realloc.c
diff --git a/beta/source/compat/snprintf.c b/source/compat/snprintf.c
similarity index 100%
rename from beta/source/compat/snprintf.c
rename to source/compat/snprintf.c
diff --git a/beta/source/compat/stat-macros.h b/source/compat/stat-macros.h
similarity index 100%
rename from beta/source/compat/stat-macros.h
rename to source/compat/stat-macros.h
diff --git a/beta/source/compat/stat.c b/source/compat/stat.c
similarity index 100%
rename from beta/source/compat/stat.c
rename to source/compat/stat.c
diff --git a/beta/source/compat/strcasecmp.c b/source/compat/strcasecmp.c
similarity index 100%
rename from beta/source/compat/strcasecmp.c
rename to source/compat/strcasecmp.c
diff --git a/beta/source/compat/strcasestr.c b/source/compat/strcasestr.c
similarity index 100%
rename from beta/source/compat/strcasestr.c
rename to source/compat/strcasestr.c
diff --git a/beta/source/compat/strndup.c b/source/compat/strndup.c
similarity index 100%
rename from beta/source/compat/strndup.c
rename to source/compat/strndup.c
diff --git a/beta/source/compat/strspn.c b/source/compat/strspn.c
similarity index 100%
rename from beta/source/compat/strspn.c
rename to source/compat/strspn.c
diff --git a/beta/source/compat/strstr.c b/source/compat/strstr.c
similarity index 100%
rename from beta/source/compat/strstr.c
rename to source/compat/strstr.c
diff --git a/beta/source/compat/timespec.h b/source/compat/timespec.h
similarity index 100%
rename from beta/source/compat/timespec.h
rename to source/compat/timespec.h
diff --git a/beta/source/compat/vfprintf.c b/source/compat/vfprintf.c
similarity index 100%
rename from beta/source/compat/vfprintf.c
rename to source/compat/vfprintf.c
diff --git a/beta/source/compat/vsprintf.c b/source/compat/vsprintf.c
similarity index 100%
rename from beta/source/compat/vsprintf.c
rename to source/compat/vsprintf.c
diff --git a/beta/source/configure.ac b/source/configure.ac
similarity index 100%
rename from beta/source/configure.ac
rename to source/configure.ac
diff --git a/source/convertdb.c b/source/convertdb.c
index 9938101..0e3ca10 100755
--- a/source/convertdb.c
+++ b/source/convertdb.c
@@ -1,92 +1,106 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-// If you are compiling this on a non cygwin environment it's bin should
-// be placed on scripts directory and being so userlist relative path
-// should be "../dat/userlist.db" and "../dat/temp.db".
-// Under cygwin the executable should be placed on Darkbot's root dir
-// due to the necessity of cygwin dynamic library.
-// So... comment next 2 defines and uncomment the following 2 if you are
-// not compiling convertdb with cygwin. Also change what is commented
-// on "dat/userlist.db dat/backup.db" a couple lines bellow.
-// There is already a compiled bin on /scripts for unixes
-#define USERFILE "dat/userlist.db"
-#define TMPFILE "dat/temp.db"
-// #define USERFILE "../dat/userlist.db"
-// #define TMPFILE "../dat/temp.db"
-
+#include "defines.h"
+#define STRING_SHORT 512
+char DAT_DIR[STRING_SHORT] = { 0 };
-char *crypt (const char *key, const char *salt);
+// FIXME: This may not be compatible with putting all exes into $prefix/bin.
+// Under cygwin the executable should be placed on Darkbot's root dir
+// due to the necessity of cygwin dynamic library.
-int main(int argc, char *argv[]){ FILE *in, *out;
+int main(int argc, char *argv[])
+{
+ FILE *in, *out;
char *ptr = NULL;
- char *salt = "8fei3k";
+ const char *salt = "8fei3k";
+ char userlist[STRING_SHORT] = { 0 };
+ char tempfile[STRING_SHORT] = { 0 };
+ char temp[STRING_SHORT] = { 0 };
char channel[1024] = { 0 };
char uh[1024] = { 0 };
char level[10] = { 0 };
char joins[10] = { 0 };
char pass[1024] = { 0 };
char setinfo[1024] = { 0 };
+ struct stat st;
printf("\nDarkbot USERLIST.DB < 7f0 conversion utility.\n");
printf("IMPORTANT :: READ THIS!\n\n");
printf("This UTILITY is for converting *OLD* (pre 7f0) userlist's\n");
printf("to the new encrypted format.\n\n");
printf("Use this utility ONLY if:\n");
printf(" - You have copied your pre 7f0 userlist.db in to the dat directory\n\n");
printf("DO NOT use this utility if:\n");
printf(" - You have created a brand new darkbot, and have no users\n\n");
if(argc < 2)
{
printf("Syntax: %s -convert\n\n", argv[0]);
return 0;
}
if(argc > 1)
{
if(strcmp(argv[1], "-convert") != 0)
{
printf("Syntax: %s -convert\n\n", argv[0]);
return 0;
}
}
- printf("Converting ...\n");
+#ifdef DATABASEDIR
+ strncpy (DAT_DIR, DATABASEDIR, sizeof (DAT_DIR));
+#else
+ strncpy (DAT_DIR, "dat", sizeof (DAT_DIR));
+#endif
+#ifdef SOURCEDIR
+ /* Check if this is being run from the build directory before being installed. */
+ snprintf(temp, sizeof(temp), "%s/dat/setup.ini", SOURCEDIR);
+ if (stat(temp, &st) >= 0)
+ {
+ snprintf(temp, sizeof(temp), "%s/dat", SOURCEDIR);
+ strncpy(DAT_DIR, temp, sizeof (DAT_DIR));
+ }
+#endif
- if((in = fopen(USERFILE, "r")) == NULL)
+ snprintf(userlist, sizeof(userlist), "%s/userlist.db", DAT_DIR);
+ snprintf(tempfile, sizeof(tempfile), "%s/temp.db", DAT_DIR);
+
+ printf("Converting %s ...\n", userlist);
+
+ if((in = fopen(userlist, "r")) == NULL)
{
- printf("\nCan't open %s for reading!\n", USERFILE);
+ printf("\nCan't open %s for reading!\n", userlist);
return EXIT_FAILURE;
- } if((out = fopen(TMPFILE, "wt")) == NULL)
+ } if((out = fopen(tempfile, "wt")) == NULL)
{
- printf("\nCan't open %s for writing!\n", TMPFILE);
+ printf("\nCan't open %s for writing!\n", tempfile);
return EXIT_FAILURE;
}
-// Comment next line and uncomment the following one if you are
-// not compiling convertdb with cygwin.
- system("cp dat/userlist.db dat/backup.db"); while(!feof(in))
-// system("cp ../dat/userlist.db ../dat/backup.db"); while(!feof(in))
+ snprintf(temp, sizeof(temp), "cp %s %s/backup.db", userlist, DAT_DIR);
+ system(temp);
+ while(!feof(in))
{
fscanf(in, "%s %s %s %s %s %[^\n]s", channel, uh, level, joins, pass, setinfo);
- if ((ptr = crypt (pass, salt)) == NULL)
+#ifdef ENABLE_ENCRYPT
+ if ((ptr = crypt(pass, salt)) == NULL)
{
printf("\ncrypt() error\n");
return EXIT_FAILURE;
}
+#endif
if(!feof(in))
fprintf(out, "%s %s %s %s %s %s\n", channel, uh, level, joins, ptr, setinfo);
}
fclose(in);
fclose(out);
- remove(USERFILE);
- rename(TMPFILE, USERFILE);
+ remove(userlist);
+ rename(tempfile, userlist);
printf("Conversion Complete.\n");
-
- return EXIT_SUCCESS;}
+
+ return EXIT_SUCCESS;
+}
diff --git a/source/defines.h b/source/defines.h
index 6c90cc6..7f8a607 100755
--- a/source/defines.h
+++ b/source/defines.h
@@ -1,824 +1,344 @@
+/* @configure_input@ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
/* defines.h
- *** Darkbot (c) 2004
+ *** Darkbot (c) 2002
* The Internet Relay Chat Talking Robot
*
*** Darkbot Creator - Jason Hamilton (play) Jason@superlink.net
* Project Administrator - LuizCB (Pincel) LuizCB@darkbot.info
* Recent Code Modifications - Ron (`ron) ron@freezedown.org
*
* Official Sites: http://www.freezedown.org
* http://darkbot.sourceforge.net
*
*** For any questions, suggestions, malfunctions, etc
* Use our support forum at http://forum.freezedown.org
*
* *******************************---******************************* */
/*
*** NOTES - READ before you start:
*** Lines beginning by # (hash) are peprocessor directives, they are not
* comments. You should NOT remove them.
*** #defines should only be changed to ON, OFF, #define, #undef
* or it's value defined on the very right end.
*** Areas between " " are messages Darkbot will send. Do not remove " ".
*** Double slash characters on de beginning of a line or slaches followed
* or preceded by * on the beginning and end of lines envolving some
* portion of text are comment characters combinations with help
* information for the delelopers or users. They do not have any effect
* in the behavior of the program.
*
,-----------------------------------------------------------------,
| Note that the defines bellow are the RECOMMENDED settings! |
| Modify it by changing it's values of the data. This file will |
| instruct the compiler to build the executable file. If you're |
| not sure of what to do, leave the default settings alone :) |
`-----------------------------------------------------------------' */
-// ================ SYSTEM REQUIREMENTS ================
+#define ON 1
+#define OFF 0
+
+
+/* ================ SYSTEM REQUIREMENTS ================ */
/*
* Change the Ansi C signal handling below if it's not in the standard place,
* usually on include/. Leave it as is if you don't know what that is. Type
* 'man signal' on your unix box for more info.
* (default = <signal.h>)
*/
-#include <signal.h>
-
-/*
- * If you are getting errors during compilation about clock_t
- * and clocks_per_sec not being available, turn this option ON.
- * This includes <time.h> in addition to <sys/time.h>.
- * (default = OFF)
- */
-#define NEED_CLOCK_T OFF
+//#include <signal.h>
/*
- * If your compiler does not support snprintf() turn this
- * option ON. (default = OFF)
- */
-#define SNPRINTF_SUPPORT OFF
-
-/*
- * If you have an OS like Linux, you -may- need this ON.
* Most BSD systems will not need this. If your bot will
* connect but don't react at all try turning this ON.
* (default = OFF)
*/
-#define NEED_LIBC5 OFF
+
+//#define NEED_LIBC5 OFF
/*
* SGI boxes (ie; IRIX system) need this
* define to run. (default = OFF)
*/
-#define SGI OFF
-
-// ================ LANGUAGE ================
-/*
- * Pick a number from the list below for the language you
- * want your darkbot to speak. Default is 1, English.
- * ------------------------------------------------------------------
- * 1 = ENGLISH - play <jason@superlink.net>
- * 2 = FRENCH - Inajira <inajira@videotron.ca>
- * - EfX <michel.efx@globetrotter.net>
- * - eCHaLoTTe <echalotte@cablevision.qc.ca>
- * 3 = SPANISH - speed1 <speed@eduredes.edu.do>
- * 4 = DUTCH - Asmodai <asmodai@wxs.nl>
- * 5 = LATIN - Otaku <otaku@unixgeek.ml.org>
- * 6 = GREEK - Chris_CY <chriscy@cylink.net>
- * 7 = EBONICS - rapsux <bitter@ici.net>
- * 8 = PIG LATIN- Cloud <burtner@usa.net>
- * 9 = RUSSIAN - KOI8 encoding
- * 10= RUSSIAN - CP1251 encoding
- * - Oleg Drokin <green@ccssu.crimea.ua>
- * 11= PORTUGUESE- Pincel <Pincel@darkbot.info>
- * 12= GERMAN - C.Hoegl@gmx.net & marc@reymann.net
- * 13= ITALIAN - daniele nicolucci <jollino@icemail.it>
- * 14= CHINESE - James <jamespower@263.net>
- * 15= SWEDISH - Ybznek <sunmo@seaside.se>
- * 16= NORWEGIAN- [SoHo] <soho@int19h.com>
- * 17= ROMANIAN - Radu <radu.negoescu@sante.univ-nantes.fr>
- * 18= ARABIC - MrSiMo <mrsimo7@yahoo.fr>
- * 19= TAIWANISH- ?
- * ------------------------------------------------------------------
- * ? = Email juice@freezedown.org if you want to help add other langs!
- * ------------------------------------------------------------------
- */
-#define LANG 1
-
-// ================ STARTUP, CONNECTION, IRC ================
-
-// ==== ON START ====
-/*
- * Your darkbot tell you (at startup) what the latest version of
- * darkbot is. If you DO NOT WANT THIS, then define this. We recommend
- * keeping this defined.
- */
-#define DISALLOW_COUNT
-
-// ==== ON CONNECTION ====
-/*
- * Print out extra details while starting up?
- */
-#define VERB
-
-/*
- * Check if servers are not responding, is so
- * connect to next server in list. (recommended)
- * Some linux systems have problems with this.
- * You'll know if you're one of them if your bot
- * disconnects every 5 minutes.
- *
- * ALSO NOTE: If your bot seems to disconnect every 5 minutes, try
- * turning off the CHECK_STONED code.
- */
-#define CHECK_STONED ON
-
-/*
- * This is the time that darkbot will wait for a connection
- * to the server, before trying the next server. You may need
- * to increase this if you are on a slow connection.
- */
-#define CONNECT_WAIT_TIMEOUT 10
-
-// ==== ON CONNECTED - IRC ====
-/*
- * Send everything that's in PERFORM.INI
- * to the IRC server every 60 seconds?
- * Useful if the bot is banned, or X was
- * split at the time darkbot signed on.
- */
-#define PERFORM_TIMER ON
-
-/*
- * What user modes do you want for darkbot?
- */
-#define DEFAULT_UMODE "+i-ds"
-
-// ==== ON IRC ====
-/*
- * Reply to CTCP's? (PING/VERSION).
- */
-#define CTCP ON
-
-/*
- * Want your darkbot to always have less than
- * 10 min idle? This isn't usually needed since
- * darkbots tend to talk a lot. (default = undef)
- */
-#undef ANTI_IDLE
-
-// ==== ONJOIN ====
-/*
- * When bot joins a channel, sometimes it's hard
- * to tell when it's "synced" and is no longer processing
- * stuff -- this tells the channel the bot has finished
- * syncing. For example, if you try to login while it's
- * still syncing, it may just ignore your login request
- * until it sees you in the channel. (default = OFF)
- */
-#define DISPLAY_SYNC OFF
-
-// ================ DATABASE MANAGEMENT ================
-
-// ==== ON START ====
-/*
- * Sort your info2.db on startup? Will take
- * forever if u have a large db. If you have dividers or
- * any sort of markers on your database and you want to
- * preserve their position leave this directive undefined.
- * Sorting the database will put all items listed in
- * alphabetic order. (default = undef)
- */
-#undef SORT
-
-/*
- * When user's do the INFO command, and at
- * startup, do you want to find and remove
- * duplicates database entries? (default = undef)
- */
-#undef FIND_DUPS
-
-/*
- * When duplicate topics are found, do you
- * want to save them? (in case some topics
- * are accidently deleted) (default = define)
- */
-#define SAVE_DUPS
-
-// ==== PERMISSIONS ====
-/*
- * Do you want Darkbot to answer questions that match a topic
- * without addressing the bot? (default = ON)
- */
-#define GENERAL_QUESTIONS ON
-
-/*
- * Turn this ON if you want to be able to use the ADD function
- * in private message to the bot. (default = OFF)
- */
-#define ALLOW_ADD_IN_MSG OFF
-
-/*
- * Turn this ON if you want to be able to use the DEL function
- * in private message to the bot. (default = OFF)
- */
-#define ALLOW_DEL_IN_MSG OFF
-
-/*
- * If you want your bot to be able to respond to things asked
- * in private messages, turn this option ON. Use the above two
- * defines to allow/disallow adding or deleting entries in private.
- * (default = OFF)
- */
-#define MSG_RESPONSES OFF
-
-/*
- * Toggles the use of encrypted passwords in the userlist.db file.
- * Turn this off if you don't want your passwords encrypted. Also
- * note that if you're using encrypted passwords and you decide to
- * turn this option off, you'll need to redo your userlist.db file.
- * Note: If you're new to Darkbot, you may want to turn this option OFF.
- */
-#define ENCRYPT_PASSWORDS OFF
-
-/*
- * Minimal access level required to add
- * topics? (default = define)
- */
-#define REQ_ACCESS_ADD
-
-/*
- * Minimal access level required to to delete
- * topics? (default = define)
- */
-#define REQ_ACCESS_DEL
+//#define SGI OFF
-// ==== LOGS ====
-/*
- * Do you want to log who adds/deletes topics? Log saved
- * to dat/logs/add_delete.log (default = define)
- */
-#define LOG_ADD_DELETES
-
-/*
- * Do you want to log all privmsg's to your
- * darkbot? (will be saved to dat/logs/ dir)
- * (default = ON)
- */
-#define LOG_PRIVMSG ON
-
-// ==== SLEEP DIRECTIVES ====
-/*
- * Level at which user's can make darkbot shut up
- * (aka hush). This is useful for help channels when
- * they want darkbot to quit talking while they address
- * something important in the chan (default = 3)
- */
-#define SLEEP_LEVEL 3
-
-/*
- * How many seconds to sleep for? (default = 300 (5 minutes))
- */
-#define SLEEP_TIME 300
-
-/*
- * What you would want your Darkbot to say when sleep and
- * wake up commands are issued? (If you want you can change
- * what is between 'ACTION' and '\1')
- */
-#define GOSLEEP_ACTION "\1ACTION falls asleep... ZzzZZzzZZzz\1"
-#define WAKEUP_ACTION "\1ACTION wakes up from a snooze..\1"
-
-// ==== DATA SIZE ====
-/*
- * The max length your database replies will be. This will be useful
- * to people loading their database into ram - if your data is all
- * less than 400 chars, then you can save some ram.... Longer replies
- * allows you to do more, for example, with bitwise operator PIPE
- * (default = 400)
- */
-#define MAX_DATA_SIZE 400
-
-/*
- * The max length your database topics will be. (default = 50)
- */
-#define MAX_TOPIC_SIZE 50
-
-// ==== OUTPUTS - TIMERS ====
-/*
- * LASTCOMM_TIME is the length of time (in seconds)
- * that your bot will not reply to a topic already
- * asked. Thus if someone asked your bot about "mirc"
- * that question could not be asked again in the
- * same format for N seconds (or till the question
- * is out of buffer). This prevents the bot from
- * falling prey to users who like to repeat.
- * (default = 5)
- */
-#define LASTCOMM_TIME 5
-
-/*
- * BELOW is the output timers. Darkbot does not
- * output text without first putting it into a
- * que list. If the bot has several lines of text
- * waiting to be sent, it starts to delay longer
- * and longer between output, so it can't flood
- * itself off of IRC. Explanation:
- *
- * If text in que is < OUTPUT1_COUNT, output it.
- * If text in que is > OUTPUT1_COUNT, delay
- * OUTPUT1_DELAY seconds. If que is > OUTPUT2_COUNT,
- * delay OUTPUT2_DELAY seconds. If number of text
- * in que is higher than OUTPUT_PURGE_COUNT, then
- * just delete all unneeded output (ie; any text
- * and notices, but leaving in stuff like kicks
- * and modes) The defaults below are recommended,
- * as the bot isn't going to flood off. If you are
- * having the bot delete output messages and you'd
- * like to increase the que, update the
- * OUTPUT_PURGE_COUNT to a larger number. Just keep
- * in mind if someone floods your bot with a lot of
- * VERSION requests, the bot will sit there outputting
- * a lot of version replies instead of deleting them,
- * causing it to act as if it's just sitting there not
- * doing anything when you ask it something in your
- * channel. (defaults = 4) = 1) = 6) = 2)
- */
-#define OUTPUT1_COUNT 4
-#define OUTPUT1_DELAY 1
-#define OUTPUT2_COUNT 6
-#define OUTPUT2_DELAY 2
-
-/*
- * If still < OUTPUT_PURGE_COUNT and > OUTPUT2_COUNT
- * then delay OUTPUT3_DELAY secs. (default = 3)
- */
-#define OUTPUT3_DELAY 3
-
-/*
- * When all else fails... if more than OUTPUT_PURGE_COUNT
- * delete them all! No use in making the bot output slowly
- * over a long period of time... imagine if you set this to
- * 50, and had an OUTPUT3_DELAY of 3 secs.. thats 50*3 secs
- * till the bot is ready to output any new data to you!
- * (default = 7)
- */
-#define OUTPUT_PURGE_COUNT 7
-
-// ======== OUTPUT MESSAGES ========
-
-// ==== OUTPUT MESSAGES - ON TOPICS ====
-/*
- * Message to give when adding an existent topic
- */
-#define EXISTING_ENTRY "Sorry, there is an existing entry under keyword"
-
-/*
- * Message to give when there is no mentioned topic
- */
-#define NO_ENTRY "I was unable to find entry:"
-
-// ==== OUTPUT MESSAGES - ON SEARCH ====
-/*
- * These are the messages Darkbot will give on unaccomplished
- * search queries. Change the areas between " " with what
- * you want.
- */
-#define CANT_FIND "Was unable to find" /* ... */
-#define NO_TOPIC "Sorry, I don't have any entry for" /* ... */
-#define TRY_FIND "What am I trying to find"
-
-
-// ==== OUTPUT MESSAGES - ON NONEXISTENT TEXT ====
-/*
- * Answer to give in case Darkbot's nick is mentioned
- * without any further text. Do not UNDEF. If you want
- * change only what is between " ". Check next directive.
- */
-#define WHUT "hmmm?"
-
-/*
- * Gives a random response from dat/whut.rdb instead what
- * is specified on 'define WHUT'. (default = ON)
- */
-#define RANDOM_WHUT ON
-
-/*
- * Answer to give in case there is no reply on Darkbot's database
- * Do not UNDEF. If you want change only what is between " ". Check
- * next directive.
- */
-#define DONNO_Q "*shrug*"
-
-/*
- * For those wanting the DONNO_Q response to be random, turn this
- * option ON, and darkbot will ignore the default definition and
- * use a random line from dat/dunno.db
- */
-#define RANDOM_DUNNO ON
-
-/* ======== RANDOM STUFF ========= */
-/*
- * Will read from a random line in dat/randomstuff.ini and say
- * something random in the home channel. ALSO if nothing is said
- * in darkbot's home channel it will say a randomstuff every
- * RAND_IDLE as long as no one says anything. (default = define)
- * UNDEFining this directive will not allow you to add RDBs or
- * randomstuff entries. If you really want your bot not to say
- * anything from randomstuff.ini and keed adding random replies,
- * increase the time _TIME and _IDLE defines to, for example,
- * 54750, which corresponds to 365 days :)
- */
-#define RANDOM_STUFF
-
-/*
- * Time in seconds to randomly say something
- * from randomstuff.ini (default = 3600 (1 hour))
- */
-#define RAND_STUFF_TIME 3600
-
-/*
- * Time in secs to say something in home chan when no
- * one says anything. This overrides the RAND_STUFF_TIME
- * counter. (default = 1800 (30 minutes))
- */
-#define RAND_IDLE 1800
-
-/*
- * Level at which user's can on-line add new
- * randomstuff topics, this also is the level at which
- * users will be able to add RDB topics (default = 2)
- */
-#define RAND_LEVEL 2
-
-/*
- * This is a new feature which enables the RANDQ
- * channel command, which will output a random
- * quote from your randomstuff.ini containing the
- * specified search string. ( default = ON )
- */
-#define RANDQ ON
-
-/*
- * This define backs up your randomstuff file every time
- * you add a random quote, in case you would like to do so.
- * ( default = #undef )
- */
-#undef BACKUP_RANDOMSTUFF
-
-
-// ================ IRC - CHANNEL RELATED ================
-
-// ==== REGISTERED USERS ON JOIN ACTIONS ====
-/*
- * Have the bot do auto-greet (setinfo) to registered users?
- * (default = ON)
- */
-#define JOIN_GREET ON
/*
- * This is the length of time to NOT allow someone to be recounted
- * when they rejoin your channels, which tends to clutter up
- * everyone's screen with the setinfo. This basically keeps track
- * of who joined in the last ___ seconds, and does not do their
- * setinfo during that amount of time. (default = 60 (seconds))
- */
-#define SLASTCOMM_TIME 60
-
-/*
- * Have the bot VOICE users when they join? (default = OFF)
+ * If you change anything on the next 5 directives be careful not to
+ * remove or change the position of '%s' nor anything outside quotes.
*/
-#define VOICE_USERS_ON_JOIN OFF
+#define L100(s,a,b,c,d,e,f) S("NOTICE %s :I can be triggered by various \
+forms of speech, all which must be addressed to me, in one of the \
+following formats: %s %s %s or even %s .... In my database, you can \
+find a topic by saying my nick, <topic> . eg; \37%s nuke\37 ..... \
+to do a search on a word, or partial text, just type: <mynick>, search \
+<text> ... eg; \37%s search nuke\37\n",s,a,b,c,d,e,f)
-/*
- * Have the bot OP users when they login? (default = OFF)
- */
-#define OP_USERS_ON_LOGIN OFF
+#define L101(a,b,c,d) S("NOTICE %s :I can also be triggered with even more \
+human formats: \37%s who is bill gates?\37 .. You can also phrase it \
+in a question: \37%s where is msie?\37 ...For more info \
+about me, visit http://www.freezedown.org\n",a,b,c,d)
-// ==== USERS LOOKOUT ====
-/*
- * Want to be alerted when a user who joins is in "questionable"
- * other channels? This option only works on networks which their
- * IRCD's allows NOTICE to be sent using /notice @#chan
- * (default = OFF)
- */
-#define DO_WHOIS OFF
+#define L102(a,b,c,d) S("NOTICE %s :Welcome to %s, %s. Before \
+asking your question, type %cHELP for a list of help topics.\n", a,b,c,d)
-/*
- * Max length in seconds to keep a lastseen
- * (default = 604800 (7 days))
- */
-#define MAX_LASTSEEN 604800
+/* *******************************---******************************* */
+/* --------------- Don't change anything else below! --------------- */
+/* ***************************************************************** */
-/*
- * If you change the above time (MAX_LASTSEEN), be sure to
- * update the SEEN_REPLY to the respective time length.
- * (Change for what you want between " ")
- */
-#define SEEN_REPLY "in the last 7 days."
-// ==== COMPLAINT MESSAGES ====
-/*
- * Message Darkbot will send to the channel where it was kicked
- * from. (Change for what you want between " ")
- */
-#define COMPLAIN_REASON "grrr, kick me again and I'm going to..."
+//#include <sys/cdefs.h>
+//#include <sys/param.h>
+//#include <pwd.h>
-/*
- * will complain in the chan that the Darkbot is deoped in.
- * (default = OFF)
- */
-#define BITCH_ABOUT_DEOP OFF
-/*
- * What do you want your Darkbot to say when is not
- * oped? (Change for what you want between " ")
- */
-#if BITCH_ABOUT_DEOP == 1
-#define BITCH_DEOP_REASON "grr, someone op me!"
+/* Here we sort out what to do based on some autoconf detected things. */
+#if defined _WIN32 || defined __CYGWIN__ || defined __CYGWIN32__ || defined __MINGW32__
+# ifndef WIN32
+# define WIN32
+# endif
#endif
-// ==== CHAN OP DIRECTIVES ====
-/*
- * Enable this if you want to make your darkbot bloated with
- * stuff like !KICK, !UP, !WACK, etc. Basically anything
- * dealing with channel modes and kicking commands. This
- * includes PERMBANS. On linux, without this, your darkbot
- * bin will shrink considerably. (default = ON)
- */
-#define DO_CHANBOT_CRAP ON
-
-/*
- * Autotopic time interval in seconds
- * (default = 1800 (30 minutes))
- */
-#define AUTOTOPIC_TIME 1800
+#define _GNU_SOURCE 1
-// ==== KICKS AND BANS ====
-
-/*
- * What do you want your Darkbot to say when kicks someone?
- * Note when you apply a kick with reason this setting will
- * not overwrite it. (Change for what you want between " ")
- */
-#define DEFAULT_KICK "Requested!"
+#if HAVE_ANSIDECL_H
+#include <ansidecl.h>
+#endif
+#include <ctype.h>
+#include <limits.h>
+#include <stddef.h>
-/*
- * Kick people out when they are banned?
- */
-#define KICK_ON_BAN OFF
+#if HAVE_ERRNO_H
+# include <errno.h>
+#endif
+#ifndef errno
+extern int errno;
+#endif
-// ==== KICKS AND BANS - FLOODS ====
-/*
- * Sometimes morons like to /notice flood channels.
- * This define will make the bot kick those people
- * when they do a channel notice. (default = ON)
- */
-#define KICK_ON_CHANNEL_NOTICE ON
+#if HAVE_NETDB_H
+# include <netdb.h>
+#endif
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+#include <assert.h>
+#if HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+#ifdef WIN32
+# include <windows.h>
+#endif
-/*
- * If you want to take it a step further, you can also
- * have the bot ban the user@host too. (default = OFF)
- */
-#define BAN_ON_CHANNEL_NOTICE OFF
+#include <signal.h>
+#include <sys/stat.h>
-/*
- * Finally, we can ban by *@host. This requires the
- * above two to be turned on. (default = OFF)
- */
-#define BAN_BY_HOST OFF
+#include <stdio.h> /* The only one we can guarantee. */
+
+#if HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
+# if ! HAVE__BOOL
+# ifdef __cplusplus
+typedef bool _Bool;
+# else
+typedef unsigned char _Bool;
+# endif
+# endif
+# define bool _Bool
+# define false 0
+# define true 1
+# define __bool_true_false_are_defined 1
+#endif
-// ==== KICKS AND BANS - DARKBOT'S OWN FLOOD PROTECTION ====
-/*
- * Define this if you want your Darkbot to KICK out the
- * people who flood it. NOTE: This means flooding your BOT,
- * not your CHANNEL. If you don't define this, it will just
- * ignore the user. (default = define)
- */
-#define FLOOD_KICK
+#if STDC_HEADERS
+# include <string.h>
+# include <stdarg.h>
+# include <stdlib.h>
+#else
+# if !HAVE_STRCHR
+# define strchr index
+# define strrchr rindex
+# endif
+char *strchr (), *strrchr ();
+# if !HAVE_MEMMOVE
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
-/*
- * What do you want your Darkbot to say when someone is
- * flooding it? (Change for what you want between " ")
- */
-#define FLOOD_REASON "Don't flood!"
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
-// ================ MISCELLANEOUS ================
+#if HAVE_UNISTD_H
+#include <sys/types.h>
+#include <unistd.h>
+#endif
-/*
- * Google search feature (default = ON)
- */
-#define GOOGLE ON
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
-/*
- * METAR search feature (default = ON)
- */
-#define METAR ON
+/* MacOS X is happier with this one AFTER timeval is declared. */
+#include <sys/resource.h>
-/*
- * TAF search feature (default = ON)
- */
-#define TAF ON
+#include "stat-macros.h"
+#include "minmax.h"
-/*
- * Bot's online QUIZ (default = OFF)
- */
-#define QUIZ OFF
+#ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# define EXIT_FAILURE 1
+#endif
-/*
- * How long to wait before giving the answer? (default = 25)
- */
-#define QUIZ_TIMER 25
+#if !LSTAT_FOLLOWS_SLASHED_SYMLINK
+extern int rpl_lstat (const char *name, struct stat *buf);
+# undef lstat
+# define lstat rpl_lstat
+#endif
-/*
- * Don't allow another quiz until this time has expired (since
- * the last answer) (default = 20)
- */
-#define QUIZ_REPEAT_TIMER 20
+#if !HAVE_MEMSET
+# define memset rpl_memset
+#endif
-/*
- * Do you want your bot to do math commands? (default = define)
- */
-#define DO_MATH_STUFF
+#if !HAVE_NANOSLEEP
+# define nanosleep rpl_nanosleep
+#endif
-/*
- * Parse luser data? May cause SIG_SEGV on
- * some ircd's (ie; non ircu) Basically all this does
- * is display network info like opers, servers, avg #
- * of users on the servers, etc.
- */
-#define STATUS OFF
+#if !HAVE_SNPRINTF
+# define snprintf rpl_snprintf
+#endif
-// ================ AID DIRECTIVES ================
+#if !HAVE_STRCASECMP
+# define strcasecmp rpl_strcasecmp
+#endif
- /*
- * Give user's who join a NOTICE with info on how to use the darkbot?
- * I don't bother with this anymore since my bot knows how to respond
- * to most general questions users ask. If your bot is new and doesn't
- * know much, then you may want to have it tell people how to use it.
- */
-#define HELP_GREET OFF
+#if !HAVE_STRCASESTR
+# define strcasestr rpl_strcasestr
+#endif
-/*
- * This define just sends a message to the channel, whenever a "Guest"
- * user joins, asking the user if they need any help. This is useful
- * for help channels.
- */
+#if !HAVE_STRNDUP
+extern char *rpl_strndup (const char *dupMe, size_t maxBytes);
+# undef strndup
+# define strndup rpl_strndup
+#endif
-#define AUTOHELP_GUESTS OFF
+#if !HAVE_STRSPN
+# define strspn rpl_strspn
+#endif
-/*
- * If you change anything on the next 5 directives be careful not to
- * remove or change the position of '%s' nor anything outside quotes.
- */
-#define L100(s,a,b,c,d,e,f) S("NOTICE %s :I can be triggered by various \
-forms of speech, all which must be addressed to me, in one of the \
-following formats: %s %s %s or even %s .... In my database, you can \
-find a topic by saying my nick, <topic> . eg; \37%s nuke\37 ..... \
-to do a search on a word, or partial text, just type: <mynick>, search \
-<text> ... eg; \37%s search nuke\37\n",s,a,b,c,d,e,f)
+#if !HAVE_STRSTR
+# define strstr rpl_strstr
+#endif
-#define L101(a,b,c,d) S("NOTICE %s :I can also be triggered with even more \
-human formats: \37%s who is bill gates?\37 .. You can also phrase it \
-in a question: \37%s where is msie?\37 ...For more info \
-about me, visit http://www.freezedown.org\n",a,b,c,d)
+#if !HAVE_VPRINTF
+# define vsprintf rpl_vsprintf
+# define vfprintf rpl_vfprintf
+#endif
-#define L102(a,b,c,d) S("NOTICE %s :Welcome to %s, %s. Before \
-asking your question, type %cHELP for a list of help topics.\n", a,b,c,d)
+#if !HAVE_LIBCRYPT
+# if !HAVE_CRYPT
+# define crypt rpl_crypt
+# endif
+#endif
-#define mySetinfo "My !setinfo variables are: ^ nick, % Number of joins, & \
-Channel, $ user@host. Example: !setinfo ^ has joined & % times!! (also, if \
-you make the first char of your SETINFO a \"+\" the setinfo will be shown \
-as an ACTION)"
-/*(62)
- * Below are variables for the data replys
- */
-#define myVariables "data variables are: N~ (Nick), C~ (Chan), T~ \
-(Time/date) B~ (Botnick), Q~ (Question asked), R~ (random nick), !~ \
-(command char), S~ (current Server), P~ (current port) V~ (botVer), W~ \
-(db WWW site), H~ (u@h), t~ (unixtime), BAN (sets a ban), TEMPBAN (bans \
-for 60 sec)"
+/* -------------------------------------------------- */
-/* *******************************---******************************* */
-/* --------------- Don't change anything else below! --------------- */
-/* ***************************************************************** */
-#define fr 3 /* these two are the # of lines per secs */
-#define ft 3
-#define AIL 1
-#define WSEC 10
-#define USEC 0
-#define RECHECK 45
+#define FR 3 /* these two are the # of lines per secs */
+#define FT 3
+#define AIL 1
+#define WSEC 10
+#define USEC 0
+#define RECHECK 45
#define DEFAULT_DBTIMERS_PATH "timers"
#define DEFAULT_LOG_DIR "logs/"
#define DEFAULT_RDB_DIR "rdb"
+#ifdef ENABLE_STATS
#define DEFAULT_STATS_FILE "stats.db"
+#endif
#define DEFAULT_SEEN_FILE "seen.db"
-#define DEFAULT_URL2 "info2.db"
-#define DUNNO_FILE "dunno"
-#define WHUT_FILE "whut"
+#define DEFAULT_URL2 "info2.db"
+#define DUNNO_FILE "dunno"
+#define WHUT_FILE "whut"
#define DEFAULT_BACKUP_DUP "backup_dups.db"
#define DEFAULT_ADD_DELETES "logs/add_delete.log"
-#define TMP_URL ".info.tmp"
-#define TMP_FILE ".file.tmp"
+#define TMP_URL ".info.tmp"
+#define TMP_FILE ".file.tmp"
#define DEFAULT_AUTOTOPIC_F "autotopic.ini"
#define DEFAULT_HELPER_LIST "userlist.db"
#define DEFAULT_QUIZ_FILE "quiz.db"
#define DEFAULT_PERFORM "perform.ini"
#define DEFAULT_DEOP "deop.ini"
#define DEFAULT_RAND_SAY "random.ini"
#define DEFAULT_RAND_FILE "randomstuff.ini"
#define DEFAULT_RANDQ_TEMPFILE "randq.tmp"
#define DEFAULT_RAND_BACKUP_FILE "randomstuff.bak"
#define DEFAULT_SERVERS "servers.ini"
#define DEFAULT_PERMBAN "permbans.db"
#define DEFAULT_SETUP "setup.ini"
#define MAX_SEARCH_LENGTH 350
#define ERR_SOCK_OPT -1
#define ERR_TIMED_OUT -1
+#define ERR_CANT_MALLOC -1
+#define ERR_OPEN_SOCKET -2
#define ERR_CONN_REFUSED -2
#define ERR_NOT_ADDR -3
+#define ERR_WRITE_SOCKET -3
#define ERR_NO_REACH -4
#define ERR_CANT_CONNECT -5
+#define ERR_READ_SOCKET -5
#define ERR_SERVER_BUSY -6
-#define ERR_NO_DATA -7
-#define SUCCESS 0
-
-#define ON 1
-#define OFF 0
+#define ERR_NO_DOCUMENTS -6
+#define ERR_NO_DATA -7
+#define SUCCESS 0
-#define LEGAL_TEXT "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-"
-#define SAFE_LIST "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-#define LEGAL_NICK_TEXT "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-\\|[]{}`"
+#define LEGAL_TEXT "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-"
+#define SAFE_LIST "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
+#define LEGAL_NICK_TEXT "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-\\|[]{}`"
-#define NUMBER_LIST "1234567890"
+#define NUMBER_LIST "1234567890"
#define MAX_NICK_LENGTH 35
#ifndef LANG /* If not defined, default to english */
-#define LANG 1
-#endif
-
-#define NORMALR 0
-#define WHUTR 1
-#define DUNNOR 2
-
-#define RAND_NORMAL 0
-#define RAND_ACTION 1
-#define RAND_RAW 2
-
-
-/* -------------------------------------------------- */
-
-#include "langs/lang.h"
-#include <ctype.h>
-#include <stdio.h>
-#if NEED_CLOCK_T == ON
-#include <time.h>
+#define LANG 1
#endif
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/resource.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <assert.h>
-#include <fcntl.h>
-#ifdef WIN32
-#include <windows.h>
-#endif
-#include <signal.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#define db_sleep(x) usleep(x*1000)
+#define NORMALR 0
+#define WHUTR 1
+#define DUNNOR 2
-#ifndef __cplusplus
-typedef enum
-{ false, true }
-bool;
-#endif
-
-#define ERR_CANT_MALLOC -1
-#define ERR_OPEN_SOCKET -2
-#define ERR_WRITE_SOCKET -3
-#define ERR_READ_SOCKET -5
-#define ERR_NO_DOCUMENTS -6
+#define RAND_NORMAL 0
+#define RAND_ACTION 1
+#define RAND_RAW 2
#define RANDQ_NORMAL 0
#define RANDQ_CASE 1
-#define RANDQ_RAND 2
+#define RANDQ_RAND 2
-#define RDB_NORMAL 0
-#define RDB_ACTION 1
-#define RDB_RAW 2
+#define RDB_NORMAL 0
+#define RDB_ACTION 1
+#define RDB_RAW 2
-///////////////////////////////////////////////////////////////////////
+/* ////////////////////////////////////////////////////////////////////// */
-#define RESERVED1 "EXPLAIN"
-#define RESERVED2 "DECLARE"
+#define RESERVED1 "EXPLAIN"
+#define RESERVED2 "DECLARE"
+
+#include "langs/lang.h"
diff --git a/source/general.c b/source/general.c
index dcba9dd..007f532 100755
--- a/source/general.c
+++ b/source/general.c
@@ -1,589 +1,595 @@
-
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+
+#if !HAVE_NANOSLEEP
+# include "timespec.h"
+#endif
+
/**
* Removed trailing newline and carriage returns.
* 6/22/00 Dan
* Rewrote to be more efficient, reduced from O(2n) to O(n)
*/
void
stripline (char *ptr)
{
for (; ptr && *ptr; ++ptr)
{
if ('\r' == *ptr || '\n' == *ptr)
{
*ptr = 0;
return;
}
}
}
void
db_log (const char *filename, const char *format,...)
{
va_list arglist;
FILE *fp;
fp = fopen (filename, "a");
if (NULL == fp)
{
/* I guess there's no sense in trying to log the error :) */
return;
}
va_start (arglist, format);
vfprintf (fp, format, arglist);
va_end (arglist);
fclose (fp);
}
/**
* Convert a character array to all lowercase.
* 6/23/00 Dan:
* - Rewrote to be more compact and a bit more efficient
*/
char *
strlwr (char *buf)
{
char *ptr = buf;
for (; ptr && *ptr; ++ptr)
{
*ptr = tolower (*ptr);
}
return buf;
}
-// stristr: case insensitive strstr.
-char *db_stristr (char *pHaystack, char *pNeedle)
+/**
+ * Convert a character array to all uppercase.
+ * 6/23/00 Dan:
+ * - Rewrote to be more compact and a bit more efficient
+ */
+char *
+strupr (char *buf)
{
- char szHaystack [STRING_LONG] = {0};
- char szNeedle [STRING_LONG] = {0};
-
- strcpy(szHaystack, pHaystack);
- strcpy(szNeedle, pNeedle);
-
- strlwr(szHaystack);
- strlwr(szNeedle);
+ char *ptr = buf;
- return(strstr(szHaystack, szNeedle));
+ for (; ptr && *ptr; ++ptr)
+ {
+ *ptr = toupper (*ptr);
+ }
+ return buf;
}
-
/*
* Added cast to str[i -1] to prevent warnings on Solaris.
* -ron
*/
void
trailing_blanks (char *str)
{
int i = 0;
if (str == NULL)
return;
for (i = strlen (str); i > 0; i--)
{
if (isspace ( (int) str[i - 1]))
str[i - 1] = '\0';
else
return;
}
}
-#ifndef WIN32
-int
-stricmp (const char *s1, const char *s2)
-{
- return strcasecmp (s1, s2);
-}
-#else
-int
-stricmp (const char *s1, const char *s2)
-{
- register int c = 0;
-
- while ((c = tolower (*s1)) == tolower (*s2))
- {
- if (c == 0)
- return 0;
- s1++;
- s2++;
- }
- if (c < tolower (*s2))
- return -1;
- return 1;
-}
-#endif
-
void
save_changes (void)
{
long i = 0;
struct helperlist *c;
+#ifdef ENABLE_STATS
struct statslist *d;
- c = helperhead;
d = statshead;
- unlink (TMP_FILE);
+#endif
+ c = helperhead;
+ remove (TMP_FILE);
while (c != NULL)
{
i++;
db_log (TMP_FILE, "%s %s %d %d %s %s\n",
c->chan, c->uh, c->level, c->num_join, c->pass, c->greetz);
c = c->next;
}
rename (TMP_FILE, HELPER_LIST);
+#ifdef ENABLE_STATS
while (d != NULL)
{
i++;
db_log (TMP_FILE, "%s %s %ld %ld %ld\n",
d->nick, d->uh, d->total, d->added_time, d->last_time);
d = d->next;
}
rename (TMP_FILE, STATS_FILE);
-}
-
-void
-save_setup (void)
-{
-#ifdef WIN32
- printf ("*** Writing setup file: %s (%s)\n", SETUP, date ());
#endif
- unlink (TMP_FILE);
- db_log (TMP_FILE, "NICK=%s\n", s_Mynick);
- db_log (TMP_FILE, "USERID=%s\n", UID);
- db_log (TMP_FILE, "CHAN=%s\n", CHAN);
- db_log (TMP_FILE, "VHOST=%s\n", VHOST);
- db_log (TMP_FILE, "REALNAME=%s\n", REALNAME);
- db_log (TMP_FILE, "CMDCHAR=%c\n", *CMDCHAR);
- db_log (TMP_FILE, "SEEN=%d\n", SeeN);
- rename (TMP_FILE, SETUP);
}
char *
date (void)
{
time_t timer;
time (&timer);
strncpy (strbuff, ctime (&timer), sizeof (strbuff));
stripline (strbuff);
return strbuff;
}
-/**
- * Allocate a new character array. Copy into it at most
- * maxBytes bytes.
- */
-char *
-db_strndup (const char *dupMe, size_t maxBytes)
-{
- char *ptr = NULL;
- char *retMe = NULL;
-
- /* Configure maxBytes to be the number of bytes to copy */
- maxBytes = min (strlen (dupMe), maxBytes);
- /* Allocate the return buffer. */
- retMe = malloc (maxBytes + 1);
- /* Was the allocation successful? */
- if (NULL == retMe)
- {
- return NULL;
- }
-
- /*
- * ptr will point to the byte to which to copy the next
- * source byte.
- */
- ptr = retMe;
- /*
- * Continue while dupMe is valid and we are < maxBytes number
- * of bytes copied. This is typecase here because size_t is
- * unsigned, so comparing against > 0 *should* produce a
- * warning :)
- */
- while (dupMe && (int) maxBytes-- > 0)
- {
- *ptr++ = *dupMe++;
- }
-
- /* Be sure to NULL terminate the array */
- *ptr = 0;
- return retMe;
-}
int
match_wild (const char *pattern, const char *str)
{
char c = 0;
const char *s = NULL;
for (;;)
{
switch (c = *pattern++)
{
case 0:
if (!*str)
return 1;
return 0;
case '?':
++str;
break;
case '*':
if (!*pattern)
return 1;
s = str;
while (*s)
{
if (*s == *pattern && match_wild (pattern, s))
return 1;
++s;
}
break;
default:
if (*str++ != c)
return 0;
break;
} /* switch */
}
}
-#ifndef WIN32
-size_t
-min (const size_t a, const size_t b)
-{
- return ((a < b) ? a : b);
-}
-#endif
-
char **
tokenize (char *theString, size_t * numTokens)
{
static char *tokens[STRING_SHORT] = { 0 };
assert (numTokens != NULL && theString != NULL);
memset (tokens, 0, STRING_SHORT * sizeof (char *));
tokens[(*numTokens = 0)] = strtok (theString, " ");
if (NULL == tokens[0])
{
/* 0 tokens */
return tokens;
}
while ((tokens[++(*numTokens)] = strtok (NULL, " ")) != NULL)
{
/* NO-OP */ ;
}
tokens[*numTokens] = 0;
return tokens;
}
void
get_s (void)
{
char temp[50] = { 0 };
long i = 0;
i = strlen (rp391);
while (i > 0)
{
i--;
snprintf (temp, sizeof (temp), "%s%c", dbVersion, rp391[i]);
strncpy (dbVersion, temp, sizeof (dbVersion));
}
}
-#ifndef WIN32
const char *
run_program (const char *input)
{
FILE *read_fp;
read_fp = popen (input, "r");
if (read_fp != NULL)
{
- while ( fgets(f_tmp, sizeof(f_tmp), read_fp) );
+ int length = 0;
- pclose (read_fp);
+ while ( fgets(f_tmp + length, sizeof(f_tmp - length), read_fp) )
+ {
+ length = strlen(f_tmp);
+ while ((f_tmp[length - 1] == '\n') || (f_tmp[length - 1] == '\r'))
+ {
+ f_tmp[length - 1] = '\0';
+ length--;
+ }
+ }
+
+ pclose (read_fp);
if (f_tmp)
{
return f_tmp;
}
return "No match";
}
return NULL;
}
-#endif
/**
* 6/22/00 Dan
* - Removed srand(), should only be done once, in main()
* - Changed while to for loop
*/
char *
get_rand_nick (const char *chan)
{
size_t x = 0;
size_t i = 0;
const struct userlist *c = userhead;
/* Iterate through the userlist */
for (; c != NULL; c = c->next)
{
/* Check if this user is on the channel */
- if (stricmp (chan, c->chan) == 0)
+ if (strcasecmp (chan, c->chan) == 0)
{
- if (stricmp (Mynick, c->nick) != 0)
+ if (strcasecmp (Mynick, c->nick) != 0)
{
strncpy (f_tmp, c->nick, sizeof (f_tmp));
i++;
}
}
}
- x = rand () % i + 2;
+ x = 2 + get_random_integer(i);
i = 0; /* reinit! */
for (c = userhead; c != NULL; c = c->next)
{
- if (stricmp (chan, c->chan) == 0)
+ if (strcasecmp (chan, c->chan) == 0)
{
i++;
if (i == x)
{
if (*c->nick == '0')
{
return f_tmp;
}
- if (stricmp (Mynick, c->nick) != 0)
+ if (strcasecmp (Mynick, c->nick) != 0)
{
strncpy (f_tmp, c->nick, sizeof (f_tmp));
return f_tmp;
}
}
}
}
return f_tmp;
}
void
check_dbtimers (void)
{
DIR *dp;
long i = 0;
char filename[STRING_SHORT] = { 0 };
struct dirent *entry;
struct stat statbuf;
FILE *fp;
char b[STRING_LONG] = { 0 }, output[STRING_LONG] =
{
0};
if ((dp = opendir (DBTIMERS_PATH)) == NULL)
{
return;
}
while ((entry = readdir (dp)) != NULL)
{
stat (entry->d_name, &statbuf);
-
if (S_ISDIR (statbuf.st_mode) && *entry->d_name == '.')
{
continue; /* it's a dir, ignore it */
}
-
- if (S_ISDIR (statbuf.st_mode) && stricmp (entry->d_name, "CVS") == 0)
+ if (S_ISDIR (statbuf.st_mode) && strcasecmp(entry->d_name, "CVS") == 0)
{
- /* Ignore the CVS directory. */
+ /* Ignore the CVS directory */
continue;
}
-
i = time (NULL);
if (i >= atoi (entry->d_name))
{
snprintf (filename, sizeof (filename), "%s/%s", DBTIMERS_PATH, entry->d_name);
if ((fp = fopen (filename, "r")) == NULL)
{
return;
}
while (fgets (b, STRING_LONG, fp))
{
stripline (b);
snprintf (output, sizeof (output), "%s\n", b);
S (output);
}
fclose (fp);
- unlink (filename);
+ remove (filename);
}
}
+ // FIXME: if CLOSEDIR_VOID is not defined, check the return value.
closedir (dp);
}
-#if SNPRINTF_SUPPORT == 1
-int
-snprintf (char *buff, size_t size, const char *fmt, ...)
-{
- static char temp[BUFSIZ]; // a temp (large buffer)
- int result;
- va_list ap;
- va_start (ap, fmt);
- result = vsprintf (temp, fmt, ap);
- strncpy (buff, temp, size - 1); // copy at most n
- buff[size - 1] = '\0'; // ensure \0 at end
- va_end (ap);
- return result;
-}
-#endif
-
int
add_ignore_user_ram (char *nick)
{
struct ignorelist *n, *c;
c = ignorehead;
while (c)
{
- if (stricmp (c->nick, nick) == 0)
+ if (strcasecmp (c->nick, nick) == 0)
{
return 1;
}
c = c->next;
}
if ( ( n = malloc (sizeof (struct ignorelist))) == NULL )
{
db_log ("error.log", "AHHH! No ram left! in add_ignore_user!\n");
return 0;
}
memset (n, 0, sizeof (struct ignorelist));
if (n != NULL)
{
strncpy (n->nick, nick, sizeof (n->nick));
n->next = ignorehead;
ignorehead = n;
}
return 1;
}
int
check_ignore_user_ram (char *nick)
{
struct ignorelist *c;
c = ignorehead;
while (c)
{
- if (stricmp (c->nick, nick) == 0)
+ if (strcasecmp (c->nick, nick) == 0)
{
return 1;
}
c = c->next;
}
return 0;
}
int
delete_ignore_user_ram (char *nick)
{
struct ignorelist *pNode, *pPrev;
pNode = ignorehead;
pPrev = NULL;
while (pNode)
{
- if (stricmp (pNode->nick, nick) == 0)
+ if (strcasecmp (pNode->nick, nick) == 0)
{
if (pPrev != NULL)
{
pPrev->next = pNode->next;
}
else
ignorehead = pNode->next;
free (pNode);
pNode = NULL;
return 1;
}
pPrev = pNode;
pNode = pNode->next;
}
return 0;
}
-// Count lines in a given filename.
+/* Count lines in a given filename. */
size_t count_lines (char *filename)
{
FILE *fp = NULL;
size_t lines = 0;
char b [STRING_LONG] = {0};
if((fp = fopen(filename, "r")) == NULL)
{
db_log("error.log", "Failed to open %s in count_lines()",
filename);
return (-1);
}
while(fgets(b, STRING_LONG, fp))
{
- // Ignore comments!
+ /* Ignore comments! */
if((*b != '/') && (*b != '\n'))
lines++;
if(*b == '\n')
continue;
}
/* Close the file. */
fclose(fp);
return(lines);
}
-// Self explanatory.
+/* Self explanatory. */
void reverse (char *pString)
{
size_t nLength = strlen(pString);
char *endptr = pString + nLength - 1;
for(;pString < endptr; ++pString, --endptr)
{
char c = *pString;
*pString = *endptr;
*endptr = c;
}
}
-// Count how many times the character nChar exists in szStuff
-// return that number.
+/* Count how many times the character nChar exists in szStuff
+ * return that number.
+ */
+
size_t count_char (const char *pStuff, const char nChar)
{
char szStuff [STRING_LONG] = {0};
int nIndex = 0;
int nCount = 0;
strcpy(szStuff, pStuff);
for(nIndex = 0; nIndex <= (size_t) strlen(szStuff); nIndex++)
{
if(szStuff[nIndex] == nChar)
nCount++;
}
return(nCount);
}
+
+/* I wrote this for my matrix-RAD.net project, this is translated from the Java.
+ *
+ * Try to turn all sorts of string things into a boolean. Only the first character is considered.
+ */
+
+// true 1 yes ack ok one positive absolutely affirmative 'ah ha' 'shit yeah' 'why not'
+static const char *IS_TRUE = "t1aopswy";
+// false 0 no nack nope zero negative nah 'no way' 'get real' 'uh uh' 'fuck off' 'bugger off'
+static const char *IS_FALSE = "f0bgnuz";
+bool isBoolean(char *aBoolean)
+{
+ bool result = false;
+
+ if ((aBoolean != NULL) && (aBoolean[0] != '\0'))
+ {
+ char test = aBoolean[0];
+
+ result = (strchr(IS_TRUE, tolower(test)) != NULL);
+ }
+
+ return result;
+}
+
+void db_sleep(unsigned long seconds)
+{
+ struct timespec req, rem;
+
+ req.tv_sec = seconds;
+ nanosleep(&req, &rem);
+}
+
+/* plural(): This function returns "s", or "" (empty string),
+ * depending on the plurality of the number specified by 'i'.
+ * Used for beautification purposes in output that involves
+ * showing a numeric count of objects.
+ */
+
+char *plural (size_t i)
+{
+ /* We only need to return "" if 'i' is equal to 1 or -1. */
+ if (i == 1 || i == -1)
+ return ("");
+
+ /* Everything else is considered plural. */
+ return ("s");
+}
+
+/* db_argstostr(): This function takes char **args and fills the buffer
+ * pointed to by 'str' with a 'delim' delimited string of each element
+ * in the argument buffer. A pointer to 'str' is returned for value
+ * checking.
+ */
+
+int db_argstostr(char *str, char **args, size_t startarg, char delim)
+{
+ int i = 0, j = 0, tc = 0;
+
+ /* Bail out if no args. */
+ if (args[0] == NULL)
+ return (0);
+
+ /* Iterate words. */
+ for (i = startarg; args[i]; i++)
+ {
+ /* Go through the letters and fill str buffer. */
+ for (j = 0; args[i][j]; j++)
+ {
+ str[tc++] = args[i][j];
+
+ if (args[i+1] && !(args[i][j+1]))
+ str[tc++] = delim;
+ }
+ }
+
+ str[tc] = '\0';
+
+ return (tc);
+}
diff --git a/source/helpers.c b/source/helpers.c
index b504130..4244722 100755
--- a/source/helpers.c
+++ b/source/helpers.c
@@ -1,477 +1,479 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
/**
* Add a channel helper.
* 6/22/00 Dan
* n now initialized where declared
* All pointer arguments now received as pointer to const data.
*/
void
add_helper (const char *chan,
const char *uh, long level, size_t num_join, const char *greetz, const char *pass, char mode)
{
struct helperlist *n = 0;
char *ptr = NULL;
-#if ENCRYPT_PASSWORDS == ON
- char *salt = "8fei3k";
-
+#ifdef ENABLE_ENCRYPT
+ const char *salt = "8fei3k";
+
if ( mode == 0 )
{
if ((ptr = crypt (pass, salt)) == NULL) /* encrypt password */
return;
}
else
ptr = (char *)pass;
-#else
- ptr = (char *)pass;
-#endif
-
-
+#else
+ ptr = (char *)pass;
+#endif
+
+
n = malloc (sizeof (struct helperlist));
if (n == NULL)
{
db_log ("error.log", "AHHH! No ram left! in add_helper!\n");
return;
}
memset (n, 0, sizeof (struct helperlist));
NUM_HELPER++;
if (chan[0] == '#')
{
strncpy (n->chan, chan, sizeof (n->chan));
}
else
{
strncpy (n->chan, "#*", sizeof (n->chan));
}
strncpy (n->uh, uh, sizeof (n->uh));
strlwr (n->uh);
strncpy (n->pass, ptr, sizeof (n->pass));
n->num_join = num_join;
n->level = level;
- strncpy (n->greetz, greetz, min (sizeof (n->greetz) - 1, strlen (greetz)));
+ strncpy (n->greetz, greetz, MIN(sizeof(n->greetz) - 1, strlen(greetz)));
n->next = helperhead;
helperhead = n;
}
/**
* Output the helper list to a nickname.
* 6/22, Dan:
* - Changed helperlist* c to be a pointer to const data
* - Changed initialization of DATA, and size to be a
* power of 2
* - Added initialization of c
* - Changed while loop to for loop
* - Changed types of i, x to size_t since they should be
* unsigned.
* - Added reinitialization of DATA using memset() (changed from
* strcpy(DATA,""))
*/
void
show_helper_list (const char *nick, long level)
{
char DATA [STRING_SHORT * 7] = { 0 };
- char tmp [STRING_SHORT] = { 0 };
+ char tmp [STRING_SHORT] = { 0 };
size_t i = 0, x = 0;
const struct helperlist *c = NULL;
-
+
for (c = helperhead; c != NULL; c = c->next)
{
- // If we're displaying users at all levels...
+ // If we're displaying users at all levels...
if ((level == 0) || (level == c->level))
{
- i++; x++;
-
- snprintf (tmp, sizeof(tmp), "%s", DATA);
- snprintf (DATA, (sizeof(DATA) + sizeof(tmp)),
- "%s %s[%s:%ld:%d]",
- tmp, c->uh, c->chan, c->level, c->num_join);
-
- memset (tmp, 0, sizeof(tmp));
-
- if (i > 6)
- {
- i = 0;
- S ("NOTICE %s :%s\n", nick, DATA);
- memset (DATA, 0, sizeof(DATA));
- db_sleep(2);
- }
+ i++; x++;
+
+ snprintf (tmp, sizeof(tmp), "%s", DATA);
+ snprintf (DATA, (sizeof(DATA) + sizeof(tmp)),
+ "%s %s[%s:%ld:%d]",
+ tmp, c->uh, c->chan, c->level, c->num_join);
+
+ memset (tmp, 0, sizeof(tmp));
+
+ if (i > 6)
+ {
+ i = 0;
+ S ("NOTICE %s :%s\n", nick, DATA);
+ memset (DATA, 0, sizeof(DATA));
+ db_sleep(2);
+ }
}
} /* for() */
- if (x != 0)
+ if (x != 0)
S ("NOTICE %s :%s\n", nick, DATA);
-
- S ("NOTICE %s :End of Helper Userlist; %d user%s found.\n",
- nick, x,
+
+ S ("NOTICE %s :End of Helper Userlist; %d user%s found.\n",
+ nick, x,
(x == 1) ? "" : "s");
}
void
load_helpers (void)
{
FILE *fp;
char b[STRING_LONG], *user_host, *greetz, *numb_join, *chan, *w_level, *pass;
long num_join = 0, i = 0, level = 0;
if ((fp = fopen (HELPER_LIST, "r")) == NULL)
{
printf ("Unable to open %s! Aborting connection.\n", HELPER_LIST);
printf ("Please run ./configure to setup your darkbot.\n");
exit (0);
}
-#ifndef WIN32
printf ("Loading %s file ", HELPER_LIST);
-#endif
while (fgets (b, STRING_LONG, fp))
{
if (b == NULL)
continue;
stripline (b);
if (*b == '/')
continue;
i++;
printf (".");
fflush (stdout);
chan = strtok (b, " ");
if (chan == NULL)
continue;
user_host = strtok (NULL, " ");
if (user_host == NULL)
continue;
w_level = strtok (NULL, " ");
if (w_level == NULL)
continue;
numb_join = strtok (NULL, " ");
if (numb_join == NULL)
continue;
pass = strtok (NULL, " ");
if (pass == NULL)
{
pass = "0"; /* duh */
}
greetz = strtok (NULL, "");
if (greetz == NULL)
greetz = "I haven't used \2SETINFO\2 yet!";
if (w_level != NULL)
level = atoi (w_level);
else
level = 1;
if (numb_join != NULL)
num_join = atoi (numb_join);
else
num_join = 0;
if (strlen (pass) > 25)
pass[25] = '\0';
if (DebuG == 1)
printf
("loading helperlist: %s %s l:%d j:%d %s\n",
chan, user_host, (int) level, (int) num_join, greetz);
add_helper (chan, user_host, level, num_join, greetz, pass, 1);
}
printf ("done(%d), ", (int) i);
fclose (fp);
save_changes ();
if (DebuG == 1)
db_sleep (2);
}
void
set_pass (char *nick, char *uh, char *pass, char *newpass)
{
struct helperlist *c;
- char *ptr = NULL;
-#if ENCRYPT_PASSWORDS == ON
+ char *ptr = NULL;
+#ifdef ENABLE_ENCRYPT
char *salt = "8fei3k";
-#endif
+#endif
c = helperhead;
strlwr (uh);
-
-#if ENCRYPT_PASSWORDS == ON
+
+#ifdef ENABLE_ENCRYPT
if ((ptr = crypt (pass, salt)) == NULL) /* encrypt old password */
return;
-#else
- ptr = (char *)pass;
-#endif
+#else
+ ptr = (char *)pass;
+#endif
while (c)
{
if (!match_wild (c->uh, uh) == 0)
{
if (strcmp (c->pass, ptr) == 0 || strcmp (c->pass, "0") == 0)
{
-#if ENCRYPT_PASSWORDS == ON
+#ifdef ENABLE_ENCRYPT
if ((ptr = crypt (newpass, salt)) == NULL) /* encrypt new password */
return;
-#else
- ptr = (char *)newpass;
+#else
+ ptr = (char *)newpass;
#endif
strncpy (c->pass, ptr, sizeof (c->pass));
L012 (nick, uh);
save_changes ();
return;
}
else
{
L013 (nick);
return;
}
}
c = c->next;
}
L014 (nick);
}
long
verify_pass (char *nick, char *chan, char *uh, char *pass)
{
struct helperlist *c;
- char *ptr = NULL;
-#if ENCRYPT_PASSWORDS == ON
+ char *ptr = NULL;
+#ifdef ENABLE_ENCRYPT
char *salt = "8fei3k";
-#endif
+#endif
c = helperhead;
strlwr (uh);
-#if ENCRYPT_PASSWORDS == ON
+#ifdef ENABLE_ENCRYPT
if ((ptr = crypt (pass, salt)) == NULL)
return 0;
-#else
- ptr = (char *)pass;
-#endif
+#else
+ ptr = (char *)pass;
+#endif
while (c)
{
if (!match_wild (c->uh, uh) == 0)
{
if (*c->pass == '0')
return 0; /* no pass set */
if (strcmp (c->pass, ptr) == 0)
{
if (c->chan[0] == '#' && c->chan[1] == '*')
return c->level;
if (*chan == '*')
return c->level;
- if (stricmp (c->chan, chan) == 0)
+ if (strcasecmp (c->chan, chan) == 0)
return c->level;
return 0; /* don't match chan access */
}
}
c = c->next;
}
return 0;
}
long
get_pass (char *data)
{
/* returns 0 for no data */
/* returns 1 for just pass */
/* returns 2 for pass and data */
char b[STRING_SHORT] = { 0 }, b2[STRING_SHORT] =
{
0}
, *temp = NULL;
long i = 0;
strncpy (pass_data, "0", sizeof (pass_data)); /* init */
strncpy (pass_pass, "0", sizeof (pass_pass));
if (data == NULL)
return 0;
strncpy (b2, data, sizeof (b2));
temp = strtok (data, " ");
if (temp == NULL)
return -1;
strncpy (b, temp, sizeof (b));
while (temp != NULL)
{
i++;
strncpy (pass_pass, temp, sizeof (pass_pass));
temp = strtok (NULL, " ");
if (temp == NULL)
break;
snprintf (b, sizeof (b), "%s %s", b, temp);
}
strncpy (b, "", sizeof (b)); /* reinit */
temp = strtok (b2, " ");
strncpy (b, temp, sizeof (b));
while (i > 2)
{
i--;
temp = strtok (NULL, " ");
snprintf (b, sizeof (b), "%s %s", b, temp);
}
- if (stricmp (b, pass_pass) == 0)
+ if (strcasecmp (b, pass_pass) == 0)
{
strncpy (pass_data, "0", sizeof (pass_data));
return 1;
}
strncpy (pass_data, b, sizeof (pass_data));
return 2;
}
void
do_login (char *nick, char *pass)
{
long i = 0, x = 0, D = 0;
char Data[STRING_SHORT] = { 0 }, b[STRING_SHORT] =
{
0};
struct userlist *c;
c = userhead;
while (c)
{
- if (stricmp (nick, c->nick) == 0)
+ if (strcasecmp (nick, c->nick) == 0)
{
x = verify_pass (c->nick, c->chan, c->uh, pass);
if (x > 0)
{
i++;
if (c->level == 0 && x >= 2)
{
-#if OP_USERS_ON_LOGIN == 1
+#ifdef ENABLE_CHANNEL
+ if (OP_USERS_ON_LOGIN)
+ {
/* only if not already authed */
S ("MODE %s +ov %s %s\n", c->chan, c->nick, c->nick);
+ }
#endif
- D = 1;
+ D = 1;
}
c->level = x;
snprintf (b, sizeof (b), "%s[%d] %s", c->chan, (int) c->level, Data);
strncpy (Data, b, sizeof (Data));
}
}
c = c->next;
}
if (i != 0)
{
if (!D)
{
S ("NOTICE %s :Already authed on %s\n", nick, Data);
}
else
S ("NOTICE %s :Verified: %s\n", nick, Data);
}
}
int
check_access (char *uh, char *chan, int toggle, char *nick)
{
long i = 0, length = 0, A = 0, X = 0, Y = 0;
struct helperlist *c;
struct userlist *c2;
char temp[STRING_LONG] = { 0 };
c = helperhead;
c2 = userhead;
strlwr (uh);
if (toggle == 0)
{ /* get access level */
while (c2)
{
- if (stricmp (c2->uh, uh) == 0)
+ if (strcasecmp (c2->uh, uh) == 0)
{
- if (((stricmp (c2->chan, chan) == 0) || (stricmp ("#*", chan) == 0))) /* privmsg */
+ if (((strcasecmp (c2->chan, chan) == 0) || (strcasecmp ("#*", chan) == 0))) /* privmsg */
{
- if (stricmp (c2->nick, nick) == 0)
+ if (strcasecmp (c2->nick, nick) == 0)
{
return c2->level;
}
}
}
c2 = c2->next;
}
return 0; /* no matches? */
}
else
while (c != NULL)
{
if (!match_wild (c->uh, uh) == 0)
{
if (*c->pass == '0')
{
L001 (nick, Mynick);
return 0;
}
if (c->chan[1] != '*')
- if (stricmp (c->chan, chan) != 0)
+ if (strcasecmp (c->chan, chan) != 0)
return 0;
c->num_join++;
if (*c->greetz == '+')
A = 1;
strncpy (data, "", sizeof (data));
length = Y = strlen (c->greetz);
if (length > 1)
{
while (length > 0)
{
length--;
X++;
if (c->greetz[length] == '^')
{
i++;
snprintf (temp, sizeof (temp), "%s%s", nick, data);
}
else if (c->greetz[length] == '%')
{
i++;
snprintf (temp, sizeof (temp), "%u%s", c->num_join, data);
}
else if (c->greetz[length] == '$')
{
i++;
snprintf (temp, sizeof (temp), "%s%s", uh, data);
}
else if (c->greetz[length] == '&')
{
i++;
snprintf (temp, sizeof (temp), "%s%s", chan, data);
}
else
snprintf (temp, sizeof (temp), "%c%s", c->greetz[length], data);
if (X == Y && A == 1)
continue;
strncpy (data, temp, sizeof (data));
} /* While */
-#if JOIN_GREET == 1
- if (i == 0)
+ if (JOIN_GREET)
{
+ if (i == 0)
+ {
if (setinfo_lastcomm (uh) == 0)
{
S ("PRIVMSG %s :%ld\2!\2\37(\37%s\37)\37\2:\2 %s\n",
chan, c->num_join, nick, c->greetz);
}
- }
- else if (A == 1)
- {
+ }
+ else if (A == 1)
+ {
if (setinfo_lastcomm (uh) == 0)
{
S ("PRIVMSG %s :\1ACTION %s\1\n", chan, data);
}
- }
- else
- {
+ }
+ else
+ {
if (setinfo_lastcomm (uh) == 0)
{
S ("PRIVMSG %s :%s\n", chan, data);
}
+ }
}
-#endif
return c->level;
}
}
c = c->next;
}
return 0;
}
diff --git a/source/langs/english.h b/source/langs/english.h
index d67c7d9..9aded66 100755
--- a/source/langs/english.h
+++ b/source/langs/english.h
@@ -1,114 +1,114 @@
#define I_SPEAK "I speak English."
#define L001(a,b) S("PRIVMSG %s :You have not set a password, to set a pass: \2/msg %s PASS \
<oldpass> <newpass>\2 (since this is your first time setting a pass, use '0' as your old pass)\n",a,b)
#define L002(a,b,c) S("NOTICE %s :Deleted permban #%d, %s.\n",a,b,c)
#define L003(a,b) S("NOTICE %s :Unable to open %s :(\n",a,b)
#define L004(a,b,c) S("PRIVMSG %s :%s, There are %d SEEN's in my database.\n",a,b,c)
#define L005(a,b) S("PRIVMSG %s :You'd know more about that than I do, %s.\n",a,b)
#define L006(a,b,c,d) S("PRIVMSG %s :%s, I have not seen %s %s\n",a,b,c,d)
#define L007(a,b) S("NOTICE %s :Autotopic on %s was OFF\n",a,b)
#define L008(a,b) S("NOTICE %s :Autotopic on %s is now OFF\n",a,b);
#define L009(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s ON: %s\n",a,b,c)
#define L010(a,b,c) S("NOTICE %s :AUTOTOPIC @ %s UPDATED: %s\n",a,b,c)
#define L011(a,b,c) S("PRIVMSG %s :%s, done. There are now %d randomstuffs.\n",a,b,c)
#define L012(a,b) S("NOTICE %s :Password for %s has been updated.\n",a,b)
#define L013(a) S("NOTICE %s :Incorrect password!\n",a)
#define L014(a) S("NOTICE %s :No match!\n",a)
#define L015(a,b,c,d) S("NOTICE %s :Deleted user: %s [%d:%d]\n",a,b,c,d)
#define L016(a,b) S("PRIVMSG %s :%s: Division by zero error!\n",a,b)
#define L017(a,b) S("PRIVMSG %s :%s: Illegal operation!\n",a,b)
#define L018(a,b,c,d,e) S("KICK %s %s :%s (adding ignore #%d: %s)\n",a,b,c,d,e)
#define L019(a,b,c) S("PRIVMSG %s :Adding ignore #%d: %s!\n",a,b,c);
#define L020(a,b,c,d) S("NOTICE %s :Updated #%d: \37[\37%s\37]\37 info\2:\2 %s\n",a,b,c,d)
#define L021(a,b,c,d) S("PRIVMSG %s :%s \37%s\37.. %d entries searched.\n",a,b,c,d)
#define L022(a,b,c) S("PRIVMSG %s :Found more than \37%d\37 matches, please narrow down your search\2:\2 \
%s\n",a,b,c);
#define L023(a,b,c) S("PRIVMSG %s :I found \37one\37 match, %s\2:\2 %s\n",a,b,c)
#define L024(a,b,c,d) S("PRIVMSG %s :I found \37%d\37 matches, %s\2:\2 %s\n",a,b,c,d)
#define L025(a,b) S("PRIVMSG %s :Found %ld topic duplicates. They were removed.\n",a,b)
#define L026(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Running %s. I have %ld topics in my database, Uptime: \
%d day%s, %02d:%02d, There have been %ld questions asked, %ld topic additions, and %ld topic deletions, since I connected. \
Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
#define L027(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Running %s. I have %ld topics in my database, Uptime: \
%d hour%s, %d min%s, There have been %ld questions asked, %ld topic additions, and %ld topic deletions, since I connected. \
Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
#define L028(a,b,c,d,e,f,g,h,i,j,k,l) S("PRIVMSG %s :Running %s. I have %ld topics in my database, Uptime: \
%d min%s, %d sec%s, There have been %ld questions asked, %ld topic additions, and %ld topic deletions, since I connected. \
Process time: %1.4lf sec%s\n",a,b,c,d,e,f,g,h,i,j,k,l)
#define L029(a,b,c,d) S("PRIVMSG %s :%s: I have deleted topic #%ld, \2%s\2.\n",a,b,c,d)
#define L029n(a,b,c,d) S("NOTICE %s :%s: I have deleted topic #%ld, \2%s\2.\n",a,b,c,d)
#define L030(a,b,c) S("PRIVMSG %s :%s\2:\2 I was unable to find the topic %s. Delete failed.\n",a,b,c)
#define L030n(a,b,c) S("NOTICE %s :%s\2:\2 I was unable to find the topic %s. Delete failed.\n",a,b,c)
#define L031(a,b) S("NOTICE %s :Syntax: \2/msg %s PASS <oldpass> <newpass>\2\n",a,b)
#define L032(a) Snow("QUIT :K\2\2illed (%s (cause I say so!))\n",a)
#define L033(a) S("NOTICE %s :Syntax: UP <#chan> <pass>\n",a)
#define L034(a) S("NOTICE %s :Syntax: OP <#chan> [nicks] <pass>\n",a)
#define L035(a) S("NOTICE %s :Syntax: DEOP <#chan> [nicks] <pass>\n",a)
#define L036(a) S("NOTICE %s :Specify a nick!\n",a)
#define L037(a,b) S("NOTICE %s :Attempting to /nick %s\n",a,b)
#define L038(a,b) S("NOTICE %s :Try /nick %s-dork.\n",a,b)
#define L039(a,b) S("PRIVMSG %s :Leaving %s\n",a,b)
#define L040(a,b) S("PRIVMSG %s :Joining %s\n",a,b)
#define L041(a) S("PRIVMSG %s :Specify a nick/chan!\n",a)
#define L042(a) S("NOTICE %s :Enter the u@h to purge!\n",a)
#define L043(a) S("NOTICE %s :No such ban.\n",a)
#define L044(a) S("NOTICE %s :Enter the u@h to delete!\n",a)
#define L045(a) S("NOTICE %s :How about I not do that?\n",a)
#define L046(a) S("PRIVMSG %s :Backed up database.\n",a)
#define L047(a,b) S("NOTICE %s :SYNTAX: %cAUTOTOPIC <topic> (set to \"0\" to turn off)\n",a,b)
#define L048(a) S("NOTICE %s :Syntax: SETCHAN <new channels>\n",a)
#define L049(a,b) S("NOTICE %s :Default channel: %s\n",a,b)
#define L050(a) S("NOTICE %s :Syntax: SETCHAR <new command char>\n",a)
#define L051(a,b) S("NOTICE %s :New command char now: %c\n",a,b)
#define L052(a) S("NOTICE %s :Syntax: SETUSER <new userid> (requires a restart)\n",a)
#define L053(a,b) S("NOTICE %s :Default userid now: %s\n",a,b)
#define L054(a) S("NOTICE %s :Syntax: SETNICK <newnick>\n",a)
#define L055(a) S("NOTICE %s :Syntax: ADDUSER <#chan> <*user@*.host> <level> <pass>. ie; ADDUSER #darkbot \
*jason@*.superlink.net 3 hisPasswd ... use #* if you want to give access in all chans.\n",a)
#define L056(a) sprintf(temp, "I haven't used \2%cSETINFO\2 yet!",a)
#define L057(a,b,c) S("NOTICE %s :Added user: %s - level %d\n",a,b,c)
#define L058(a,b,c) S("NOTICE %s :Syntax: %c%s <u@h> [reason]\n",a,b,c)
#define L059(a,b,c,d) S("NOTICE %s :Added in permban #%d, %s; reason: %s\n",a,b,c,d)
#define L060(a) S("NOTICE %s :Syntax: REPEAT <number> <delay> <raw-data>\n",a)
#define L061(a) S("NOTICE %s :Done.\n",a)
#define L062(a) S("QUIT :Restarting %s ...\n",a);
#define L064(a,b) S("PRIVMSG %s :%s, what do you want to add?\n",a,b)
#define L064n(a,b) S("NOTICE %s :%s, what do you want to add?\n",a,b)
#define L065(a,b) S("PRIVMSG %s :Add what, %s?\n",a,b);
#define L066(a,b,c) S("PRIVMSG %s :%s: What info to be added for %s?\n",a,b,c)
#define L067(a,b) S("PRIVMSG %s :Okay, %s :)\n",a,b)
#define Lbadtopic(a,b) S("PRIVMSG %s :Sorry %s, but support for that topic has been removed.\n",a,b);
#define Lbadtopic2(a,b) S("NOTICE %s :Sorry %s, but support for that topic has been removed.\n",a,b);
#define L065n(a,b) S("NOTICE %s :Add what, %s?\n",a,b);
#define L066n(a,b,c) S("NOTICE %s :%s: What info to be added for %s?\n",a,b,c)
#define L067n(a,b) S("NOTICE %s :Okay, %s :)\n",a,b)
#define L068(a,b) S("PRIVMSG %s :Replace what, %s?\n",a,b)
#define L069(a,b,c) S("PRIVMSG %s :%s: What info should replace %s?\n",a,b,c)
#define L070(a,b,c) S("PRIVMSG %s :%s, %s has been updated.\n",a,b,c)
#define L071(a,b,c,d) S("PRIVMSG %s :There %s %d permban%s loaded into ram.\n",a,b,c,d)
#define L073(a,b,c) S("PRIVMSG %s :%s, %d seconds left till randstuff\n",a,b,c)
#define L074(a,b,c) S("PRIVMSG %s :%s: it was %d chars long.\n",a,b,c)
-#define L075(a,b,c,d) S("PRIVMSG %s :%s, There is currently %d item%s in Que.\n",a,b,c,d)
+#define L075(a,b,c,d) S("PRIVMSG %s :%s, There is currently %d item%s in queue.\n",a,b,c,d)
#define L076(a,b) S("PRIVMSG %s :I have seen %d joins thus far.\n",a,b)
#define L077(a,b,c,d,e) S("PRIVMSG %s :There %s %d server%s in my server list. I am currently on \
server #%d.\n",a,b,c,d,e)
#define L078(a,b,c) S("PRIVMSG %s :%s, my command char is: %c\n",a,b,c)
#define L079(a,b,c) S("PRIVMSG %s :What should i be %sing for, %s?\n",a,b,c)
#define L080(a,b) S("PRIVMSG %s :%s, you need to specify an address!\n",a,b)
#define L081(a,b) S("PRIVMSG %s :Was unable to look up %s.\n",a,b)
#define L083(a,b,c) S("PRIVMSG %s :%s: What do you want me to tell %s?\n",a,b,c)
#define L083n(a,b,c) S("NOTICE %s :%s: What do you want me to tell %s?\n",a,b,c)
#define L084(a,b,c) S("PRIVMSG %s :%s, Tell %s about what?\n",a,b,c)
#define L084n(a,b,c) S("NOTICE %s :%s, Tell %s about what?\n",a,b,c)
#define L085(a,b) S("PRIVMSG %s :Tell who, %s?\n",a,b)
#define L085n(a,b) S("NOTICE %s :Tell who, %s?\n",a,b)
#define L086(a,b) S("PRIVMSG %s :%s\2:\2 you were asking?\n",a,b)
#define L086n(a,b) S("NOTICE %s :%s\2:\2 you were asking?\n",a,b)
#define L087(a,b,c,d,e) S("PRIVMSG %s :%s %s %s? Mind rephrasing that? (Type %cHELP for syntax \
hints)\n",a,b,c,d,e)
#define L087n(a,b,c,d,e) S("NOTICE %s :%s %s %s? Mind rephrasing that? (Type %cHELP (in channel) for syntax \
hints)\n",a,b,c,d,e)
#define L088(a) S("QUIT :%s is stoned!\n",a)
#define L089(a) S("PRIVMSG %s :\1ACTION wakes up...\1\n",a)
-#define L090(a,b) S("PRIVMSG %s :I'm being flooded. Dumping output Que. \
+#define L090(a,b) S("PRIVMSG %s :I'm being flooded. Dumping output queue. \
%d items deleted.\n",a,b)
diff --git a/source/main.c b/source/main.c
index 223140e..1a0482f 100755
--- a/source/main.c
+++ b/source/main.c
@@ -1,201 +1,210 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
/**
* 6/23/00 Dan:
* - Moved declaration of newact into #ifdef
*/
int
main (int argc, char **argv)
{
char temp[STRING_SHORT] = { 0 };
+ char exe[STRING_SHORT] = { 0 };
struct timeval timeout;
int i = 0;
fd_set fdvar;
-
-#if (SGI == 1) || (NEED_LIBC5 == 1)
+ struct stat st;
+#ifdef SA_NOCLDSTOP
struct sigaction newact;
#endif
+
#ifdef DEBUG
DebuG = 1;
#endif
- temp[0] = temp[0]; /* hide warning for WIN32 compile */
-
get_s ();
srand (time (0));
uptime = time (NULL);
+ strncpy (DARKBOT_BIN, argv[0], sizeof (DARKBOT_BIN));
+ strncpy (exe, argv[0], sizeof (exe)); /* Coz basename() may modify it's argument. */
+
+#ifdef DATABASEDIR
+ strncpy (DAT_DIR, DATABASEDIR, sizeof (DAT_DIR));
+#else
+ strncpy (DAT_DIR, "dat", sizeof (DAT_DIR));
+#endif
+#ifdef SOURCEDIR
+ /* Check if this is being run from the build directory before being installed. */
+ snprintf(temp, sizeof(temp), "%s/dat/setup.ini", SOURCEDIR);
+ if (stat(temp, &st) >= 0)
+ {
+ snprintf(temp, sizeof(temp), "%s/dat", SOURCEDIR);
+ strncpy(DAT_DIR, temp, sizeof (DAT_DIR));
+ }
+#endif
+
/* Parse the command line arguements, if there are any. */
if (argv[1] != NULL)
{
for (i = 1; i < argc; i++)
{
if (argv[i][0] == '-')
{
if (argv[i][1] == 'S')
{
- SeeN = 1;
+ SeeN = true;
}
else if (argv[i][1] == 'D')
{
DebuG = 1;
}
else if (argv[i][1] == 'I')
{
strcpy (DAT_DIR, argv[++i]);
printf ("DAT_DIR: Using %s.\n", DAT_DIR);
}
else
{
printf ("\n\n%s HELP:\n\n", dbVersion);
printf ("%s (Launches Darkbot to IRC)\n", argv[0]);
printf ("%s -SEEN (Enables SEEN [Even if SEEN is undefined])\n", argv[0]);
printf ("%s -DEBUG (Launch in debug mode)\n", argv[0]);
exit (0);
}
}
}
}
- if (SeeN == 1)
+ if (SeeN)
{
printf ("\nSEEN ENABLED.\n");
}
if (DebuG == 1)
{
printf ("\nDEBUG ENABLED.\n");
}
- strncpy (DARKBOT_BIN, argv[0], sizeof (DARKBOT_BIN));
- strncpy (DAT_DIR, "dat", sizeof (DAT_DIR));
-
set_paths ();
-#if (SGI == 1) || (NEED_LIBC5 == 1)
+/* This is the best way to deternmine if sigaction() can be used.
+ * sigaction() is more portable than signal(), so use it if we can. */
+#ifdef SA_NOCLDSTOP
newact.sa_handler = sig_alrm;
sigemptyset (&newact.sa_mask);
newact.sa_flags = 0;
sigaction (SIGALRM, &newact, NULL);
newact.sa_handler = sig_segv;
sigemptyset (&newact.sa_mask);
newact.sa_flags = 0;
sigaction (SIGSEGV, &newact, NULL);
newact.sa_handler = sig_hup;
sigemptyset (&newact.sa_mask);
newact.sa_flags = 0;
sigaction (SIGHUP, &newact, NULL);
-#else /* ----------------------- */
+#else
signal (SIGALRM, sig_alrm);
signal (SIGSEGV, sig_segv);
signal (SIGHUP, sig_hup);
#endif
-#ifndef WIN32
-#ifdef FORK
- if (fork ())
- exit (0);
-#endif
-#endif
-#ifdef RANDOM_STUFF
+
+#ifdef ENABLE_RANDOM
get_rand_stuff_time ();
#endif
printf ("\n\n\n");
- printf (" * * * * * * * * * * Darkbot, (c) 2006 ver. 7 final 3 * * * * * * * * * * \n");
+ printf (" * * * * * * * * Darkbot (c) 1996 v8 Release Candidate 4 * * * * * * * * * \n");
printf (" * The IRC Talking Robot * \n");
printf (" * * \n");
printf (" * Creator/Author: Jason <jason@superlink.net> * \n");
printf (" * Project Administrator: juice <juice@freezedown.org> * \n");
printf (" * Last major code changes: ron <ron@freezedown.org> * \n");
+ printf (" * Last major code changes: onefang <onefang@gmail.com> * \n");
printf (" * Please check docs/contributors for a list of collaborators * \n");
printf (" * * \n");
printf (" * Eventual malfunction, suggestions or patches use only * \n");
printf (" * Support Forum @ http://forum.freezedown.org * \n");
printf (" * * \n");
printf (" * By running this installation you agree that this program is provided * \n");
printf (" * free for non-commercial use only; - Distribution of modified source * \n");
printf (" * code or binaries compiled from modified source code for any platform * \n");
printf (" * or OS is expressly forbidden. - This program is only available at * \n");
printf (" * http://www.freezedown.org * \n");
printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n");
#ifndef WIN32
-#ifndef DISALLOW_COUNT
+# ifdef ENABLE_VERSION_CHECK
snprintf (temp, sizeof (temp), "lynx -source http://www.freezedown.org/cgi/laun.cgi?%s &", dbVersion);
system (temp);
-#endif
- /* Added the cast to getpid() to remove warnings on Solaris */
- sprintf (temp, "echo \"%d\" > %s.pid", (int) getpid (), DARKBOT_BIN);
- system (temp);
-#endif
-#ifndef WIN32
+# endif
db_sleep (2);
-#endif
-#ifndef WIN32
-#ifdef SORT
- printf ("Sorting database...\n");
- snprintf (temp, sizeof (temp), "sort %s -o %s\n", URL2, URL2);
- system (temp);
-#endif
+ if (SORT)
+ {
+ printf ("Sorting database...\n");
+ snprintf (temp, sizeof (temp), "sort %s -o %s\n", URL2, URL2);
+ system (temp);
+ }
#endif
load_helpers ();
+#ifdef ENABLE_STATS
load_stats ();
+#endif
check_files ();
raw_now ("SERVERS");
raw_now ("SETUP");
raw_now ("PERMBAN");
-#ifndef WIN32
-#endif
alarm (AIL);
prepare_bot ();
register_bot ();
while (1)
{
timeout.tv_sec = WSEC;
timeout.tv_usec = USEC;
FD_ZERO (&fdvar);
FD_SET (socketfd, &fdvar);
- switch (select (NFDBITS, &fdvar, (fd_set *) 0, (fd_set *) 0, &timeout))
+ switch (select (NFDBITS, &fdvar, (fd_set *) NULL, (fd_set *) NULL, &timeout))
{
case 0:
break;
case -1:
if (!alarmed)
{
db_sleep (RECHECK);
}
else
alarmed = 0;
break;
default:
parse_server_msg (&fdvar);
break;
}
}
}
void set_paths (void)
{
snprintf (DBTIMERS_PATH, sizeof (DBTIMERS_PATH), "%s/%s", DAT_DIR, DEFAULT_DBTIMERS_PATH);
snprintf (LOG_DIR, sizeof (LOG_DIR), "%s/%s", DAT_DIR, DEFAULT_LOG_DIR);
snprintf (RDB_DIR, sizeof (RDB_DIR), "%s/%s", DAT_DIR, DEFAULT_RDB_DIR);
+#ifdef ENABLE_STATS
snprintf (STATS_FILE, sizeof (STATS_FILE), "%s/%s", DAT_DIR, DEFAULT_STATS_FILE);
+#endif
snprintf (SEEN_FILE, sizeof (SEEN_FILE), "%s/%s", DAT_DIR, DEFAULT_SEEN_FILE);
snprintf (URL2, sizeof (URL2), "%s/%s", DAT_DIR, DEFAULT_URL2);
snprintf (BACKUP_DUP, sizeof (BACKUP_DUP), "%s/%s", DAT_DIR, DEFAULT_BACKUP_DUP);
snprintf (AUTOTOPIC_F, sizeof (AUTOTOPIC_F), "%s/%s", DAT_DIR, DEFAULT_AUTOTOPIC_F);
snprintf (HELPER_LIST, sizeof (HELPER_LIST), "%s/%s", DAT_DIR, DEFAULT_HELPER_LIST);
snprintf (QUIZ_FILE, sizeof (QUIZ_FILE), "%s/%s", DAT_DIR, DEFAULT_QUIZ_FILE);
snprintf (PERFORM, sizeof (PERFORM), "%s/%s", DAT_DIR, DEFAULT_PERFORM);
snprintf (DEOP, sizeof (DEOP), "%s/%s", DAT_DIR, DEFAULT_DEOP);
snprintf (RAND_SAY, sizeof (RAND_SAY), "%s/%s", DAT_DIR, DEFAULT_RAND_SAY);
snprintf (RAND_FILE, sizeof (RAND_FILE), "%s/%s", DAT_DIR, DEFAULT_RAND_FILE);
snprintf (RANDQ_TEMPFILE, sizeof (RANDQ_TEMPFILE), "%s/%s", DAT_DIR, DEFAULT_RANDQ_TEMPFILE);
snprintf (RAND_BACKUP_FILE, sizeof (RAND_BACKUP_FILE), "%s/%s", DAT_DIR, DEFAULT_RAND_BACKUP_FILE);
snprintf (SERVERS, sizeof (SERVERS), "%s/%s", DAT_DIR, DEFAULT_SERVERS);
snprintf (PERMBAN, sizeof (PERMBAN), "%s/%s", DAT_DIR, DEFAULT_PERMBAN);
snprintf (SETUP, sizeof (SETUP), "%s/%s", DAT_DIR, DEFAULT_SETUP);
}
diff --git a/source/parse.c b/source/parse.c
index 4640b99..ee9d492 100755
--- a/source/parse.c
+++ b/source/parse.c
@@ -1,504 +1,504 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
/**
* TODO: No function should ever be this long...move to the Command Pattern
*/
void
parse (char *line)
{
- char *s = NULL, *s1 = NULL, *s2 = NULL, *s3 = NULL, *cmd = NULL, *ptr = NULL;
-#if BAN_BY_HOST == ON
- char *s4 = NULL;
-#endif
+ char *s = NULL, *s1 = NULL, *s2 = NULL, *s3 = NULL, *s4 = NULL, *cmd = NULL, *ptr = NULL;
long TOG = 0, seen_value = 0;
LastInput = 0;
if (DebuG == 1)
- printf ("IN :%s\n", line);
+ printf ("IN: %s", line);
#ifdef DEBUG2
- db_log ("darkbot_debug.log", "IN :%s\n", line);
+ db_log ("darkbot_debug.log", "IN: %s", line);
#endif
stripline (line);
s = strtok (line, " ");
- if (stricmp (s, "PING") == 0)
+ if (strcasecmp (s, "PING") == 0)
{
s1 = strtok (NULL, " ");
Snow ("PONG %s\n", s1);
}
- else if (stricmp (s, "ERROR") == 0)
+ else if (strcasecmp (s, "ERROR") == 0)
{
s1 = strtok (NULL, "");
if (s1 != NULL)
{
if (strstr (s1, "Excess Flood") != NULL)
{
prepare_bot ();
register_bot ();
}
else if (strstr (s1, "throttled") != NULL)
{
prepare_bot ();
register_bot ();
}
else if (strstr (s1, "oo many c") != NULL)
{
prepare_bot ();
register_bot ();
}
else if (strstr (s1, "o more c") != NULL)
{
prepare_bot ();
register_bot ();
}
else
{
S ("QUIT :Caught ERROR from %s :(\n", BS);
db_sleep (5);
prepare_bot ();
register_bot ();
}
}
}
else if (strstr (s, "!") == NULL)
{ /* From Server */
cmd = strtok (NULL, " ");
- if (stricmp (cmd, "004") == 0)
+ if (strcasecmp (cmd, "004") == 0)
{ /* Connected! */
save_changes ();
s2 = strtok (NULL, " "); /* Copy the current nick */
strncpy (Mynick, s2, sizeof (Mynick));
snprintf (NICK_COMMA, sizeof (NICK_COMMA), "%s,", Mynick);
snprintf (COLON_NICK, sizeof (COLON_NICK), "%s:", Mynick);
snprintf (BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", Mynick);
s2 = strtok (NULL, " "); /* Got server name */
}
- else if (stricmp (cmd, "315") == 0)
+ else if (strcasecmp (cmd, "315") == 0)
{
-#if DISPLAY_SYNC == 1
- s2 = strtok (NULL, " "); /*mynick */
- strncpy (Mynick, s2, sizeof (Mynick));
- s2 = strtok (NULL, " "); /* chan */
- S ("PRIVMSG %s :Sync with %s completed.\n", s2, s2);
-#endif
+ if (DISPLAY_SYNC)
+ {
+ s2 = strtok (NULL, " "); /*mynick */
+ strncpy (Mynick, s2, sizeof (Mynick));
+ s2 = strtok (NULL, " "); /* chan */
+ S ("PRIVMSG %s :Sync with %s completed.\n", s2, s2);
+ }
}
- else if (stricmp (cmd, "311") == 0)
+ else if (strcasecmp (cmd, "311") == 0)
{
s1 = strtok (NULL, " ");
s1 = strtok (NULL, " ");
s1 = strtok (NULL, " ");
s1 = strtok (NULL, " ");
strncpy (g_host, s1, sizeof (g_host));
}
- else if (stricmp (cmd, "319") == 0)
+ else if (strcasecmp (cmd, "319") == 0)
{
s1 = strtok (NULL, " ");
s1 = strtok (NULL, " ");
s2 = strtok (NULL, "");
if (*s2 == ':')
s2++;
strlwr (s2);
if (strstr (s2, "arez") != NULL)
TOG = 1;
if (strstr (s2, "kidd") != NULL)
TOG = 1;
if (strstr (s2, "hack") != NULL)
TOG = 1;
if (strstr (s2, "sex") != NULL)
TOG = 1;
if (strstr (s2, "fuck") != NULL)
TOG = 1;
if (strstr (s2, "porn") != NULL)
TOG = 1;
if (strstr (s2, "pic") != NULL)
TOG = 1;
if (TOG == 1)
{
S ("NOTICE @%s :%s is on \2%s\2\n", g_chan, s1, s2);
return;
}
}
- else if (stricmp (cmd, "432") == 0 || stricmp (cmd, "468") == 0)
+ else if (strcasecmp (cmd, "432") == 0 || strcasecmp (cmd, "468") == 0)
{ /* Invalid nick/user */
s2 = strtok (NULL, "");
printf ("Server Reported error %s\n\nDarkbot exiting.\n", s2);
db_sleep (2);
exit (0);
}
- else if ((stricmp (cmd, "376") == 0) || (stricmp(cmd, "422") == 0))
+ else if ((strcasecmp (cmd, "376") == 0) || (strcasecmp(cmd, "422") == 0))
{
/* Set default umodes */
S ("MODE %s %s\n", Mynick, DEFAULT_UMODE);
run_perform (); /* Run performs */
S ("JOIN %s\n", CHAN);
}
- else if (stricmp (cmd, "482") == 0)
+ else if (strcasecmp (cmd, "482") == 0)
{
-#if BITCH_ABOUT_DEOP == 1
- s2 = strtok (NULL, " "); /* mynick */
- strncpy (Mynick, s2, sizeof (Mynick));
- s2 = strtok (NULL, " "); /* chan */
- /* We used to run the DEOP.INI here */
+#ifdef ENABLE_CHANNEL
+ if (BITCH_ABOUT_DEOP)
+ {
+ s2 = strtok (NULL, " "); /* mynick */
+ strncpy (Mynick, s2, sizeof (Mynick));
+ s2 = strtok (NULL, " "); /* chan */
+ /* We used to run the DEOP.INI here */
+ }
#endif
}
- else if (stricmp (cmd, "352") == 0)
+ else if (strcasecmp (cmd, "352") == 0)
{
s2 = strtok (NULL, "");
parse_who (s2);
-#if STATUS == 1
+#ifdef ENABLE_STATUS
}
- else if (stricmp (cmd, "252") == 0)
+ else if (strcasecmp (cmd, "252") == 0)
{
s2 = strtok (NULL, "");
parse_252 (s2);
}
- else if (stricmp (cmd, "404") == 0
- || stricmp (cmd, "475") == 0
- || stricmp (cmd, "474") == 0 || stricmp (cmd, "473") == 0)
+ else if (strcasecmp (cmd, "404") == 0
+ || strcasecmp (cmd, "475") == 0
+ || strcasecmp (cmd, "474") == 0 || strcasecmp (cmd, "473") == 0)
{ /* Can't join? */
s2 = strtok (NULL, " ");
s2 = strtok (NULL, " ");
db_sleep (5);
S ("JOIN %s\n", s2);
}
- else if (stricmp (cmd, "251") == 0)
+ else if (strcasecmp (cmd, "251") == 0)
{
s2 = strtok (NULL, "");
parse_251 (s2);
}
- else if (stricmp (cmd, "255") == 0)
+ else if (strcasecmp (cmd, "255") == 0)
{
s2 = strtok (NULL, "");
parse_255 (s2);
#endif
}
- else if (stricmp (cmd, "433") == 0)
+ else if (strcasecmp (cmd, "433") == 0)
{
s2 = strtok (NULL, " ");
if (*s2 != '*')
{
strncpy (Mynick, s2, sizeof (Mynick));
snprintf (NICK_COMMA, sizeof (NICK_COMMA), "%s,", Mynick);
snprintf (COLON_NICK, sizeof (COLON_NICK), "%s:", Mynick);
snprintf (BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", Mynick);
s3 = strtok (NULL, " ");
}
else
{
Snow ("NICK %s%d\n", Mynick, xtried);
xtried++;
if (xtried > 15)
Snow ("NICK _`^%s%d\n", Mynick, xtried);
if (xtried > 5)
Snow ("NICK _%s%d\n", Mynick, xtried);
}
}
}
else
{ /* Info from user */
if (*s == ':') /* Remove the colon prefix */
s++;
cmd = strtok (NULL, " "); /* Read in command */
- if (stricmp (cmd, "NOTICE") == 0)
+ if (strcasecmp (cmd, "NOTICE") == 0)
{
+#ifdef ENABLE_CHANNEL
s2 = strtok (NULL, " "); /* target */
-#if KICK_ON_CHANNEL_NOTICE == ON
- if (*s2 == '#')
+ if ((KICK_ON_CHANNEL_NOTICE) && (*s2 == '#'))
{
s3 = strtok (s, "!");
-#if BAN_ON_CHANNEL_NOTICE == ON
-#if BAN_BY_HOST == ON
- s4 = strtok (NULL, "@");
- s4 = strtok (NULL, "");
- S ("MODE %s +b *!*@%s\n", s2, s4);
-#else /* ban just by u@h */
- S ("MODE %s +b *%s\n", s2, strtok (NULL, ""));
-#endif
-#endif
+ if (BAN_ON_CHANNEL_NOTICE)
+ {
+ if (BAN_BY_HOST)
+ {
+ s4 = strtok (NULL, "@");
+ s4 = strtok (NULL, "");
+ S ("MODE %s +b *!*@%s\n", s2, s4);
+ }
+ else /* ban just by u@h */
+ S ("MODE %s +b *%s\n", s2, strtok (NULL, ""));
+ }
S ("KICK %s %s :Punt\n", s2, s3);
}
#endif
}
- else if (stricmp (cmd, "PRIVMSG") == 0)
+ else if (strcasecmp (cmd, "PRIVMSG") == 0)
{ /* PRIVMSG */
s1 = strtok (NULL, " "); /* Target */
s2 = strtok (NULL, ""); /* Rest */
-#if LOG_PRIVMSG == 1
- if (*s1 != '#' && *s1 != '&')
+ if ((LOG_PRIVMSG) && (*s1 != '#') && (*s1 != '&'))
{
db_log (privmsg_log, "[%s] %s %s %s\n", date (), s, s1, s2);
}
-#endif
if (*s1 == '#' || *s1 == '&' || *s1 == '+')
if (do_lastcomm (s, s1, s2) == 1)
return;
chanserv (s, s1, s2); /* Process PRIVMSG commands */
}
- else if (stricmp (cmd, "KILL") == 0)
+ else if (strcasecmp (cmd, "KILL") == 0)
{
s1 = strtok (NULL, " "); /* Kill nick */
- if (stricmp (s1, Mynick) == 0)
+ if (strcasecmp (s1, Mynick) == 0)
{
do_quit (s1, 3); /* delete all users from ram since I'm gone */
prepare_bot ();
register_bot ();
}
}
- else if (stricmp (cmd, "KICK") == 0)
+ else if (strcasecmp (cmd, "KICK") == 0)
{
s1 = strtok (NULL, " "); /* #chan */
s2 = strtok (NULL, " "); /* Who got kicked? */
- if (stricmp (s2, Mynick) == 0)
+ if (strcasecmp (s2, Mynick) == 0)
{ /* Rejoin if I was
* kicked */
do_quit (s1, 2);
db_sleep (5);
S ("JOIN %s\n", s1);
S ("PRIVMSG %s :%s\n", s1, COMPLAIN_REASON);
}
else
delete_user (s2, s1);
}
- else if (stricmp (cmd, "INVITE") == 0)
+ else if (strcasecmp (cmd, "INVITE") == 0)
{
s1 = strtok (NULL, " "); /* Mynick */
s2 = strtok (NULL, " "); /* Target */
if (*s2 == ':')
s2++;
- if (stricmp (s2, CHAN) == 0)
+ if (strcasecmp (s2, CHAN) == 0)
S ("JOIN %s\n", s2);
}
- else if (stricmp (cmd, "PART") == 0)
+ else if (strcasecmp (cmd, "PART") == 0)
{
if ((ptr = strchr (s, '!')) != NULL)
*ptr++ = '\0';
// Channel
s1 = strtok (NULL, " ");
// Make sure the first character in the target operative is not a :.
if (*s1 == ':')
s1++;
/*
* If we are parting the channel, remove all users in that channel from
* memory. If someone else is parting, only remove them from memory.
*/
- if (stricmp (s, Mynick) != 0)
+ if (strcasecmp (s, Mynick) != 0)
delete_user (s, s1);
else
do_quit (s1, 2);
}
- else if (stricmp (cmd, "QUIT") == 0)
+ else if (strcasecmp (cmd, "QUIT") == 0)
{
if ((ptr = strchr (s, '!')) != NULL)
*ptr++ = '\0';
do_quit (s, 1);
}
- else if (stricmp (cmd, "MODE") == 0)
+ else if (strcasecmp (cmd, "MODE") == 0)
{
do_modes (s, strtok (NULL, ""));
}
- else if (stricmp (cmd, "NICK") == 0)
+ else if (strcasecmp (cmd, "NICK") == 0)
{
if ((ptr = strchr (s, '!')) != NULL)
*ptr++ = '\0';
s1 = strtok (NULL, " ");
process_nick (s, s1);
}
- else if (stricmp (cmd, "JOIN") == 0)
+ else if (strcasecmp (cmd, "JOIN") == 0)
{
JOINs++;
s1 = strtok (NULL, " "); /* TARGET */
if (*s1 == ':')
s1++;
if ((ptr = strchr (s, '!')) != NULL)
*ptr++ = '\0';
strlwr (ptr);
- if (SeeN == 1 && *s1 == '#')
+ if ((SeeN) && (*s1 == '#'))
seen_value = save_seen (s, ptr, s1);
- if (stricmp (s, Mynick) != 0)
+ if (strcasecmp (s, Mynick) != 0)
{
if (check_permban (ptr, s1, s) == 1)
return;
add_user (s1, s, ptr, 1);
-#if AUTOHELP_GUESTS == 1
- if (strstr (s, "Guest") != NULL)
+ if ((AUTOHELP_GUESTS) && (strstr(s, "Guest") != NULL))
S ("PRIVMSG %s :hello %s. need any help?\n", s);
-#endif
-#if DO_WHOIS == 1
- strncpy (g_chan, s1, sizeof (g_chan));
- S ("WHOIS %s\n", s);
-#endif
+ if (DO_WHOIS)
+ {
+ strncpy (g_chan, s1, sizeof (g_chan));
+ S ("WHOIS %s\n", s);
+ }
+
if (check_access (ptr, s1, 0, s) >= 4)
{
S ("MODE %s +o %s\n", s1, s);
}
else if (check_access (ptr, s1, 1, s) >= 1)
{
-#if VOICE_USERS_ON_JOIN == 1
- S ("MODE %s +v %s\n", s1, s);
+#ifdef ENABLE_CHANNEL
+ if (VOICE_USERS_ON_JOIN)
+ S ("MODE %s +v %s\n", s1, s);
#endif
-#if HELP_GREET == 1
}
- else if (check_access (ptr, s1, 0, s) >= 1)
+ else if ((HELP_GREET) && (check_access(ptr, s1, 0, s) >= 1))
{
return; /* don't greet if the guy has
* access (and no setinfo) */
}
- else if (stricmp (s1, CHAN) == 0)
+ else if ((HELP_GREET) && (strcasecmp(s1, CHAN) == 0))
{
- if (SeeN == 1)
+ if (SeeN)
{
if (seen_value == 0) /* don't show people the
* notice every join */
if (setinfo_lastcomm (s1) == 0) /* don't do it if you just did it! */
L102 (s, s1, s, *CMDCHAR);
}
else
{
if (setinfo_lastcomm (s1) == 0)
L102 (s, s1, s, *CMDCHAR);
}
}
-#else
- }
-#endif
}
else
S ("WHO %s\n", s1); /* Check who is in the
* chan */
} /* JOIN */
}
}
void
parse_who (char *data)
{
- char *chan = NULL, *nick = NULL, *ptr = NULL, b[STRING_SHORT] = { 0 };
+ char *chan = NULL, *nick = NULL, *ptr = NULL, *flags = NULL, b[STRING_SHORT] = { 0 };
nick = strtok (data, " "); /* botnick */
strncpy (Mynick, nick, sizeof (Mynick));
chan = strtok (NULL, " ");
ptr = strtok (NULL, " ");
snprintf (b, sizeof (b), "%s@%s", ptr, strtok (NULL, " "));
nick = strtok (NULL, " "); /* server */
nick = strtok (NULL, " ");
+ flags = strtok (NULL, " ");
add_user (chan, nick, b, 1);
+
+ if (strstr (flags, "@") != NULL)
+ do_op(nick, chan, 1);
}
-#if STATUS == 1
+#ifdef ENABLE_STATUS
void
parse_252 (char *s)
{
char *tmp = NULL;
int numb = 0;
tmp = strtok (s, " ");
tmp = strtok (NULL, " ");
sscanf (tmp, "%d", &numb);
IRCOPS = numb;
}
-#endif
-#if STATUS == 1
void
parse_251 (char *s)
{
char *tmp = NULL;
int numb = 0, r = 0, i = 0;
/*- Read and chuck useless data from line 'b' -*/
tmp = strtok (s, " ");
tmp = strtok (NULL, " ");
tmp = strtok (NULL, " ");
tmp = strtok (NULL, " ");
sscanf (tmp, "%d", &r);
tmp = strtok (NULL, " ");
tmp = strtok (NULL, " ");
tmp = strtok (NULL, " ");
sscanf (tmp, "%d", &i);
tmp = strtok (NULL, " ");
tmp = strtok (NULL, " ");
tmp = strtok (NULL, " ");
sscanf (tmp, "%d", &numb);
NUM_SERV = numb;
G_USERS = r + i;
}
-#endif
-#if STATUS == 1
void
parse_255 (char *s)
{
char *tmp = NULL, Stat[1] = { 0 };
int numb = 0, pre_CLIENTS = 0;
/* test321 :I have 1313 clients and 1 servers */
strlwr (s);
tmp = strtok (s, " ");
tmp = strtok (NULL, " ");
tmp = strtok (NULL, " ");
tmp = strtok (NULL, " ");
numb = atoi (tmp);
pre_CLIENTS = L_CLIENTS;
L_CLIENTS = numb;
if (L_CLIENTS < pre_CLIENTS)
{
strncpy (Stat, "-", sizeof (Stat));
pre_CLIENTS = pre_CLIENTS - L_CLIENTS;
}
else
{
strncpy (Stat, "+", sizeof (Stat));
pre_CLIENTS = L_CLIENTS - pre_CLIENTS;
}
snprintf (tmp, sizeof (tmp), "%3.2f", (float) (((float) L_CLIENTS / (float) G_USERS) * 100));
+/* FIXME: I don't see PLAY defined anywhere, is it left over from something else? */
#if PLAY == 1
+#define PBOT "ArchFiend"
if (pre_CLIENTS == 0 || pre_CLIENTS == L_CLIENTS)
{
S ("PRIVMSG %s :!SENDQ %d srvs, %d ops, %d users (%s%% of %d, %ld avg)\n", PBOT, NUM_SERV,
IRCOPS, L_CLIENTS, tmp, G_USERS, G_USERS / NUM_SERV);
}
else
S ("PRIVMSG %s :!SENDQ %d srvs, %d ops, %d users [%c%2d] (%s%% of %d, %ld avg)\37\n", PBOT,
NUM_SERV, IRCOPS, L_CLIENTS, Stat[0], pre_CLIENTS, tmp, G_USERS, G_USERS / NUM_SERV);
db_log (".ubcount", "%d\n%d\n0\n0\n", L_CLIENTS, L_CLIENTS);
rename (".ubcount", "/usr/local/apache/htdocs/usage/userbase/userbase.dat");
db_log (".glcount", "%d\n%d\n0\n0\n", G_USERS, G_USERS);
rename (".glcount", "/usr/local/apache/htdocs/usage/global/global.dat");
#else
if (pre_CLIENTS == 0 || pre_CLIENTS == L_CLIENTS)
{
- S ("PRIVMSG %s :\1ACTION \37(\37%2d servers\37)\37: %2d opers + \2%4d\2 users \37(\37%s%% %5d global \2!\2 %3ld avg\37)\37\1\n", CHAN, NUM_SERV, IRCOPS, L_CLIENTS, tmp, G_USERS, G_USERS / NUM_SERV);
+ S ("PRIVMSG %s :\1ACTION \37(\37%2d servers\37)\37: %2d opers + \2%4d\2 users \37(\37%s%% %5d global \2!\2 %3ld avg\37)\37\1\n", CHAN, NUM_SERV, IRCOPS, L_CLIENTS, tmp, G_USERS, NUM_SERV ? (G_USERS / NUM_SERV) : 0);
}
else
- S ("PRIVMSG %s :\1ACTION \37(\37%2d servers\37)\37: %2d opers + \2%4d\2 users [\37%c%2d\37] \37(\37%s%% %5d global \2!\2 %3ld avg\37)\37\1\n", CHAN, NUM_SERV, IRCOPS, L_CLIENTS, Stat[0], pre_CLIENTS, tmp, G_USERS, G_USERS / NUM_SERV);
+ S ("PRIVMSG %s :\1ACTION \37(\37%2d servers\37)\37: %2d opers + \2%4d\2 users [\37%c%2d\37] \37(\37%s%% %5d global \2!\2 %3ld avg\37)\37\1\n", CHAN, NUM_SERV, IRCOPS, L_CLIENTS, Stat[0], pre_CLIENTS, tmp, G_USERS, NUM_SERV ? (G_USERS / NUM_SERV) : 0);
#endif
}
#endif
void
parse_server_msg (fd_set * read_fds)
{
if (FD_ISSET (socketfd, read_fds))
{
if (readln () > 0)
{
NUMLINESSEEN++;
parse (L);
}
else
{
close (socketfd);
}
}
}
diff --git a/source/permbans.c b/source/permbans.c
index 1c417be..f7a4415 100755
--- a/source/permbans.c
+++ b/source/permbans.c
@@ -1,216 +1,219 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
/**
* Add a permban to the permban list.
* 6/23/00 Dan:
* - Both pointer variables are now received as pointer to const data
* - Changed counter to type size_t, this should be an unsigned type
* - Initialiazed n to 0 on declaration
* - Added support for dynamically allocated uh and reason fields
* in the struct permban list
* - Did some extra memory leak prevention
*/
void
add_permban (const char *uh, size_t counter, const char *reason)
{
struct permbanlist *n = 0;
n = malloc (sizeof (struct permbanlist));
if (n == NULL)
{
db_log ("error.log", "AHHH! no ram left! in add_permban!\n");
return;
}
memset (n, 0, sizeof (struct permbanlist));
- n->uh = db_strndup (uh, STRING_SHORT);
+ n->uh = strndup (uh, STRING_SHORT);
if (NULL == n->uh)
{
db_log ("error.log", "add_permban> Memory allocation failure\n");
/* Prevent memory leaks */
free (n);
return;
}
- n->reason = db_strndup (reason, STRING_SHORT);
+ n->reason = strndup (reason, STRING_SHORT);
if (NULL == n->reason)
{
db_log ("error.log", "add_permban> Memory allocation failure\n");
/* Prevent memory leaks */
free (n->uh);
free (n);
return;
}
strlwr (n->uh);
n->counter = counter;
PERMBAN_counter++;
n->next = permbanhead;
permbanhead = n;
}
/**
* Check if a permban exists for a given uh/channel/nick set.
* 6/23/00 Dan:
* - Changed all method arguments to be pointers to const data
* - Return type is now bool, returns true if ban is found,
* false otherwise
*/
bool
check_permban (const char *uh, const char *chan, const char *nick)
{
char tmpBuf[STRING_SHORT + 1] = { 0 };
struct permbanlist *c = permbanhead;
size_t len = 0;
- len = min ( STRING_SHORT, strlen (uh) );
+ len = MIN(STRING_SHORT, strlen(uh));
strncpy (tmpBuf, uh, len);
tmpBuf[len] = '\0';
strlwr (tmpBuf);
for (; c != NULL; c = c->next)
{
if (!match_wild (c->uh, tmpBuf) == 0)
{
c->counter++;
S ("MODE %s +b %s\n", chan, c->uh);
S ("KICK %s %s :\2[\2%d\2]\2: %s\n", chan, nick, c->counter, c->reason);
return true;
}
}
return false;
}
-#if DO_CHANBOT_CRAP == 1
+#ifdef ENABLE_CHANNEL
/**
* Remove a permban based on nickname and user@host.
* 6/23/00 Dan:
* - Both arguments are now pointers to const data
* - Added free() for both pNode->uh and pNode->reason now
* that the permbanlist has dynamically allocated fields
* - Changed type of toggle from long to bool
* - Changed name of toggle variable to (foundBan)
* - permbanlist pointers are now initialized when declared
* - Added if statement at end of method, this will only save
* the bans if a ban was removed
*/
int
del_permban (const char *nick, const char *uh)
{
bool foundBan = false;
struct permbanlist *pNode = permbanhead, *pPrev = 0;
+ int i = 0;
while (pNode)
{
- if (stricmp (pNode->uh, uh) == 0)
+ if (strcasecmp (pNode->uh, uh) == 0)
{
L002 (nick, PERMBAN_counter, uh);
PERMBAN_counter--;
if (pPrev != NULL)
{
pPrev->next = pNode->next;
}
else
{
permbanhead = pNode->next;
}
free (pNode->uh);
free (pNode->reason);
free (pNode);
foundBan = true;
pNode = NULL;
break;
}
pPrev = pNode;
pNode = pNode->next;
}
if (foundBan)
{
/* Only need to save bans if ban list has changed */
save_permbans ();
}
return foundBan;
}
-#endif
-#if DO_CHANBOT_CRAP == 1
/**
* Save the permban list to file.
* 6/23/00 Dan:
* - the permbanlist pointer (c) is now pointer to const, because
* this is a read only method, and that is a read only variable
* - Initialized c when it is declared
*/
void
save_permbans (void)
{
const struct permbanlist *c = permbanhead;
remove (TMP_FILE);
- remove (PERMBAN);
-#ifdef WIN32
printf ("*** Writing permbans: %s (%s)\n", PERMBAN, date ());
-#endif
for (; c != NULL; c = c->next)
{
db_log (TMP_FILE, "%s %d %s\n", c->uh, c->counter, c->reason);
}
-
rename (TMP_FILE, PERMBAN);
if (PERMBAN_counter == 0)
remove (PERMBAN);
}
#endif
/**
* 6/22 Dan
* - Changed DATA to be 512 bytes, a power of 2
* - DATA now initialized properly
* - c is now a pointer to const, this is a read only method
* - c is now initialized where declared
* - Changed type of i, x to size_t, these variables should be
* unsigned.
* - Changed while loop to for loop.
* - Changed reinitialization of DATA to use memset()
*/
void
show_banlist (const char *nick)
{
char DATA[STRING_SHORT * 7] = { 0 };
- char tmp [STRING_SHORT] = { 0 };
+ char tmp [STRING_SHORT * 7] = { 0 };
size_t i = 0, x = 0;
const struct permbanlist *c = 0;
for (c = permbanhead; c != NULL; c = c->next)
{
i++;
++x;
- snprintf (tmp, sizeof(tmp), "%s", DATA);
- snprintf (DATA, (sizeof(DATA) + sizeof(tmp)), "%s %s:%d",
- tmp, c->uh, c->counter);
- memset (tmp, 0, sizeof(tmp));
- //if (i > 8)
- if (i > 6)
+ snprintf (tmp, sizeof (tmp), "%s", DATA);
+ snprintf (DATA, sizeof(DATA), "%s %s:%u",
+ tmp, c->uh, c->counter);
+ memset (tmp, 0, sizeof (tmp));
+
+ /* Only show at max 6 bans per message sent. */
+ if (i >= 6)
{
S ("NOTICE %s :%s\n", nick, DATA);
i = 0;
memset (DATA, 0, sizeof (DATA));
- db_sleep (2);
}
}
- S ("NOTICE %s :%s\n", nick, DATA);
+
+ /* If 'i' never reaches 6 on the last pass through the while loop,
+ * and there are bans yet to be shown, act accordingly.
+ */
+
+ if (i > 0)
+ {
+ S ("NOTICE %s :%s\n", nick, DATA);
+ }
+
S ("NOTICE %s :End of PERMBAN list; %d ban%s found.\n", nick, x, (x == 1) ? "" : "s");
}
-
diff --git a/source/prototypes.h b/source/prototypes.h
index 7b2e4f6..d75ed3c 100755
--- a/source/prototypes.h
+++ b/source/prototypes.h
@@ -1,177 +1,175 @@
/* ------------ Below are function declarations --------------- */
-#if STATUS == 1
+
+#ifdef ENABLE_STATUS
void parse_252 (char *),
parse_251 (char *),
parse_255 (char *);
#endif
-#ifndef WIN32
-inline size_t min (const size_t, const size_t);
-#endif
-
-char *db_strndup (const char *, size_t);
char **tokenize (char *, size_t *);
size_t count_lines (char *);
void show_seen (char *, char *, char *),
count_seen (char *, char *),
- show_info2 (const char *, const char *);
+ show_info2 (const char *, const char *, enum chanserv_invoke_type);
long save_seen (char *, char *, char *);
void do_randomtopic (int, char *, char *, char *, char *);
+int get_random_integer (int max);
-#ifdef RANDOM_STUFF
+#ifdef ENABLE_RANDOM
void do_random_stuff (void),
check_idle_channels (void),
get_rand_stuff_time (void),
del_autotopic (const char *),
add_randomstuff (char *, char *, char *),
do_autotopics (void);
#endif
-#ifdef RANDQ
+#ifdef ENABLE_RANDQ
void do_randq (char *, const int, const char *, const char *);
#endif
void datasearch (const char *, char *, char *),
display_url (char *, char *, char *),
set_pass (char *, char *, char *, char *),
do_modes (char *, char *),
process_nick (char *, char *);
long verify_pass (char *, char *, char *, char *),
ifexist_autotopic (char *);
-#if DO_CHANBOT_CRAP == 1
+#ifdef ENABLE_CHANNEL
void save_permbans (void);
#endif
void do_quit (const char *, long);
-#ifdef DO_MATH_STUFF
+#ifdef ENABLE_MATH
void do_math (const char *, char *, char *);
#endif
void parse_who (char *);
void set_autotopic (char *, char *, char *);
void delete_user_ram (char *, char *),
get_s (void),
delete_url (const char *, char *, char *),
update_setinfo (const char *, const char *, const char *);
-#if DO_CHANBOT_CRAP == 1
+#ifdef ENABLE_CHANNEL
void add_permban (const char *, size_t, const char *);
int del_permban (const char *, const char *);
#endif
int check_existing_url (const char *, char *, char *);
+void *check_nick_parameter (struct setup_parameter *parameter, char *ptr);
void show_helper_list (const char *, long),
set_paths (void),
show_banlist (const char *),
chanserv (char *, char *, char *),
raw_now (char *),
find_url (const char *, char *, char *),
save_changes (void),
show_url (char *, char *, char *, long, long, char *, long);
char *strlwr (char *),
*rand_reply (const char *),
*date (void),
*get_multiword_topic (char *),
*revert_topic (char *),
*get_rand_nick (const char *),
*get_word (long, char *, char *);
void info (const char *, char *),
load_helpers (void),
scan_chan_users (char *, char *, char *),
do_login (char *, char *);
-int stricmp (const char *, const char *);
long do_lastcomm (char *, char *, char *),
setinfo_lastcomm (char *);
void parse (char *),
add_helper (const char *, const char *, long, size_t,
const char *, const char *, char);
int get_connection (const char *, const char *, int),
readln (void),
writeln (const char *);
bool check_permban (const char *, const char *, const char *);
long cf (char *, char *, char *),
f_f (char *),
get_passwd (char *);
time_t return_useridle (const char *, const char *, int);
void a_f (char *),
reset_ (void),
delete_user (const char *, char *),
add_user (char *, char *, char *, long);
void set_fds (void),
sig_hup (int),
sig_segv (int),
save_setup (void);
void stripline (char *),
init_bot (void),
sig_alrm (int);
void parse_server_msg (fd_set *);
void trailing_blanks (char *),
db_log (const char *, const char *,...),
gs26 (void),
add_s25 (char *, long, char *),
add_banned_server (char *, char *),
S (const char *,...),
del_sendq (long),
clear_sendq (long, long);
char L[524],
- *random_word (char **);
-
-char *db_stristr (char *, char *);
+ *random_word (char **),
+ *plural (size_t);
int socketfd,
alarmed,
check_access (char *, char *, int, char *),
match_wild (const char *, const char *),
Send (void),
get_sendq_count (long);
void check_dbtimers (void);
void register_bot (void);
void prepare_bot (void);
int create_connection (char *, char *, long);
int Snow (const char *, ...);
void show_chaninfo (const char *, const char *, const char *);
void show_chanusers (const char *, const char *);
const char *run_program (const char *);
-#if SNPRINTF_SUPPORT == 1
-int snprintf (char *, size_t, const char *, ...);
-#endif
-
void do_autotopics (void);
+
+#ifdef ENABLE_STATS
void add_stats (char *, char *, long, long, long);
void load_stats (void);
void get_stats (char *, char *);
+#endif
+
+#ifdef ENABLE_QUIZ
void run_quiz_question (char *);
void run_quiz_answer (void);
+#endif
void check_files (void);
-char *crypt (const char *, const char *);
void run_perform (void);
-void init_sockaddr (struct sockaddr_in *, char *, unsigned short int);
int web_post_query (char *trigger, char *source, char *uh, char *target, char *query, int size);
-int web_open_socket (char *host, int port);
-int web_write_server (int filedes, char *format,...);
-int web_read_server (char *source, char *uh, char *target, int filedes, char *host);
-int google_parse_query (char *source, char *uh, char *target, char *data);
-int metar_parse_query (char *source, char *uh, char *target, char *data);
-int taf_parse_query (char *source, char *uh, char *target, char *data);
int add_ignore_user_ram (char *);
int delete_ignore_user_ram (char *);
int check_ignore_user_ram (char *);
+int check_exempt (char *);
void call_reserved_1 (char *, char *, char *);
void call_reserved_2 (char *, char *, char *);
size_t count_char (const char *, const char);
+bool isBoolean (char *aBoolean);
+void db_sleep (unsigned long seconds);
void reverse (char *);
char *mask_from_nick (char *, const char *);
char *uh_from_nick (char *, const char *);
+int db_argstostr (char *, char **, size_t, char);
+long is_op (char *, const char *);
+void do_op (char *, const char *, long);
+
+struct setup_parameter *set_parameter (char *input);
diff --git a/source/quiz.c b/source/quiz.c
index bb95bcd..12cbcd5 100755
--- a/source/quiz.c
+++ b/source/quiz.c
@@ -1,110 +1,108 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
+#ifdef ENABLE_QUIZ
void
run_quiz_question (char *target)
{
FILE *fp;
int i = 0;
int j = 0;
int k = 0;
int size = 0;
static int pos = 0;
char b[STRING_LONG] = { 0 };
char *ptr = NULL;
if (quiz_timer > 0)
return; /* timer already running */
- srand (time (0));
-
if ((fp = fopen (QUIZ_FILE, "r")) == NULL)
return;
while (fgets (b, sizeof (b), fp))
{
i++; /* count questions */
}
fseek (fp, 0L, SEEK_SET);
- j = rand () % i;
+ j = get_random_integer(i);
size = sizeof (recent_questions) / sizeof (recent_questions[0]);
if (i < size)
size = i / 2;
while (k <= size)
{
- srand (time (NULL));
-
if (j == recent_questions[k])
{
- j = rand () % i;
+ j = get_random_integer(i);
k = 0;
continue;
}
k++;
}
if (pos == size)
pos = 0;
recent_questions[pos] = j;
quiz_line = j;
pos++;
i = 0;
while (fgets (b, sizeof (b), fp))
{
if (i == quiz_line)
break;
i++;
}
if ((ptr = strtok (b, "@")) == NULL)
{
fclose (fp);
return;
}
S ("PRIVMSG %s :%s\n", target, ptr);
strncpy (quiz_target, target, sizeof (quiz_target));
quiz_answer = 1; /* switch on timer */
fclose (fp);
}
void
run_quiz_answer (void)
{
FILE *fp;
int i = 0;
char b[STRING_LONG] = { 0 };
char *ptr = NULL;
if ((fp = fopen (QUIZ_FILE, "r")) == NULL)
return;
while (fgets (b, sizeof (b), fp))
{
if (i == quiz_line)
break;
i++;
}
if ((ptr = strtok (b, "@")) == NULL)
{
fclose (fp);
return;
}
if ((ptr = strtok (NULL, "")) == NULL)
{
fclose (fp);
return;
}
S ("PRIVMSG %s :%s\n", quiz_target, ptr);
fclose (fp);
}
+#endif
diff --git a/source/random.c b/source/random.c
index 4777161..41fb670 100755
--- a/source/random.c
+++ b/source/random.c
@@ -1,687 +1,688 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
-#ifdef RANDOM_STUFF
+int get_random_integer(int max)
+{
+ int result;
+
+ result = ((float) max) * (rand() / (RAND_MAX + 1.0));
+ if (result >= max) // Paranoid check.
+ result = max - 1;
+
+ return result;
+}
+
+
+#ifdef ENABLE_RANDOM
void add_randomstuff (char *source, char *target, char *data)
{
char *ptr = NULL;
char file [STRING_LONG] = {0};
size_t nLines = 0;
int toggle = 1;
-#ifdef BACKUP_RANDOMSTUFF
-# ifndef WIN32
- // Backup randomstuff file to a temporary file.
- unlink(RAND_BACKUP_FILE);
- snprintf(file, sizeof(file), "cp %s %s\n", RAND_FILE, RAND_BACKUP_FILE);
- system(file);
-# endif
-#endif
+//#ifndef WIN32
+ if (BACKUP_RANDOMSTUFF)
+ {
+ // Backup randomstuff file to a temporary file.
+ unlink(RAND_BACKUP_FILE);
+ snprintf(file, sizeof(file), "cp %s %s\n", RAND_FILE, RAND_BACKUP_FILE);
+ system(file);
+ }
+//#endif
if(*data == '~')
{
data++;
ptr = strtok(data, " ");
if(ptr != NULL)
strlwr(ptr);
if(strspn(ptr, LEGAL_TEXT) != strlen(ptr))
{
S("privmsg %s :%s, rdb files must be made up of letters and or numbers, no other text is accepted.\n",
target, source);
return;
}
snprintf(file, sizeof(file), "%s/%s.rdb", RDB_DIR, ptr);
data = strtok(NULL, "");
toggle = 0;
}
else
{
snprintf(file, sizeof(file), "%s", RAND_FILE);
nRandStuffs++;
}
db_log(file, "%s\n", data);
nLines = count_lines(file);
L011(target, source, nLines);
}
void get_rand_stuff_time (void)
{
- Rand_Stuff = rand () % RAND_STUFF_TIME + 2;
+ Rand_Stuff = 2 + get_random_integer(RAND_STUFF_TIME);
if (Rand_Stuff < RAND_STUFF_TIME / 2)
Rand_Stuff = RAND_STUFF_TIME;
}
-
void do_random_stuff (void)
{
FILE *fp = 0;
size_t nLine = 0, nLength = 0, nIndex = 0;
int nIsAction = 0;
char temp [STRING_SHORT] = {0};
char szBuffer [STRING_LONG] = {0};
char *b2 = NULL;
// Count the randomstuffs.
if ((nRandStuffs = count_lines(RAND_FILE)) < 1)
return;
- // Get a random line number to display. If nLine is more than the number of RandStuffs,
- // nLine becomes equal to the number of RandStuffs.
- if ((nLine = 1 + (size_t) ((float)nRandStuffs * rand() / (RAND_MAX + 1.0))) > nRandStuffs)
- nLine = nRandStuffs;
+ // Get a random line number to display.
+ nLine = 1 + (size_t) get_random_integer(nRandStuffs);
// If nLine is less than 1, nLine becomes equal to 1
if(nLine < 1)
nLine = 1;
// Complain if we can't open the randomstuff file.
if((fp = fopen(RAND_FILE, "r")) == NULL)
{
S("privmsg %s :Unable to open %s for reading in do_random_stuff()\n",
CHAN, RAND_FILE);
return;
}
while(fgets(szBuffer, STRING_LONG, fp))
{
- // Ignore comments that start with a /
- if ((*szBuffer == '/') ||
- (*szBuffer == '\n') ||
- (*szBuffer == '\0'))
- continue;
-
- nIndex++;
+ // Ignore lines that start with a /, treat as comments.
+ if((*szBuffer != '/') && (*szBuffer != '\n'))
+ nIndex++;
+ else
+ continue;
stripline(szBuffer);
if(nIndex == nLine)
{
nLength = strlen(szBuffer);
nIndex = 0;
memset(data, 0, sizeof(data));
nIsAction = (*szBuffer == '+' ? 1 : 0);
while(nLength > 0)
{
nIndex++;
nLength--;
// Parse data for channel name variable. replace accordingly.
if(szBuffer[nLength] == '~')
snprintf(temp, sizeof(temp), "%s%s", CHAN, data);
else
snprintf(temp, sizeof(temp), "%c%s", szBuffer[nLength], data);
strncpy(data, temp, sizeof(data));
}
// Make sure the file is closed!
fclose (fp);
if(nIsAction == 1)
{
b2 = data;
b2++;
S("privmsg %s :\1ACTION %s\1\n", CHAN, b2);
return;
}
else
{
S("privmsg %s :%s\n", CHAN, data);
return;
}
}
}
fclose(fp);
}
#endif
void do_randomtopic (int type, char *target, char *file, char *nick, char *topic)
{
FILE *fp = 0;
char file2 [FILENAME_MAX] = {0};
char szBuffer2 [STRING_LONG] = {0};
char Data [STRING_LONG] = {0};
char temp [STRING_LONG] = {0};
char crm1 [STRING_LONG] = {0};
char crm2 [STRING_LONG] = {0};
char bFirst = 1;
char *pBuffer = NULL, *ptr = NULL, *pDefault = NULL;
size_t nLength = 0, nRandTopics = 0, nLine = 0,
nIndex = 0;
int toggle = 0, nType = 0, F = 0;
// This ends up being the response, if we're doing a dunno, or whut reply, and the file
// containing the random responses can't be opened.
- pDefault = (type == DUNNOR ? DONNO_Q : WHUT);
+ pDefault = (type == DUNNOR ? DUNNO_Q : WHUT);
if(file != NULL)
snprintf(file2, sizeof(file2), "%s/%s.rdb", RDB_DIR, file);
if ((nRandTopics = count_lines(file2)) < 1)
{
S("privmsg %s :Sorry, I cannot answer that topic because "
"darkbot random text file (rdb) \"%s\" has no lines in it.\n",
target, file2);
return;
}
if ((fp = fopen(file2, "r")) == NULL)
{
// If this is a dunno, or whut response, instead we say our default reply.
if (type == NORMALR)
{
S("privmsg %s :Sorry, I cannot answer that topic because "
"darkbot random text file (rdb) \"%s\" was not found.\n",
target, file2);
}
else
{
S ("privmsg %s :%s\n", target, pDefault);
}
return;
}
/* db_sleep(1) */
- // Get line number that we are searching for in the file. If it ends up less than
- // 1, for some reason, set it to 1.
-
- if ((nLine = (size_t) ((float)nRandTopics * rand() / (RAND_MAX+1.0))) < 1)
- nLine = 1;
-
- if(nLine > nRandTopics)
- nLine = nRandTopics;
+ // Get line number that we are searching for in the file.
+ nLine = 1 + (size_t) get_random_integer(nRandTopics);
while(fgets(szBuffer2, STRING_LONG, fp))
{
if((*szBuffer2 != '/') && (*szBuffer2 != '\n'))
nIndex++;
else
continue;
stripline(szBuffer2);
// This is our line!
if(nIndex == nLine)
{
nIndex = 0;
pBuffer = szBuffer2;
/* if ((*pBuffer == '+') || (*pBuffer == '-'))
{
pBuffer++;
nType = ((*pBuffer == '+') ? RDB_ACTION : RDB_RAW);
}
else
nType = RDB_NORMAL;
*/
if (*pBuffer == '+')
{
pBuffer++;
nType = RDB_ACTION;
}
else if (*pBuffer == '-')
{
pBuffer++;
nType = RDB_RAW;
}
else
{
nType = RDB_NORMAL;
}
nLength = (size_t) strlen(pBuffer);
while(nLength > 0)
{
nLength--;
if (toggle == 1)
{
toggle = 0;
// Support for tokens
if (pBuffer[nLength] == '1' || pBuffer[nLength] == '2' || pBuffer[nLength] == '3' ||
pBuffer[nLength] == '4' || pBuffer[nLength] == '5' || pBuffer[nLength] == '6' ||
pBuffer[nLength] == '7' || pBuffer[nLength] == '8' || pBuffer[nLength] == '9')
{
/* The first time around, we just store the topic in a "safe place" */
if (bFirst == 1)
{
strncpy (crm1, topic, sizeof(crm1));
bFirst = 0;
}
/* Each time around, get a new copy from the "safe place". */
strncpy (crm2, crm1, sizeof(crm2));
snprintf (temp, sizeof(temp), "%s%s", get_word (pBuffer[nLength], crm2, "+"), Data);
}
else if(pBuffer[nLength] == 'N')
{ // nick
snprintf(temp, sizeof(temp), "%s%s", nick, Data);
}
else if ((pBuffer[nLength] == 'H') && (*target == '#'))
{ /* u@h of user */
snprintf (temp, sizeof (temp), "%s%s", mask_from_nick (nick, target), Data);
}
else if ((pBuffer[nLength] == 'C') && (*target == '#'))
{ // channel or nick.
snprintf(temp, sizeof(temp), "%s%s", target, Data);
}
else if (pBuffer[nLength] == 'T')
{ // time
snprintf(temp, sizeof(temp), "%s%s", date(), Data);
}
else if (pBuffer[nLength] == 't')
{ /* unixtime */
snprintf (temp, sizeof (temp), "%ld%s", (long) time (NULL), Data);
}
else if ((pBuffer[nLength] == 'R') && (*target == '#'))
{ // Random nick (not if this is not a channel
snprintf(temp, sizeof(temp), "%s%s",
get_rand_nick(target), Data);
}
else if (pBuffer[nLength] == 'S')
{ // Server
snprintf(temp, sizeof(temp), "%s%s", BS, Data);
}
else if (pBuffer[nLength] == 'P')
{ // Port
snprintf(temp, sizeof(temp), "%d%s", (int) BP, Data);
}
else if(pBuffer[nLength] == 'Q')
{ // Question
snprintf(temp, sizeof(temp), "%s%s", revert_topic(topic), Data);
}
else if(pBuffer[nLength] == 'W')
{ // WWW page
snprintf(temp, sizeof(temp), "http://freezedown.org%s", Data);
}
else if(pBuffer[nLength] == '!')
{ // cmdchar
snprintf(temp, sizeof(temp), "%c%s", *CMDCHAR, Data);
}
else if(pBuffer[nLength] == 'V')
{ // Version
snprintf(temp, sizeof(temp), "%s%s", dbVersion, Data);
}
else if(pBuffer[nLength] == 'B')
{ // Mynick
snprintf(temp, sizeof(temp), "%s%s", Mynick, Data);
}
else
{
snprintf(temp, sizeof(temp), "%c~%s", pBuffer[nLength], Data);
}
}
else if(pBuffer[nLength] == '~')
{
toggle = 1;
}
else
{
snprintf(temp, sizeof(temp), "%c%s", pBuffer[nLength], Data);
}
strncpy(Data, temp, sizeof(Data));
}
switch (nType)
{
case RDB_ACTION:
S ("privmsg %s :\1ACTION %s\1\n", target, Data);
break;
case RDB_NORMAL:
S ("privmsg %s :%s\n", target, Data);
break;
case RDB_RAW:
ptr = strtok (Data, "|");
while (ptr != NULL)
{
if (ptr[0] == ' ')
ptr++;
if (ptr[0] == 'B' && ptr[1] == 'A' && ptr[2] == 'N')
{ // Ban the user, if the target is a channel.
if (*target == '#')
S ("mode %s +b *%s\n", target, mask_from_nick (nick, target));
else
S ("privmsg %s :Sorry, %s, I can't respond to that topic in private.\n",
target, nick);
}
if (ptr[0] == 'T' && ptr[1] == 'E' && ptr[2] == 'M' && ptr[3] == 'P' &&
ptr[4] == 'B' && ptr[5] == 'A' && ptr[6] == 'N')
{ // Ban user for 60 seconds, if the target is a channel.
if (*target == '#')
{
S ("mode %s +b *%s\n", target, mask_from_nick (nick, target));
snprintf (temp, sizeof (temp), "%s/%ld", DBTIMERS_PATH, (long) time (NULL) + 60);
db_log (temp, "MODE %s -b *%s\n", target, mask_from_nick (nick, target));
}
else
S ("privmsg %s :Sorry, %s, I can't respond to that topic in private.\n",
target, nick);
}
ptr[0] = tolower (ptr[0]);
ptr[1] = tolower (ptr[1]);
if (ptr[0] == 'p' && ptr[1] == 'r')
F = 1;
if (ptr[0] == 'k' && ptr[1] == 'i')
F = 1;
if (ptr[0] == 'n' && ptr[1] == 'o')
F = 1;
if (ptr[0] == 't' && ptr[1] == 'o')
F = 1;
if (F == 1)
{
S ("%s\n", ptr);
F = 0;
}
ptr = strtok (NULL, "|");
}
break;
} // End switch.
fclose (fp);
return;
}
}
fclose(fp);
}
/**
* 05/27/02 Ron
* - Recoded this function, random.ini no longer needs a number
* at the top.
* 6/22/00 Dan
* - Function argument is now pointer to const
* - Fixed a problem where the file was never closed
* - All variables are now initialized when declared
* - Removed an unused variable
* - Changed long variables to type size_t, they should be
* unsigned
* - Changed reinitialization of data
* - Moved the big if/else structure to a switch
*/
char *rand_reply (const char *nick)
{
FILE *fp = 0;
char temp [STRING_SHORT] = {0};
size_t nIndex = 0, nRandTopics = 0, nLine = 0,
- nLength = 0;
-
+ nLength = 0;
// Count how many lines are in the RAND_SAY file, if can't be
// counted, just return.
if((nRandTopics = count_lines(RAND_SAY)) < 1)
return(0);
// set nLine to be a random number between 1 and nRandTopics.
- nLine = 1 + (size_t) ((float)nRandTopics * rand() / (RAND_MAX+1.0));
+ nLine = 1 + (size_t) get_random_integer(nRandTopics);
// If the RAND_SAY file can't be opened, just return.
if((fp = fopen(RAND_SAY, "r")) == NULL)
return(0);
while(fgets(r_reply, STRING_SHORT, fp))
{
// Ignore comments
if((*r_reply != '/' ) && (*r_reply != '\n'))
nIndex++;
else
continue;
stripline(r_reply);
if(nIndex != nLine)
continue;
else
{
// This is our line.
fclose(fp);
nLength = (size_t) strlen(r_reply);
nIndex = 0;
data[0] = 0;
while(nLength > 0)
{
nIndex++;
nLength--;
switch(r_reply[nLength])
{
case '^':
snprintf(temp, sizeof(temp), "%s%s", nick, data);
break;
case '%':
snprintf(temp, sizeof(temp), "\2%s", data);
break;
case '&':
snprintf(temp, sizeof(temp), "\37%s", data);
break;
case '~':
snprintf(temp, sizeof(temp), "\26%s", data);
break;
default:
snprintf(temp, sizeof(temp), "%c%s", r_reply[nLength], data);
break;
}
strncpy(data, temp, sizeof(data));
}
// Return our fully parsed line.
return(data);
}
}
// Unable to find a match
fclose(fp);
// A space is returned to prevent crashing
return(" ");
}
-#if RANDQ == ON
+#ifdef ENABLE_RANDQ
/*
* do_randq():
*
* Types = RANDQ_NORMAL, RANDQ_CASE, RANDQ_RAND
*/
void do_randq (char *text, const int type, const char *target, const char *nick)
{
FILE *fp = 0;
size_t nLine = 0, length = 0, nNumMatches = 0,
nIndex2 = 0, nIndex3 = 0;
int nIsAction = 0;
char *b2 = NULL;
char temp [STRING_SHORT] = { 0 };
char szBuffer[STRING_LONG] = { 0 };
/*
* Check for RANDQ_RAND, and just do_random_stuff() if it's specified.
*/
if (type == RANDQ_RAND)
{
do_random_stuff ();
return;
}
if (text == NULL)
{
if(((nNumMatches = count_lines(RAND_FILE)) == -1) ||
(nNumMatches == 0))
{
S ("privmsg %s :%s, There are no randomstuffs, or %s cannot be accessed.\n",
target, nick, RAND_FILE);
return;
}
S("privmsg %s :%s, there %s %d randomstuff%s\n",
target,
nick,
nNumMatches == 1 ? "is" : "are",
nNumMatches,
nNumMatches == 1 ? "." : "s."
);
return;
}
/* Remove the temporary file. */
remove(RANDQ_TEMPFILE);
if((fp = fopen(RAND_FILE, "r")) == NULL)
{
S("privmsg %s :%s, I was unable to open %s for reading.\n",
target, nick, RAND_FILE);
return;
}
while(!feof(fp))
{
while(fgets(szBuffer, STRING_LONG, fp))
{
if(*szBuffer == '/')
continue;
stripline(szBuffer);
/*
* If type is specified as being case sensitive, use strstr,
- * otherwise, use db_stristr
+ * otherwise, use strcasestr
*/
if (type == RANDQ_CASE)
{
if (strstr(szBuffer, text))
{
nNumMatches++;
db_log(RANDQ_TEMPFILE, "%s\n", szBuffer);
}
}
else /* if (type == RANDQ_NORMAL) */
{
- if (db_stristr(szBuffer, text) != 0)
+ if (strcasestr(szBuffer, text) != 0)
{
nNumMatches++;
db_log(RANDQ_TEMPFILE, "%s\n", szBuffer);
}
}
}
}
// Close randomstuff file.
fclose(fp);
// If no matches are present, return that.
if(nNumMatches == 0)
{
S("privmsg %s :%s, I didn't find any matches for your search.\n",
target, nick);
return;
}
- nLine = 1 + (size_t) ((float)nNumMatches * rand() / (RAND_MAX + 1.0));
+ nLine = 1 + (size_t) get_random_integer(nNumMatches);
// If we can't open the temporary file, complain about it.
if((fp = fopen(RANDQ_TEMPFILE, "r")) == 0)
{
S("privmsg %s :%s, I was unable to open %s for reading.\n",
target, nick, RANDQ_TEMPFILE);
return;
}
while(!feof(fp))
{
while(fgets(szBuffer, STRING_LONG, fp))
{
if((*szBuffer != '/' ) || (*szBuffer != '\n'))
nIndex2++;
else
continue;
stripline(szBuffer);
// This is the line we have chosen.
if(nIndex2 == nLine)
{
// Check if this is an action.
nIsAction = (*szBuffer == '+' ? 1 : 0);
length = strlen(szBuffer);
nIndex3 = 0;
memset(data, 0, sizeof(data));
while(length > 0)
{
nIndex3++;
length--;
if(szBuffer[length] == '~')
{
// Replace occurance of this char with chan name
snprintf(temp, sizeof(temp), "%s%s", target, data);
}
else
{
snprintf(temp, sizeof(temp), "%c%s", szBuffer[length], data);
}
strncpy(data, temp, sizeof(data));
}
// Make sure the file is closed.
fclose (fp);
if(nIsAction == 1)
{
b2 = data;
b2++;
S("privmsg %s :\1ACTION %s (%d/%d)\1\n",
target, b2, nLine, nNumMatches);
return;
}
else
{
S("privmsg %s :(%d/%d): %s\n",
target, nLine, nNumMatches, data);
return;
}
}
}
}
fclose(fp);
}
#endif
diff --git a/source/raw.c b/source/raw.c
index 2c2d06d..4e2fca4 100755
--- a/source/raw.c
+++ b/source/raw.c
@@ -1,212 +1,220 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
void
check_files (void)
{
FILE *fp;
if ((fp = fopen (PERFORM, "r")) == NULL)
{
if ((fp = fopen (PERFORM, "w")) == NULL)
{
printf ("Can't read/write %s! Exiting ...\n", PERFORM);
exit (EXIT_FAILURE);
}
else
fclose (fp);
}
if ((fp = fopen (URL2, "r")) == NULL)
{
if ((fp = fopen (URL2, "w")) == NULL)
{
printf ("Can't read/write %s! Exiting ...\n", URL2);
exit (EXIT_FAILURE);
}
else
fclose (fp);
}
fclose(fp);
}
+
+void *check_nick_parameter(struct setup_parameter *parameter, char *ptr)
+{
+ if (strspn (ptr, LEGAL_NICK_TEXT) != strlen (ptr))
+ {
+ printf("The nickname %s contains illegal characters.", ptr);
+ return NULL;
+ }
+
+ strncpy (s_Mynick, ptr, sizeof (s_Mynick));
+ snprintf(NICK_COMMA, sizeof (NICK_COMMA), "%s,", s_Mynick);
+ snprintf(COLON_NICK, sizeof (COLON_NICK), "%s:", s_Mynick);
+ snprintf(BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", s_Mynick);
+ S("NICK %s\n", s_Mynick);
+
+ if(LOG_PRIVMSG)
+ snprintf (privmsg_log, sizeof (privmsg_log), "%s%s-privmsg.log", LOG_DIR, s_Mynick);
+
+ return ptr;
+}
+
/**
* 6/23/00 Dan:
* - Initialized all variables
*/
void
raw_now (char *type)
{
FILE *fp = NULL;
long i = 0, counter = 0;
char str[STRING_LONG] = { 0 }, *dat = NULL, *ptr = NULL, *tmp1 =
NULL, *tmp2 = NULL, *tmp3 = NULL;
- if (stricmp (type, "PERMBAN") == 0)
+ if (strcasecmp (type, "PERMBAN") == 0)
if ((fp = fopen (PERMBAN, "r")) == NULL)
return;
- if (stricmp (type, "DEOP") == 0)
+ if (strcasecmp (type, "DEOP") == 0)
if ((fp = fopen (DEOP, "r")) == NULL)
return;
- if (stricmp (type, "SERVERS") == 0)
+ if (strcasecmp (type, "SERVERS") == 0)
if ((fp = fopen (SERVERS, "r")) == NULL)
{
printf ("%s not found. You must create the file with format:\n", SERVERS);
printf ("server port ...this list can be as long as you want.\n");
exit (0);
}
- if (stricmp (type, "SETUP") == 0)
+ if (strcasecmp (type, "SETUP") == 0)
if ((fp = fopen (SETUP, "r")) == NULL)
{
printf ("Unable to locate %s! You must run configure!.\n", SETUP);
exit (0);
}
while (!feof (fp))
{
- if (stricmp (type, "SETUP") == 0)
+ if (strcasecmp (type, "SETUP") == 0)
{
- SeeN = 1;
+ SeeN = true;
while (fgets (str, STRING_LONG, fp))
{
stripline (str);
-
- /* Allow comments */
- if (*str == '#')
- continue;
-
- dat = strtok (str, "");
- if ((ptr = strchr (dat, '=')) != NULL)
- *ptr++ = '\0';
- if (stricmp (dat, "NICK") == 0)
- {
- strncpy (Mynick, ptr, sizeof (Mynick));
- strncpy (s_Mynick, ptr, sizeof (s_Mynick));
-#if LOG_PRIVMSG == 1
- snprintf (privmsg_log, sizeof (privmsg_log),
- "%s%s-privmsg.log", LOG_DIR, Mynick);
-#endif
- }
- else if (stricmp (dat, "USERID") == 0)
- {
- strncpy (UID, ptr, sizeof (UID));
- }
- else if (stricmp (dat, "CHAN") == 0)
- {
- strncpy (CHAN, ptr, sizeof (CHAN));
- }
- else if (stricmp (dat, "SEEN") == 0)
- {
- SeeN = atoi (ptr);
- }
- else if (stricmp (dat, "VHOST") == 0)
- {
- strncpy (VHOST, ptr, sizeof (VHOST));
- }
- else if (stricmp (dat, "REALNAME") == 0)
- {
- strncpy (REALNAME, ptr, sizeof (REALNAME));
- }
- else if (stricmp (dat, "CMDCHAR") == 0)
- {
- *CMDCHAR = *ptr;
- }
+ set_parameter(str);
}
-#ifdef VERB
- printf (" - botnick(%s),", Mynick);
- printf ("userid(%s),", UID);
- printf ("channel(%s),", CHAN);
- printf ("realname(%s)\n", REALNAME);
- printf (" - cmdchar(%c),", *CMDCHAR);
- printf ("vhost(%s),", VHOST);
- printf ("seen(%s)\n", SeeN == 1 ? "On" : "Off");
-#endif
}
- else if (stricmp (type, "PERMBAN") == 0)
+ else if (strcasecmp (type, "PERMBAN") == 0)
{
while (fgets (str, STRING_LONG, fp))
{
stripline (str);
/* Allow comments */
- if (*str != '#')
+ if (*str == '#')
continue;
tmp1 = strtok (str, " ");
if (tmp1 == NULL)
continue;
tmp2 = strtok (NULL, " ");
if (tmp2 == NULL)
tmp2 = "0";
tmp3 = strtok (NULL, "");
if (tmp3 == NULL)
tmp3 = "Permbanned!";
strlwr (tmp1);
counter = atoi (tmp2);
add_permban (tmp1, counter, tmp3);
}
}
- else if (stricmp (type, "SERVERS") == 0)
+ else if (strcasecmp (type, "SERVERS") == 0)
{
-#ifndef WIN32
printf ("Loading %s file ", SERVERS);
-#endif
while (fgets (str, STRING_LONG, fp))
{
- /* Allow comments */
+ /* Ignore comment lines */
- if (*str == '#')
+ if (*str == '#' || *str == '/')
continue;
- i++;
printf (".");
fflush (stdout);
stripline (str);
- tmp1 = strtok (str, " ");
- if (tmp1 == NULL)
- {
- printf ("Found error in %s! Aboring! please re-run configure!\n", SERVERS);
- exit (0);
- }
+
+ /* Watch out for blank lines. Since fgets
+ returns on NULL, we're checking for NULL
+ within the fget'd data, which would indicate
+ a line containing NULL data in the file, not
+ EOF (Wrote this as a reminder). Ignore these
+ lines and move on.
+ */
+
+ if ((tmp1 = strtok (str, " ")) == NULL)
+ continue;
else
tmp2 = strtok (NULL, " ");
+
+ i++;
+
if (tmp2 == NULL)
{
printf ("%s has no matching port in %s!\n", tmp1, SERVERS);
exit (0);
}
tmp3 = strtok (NULL, "");
add_s25 (tmp1, atoi (tmp2), tmp3);
}
- printf ("done(%d).\n", (int) i);
+
+ if (i > 0)
+ printf ("done(%d).\n", (int) i);
+ else
+ {
+ printf ("ERROR! No servers found in %s! Please edit this file. Aborting!\n", SERVERS);
+ exit (0);
+ }
}
else if (fgets (str, STRING_LONG, fp))
S ("%s\n", str);
}
fclose (fp);
}
void
run_perform (void)
{
FILE *fp;
- char str[STRING_LONG] = { 0 };
+ char str [STRING_LONG] = {0},
+ temp [STRING_LONG] = {0};
+ size_t len = 0;
if ((fp = fopen (PERFORM, "r")) == NULL)
return;
while (fgets (str, sizeof (str), fp))
{
/* Allow comments */
if (*str == '#')
continue;
+
+ len = strlen (str);
+ memset (data, 0, sizeof (data));
+
+ while (len > 0)
+ {
+ len--;
+ if ((str[len] == '~') && (str[len-1] == 'B'))
+ {
+ len--;
+ snprintf (temp, sizeof (temp), "%s%s", Mynick, data);
+ }
+ else
+ {
+ snprintf (temp, sizeof (temp), "%c%s", str[len], data);
+ }
+
+ strncpy (data, temp, sizeof (data));
+ }
- S ("%s\n", str);
+ if (data != NULL)
+ {
+ S ("%s\n", data);
+ }
}
fclose (fp);
}
diff --git a/source/seen.c b/source/seen.c
index a24d5d0..6f84ca5 100755
--- a/source/seen.c
+++ b/source/seen.c
@@ -1,147 +1,145 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
void
count_seen (char *source, char *target)
{
FILE *fp = 0;
char temp [STRING_LONG] = { 0 };
size_t nCount = 0;
- // Complain if we can't open the file.
+ // Complain if we can't open the file.
if ((fp = fopen (SEEN_FILE, "r")) == NULL)
{
L003 (source, SEEN_FILE);
return;
}
-
+
while (fgets (temp, STRING_LONG, fp))
{
++nCount;
}
-
+
fclose (fp);
L004 (target, source, nCount);
}
void
show_seen (char *nick, char *source, char *target)
{
FILE *fp = 0;
char temp[STRING_LONG] = { 0 }, *intime = NULL, *r_nick = NULL, *uh =
NULL, *chan = NULL, *ptr = NULL;
time_t unixtime = 0;
if ((nick == NULL) || (strlen(nick) > MAX_NICK_LENGTH))
return;
-
- // Looking for yourself, eh?
- if (stricmp (nick, source) == 0)
+
+ // Looking for yourself, eh?
+ if (strcasecmp (nick, source) == 0)
{
L005 (target, source);
return;
}
-
+
if ((ptr = strchr (nick, '?')) != NULL)
memmove (ptr, ptr + 1, strlen (ptr + 1) + 1);
-
+
if ((fp = fopen (SEEN_FILE, "r")) == NULL)
{
L003 (source, SEEN_FILE);
return;
}
-
+
while (fgets (temp, STRING_LONG, fp))
{
stripline (temp);
r_nick = strtok (temp, " ");
- if (stricmp (nick, r_nick) == 0)
+ if (strcasecmp (nick, r_nick) == 0)
{
uh = strtok (NULL, " ");
chan = strtok (NULL, " ");
-
+
if ((uh == NULL) || (chan == NULL))
continue;
-
+
intime = strtok (NULL, " ");
-
+
if (intime == NULL)
continue;
-
+
unixtime = time (NULL) - atoi (intime);
-
+
if (unixtime > 86400)
S ("PRIVMSG %s :%s, I last saw %s (%s) %d day%s, %02d:%02d ago in %s\n", target,
source, r_nick, uh, unixtime / 86400, (unixtime / 86400 == 1) ? "" : "s",
(unixtime / 3600) % 24, (unixtime / 60) % 60, chan);
else if (unixtime > 3600)
S ("PRIVMSG %s :%s, I last saw %s (%s) %d hour%s, %d min%s ago in %s\n", target,
source, r_nick, uh, unixtime / 3600, unixtime / 3600 == 1 ? "" : "s",
(unixtime / 60) % 60, (unixtime / 60) % 60 == 1 ? "" : "s", chan);
else
S ("PRIVMSG %s :%s, I last saw %s (%s) %d minute%s, %d sec%s ago in %s\n", target,
source, r_nick, uh, unixtime / 60, unixtime / 60 == 1 ? "" : "s", unixtime % 60,
unixtime % 60 == 1 ? "" : "s", chan);
fclose (fp);
return;
}
}
fclose (fp);
L006 (target, source, nick, SEEN_REPLY);
}
long
save_seen (char *nick, char *uh, char *chan)
{
FILE *fp = 0;
char temp[STRING_LONG] = { 0 }, *r_nick = NULL, *r_chan = NULL, *r_uh = NULL, *r_time = NULL;
- long toggle = 0;
+ long toggle = 0;
time_t unixtime = 0;
-#ifdef WIN32
printf ("\n*** Writing seen file: %s (%s) [%s]\n", CHAN, SEEN_FILE, date ());
-#endif
-
+
unlink (TMP_FILE);
-
+
if ((fp = fopen (SEEN_FILE, "r")) == NULL)
{
db_log (SEEN_FILE, "%s %s %s %d\n", nick, uh, chan, (time_t) time (NULL));
return (-1);
}
-
+
while (fgets (temp, STRING_LONG, fp))
{
stripline (temp);
r_nick = strtok (temp, " ");
- if (stricmp (nick, r_nick) == 0)
+ if (strcasecmp (nick, r_nick) == 0)
{
toggle = 1;
db_log (TMP_FILE, "%s %s %s %d\n", nick, uh, chan, (time_t) time (NULL));
}
else
{
r_uh = strtok (NULL, " ");
r_chan = strtok (NULL, " ");
r_time = strtok (NULL, " ");
-
+
if (r_uh == NULL || r_chan == NULL || r_time == NULL)
continue;
-
+
unixtime = (time_t) time (NULL) - (time_t) atoi (r_time);
-
+
if (unixtime < MAX_LASTSEEN)
db_log (TMP_FILE, "%s %s %s %s\n", r_nick, r_uh, r_chan, r_time);
}
}
fclose (fp);
if (toggle == 0)
{
db_log (TMP_FILE, "%s %s %s %d\n", nick, uh, chan, (time_t) time (NULL));
}
-
+
rename (TMP_FILE, SEEN_FILE);
-
+
return toggle;
}
diff --git a/source/server.c b/source/server.c
index 55c4621..ed369fd 100755
--- a/source/server.c
+++ b/source/server.c
@@ -1,49 +1,49 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
void
gs26 (void)
{
long i = 0;
struct sl124 *c;
c = sh124;
spr++;
if (spr > snr)
spr = 1;
while (c != NULL)
{
i++;
if (i == spr)
{
strncpy (BS, c->name, sizeof (BS));
BP = c->port;
- strncpy (BPASS, c->pass, sizeof (BPASS));
+ strncpy (BPASS, c->pass, sizeof (BPASS));
}
c = c->next;
}
}
void add_s25 (char *server, long port, char *pass)
{
struct sl124 *n;
n = malloc (sizeof (struct sl124));
if (n == NULL)
{
db_log ("error.log", "AHHH! No ram left! in add_s25!\n");
return;
}
memset (n, 0, sizeof (struct sl124));
snr++;
if (n != NULL)
{
strncpy (n->name, server, sizeof (n->name));
n->port = port;
- if (pass != NULL)
- strncpy (n->pass, pass, sizeof (n->pass));
+ if (pass != NULL)
+ strncpy (n->pass, pass, sizeof (n->pass));
n->next = sh124;
sh124 = n;
}
}
diff --git a/source/signals.c b/source/signals.c
index f3ef464..a1a781e 100755
--- a/source/signals.c
+++ b/source/signals.c
@@ -1,178 +1,179 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
void
sig_alrm (int notUsed)
{
alarmed = 1;
alarm (AIL);
check_dbtimers (); /* timers :) */
AIL8 += AIL;
+#ifdef ENABLE_QUIZ
if (quiz_halt == 1)
{
AIL13++;
if (AIL13 >= QUIZ_REPEAT_TIMER)
{
AIL13 = 0;
quiz_halt = 0;
}
}
if (quiz_answer == 1 && quiz_halt == 0)
{
if (quiz_timer >= QUIZ_TIMER)
{
quiz_answer = 0;
quiz_timer = 0;
quiz_halt = 1;
run_quiz_answer ();
}
else
quiz_timer++;
}
+#endif
+
if (AIL8 >= SEND_DELAY)
{
AIL8 = 0;
Send ();
}
LastInput += AIL;
if (LastInput >= 500)
{
LastInput = 0;
-#if CHECK_STONED == 1
+#ifdef ENABLE_STONED_CHECK
L088 (BS);
-#ifdef WIN32
printf ("\nNo response from %s in 5 mins, reconnecting...\n", BS);
-#endif
prepare_bot ();
register_bot ();
#endif
}
AIL10 += AIL;
if (AIL10 >= 900)
{ /* 15 mins */
AIL10 = 0;
if (MARK_CHANGE == 1)
{
MARK_CHANGE = 0;
save_setup (); /* save settings */
}
}
AIL666 += AIL;
if (AIL666 >= 60)
{ /* 60 sec timer */
AIL666 = 0;
S ("PING :%s\n", BS);
}
AIL9 += AIL;
if (AIL9 >= 30)
{
AIL9 = 0;
- if (stricmp (s_Mynick, Mynick) != 0)
+ if (strcasecmp (s_Mynick, Mynick) != 0)
{
S ("NICK %s\n", s_Mynick);
strncpy (Mynick, s_Mynick, sizeof (Mynick));
snprintf (NICK_COMMA, sizeof (NICK_COMMA), "%s,", Mynick);
snprintf (COLON_NICK, sizeof (COLON_NICK), "%s:", Mynick);
snprintf (BCOLON_NICK, sizeof (BCOLON_NICK), "%s\2:\2", Mynick);
}
}
if (Sleep_Toggle == 1)
{
AIL4 += AIL;
if (AIL4 >= Sleep_Time)
{
Sleep_Toggle = 0;
AIL4 = 0;
L089 (sleep_chan);
}
}
AIL2 += AIL;
AIL3 += AIL;
-#ifdef RANDOM_STUFF
+#ifdef ENABLE_RANDOM
Rand_Idle++;
if (RAND_IDLE <= Rand_Idle)
{
Rand_Idle = 0;
do_random_stuff ();
get_rand_stuff_time ();
}
Rand_Stuff -= AIL;
if (Rand_Stuff <= 0)
{
if (Sleep_Toggle != 1)
do_random_stuff ();
get_rand_stuff_time ();
}
#endif
+#ifdef ENABLE_CHANNEL
if (AIL3 >= AUTOTOPIC_TIME)
{
AIL3 = 0;
do_autotopics ();
}
+#endif
AIL5 += AIL;
if (AIL5 >= 600)
{
-#ifdef ANTI_IDLE
- S ("PRIVMSG ! :\2\n");
-#endif
+ if (ANTI_IDLE)
+ S ("PRIVMSG ! :\2\n");
AIL5 = 0;
}
if (AIL2 >= 300)
{
AIL2 = 0;
-#if STATUS == 1
+#ifdef ENABLE_STATUS
S ("LUSERS\n");
#endif
S ("MODE %s %s\n", Mynick, DEFAULT_UMODE);
S ("JOIN %s\n", CHAN);
reset_ ();
save_changes ();
-#if PERFORM_TIMER == 1
- run_perform ();
-#endif
-
+ if (PERFORM_TIMER)
+ run_perform ();
}
}
void
sig_segv (int notUsed)
{
long uptime2 = 0, p = 0;
uptime2 = time (NULL) - uptime;
printf
("ERROR! Aborting program. (SIG_SEGV) Uptime: %d hour%s, %d min%s\n",
(int) (uptime2 / 3600),
(uptime2 / 3600 == 1) ? "" : "s",
(int) ((uptime2 / 60) % 60), ((uptime2 / 60) % 60) == 1 ? "" : "s");
Snow ("QUIT :Caught SIG_SEGV! Aborting connection. Uptime: %d hour%s, %d min%s\n",
uptime2 / 3600,
uptime2 / 3600 == 1 ? "" : "s", (uptime2 / 60) % 60, (uptime2 / 60) % 60 == 1 ? "" : "s");
db_sleep (2);
p = getpid ();
+ // FIXME: Not sure about this, maybe we can live without the fork, maybe without the kills.
if (fork () > 0)
{
db_log ("error.log", "Caught SIGSEGV.. Sent kill -3 and kill -9...\n");
- kill (p, 3);
- kill (p, 9);
+ kill (p, 3); /* SIGQUIT - terminate process and dump core. */
+ kill (p, 9); /* SIGKILL */
}
db_sleep (1);
exit (0);
}
void
sig_hup (int notUsed)
{
char temp[STRING_LONG];
S ("QUIT :SIGHUP - Restarting %s ...\n", dbVersion);
snprintf (temp, sizeof (temp), "sleep 2; %s", DARKBOT_BIN);
system (temp);
db_sleep (1);
exit (0);
}
diff --git a/source/sockets.c b/source/sockets.c
index 423d7b0..11b0187 100755
--- a/source/sockets.c
+++ b/source/sockets.c
@@ -1,123 +1,123 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
/**
* Write a character array to a socket connection.
* 6/22/00 Dan
* Method argument now pointer to const data.
*/
int
writeln (const char *b)
{
return (write (socketfd, b, strlen (b)) < 0) ? 0 : 1;
}
int
readln (void)
{
char ch = 0;
int i = 0;
do
{
if (read (socketfd, &ch, 1) < 1)
return 0;
if (ch >= 32 || ch <= 126)
if (i < 524 - 1)
L[i++] = ch;
}
while (ch != '\n');
L[i] = '\0';
return 1;
}
/**
* 6/23/00 Dan
* - Changed method argument to be pointer to const data
* - Initialized variables when declared
* - Changed b to a power of 2
*/
void
S (const char *format, ...)
{
va_list arglist;
char b[STRING_LONG] = { 0 };
struct sendq *n = 0;
va_start (arglist, format);
vsprintf (b, format, arglist);
va_end (arglist);
if (send_tog == 0)
{
send_tog = 1;
if (DebuG == 1)
{
- printf ("OUT: %s\n", b);
+ printf ("OUT: %s", b);
}
writeln (b);
return;
}
n = malloc (sizeof (struct sendq));
if (n == NULL)
{
db_log ("error.log", "AHH! no ram left! in S!\n");
return;
}
memset (n, 0, sizeof (struct sendq));
strncpy (n->data, b, sizeof (n->data));
if (sendqhead == NULL)
{
sendqhead = sendqtail = n;
}
else
{
sendqtail->next = n;
sendqtail = sendqtail->next;
}
}
/**
* 6/23/00 Dan
* - Changed method argument to be pointer to const data
* - Initialized b
*/
int
Snow (const char *format, ...)
{
va_list arglist;
char b[STRING_LONG] = { 0 };
va_start (arglist, format);
vsprintf (b, format, arglist);
va_end (arglist);
if (DebuG == 1)
- printf ("OUT: %s\n", b);
+ printf ("OUT: %s", b);
return (writeln (b));
}
int
Send ()
{
struct sendq *c;
char output[STRING_LONG];
c = sendqhead;
get_sendq_count (0);
if (c == NULL)
{
send_tog = 0;
return -1;
}
if (DebuG == 1)
- printf ("OUT: %s\n", c->data);
+ printf ("OUT: %s", c->data);
#ifdef DEBUG2
- db_log ("darkbot_debug.log", "OUT: %s\n", c->data);
+ db_log ("darkbot_debug.log", "OUT: %s", c->data);
#endif
strncpy (output, c->data, sizeof (output));
del_sendq (0);
return (writeln (output));
}
diff --git a/source/stats.c b/source/stats.c
index ee24a43..6ea5341 100755
--- a/source/stats.c
+++ b/source/stats.c
@@ -1,163 +1,167 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
+#ifdef ENABLE_STATS
void
get_stats (char *target, char *user)
{
struct statslist *c;
char temp[50] = { 0 };
char *ptr = NULL;
long total = 0;
time_t oldtime = 0;
time_t added_time = 0;
time_t last_time = 0;
c = statshead;
if (c)
oldtime = c->added_time;
while (c)
{
if (user == NULL)
{
total += c->total;
if (c->added_time < oldtime)
oldtime = c->added_time;
}
else
{
- if (stricmp (c->nick, user) == 0)
+ if (strcasecmp (c->nick, user) == 0)
{
added_time = c->added_time;
last_time = c->last_time;
strncpy (temp, ctime (&added_time), sizeof (temp));
if ((ptr = strchr (temp, '\n')) != NULL)
*ptr = '\0';
S ("PRIVMSG %s :%s has asked %ld questions since %s, %s's last question was asked on %s", target, user, c->total, temp, user, ctime (&last_time));
return;
}
}
c = c->next;
}
if (user)
{
S ("PRIVMSG %s :I have no data on %s\n", target, user);
}
else
{
S ("PRIVMSG %s :There have been %ld questions asked by %ld people, since I began recording on %s", target, total, NUM_USER, ctime (&oldtime));
}
}
void
add_stats (char *nick, char *uh, long total, long added_time, long last_time)
{
struct statslist *n, *c;
c = statshead;
if (strlen (uh) > 399)
uh[399] = '\0';
while (c)
{
- if (stricmp (c->nick, nick) == 0)
+ if (strcasecmp (c->nick, nick) == 0)
{
strncpy (c->uh, uh, sizeof (c->uh));
c->total++;
c->last_time = last_time;
save_changes ();
return;
}
c = c->next;
}
n = malloc (sizeof (struct statslist));
if (n == NULL)
{
db_log ("error.log", "AHHH! No ram left! in add_stats!\n");
return;
}
NUM_USER++;
memset (n, 0, sizeof (struct statslist));
if (n != NULL)
{
strncpy (n->nick, nick, sizeof (n->nick));
strncpy (n->uh, uh, sizeof (n->uh));
strlwr (n->uh);
n->total = total;
n->added_time = added_time;
n->last_time = last_time;
n->next = statshead;
statshead = n;
}
+
+ free (n);
}
void
load_stats (void)
{
FILE *fp;
char b[STRING_LONG] = { 0 }, *user_host = NULL;
char *nick = NULL, *w_total = NULL, *w_added_time = NULL, *w_last_time = NULL;
long last_time = 0, added_time = 0, i = 0, total = 0;
if ((fp = fopen (STATS_FILE, "r")) == NULL)
{
if ((fp = fopen (STATS_FILE, "w")) == NULL)
{
printf ("Unable to create %s!\n", STATS_FILE);
exit (0);
}
fclose (fp);
return;
}
while (fgets (b, STRING_LONG, fp))
{
if (b == NULL)
continue;
stripline (b);
if (*b == '/')
continue;
i++;
printf (".");
fflush (stdout);
nick = strtok (b, " ");
if (nick == NULL)
continue;
user_host = strtok (NULL, " ");
if (user_host == NULL)
continue;
w_total = strtok (NULL, " ");
if (w_total == NULL)
continue;
w_added_time = strtok (NULL, " ");
if (w_added_time == NULL)
continue;
w_last_time = strtok (NULL, "");
if (w_last_time == NULL)
continue;
if (w_total != NULL)
total = atoi (w_total);
else
total = 0;
if (w_added_time != NULL)
added_time = atoi (w_added_time);
else
added_time = 0;
if (w_added_time != NULL)
last_time = atoi (w_last_time);
else
last_time = 0;
if (DebuG == 1)
printf
("loading statslist: %s %s total:%ld add:%ld last:%ld\n",
nick, user_host, total, added_time, last_time);
add_stats (nick, user_host, total, added_time, last_time);
}
printf ("done(%d), ", (int) i);
fclose (fp);
save_changes ();
if (DebuG == 1)
db_sleep (2);
}
+#endif
diff --git a/source/topics.c b/source/topics.c
index 49c49dc..def37c1 100755
--- a/source/topics.c
+++ b/source/topics.c
@@ -1,175 +1,176 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
/**
* Remove the autotopic for a particular channel.
* 6/23/00 Dan:
* - Method argument is now pointer to const data
* - All variables are now initialized when declared
* - Changed size of b to be power of 2
* - Changed variable types of toggle and x in accordance
* with their use
*/
void
del_autotopic (const char *chan)
{
FILE *fp;
char b[STRING_LONG] = { 0 }, *r_chan = 0, *r_data = 0;
bool toggle = false;
size_t x = 0;
- unlink (TMP_FILE);
+ remove (TMP_FILE);
fp = fopen (AUTOTOPIC_F, "r");
if (NULL == fp)
{
return;
}
while (fgets (b, STRING_LONG, fp))
{
x++;
stripline (b);
r_chan = strtok (b, " ");
r_data = strtok (NULL, "");
- if (stricmp (r_chan, chan) == 0)
+ if (strcasecmp (r_chan, chan) == 0)
{
/* Found the channel */
toggle = true;
}
else
{
db_log (TMP_FILE, "%s %s\n", r_chan, r_data);
}
}
fclose (fp);
if (x == 1 && toggle)
{
/* The autotopic file is now empty */
- unlink (AUTOTOPIC_F);
- unlink (TMP_FILE);
+ remove (AUTOTOPIC_F);
+ remove (TMP_FILE);
return;
}
if (toggle)
{
/* We found the topic, change the temp file to the
* the name of the autotopic file */
rename (TMP_FILE, AUTOTOPIC_F);
}
else
{
/* We were unable to find the channel, just
* return */
- unlink (TMP_FILE);
+ remove (TMP_FILE);
}
}
void
do_autotopics (void)
{
FILE *fp;
char b[STRING_LONG] = { 0 }, *r_chan = NULL, *r_data = NULL;
if ((fp = fopen (AUTOTOPIC_F, "r")) == NULL)
return;
while (fgets (b, STRING_LONG, fp))
{
stripline (b);
r_chan = strtok (b, " ");
r_data = strtok (NULL, "");
if (*r_data != '0')
{
db_sleep (1);
S ("TOPIC %s :%s\n", r_chan, r_data);
}
}
fclose (fp);
}
long
ifexist_autotopic (char *chan)
{
FILE *fp;
char b[STRING_LONG] = { 0 }, *r_chan = NULL;
if ((fp = fopen (AUTOTOPIC_F, "r")) == NULL)
return -1;
while (fgets (b, STRING_LONG, fp))
{
stripline (b);
if (*b == '/')
continue;
r_chan = strtok (b, " ");
- if (stricmp (r_chan, chan) == 0)
+ if (strcasecmp (r_chan, chan) == 0)
{
fclose (fp);
return 1; /* exists */
}
}
fclose (fp);
return 0; /* doesn't exist */
}
void
set_autotopic (char *source, char *target, char *topic)
{
long exist = 0;
exist = ifexist_autotopic (target);
if (exist == 0 && *topic == '0')
{ /* never existed, lets humor
* the guy */
L007 (source, target);
return;
}
else if (exist == 1 && *topic == '0')
{ /* delete it! */
L008 (source, target);
S ("TOPIC %s :\n", target);
del_autotopic (target);
return;
}
+
if (strlen (topic) >= 400) /* make sure no overflow */
topic[400] = '\0';
if (exist == 0)
{ /* no such autotopic, so add it */
L009 (source, target, topic);
db_log (AUTOTOPIC_F, "%s %s\n", target, topic);
return;
}
/* only thing left is if topic exists and you want to update it */
del_autotopic (target);
L010 (source, target, topic);
S ("TOPIC %s :%s\n", target, topic);
db_log (AUTOTOPIC_F, "%s %s\n", target, topic);
}
char *
revert_topic (char *input)
{
char *ptr = NULL, b[STRING_SHORT] = { 0 };
ptr = strtok (input, "+");
-
+
snprintf (f_tmp, sizeof (f_tmp), "%s", ptr);
if (ptr != NULL)
{
while (ptr != NULL)
{
ptr = strtok (NULL, "+");
if (ptr != NULL)
{
snprintf (b, sizeof (b), "%s %s", f_tmp, ptr);
snprintf (f_tmp, sizeof (f_tmp), "%s", b);
}
}
return f_tmp;
}
else
return f_tmp;
}
diff --git a/source/url.c b/source/url.c
index 6922143..3452972 100755
--- a/source/url.c
+++ b/source/url.c
@@ -1,644 +1,647 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
int
check_existing_url (const char *source, char *topic, char *target)
{
FILE *fp;
char b[STRING_LONG] = { 0 }, *subj = NULL;
if ((fp = fopen (URL2, "r")) == NULL)
{
L003 (source, URL2);
return 0;
}
while (fgets (b, STRING_LONG, fp))
{
stripline (b);
subj = strtok (b, " ");
- if (stricmp (subj, topic) == 0)
+ if (strcasecmp (subj, topic) == 0)
{
fclose (fp);
return 1;
}
}
fclose (fp);
return 0;
}
void
find_url (const char *nick, char *topic, char *target)
{
FILE *fp = NULL;
long i = 0, FOUND = 0, x = 0;
char b [STRING_LONG] = {0}, DATA [STRING_SHORT] = {0};
char *subj = NULL, *ptr2 = NULL;
if (strlen (topic) > MAX_TOPIC_SIZE)
topic[MAX_TOPIC_SIZE] = '\0';
strlwr (topic);
if ((fp = fopen (URL2, "r")) == NULL)
{
L003 (nick, URL2);
return;
}
while (fgets (b, STRING_LONG, fp))
{
x++;
if (*b == '\n')
continue; /* Just pass over empty lines */
stripline (b);
subj = strtok (b, " ");
strlwr (subj);
ptr2 = strstr (subj, topic);
if (ptr2 != NULL)
{
i++;
FOUND = 1;
sprintf (DATA, "%s %s", DATA, subj);
if (strlen (DATA) >= MAX_SEARCH_LENGTH)
break;
}
}
fclose (fp);
if (FOUND == 0)
{
L021 (target, NO_TOPIC, topic, x);
}
else if (i > 19)
{
L022 (target, i, DATA);
}
else if (i == 1)
{
L023 (target, nick, DATA);
}
else
L024 (target, i, nick, DATA);
}
void
display_url (char *target, char *nick, char *topic)
{
FILE *fp;
long x = 0;
char b[STRING_LONG] = { 0 }, *subj = NULL, *ptr = NULL;
strlwr (topic);
if ((fp = fopen (URL2, "r")) == NULL)
{
S ("%s %s :%s, there was an error displaying data for \"%s\".\n",
(target == nick) ? "notice" : "privmsg", target,
nick, topic);
return;
}
while (fgets (b, STRING_LONG, fp))
{
x++;
stripline (b);
subj = strtok (b, " ");
ptr = strtok (NULL, "");
- if (stricmp (subj, topic) == 0 || !match_wild (subj, topic) == 0)
+ if (strcasecmp (subj, topic) == 0 || !match_wild (subj, topic) == 0)
{
QUESTIONS++;
S ("PRIVMSG %s :Raw data for %s is: %s\n", target, topic, ptr);
fclose (fp);
return;
} /* Subject match */
}
fclose (fp);
S ("PRIVMSG %s :%s, I do not know of any topic named %s\n", target, nick, topic);
}
void
delete_url (const char *nick, char *topic, char *target)
{
FILE *fp = 0;
size_t i = 0;
size_t FOUND = 0;
char b [STRING_LONG] = { 0 };
char DATA [STRING_SHORT] = { 0 };
char *subj = NULL;
char *ptr = NULL;
if (*topic == '~')
{
topic++;
if (topic != NULL)
strlwr (topic);
snprintf (DATA, sizeof (DATA), "%s/%s.rdb", RDB_DIR, topic);
if (strspn (topic, LEGAL_TEXT) != strlen (topic))
{
- if (stricmp (nick, target) == 0)
+ if (strcasecmp (nick, target) == 0)
S ("NOTICE %s :%s, rdb files are made up of letters and or numbers, no other text is accepted.\n", nick, nick);
else
S ("PRIVMSG %s :%s, rdb files are made up of letters and or numbers, no other text is accepted.\n", target, nick);
return;
}
if ((fp = fopen (DATA, "r")) == NULL)
{
- if (stricmp (nick, target) == 0)
+ if (strcasecmp (nick, target) == 0)
S ("NOTICE %s :%s, %s.rdb does not exist.\n", nick, nick, topic);
else
S ("PRIVMSG %s :%s, %s.rdb does not exist.\n", target, nick, topic);
return;
}
fclose (fp);
remove(DATA);
- if (stricmp (nick, target) == 0)
+ if (strcasecmp (nick, target) == 0)
S ("NOTICE %s :I have unlinked %s.\n", nick, DATA);
else
S ("PRIVMSG %s :I have unlinked %s.\n", target, DATA);
return;
}
if ((fp = fopen (TMP_URL, "w")) == NULL) /* fixes the 'must have at least 1 topic' problem. */
{
L003 (nick, TMP_URL);
return;
}
fclose (fp);
if ((fp = fopen (URL2, "r")) == NULL)
{
L003 (nick, URL2);
return;
}
while (fgets (b, STRING_LONG, fp))
{
stripline (b);
subj = strtok (b, " ");
ptr = strtok (NULL, "");
i++;
- if (stricmp (subj, topic) == 0)
+ if (strcasecmp (subj, topic) == 0)
{
FOUND = 1;
DELETIONS++;
- if (stricmp (nick, target) == 0)
+ if (strcasecmp (nick, target) == 0)
L029n (nick, nick, i, topic);
else
L029 (target, nick, i, topic);
}
else if (strstr (subj, " ") == NULL)
db_log (TMP_URL, "%s %s\n", subj, ptr);
}
fclose (fp);
remove(URL2);
rename(TMP_URL, URL2);
if (FOUND == 0)
{
- if (stricmp (nick, target) == 0)
+ if (strcasecmp (nick, target) == 0)
L030n (nick, nick, topic);
else
L030 (target, nick, topic);
}
}
void
show_url (char *nick, char *topic, char *target, long donno, long floodpro, char *uh, long no_pipe)
{
FILE *fp;
long x = 0, length = 0, toggle = 0, A = 0, gotit = 0, D = 0, F = 0, Tog = 0;
char b[STRING_LONG] = { 0 }, *subj = NULL, *ptr = NULL;
char temp[STRING_LONG] = { 0 };
char Data[STRING_LONG] = { 0 }, *ptr8 = NULL;
char crm1[STRING_LONG] = { 0 };
char crm2[STRING_LONG] = { 0 }, bFirst = 1;
strlwr (topic);
/* removes the question mark */
if ((ptr = strchr (topic, '?')) != NULL)
memmove (ptr, ptr + 1, strlen (ptr + 1) + 1);
if ((fp = fopen (URL2, "r")) == NULL)
{
if (donno == 1)
L003 (nick, URL2);
return;
}
while (fgets (b, STRING_LONG, fp))
{
x++;
stripline (b);
subj = strtok (b, " ");
if (subj == NULL)
continue;
ptr = strtok (NULL, "");
if (ptr == NULL)
continue;
- if (stricmp (subj, topic) == 0 || !match_wild (subj, topic) == 0)
+ if (strcasecmp (subj, topic) == 0 || !match_wild (subj, topic) == 0)
{
QUESTIONS++;
if (floodpro == 1)
if (cf (uh, nick, nick))
{
fclose (fp);
return;
}
gotit = 1;
if (*ptr == '+')
{
ptr++;
A = 1;
}
else if (*ptr == '-')
{
if (strstr (nick, "|") != NULL)
return;
if (no_pipe == 1)
{
fclose (fp);
return;
}
ptr++;
D = 1;
}
else if (*ptr == '~')
{
ptr++;
fclose (fp);
do_randomtopic (NORMALR, target, ptr, nick, topic);
return;
}
length = strlen (ptr);
if (length > 3)
{
if (ptr[0] == 'i' && ptr[1] == 'l' && ptr[2] == 'c')
{
toggle++;
}
}
while (length > 0)
{
length--;
if (Tog == 1)
{
Tog = 0;
if (ptr[length] == 'N')
{ /* nick */
toggle++;
snprintf (temp, sizeof (temp), "%s%s", nick, Data);
}
else if (ptr[length] == 'C')
{ /* chan */
toggle++;
snprintf (temp, sizeof (temp), "%s%s", target, Data);
}
else if (ptr[length] == '1'
|| ptr[length] == '2'
|| ptr[length] == '3'
|| ptr[length] == '4'
|| ptr[length] == '5'
|| ptr[length] == '6'
|| ptr[length] == '7' || ptr[length] == '8' || ptr[length] == '9')
{
toggle++;
/* The first time around, we just store the topic in a
"safe place" */
if (bFirst == 1)
{
strncpy (crm1, topic, sizeof (crm1));
bFirst = 0;
}
/* Each time around, get a new copy from the "safe place." */
strncpy (crm2, crm1, sizeof (crm2));
snprintf (temp, sizeof (temp), "%s%s", get_word (ptr[length], crm2, "+"), Data);
}
else if (ptr[length] == 'H')
{ /* u@h of user */
toggle++;
snprintf (temp, sizeof (temp), "%s%s", uh, Data);
}
else if (ptr[length] == 'h')
{ /* u@h (no ident) */
toggle++;
if (*uh == '~')
{
uh++;
}
snprintf (temp, sizeof (temp), "%s%s", uh, Data);
}
else if (ptr[length] == 'T')
{ /* time */
toggle++;
snprintf (temp, sizeof (temp), "%s%s", date (), Data);
}
else if (ptr[length] == 't')
{ /* unixtime */
toggle++;
snprintf (temp, sizeof (temp), "%ld%s", (long)time (NULL), Data);
}
else if (ptr[length] == 'W')
{ /* WWW page */
toggle++;
snprintf (temp, sizeof (temp), "http://freezedown.org%s", Data);
}
else if (ptr[length] == 'S')
{ /* server */
toggle++;
snprintf (temp, sizeof (temp), "%s%s", BS, Data);
}
else if (ptr[length] == 'R')
{ /* rand */
toggle++;
/* The first time around, we just store the topic in a
"safe place" */
if (bFirst == 1)
{
strncpy (crm1, topic, sizeof (crm1));
bFirst = 0;
}
// Don't do random nicknames if the target isn't a channel!!
snprintf (temp, sizeof (temp), "%s%s",
((*target != '#') ? "R~" : get_rand_nick (target)),
Data);
}
else if (ptr[length] == 'P')
{ /* port */
toggle++;
snprintf (temp, sizeof (temp), "%ld%s", BP, Data);
}
else if (ptr[length] == 'Q')
{ /* question */
toggle++;
snprintf (temp, sizeof (temp), "%s%s", revert_topic (topic), Data);
}
else if (ptr[length] == 'V')
{ /* version */
toggle++;
snprintf (temp, sizeof (temp), "%s%s", dbVersion, Data);
}
else if (ptr[length] == '!')
{ /* cmdchar */
toggle++;
snprintf (temp, sizeof (temp), "%c%s", *CMDCHAR, Data);
}
else if (ptr[length] == 'B')
{ /* mynick */
toggle++;
snprintf (temp, sizeof (temp), "%s%s", Mynick, Data);
}
else
snprintf (temp, sizeof (temp), "%c~%s", ptr[length], Data);
}
else if (ptr[length] == '~')
{
Tog = 1;
}
else
snprintf (temp, sizeof (temp), "%c%s", ptr[length], Data);
strncpy (Data, temp, sizeof (Data));
} /* While */
if (D == 1)
{
ptr8 = strtok (Data, "|");
while (ptr8 != NULL)
{
if (ptr8[0] == ' ')
ptr8++;
if (ptr8[0] == 'B' && ptr8[1] == 'A' && ptr8[2] == 'N')
{ /* ban user */
S ("MODE %s +b *%s\n", target, uh);
}
if (ptr8[0] == 'T' && ptr8[1] == 'E' && ptr8[2] == 'M' &&
ptr8[3] == 'P' && ptr8[4] == 'B' && ptr8[5] == 'A' && ptr8[6] == 'N')
{ /* temp ban user for 60 sec */
S ("MODE %s +b *%s\n", target, uh);
snprintf (temp, sizeof (temp), "%s/%ld", DBTIMERS_PATH, (long)time (NULL) + 60);
db_log (temp, "MODE %s -b *%s\n", target, uh);
}
ptr8[0] = tolower (ptr8[0]);
ptr8[1] = tolower (ptr8[1]);
if (ptr8[0] == 'p' && ptr8[1] == 'r')
F = 1;
- if (ptr8[0] == 'k' && ptr8[1] == 'i')
+ if (ptr8[0] == 'k' && ptr8[1] == 'i' && !is_op(nick, target))
F = 1;
if (ptr8[0] == 'n' && ptr8[1] == 'o')
F = 1;
if (ptr8[0] == 't' && ptr8[1] == 'o')
F = 1;
if (F == 1)
S ("%s\n", ptr8);
F = 0;
ptr8 = strtok (NULL, "|");
}
fclose (fp);
return;
}
if (toggle == 0)
{
+#ifdef ENABLE_STATS
add_stats (nick, uh, 1, time (NULL), time (NULL));
-
+#endif
if (A == 0)
{
if ((*target == '#') || (*target == '+') || (*target == '&'))
S ("PRIVMSG %s :%s%s\n", target, rand_reply (nick), Data);
else
{
- strncpy (temp, rand_reply (target), sizeof (temp));
- S ("NOTICE %s :%s %s\n", target, topic, Data);
+ S ("NOTICE %s :%s%s\n", target, rand_reply(target), temp, Data);
}
}
else if ((*target == '#') || (*target == '+') || (*target == '&'))
S ("PRIVMSG %s :\1ACTION %s\1\n", target, Data);
else
{
- S ("NOTICE %s :%s\n", target, Data);
+ S ("NOTICE %s :%s%s\n", target, rand_reply(target), Data);
}
}
else if (A == 0)
{
+#ifdef ENABLE_STATS
add_stats (nick, uh, 1, time (NULL), time (NULL));
-
+#endif
if ((*target == '#') || (*target == '+') || (*target == '&'))
S ("PRIVMSG %s :%s\n", target, Data);
else
{
S ("NOTICE %s :%s\n", target, Data);
}
}
else if ((*target == '#') || (*target == '+') || (*target == '&'))
{
+#ifdef ENABLE_STATS
add_stats (nick, uh, 1, time (NULL), time (NULL));
+#endif
S ("PRIVMSG %s :\1ACTION %s\1\n", target, Data);
}
-#if MSG_RESPONSES == ON
- else
+ else if (MSG_RESPONSES)
{
+#ifdef ENABLE_STATS
add_stats (nick, uh, 1, time (NULL), time (NULL));
-
+#endif
S ("NOTICE %s :%s\n", target, Data);
}
-#endif
fclose (fp);
return;
} /* Subject match */
}
fclose (fp);
if (donno == 1)
{
if (strlen (topic) > 3)
{
strlwr (topic);
if (topic[0] == 'i' && topic[1] == 'l' && topic[2] == 'c')
{
if ((*target == '#') || (*target == '+') || (*target == '&'))
S ("PRIVMSG %s :%s, I found no matching ILC for that channel.\n", target, nick);
return;
}
}
if ((*target == '#') || (*target == '+') || (*target == '&'))
-#if RANDOM_DUNNO == 1
- do_randomtopic (DUNNOR, target, DUNNO_FILE, nick, topic);
-#else
- S ("PRIVMSG %s :%s, %s\n", target, nick, DONNO_Q);
-#endif
+ {
+ if (RANDOM_DUNNO == true)
+ do_randomtopic (DUNNOR, target, DUNNO_FILE, nick, topic);
+ else
+ S ("PRIVMSG %s :%s, %s\n", target, nick, DUNNO_Q);
+ }
else
- S ("NOTICE %s :%s, %s\n", nick, nick, DONNO_Q);
+ S ("NOTICE %s :%s, %s\n", nick, nick, DUNNO_Q);
}
}
char *
get_multiword_topic (char *first)
{
char *tmp2 = NULL;
tmp2 = strtok (NULL, " ");
if (tmp2 != NULL)
{
sprintf (f_tmp, "%s", first);
while (tmp2 != NULL)
{
sprintf (f_tmp, "%s+%s", f_tmp, tmp2);
tmp2 = strtok (NULL, " ");
}
return f_tmp;
}
else
return first;
}
void
datasearch (const char *nick, char *topic, char *target)
{
FILE *fp = NULL;
size_t i = 0, FOUND = 0, x = 0;
char b[STRING_LONG] = { 0 }, *dorf = NULL, *subj = NULL, *ptr2 = NULL, DATA[STRING_SHORT] =
{
0};
/* Make sure topic is not NULL.*/
if (topic == NULL)
{
return;
}
if (strlen (topic) > MAX_TOPIC_SIZE)
topic[MAX_TOPIC_SIZE] = '\0';
-
+
strlwr (topic);
-
+
if ((fp = fopen (URL2, "r")) == NULL)
{
L003 (nick, URL2);
return;
}
while (fgets (b, STRING_LONG, fp))
{
x++;
if (*b == '\n')
continue; /* Just pass over blank lines */
stripline (b);
strlwr (b);
subj = strtok (b, " ");
dorf = strtok (NULL, "");
ptr2 = strstr (dorf, topic);
if (ptr2 != NULL)
{
i++;
FOUND = 1;
sprintf (DATA, "%s %s", DATA, subj);
if (strlen (DATA) >= MAX_SEARCH_LENGTH)
break;
}
}
fclose (fp);
if (FOUND == 0)
{
L021 (target, NO_TOPIC, topic, x);
}
else if (i > 19)
{
L022 (target, i, DATA);
}
else if (i == 1)
{
L023 (target, nick, DATA);
}
else
L024 (target, i, nick, DATA);
}
char *
get_word (long number, char *string, char *seperator)
{ /* gets a specific word requested */
long i = 0;
char *ptr = NULL;
number = number - 49;
ptr = strtok (string, "+");
strncpy (f_tmp, ptr, sizeof (f_tmp));
if (ptr != NULL)
{
while (ptr != NULL)
{
i++; /* word number */
ptr = strtok (NULL, seperator);
if (ptr != NULL)
{
if (i == number)
{
snprintf (f_tmp, sizeof (f_tmp), "%s", ptr);
return f_tmp;
}
}
}
return f_tmp;
}
else
{ /* only one word */
if (number == 1)
{
return f_tmp;
}
else
return ""; /* no match */
}
}
diff --git a/source/users.c b/source/users.c
index d071aa9..f61f48e 100755
--- a/source/users.c
+++ b/source/users.c
@@ -1,231 +1,269 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
void
scan_chan_users (char *chan, char *nick, char *banned)
{
struct userlist *c;
c = userhead;
if (banned[0] == '*' && banned[1] == '!' && banned[2] == '*' && banned[3] == '\0')
{
S ("MODE %s -ob %s %s\n", chan, nick, banned);
return;
}
-#if KICK_ON_BAN == 1
- while (c)
+#ifdef ENABLE_CHANNEL
+ if (KICK_ON_BAN)
{
+ while (c)
+ {
if (!match_wild (banned, c->uh) == 0)
{
- if (stricmp (c->nick, Mynick) != 0)
+ if (strcasecmp (c->nick, Mynick) != 0)
{
S ("KICK %s %s :BANNED\n", chan, c->nick);
}
else
{
S ("MODE %s -ob %s %s\n", chan, nick, banned);
return;
}
}
c = c->next;
+ }
}
#endif
}
void
delete_user (const char *nick, char *chan)
{
struct userlist *pNode, *pPrev;
pNode = userhead;
pPrev = NULL;
while (pNode)
{
- if (stricmp (pNode->nick, nick) == 0 && stricmp (pNode->chan, chan) == 0)
+ if (strcasecmp (pNode->nick, nick) == 0 && strcasecmp (pNode->chan, chan) == 0)
{
save_seen (pNode->nick, pNode->uh, pNode->chan);
if (pPrev != NULL)
{
pPrev->next = pNode->next;
}
else
{
userhead = pNode->next;
}
free (pNode);
pNode = NULL;
break;
}
pPrev = pNode;
pNode = pNode->next;
}
}
void
add_user (char *chan, char *nick, char *uh, long tog)
{
/* toggle of 0 means to unidle the client */
struct userlist *n, *c;
c = userhead;
if (strlen (uh) > 399)
uh[399] = '\0';
while (c)
{ /* don't readd data that already exists */
if (tog == 0)
{
- if (stricmp (c->nick, nick) == 0 && stricmp (c->chan, chan) == 0)
+ if (strcasecmp (c->nick, nick) == 0 && strcasecmp (c->chan, chan) == 0)
{
c->idle = time (NULL);
}
}
if (tog == 1)
{
- if (stricmp (c->nick, nick) == 0 && stricmp (c->chan, chan) == 0)
+ if (strcasecmp (c->nick, nick) == 0 && strcasecmp (c->chan, chan) == 0)
{
/* If user is somehow already here, just update his data instead
of readding */
strncpy (c->chan, chan, sizeof (c->chan));
strncpy (c->uh, uh, sizeof (c->uh));
strlwr (c->uh);
strncpy (c->nick, nick, sizeof (c->nick));
c->idle = time (NULL);
c->level = 0;
return;
}
}
c = c->next;
}
if (tog == 0)
{
/* all we wanted to do was unidle, so we can quit now */
return;
}
n = malloc (sizeof (struct userlist));
if (n == NULL)
{
db_log ("error.log", "AHHH! No ram left! in add_user!\n");
return;
}
memset (n, 0, sizeof (struct userlist));
if (n != NULL)
{
strncpy (n->chan, chan, sizeof (n->chan));
strncpy (n->uh, uh, sizeof (n->uh));
strlwr (n->uh);
strncpy (n->nick, nick, sizeof (n->nick));
n->idle = time (NULL);
n->level = 0;
n->next = userhead;
userhead = n;
}
}
void
delete_user_ram (char *source, char *uh)
{
struct helperlist *pNode, *pPrev;
pNode = helperhead;
pPrev = NULL;
while (pNode)
{
- if (stricmp (pNode->uh, uh) == 0)
+ if (strcasecmp (pNode->uh, uh) == 0)
{
L015 (source, pNode->uh, pNode->level, pNode->num_join);
if (pPrev != NULL)
{
pPrev->next = pNode->next;
}
else
helperhead = pNode->next;
- free (pNode);
- pNode = NULL;
+ free (pNode);
+ pNode = NULL;
break;
}
pPrev = pNode;
pNode = pNode->next;
}
save_changes ();
}
-
-char *mask_from_userhost (char *uh)
-{
- char *ptr1 = NULL;
- char *ptr2 = NULL;
- char *user = NULL;
- char *host = NULL;
- char userhost [STRING_LONG] = {0};
- size_t nParts = 0;
-
- if (userhost == NULL)
- return(" ");
-
- strcpy (userhost, mask_tmp);
-
- if ((user = strtok (userhost, "@")) == NULL)
- return (" ");
-
- // Strip off any tilde on the username.
- if (*user == '~')
- user++;
-
- // Hostname
- host = strtok (NULL, " ");
-
- // If there are less than three parts to this hostname, return
- // the full hostname.
- if ((nParts = count_char (host, '.')) < 3)
- {
- snprintf (mask_tmp, sizeof (mask_tmp), "*%s@%s", user, host);
- return (mask_tmp);
- }
-
- // If the host is composed entirely of numbers and dots, assume
- // it is a numeric IP. Parse that accordingly (203.203.203.*)
- if (strspn (host, "1234567890.") == strlen (host))
- {
- reverse (host);
- ptr1 = strtok (host, ".");
- ptr1 = strtok (NULL, " ");
- reverse (ptr1);
- snprintf (mask_tmp, sizeof (mask_tmp), "*%s@%s.*", user, ptr1);
- return (mask_tmp);
- }
-
- // It has to be an actual hostname now, so let's parse it.
- reverse (host);
- ptr2 = strtok (host, ".");
- ptr1 = strtok (NULL, ".");
- reverse (ptr2);
- reverse (ptr1);
- snprintf (mask_tmp, sizeof (mask_tmp), "*%s@*.%s.%s", user, ptr1, ptr2);
- return (mask_tmp);
-}
-
-char *uh_from_nick (char *who, const char *chan)
-{
- const struct userlist *c = userhead;
- for (; c != NULL; c = c->next)
- {
- if (!stricmp (who, c->nick) && !stricmp (chan, c->chan))
- {
- strcpy (mask_tmp, c->uh);
- return (mask_tmp);
- }
- }
- return (0);
-}
-
-char *mask_from_nick (char *who, const char *chan)
-{
- char *s;
-
- if ((s = uh_from_nick(who, chan)) == NULL)
- return (who);
- return (mask_from_userhost (s));
-}
-
+
+char *mask_from_userhost (char *uh)
+{
+ char *ptr1 = NULL;
+ char *ptr2 = NULL;
+ char *user = NULL;
+ char *host = NULL;
+ char userhost [STRING_LONG] = {0};
+ size_t nParts = 0;
+
+ if (userhost == NULL)
+ return(" ");
+
+ strcpy (userhost, mask_tmp);
+
+ if ((user = strtok (userhost, "@")) == NULL)
+ return (" ");
+
+ // Strip off any tilde on the username.
+ if (*user == '~')
+ user++;
+
+ // Hostname
+ host = strtok (NULL, " ");
+
+ // If there are less than three parts to this hostname, return
+ // the full hostname.
+ if ((nParts = count_char (host, '.')) < 3)
+ {
+ snprintf (mask_tmp, sizeof (mask_tmp), "*%s@%s", user, host);
+ return (mask_tmp);
+ }
+
+ // If the host is composed entirely of numbers and dots, assume
+ // it is a numeric IP. Parse that accordingly (203.203.203.*)
+ if (strspn (host, "1234567890.") == strlen (host))
+ {
+ reverse (host);
+ ptr1 = strtok (host, ".");
+ ptr1 = strtok (NULL, " ");
+ reverse (ptr1);
+ snprintf (mask_tmp, sizeof (mask_tmp), "*%s@%s.*", user, ptr1);
+ return (mask_tmp);
+ }
+
+ // It has to be an actual hostname now, so let's parse it.
+ reverse (host);
+ ptr2 = strtok (host, ".");
+ ptr1 = strtok (NULL, ".");
+ reverse (ptr2);
+ reverse (ptr1);
+ snprintf (mask_tmp, sizeof (mask_tmp), "*%s@*.%s.%s", user, ptr1, ptr2);
+ return (mask_tmp);
+}
+
+long is_op(char *who, const char *chan)
+{
+ const struct userlist *c = userhead;
+ for (; c != NULL; c = c->next)
+ {
+ if (!strcasecmp (who, c->nick) && !strcasecmp (chan, c->chan))
+ {
+ return (c->flags & FLAG_CHANOP);
+ }
+ }
+ return (0);
+}
+
+void
+do_op(char *who, const char *chan, long tog)
+{
+ struct userlist *c = userhead;
+ for (; c != NULL; c = c->next)
+ {
+ if (!strcasecmp (who, c->nick) && !strcasecmp (chan, c->chan))
+ {
+ if (tog == 1)
+ c->flags |= FLAG_CHANOP;
+ else
+ c->flags &= ~FLAG_CHANOP;
+ }
+ }
+ return;
+}
+
+char *uh_from_nick (char *who, const char *chan)
+{
+ const struct userlist *c = userhead;
+ for (; c != NULL; c = c->next)
+ {
+ if (!strcasecmp (who, c->nick) && !strcasecmp (chan, "#*"))
+ {
+ strcpy (mask_tmp, c->uh);
+ return (mask_tmp);
+ }
+
+ if (!strcasecmp (who, c->nick) && !strcasecmp (chan, c->chan))
+ {
+ strcpy (mask_tmp, c->uh);
+ return (mask_tmp);
+ }
+ }
+ return (0);
+}
+
+char *mask_from_nick (char *who, const char *chan)
+{
+ char *s;
+
+ if ((s = uh_from_nick(who, chan)) == NULL)
+ return (who);
+ return (mask_from_userhost (s));
+}
diff --git a/source/vars.c b/source/vars.c
index 080a6bf..019295a 100755
--- a/source/vars.c
+++ b/source/vars.c
@@ -1,233 +1,468 @@
#include "defines.h"
-
-#define STRING_SHORT 512
-#define STRING_LONG 2048
+#include "vars.h"
+#include "prototypes.h"
int wsock = 0;
int sockerr = 0;
int optlen = sizeof(sockerr);
size_t nRandStuffs = 0;
long QUESTIONS = 0;
long ADDITIONS = 0;
long DELETIONS = 0;
long uptime = 0;
long NO_FLOOD = 0;
long NUM_SERV = 0;
long L_CLIENTS = 0;
long IRCOPS = 0;
long xtried = 0;
long G_USERS = 0;
long rt = 120;
long fc = 0;
long spr = 0;
long snr = 0;
long BP = 6667;
long CHECKED = 1;
long SEND_DELAY = 1;
long send_tog = 0;
long NUM_HELPER = 0;
long NUMLINESSEEN = 0;
long NUM_USER = 0;
+#ifdef ENABLE_QUIZ
long quiz_timer = 0;
long quiz_line = 0;
bool quiz_answer = 0;
bool quiz_halt = 0;
char quiz_target[STRING_SHORT] = { 0 };
long recent_questions[10] = { 0 };
+#endif
-#ifdef RANDOM_STUFF
+#ifdef ENABLE_RANDOM
long Rand_Stuff = 0;
long Rand_Idle = 0;
#endif
long AIL4 = 0;
long Sleep_Toggle = 0;
long Sleep_Time = 0;
long AIL3 = 0;
long AIL2 = 0;
long AIL5 = 0;
long JOINs = 0;
long PERMBAN_counter = 0;
long ram_load_time = 0;
long AIL9 = 0;
long AIL666 = 0;
long AIL8 = 0;
+#ifdef ENABLE_QUIZ
long AIL13 = 0;
+#endif
long LastInput = 0;
long AIL10 = 0;
long MARK_CHANGE = 0;
long html_counter = 0;
char NICK_COMMA[32] = { 0 };
char COLON_NICK[33] = { 0 };
char pass_data[512] = { 0 };
char pass_pass[STRING_SHORT] = { 0 };
char rword[STRING_SHORT] = { 0 };
char lc1[STRING_SHORT] = "0";
char lc2[STRING_SHORT] = "0";
char lc4[STRING_SHORT] = "0";
char lc3[STRING_SHORT] = "0";
char BPASS[STRING_SHORT] = "0";
char mask_tmp[STRING_LONG] = "0";
long lcn1 = 0;
long lcn2 = 0;
long lcn4 = 0;
long lcn3 = 0;
-long SeeN = 0;
+bool SeeN = false;
long DebuG = 0;
char slc1[STRING_SHORT] = "0";
char slc2[STRING_SHORT] = "0";
char slc4[STRING_SHORT] = "0";
char slc3[STRING_SHORT] = "0";
long slcn1 = 0;
long slcn2 = 0;
long slcn4 = 0;
long slcn3 = 0;
#ifdef WIN32
-char *rp391 = "niW-3f7 tobkraD";
+char *rp391 = "niW-4cr8 tobkraD";
#else
-char *rp391 = "3f7 tobkraD";
+char *rp391 = "4cr8 tobkraD";
#endif
char BCOLON_NICK[STRING_SHORT] = { 0 };
char DARKBOT_BIN[STRING_SHORT] = { 0 };
char URL2[STRING_SHORT] = { 0 };
char DBTIMERS_PATH[STRING_SHORT] = { 0 };
char LOG_DIR[STRING_SHORT] = { 0 };
char RDB_DIR[STRING_SHORT] = { 0 };
+#ifdef ENABLE_STATS
char STATS_FILE[STRING_SHORT] = { 0 };
+#endif
char SEEN_FILE[STRING_SHORT] = { 0 };
char BACKUP_DUP[STRING_SHORT] = { 0 };
char ADD_DELETES[STRING_SHORT] = { 0 };
char AUTOTOPIC_F[STRING_SHORT] = { 0 };
char HELPER_LIST[STRING_SHORT] = { 0 };
char QUIZ_FILE[STRING_SHORT] = { 0 };
char PERFORM[STRING_SHORT] = { 0 };
char DEOP[STRING_SHORT] = { 0 };
char RAND_SAY[STRING_SHORT] = { 0 };
char RAND_FILE[STRING_SHORT] = { 0 };
char RANDQ_TEMPFILE[STRING_SHORT] = { 0 };
char RAND_BACKUP_FILE[STRING_SHORT] = { 0 };
char SERVERS[STRING_SHORT] = { 0 };
char PERMBAN[STRING_SHORT] = { 0 };
char SETUP[STRING_SHORT] = { 0 };
char DAT_DIR[STRING_SHORT] = { 0 };
char r_reply[STRING_SHORT] = { 0 };
char data[STRING_SHORT] = { 0 };
char g_chan[STRING_SHORT] = { 0 };
char dbVersion[STRING_SHORT] = { 0 };
char strbuff[STRING_SHORT] = { 0 };
char f_tmp[STRING_LONG] = { 0 };
char UID[STRING_SHORT] = "database";
char BS[STRING_SHORT] = "irc.undernet.org";
char CMDCHAR[2] = "!";
char CHAN[STRING_SHORT] = "#darkbot";
char s_Mynick[STRING_SHORT] = "darkbot";
char g_host[STRING_SHORT] = { 0 };
char Mynick[STRING_SHORT] = "darkbot";
char sleep_chan[STRING_SHORT] = { 0 };
char VHOST[STRING_SHORT] = "0";
char REALNAME[STRING_SHORT] = "http://www.freezedown.org";
char privmsg_log[STRING_SHORT] = { 0 };
-#define PBOT "ArchFiend"
+long CONNECT_WAIT_TIMEOUT = 10;
+bool PERFORM_TIMER = true;
+char DEFAULT_UMODE[STRING_SHORT] = "+i-ds";
+bool ANTI_IDLE = false;
+bool DISPLAY_SYNC = false;
+
+bool SORT = false;
+bool FIND_DUPS = false;
+bool SAVE_DUPS = true;
+bool GENERAL_QUESTIONS = true;
+//bool ALLOW_ADD_IN_MSG = false;
+//bool ALLOW_DEL_IN_MSG = false;
+bool MSG_RESPONSES = false;
+
+bool LOG_ADD_DELETES = true;
+bool LOG_PRIVMSG = true;
+
+long SLEEP_TIME = 300;
+char GOSLEEP_ACTION[STRING_SHORT] = "\1ACTION falls asleep... ZzzZZzzZZzz\1";
+char WAKEUP_ACTION[STRING_SHORT] = "\1ACTION wakes up from a snooze..\1";
+
+long LASTCOMM_TIME = 5;
+long OUTPUT1_COUNT = 4;
+long OUTPUT1_DELAY = 1;
+long OUTPUT2_COUNT = 6;
+long OUTPUT2_DELAY = 2;
+long OUTPUT3_DELAY = 3;
+long OUTPUT_PURGE_COUNT = 7;
+
+char EXISTING_ENTRY[STRING_SHORT] = "Sorry, there is an existing entry under keyword";
+char NO_ENTRY[STRING_SHORT] = "I was unable to find entry:";
+//char CANT_FIND[STRING_SHORT] = "Was unable to find"; /* ... */
+char NO_TOPIC[STRING_SHORT] = "Sorry, I don't have any entry for"; /* ... */
+char TRY_FIND[STRING_SHORT] = "What am I trying to find";
+char WHUT[STRING_SHORT] = "hmmm?";
+char DUNNO_Q[STRING_SHORT] = "*shrug*";
+bool RANDOM_DUNNO = true;
+bool RANDOM_WHUT = true;
+
+#ifdef ENABLE_RANDOM
+//bool RANDOM_STUFF = true;
+long RAND_STUFF_TIME = 3600;
+long RAND_IDLE = 1800;
+//long RAND_LEVEL = 2;
+//bool RANDQ = true;
+bool BACKUP_RANDOMSTUFF = false;
+#endif
+
+bool JOIN_GREET = true;
+long SLASTCOMM_TIME = 60;
+bool VOICE_USERS_ON_JOIN = false;
+bool OP_USERS_ON_LOGIN = false;
+
+bool DO_WHOIS = false;
+long MAX_LASTSEEN = 604800;
+char SEEN_REPLY[STRING_SHORT] = "in the last 7 days.";
+
+char COMPLAIN_REASON[STRING_SHORT] = "grrr, kick me again and I'm going to...";
+bool BITCH_ABOUT_DEOP = false;
+char BITCH_DEOP_REASON[STRING_SHORT] = "grr, someone op me!";
+
+long AUTOTOPIC_TIME = 1800;
+char DEFAULT_KICK[STRING_SHORT] = "Requested!";
+bool KICK_ON_BAN = false;
+
+bool KICK_ON_CHANNEL_NOTICE = true;
+bool BAN_ON_CHANNEL_NOTICE = false;
+bool BAN_BY_HOST = false;
+
+bool FLOOD_KICK = true;
+char FLOOD_REASON[STRING_SHORT] = "Don't flood!";
+
+#ifdef ENABLE_QUIZ
+long QUIZ_TIMER = 25;
+long QUIZ_REPEAT_TIMER = 20;
+#endif
+
+bool HELP_GREET = false;
+bool AUTOHELP_GUESTS = false;
+
+char mySetinfo[STRING_SHORT] = "My !setinfo variables are: ^ nick, % Number of joins, & \
+Channel, $ user@host. Example: !setinfo ^ has joined & % times!! (also, if \
+you make the first char of your SETINFO a \"+\" the setinfo will be shown \
+as an ACTION)";
+
+char myVariables[STRING_SHORT] = "Data variables are: N~ (Nick), C~ (Chan), T~ \
+(Time/date) B~ (Botnick), Q~ (Question asked), R~ (random nick), !~ \
+(command char), S~ (current Server), P~ (current port) V~ (botVer), W~ \
+(db WWW site), H~ (u@h), t~ (unixtime), BAN (sets a ban), TEMPBAN (bans \
+for 60 sec)";
-/* ------------ Below are structs ------------------ */
struct rusage r_usage;
-struct ignorelist
-{
- char nick[STRING_SHORT];
- struct ignorelist *next;
-}
- *ignorehead = NULL;
+struct ignorelist *ignorehead = NULL;
-struct sendq
-{
- char data[STRING_SHORT];
- struct sendq *next;
-}
- *sendqhead = NULL, *sendqtail = NULL;
-
-struct userlist
-{ /* internal userlist */
- char chan[STRING_SHORT];
- char nick[STRING_SHORT];
- char uh[STRING_SHORT];
- long level; /* auth */
- short global; /* Global user? */
- long idle;
- struct userlist *next;
-}
- *userhead = NULL;
+struct sendq *sendqhead = NULL, *sendqtail = NULL;
-struct helperlist
-{
- char chan[STRING_SHORT];
- char uh[STRING_SHORT];
- char nick[STRING_SHORT];
- long level;
- size_t num_join;
- char greetz[STRING_SHORT];
- char pass[STRING_SHORT];
- struct helperlist *next;
-}
- *helperhead = NULL;
-
-/**
- * 6/23/00 Dan
- * - Changed permbanlist to have dynamically allocated
- * userhost and reason fields.
- * - Changed type of counter to size_t, this should be an
- * unsigned type.
- */
-struct permbanlist
-{
- char *uh;
- char *reason;
- size_t counter;
+struct userlist *userhead = NULL;
- struct permbanlist *next;
-}
- *permbanhead = NULL;
+struct helperlist *helperhead = NULL;
-struct old
-{
- char host[200];
- long time;
- int count;
- int value;
- int kick;
-}
-ood[STRING_SHORT];
+struct permbanlist *permbanhead = NULL;
+
+struct old ood[STRING_SHORT];
+
+struct sl124 *sh124 = NULL;
+
+#ifdef ENABLE_STATS
+struct statslist *statshead = NULL;
+#endif
+
+struct webinfo
+ GOOGLE_webinfo = { "GOOGLE", "www.google.com", 80, "/search?q=" } ,
+ METAR_webinfo = { "METAR", "weather.noaa.gov", 80, "/cgi-bin/mgetmetar.pl?cccc=" } ,
+ TAF_webinfo = { "TAF", "weather.noaa.gov", 80, "/cgi-bin/mgettaf.pl?cccc=" } ,
+ WEATHER_webinfo = { "WEATHER", "mobile.wunderground.com", 80, "/cgi-bin/findweather/getForecast?brand=mobile&query=" };
-struct sl124
+
+struct setup_parameter parameters[] =
{
- char name[STRING_SHORT];
- long port;
- char pass[STRING_SHORT];
- struct sl124 *next;
-}
- *sh124 = NULL;
+// I managed to eliminate these options when I rewrote chansrv.c.
+// {ST_BOOLEAN, 3, sizeof(ALLOW_ADD_IN_MSG), {"ALLOW_ADD_IN_MSG", NULL, NULL, NULL, NULL}, "allowing ADD command in private", &ALLOW_ADD_IN_MSG, NULL},
+// {ST_BOOLEAN, 3, sizeof(ALLOW_DEL_IN_MSG), {"ALLOW_DEL_IN_MSG", NULL, NULL, NULL, NULL}, "allowing DEL command in private", &ALLOW_DEL_IN_MSG, NULL},
+ {ST_BOOLEAN, 3, sizeof(ANTI_IDLE), {"ANTI_IDLE", NULL, NULL, NULL, NULL}, "idling for less than ten minutes", &ANTI_IDLE, NULL},
+#ifdef ENABLE_CHANNEL
+ {ST_BOOLEAN, 3, sizeof(BITCH_ABOUT_DEOP), {"BITCH_DEOP", NULL, NULL, NULL, NULL}, "bitch about deop", &BITCH_ABOUT_DEOP, NULL},
+ {ST_STRING, 3, sizeof(BITCH_DEOP_REASON), {"BITCH_DEOP_TEXT", NULL, NULL, NULL, NULL}, "deop complaint", BITCH_DEOP_REASON, NULL},
+#endif
+ {ST_STRING, 3, sizeof(COMPLAIN_REASON), {"BITCH_KICK_TEXT", NULL, NULL, NULL, NULL}, "bot kicked message", COMPLAIN_REASON, NULL},
+ {ST_STRING, 3, sizeof(CMDCHAR), {"BOT_CMD_CHAR", NULL, NULL, NULL, NULL}, "bot's command char", CMDCHAR, NULL},
+ {ST_STRING, 3, sizeof(Mynick), {"BOT_NICK", NULL, NULL, NULL, NULL}, "bot's nickname", Mynick, check_nick_parameter},
+ {ST_STRING, 3, sizeof(REALNAME), {"BOT_NAME", NULL, NULL, NULL, NULL}, "bot's real name", REALNAME, NULL},
+ {ST_STRING, 3, sizeof(UID), {"BOT_USER_ID", NULL, NULL, NULL, NULL}, "bot's user ID", UID, NULL},
+ {ST_STRING, 3, sizeof(DEFAULT_UMODE), {"BOT_USER_MODE", NULL, NULL, NULL, NULL}, "bot's user modes", DEFAULT_UMODE, NULL},
+ {ST_STRING, 3, sizeof(VHOST), {"BOT_VHOST", NULL, NULL, NULL, NULL}, "bot's virtual host", VHOST, NULL},
+ {ST_INTEGER, 3, sizeof(CONNECT_WAIT_TIMEOUT), {"CONNECT_TIME", NULL, NULL, NULL, NULL}, "server connection timeout", &CONNECT_WAIT_TIMEOUT, NULL},
+ {ST_STRING, 3, sizeof(CHAN), {"DEFAULT_CHANNEL", NULL, NULL, NULL, NULL}, "channel", CHAN, NULL},
+ {ST_BOOLEAN, 3, sizeof(DISPLAY_SYNC), {"DISPLAY_SYNC", NULL, NULL, NULL, NULL}, "tell channel bot has finished syncing", &DISPLAY_SYNC, NULL},
+ {ST_BOOLEAN, 3, sizeof(DO_WHOIS), {"DO_WHOIS", NULL, NULL, NULL, NULL}, "questionable channel alert", &DO_WHOIS, NULL},
+ {ST_STRING, 3, sizeof(DUNNO_Q), {"DUNNO_TEXT", NULL, NULL, NULL, NULL}, "no answer complaint", DUNNO_Q, NULL},
+ {ST_BOOLEAN, 3, sizeof(RANDOM_DUNNO), {"DUNNO_RANDOM_TEXT", NULL, NULL, NULL, NULL}, "random no answer complaint", &RANDOM_DUNNO, NULL},
+ {ST_BOOLEAN, 3, sizeof(FIND_DUPS), {"DUPS_REMOVE", NULL, NULL, NULL, NULL}, "remove duplicates in hatabase", &FIND_DUPS, NULL},
+ {ST_BOOLEAN, 3, sizeof(SAVE_DUPS), {"DUPS_SAVE", NULL, NULL, NULL, NULL}, "save duplicates in database", &SAVE_DUPS, NULL},
+ {ST_STRING, 3, sizeof(EXISTING_ENTRY), {"ENTRY_EXISTS_TEXT", NULL, NULL, NULL, NULL}, "replacing existing complaint", EXISTING_ENTRY, NULL},
+ {ST_STRING, 3, sizeof(NO_ENTRY), {"ENTRY_NOT_EXIST_TEXT", NULL, NULL, NULL, NULL}, "non-existing topic complaint", NO_ENTRY, NULL},
+ {ST_STRING, 3, sizeof(NO_TOPIC), {"FIND_NO_TEXT", NULL, NULL, NULL, NULL}, "no topic search complaint", NO_TOPIC, NULL},
+ {ST_STRING, 3, sizeof(TRY_FIND), {"FIND_WHAT_TEXT", NULL, NULL, NULL, NULL}, "try find search complaint", TRY_FIND, NULL},
+#ifdef ENABLE_CHANNEL
+ {ST_BOOLEAN, 3, sizeof(KICK_ON_CHANNEL_NOTICE), {"FLOOD_NOTICE_KICK", NULL, NULL, NULL, NULL}, "kick on channel notice flood", &KICK_ON_CHANNEL_NOTICE, NULL},
+ {ST_BOOLEAN, 3, sizeof(BAN_ON_CHANNEL_NOTICE), {"FLOOD_NOTICE_BAN", NULL, NULL, NULL, NULL}, "ban on channel notice flood", &BAN_ON_CHANNEL_NOTICE, NULL},
+ {ST_BOOLEAN, 3, sizeof(BAN_BY_HOST), {"FLOOD_NOTICE_BAN_HOST", NULL, NULL, NULL, NULL}, "ban by host on channel notice flood", &BAN_BY_HOST, NULL},
+ {ST_BOOLEAN, 3, sizeof(FLOOD_KICK), {"FLOOD_KICK", NULL, NULL, NULL, NULL}, "kick if bot is flooded", &FLOOD_KICK, NULL},
+ {ST_STRING, 3, sizeof(FLOOD_REASON), {"FLOOD_TEXT", NULL, NULL, NULL, NULL}, "flooded bot complaint", FLOOD_REASON, NULL},
+#endif
+ {ST_BOOLEAN, 3, sizeof(AUTOHELP_GUESTS), {"GREET_GUESTS_TEXT", NULL, NULL, NULL, NULL}, "give guests help", &AUTOHELP_GUESTS, NULL},
+ {ST_BOOLEAN, 3, sizeof(HELP_GREET), {"GREET_NEW_TEXT", NULL, NULL, NULL, NULL}, "give new users help", &HELP_GREET, NULL},
+ {ST_BOOLEAN, 3, sizeof(JOIN_GREET), {"GREET_USER_TEXT", NULL, NULL, NULL, NULL}, "registered user greeting", &JOIN_GREET, NULL},
+ {ST_INTEGER, 3, sizeof(LASTCOMM_TIME), {"IGNORE_TIME", NULL, NULL, NULL, NULL}, "seconds to ignore repeated topics", &LASTCOMM_TIME, NULL},
+ {ST_INTEGER, 3, sizeof(SLASTCOMM_TIME), {"IGNORE_USER_TIME", NULL, NULL, NULL, NULL}, "registered user delay seconds", &SLASTCOMM_TIME, NULL},
+#ifdef ENABLE_CHANNEL
+ {ST_STRING, 3, sizeof(DEFAULT_KICK), {"KICK_TEXT", NULL, NULL, NULL, NULL}, "kick message", DEFAULT_KICK, NULL},
+ {ST_BOOLEAN, 3, sizeof(KICK_ON_BAN), {"KICK_ON_BAN", NULL, NULL, NULL, NULL}, "kick when banned", &KICK_ON_BAN, NULL},
+#endif
+ {ST_BOOLEAN, 3, sizeof(LOG_ADD_DELETES), {"LOG_CHANGES", NULL, NULL, NULL, NULL}, "logging of database changes", &LOG_ADD_DELETES, NULL},
+ {ST_BOOLEAN, 3, sizeof(LOG_PRIVMSG), {"LOG_PRIVATE", NULL, NULL, NULL, NULL}, "logging of private messages", &LOG_PRIVMSG, NULL},
+#ifdef ENABLE_CHANNEL
+ {ST_BOOLEAN, 3, sizeof(OP_USERS_ON_LOGIN), {"OP_ON_LOGIN", NULL, NULL, NULL, NULL}, "op users on login", &OP_USERS_ON_LOGIN, NULL},
+#endif
+ {ST_INTEGER, 3, sizeof(OUTPUT1_COUNT), {"OUTPUT1_COUNT", NULL, NULL, NULL, NULL}, "output delay threshold", &OUTPUT1_COUNT, NULL},
+ {ST_INTEGER, 3, sizeof(OUTPUT1_DELAY), {"OUTPUT1_TIME", NULL, NULL, NULL, NULL}, "output delay seconds", &OUTPUT1_DELAY, NULL},
+ {ST_INTEGER, 3, sizeof(OUTPUT2_COUNT), {"OUTPUT2_COUNT", NULL, NULL, NULL, NULL}, "long output delay threshold", &OUTPUT2_COUNT, NULL},
+ {ST_INTEGER, 3, sizeof(OUTPUT2_DELAY), {"OUTPUT2_TIME", NULL, NULL, NULL, NULL}, "long output delay seconds", &OUTPUT2_DELAY, NULL},
+ {ST_INTEGER, 3, sizeof(OUTPUT_PURGE_COUNT), {"OUTPUT_PURGE_COUNT", NULL, NULL, NULL, NULL}, "purge output delay threshold", &OUTPUT_PURGE_COUNT, NULL},
+ {ST_INTEGER, 3, sizeof(OUTPUT3_DELAY), {"OUTPUT3_TIME", NULL, NULL, NULL, NULL}, "purge output delay seconds", &OUTPUT3_DELAY, NULL},
+ {ST_BOOLEAN, 3, sizeof(PERFORM_TIMER), {"PERFORM_TIME", NULL, NULL, NULL, NULL}, "sending perform.ini to server reqularly", &PERFORM_TIMER, NULL},
+ {ST_BOOLEAN, 3, sizeof(GENERAL_QUESTIONS), {"QUESTIONS_GENERAL", NULL, NULL, NULL, NULL}, "bot responds without being asked", &GENERAL_QUESTIONS, NULL},
+ {ST_BOOLEAN, 3, sizeof(MSG_RESPONSES), {"QUESTIONS_PRIVATE", NULL, NULL, NULL, NULL}, "bot responds to private questions", &MSG_RESPONSES, NULL},
+#ifdef ENABLE_QUIZ
+ {ST_INTEGER, 3, sizeof(QUIZ_TIMER), {"QUIZ_TIME", NULL, NULL, NULL, NULL}, "quiz answer seconds", &QUIZ_TIMER, NULL},
+ {ST_INTEGER, 3, sizeof(QUIZ_REPEAT_TIMER), {"QUIZ_REPEAT_TIME", NULL, NULL, NULL, NULL}, "next quiz delay seconds", &QUIZ_REPEAT_TIMER, NULL},
+#endif
+#ifdef ENABLE_RANDOM
+// This one is currently ./configure --enable-random
+// {ST_BOOLEAN, 3, sizeof(RANDOM_STUFF), {"RANDOM_STUFF", NULL, NULL, NULL, NULL}, "random utterences", &RANDOM_STUFF, NULL},
+ {ST_BOOLEAN, 3, sizeof(BACKUP_RANDOMSTUFF), {"RANDOM_BACKUP", NULL, NULL, NULL, NULL}, "enable random stuff auto backups", &BACKUP_RANDOMSTUFF, NULL},
+ {ST_INTEGER, 3, sizeof(RAND_IDLE), {"RANDOM_IDLE_TIME", NULL, NULL, NULL, NULL}, "seconds idle before random utterences", &RAND_IDLE, NULL},
+// This one is currently ./configure --with-random=level
+// {ST_INTEGER, 3, sizeof(RAND_LEVEL), {"RANDOM_LEVEL", NULL, NULL, NULL, NULL}, "level for adding random things", &RAND_LEVEL, NULL},
+// This one is currently ./configure --enable-randq
+// {ST_BOOLEAN, 3, sizeof(RANDQ), {"RANDOM_Q", NULL, NULL, NULL, NULL}, "enable RANDQ command", &RANDQ, NULL},
+ {ST_INTEGER, 3, sizeof(RAND_STUFF_TIME), {"RANDOM_TIME", NULL, NULL, NULL, NULL}, "seconds between random utterences", &RAND_STUFF_TIME, NULL},
+#endif
+ {ST_BOOLEAN, 3, sizeof(SeeN), {"SEEN_MODE", NULL, NULL, NULL, NULL}, "seen mode", &SeeN, NULL},
+ {ST_INTEGER, 3, sizeof(MAX_LASTSEEN), {"SEEN_TIME", NULL, NULL, NULL, NULL}, "maximum last seen seconds", &MAX_LASTSEEN, NULL},
+ {ST_STRING, 3, sizeof(SEEN_REPLY), {"SEEN_TEXT", NULL, NULL, NULL, NULL}, "maximum last seen reply", SEEN_REPLY, NULL},
+ {ST_STRING, 3, sizeof(mySetinfo), {"SETINFO_TEXT", NULL, NULL, NULL, NULL}, "setinfo variables help text", mySetinfo, NULL},
+ {ST_INTEGER, 3, sizeof(SLEEP_TIME), {"SLEEP_TIME", NULL, NULL, NULL, NULL}, "seconds to sleep for", &SLEEP_TIME, NULL},
+ {ST_STRING, 3, sizeof(GOSLEEP_ACTION), {"SLEEP_TEXT", NULL, NULL, NULL, NULL}, "sleep action", GOSLEEP_ACTION, NULL},
+ {ST_STRING, 3, sizeof(WAKEUP_ACTION), {"SLEEP_WAKE_TEXT", NULL, NULL, NULL, NULL}, "wakeup action", WAKEUP_ACTION, NULL},
+ {ST_BOOLEAN, 3, sizeof(SORT), {"SORT_DB", NULL, NULL, NULL, NULL}, "sort database on startup", &SORT, NULL},
+#ifdef ENABLE_CHANNEL
+ {ST_INTEGER, 3, sizeof(AUTOTOPIC_TIME), {"TOPIC_TIME", NULL, NULL, NULL, NULL}, "topic setting seconds", &AUTOTOPIC_TIME, NULL},
+#endif
+ {ST_STRING, 3, sizeof(myVariables), {"VARIABLES_TEXT", NULL, NULL, NULL, NULL}, "data variables help text", myVariables, NULL},
+#ifdef ENABLE_CHANNEL
+ {ST_BOOLEAN, 3, sizeof(VOICE_USERS_ON_JOIN), {"VOICE_ON_JOIN", NULL, NULL, NULL, NULL}, "voice users on join", &VOICE_USERS_ON_JOIN, NULL},
+#endif
+ {ST_STRING, 3, sizeof(WHUT), {"WHUT_TEXT", NULL, NULL, NULL, NULL}, "no text complaint", WHUT, NULL},
+ {ST_BOOLEAN, 3, sizeof(RANDOM_WHUT), {"WHUT_RANDOM_TEXT", NULL, NULL, NULL, NULL}, "random no text complaint", &RANDOM_WHUT, NULL},
+// Cant find CANT_FIND. B-)
+// {ST_STRING, 3, sizeof(CANT_FIND), {"CANT_FIND", NULL, NULL, NULL, NULL}, "can't find search complaint", CANT_FIND, NULL},
+ {ST_STRING, 4, 0, {NULL, NULL, NULL, NULL, NULL}, NULL, NULL, NULL}
+};
+
-struct statslist
+struct setup_parameter *
+set_parameter(char *input)
{
- char nick[STRING_SHORT];
- char uh[STRING_SHORT];
- long total;
- long added_time;
- long last_time;
+ struct setup_parameter *result = NULL;
+
+ /* ignore comments. */
+ if (*input != '#')
+ {
+ int i, found = -1;
+ char *dat = NULL, *ptr = NULL;
+
+ dat = strdup(input);
+ if ((ptr = strchr(dat, '=')) != NULL)
+ *ptr++ = '\0';
+ for (result = &parameters[0]; result->parameter[0] != NULL; result++)
+ {
+ for (i = 0; result->parameter[i] != NULL; i++)
+ {
+ if (strcasecmp(dat, result->parameter[i]) == 0)
+ {
+ found = i;
+ break;
+ }
+ }
+ if (found != -1)
+ break;
+ }
- struct statslist *next;
+ if (found == -1)
+ result = NULL;
+ else
+ {
+ if ((ptr) && (result->func))
+ {
+ ptr = result->func(result, ptr);
+ if (ptr == NULL)
+ result = NULL;
+ }
+ if (ptr)
+ {
+#ifdef ENABLE_VERBOSE
+ printf("Setting %s = %s\n", result->summary, ptr);
+#endif
+ switch (result->type)
+ {
+ case ST_BOOLEAN :
+ {
+ bool *variable = result->value;
+
+ *variable = isBoolean(ptr);
+ break;
+ }
+
+ case ST_INTEGER :
+ {
+ long *variable = result->value;
+
+ *variable = atoi(ptr);
+ break;
+ }
+
+ case ST_STRING :
+ {
+ char *variable = result->value;
+
+ strncpy(variable, ptr, result->max_size);
+ break;
+ }
+ }
+ }
+ }
+ free(dat);
+ }
+
+ return result;
}
- *statshead = NULL;
-struct webinfo
+void
+save_setup (void)
{
- char trigger[STRING_SHORT];
- char host[STRING_SHORT];
- int port;
- char url[STRING_SHORT];
+ struct setup_parameter *result = NULL;
+
+ printf("*** Writing setup file: %s (%s)\n", SETUP, date());
+ remove(TMP_FILE);
+
+ for (result = &parameters[0]; result->parameter[0] != NULL; result++)
+ {
+ switch (result->type)
+ {
+ case ST_BOOLEAN :
+ {
+ bool *variable = result->value;
+
+ db_log(TMP_FILE, "%s=%d\n", result->parameter[0], (*variable) ? 1 : 0);
+ break;
+ }
+
+ case ST_INTEGER :
+ {
+ long *variable = result->value;
+
+ db_log(TMP_FILE, "%s=%ld\n", result->parameter[0], *variable);
+ break;
+ }
+
+ case ST_STRING :
+ {
+ char *variable = result->value;
+
+ db_log(TMP_FILE, "%s=%s\n", result->parameter[0], variable);
+ break;
+ }
+ }
+ }
+
+ rename(TMP_FILE, SETUP);
}
- GOOGLE_webinfo = { "GOOGLE", "www.google.com", 80, "/search?q=" } ,
- METAR_webinfo = { "METAR", "weather.noaa.gov", 80, "/cgi-bin/mgetmetar.pl?cccc=" } ,
- TAF_webinfo = { "TAF", "weather.noaa.gov", 80, "/cgi-bin/mgettaf.pl?cccc=" } ;
diff --git a/source/vars.h b/source/vars.h
index 97ef811..57de48a 100755
--- a/source/vars.h
+++ b/source/vars.h
@@ -1,231 +1,357 @@
#define STRING_SHORT 512
#define STRING_LONG 2048
+#define FLAG_CHANOP 0x0001
+#define FLAG_CHANVOICE 0x0002
+
extern int wsock;
extern int sockerr;
extern int optlen;
extern size_t nRandStuffs;
extern long QUESTIONS;
extern long ADDITIONS;
extern long DELETIONS;
extern long uptime;
extern long NO_FLOOD;
extern long NUM_SERV;
extern long L_CLIENTS;
extern long IRCOPS;
extern long xtried;
extern long G_USERS;
extern long rt;
extern long fc;
extern long spr;
extern long snr;
extern long BP;
extern long CHECKED;
extern long SEND_DELAY;
extern long send_tog;
extern long NUM_HELPER;
extern long NUM_USER;
extern long NUMLINESSEEN;
extern long Rand_Stuff;
extern long Rand_Idle;
extern long AIL4;
extern long Sleep_Toggle;
extern long Sleep_Time;
extern long AIL3;
extern long AIL2;
extern long AIL5;
extern long JOINs;
extern long PERMBAN_counter;
extern long RAND_CHANS;
extern long ram_load_time;
extern long AIL9;
extern long AIL666;
extern long AIL8;
+#ifdef ENABLE_QUIZ
extern long AIL13;
+#endif
extern long LastInput;
extern long AIL10;
extern long MARK_CHANGE;
extern long html_counter;
extern long lcn1;
extern long lcn2;
extern long lcn4;
extern long lcn3;
-extern long SeeN;
+extern bool SeeN;
extern long DebuG;
+#ifdef ENABLE_QUIZ
extern long quiz_timer;
extern long quiz_line;
extern bool quiz_answer;
extern bool quiz_halt;
extern long recent_questions[10];
+#endif
extern char NICK_COMMA[32];
extern char COLON_NICK[33];
-extern char BPASS[32];
+extern char BPASS[STRING_SHORT];
extern char pass_data[512];
extern char pass_pass[STRING_SHORT];
extern char rword[STRING_SHORT];
extern char lc1[STRING_SHORT];
extern char lc2[STRING_SHORT];
extern char lc4[STRING_SHORT];
extern char lc3[STRING_SHORT];
extern char slc1[STRING_SHORT];
extern char slc2[STRING_SHORT];
extern char slc4[STRING_SHORT];
extern char slc3[STRING_SHORT];
extern char mask_tmp[STRING_LONG];
extern char quiz_target[STRING_SHORT];
extern long slcn1;
extern long slcn2;
extern long slcn4;
extern long slcn3;
extern char *rp391;
extern char BCOLON_NICK[STRING_SHORT];
extern char DARKBOT_BIN[STRING_SHORT];
extern char URL2[STRING_SHORT];
extern char DBTIMERS_PATH[STRING_SHORT];
extern char LOG_DIR[STRING_SHORT];
extern char RDB_DIR[STRING_SHORT];
+#ifdef ENABLE_STATS
extern char STATS_FILE[STRING_SHORT];
+#endif
extern char SEEN_FILE[STRING_SHORT];
extern char BACKUP_DUP[STRING_SHORT];
extern char ADD_DELETES[STRING_SHORT];
extern char AUTOTOPIC_F[STRING_SHORT];
extern char HELPER_LIST[STRING_SHORT];
extern char QUIZ_FILE[STRING_SHORT];
extern char PERFORM[STRING_SHORT];
extern char DEOP[STRING_SHORT];
extern char RAND_SAY[STRING_SHORT];
extern char RAND_FILE[STRING_SHORT];
extern char RANDQ_TEMPFILE[STRING_SHORT];
extern char RAND_BACKUP_FILE[STRING_SHORT];
extern char SERVERS[STRING_SHORT];
extern char PERMBAN[STRING_SHORT];
extern char SETUP[STRING_SHORT];
extern char DAT_DIR[STRING_SHORT];
extern char r_reply[STRING_SHORT];
extern char data[STRING_SHORT];
extern char g_chan[STRING_SHORT];
extern char dbVersion[STRING_SHORT];
extern char strbuff[STRING_SHORT];
extern char f_tmp[STRING_LONG];
extern char UID[STRING_SHORT];
extern char BS[STRING_SHORT];
extern char CMDCHAR[2];
extern char CHAN[STRING_SHORT];
extern char s_Mynick[STRING_SHORT];
extern char g_host[STRING_SHORT];
extern char Mynick[STRING_SHORT];
extern char sleep_chan[STRING_SHORT];
extern char VHOST[STRING_SHORT];
extern char REALNAME[STRING_SHORT];
extern char privmsg_log[STRING_SHORT];
+extern long CONNECT_WAIT_TIMEOUT;
+extern bool PERFORM_TIMER;
+extern char DEFAULT_UMODE[STRING_SHORT];
+extern bool ANTI_IDLE;
+extern bool DISPLAY_SYNC;
+
+extern bool SORT;
+extern bool FIND_DUPS;
+extern bool SAVE_DUPS;
+extern bool GENERAL_QUESTIONS;
+extern bool ALLOW_ADD_IN_MSG;
+extern bool ALLOW_DEL_IN_MSG;
+extern bool MSG_RESPONSES;
+
+extern bool LOG_ADD_DELETES;
+extern bool LOG_PRIVMSG;
+
+extern long SLEEP_TIME;
+extern char GOSLEEP_ACTION[STRING_SHORT];
+extern char WAKEUP_ACTION[STRING_SHORT];
+
+extern long LASTCOMM_TIME;
+extern long OUTPUT1_COUNT;
+extern long OUTPUT1_DELAY;
+extern long OUTPUT2_COUNT;
+extern long OUTPUT2_DELAY;
+extern long OUTPUT3_DELAY;
+extern long OUTPUT_PURGE_COUNT;
+
+extern char EXISTING_ENTRY[STRING_SHORT];
+extern char NO_ENTRY[STRING_SHORT];
+//extern char CANT_FIND[STRING_SHORT]; /* ... */
+extern char NO_TOPIC[STRING_SHORT]; /* ... */
+extern char TRY_FIND[STRING_SHORT];
+extern char WHUT[STRING_SHORT];
+extern bool RANDOM_WHUT;
+extern char DUNNO_Q[STRING_SHORT];
+extern bool RANDOM_DUNNO;
+
+#ifdef ENABLE_RANDOM
+//extern bool RANDOM_STUFF;
+extern long RAND_STUFF_TIME;
+extern long RAND_IDLE;
+//extern long RAND_LEVEL;
+//extern bool RANDQ;
+extern bool BACKUP_RANDOMSTUFF;
+#endif
+
+extern bool JOIN_GREET;
+extern long SLASTCOMM_TIME;
+#ifdef ENABLE_CHANNEL
+extern bool VOICE_USERS_ON_JOIN;
+extern bool OP_USERS_ON_LOGIN;
+#endif
+
+extern bool DO_WHOIS;
+extern long MAX_LASTSEEN;
+extern char SEEN_REPLY[STRING_SHORT];
+
+extern char COMPLAIN_REASON[STRING_SHORT];
+#ifdef ENABLE_CHANNEL
+extern bool BITCH_ABOUT_DEOP;
+extern char BITCH_DEOP_REASON[STRING_SHORT];
+
+extern long AUTOTOPIC_TIME;
+extern char DEFAULT_KICK[STRING_SHORT];
+extern bool KICK_ON_BAN;
+
+extern bool KICK_ON_CHANNEL_NOTICE;
+extern bool BAN_ON_CHANNEL_NOTICE;
+extern bool BAN_BY_HOST;
+
+extern bool FLOOD_KICK;
+extern char FLOOD_REASON[STRING_SHORT];
+#endif
+
+#ifdef ENABLE_QUIZ
+extern long QUIZ_TIMER;
+extern long QUIZ_REPEAT_TIMER;
+#endif
+
+extern bool HELP_GREET;
+extern bool AUTOHELP_GUESTS;
+
+extern char mySetinfo[STRING_SHORT];
+extern char myVariables[STRING_SHORT];
+
extern struct rusage r_usage;
extern struct ignorelist
{
char nick[STRING_SHORT];
struct ignorelist *next;
}
*ignorehead;
extern struct sendq
{
char data[STRING_SHORT];
struct sendq *next;
}
*sendqhead, *sendqtail;
extern struct userlist
-{ /* internal userlist */
+{ /* internal userlist */
char chan[STRING_SHORT];
char nick[STRING_SHORT];
char uh[STRING_SHORT];
- long level; /* auth */
- short global; /* Global user? */
+ long flags; /* op/voice/etc */
+ long level; /* auth */
+ short global; /* Global user? */
long idle;
struct userlist *next;
}
*userhead;
extern struct helperlist
{
char chan[STRING_SHORT];
char uh[STRING_SHORT];
char nick[STRING_SHORT];
long level;
size_t num_join;
char greetz[STRING_SHORT];
char pass[STRING_SHORT];
struct helperlist *next;
}
*helperhead;
/**
* 6/23/00 Dan
* - Changed permbanlist to have dynamically allocated
* userhost and reason fields.
* - Changed type of counter to size_t, this should be an
* unsigned type.
*/
extern struct permbanlist
{
char *uh;
char *reason;
size_t counter;
struct permbanlist *next;
}
*permbanhead;
extern struct old
{
char host[200];
long time;
int count;
int value;
int kick;
}
-ood[STRING_SHORT];
+ ood[STRING_SHORT];
extern struct sl124
{
char name[STRING_SHORT];
long port;
- char pass[STRING_SHORT];
+ char pass[STRING_SHORT];
struct sl124 *next;
}
*sh124;
+#ifdef ENABLE_STATS
extern struct statslist
{
char nick[STRING_SHORT];
char uh[STRING_SHORT];
long total;
long added_time;
long last_time;
struct statslist *next;
}
*statshead;
+#endif
extern struct randstats
{
char chan [STRING_SHORT];
size_t Rand_Stuff;
size_t Rand_Idle;
size_t refnum;
- size_t nCount; // Number of times we outputted to this channel.
-
+ size_t nCount; /* Number of times we outputted to this channel. */
struct randstats *next;
-// struct randstats *prev;
+/* struct randstats *prev; */
}
*randstatshead;
extern struct webinfo
{
char trigger[STRING_SHORT];
char host[STRING_SHORT];
int port;
char url[STRING_SHORT];
}
- GOOGLE_webinfo, METAR_webinfo, TAF_webinfo;
+ GOOGLE_webinfo, METAR_webinfo, TAF_webinfo, WEATHER_webinfo;
+
+
+enum setup_type
+{
+ ST_BOOLEAN = 0,
+ ST_INTEGER = 1,
+ ST_STRING = 2
+};
+
+enum chanserv_invoke_type
+{
+ DIRECT_INVOKE = 0, // command
+ ADDRESS_INVOKE = 1, // bot: command
+ MSG_INVOKE = 2, // /msg bot command
+ CHAR_INVOKE = 3 // !command
+};
+
+extern struct setup_parameter
+{
+ enum setup_type type;
+ int access; /* Access level required to change the value. */
+ size_t max_size;
+ char *parameter[5];
+ char *summary;
+ void *value; /* Where the value is stored. */
+ void *(*func) (struct setup_parameter *parameter, char *ptr); /* Optional function that can do other things with the value, and veto the change by returning NULL. */
+}
+parameters[];
diff --git a/source/web.c b/source/web.c
index 00e30c3..fa8860f 100755
--- a/source/web.c
+++ b/source/web.c
@@ -1,456 +1,631 @@
#include "defines.h"
#include "vars.h"
#include "prototypes.h"
-#include "stdio.h"
+
+#if defined ENABLE_GOOGLE || defined ENABLE_METAR || defined ENABLE_TAF || defined ENABLE_WEATHER
+
+static void init_sockaddr (struct sockaddr_in *, char *, unsigned short int);
+static int web_open_socket (char *host, int port);
+static int web_write_server (int filedes, char *format,...);
+static int web_read_server (char *source, char *uh, char *target, int filedes, char *host);
+static int google_parse_query (char *source, char *uh, char *target, char *data);
+static int weather_parse_query (char *source, char *uh, char *target, char *data);
+static int metar_parse_query (char *source, char *uh, char *target, char *data);
+static int taf_parse_query (char *source, char *uh, char *target, char *data);
+
int
web_post_query(char *trigger, char *source, char *uh, char *target, char *query, int size)
{
char *ptr = NULL;
char *mem = NULL;
struct webinfo *wi = NULL;
- if(stricmp (trigger, GOOGLE_webinfo.trigger) == 0)
+ if(strcasecmp (trigger, GOOGLE_webinfo.trigger) == 0)
{
wi = (struct webinfo *) &GOOGLE_webinfo;
}
- else if(stricmp (trigger, METAR_webinfo.trigger) == 0)
+ else if(strcasecmp (trigger, METAR_webinfo.trigger) == 0)
{
wi = (struct webinfo *) &METAR_webinfo;
}
- else if(stricmp (trigger, TAF_webinfo.trigger) == 0)
+ else if(strcasecmp (trigger, TAF_webinfo.trigger) == 0)
{
wi = (struct webinfo *) &TAF_webinfo;
}
+ else if(strcasecmp (trigger, WEATHER_webinfo.trigger) == 0)
+ {
+ wi = (struct webinfo *) &WEATHER_webinfo;
+ }
else
{
return SUCCESS;
}
size++; // for null
if((ptr = calloc(size, sizeof(char))) == NULL)
{
return ERR_CANT_MALLOC;
}
mem = ptr;
if(web_open_socket(wi->host, wi->port) != SUCCESS)
{
free (mem);
return ERR_OPEN_SOCKET;
}
snprintf(ptr, size + 1, "%s", query);
while(*ptr != '\0')
{
if(*ptr == ' ')
{
*ptr = '+';
}
ptr++;
}
if(web_write_server(wsock, "GET %s%s HTTP/1.0\n\n", wi->url, mem) != SUCCESS)
{
free (mem);
return ERR_WRITE_SOCKET;
}
/* i'm passing the trigger instead of the host to web_read_server
because the hostnames could be equal (see METAR & TAF) */
if(web_read_server(source, uh, target, wsock, wi->trigger) != SUCCESS)
{
free (mem);
return ERR_READ_SOCKET;
}
close(wsock);
free (mem);
return SUCCESS;
}
-void
+static void
init_sockaddr (struct sockaddr_in *name, char *host, unsigned short int port)
{
struct hostent *hostinfo;
name->sin_family = AF_INET;
name->sin_port = htons (port);
hostinfo = gethostbyname (host);
if (!hostinfo)
{
return;
}
name->sin_addr = *(struct in_addr *) hostinfo->h_addr;
}
-int
+static int
web_open_socket(char *host, int port)
{
extern void init_sockaddr (struct sockaddr_in *name, char *host, unsigned short int port);
struct sockaddr_in name;
struct timeval timeout;
int result = 0;
int esc = 0;
fd_set set;
if((wsock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
return ERR_CANT_CONNECT;
}
if((result = fcntl(wsock, F_SETFL, O_NONBLOCK)) < 0)
{
return ERR_CANT_CONNECT;
}
init_sockaddr (&name, host, port);
if(connect(wsock, (struct sockaddr *) & name, sizeof(name)) != -1)
{
return ERR_CANT_CONNECT;
}
if(errno != EINPROGRESS)
{
return ERR_CANT_CONNECT;
}
while(!esc)
{
timeout.tv_sec = 10;
timeout.tv_usec = 0;
FD_ZERO(&set);
FD_SET(wsock, &set);
- switch(select(FD_SETSIZE, (fd_set *) 0, &set, (fd_set *) 0, &timeout))
+ switch(select(FD_SETSIZE, (fd_set *) NULL, &set, (fd_set *) NULL, &timeout))
{
case 0:
return ERR_TIMED_OUT;
case -1:
break;
default:
esc++;
switch(getsockopt(wsock, SOL_SOCKET, SO_ERROR, &sockerr, &optlen))
{
case -1:
break;
case 0:
switch(sockerr)
{
case ECONNREFUSED:
break;
case EADDRNOTAVAIL:
break;
case ENETUNREACH:
break;
case SUCCESS:
if((result = fcntl(wsock, F_SETFL, 0)) < 0)
{
return ERR_CANT_CONNECT;
}
return SUCCESS;
}
}
}
}
return SUCCESS;
}
-int
+static int
web_write_server (int filedes, char *format,...)
{
int nbytes = 0;
va_list arglist;
char message[STRING_LONG] = {0};
struct timeval timeout;
fd_set set;
va_start(arglist, format);
vsprintf(message, format, arglist);
va_end(arglist);
while(1)
{
timeout.tv_sec = 10;
timeout.tv_usec = 0;
FD_ZERO(&set);
FD_SET(filedes, &set);
- switch (select(FD_SETSIZE, (fd_set *) 0, &set, (fd_set *) 0, &timeout))
+ switch (select(FD_SETSIZE, (fd_set *) NULL, &set, (fd_set *) NULL, &timeout))
{
case 0:
close(filedes);
return ERR_SERVER_BUSY;
case -1:
if (!alarmed)
{
- sleep(RECHECK);
+ db_sleep(RECHECK);
}
else
{
alarmed = 0;
}
break;
default:
if((nbytes = write(filedes, message, strlen(message) + 1)) < 0)
{
return ERR_SERVER_BUSY;
}
else
{
return SUCCESS;
}
}
}
}
-int
+static int
web_read_server(char *source, char *uh, char *target, int filedes, char *host)
{
int nbytes = 0;
int esc = 0;
char packet[STRING_LONG] = { 0 };
char *mem = NULL;
char *ptr = NULL;
struct timeval timeout;
fd_set set;
if((mem = calloc(sizeof(packet) + 1, sizeof(char))) == NULL)
{
return ERR_READ_SOCKET;
}
alarm(0);
while(!esc)
{
timeout.tv_sec = 10;
timeout.tv_usec = 0;
FD_ZERO(&set);
FD_SET(filedes, &set);
- switch(select(FD_SETSIZE, &set, (fd_set *) 0, (fd_set *) 0, &timeout))
+ switch(select(FD_SETSIZE, &set, (fd_set *) NULL, (fd_set *) NULL, &timeout))
{
case 0:
close(filedes);
alarm(AIL);
free (mem);
return ERR_SERVER_BUSY;
case -1:
break;
default:
alarm(AIL);
esc = 1;
break;
}
}
while((nbytes = recv(filedes, packet, sizeof(packet), 0)) > 0)
{
strncat(mem, packet, sizeof(packet));
if((ptr = realloc(mem, strlen(mem) + sizeof(packet) + 1)) == NULL)
{
free ( mem );
return ERR_CANT_MALLOC;
}
else
{
mem = ptr;
}
memset(packet, 0, sizeof(packet));
}
if(nbytes < 0)
{
free ( mem );
return ERR_SERVER_BUSY;
}
close(filedes);
- if(stricmp (host, GOOGLE_webinfo.trigger) == 0)
+ if(strcasecmp (host, GOOGLE_webinfo.trigger) == 0)
{
google_parse_query(source, uh, target, mem);
}
- else if(stricmp (host, METAR_webinfo.trigger) == 0)
+ else if(strcasecmp (host, METAR_webinfo.trigger) == 0)
{
metar_parse_query(source, uh, target, mem);
}
- else if(stricmp (host, TAF_webinfo.trigger) == 0)
+ else if(strcasecmp (host, TAF_webinfo.trigger) == 0)
{
taf_parse_query(source, uh, target, mem);
}
+ else if (strcasecmp (host, WEATHER_webinfo.trigger) == 0)
+ {
+ weather_parse_query (source, uh, target, mem);
+ }
free(mem);
return SUCCESS;
}
+static int
+weather_parse_query (char *source, char *uh, char *target, char *data)
+{
+ char *s1 = NULL, *s2 = NULL;
+ char *tmp = NULL, *temp = NULL, *city = NULL;
+ char *humid = NULL, *dew = NULL;
+ char *wind = NULL, *pres = NULL, *cond = NULL;
+ char *vis = NULL, *cloud = NULL, *wind2 = NULL;
+ char *sunr = NULL, *suns = NULL;
-int
+ char sub1[] = "<b>";
+ char sub2[] = "<span class=\"nowrap\"><b>";
+
+
+ if ((s1 = strstr (data, "Observed at")) != NULL)
+ {
+ s2 += 8;
+ if ((s2 = strstr (s1, sub1)) != NULL)
+ {
+ city = strtok (s2, "</b>");
+ data = strtok (NULL, "");
+ }
+ }
+
+ if ((s1 = strstr (data, "Temperature")) != NULL)
+ {
+ if ((s2 = strstr(s1, sub1)) != NULL)
+ {
+ s2 += strlen (sub1);
+
+ temp = strtok (s2, "</b>");
+ data = strtok (NULL, "");
+ }
+ }
+
+ if ((s1 = strstr (data, "Humidity")) != NULL)
+ {
+ if ((s2 = strstr(s1, sub1)) != NULL)
+ {
+ s2 += strlen (sub1);
+
+ humid = strtok (s2, "</b>");
+ data = strtok (NULL, "");
+ }
+ }
+
+ if ((s1 = strstr (data, "Dew Point")) != NULL)
+ {
+ if ((s2 = strstr(s1, sub1)) != NULL)
+ {
+ s2 += strlen (sub1);
+
+ dew = strtok (s2, "</b>");
+ data = strtok (NULL, "");
+ }
+ }
+
+ if ((s1 = strstr (data, "Wind")) != NULL)
+ {
+ if ((s2 = strstr(s1, sub1)) != NULL)
+ {
+ s2 += strlen (sub1);
+
+ wind = strtok (s2, "</b>");
+ data = strtok (NULL, "");
+
+ if ((tmp = strstr (data, sub2)) != NULL)
+ {
+ tmp += strlen (sub2);
+ wind2 = strtok (tmp, "</b>");
+ data = strtok (NULL, "");
+ }
+
+ }
+ }
+
+ if ((s1 = strstr (data, "Pressure")) != NULL)
+ {
+ if ((s2 = strstr(s1, sub1)) != NULL)
+ {
+ s2 += strlen (sub1);
+
+ pres = strtok (s2, "</b>");
+
+ data = strtok (NULL, "");
+ }
+ }
+
+ if ((s1 = strstr (data, "Conditions")) != NULL)
+ {
+ if ((s2 = strstr(s1, sub1)) != NULL)
+ {
+ s2 += strlen (sub1);
+
+ cond = strtok (s2, "</b>");
+ data = strtok (NULL, "");
+ }
+ }
+
+ if ((s1 = strstr (data, "Visibility")) != NULL)
+ {
+ if ((s2 = strstr(s1, sub1)) != NULL)
+ {
+ s2 += strlen (sub1);
+
+ vis = strtok (s2, "</b>");
+ data = strtok (NULL, "");
+ }
+ }
+
+ if ((s1 = strstr (data, "Clouds")) != NULL)
+ {
+ if ((s2 = strstr(s1, sub1)) != NULL)
+ {
+ s2 += strlen (sub1);
+
+ cloud = strtok (s2, "</b>");
+ data = strtok (NULL, "");
+ }
+ }
+
+ if ((s1 = strstr (data, "Sunrise")) != NULL)
+ {
+ if ((s2 = strstr(s1, sub1)) != NULL)
+ {
+ s2 += strlen (sub1);
+
+ sunr = strtok (s2, "</b>");
+ data = strtok (NULL, "");
+ }
+ }
+
+ if ((s1 = strstr (data, "Sunset")) != NULL)
+ {
+ if ((s2 = strstr(s1, sub1)) != NULL)
+ {
+ s2 += strlen (sub1);
+
+ suns = strtok (s2, "</b>");
+ data = strtok (NULL, "");
+ }
+ }
+
+ /* Display stuff to target. */
+ S ("PRIVMSG %s :%s: Temperature (%s%cF) Humidity (%s) DewPoint (%s%cF) Wind (%s at %smph) Pressure (%s in) Conditions (%s) Visibility (%s miles) Clouds (%sft) Sunrise (%s) Sunset (%s)\n",
+ target, city, temp, 176, humid, dew, 176, wind, wind2, pres,
+ cond, vis, cloud, sunr, suns);
+
+}
+static int
google_parse_query(char *source, char *uh, char *target, char *data)
{
char *s1 = NULL;
char *s2 = NULL;
char *s3 = NULL;
char *s4 = NULL;
char url[STRING_LONG] = { 0 };
char sub1[] = "<p class=g><a href=";
if(strstr(data, "did not match any documents") != NULL)
{
S("PRIVMSG %s :Sorry, your search did not match any documents.\n", target);
return ERR_NO_DOCUMENTS;
}
if((s1 = strstr(data, "Results ")) != NULL)
{
if((s2 = strstr(s1, sub1)) != NULL)
{
s2 += strlen(sub1);
if((s4 = strstr(s2, "http")) == NULL)
{
S("PRIVMSG %s :Try again later.\n", target);
return ERR_NO_DOCUMENTS;
}
if((s3 = strchr(s4, '\"')) != NULL)
{
*s3 = '\0';
}
if((s3 = strstr(s4, "&e=")) != NULL)
{
*s3 = '\0';
}
snprintf(url, sizeof(url), "%s", s4);
}
if(url[0] != 'h')
{
S("PRIVMSG %s :Try again later.\n", target);
return ERR_NO_DOCUMENTS;
}
S("PRIVMSG %s :%s%s\n", target, rand_reply(source), url);
+#ifdef ENABLE_STATS
add_stats (source, uh, 1, time (NULL), time (NULL));
+#endif
}
else
{
S("PRIVMSG %s :Sorry, your search did not match any documents.\n", target);
return ERR_NO_DOCUMENTS;
}
return SUCCESS;
}
-int
+static int
metar_parse_query(char *source, char *uh, char *target, char *data)
{
char *s1 = NULL;
char *s2 = NULL;
char metardata[STRING_LONG] = { 0 };
int i = 0;
if((s1 = strstr(data, "The observation is:")) != NULL)
{
/* skip the next 3 html tags */
while(i<3)
{
while(*s1 != '>')
{
s1++;
}
s1++;
i++;
}
while((*s1 == 0x0D) || (*s1 == 0x0A))
{
s1++;
}
if((s2 = strchr(s1, '<')) != NULL)
{
*s2 = '\0';
}
s2 = s1;
while (*s2 != '\0')
{
if ((*s2 == 0x0D) || (*s2 == 0x0A))
{
*s2 = ' ';
}
s2++;
}
snprintf(metardata, sizeof(metardata), "%s", s1);
S("PRIVMSG %s :%s%s\n", target, rand_reply(source), metardata);
+#ifdef ENABLE_STATS
add_stats (source, uh, 1, time (NULL), time (NULL));
+#endif
}
else
{
S("PRIVMSG %s :Sorry, no METAR data available.\n", target);
return ERR_NO_DOCUMENTS;
}
return SUCCESS;
}
-int
+static int
taf_parse_query(char *source, char *uh, char *target, char *data)
{
char *s1 = NULL;
char *s2 = NULL;
char tafdata[STRING_LONG] = { 0 };
int i = 0;
if((s1 = strstr(data, "The observation is:")) != NULL)
{
/* skip the next 4 html tags */
while(i<4)
{
while(*s1 != '>')
{
s1++;
}
s1++;
i++;
}
while((*s1 == 0x0D) || (*s1 == 0x0A))
{
s1++;
}
if((s2 = strchr(s1, '<')) != NULL)
{
*s2 = '\0';
}
s2 = s1;
while (*s2 != '\0')
{
if ((*s2 == 0x0D) || (*s2 == 0x0A) || (*s2 == 0x09))
{
*s2 = ' ';
}
s2++;
}
snprintf(tafdata, sizeof(tafdata), "%s", s1);
S("PRIVMSG %s :%s%s\n", target, rand_reply(source), tafdata);
+#ifdef ENABLE_STATS
add_stats (source, uh, 1, time (NULL), time (NULL));
+#endif
}
else
{
S("PRIVMSG %s :Sorry, no TAF data available.\n", target);
return ERR_NO_DOCUMENTS;
}
return SUCCESS;
}
+
+#endif
diff --git a/beta/testing.sh b/testing.sh
similarity index 100%
rename from beta/testing.sh
rename to testing.sh

File Metadata

Mime Type
application/octet-stream
Expires
Mon, Sep 8, 06:40 (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2965822
Default Alt Text
(1 MB)

Event Timeline