An OpenSource VooDoo cIRCle version 1.1.40 - documentation for users

logo

Table of contents

  1. Developers
  2. Purpose and URL of project
  3. Change log
  4. OpenSSL linkage
  5. Configuration - file logic.txt
    1. Basic configuration knowledge
    2. Structure of logic.txt file
    3. Other access flags has little bit similar meaning
    4. List of events that can be assigned to user on channel
    5. List of flood limits assigned to specific user on channel
    6. Channel definitions
    7. Events on channel definition
    8. Private definitions
    9. Procedures and functions
      1. Procedure and function commands and syntax
      2. "op" command
      3. "deop" command
      4. "voice" command
      5. "devoice" command
      6. "kick" command
      7. "msg" command
      8. "msgq" command
      9. "if_match" command
      10. "!if_match" command
      11. "if_match_case_insensitive" command
      12. "!if_match_case_insensitive" command
      13. "if_in" command
      14. "!if_in" command
      15. "if_group" command
      16. "!if_group" command
      17. "return" command
      18. "timer_once" command
      19. "timer_every" command
      20. "execute" command
      21. "SMTP" command / "smtp_raw1" function
      22. "NET_SEND" command / "net_send" function
      23. "LOG" command / "log_print" function
      24. "join" command
      25. "part" command
      26. "disconnect" command
      27. "irc_server" command
      28. "irc_server_ex" command
      29. "try_connect" and "if_error" command sequence
      30. "bot_nick" command
      31. "bot_ident" command
      32. "bot_ident_ipv6" command
      33. "bot_fullname" command
      34. "bot_auth" command
      35. "allow_redirect" command
      36. "sleep" command
      37. "restart" command
      38. "notice" command
      39. "noticeq" command
      40. "unban_mask" command
      41. "ban_mask" command
      42. "dcc_server" command
      43. "dcc_server_ipv6" command
      44. "label" command
      45. "goto" command
      46. "ident" command
      47. "host" command
      48. "SCRIPT" command / "script" function
      49. "telnet_server" command
      50. "telnet_server_ipv6" command
      51. "link" command
      52. "work" command
      53. "chan_mode" command
      54. "change_nick" command
      55. "kill_timers" command
      56. "get_chan_mode" command
      57. "get_chan_topic" command
      58. "topic" command
      59. "check_dynamic_bans" command
      60. "dynamic_ban" command
      61. "process_on_banned" command
      62. "raw" command
      63. "remote_execute" command
      64. "delete_irc_servers" command
      65. "delete_nicks" command
      66. "admin_msg" command
      67. "rem" command
      68. "eval" command
      69. "explode" function
      70. "ord" function
      71. "bind" command
      72. "unbind" command
      73. "bind_ex" command
      74. "unbind_ex" command
      75. "dispatch" function
      76. "var_dump" function
      77. "mask_match" function
      78. "time" function
      79. "strtoupper" function
      80. "strtolower" function
      81. "strpos" function
      82. "strlen" function
      83. "load_module" command
      84. "unload_module" command
      85. "count" function
      86. "chr" function
      87. "get_nick_mode" command
      88. "get_bot_nick" command
      89. "get_event_id" command
      90. "set" command
      91. "isset" command
      92. "array" command
      93. "NULL" command
      94. "deop_ban_mask" command
      95. "md5" function
      96. "rand" function
      97. "getrandmax" function
      98. "fopen" function
      99. "fgets" function
      100. "fputs" function
      101. "fclose" function
      102. "fseek" function
      103. "ftell" function
      104. "fread" function
      105. "make_valid_filename" function
      106. "trim" function
      107. "feof" function
      108. "filesize" function
      109. "ssl_server" command
      110. "load_bin_module" command
      111. "have_func" function
      112. "preg_grep" function
      113. "preg_match_all" function
      114. "preg_match" function
      115. "preg_split" function
      116. "preg_replace" function
      117. "preg_last_error" function
      118. "get_bot_name" command
      119. "get_current_irc_server" command
  6. Modules and messages
    1. Intro
    2. Messages
  7. Built-in global variables
  8. Configuration - file "conf.txt"
    1. botname
    2. admin - your e-mail
    3. botnet_penalty
    4. log_echo_debug
    5. log_echo_irc
    6. log_echo_socket
    7. log_echo_bot
    8. log_echo_identd
    9. log_echo_botnet
    10. log_echo_botnet_debug
    11. log_echo_clients
    12. log_debug
    13. log_irc
    14. log_socket
    15. log_bot
    16. log_identd
    17. log_botnet
    18. log_botnet_debug
    19. log_clients
    20. php_processor
    21. php_processor_args
    22. php_script_dir
    23. php_1
    24. php_2
    25. php_2_1
    26. perl_processor
    27. perl_processor_args
    28. perl_script_dir
    29. perl_1
    30. perl_2
    31. dcc_bind_ip
    32. dcc_bind_ip6
    33. notify_interval
    34. dcc_max_transfers
    35. ctcp_lag_user_msgs
    36. ctcp_lag_user_seconds
    37. dcc_send_timeout
    38. irc_bot_flood_bytes
    39. irc_bot_flood_seconds
    40. irc_bot_flood_lines
    41. 127.0.0.1_dcc_user
    42. msg_force_secure_lines
    43. irc_bot_flood_other_seconds
    44. try_reverse_lookup
    45. important_ident_daemon
    46. compress_mode_wait
    47. smart_mode
    48. send_+R
    49. dcc_chat_ping_interval
    50. lockout_duration
    51. lockout_count
    52. dcc_max_message_size
    53. dcc_max_sessions_per_ip
    54. auto_backup_interval
    55. disable_ident_daemon
    56. dcc_always_want_nick
    57. irc_part_msg_on_cycle
    58. irc_part_msg_on_.part_w_reason
    59. irc_part_msg_on_.part_wo_reason
    60. irc_quit_msg_on_.die
    61. irc_quit_msg_on_.restart
    62. dcc_send_chunk_size
    63. max_array_recursion
    64. max_proc_recursion
    65. max_eval_recursion
    66. eval_script_timeout
    67. max_logic_backups
    68. rot_log
    69. log_rot_switch_time
    70. log_rot_keep_days
    71. dcc_bind_ip_dynamic
    72. dcc_bind_ip6_dynamic
    73. eval_stack_size
    74. time_offset
    75. umask
    76. log_cumul
    77. sendmail
    78. dcc_disable_reverse_ip_check
    79. sys_startup_script_timeout_protect
  9. Quick start
  10. Botnet and replication
  11. PHP scripting (old method)
  12. PHP scripting ("php_2" method)
  13. PERL scripting
  14. DCC / telnet commands
    1. .help
    2. .whois <name>
    3. .+user
    4. .edituser
    5. .+proc
    6. .editproc
    7. .editchan
    8. .+chan
    9. .quit
    10. .backup
    11. .rehash
    12. .filesystem
    13. .msg
    14. .getfile <filename> <optional_dcc_group>
    15. .partyline <partyline_channel_(optional)>
    16. .leave
    17. .restart
    18. .die
    19. .+group <groupname>
    20. .private
    21. .replication
    22. .terminator
    23. .lang
    24. .part
    25. .join
    26. .rproc
    27. .upgrade
    28. .chpass
    29. .showbots
    30. .broadcastping
    31. .execute
    32. .apply
    33. .pass
    34. .stat or .stats
    35. .touch
    36. .info
  15. Notes about delegation of some user to maintain channel
  16. Compilation
  17. Filesystem
  18. VooDoo cIRCle service (Windows(TM) only)
    1. Installation of service
    2. Configuration of service
    3. Contents of this file
    4. Example
  19. Configuration - file "pass.txt"
  20. Configuration - file "ssl.txt"
  21. Configuration - file "motd.txt" (Message Of The Day)
  22. Character case mapping issues
  23. CLI - command line interface
  24. File "logs/irc_bot.action"
  25. Good tips
  26. Security notes
  27. Signal handling (unices and Win)
  28. FAQ's
    1. How can I delete user?
    2. Which host masks/wildcards are supported?
    3. Does IPv6 host masks for IPv6 IRC users work even bot is not compiled with IPv6 support?
    4. How could I compile bot with IPv6 support?
    5. There is feature that supports recognition also by their "full name mask". Can I turn it off?
    6. How can I compile this bot?
  29. Additional information
  30. How to report a bug
  31. Important legal notices
  32. Credits
  33. License

Developing of this software


VooDoo cIRCle Copyright (C) 2004-2010 Marian VooDooMan Meravy (ghostvoodooman [NOSPAM] (at) [NOSPAM] users (dot) [NOSPAM!] sourceforge (dot) net). Licensed under GNU/GPL license version 2
 
VooDoo cIRCle comes with ABSOLUTELY NO WARRANTY; for details see `license.html'. This is free software, and you are welcome to redistribute it under certain conditions; see the license for details.
 
This product uses zlib library for compressing written by Jean-loup Gailly and Mark Adler

Contains code stolen/borrowed from:

IRCd
ftp://ftp.irc.org/irc/server/
GNU/GPL (used code for matching hostmasks and few functions in match.cpp/match.h)

Andrew Gierth
http://www.faqs.org/faqs/unix-faq/programmer/faq/
(daemon() and closeall() functions in irc_bot.cpp)

Colin Plumb in 1993, John Walker
public domain
(functions for MD5 in md5.cpp)

Luc Maisonobe
http://cvs.savannah.gnu.org/viewcvs/src-highlite/src-highlite/acinclude.m4?rev=1.25
(useful parts of "configure.in")

Perceval ANICHINI <perceval.anichini (at) epita.fr>
http://autoconf-archive.cryp.to/ac_cxx_have_ext_hash_map.html
(useful parts of "configure.in")

Bob Jenkins, May 2006
http://www.burtleburtle.net/bob/hash/doobs.html
http://www.burtleburtle.net/bob/c/lookup3.c
Public Domain
(fast 32 bit hashing function in "jenkins_hash.cpp" - for hash tables)

Kasper Peeters
http://www.aei.mpg.de/~peekas/tree/
GNU/GPLv2
Copyright (C) 2001-2010 Kasper Peeters <kasper (d-o-t) peeters (at) aei.mpg.de>.
Modifications Copyright (C) 2006-2010 Marian VooDooMan Meravy
(files "tree/tree.hh", "tree/*", C++ STL-like templated tree class)

Todd Veldhuizen
Luc Maisonobe luc (at) spaceroots.org
http://autoconf-archive.cryp.to/ac_cxx_namespaces.html
(useful parts of "configure.in")

Andy Pennell, 2002
http://www.codeproject.com/debug/postmortemdebug_standalone1.asp
(files irc_bot/src/mdump/mdump.cpp and mdump.h)

September 2003 - Tiago Sousa <mirage (at) kaotik.org>
http://www.trl.ibm.com/projects/security/ssp/
http://www.trl.ibm.com/projects/security/ssp/gcc2_95_3/gcc_stack_protect.m4.gz
Useful macros for autoconf to check for ssp-patched gcc
(file irc_bot/configure.in)

Steven G. Johnson <stevenj (-a=t) alum.mit (d ot?) edu>, 2006-05-29
http://ac-archive.sourceforge.net/ac-archive/acx_pthread.html
Useful macros for autoconf to check for various portable pthread library detection
(file irc_bot/configure.in)

Purpose

VooDoo cIRCle is an IRC (ro)bot.

Official URL of project is http://voodoo-circle.sourceforge.net/ (opens in a new window).


Changes

(skip ChangeLog)

Release version 1.1.40
Date: 2010-06-24
Bug fix: Potential crash due to reentrancy of garbage collection of script variables.
Bug fix: Security: Windows binary distributions are vulnerable due to distribution and usage of vulnerable OpenSSL library.

Release version 1.1.40
Date: 2010-03-13
Bug fix: Fixed crash when user's internal script removes ban from a channel while bot's rehash is issued.

Release version 1.1.38
Date: 2009-11-12
Security: Windows binary distribution was using vulnerable OpenSSL library.
Bug fix: Fixed crash in PRNG seeding function, due to "cast to smaller type assertion failure due to overflow" when the bot is ran for the very first time and compiled in debug mode with OpenSSL using MSVC compiler, when there is no "openssl.rnd" file for seeding.

Release version 1.1.37
Date: 2009-10-12
GIT pre-release version 1.1.37-git
Date: 2009-07-04
Improvement: Reorganized channel sync on bot's JOIN. We first send JOIN and WHO in CRITICAL priority, to make users in channel recognised very soon.
Improvement: Keepalive IRC server PING period increased from 30 seconds to 5 minutes (this could help in case of short network connectivity loss, and in theory TCP retransmission would handle it).
Improvement: Early on connect, the bot performs self-WHOIS to force dynamic (re)binding of dynamic IP servers (e.g. DCC, telnet and so on), even when bot will not JOIN any channel.
Bug fix: On heavy-loaded machine, when using SSL IRC connection, assertion failure on IRC authentication when IRC socket was already closed by SSL subsystem due to server disconnect.
Bug fix: Race condition was possible when heap debugging was turned on.
Security: Windows binary distribution was using vulnerable OpenSSL library.

Release version 1.1.36 (maintenance release)
Date: 2009-03-26
Bug fix: Windoze binary build: x86 package contained x64 DLL pcre-msw.dll, preventing to run the bot.
Bug fix: Security: Windoze binary builds: All versions prior to this are affected by multiple OpenSSL security vulnerabilities. See OpenSSL security advisory for more informations: http://www.openssl.org/news/secadv_20090325.txt

Release version 1.1.35
Date: 2009-03-24
Bug fix: Memory leak when dispatching some events.

Release version 1.1.34 (maintenance release)
Date: 2009-01-23
Bug fix: Win32 binary release: There was vulnerable version of OpenSSL library: http://www.openssl.org/news/secadv_20090107.txt .

Release version 1.1.33 (maintenance release)
Date: 2008-11-24
Improvement: Win32/Win64 binary release: There were problems with DLL's, now only Visual C++ 2008 redistributable package is needed.
Improvement: *NIX: Release with fix: http://voodoo-circle.sourceforge.net/sa/sa-20080904-01.html .
Bug fix: Win32 binary release: There was vulnerable version of GnuTLS library: http://article.gmane.org/gmane.comp.encryption.gpg.gnutls.devel/3248 .

CVS pre-release version 1.1.33-cvs
Date: 2008-09-04
Bug fix: POSIX: Resource leak existed in previous versions when in POSIX environments GnuTLS library is used, and pthread (the default) library is used. As default, RSA and DH parameters are regenerated every 12 hours or every 500 connections to SSL-enabled network socket connection (this can be adjusted in "params.h"). Thread was not killed, which can have security consequences (DoS).
Change: A better message when using OpenSSL library and files "./openssl.rnd", "/dev/urandom", and "/dev/random" do not exist, so 'rand() ^ rand()' seeding as fallback is used.

CVS pre-release version 1.1.33-cvs
Date: 2008-08-23
Bug fix: POSIX: Possible heap-based buffer overflow when POSIX operating system returns human-readable string description of a socket error code longer than 1023 bytes. However, it is very unlikely that there is an operating system with such long BSD socket API error messages. This bug is not critical, and don't affect Windoze users.
Bug fix: POSIX: In some circumstances, if BSD socket API calls to "socket()" and "bind()", an incorrect error message might be logged to logs ("socket.log", "cumul.log", if enabled).
Improvement: Windoze: Implemented all Winsock socket error code mappings to error string for human for logs. Strings were taken from the latest MSDN to date. All codes are guarded by the preprocessor, so if for instance you are compiling the bot on XP, which don't have particular V*sta's error, the compilation should succeed.
Bug fix: Documentation: Fixed incorrect description for "preg_grep" built-in function (copy-and-paste error).
Bug fix: When there were exactly same bound events via "bind" procedure command/built-in function, call to "unbind" procedure command/built-in function with the same arguments killed only first bound event in particular module, not all of them. This affected both standard modules and binary modules.
Improvement: New procedure commands/built-in functions "bind_ex" and "unbind_ex". See documentation here and here.
Change: Increased BOTNET protocol version from 1008 to 1009, as new procedure commands were added. Backward compatibility of BOTNET protocol is of course kept. This change is only required in case you run older bot on BOTNET (protocol version 1008), to force rejection PUSH replication of procedure(s) containing these new procedure commands to older bot on BOTNET (protocol version 1008 or less), since the replication would fail by error entries in "botnet.log" (if enabled). Of course, this case is only possible if you set replication rule PUSH or PUSHPULL on procedure containing these two new commands to older bot (of BOTNET protocol version 1008 or less).
Change: Increased "VDCMOD_API_VERSION" from version 4 to 5, in interface to binary modules, as there are new API functions for "bind_ex" and "unbind_ex". Backward compatibility is of course kept; you don't need to recompile your binary modules, unless you want to use these new API calls. NB: If you wish to use these two new API, you need to replace "vdcmod.h" file [API interface for binary modules to call bot's (new) API functions of bot] in you binary module by the new one that is in bot source package in CVS and/or distribution. Hint: If you are unsure whether you are using right/new include file, open "vdcmod.h" API interface file in your binary module and plain-text-search for string "#define VDCMOD_API_VERSION", and on the same line there should be number "5".
Bug fix: Memory leak when "on_flood" event is triggered and there is bound event "flood@channel" via procedure command "bind" or built-in function "bind()".
Bug fix: Memory leak when built-in function "dispatch()" was used.
Bug fix: "fread" function in built-in function scripting was malfunctioning on 64 bit platforms.
Bug fix: If module with '#version 3' at begining of 'logic.txt' without mandatory '#eof' at the end (required for version 3) was tried to load (which is failure), there were memory leaks (forgotten to free compiled microcode of built-in scripting functions).
Bug fix: Remote execute call to other bot on BOTNET sent badly-encoded data (thus rejected on remote side) if there were multidimensional arrays with long depth [important line of code was commented-out (?!)].
Bug fix: Parser of built-in function scripting parsed erroneous expressions e.g. '$x+=2 $x++' as thought it were '$x+=2; $x++;' and '$x=array( array(1,2) array("a","b") );' as '$x=array( array(1,2), array("a","b") );' and a like. Now sanity is checked.
Improvement: Sanity checker to parser of built-in function scripting was implemented, now it prints some warnings for strange expressions like '$y=$x[SEEK_SET];', or generates an error while compiling for '$x=3++;' - so far an error occurred at execution/run-time, not at compile time.
Improvement: Internal function scripting parser: Minor speed and memory optimization for "switch()"'s "default:" case label.
Improvement: Cosmetical changes: No warnings for "release" build (i.e. without debugging support) on MSVC 9 ("/W4" switch), less warnings and remarks for Intel(R) C++ compiler 10.1.022 for Windows, for compile with x64 and x86 profiles ("/W4" switch).
Improvement: Little speed gain after compiling built-in scripting procedures and functions - after successful module load (commented-out old ineffective code - it was odd as other algorithm was implemented in the past).

CVS pre-release
Date: 2008-08-01
Bug fix: Assertion failure due to closing non-existent socket of Ident daemon emulation in some cases. On Windows(TM) this causes 2 core dumps to be written, to log assertion failure to "cumul.log", but bot continues without error, or corruption of internal state. On POSIX, this causes core dump to be written and termination of bot, however, on these systems Ident daemon emulation is often disabled in configuration, since this requires root privileges.

Release version 1.1.32
Date: 2008-07-21
Improvement: Version bump. VooDoo cIRCle version 1.1.32. First non-beta version of 1.1.x series.
Note: This release includes cumulative improvements/bug fixes listed below of CVS pre-releases from release 1.1.beta31.

CVS pre-release
Date: 2008-07-02
Bug fix: For some odd reason MSVC's STL implementation has problems with reverse iterators on lists and vectors. We now use deque in such cases.
Improvement: We are now not removing redundant exactly same messages to IRC server. However, there is still some optimization on MODE commands (joining more MODE's into single one on the same channel in time-limited period), if "smart_mode" key in "conf.txt" is set to "1" in "compress_mode_wait" seconds period.
Improvement: If compiled with heap-debugging (default when debug mode is on), we zero memory prior to free. This can be turned off by "SANITIZE_FREED_MEMORY" preprocessor macro set to zero, e.g. in "params.h".
Improvement: Can be compiled with debugging turned off, and heap-debugging/memory leak detection turned on. See "REPORT_LEAKS" in "params.h".
Bug fix: When compiled without debugging support, there were reports not printed on shutdown.
Bug fix: Made able to compile with g++ -O2 and RAM quota 512 MiB (tested on linux x86_64 + gcc 4.1.2, i686 + gcc 4.1.1).

CVS pre-release
Date: 2008-06-29
Bug fix: Double-free error when fclose() fails with error due to misunderstanding of man page (mostly on low-disk condition, e.g. quota exceeded).
Bug fix: Memory leak when closing SSL socket but some data arrived on lower layer (this affects only non-Windows(TM) platforms, as there is different code used).

CVS pre-release
Date: 2008-06-17
Bug fix: There was bug in algorithm that erases redundant (multiple exactly same) messages to IRC server, leading to incorrect erasure of other messages. I suspect this bug is present only on specific STL implementations due to ambiguity of interpretation of ISO standard. Bug is confirmed in using of MSVC's STL implementation.
Bug fix: We are now removing redundant (multiple exactly same) messages to IRC that begins with "MODE ", "NICK ", "PART ", "QUIT ", "KICK " and "JOIN " only; others are unaffected now.
Improvement: Little speed improvement by using more suitable STL container for messages to IRC server ("deque" instead of "list", because we are using "push_back" and "pop_front").

CVS pre-release
Date: 2008-06-16
Change: Documentation: "Quick start" section: replaced "restart" command in case of IRC server disconnect by "goto" command to connect again.
Change: Documentation: "Quick start" section: better formatting of code according to coding standard.
Semi-bug fix: If enabled, in cumulative log "logs/cumul.log" there was missing information of originating module's name.
Semi-bug fix: If enabled, in cumulative log "logs/cumul.log" there was missing timestamp (it is critical for post-mortem debugging purposes in case of crash!).
Bug fix: Infinite loop after script evaluation timeout in function containing an infinite loop like "again: goto again;" - such script should be terminated after timeout.
Bug fix: If function evaluation timeout occurred, or recursion depth were too deep (according to rules in "conf.txt"), an error message in logs included "Additional info: Internal error: Uninitialized procedure command within 'c_eval_iteration' class construction #2" instead of actual line of function's code where the error occurred.
Improvement: Memory optimization: Less memory consumption because of shorted debug string for each line of compiled procedure in other than core module (there was long path to "logic.txt").
Improvement: There is "sys_startup_script_timeout_protect" key in "conf.txt" introduced for each module. This improves bot's stability on heavy-loaded machines. See documentation.

CVS pre-release
Date: 2008-06-08
Bug fix: Some log messages could be incorrectly logged do "debug.log" instead of "irc.log" in core module.
Bug fix: Possible memory leak around socket linger emulation. Hopefully fixed.
Bug fix: *NIX: When you were requesting version of bot (i.e. "--version" or "-v" command-line argument) and in your current working directory were not directory "logs/" it displayed two OOPS errors that shared semaphore (IPC locking object) could not be created.
Bug fix: When using in internal scripting code such as "global $_users; foreach($_users as $key => $val) { ...", there was "$val" always the same on each iteration, because this variable is read-only (cannot be modified by script). It also affected other superglobals variables such as "$_channels", or any that has read-only restriction.
Bug fix: Crash when loading non-core module and executing "_sys_startup" script procedure/function when its execution excess script execution timeout defined in module's "conf.txt" (possibly either due to logical error in script, or on heavy-loaded machine).
Bug fix: When there were two subsequent "execute" commands in procedure calling functions, next commands were not performed in that procedure, procedure execution stopped rather.
Bug fix: Crash when using "global $variable;" in built-in function scripting, and then built-in function were called with "$variable" as an argument that receives output into this variable after call.
Improvement: When running self test suite (command line argument "--eval-test-1" or on *NIX "make check") there are no more OOPS messages about missing "log_rot" key with value in "self_test" module.
Improvement: Changed timestamps in logs and files to conform to ISO 8601 international time standard notation.
Improvement: Changed format for "time_offset" in file "conf.txt". See documentation.
Bug fix: When in function internal scripting using "foreach" construct with referenced value, and it is unset but using something like "$val=NULL;", assertion failure has occurred.
Bug fix: To be as much as possible to PHP, "count()" function on arrays is now counting unset members (e.g. after "$x['something']=NULL;").
Bug fix: To be as much as possible to PHP, when concatenating variable to string (using operator ".") if variable is not set or it was unset, now "NULL" string will not be appended to string, but nothing rather.
Improvement: Introduced new command/built-in function "get_bot_name". See documentation.
Improvement: Introduced new command/built-in function "get_current_irc_server". See documentation.

Release version 1.1.beta31
Date: 2008-05-22
Bug fix: Windows binary distribution: Three security vulnerabilities in GnuTLS library, see vendor advisory: http://lists.gnu.org/archive/html/gnutls-devel/2008-05/msg00060.html .
Bug fix: In some circumstances GnuTLS library was not initialized before being used.
Bug fix: Race condition crash when executing script (mostly on IRC server connect) when IRC commands send causes reenter of IRC queue sending loop.
Improvement: Version bump. VooDoo cIRCle version 1.1.beta31.

Release version 1.1.beta31-cvs13
Date: 2008-05-10
Bug fix: Now when command-line argument "--get-ssl-cert" is used and bot is compiled with debugging support, time measurements will not interfere with output of certificate.
Bug fix: Argument "--get-ssl-cert" was not working when remote peer's certificate was not trusted (i.e. its certification authority was not in CA file).
Semi-bug fix: Spelling problem in error message.
Improvement: POSIX: Since data from file '/dev/random' comes slowly, when seeding OpenSSL PRNG (if saved file 'openssl.rnd' doesn't exists, or OpenSSL library decides that it has insufficient entropy) I made priority change. First is check that is whether file '/dev/urandom' exists (and will be used), and if not, '/dev/urandom' has second priority (in earlier versions this semantics were exchanged). If that file doesn't exist too, then C rand() function is used.
Improvement: If files for entropy '/dev/urandom' and '/dev/random' don't exist (e.g. on Windoze platform), entropy for OpenSSL seeding is now performed via C function expression 'rand() ^ rand()'. In earlier versions of bot it was simply 'rand()'. But still only lowest byte of expression is used.
Improvement: OpenSSL: If compiled with OpenSSL back-end, bot now ignore 'X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN' and 'X509_V_ERR_CERT_SIGNATURE_FAILURE' errors from library, to relax this restriction. There is no security concern, as SSL certificates were generated by you, the user (and should be - do not use example certificates in distribution for production purposes!).
Bug fix: At some circumstances IRC channel messages might not have been logged to "cumul.log" (if this log is enabled).
Bug fix: At some circumstances SSL-related messages might not have been logged to "cumul.log" (if this log is enabled).
Bug fix: Access to uninitialized variable.
Bug fix: Rare probability of crash (in debug configuration assertion failure) in some configurations, related to rehashing of core module, or at bot startup.
Bug fix: Memory leak of 1024 bytes each time a function from logic.txt is PUSHed to remote bot on BOTNET.
Semi-bug fix: Fixed not critical compiler warning produced by MSVC 2008 (9.0) compiler in "sock.cpp".
Improvement: Some SSL-enabled IRC servers don't send their SSL certificate when using "--get-ssl-cert" command-line option if we don't send any data, causing bot to timeout (of 30 seconds) in process of getting certificate. Now we send a dummy string "BOO!" ;-).
Bug fix: Memory leak when socket is closed in linger emulation mode and there are data to send/receive (e.g. when SSL error occurs).

Release version 1.1.beta31-cvs12
Date: 2008-05-06
Bug fix: Rare crash (in debug configuration assertion failure) in some configurations, related to loading modules.

Release version 1.1.beta31-cvs11
Date: 2008-05-04
Bug fix: Access to uninitalized variable (3 times).

Release version 1.1.beta31-cvs10
Date: 2008-04-27
Semi-bug fix: POSIX: 'configure' script: Now we are checking whether 'ar' tool is present on system.
Semi-bug fix: POSIX: 'configure' script: Now we are checking whether 'ranlib' tool is present on system.
Bug fix: Compile problem when compiling without IPv6 support enabled.
Bug fix: Compile problem when compiling without debugging support enabled.

Release version 1.1.beta31-cvs9
Date: 2008-04-08
Improvement: Bound events ("bind()" built-in function) can have now arbitrary name of one and only argument; so far it was restricted to "$dispatch" only.
Bug fix: Bound event "privmsg@private" was not called if user was not known, or event "on_privmsg" in private section was not defined, also, event for CTCP in private section and bound events were not called.
Bug fix: If OpenSSL functions on initalise of new SSL connection fails (which is rare, most probably in case of low memory condition, but bot will sooner or later crash in this case anyway), bot crashed due to double heap pointer deallocation.
Improvement: When connecting to SSL IRC server, bot now logs SSL back-end-provided error message to "logs/irc.log" as "INF" entry, and this much more verbose log entry is logged to "logs/ssl.log" - so far there was only brief message in this log file.
Improvement: In file "ssl.txt" you can now configure in section for SSL IRC server connection profile whether IRC server's CA should be ignored ("disable_ca_verification" key), (or not), so you don't need to add their CA to CAs file of your bot (which improves security). See documentation.
Improvement: In file "ssl.txt" you can now configure in section for SSL IRC server connection profile expected IRC server's server certificate ("server_cert" key), (you need to put certificate into directory "cert/" (in PEM format, of course). See documentation.
Improvement: In file "ssl.txt" you can now configure in section for SSL IRC server connection profile whether to ignore expired certificate, or not yet activated/valid certificate for broken IRCd configuration compatibility ("ignore_expired_cert" key). See documentation.
Bug fix: Possible memory leak in socket handling, when socket is closed, and there were still data in input and output buffers.
Bug fix: Possible memory leak when using OpenSSL.
Bug fix: OpenSSL resource leak when using OpenSSL.
Bug fix: When IPv6 client connecting to server fails on BSD-sockets-API call "connect()", the reported error was "(Unknown error)" instead of real error message from OS's IP stack.
Bug fix: Possible GnuTLS resource leak (xcred leak) when closing SSL connection, when using GnuTLS.
Bug fix: Memory leak when using OpenSSL, after socket is closed.
Improvement: Implemented new command-line argument "--get-ssl-cert". See documentation.

Release version 1.1.beta31-cvs8
Date: 2008-03-25
Improvement: Heap map recreation is now logged to "logs/debug.log" and debugging log (if enabled).
Improvement: Optimized performance.
Improvement: Delayed commands ("load_module", "unload_module", "load_bin_module", "bind" and "unbind") are now processed as soon as possible.
Bug fix: Internal scripting built-in function "preg_split" have not included an empty string in result array if there was such case.
Improvement: If internal script runs too long, we now don't get ping timeout, nor SendQ exceeded. Now we read the socket and respond to PINGs from server only while script is running.
Bug fix: Not able to compile with GnuTLS.
Bug fix: Crash when IRC server (DNS) cannot be found and Ctrl+C is pressed in interactive mode ("-i" argument), or got SIGTERM, SIGINT, or SIGHUP (on POSIX).
Improvement: srand() function is seeded from /dev/random, if it not exists fallback to /dev/urandom, and it neither fallback to time().
Improvement: OpenSSL: If 'openssl.rnd' doesn’t exists, entropy is seeded from /dev/random, if it not exists fallback to /dev/urandom, and it neither fallback to one-byte time().
Improvement: Speed-up of CPU load on executing "on_flood" event: It is called only once after user is kicked off the channel.
Bug fix: Crash if "wait_if_error" command/built-in function waits too long (e.g. problem with IRC server connection, or auth timeout - "You have not registered" message).
Improvement: Less memory usage while using preprocessor "_DEBUG" and "DEBUG_VAR_KEEPER_DEBUG_STRING_DISABLE" is not set (thus enabled).
Improvement: POSIX: When using "configure" script, we now test if C++ compiler supports "-fstack-protector", if yes, we use it.
Bug fix: POSIX: When using "configure" script, we now test if C++ compiler supports "-Wall", if not, we don't use it (previously we used it always, now we perform a test).
Bug fix: Crash/assertion failure on startup on Unices that use shared semaphores (e.g. Linux), when semaphore mmap-ed file cannot be created (e.g. directory "logs/" doesn't exist). Now we print an OOPS to stdout.
Bug fix: Documentation: Unterminated string of time in sample function "function revenge1($channel,$source,$target,$source_nick,$target_nick)" (thanks to Pipo).
Bug fix: On startup, if "logic.txt" were screwed, bot didn't performed rollback to backup, but was rehashing the same file and sooner or later crashed because of assertion failure.
Semi-bug fix: Doubled SSL log messages in "logs/cumul.log" in some cases (if enabled).
Bug fix: MODE from IRC server to our nick was going to logs/<our_nick>.log" instead of "logs/status.log".
Bug fix: Bot dies with "Procedure error E_INV_COMMAND: Invalid command code" when dumping procedure (e.g. backup) if procedure contains "get_event_id" command (thanks to Pipo for reporting this).

Release version 1.1.beta31-cvs7
Date: 2008-03-12
Improvement: Implemented "dcc_disable_reverse_ip_check" in "conf.txt". See docuemntation.

Release version 1.1.beta31-cvs6
Date: 2008-03-11
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed. (If you are upgrading from previous version.)
Bug fix: Botnet replication could cause redundant (exactly same) replication rule definitions. Now we remove redundant definitions.
Bug fix: Memory leaks introduced in version 1.1.beta31-cvs5 in botnet packet sending to remote bot.
Bug fix: Logical error, bot was not respecting 'MAX_RESOLV_THREADS' definition in "params.h", so created many threads, and disrespecting defined limit (this could cause the crash on unices if memory quota would exceed).
Improvement: Now verbose debug log file (i.e. "logs/debug.<timestamp_of_bot's_run>.log") contains bot's PID as well, for better clarity.
Semi-bug fix: NULL pointer dereference causing crash of bot; however this code with that bug is normally not used - only in case of bug in another piece of code (since this function has different purpose, but fallback is provided anyway, and the bug was in that fallback code), thus this was not critical bug.
Bug fix: Memory leak after PUSH'ing channel definition to remote bot while in replication.
Improvement: Much verbose log entries in "logs/botnet.log" and "logs/botnet_debug.log" (if enabled in "conf.txt").
Bug fix: If cumulative logging were enabled ("logs/cumul.log") in "conf.txt", there weren't entries logged, originating from "logs/bot.log", "logs/identd.log", and "logs/ssl.log".
Improvement: POSIX: "configure" script now does a sanity check for such errors as "--disable-debug --enable-assert", since to make a core dump in case of assertion failure can is compiled-in only if compiled with debugging support.
Semi-bug fix: Spelling "Shot down" instead of "Shuted down" in "logs/identd.log".
Bug fix: In some circumstances, bot have not recognized nick on join, e.g. not performing "on_join" event on particular user, but on "unknown" ("host_unknown flagged user) rather.
Improvement: Bot is now iterating in reverse order both LOW and HIGHT queue of commands to send to IRC server, and erases redundant commands, i.e. those which are exactly the same, but keeps the latest one (e.g. only deletes all duplicates before latest). This improves bot performance, and unloads both itself and IRC server cause by redundant commands.
Improvement: Some compilers don't optimize post-in/de-crementing of STL iterators, so all were changed to pre-in/de-crement for faster execution of bot on such compilers.
Improvement: Now on every new BOTNET connection, STL vector holding information about other bots is recreated. This is experimental feature, which should help better heap defragmentation, in theory.
Bug fix: Self test ("--eval-test-1" argument to bot) failed at the end, if compiled with GnuTLS.
Semi-bug fix: POSIX: "configure" script emitted warning about missing <malloc.h> include file (some systems, e.g. BSD's don't have it, and have malloc() elsewhere). Now it is silently checked, without emitting a warning.
Semi-bug fix: (vdc_)sendmail: Annoying warning "C4244: 'argument' : conversion from 'LONG_PTR' to 'LONG', possible loss of data" when compiled with MSVC.
Semi-bug fix: irc_bot: Annoying warning "C4244: 'argument' : conversion from 'LONG_PTR' to 'LONG', possible loss of data" when compiled with MSVC.
Bug fix: (vdc_)sendmail: Made able to compile while debugging is enabled ("_DEBUG" preprocessor define) when compiled with MSVC.
Semi-bug fix: 1. Made code much close to coding style standard; 2. Converted accidental '\t' characters in the code to 4 spaces indent; 3. Regexp thru all code "s/ +$//" (removed accidental trailing spaces at ends of lines); 4. Minor code clean-up.
Semi-bug fix: Annoying warning "C4505: warning: unreferenced local function has been removed" in include files of GnuTLS (static functions) when compiled with MSVC and with GnuTLS.
Improvement: Now rehashing affects also "ssl.txt" to be rehashed.
Semi-bug fix: Log rotation may accidentally archive "logs/irc_bot.action" file, now it is excluded.
Improvement: When bot cannot understand a command in "logs/irc_bot.action" file, it will not periodically remove it.
Semi-bug fix: Fixed warnings when "_DEBUG" and "REPORT_LEAKS" preprocessor define is not defined when compiled with MSVC.
Bug fix: Memory leak (1024 bytes) after each procedure is PUSHed to remote bot on BOTNET.
Bug fix: PUSHing of procedure to remote bot on BOTNET caused parse error on remote side, so procedure has not been accepted (PULLed).
Bug fix: Replication of procedures and functions had not set modification time after PULL.
Bug fix: Replication of procedures and functions had not set "member_of_group" attributes of procedures/functions.
Improvement: Now when introducing a new procedure or function, ".+group <new_group>" is not needed to precede, if procedure/function has "member_of_group" attribute set inside of its body.
Improvement: Bot is now validating +b, +I and +R events on rehash/apply.
Bug fix: PULL replication of function on BOTNET caused to "#last_changed" attribute set to current time, instead of time of remote object.
Semi-bug fix: Resolved not critical memory leak after ".upgrade"/".restart" (descriptor of new sub-process was not freed).
Bug fix: Possible resource leak and memory leak, when non-core module runs sub-process (external script), and before it finished the module is unloaded. Now these resource descriptors are put to garbage waiting for sub-processes to finish, but the result of external script is not processed (as the module was unloaded).
Improvement: Minor CPU optimizations in code of DCC/(SSL-)telnet interface.
Bug fix: Resource leak (fopen() and forgot to fclose()) while getting DCC resume position from filesystem.
Improvement: Implemented 64-bit ftell() and fseek() in function internal scripting, even on 32-bit platforms that provide 64-bit functions.
Bug fix: Since fclose() function may fail, now we are trying 100 times to call fclose() until success. There could were errors queued, causing the file not to be closed (a resource leak).
Improvement: Implemented 'filesize()' function for internal scripting. See documentation.
Improvement: Implemented limit of open files in module's user script (via 'fopen()' built-in function). Defaults to 32, can be tuned in 'params.h', seek for 'MODULE_MAXIMUM_OPEN_FILES' preprocessor define.
Bug fix: Documentation: Forgotten in documentation built-in function for internal scripting 'preg_replace()'. First appeared in version 1.1.beta31-cvs2. See documentation.
Improvement: Removed unusable "on_creator" and "on_decreator" events.
Bug fix: "on_other_mode" event in channel definition for user was not PUSH-replicated to other bot on BOTNET. To successful replication the version 1.1.beta31-cvs6 or later of the other bot is required.
Improvement: Minor system stack/heap optimizations in "irc.cpp" (usage of const string reference in event handlers).
Improvement: Minor CPU optimizations in BOTNET user PUSH replication.
Improvement: Implemented "on_other_mode_mask" event for exotic IRC servers. See documentation.
Improvement: Few minor CPU optimizations in "irc.cpp" (event handlers).
Semi-bug fix: Fixed indentation problem of closing brace on backup in "SMTP" command in procedure.
Improvement: Format of logs slightly changed.
Bug fix: Security: When PULL replication were pulling user definition, user's group membership were not checked if remote (PUSHing) bot has access to use of those groups.
Bug fix: Security: When PULL replication was pulling channel definition, events were not checked if remote (PUSHing) bot has proper access to procedures/functions to unassign and/or assign them.
Bug fix: Security: When PULL replication were pulling channel definition, group membership of dynamic ban editors were not checked if remote (PUSHing) bot has access to use of those groups.

Release version 1.1.beta31-cvs5
Date: 2008-02-25
Improvement: Ported to Cygwin (g++ 4.2.1).
Improvement: Now variable dumps (e.g. in case of error, or while usage of '_var_dump()' undocumented built-in function in internal function scripting, or when bot is envoced with '--eval-test-1' self testing command-line argument) are stored into corrseponding module's log directory.
Bug fix: Memory leak after destroying variable from internal scripting: If debug strings for dump were enabled, after destroy forgot to erase debug string entry in the table.
Improvment: When invoked with command-line argument '--eval-test-1', return code is 0 (zero) if all self test passed, or 3 (three) if some of self test failed. Also displays summary at the end (use *UNIX "| grep EVAL_TEST_1" to suppress all tests progress).
Improvement: Unices: Implemented "make check" to provide execution of bot's self-test.
Bug fix: Bot crashes after pulling a channel definition from remote bot on BOTNET (invalid vector iterator dereference).
Semi-bug fix: Erroneous message in "logs/botnet_debug.log" like "(...) PacketType=2 Command=10010013 * unknown PACKET_TYPE_COMMAND from remote bot - in file botnet.cpp in function botnet_cmd_switch_8".
Bug fix: Replication of channel definitions from "logic.txt" after pulling from another bot on BOTNET didn't updated "last_changed" attribute, so replication attemps were infinite. Also, related issue has been fixed, comparsion of channel names while replicating them is now case-insensitive.

Release version 1.1.beta31-cvs4
Date: 2008-02-13
Bug fix: Updated documentation (operator precedence/associativity).
Improvement: "ssl.txt": Now we are accepting *NIX "/" as path direcory separator, on Windows(TM), and "\" as well on *NIX.
Improvement: Made undocumented operators "and", "xor" and "or" working and documented in built-in function scripting.
Bug-fix: When we are OR-ing, XOR-ing and AND-ing two BOOLs using '|', '^', '&' or 'or', 'xor' and 'and' operator, return value should be BOOL.

Release version 1.1.beta31-cvs3
Date: 2008-02-12
Bug fix: "preg_split" function was ignoring $limit when compiled with gcc.

Release version 1.1.beta31-cvs2
Date: 2008-02-12
Bug fix: Error in parser for 'strings' in internal function script (escape sequences allowed here are only '\'' and '\\').
Bug fix: Bot allowed overwriting read-only variables (i.e. built-in superglobals) by calling function such as "check_dynamic_bans()" that are overwriting passed variable as argument (e.g. "$match=check_dynamic_bans($channel,$nick,$_users);"). If overwritten argument was a constant, e.g. "NULL", bot crashed after returning from the function.
Bug fix: Bot generated bad code when second and further function arguments contained unary operator, e.g. "my_fn($x,-2);".
Improvement: Implemented PHP-compatible "preg_grep" function (see documentation).
Improvement: Implemented PHP-compatible "preg_match_all" function (with some limitations) (see documentation).
Improvement: Implemented PHP-compatible "preg_match" function (see documentation).
Improvement: Implemented PHP-compatible "preg_split" function (with some limitations) (see documentation).
Improvement: Implemented PHP-compatible "preg_last_error" function, with optional argument which can receive error message (see documentation). Bug fix: Infinite loop when compiling internal function script, in case of such erroneous expressions as "fn1(fn2(fn3());" (not enough ')' in nested function call before ';' command terminator).

Release version 1.1.beta31-cvs1
Date: 2008-02-05
Bug fix: Built-in scripting function parser: There were numbers not allowed in names of variables in foreach() construct.
Bug fix: Documentation: Forgotten to mention 'fread()' built-in function in documentation.
Semi-bug fix: If invalid resource handle passed to 'fread()' built-in function, in logs there was "Invalid resource handle passed to 'fgets()' function; ..." in error.
Bug fix: Missing check for resource handle validity passed to 'fclose()' built-in function.
Bug fix: Missing check for result of C function 'fclose()' in the implementation of 'fclose()' built-in function (fclose may fail in some cases!).
Improvement: Built-in function 'fread()' was consuming a lot of RAM (2 more bytes than the second argument) for a short period of time even if file was shorter. Now we get size of file and current position in file to determine size of temporary read buffer we really need (not more).
Bug fix: Crash while calling built-in function in script, when there was expecting STRING type of argument to built-in function call, but variable passed was not set (i.e. NULL).
Semi-bug fix: warnings while compiling with gcc -Wall: 4 times "logic.cpp:1918: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'unsigned int'"; however, generated binary was fine on 32 and 64 bit platforms, as "unsigned long" is same as "int" in size (always 4 bytes) in gcc. (It was arguments from #3 to #6 – so 4 times).
Semi-bug fix: warnings while compiling with gcc -Wall: 4 times "logic.cpp:1941: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'unsigned int'"; however, generated binary was fine on 32 and 64 bit platforms, as "unsigned long" is same as "int" in size (always 4 bytes) in gcc. (It was arguments from #3 to #6 – so 4 times).

Release version 1.1.beta30
Date: 2008-01-28
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed. (If you are upgrading from previous version.)
Semi-bug fix: If reporting either to console, or "botnet.log", or "botnet_debug.log" was enables, bot incorrectly reported time difference of objects if remote bot has time drift against local time. However, replication worked well.
Bug fix: Security: Various not so critical buffer overflows on DCC/telnet/ssl-telnet interface, if string in "lang01.txt" language file were longer than 128 bytes.
Improvement: Good news for those who compile bot using MSVC && using GnuTLS: We don't need anymore MINGW callback when using GnuTLS compiled under MINGW to set "errno". There is a new GnuTLS API function that is intended for this purpose (they knew about this problem, when each of MINGW and MSVC runtime library has its own "errno" valiable).
Bug fix: When bot was in a long loop without network connection trying to connect in a main loop, garbage collection was not processed, so when network has began to worked again, it consumed lot of CPU for longer time, while garbage collecting variables from executed procedures/functions. Also gradually consuming RAM until connection to IRC server is successful.
Improvement: Good new for those who are using ".upgrade": All log entries in log files now include process' PID to distinguish from which instance of bot log entry comes.
Bug fix: On begin of connection to IRC server, now messages about server forcing user's mode to, fo example, '+i' goes to "status.log" instead of "<botnick>.log".
Bug fix: On begin of connection to IRC server, now messages/notices from server such as "AUTH" (related to username ident lookup) goes to "private.log" instead of e.g. "auth.log".
Bug fix: Problems with DCC SEND when hostname of nick is not in intenal resolver cache yet, or internal resolver cache entry expired, i.e. has been removed.
Semi-bug fix: Doubled log entry "Die by..." and similar in logs and on DCC/telnet/ssl-telnet console (shutdown log sent to ".die" and similar commands originator).
Bug fix: Documentation: About command/built-in function "ssl_server" there was "telnet_server" used for syntax for function in error.
Bug fix: Few forgotten minor bug fixes.
Improvement: Few forgotten minor improvements.
Bug fix: In dynamic bans edit mode (command ".dynbans #channel"), bot was ignoring comment in ".+ <mask> <reason/comment>" (the code was commented-out, however, it was slightly bad code, there were quotes to enclose the reason in error, of course).
Bug fix: *NIX: After ".upgrade", new "logs/irc_bot.lock" file has been set wrong file mode (02500) in error. Now bot respects umask in "conf.txt" or umask of parent, is set in "conf.txt" so.
Improvement: *NIX: After ".upgrade", new binary is copied with file mode respecting user's setting in "conf.txt" about umask, i.e. "0777 & ~umask".
Bug fix: OpenSSL: Potential memory leak (two times in various places in the code; but too improbable), After calling "BIO_new(BIO_s_mem());" and "BIO_new(BIO_s_mem());", if only one of these failed, but not both (e.g. due to low memory condition), the successful one was forgotten to free via "BIO_free(...);". However, if there is low memory condition (e.g. memory limit/quota of user running the bot), the bot will crash sooner or later, because this situation is hard to handle.
Bug fix: Some minor semantic bugs fixed about incompatible iterators comparsion, however, should work okay anyways (MSVC 7 okay, gcc4 okay, MSVC 8 run-time error/debugger trap) [e.g. vector<T1> v1; vector<T1>::iterator i1; vector<T2> v2; vector<T2>::iterator i2; if(i1==v2.end())].
Bug fix: On destroying socket connection possible crash or internal agenda about socket connection corruption (copy && paste same code bug, forgotten to adjust copied code).
Bug fix: If evaluation error occurred while evaluating, e.g. for() conditional expression (e.g. variable is UNSET), this error was not reported.
Bug fix: Compile problem when using MSVC release build: inclusion of <crtdbg.h> because of erroneous preprocessor commands: unresolved externals.
Improvement: Brand new internal function script compiler, less error-prone code (the old code became messy over time).
Improvement: Improved statistics (".stat" / ".stats" (synonimic alias) commands on DCC/telnet/ssl-telnet interface, and after bot shutdown.
Improvement: Improved test suite (commnad line argument "--eval-test-1"), now displays more statistics.
Bug fix: Security: If an user has access to edit procedures/functions (should be only admin of bot, not common user), or if user who has rights to load module (again, only admin) and loads malicious module: in built-in functions "fgets()" and "fread()" there was interger underflow when number of bytes were set to negative number, thus bot could consume a lot of temporary memory for a short while, but would not crash if memory allocation failed, rather, so function returned "FALSE" to indicate an error.
Bug fix: Security: If an user has access to edit procedures/functions (should be only admin of bot, not common user), or if user who has rights to load module (again, only admin) and loads malicious module: in built-in function "fread()" if number of bytes were set to negative number, resulted in arbitrary memory to be overwritten, on addresses less than address of temporary buffer (negative value passed as array index).
Bug fix: Bot could die because of script evaluation timeout if authentication problem occurs at "wait_if_error" procedure command/built-in function on heavy loaded (CPU) machine. This commnad/function should normally clear the time counter for script evaluation timeout. Hopefully fixed.
Bug fix: FreeBSD: Compile problem.
Bug fix: Systems that has no shared (between processes) mutexes and conditions (pthreads) implemented (e.g. FreeBSD): Bot crashed. On these systems there is workaround now (when this fact is detected), locking of log file. (There can be more that one instance of bot, e.g. ".upgrade" to avoid conflicting simultaneous write to log file causing its corruption.)
Improvement: BOTNET: Remote procedure call: If there is INT variable received, and remote side have larger INT than local side, there is check added if it could cause overflow leading to incorrect INT variable value, i.e. if it fits into local INT variable value representation, if not, such call is rejected.
Improvement: Bot now accepts "DCC CHAT CHAT" (irssi style), not only "DCC CHAT chat" (mIRC style).
Bug fix: Various buffer overflows if bot is connecting to malicious IRC server where nick is longer than 1017 bytes.
Bug fix: If DNS lookup was not yet successfuly performed on channel join, and user's host mask doesn't match, but would match after DNS lookup, bot might not recognize user on channel and ignoring e.g. DCC CHAT requests. Also, it could incorrectly call "on_join" event on "unknown" user. Now we wait for DNS lookup to complete first.
Semi-bug fix: If in startup script were not IRC server(s) specified, bot died and shutdown sequence caused appearing message in logs, console, and so on, in style "Backup invoked by ". Now it will appear as "Backup invoked by SELF".
Bug fix: If bot received message from IRC server saying its connection is throttled due to too many fast reconnections (like UnrealIRCd does) it sleeps for 60 seconds, and then continues. Now in those 60 seconds bot performs idle tasks, such as processing DCC/telnet/ssl-telnet sessions, and BOTNET session packets processing, interrup signal (SIGINT) to terminate bot, or Ctrl+C signal on Win32, and many other things. Until now, these things were not processed, so bot absolutely freezed itself, e.g. on SIGINT/Ctrl+C, this condition was handled after this "deep sleep" of 60 seconds has elapsed.
Bug fix: Fixed possible uncatched exceptions on ".execute" command on DCC/telnet interface and BOTNET (remote procedure call).
Improvement: Bot now tracks nick changes and PARTs/QUITs in send queues of commands (those with HIGH and LOW priority), such case will adjust send queue by changing nick (e.g. for "+o" on channel) or remove command (e.g. got "KICK" on channel).
Improvement: GCC: Should be able to compile with "-O2" with 512 MB memory limit.
Improvement: Abuse prevention: "Hard" lock-out limit is 5 more bad logins than lock-out limit, so connection is refused without notice to user, saying they are locked-out. Can be adjusted in "params.h", "HARD_LOCKOUT_LIMIT_ADJUST" preprocessor define.
Improvement: Abuse prevention: When user cannot login to SSL telnet server because they have no SSL certificate configured in "pass.txt", we incorporate this case into lock-out counter (if configured in "conf.txt").
Improvement: Abuse prevention: Now counting not completely logged-in connections as temporary bad login (as presumption) in lock-out counter.
Bug fix: Race condition crash when using OpenSSL when SSL connection is closed by remote peer shortly after connect, and OpenSSL library triggers certificate verification callback while SSL socket is in linger pool (invalid pointer dereference; we are using memory BIO read/write - so this condition is possible, but rare).
Improvement: We log SSL error (e.g. SSL certification verification error) to "logs/botnet.log" as well when this occurs in BOTNET (not only to "logs/ssl.log").
Improvement: We use WHO #channel on join to support really big channels (faster sync/init burst).

Release version 1.1.beta29
Date: 2007-08-16
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed. (If you are upgrading from previous version.)
Bug fix: *NIX: We are now ignoring signal SIGURG (may be sent in case of urgent packet).
Bug fix: Again, after SSL socket close (botnet connection) there could be reuse of FD by OS for next client (same FD number), and closed again in error. It is hopefully fixed now.
Bug fix: Memory leak, every time a local user leaves partyline channel.
Bug fix: Some log events were not written to cumulative log as well (if enabled).
Bug fix: Workaround: Inserted upper layer above low level socket operation, which is generating unique socket handle mapped to OS file descriptor. I have suspect that there is some double-close of socket's FD, and, on *NIX they are reused; so now the bot will not close unrelated other connection if the bug is still there. However, if this kind of attempt is made, you will get error in "debug.log" (even if you have disabled this log file for using in "conf.txt") about this bug with file name and line number, with note, that you should report this problem.
Bug fix: *NIX: Statistics about CPU time of bot was overflowing over time (on ".stat" / ".stats" synonyms on DCC/telnet, ".die", or on other shutdown).
Bug fix: Win: Statistics about CPU time of bot was not accurate, instead, there was full uptime reported (because Win has improper standard C 'clock()' function implementation).
Bug fix: If key "time_offset" in core module's "conf.txt" were set to something different than "0" (e.g. "+2", or "-2"), and after rehash of configuration this key in "conf.txt" disappeared, bot have not set time offset to "0" (which is the default value if key is not present).
Bug fix: *NIX: When connected with IPv6 support, client sockets could not connect to server (even IPv4 sockets).
Bug fix: Memory leak, when socket is closed (either due to error, or in a standard way) and there are still data to send.
Bug fix: Few minor bug fixes around so far undocumented features (for self-testing of bot).
Semi-bug fix: Log entry "Disconnecting" in "irc.log" now appears only once (not twice at very same time one by one).
Semi-bug fix: If you have "sleep" command/built-in function after disconnection from IRC, before re-connecting (to avoid abuse), bot now immediately logs that it was disconnected, not after expiration of "sleep", i.e. not just right before new re-connection.
Semi-bug fix: In cumulative log "cumul.log" (if enabled), socket-related entries: missing final ')' character.
Semi-bug fix: Bot incorrectly wrote time difference of object on remote bot on botnet in "botnet.log" and "botnet_debug.log" (if enabled), instead of how many seconds is object on remote side is in future, it reported how many seconds it is in the past.
Semi-bug fix: Various typos in documentation, comments in sources, strings in sources and in "lang01.txt" were fixed.
Semi-bug fix: Sometimes you could get an erroneous message "OOPS: Number of mandatory arguments mismatch, or invalid call string, also, mandatory arguments cannot be overridden by immediates. Call string was: " in "debug.log" when procedure/function for some events is not set (empty event).
Improvement: Log entry "Disconnecting" in "irc.log" has been changed to "Disconnecting from IRC server", because now it appears in "bot.log" as well.
Improvement: New log entry about event of connecting to IRC server is now appearing in "bot.log" as well (besides that in "irc.log").
Improvement: Log entry "Connecting [(SSL profile info/if applicable)] to host:port" in "irc.log" has been changed to "Connecting [(SSL profile info/if applicable)] to IRC server host:port", because now it appears in "bot.log" as well.
Improvement: In "irc.log" there were two types of entries: "IN" (commands from IRC server) and "OUT" (commands sent to IRC server). Now we have "INF" as well (which stands for "informative message"). It is used for events saying we are connecting to an IRC server, or disconnecting from it.
Improvement: For those who are using bind internal scripting function to "on_internal_event" event: in case of $type=="@log@", $flags1=="irc", there is $flags2 set to "IN" or "OUT"; now we have "INF" case as well (see above improvements for explanation).
Improvement: If you have "sleep" command/built-in function in your scripts, sleep state is logged into "irc.log" log (if you use "tail -f", you will know what is happening, and not to freak out what happened to your bot).
Improvement: On unsuccessful connect to IRC server, or other socket error, OS socket error message is logged to "irc.log", tagged with "INF" (see above improvements for explanation).
Improvement: Added handler IRC 405 numeric, sent when we cannot join more channels, because we are on too many ones. Bot acts like in case it cannot join due to '+l', "+i', '+b', or like if channel were temporarily unavailable due to netsplit (channel delay, IRCnet-specific), so it tries again and again when the send queue of commands for IRC server is empty, in 15 seconds periodic cycle.
Improvement: *NIX: Memory leak and other heap errors detection now implemented in a different way (not using MSVC's built-in native features anymore), if compiled with "_DEBUG" preprocessor define.
Improvement: When bot is in deep sleep (command/built-in function "sleep" in internal scripting), now it can be interrupted via Ctrl+C, which shuts down the bot immediately, thus "sleep" is not blocking shutdown anymore.
Improvement: Milestone: Ported to and successfully tested on Linux x86_64 bit platform (using GCC).
Improvement: Few minor optimizations.
Improvement: Few minor improvements around logging facilities.
Improvement: A little bit faster code (optimization) around execution of internal scripting (functions).
Improvement: Internal scripting: new built-in function for functions in scripts "have_func". See documentation.

Release version 1.1.beta28
Date: 2007-05-16
Bug fix: In procedures, commands "delete_irc_servers" and "delete_nicks" were not working.
Bug fix: There weren't channel masks (+b, +e, +I, +R) added to superglobal variables for scripts.
Bug fix: Additional bug to bug fix from version 1.1.beta28.cvs-2: After pulling of terminated user, their channel definitions were not accepted to pull (if policy allowed it), so there was only user definition, without their channels.
Bug fix: Again, after SSL socket close there could be reuse of FD by OS for next clients, and closed again, after log-in. Hopefully fixed now.
Bug fix: Now it is able to touch with ".touch" command terminator users and user templates.
Semi-bug fix: *NIX: Race condition, segmentation fault at cleanup after bot finished (died), if there was thread which has finished, but was not joined yet, bot called cancel on it; now bot joins it (i.e. waits for it to finish).
Semi-bug fix: Fixed spelling in 'lang/lang01.txt'.
Improvement: Brand new function for evaluating strings (those enclosed in double-quotes) in logic.txt while hashing (not in procedures, nor functions, but user definitions, etc.) which is faster and consumes less memory (the old method was going through standard string variables, as used while executing internal script).
Improvement: We are appending dot ('.') character to the end of each domain name passed to DNS resolver functions; this is workaround for some broken configurations of resolver (resolver returning local address because of automatic appending of local domain in case of non-existing domain). This can be adjusted in 'params.h', seek for RESOLV_APPEND_DOT preprocessor define.
Improvement: Cosmetic change: Spread code across multiple files, to not let compilers to consume a lot of memory.
Improvement: Cosmetic change: Added "sendmail" key to "conf.txt" as path for binary file with new name "vdc_sendmail(.exe)". Please, see documentation about this change.
Improvement: If bot is in deep sleep ("sleep" command/function), BOTNET and SSL is now not affected by it.
Improvement: Command/function "get_bot_nick" has been adjusted, see documentation.

Release version 1.1.beta28.cvs-2 (CVS release)
Bug fix: Made able to compile with gcc 4.1.1.
Bug fix: If foreach block in function was iteration read-only array, and value was referenced (with ampersand), and it was in a loop, then on next iteration of outer loop it has failed with attemp to write to read-only variable, e.g.: global $_users; foreach($_users as &$u) { foreach($u["channels"] as &$ch) { ...
Bug fix: In foreach construct like "foreach($ar as $key => $val)", there was not $key set.
Bug fix: Compilation of function could be malfuctioning in a special case (generated wrong code).
Bug fix: Memory leak, duplicating read-only variables, which were never been released.
Bug fix: Crash after script execution timeout, when in procedure evaluation.
Bug fix: Various memory leaks, unfreed local variable when calling a function.
Bug fix: *NIX: Zombie processes when external binary execution (e.g. external script) lifetime took more than 10 minutes and then process exits (hopefully fixed).
Bug fix: Users with "terminator" flag were not replicated at all, if replication was needed by newer timestamp.
Bug fix: User who has access to special wildcard group ("*") has no access to terminated users ("terminator" flag).
Improvement: Minor speed optimizations of evaluating functions (especially, work with large arrays).

Release version 1.1.beta28.cvs-1 (CVS release)
Bug fix: Security: Restricted character set used in .so/.dll file of binary module used in "load_bin_module" command/built-in function to avoid directory traversal. However, user needs to have privilege to write/edit procedures/functions via DCC/telnet to exploit this. Now .so/.dll file must be in root directory of same module. Note, that you should not have other loadable binaries (with dynamic linker) in module's root directory. Filesystem links are of course allowed to point elsewhere (if you need that so much).
Bug fix: Not all failures of other module loading were reported to core module's logs.
Improvement: Now the dash ('-') is also accepted in the module name.

Release version 1.1.beta27
Date: 2007-03-31
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed. (If you are upgrading from previous version.)
Bug fix: Various off-by-one errors (without buffer overflow) in sent BOTNET packets could lead to BOTNET connection close after received packet sanity check, if there is overly long string, such as overly long channel name in user definition in logic.txt, or overly long partyline channel name.
Bug fix: Various off-by-one errors in DNS resolution, if malicious DNS server returns DNS name that has exact length as buffer, could lead into buffer reading overflow.
Bug fix: Mostly *NIX: Crash after unsuccessful thread creation (e.g. resource limits), now it goes to queue and tries to create it later.
Bug fix: *NIX: After bad password on SSL connection of client, next client was rejected due to OS's reuse of FD for the next socket.
Bug fix: After an error in SSL connection, socket could not have been closed (resource leak).
Bug fix: When BOTNET connection did not succeed to link, there could be rarely forgotten to close socket (resource leak).
Bug fix: Documentation: Adjusted documentation, there was forgotten obsolete "access_to_procedure" access right, now it is handled in another (simpler) way.
Bug fix: File "lang/lang01.txt": Fixed bug, editing pass.txt, ".5" for editing remote password, not local.
Semi-bug fix: On telnet-SSL client connection (telnet), there was doubled message about accepting client's certificate.
Improvement: Adjusted behavior of character case mapping (see documentation).
Improvement: On telnet, and telnet-SSL connection, all client connections now linger (bot waits few seconds before destroying socket to allow SSL layer to transfer send queue).
Improvement: When on telnet-SSL connection maximum send queue is exceeded, the buffer is discarded and that fact is reported (not disconnected as in past versions).
Improvement: When there is timer with "0:00:00:00" duration, we treat it now like it were "0:00:00:01" (because this mistake could consume a lot of CPU, and, possibly, an infinite loop).
Improvement: Improved speed of evaluation of functions in internal scripting by detection if result of pre- and post-increment and -decrement operators is really needed.

Release version 1.1.beta26
Date: 2007-03-04
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed. (If you are upgrading from previous version.)
Bug fix: Bot could have been incorrectly computing time difference of local and remote bot on BOTNET, so replication was malfunctioning.
Bug fix: If there were attemp to load module that isn't present in "modules/" directory, log messages were written to to newly created "bot.log" and "debug.log" files in bot's root directory. Now, the messages with name of failed module are written into core module's log files.
Bug fix: BOTNET: Replicated "access_usage_procedure" entries for pulled user were not replaced, but rather added to existing ones (if the user already existed).
Bug fix: Possible memory leak after an error on socket for BOTNET connection.
Semi-bug fix: If compiled with debugging support ("_DEBUG" preprocessor define defined), bot displayed debugging info also when it was not needed (e.g. command line argument "-v" to display only version info, then exit).
Semi-bug fix: *NIX: Lock file "logs/irc_bot.lock" was not removed after bot died.
Improvement: If remote side is older bot version than this one, sending of BOTNET packets is going to queue, packets that contain current time (to compute time difference between machines) has updated local time just before send; they wait in queue until socket/ssl send queue is empty. This minimizes time drift, when there is lag (slow connection between bots). If it is the same version as this one, computing of time difference is more accurate (but no queueing of packets is needed in this case). BOTNET protocol version was not increased, instead, there are extended fields with system time in PING/PONG and LINKED control packets.
Improvement: BOTNET: After pulling of object, "last_changed" property is adjusted with remote bot's time difference in mind.
Improvement: Implemented pre-authentication timeout (telnet/ssl/dcc chat user need to authenticate within 3 minutes, then connection is dropped).
Improvement: BOTNET: In logs ("logs/botnet.log" and "logs/botnet_debug.log" when enabled) there will be new entries saying time drift between local and remote bot, and, in case of replication is needed, time difference (oldness) of to-be replicated object.
Improvement: BOTNET: If remote bot has access to apply new configuration rules "access_to_apply", apply will be used, not rehash (which is slow). If not, classic backup and rehash will be used (remote bot still needs to have "access_to_backup" and "access_to_rehash"). Of course, this new functionality requires that you have properly set-up autobackup interval, if remote bot doesn't have "access_to_backup" (to save new configuration file automatically to disk at given time period).
Improvement: Use of ".apply" command by user, or apply requested by remote bot on BOTNET is now logged into "logs/bot.log".
Improvement: BOTNET: Connection attemp (before linkage and authentication) is logged.

Release version 1.1.beta25
Date: 2007-02-13
Bug fix: Small memory leak after deallocation of variable in internal scripting support (could have result in more CPU utilisation percent after few days of uptime, or after many rehashes with large configuration file(s) "logic.txt").
Bug fix: Race condition could have crashed the bot if not compiled with IPv6 support when client socket is trying to connect to remote host (e.g. IRC connection, DCC transfer, or remote BOTNET connection).
Bug fix: Bot could have been incorrectly resolve DNS name.
Bug fix: *NIX: Forgotten to incorporate changes from past versions into "configure.in", so include file "<ext/hash_map>" detection and "hash_multimap" C++ STL extension template tests were not included in "configure" tests (bot could have been a bit slower without hash map for DNS cache).
Bug fix: Small memory leak while binding IPv6 server socket to listen for clients (forgotten to call "freeaddrinfo()" function).
Bug fix: Fixed big endian issues in BOTNET (could not link), and DCC (sending invalid IP in invitation).
Bug fix: Mac OS X: Use "--enable-wildcard-bind" argument to "configure".
Improvement: Improved CPU and RAM utilisation percent in allocation routines for variables in internal scripting support (using on-demand expanding bit array as list of ID's of freed variables).

Release version 1.1.beta24
Date: 2007-01-31
Bug fix: Crash on log rotation when not compiled with debugging support (without "_DEBUG" preprocessor define).
Bug fix: *NIX: Malfunctioning already-running-instance detection (lock file "logs/irc_bot.lock"). Bot didn't detected that one instance is already running.
Bug fix: If compiled without debugging support (without "_DEBUG" preprocessor define), an empty "logs/debug..log" file was created and left open.

Release version 1.1.beta23
Date: 2007-01-29
Bug fix: Crash after calling function in "logic.txt" in non-core module if "on_internal_event" has been assigned in core module.

Release version 1.1.beta22
Date: 2007-01-21
Bug fix: If user got away from all channels the bot is on, or quit IRC, its entry in $_users structure was not deleted if channel name was not exactly the same (it was compared in case-sensitive manner, and channel names are case-insensitive).
Bug fix: If nick left/quit/got kicked out of channel, $dispatch["line"] was empty string instead of quit/part/kick message.
Bug fix: For binary modules, "done" function in shared object/dynamic link library was not called and library was not unloaded/freed.
Bug fix: Nick change has not properly updated $_users array (index) and $_users["nick"] value.

Release version 1.1.beta21
Date: 2007-01-05
Bug fix: Fixed memory leak, local variables of first stack frame were not destroyed (e.g. 'on_internal_event' procedure/function, if assigned, caused leak).
Bug fix: Arguments to timer procedure/function ('timer_once', 'timer_every') was not correctly passed to timer's routine when timer event triggered (ended-up with UNSET variable warning in logs).

Release version 1.1.beta20
Date: 2007-01-04
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed. (If you are upgrading from previous version.)
cumulated changes from CVS releases, some bugfixes may be related only to those CVS releases:
Bug fix: Crash after "work" command (IRC server reconnection).
Semi-bug fix: Debugging: Again, when compiled with MSVC, false positive memory leaks detected on bot shutdown (this time really fixed).
Bug fix: Crash after on_flood event is triggered.
Bug fix: Crash after BOTNET remote procedure/function call.
Semi-bug fix: Debugging: When compiled with MSVC, false positive memory leaks detected on bot shutdown.
Bug fix: Fast lookup table was not properly update when array for script was copied in second or more deep depth (e.g. $dispatch["meta"]["msg"] was not working).
Documentation: Corrected erronous doxygen tags, added forgotten tags.
Bug fix: Crash after two rehashes.
Bug fix: Fixed memory leaks.
Bug fix: Compile problem on some compilers.
Bug fix: Fixed memory leak, variables for timer in script, after timer is removed (3 times).
Bug fix: Fixed 2 memory leaks around binary module's variables transfer.
Improvement: Debugging: When compiled with MS Visual C++, on assertion failed, the core is dumped, but execution continues as usual.
Improvement: Debugging: On assertion fail while debugging enabled it will dereference NULL pointer to force the core to be dumped.
Bug fix: If ISUPPORT message from IRC server (005 numeric) was split into more messages (multiple lines/occurences), only the last one was in effect in bot (it affected internal scripting/superglobal variable, and external scripting/php/perl).
Bug fix: Malfunctioning "eval" command in procedure if evaluated string contained constant (ended up with error in log).
Bug fix: Command "LOG" in procedure wrote log message to core module's "bot.log" instead of particular module's log.
Improvement: Improved debugging support (for developers), see new preprocessor define's in "params.h".
Improvement: Changed value of "SSL_CLIENT_MAXIMUM_QUEUE" preprocessor define in "params.h" from 10 KiBytes to 128 KiBytes, because client connected via SSL could get disconnected when issuing command with large output (e.g. ".whois <mask>").
Improvement: Changed value of "DNS_CACHE_VALIDITY" preprocessor define in "params.h" from 12 hours to 2 hours (internal DNS resolver cache TTL/entry validity).
Improvement: Win: In case of unhandled exception (mostly invalid pointer dereference, or assertion failure), there is crash dump of memory generated now (a.k.a. core dump, only works if compiled via MSVC, using "DBGHELP.DLL" helper, the older than win2000 version is required!).
Improvement: Increased limit for CTCP PING message's argument(s) (often timestamp from most IRC clients) to 64 characters, old limit was 16 charcters (to prevent ping of death flood). Well, some clients are sending longer PING message (e.g. irssi).
Improvement: Increased '#version' tag at begin of 'logic.txt' to version '3', which requires '#eof' tag at the end for detection of incomplete 'logic.txt' file (useful on Unices when system is going down and bot could not do full backup due to SIGTERM, so file gets corrupted). Your 'logic.txt' will be upgraded automatically upon first (auto)backup.
Improvement: 'log_rot' key in 'conf.txt' can have value '2' (see documantation).
Improvement: Unices: User-configurable umask (see documentation).
Improvement: Added cumulative log ("logs/cumul.log") for better debugging/bug reporting (where order of entries in multiple logs is important), (see documentation).
Main change: Brand new engine for php-like variables (using Kasper Peeters' STL-like tree template).
Improvement: Optimized (for speed) routines around looking up an user against its masks.
Improvement: Optimized (for speed) internal resolver cache (using hash tables - compiler support for STL extensions / hash_multimap is needed).

Release version 1.1.beta19-cvs6 (CVS release)
Date: 2007-01-03
Semi-bug fix: Debugging: Again, when compiled with MSVC, false positive memory leaks detected on bot shutdown (this time really fixed).

Release version 1.1.beta19-cvs5 (CVS release)
Date: 2007-01-02
Bug fix: Crash after on_flood event is triggered.
Bug fix: Crash after BOTNET remote procedure/function call.
Semi-bug fix: Debugging: When compiled with MSVC, false positive memory leaks detected on bot shutdown.

Release version 1.1.beta19-cvs4 (CVS release)
Date: 2006-12-31
Bug fix: Fast lookup table was not properly update when array for script was copied in second or more deep depth (e.g. $dispatch["meta"]["msg"] was not working).
Documentation: Corrected erronous doxygen tags, added forgotten tags.
Bug fix: Crash after two rehashes.
Bug fix: Fixed memory leaks.
Bug fix: Compile problem on some compilers.
Bug fix: Fixed memory leak, variables for timer in script, after timer is removed (3 times).
Bug fix: Fixed 2 memory leaks around binary module's variables transfer.
Improvement: Debugging: When compiled with MS Visual C++, on assertion failed, the core is dumped, but execution continues as usual.
Improvement: Debugging: On assertion fail while debugging enabled it will dereference NULL pointer to force the core to be dumped.

Release version 1.1.beta19-cvs2 (CVS release)
Date: 2006-12-27
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed. (If you are upgrading from previous version.)
Bug fix: If ISUPPORT message from IRC server (005 numeric) was split into more messages (multiple lines/occurences), only the last one was in effect in bot (it affected internal scripting/superglobal variable, and external scripting/php/perl).
Bug fix: Malfunctioning "eval" command in procedure if evaluated string contained constant (ended up with error in log).
Bug fix: Command "LOG" in procedure wrote log message to core module's "bot.log" instead of particular module's log.
Improvement: Improved debugging support (for developers), see new preprocessor define's in "params.h".
Improvement: Changed value of "SSL_CLIENT_MAXIMUM_QUEUE" preprocessor define in "params.h" from 10 KiBytes to 128 KiBytes, because client connected via SSL could get disconnected when issuing command with large output (e.g. ".whois <mask>").
Improvement: Changed value of "DNS_CACHE_VALIDITY" preprocessor define in "params.h" from 12 hours to 2 hours (internal DNS resolver cache TTL/entry validity).
Improvement: Win: In case of unhandled exception (mostly invalid pointer dereference, or assertion failure), there is crash dump of memory generated now (a.k.a. core dump, only works if compiled via MSVC, using "DBGHELP.DLL" helper, the older than win2000 version is required!).
Improvement: Increased limit for CTCP PING message's argument(s) (often timestamp from most IRC clients) to 64 characters, old limit was 16 charcters (to prevent ping of death flood). Well, some clients are sending longer PING message (e.g. irssi).
Improvement: Increased '#version' tag at begin of 'logic.txt' to version '3', which requires '#eof' tag at the end for detection of incomplete 'logic.txt' file (useful on Unices when system is going down and bot could not do full backup due to SIGTERM, so file gets corrupted). Your 'logic.txt' will be upgraded automatically upon first (auto)backup.
Improvement: 'log_rot' key in 'conf.txt' can have value '2' (see documantation).
Improvement: Unices: User-configurable umask (see documentation).
Improvement: Added cumulative log ("logs/cumul.log") for better debugging/bug reporting (where order of entries in multiple logs is important), (see documentation).
Main change: Brand new engine for php-like variables (using Kasper Peeters' STL-like tree template).

Release version 1.1.beta19-cvs1 (CVS release)
Date: 2006-10-12
Improvement: Optimized (for speed) routines around looking up an user against its masks.
Improvement: Optimized (for speed) internal resolver cache (using hash tables - compiler support for STL extensions / hash_multimap is needed).

Release version 1.1.beta18
Date: 2006-10-01
Bug fix: Function compilation error while having an empty expression in "for()" function.
Bug fix: Compile problem on FreeBSD.
Bug fix: Function compilation error while having unary + and - operator in expression.
Bug fix: Crash on casting INT or BOOL to STRING in function.
Bug fix: Malfunctioning "explode" function if limit reached.
Bug fix: Remote BOTNET procedure/function call sends invalid index of sub-array (array depth more than 1), equaled to last index of sub-array.
Bug fix: Incorrect byte order used for DCC causing invalid IP has been en-/de-coded (thanx to Varun for reporting this).
Bug fix: While in auth state (connecting to IRC server), if server responded by ERROR, this response was not logged (e.g. we got K:line, or not sufficient I:line).
Bug fix: Various bugfixes and memory leaks resolved.
Improvement: Improved speed of receiving file (remote user is uploading to us) via DCC SEND.
Improvement: Added support for binary modules (see documentation).
Improvement: Botnet partyline message length restriction to maximum 512 characters introduced, for better flood control.
You may need to adjust your core module's "logic.txt" as seen here, to get support for loading binary modules via partyline.

Release version 1.1.beta17
Date: 2006-07-31
Bug fix: Race condition could mess up garbage collector for internal scripts.
Bug fix: Race condition could make bot crash if threaded connect (e.g. to other bot on BOTNET) fails in thread in the same time as internal script is being executed.
Improvement: Improved and documented previously undocumented file "logs/irc_bot.action". See documentation.
Improvement: Included dummy header file "precomp.h" to support compilers that provides precompiled headers to compile faster.

Release version 1.1.beta16
Date: 2006-07-17
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed. (If you are upgrading from previous version.)
Bug fix: Forgotten to reset timer for timeout of script evaluation after connecting to IRC server (again, hopefully fixed now; thanks to Varun for reporting this).
Bug fix: Erroneous 727 message after ".pass" command.
Bug fix: Possible crash after client exceeded connection count limit.
Bug fix: There was malfunctioning SSL error detection.
Bug fix: Fixed bug in idle sleeper.
Bug fix: The "*" marker for access_to_group was not working on channel definition, thus you could incorrectly had denied access (thanks to Varun for reporting this).
Bug fix: User who can add new users into, or edit existing ones in "logic.txt" database and has "access_grant_groups" right to at least one group, could assign, or remove "access_to_group" access to arbitrary group he were not normally allowed to (typo error).
Bug fix: Infinite loop on "return" command in procedure led to script execution timeout.
Improvement: Added pure-SSL telnet interface for users and bots. See documentation.
Improvement: Optimized calculation of access rights on a user's connect to DCC/telnet interface, or after ".apply" command.
Improvement: If user has access to other user (access_to_group), s/he can assign new channel definition to that user ("channel" tag inside of "user" tag), but only if s/he has "access_grant_group" for group the channel definition is member of. (S/he is delegated maintainer of some channel, so s/he can set properties on that channel to existing users, also it they are not set yet).
Improvement: Now requests for checking if to replicate users, procedures/functions and channel definitions are sent by sequel to keep communication cache growth more subtle.
Improvement: *NIX: Used SIGUSR1 to rehash the bot.

Release version 1.1.beta15
Date: 2006-07-04
Bug fix: Fixed bug related to matching masks for IRC users.
Bug fix: There was zombie process after "net send" (Win32), or sending an SMTP mail.

Release version 1.1.beta14
Date: 2006-06-29
Bug fix: Incorrect script execution timeout after bot spent some time in "wait_if_error" procedure command / built-in function.
Bug fix: Incorrect script execution timeout after bot spent some time in "sleep" procedure command / built-in function.
Bug fix: Binary release for Win32: Forgotten to update "lang01.txt" language file (you could see empty messages in DCC/telnet connection).

Release version 1.1.beta13
Date: 2006-06-23
Bug fix: Cut-off of last character in string from system time (seconds) when generating filename from that string (two times).
Bug fix: Value for "time_offset" key in "conf.txt" have not been adjusted after rehash (if it has changed).
Bug fix: Non-functional ".execute" command on DCC/telnet interface.
Bug fix: Crash after external script tries to execute procedure/function.
Bug fix: Fixed problem of UNSET variables passed to "execute" command from procedure call.
Bug fix: Some variables were not passed to timer's procedure/function.

Release version 1.1.beta12
Date: 2006-06-18
Bug fix: Compile problem on FreeBSD.
Improvement: New log "clients.log" introduced for client connections (see documentation).
Improvement: New "time_offset" key in file "conf.txt" introduced (see documentation).

Release version 1.1.beta11
Date: 2006-06-12
(cumulative bug fixes and improvements from CVS releases)
See this section about upgrading to this release.

Pre-release version 1.1.beta11.pl8 (CVS release)
Date: 2006-06-10
Bug fix: Fixed bug in two arrays comparsion for equality.
Bug fix: Crash after some events called.
Bug fix: Infinite loop after connection to IRC server drops.
Bug fix: Fixed memory leaks after rehash. See this section about upgrading to this release.

Pre-release version 1.1.beta11.pl7 (CVS release)
Date: 2006-06-09
Bug fix: Forgotten to generate warning to logs on attemp to write to read-only variable.
Bug fix: Now bot generates error when non-l-value is passed as reference argument to function.
Bug fix: Crash after exception is throw in procedure (rare condition).
Improvement: Prohibited usage of 'work'/'work()' command/built-in function in other module than 'core' module. See this section about upgrading to this release.

Pre-release version 1.1.beta11.pl6 (CVS release)
Date: 2006-06-07
Main improvement: New faster way of evaluating functions.
Bug fix: Rare crash while evaluating function.
Bug fix: Infinite loop in "trim()" built-in function.
Bug fix: Rare infinite loop after error in function evaluation.
Bug fix: After numerous failed DCC SEND connects to remote user (when compiled to use threads), forgotten to remove DCC SEND session from list, so "dcc_max_transfers" key in "conf.txt" was still in effect and limiting bot to connect and respond correctly to DCC SEND requests.
Bug fix: Crash after try to resolve IPv6 address as IPv4, should return error, but corrupts stack instead (typo).
Bug fix: Now in ".terminator" command bot displays also users marked as "terminator".
Improvement: Introduced "feof()" built-in function (see documentation).
Improvement: Improved "$dispatch" structure of bound events (see documentation).
Improvement: Improved sleep routines to make bot consume much less CPU time when idle.
Improvement: Added "noremove" functionality for external scripts for debugging (see documentation). Increased BOTNET protocol version to 1005.
See this section about upgrading to this release.

Pre-release version 1.1.beta11.pl5 (CVS release)
Date: 2006-03-06
Improvement: Increased BOTNET protocol version to 1004. If both sides are 1004 or later, BOTNET replication check (comparing modification times of objects) is done on link once, and once after bot has rehashed/apply new configuration (not in periodic intervals each time). This optimizes bandwidth and CPU load consumption (e.g. de/compressing packets).
See this section about upgrading to this release.

Pre-release version 1.1.beta11.pl4 (CVS release)
Date: 2006-03-05
Bug fix: Fixed some memory leaks.
See this section about upgrading to this release.

Pre-release version 1.1.beta11.pl3 (CVS release)
Date: 2006-03-04
Bug fix: Incorrect deallocation of script output.
See this section about upgrading to this release.

Pre-release version 1.1.beta11.pl2 (CVS release)
Date: 2006-03-03
*** WARNING *** Please, see this list of changes in documentation for users; there are important notes about upgrading configuration files for this release.
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed. (If you are upgrading from previous version.)
Bug fix: Crash when error occurred while processing function (script evaluation timeout, call of non-existing function, division by zero, etc... each possible error).
Bug fix: Crash if there were no "conf.txt" while loading "core" module.
Non-critical bug fix: Crash after correct shutdown, if there were error in "logic.txt" and no backups for rollback were available.
Improvement: When manual ".rehash" is issued, or BOTNET requests rehash and there is compilation error in "logic.txt" script, no rollback to old good working version of file is performed, but request is ignored. This improvement has nothing to do with hashing at startup - there still rollback will be performed in case of error.
Improvement: BCB compiler: Compilation: Fixed compilation problem while enabled compilation of evaluate tests (so far if they were enabled, they were cut out by preprocessor, because this compiler just cannot understand basic syntax).
Improvement: Minor optimizations.
See this section about upgrading to this release.

Pre-release version 1.1.beta11.pl1 - Milestone experimental release. (CVS release)
Date: 2006-02-28
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed. (If you are upgrading from previous version.)
*** WARNING *** Please, see this list of changes in documentation for users; there are important notes about upgrading configuration files for this release.
Bug fix: POSIX: Compilation: Fixed compilation problem in call to mkdir() while enabled compilation of evaluate tests.
Bug fix: POSIX: Fixed issue about rotating logs.
Non-critical bug fix: If "on_topic" event in channel definition was empty (e.g. no assigned procedure/function) then bot logs in "debug.log" entry about mandatory number of arguments violation.
Non-critical bug fix: Missing verbose comment in "socket.log" when socket error occurs related to BOTNET.
Non-critical bug fix: Fussy OOPS in "debug.log", when module's "conf.txt" key was not found, so fallback to "core" module's "conf.txt" was done, and there was that key found, but had an empty value, so log said that key was not found and returning an empty string.
Improvement: On backup, bot removes redundant replication parameters (multiple exactly same entries).
Improvement: As you probably know, when rehash is not successful because of invalid "logic.txt" file, rollback to backups is used, one by one until good one is found. Same logic now applies when bot starts up. [On *nix systems "logic.txt" may be inconsistent because of non-finished backup on shutdown of system. Unices are a bit agressive about shutdown ;-)].
Improvement: Now bot is writing to "bot.log" at startup and die also PID (its process id). Also in ".stat" command.
Improvement: New command ".info" introduced on DCC/telnet interface. See documentation.
Improvement: ".help" command on DCC/telnet interface now shows list of available commands alphabetically sorted.
Most important improvement: Added support for PERL scripting (thanks to Varun)
Most important improvement: Changed code responsible for array processing, procedure processing and function processing in logic.txt to be iterative, not recursive, for better stability of bot in case of infinite recursion loop, or large multi-dimensional array depths.
See this section about upgrading to this release.

Release version 1.1.beta10
Date: 2006-01-22
Bug fix: Crash if no unlink timer specified (e.g. if remote bot is linking to us) and connection breaks.
Improvement: Memory management optimization: Introduced another hard-coded limit of outgoing packet cache in file 'params.h' ("BOTNET_KILL_CONNECTION_SOCKET_CACHE" preprocessor define, defaults to 2 megabytes). If this limit is exceeded, connection to bot is killed/delinked and cache purged. This prevents your bot from consume large amount of memory.

Release version 1.1.beta9
Date: 2006-01-22
*** WARNING *** Do not forget to update your "lang01.txt" file in directory "lang" as well, since it has been changed.
Bug fix: If you were set new host masks/fullname masks for some user, bot after ".rehash" command have not processed changes on channel (e.g. to give +o flag to user). Workaround could be done by ".part #channel" + ".join #channel". Now ".rehash" and ".apply" works correctly.
Bug fix: BOTNET: Some of user's privileges were not replicated.
Bug fix: UN*X: Upon disconnection of any network connection, there were not cleared 'errno' variable, so networking no longer worked.
Bug fix: After user issued ".upgrade" and ".quit" (or their connection has broke), bot unexpectedly terminated.
Bug fix: While editing user (".edituser" command), after commit new attributes, replication rules for that user disappeared.
Bug fix: ".whois <mask>" command incorrectly displayed "access_to_replication" right (always negative/no access).
Bug fix: On some unices bot might hang after DCC CHAT request from user. (Incorrectly handled blocking I/O operation).
Bug fix: "deop_ban_mask" command/function was not working if victim had not +o chanop status.
Bug fix: If your procedure (not function) in core module's logic.txt file contained "bind" command, it failed to backup.
Bug fix: Bot unlink procedure/function event was not working.
Bug fix: There was error if evaluated string contained hex escape sequence (e.g. "\x12"), octal escape sequence (e.g. "\007") at the end of the string.
Semi-bug fix: Fixed some mistakes in "lang01.txt" file.
Improvement: Tuned code for BOTNET to support low speed lines and slow remote parties.
Improvement: IDENTd server emulator now send error message if client is not asking for our connection. Also, prints into logs IP of client.
Improvement: Major optimization mainly for ".stat" command, and optimized some often used routines.
Improvement: Added ".touch" command. See documentation.
Improvement: Completely rewritten function commands processing (not evaluating), in hope, it will be less liable to have bugs in new algorithm.
Improvement: When users issues ".+group" command to add a new grout, they automatically gets "access_to_group", "access_grant_group" and "access_usage_procedure" right for them on that new group.
Improvement: Memory management optimization: In case of slow network link connection to remote bot, or remote bot runs on slow hardware and is unable to receive user, procedure, function, channel definition, or private definition replication push packets, there is hard-coded limit in file 'params.h' ("BOTNET_MAXIMUM_SOCKET_CACHE" preprocessor define, defaults to 128 kilobytes) of outgoing packet cache load in bytes. If this limit is exceeded, object will not be pushed, so remote bot needs to ask for that object again later. This prevents your bot to consume large amount of memory.
Improvement: ".stat" command on DCC/telnet has now alias ".stats".
Improvement: Now remote procedure call (BOTNET) works with procedures/function in modules as well. See documentation.
Improvement: Added new built-in functions: md5(), rand(), getrandmax(), fopen(), fgets(), fputs(), fclose(), fseek(), ftell(), make_valid_filename(), trim(). See documentation.
Improvement: Bot warns about incorrect mandatory number of arguments of events while compile of "logic.txt".

Release version 1.1.beta8
Date: 2006-01-11
Bug fix: Unexpected shutdown if new timer(s) set or old one(s) inside timer handler.
Bug fix: Error processing left-hand argument of simple operators (such as "==") when it is of type ARRAY or UNSET.

Release version 1.1.beta7
Date: 2006-01-10
Bug fix: .join/.part was not working if user had access_to_group privilege for that channel.
Bug fix: Some fixes in lang.txt laguage file.

Release version 1.1.beta6
Date: 2006-01-09
Bug fix: Badly encoded BOOL type into stream for remore procedure/function call (BOTNET).
...few forgotten bug fixes...

Release version 1.1.beta5
Date: 2006-01-08
Bug fix: Crash after few .rehash'es when IRC connection drops (exit from "work" command/function) due to STL mess in iterators (it deos a lot of copy-constructing and iterator's pointer becomes invalid after rebuilding vector of procedures/functions). Resolved by temporary copy of procedure/function before call.

Release version 1.1.beta4
Date: 2006-01-04
Bug fix: On delayed load module, some one other delayed command was erased without processing in error.
Bug fix: After .rehash, all procedures and functions that were on call stack were also replaced in memory, so there was possibility of shut down of bot after exiting "work" built-in command/function (e.g. after IRC connection dropped). Resolved by workaround: procedures/functions locking (ignore them, and do not rehash them).
Bug fix: Incorrect escaping of STRING type of variable when passed to external php script.
Bug fix: Fixed compilation problem using Dev-C++ while compiling with OpenSSL.
Improvement: Added "raw_whois" to global $_users variable. See documentation.

Release version 1.1.beta3
Date: 2006-01-03
Improvement: Minor optimization when idle - less CPU load consumption.
Improvement: Made compilable with Borland C++ Builder 6. See documentation.
Bug fix: Possible crash on unices while threaded connect to server.
Improvement: Added "max_logic_backups" key to conf.txt. See documentation.
Improvement: Added "log_rot" key to conf.txt. See documentation.
Improvement: Added "deop_ban_mask" command/function. See documentation.

Release version 1.1.beta2
Date: 2005-12-29
Bug fix: When bot was acting as client on DCC connection with threads, it was malfunctioning (not receiving any data).
Improvement: Optimization: After WHOIS reply on nick, there was check for filesystem events on that user, which was found slow: code removed; however we got "notify_interval" interval for notifications about filesystem events in conf.txt.
Improvement: Optimization: Mask matching calls and code around it is now better optimized; and inline-ed calls.

Release version 1.1.beta1
Date: 2005-12-24
Bug fix: There were multiple same channels entries in $_users array.
Bug fix: Crash upon IRC disconnection. (Hopefully fixed)
Improvement: Now ignoring 404 numeric (Cannot send to channel)

Release version 1.1.beta0
Date: 2005-12-23
Bug fix: On DCC/telnet connection, on .whois command, there was displaying that user has grant to give access to replication (access_grant_replication) falsely true if not and vice versa (negated value, misplaced '!' operator).
Bug fix: Fixed deadlock while setting flood limits on new user on DCC/telnet administration (bot was asking same questions).
Bug fix: SSL connection to IRC server was blocking, on UNIX this was preventing bot from responding while waiting for next message from IRC server.
Bug fix: PHP scripting: While enriching template of script "$fullname_masks" in was created as "$full_name_masks" variable in error.
Semi-bug fix: Bot is now responding to CTCP PING without argument.
Semi-bug fix: Now CTCP is case-insensitive.
Semi-bug fix: Erroneous TOPIC message to IRC server: missing colon before new topic, however most IRC servers accepted it.
...many forgotten bug fixes...
Improvement: Iterative shifting of logic.txt's backups ("logic.txt.bak999" down through "logic.txt.bak000"), while idle (not all of them at once on backup, rather one by one on idle, in advance, as prepare for next backup).
Improvement: on_flood event now contains list of messages that caused flood. See documentation for upgrading informations.

Release version 1.0.60
Date: 2005-08-28
Improvement: "logic.txt" file parser: Dollar sign can be now escaped with backslash. See documentation.
Improvement: "partyline_msg_flood" - flood limit on partyline channels made functional after backup. Also added to documentation.

Release version 1.0.59
Date: 2005-08-12
Improvement: Now connection to IRC server can be SSL-encrypted. See documentation.
Improvement: Added "@end_of_init_burst@" internal event. See documentation.

Release version 1.0.58
Date: 2005-08-07
Bug fix: Crash at random while accepting new connection on telnet.
Bug fix: Nick flood rules violation could occur when user is on many bot's channel - bot was aggregating statistics per user on all channels, not per user on single channel.
Bug fix: Bot wasn't waiting for response to JOIN command from IRC server.
Bug fix: Sometimes PHP scripts could were malfunctioning.

Release version 1.0.57
Date: 2005-08-06
Bug fix: Infinite loop after receiving "Reconnecting too fast" message.
Bug fix: Crash at random after Control+C/Break or clicking "X" button while backup.
Bug fix: FreeBSD: Compile problem on some FreeBSD machines (missing include of file in "compat.cpp").
Bug fix: FreeBSD: Timeout while waiting for response from IRC server.
Improvement: Changed BOTNET authentication, changed structure of "pass.txt" file. See documentation.
Improvement: New command ".pass" on DCC/telnet connection introduced for changing file "pass.txt". See documentation.
Improvement: New command "irc_server_ex" in file "logic.txt" introduced. See documentation.

Release version 1.0.56
Date: 2005-08-01
Bug fix: UnrealIRCd: Implemented "438: Nick change too fast. Please wait X seconds" message handler. So far there was timeout for waiting for acknowledgement to NICK command.
Semi-bug fix: Now we don't wait for response from IRC server even to MODE -b banmask (Some scripts could supply -b mask for non-existing or removed mask which could halt bot for a few seconds; some IRC networks don't give response in this case).
Semi-bug fix: Fixed typos in report list to ".whois user_mask*" command on DCC/telnet connection - list of user's flood limits on channel and dynamic modes (yay - copy&paste code makes mess).
Semi-bug fix: GCC compiler: Now should say also name of function instead of "<unknown>" in logs (mostly debug logs).
Improvement: Improved "on_internal_event" event (DCC verbose logging, see documentation).
Improvement: Improved speed of DCC SEND file from filesystem to client, new "conf.txt" key; see documentation.
Improvement: Kicks and +b bans submitted to IRC server are now posted as CRITICAL priority class, however "conf.txt"'s keys "irc_bot_flood_bytes"/"irc_bot_flood_seconds" pair still apply as flood limit bot must obey.
Improvement: Upper-case characters "[\]^" in nicks/channel names are now not translated to lower-case "{|}~" and vice versa anymore. (Scandinavian origin of IRC - these characters are used in their chat-alphabet as replacement for accented ones).
Improvement: More verbose "socket.log" and BOTNET socket errors.
Improvement: Unix: SIGHUP can be now used to cause the bot to rehash (reload configuration files).
Improvement: When bot ran on high CPU load machine, autobackup with large "logic.txt" file could cause reconnection to IRC server (IRC client socket keep-alive detection).

Release version 1.0.55
Date: 2005-07-24
Bug fix: IRCnet: If bot on channel was not opped until end of WHOIS burst, but after, "on_not_in_reop" events would not be processed. Now when it gets oper status on channel, these events on users are processed.
Bug fix: PHP scripting: Errorneously escaped characters < 0x10.
Semi-bug fix: Fixed several typos in language "lang01.txt" file in word "command".
Improvement: "library_php_2.inc.php" library: Class "c_output" have new method "put_lines()" for putting multiple lines to IRC server (delimited by '\n').
Improvement: Better log on DCC/telnet while in UPGRADE state. Old instance reports who set MODE on new instance (<nick> if bot itself; <nick!ident@host> if someone else).

Release version 1.0.54
Date: 2005-07-14
Bug fix: There was timeout in debug log while waiting for acknowledgement from IRC server as response to NICK command, when server answered "437 nick temporarily unavailable".
Bug fix: Now optional PART reason as second argument to ".part" command on DCC/telnet connection can be more than just one word.
Bug fix: Fixed some bugs related to ".+chan" command on DCC/telnet connection.
Bug fix: Fixed some bugs related to ".edituser" command on DCC/telnet connection.
Bug fix: Fixed some bugs related to ".editproc" command on DCC/telnet connection.
Bug fix: Possibility of crash on DCC/telnet connection (typo in iterator).
Bug fix: Freeze on connect if first nick is unavailable - fixed.
Bug fix: BOTNET: "dynamic1" and "dynamic2" (dynamic plus, and dynamic minus modes) of user on channel were not properly replicated.
Improvement: Changed behavior of some events, when IRC server itself changes MODE (e.g. after net burst). See documentation.
Improvement: Added "rem" command to procedures for remarking. See documentation.
Improvement: Configurable PART and QUIT messages via "conf.txt" file. See documentation.
Improvement: Improved ".+chan" command. Now you can do templates. See documentation.
Improvement: Added optimization (reducing use of logic_eval() function to minimum).

Release version 1.0.53
Date: 2005-07-10
Bug fix: Stuck in the loop while "ERROR" response from IRC server while in authentication state.
Bug fix: *NIX: Registration timeouts.
Bug fix: *NIX: Strange message "513 nick :Your client may not be compatible with this server." from some exotic IRC servers, while bot on *NIX, but not on Win32. Thanks to Varun for reporting this.
Bug fix: Possibility of infinite loop ending with stack overflow in "on_internal_event" event procedure, when a C++ exception is thrown due to ".rehash".
Improvement: Win32: Binary distribution: Upgraded .dll's to OpenSSL-0.9.8 (major release from 2005-07-05) - see http://www.openssl.org/ .

Release version 1.0.52
Date: 2005-07-09
Bug fix: Non-critical bug, where user on DCC/telnet connection in some conditions stopped receiving PING? messages according to enabled "dcc_chat_ping_interval=xxx" ping period.
Bug fix: There was missing EOL sequence (\r\n on telnet, \n on DCC) connection while ".getfile <name_of_file>" failed due to reasons like "No such file", "Access denied", and "I/O error".
Bug fix: In certain conditions, if user is downloading file from filesystem, and issuing next ".getfile" command, s/he could get greeting as on DCC chat/telnet connection, instead of real file. Now fixed.
Bug fix: On DCC CHAT connection, there were \0x08 characters after password supplied, which should be only on telnet connection. Now fixed.
Bug fix: Forgotten to close file "logic.txt" after unsuccessful ".rehash", so roll-back to old configuration was malfunctioning.
Semi-bug fix: On DCC/telnet connection, there was in ".filesystem" -> ".editfile <name_of_file>" -> ".attr" nothing displayed if user wrote bad command, so it was confusing. Now displays list of available commands in this case.
Semi-bug fix: Errors reported in file "logic.txt": Now we are counting lines from one - not zero-based from now on. I've decided to do so, because many text editors count them from one.
Improvement: Added "on_internal_event" event, for better monitoring of your bot. See documentation.
Improvement: PING? message on DCC/telnet connection is now timestamped, and shows your idle time.
Improvement: Changed format of channel logs to much clever messages (believe me or not). Now shows actual mode of user (op, voice,...) for better orientation in logs.
Improvement: Channel logs now contains entries if an IRC operator is detected on channel by WHOIS on their JOIN, or bot's JOIN followed by WHOIS burst, and also if an IRC operator QUITs/PARTs/gets-KICKed.
Improvement: Added "dcc_always_want_nick" attribute to "conf.txt" file. See documentation.
Improvement: Bot now silently ignores user name and password on DCC/telnet connections that matches mask "### *" ('#' stands for one numeric character) for better compatibility with "/dcc chat 127.0.0.1:2010" command while using mIRC.

Release version 1.0.51
Date: 2005-07-01
Bug fix: If procedure in "logic.txt" for on_kick event of user with "host_bot" flag (the bot itself) contained command "join" to re-join channel, the command weren't performed.

Release version 1.0.50
Date: 2005-06-29
Bug fix: Forgot to close filesystem file after it has been sent to client. (Saving resources)
Bug fix: Forgot to close file "pass.txt" in certain conditions. (Saving resources)
Bug fix: PONG response to server's PING: forgotten colon separator between command and "comment" (PONG argument).
Bug fix: DCC invitation was not working if supplied address was compressed IPv6 address (containing "::" sequence).
Semi-bug fix: Fixed annoying PING? message on DCC/telnet connection that wasn't in order of "dcc_chat_ping_interval" interval.
Semi-bug fix: Less doubled messages on ".broadcastping" command (pinging all bots on BOTNET).
Improvement: Bot now detects DCC invitation IP address spoofing. Until now, it accepted any address passed to CTCP DCC invitation, now accepts only IP address that coresponds (afte DNS resolution) to user's host (nick!ident@HOST).
Improvement: If CPU load were *really* high, bot didn't get response to each 60 seconds' "keep-alive" WHOIS to itself in 120 seconds, you've seen quitting it by EOF from client and reconnect. Now timeout to receive response is 3 minutes, sending PING to server as "keep-alive" (WHOIS could be penalised!) each 30 seconds. Hope this will help.
Improvement: ".broadcastping" now receives also version of remote connected bot(s) - but only if both sides are version >= 1.0.50.
Improvement: Added "admin_msg" command to "logic.txt". See documentation.

Release version 1.0.49
Date: 2005-06-15
Bug fix: Bot could crash if there was attemp to run script which andiminstrator forgot to create (.php file).
Bug fix: Resolved problem while using ".getfile" command issued on private query when user's host wasn't numeric IP address, but DNS name.
Bug fix: There was incorrect timestamp reported when user read message/downloaded file.

Release version 1.0.48
Date: 2005-06-13
Bug fix: Old-style php scripting: user's mode had nick, not mode string.

Release version 1.0.47
Date: 2005-06-13
Improvement: Added list of groups for users to PHP scripting facility.
Improvement: Now bot logs a record to debug log if there are incorrect lines inside magic command section of script's output.

Release version 1.0.46
Date: 2005-06-10
Bug fix: Win32: Service didn't start up the bot if defined pre-startup idle was non-zero.

Release version 1.0.45
Date: 2005-06-09
Bug fix: On telnet connection, there was \n character instead of \r\n sequence while setting expiration on new FileSystem object.
Bug fix: Linker error unresolved external logic_on_flood() while using Dev-C++. (Still it should use implicit typecast while having "time_t" in header file and "int" in source file, like other compilers do.)
Bug fix: Now using ident username as argument to "USER" command, not nick.
Bug fix: If there was no access to log files (permission denied) there wasn't also write to console (if enabled).
Improvement: Made "library_php_2.inc.php" needed for "php_2" method scripting compatible also for earlier versions of php (<5).
(see documentation here, here and here)

Release version 1.0.44
Date: 2005-06-06
Semi-bug fix: PHP preprocessor sometimes returns error code 255, when there is parse error in the script, but it is also handled by set_error_handler(). Bot ignored output of script with return codes not equal to zero. Now accepts *everyting*, continues to seek for magick commands in the output.
Improvement: Less warnings on compile.

Release version 1.0.43
Date: 2005-06-05
Bug fix: When script runs longer than 10 minuters, the bot crashed.
Semi-bug fix: No message after ".filesystem" command, now tells to use ".help" to get available commands.

Release version 1.0.42
Date: 2005-06-04
Bug fix: PHP scripting: There was incorrect UserNotified value taken from OwnerNotified.
Bug fix: Fixed DCC SEND problem when someone requested file via ".getfile" as private query.
Bug fix: Bot wasn't remembering +b bans and +e exceptions when someone set it, while bot was already on channel.
Semi-bug fix: Added check whether the procedure is already defined (no overloading support!).
Improvement: Added "php_2" method for PHP scripting. See documentation.
Improvement: Added modes and topics of channel to PHP scripting support.
Improvement: When channel is +k (key-protected), and bot has tried all keys in history of keys listing, it schedules JOIN to 15 secods later (if someone removes key, or set key to one from the history of keys listing).

Release version 1.0.41
Date: 2005-05-30
Bug fix: Removed forgotten write (printf()) of debug string to console.
Bug fix: Win32: Turned off handle inheritance while spawning new instance by ".upgrade" and ".restart" commands causing not to close some handles.
Bug fix: Fixed missing string in file "lang01.txt" causing display of incorrect string when user with no password yet set logs-in to telnet connection. However, user logging in for the first time still needs to use DCC CHAT, not telnet for security reasons, or admin of bot should set them password.
Improvement: Better logging and copying log to console while ".restart" command. Now notifies in case of error spawning new instance, and writes real error code, in this case it is 2, in case of success it is 0.
Improvement: Win32: Service application ("vdcsvc.exe") gets now control over ".restart" command, so if it is used, bot on ".restart" command leaves respawning on it. This fixes problem after two ".restart" commands.

Release version 1.0.40
Date: 2005-05-25
Bug fix: No longer setting "internal mode" status on op/deop/voice/devoice, but when we do so, we wait for acknowledgement from IRC server (response). There was problem when bot was deopped and script told to op other users, bot thought that it has op (seen in ".stat" status). occurred sometimes on mass deopping (-ooo).
Bug fix: Don't send JOIN on "join" command if we are already on channel, don't send PART on "part" command if we are not on channel.
Bug fix: Win32: "NET_SEND" command was not working.
Semi-bug fix: We are not waiting now for response to MODE +b mask and KICK nick (commands "ban_mask" and "kick"), because these commands should be posted as soon as possible (takeover hot while).

Release version 1.0.39
Date: 2005-05-24
Bug fix: Automatic backup was invoked on also startup, now really after elapsing time period.
Bug fix: There was 20 seconds wait after KICK command, response from IRC server was ignored in error (in order to kill 20 seconds wait before next command).

Release version 1.0.38
Date: 2005-05-23
Improvement: Added ".apply" command, "access_to_apply", "access_grant_apply" rights. See documentation.
Improvement: Added "auto_backup_interval" attribute to "conf.txt" file. See documentation.
Improvement: Bot automatically backs-up configuration ("logic.txt") on die/restart/upgrade.

Release version 1.0.37
Date: 2005-05-22
Improvement/semi-bug fix: Now bot is doing "synchronous communication" with IRC server - always waits for response from IRC server after message, then sends next message (no WHOIS flood on startup!).
Improvement: Now using "MODES" parameter from 005 ISUPPORT message to find out how many modes can be used in "compressed mode" (for "MODES=3": MODE +ooo nick1 nick2 nick3), till now it was fixed to 3.
Improvement/semi-bug fix: Now after ".upgrade" command bot copies itself from "upgrade" dir to one level upper ("..") only once, not every while.

Release version 1.0.36
Date: 2005-05-17
Bug fix: Win32: Forgot to close unused handles for sub-processes, such as PHP script and sendmail after they exits, which consumed resources under Win32.
Improvement: Now we are accepting also PHP preprocessor in the SPACE character in path.
Bug fix: Linux/BSD: Fixed errors while trying to compile (depfiles problem).

Release version 1.0.35
Date: 2005-05-11
Improvement: Fixed *NIX build problems, updated documentation.

Release version 1.0.34
Date: 2005-04-27
Bug fix: Not correctly set argument to memset() as size of buffer in module botnet.cpp at various places (set 4 bytes instead of much more) causing on remote side of BOTNET connection possibility of false positive buffer overflow detected and closing connection while replication of "private definitions" section of logic.txt configuration file.
Bug fix: Forgotten debug string in win_sock.cpp/sock_connect() for my internal purposes to comment out.
Improvement: BOTNET packet receive code botnet.cpp/botnet_receive() completely recoded to be much clear code to understand.
Improvement: Buffer overflow detection routine recoded to be much clear code to understand.
Improvement: botnet.cpp module clean up of old commented out code.

Release version 1.0.33
Date: 2005-04-26
Bug fix: No more responses to CTCP quoted NOTICE's (RFC is saying strictly that there MUST NOT be automatic reply to NOTICE). However, CTCP request is only PRIVMSG, not NOTICE.
Bug fix: ...many forgotten bug fixes related to CTCP messages handling.
Bug fix: Packets received on BOTNET with commands from protocol BOTNET 5 and later were not fully functioning.
Security minor bug fix: There was possibility of buffer overflow while receiving specially crafted packet on BOTNET connection which could crash bot. Since the length of buffer was not tested inside the packet frame, but packet as whole was tested, there is not possibility of disclosure of sensitive information, nor execution of arbitrary code. However, it is still needed for intruder to know password of remote bot, and, if SSL connection is only allowed for remote bot, it needs correct client's certificate to process these crafted packets; without previous successful authentication it is not possible. (affected versions: from 1.0.20 to 1.0.32 inclusive)
Semi-bug fix: Fixed unknown mode +i panic warning in debug log on UnrealIRCd.
Improvement: Added on_broadcast event to catch IRC operators' PRIVMSG's and NOTICE's separately from other messages so far passed to private definitions section's on_privmsg and on_notice events - from now not.
Improvement: Added on_server_msg event to channel definition and private definition.
Improvement: Added informations about current IRC server host/port to PHP script.
Improvement: From now on, using YYYY-MM-DD style of timestamp in ChangeLog, as recommended international format of date, instead of YYYY/MM/DD :-)

Release version 1.0.32
Date: 2005/04/16
This release is to support developers and to support FreeBSD builing.
Semi-bug fix: If domain part of user's host mask contains "#" (hash) symbol, it is not passed to DNS resolver while compiling "logic.txt" (chacheing DNS names).
Bug fix: Segmentation fault on FreeBSD while unsuccessful DNS resolve.
Improvement: Now compilable and working well on FreeBSD.

Release version 1.0.31
Date: 2005/04/13
Bug fix: on_join event for user "unknown" was called twice.

Release version 1.0.30
Date: 2005/04/09
This release is to support developers and to support Linux builing.
Added: Documentation how to build using MSVC 7, Dev-C++ 4.9.9.1, GCC 3.3.2, KDevelop 3.
Updated: Project files.

Release version 1.0.29
Date: 2005/04/05
Bug fix: Attribute last_changed in various DCC/telnet administration routines was not properly updated.
Bug fix: .private command on DCC/telnet connection was not properly working.
Improvement: Now MD5-encoded (hashed) "passwords" in file "pass.txt" are compared case-insensitive.

Release version 1.0.28
Date: 2005/04/04
Bug fix: Deadlock in new user's .pl command (access to partyline number of lines/seconds to limit the flood).
Improvement: PHP scripts can now modify filesystem. See documentation.
Improvement: Added on_fnc event. See documentation.

Release version 1.0.27
Date: 2005/03/23
Bug fix: Corrected telnet EOL sequence on telnet connection while displaying message from filesystem (telnet uses \r\n, not just \n!).
Bug fix: Problem with accepting TCP connections on listening socket on Linux.
Semi-bug fix: Corrected message from filesystem splitting into multiple PRIVMSG's when sending as private query, it was splitted into multiple lines every 128 characters in filesys.cpp while reading the file + new line character (\n), which was ignored while counting; now it is correctly splitted in irc.cpp every 256 characters, or on new line character (\n), whichever comes first. So now we will have less number of PRIVMSG's.
Semi-bug fix: Fixed incompatibility while compiling with GCC.
Improvement: Now messages from filesystem (such as "Subject:", "Message from owner:", hints how to download file with DCC) can be also localized to more native languages (file "lang/lang01.txt").

Release version 1.0.26
Date: 2005/03/17
Improvement: Security: Remote bot on BOTNET need to have access_usage_procedure on event's procedure to change existing user's on_XXX events.
Improvement: Security: Remote bot on BOTNET need to have access_usage_procedure on event's procedure to set existing user's on_XXX events.
Improvement: Security: Remote bot on BOTNET need to have access_grant_can_send_unknown_users right to change or set user's can_send_unknown_users flag.
Improvement: Security: Procedures are replicated first, users then.
Improvement: BotNet: After pulling of new procedure, bot sets access_usage_procedure right to remote bot on that procedure.
Improvement: Flags access_usage_procedure can now contain string "*" (without quotes) indicating all procedures.

Release version 1.0.25
Date: 2005/03/16
Bug fix: Problem with socket communication - previous release is unstable.

Release version 1.0.24
Date: 2005/03/16
Bug fix: I/O error on socket was not reported to upper application layer.
Bug fix: "Address already in use" error on Win32 was not reported (SO_REUSEADDR bug in Win32).
Improvement: Added commands "delete_irc_servers" and "delete_nicks", so BOTNET protocol increased to 6 (while keeping backward compatibility). See documentation.

Release version 1.0.23
Date: 2005/03/12
Bug fix: If remote connection was closed, some data received before connection close may be lost (e.g. IRC server has closed connection due to restart, or on BOTNET remote bot closed connection,...).
Improvement: Fixed potential incompatibilities on BOTNET between bots compiled on different compilers (GCC / MSVC). On other compilers ensure no alignment is used on structures s_bot_control and s_bot_command; and uint32 must be always 32 bit long; in file botnet.cpp.
Improvement: Added .execute command. See documentation.

Release version 1.0.22
Date: 2005/02/13
Bug fix: .stats always enclosed host name of IRC server in "[]" (typo), now only for IPv6 addresses.
Bug fix: There could be conflict in writting of files "logic.txt", "pass.txt", and "filesystem/index.txt" in upgrade state of bot, if some user were changing password, or invoked .backup, or made change to filesystem in both instances of bot (now on old one, these functions are blocked).
Bug fix: Forgotten support for Botnet over IPv6 network.
Bug fix: Resolved Botnet linking problem due to dead connections.
Improvement: Added .showbots command. See documentation.
Improvement: Added .broadcastping command. See documentation.

Release version 1.0.21
Date: 2005/02/05
Improvement: Added .chpass command.

Release version 1.0.20
Date: 2005/02/02
Bug fix: Fixed strange problem related to change of one's nick.
Improvement: Added .upgrade command. See documentation. Increased BOTNET protocol version to 5.

Release version 1.0.19
Date: 2005/01/31
Improvement: Less CPU load consumption due to BOTNET connections.
Improvement: BOTNET/OpenSSL/security: Now checks incomming BOTNET via SSL client's certificate *really* against "ssl.txt"'s definition of that client's certificate (not only against trusted CA's). If this client has other client certificate, it is rejected.
Improvement: In PHP script, added +R reop hints ("reops") to array of channel dump (IrcNet).

Release version 1.0.18
Date: 2005/01/27
Bug fix: IDENT daemon emulation could be malfunctioning after redirect message from IRC server (Shutdown too soon).
Bug fix: If compiled with IPv6 support, in case of unsucessfull connect to IPv6 IRC host, there was always confusing message "Not compiled with IPv6 support" instead of real error reason (e.g. "Host not found").
Improvement: Added support for IPv6 IDENT daemon emulation. See documentation for command "bot_ident_ipv6". Increased BOTNET protocol to version 4.
Improvement: Now IPv6 address (if not given host, but numeric address) in log message "Connecting to" and "Using IRC server host/port" is enclosed in "[]"
...maybe some forgotten minor bug fixes...

Release version 1.0.17
Date: 2005/01/26
Bug fix: Security: Possible security flaw on WinNT, related to NET_SEND command.
Bug fix: Bad handling of escaped double-quote (\") in string parser for logic.txt file.

Release version 1.0.16
Date: 2005/01/19
Bug fix: On IRCnet, unique ID message has been parsed wrong way, and 043 numeric to force nick change to unique ID while in nick collision caused deadlock in infinite loop.
Bug fix: RPL_ISUPPORT (005 numeric) was parsed omitting first parameter.

Release version 1.0.15
Date: 2005/01/17
Bug fix: In the past, on_banned event could be called for some other user as well as for user who is actually banned on channel.

Release version 1.0.14
Date: 2005/01/11
Security bug fix: Lockout after numerous bad logins could had been malfunctioning, due to invalid argument to function inet_ntop().
Security bug fix: There could be attack on bot in the BOTNET without successful authentication of remote peer by sending incorrect packet sequence (but only with hacked sources, or if attacker spoofed that it is a bot).
Improvement: Now you can use in strings escaped characters like in C (\" \n \r \xAB etc...).
Improvement: PHP script can put as output "EXECUTE" command to execute procedure in file "logic.txt".
Improvement: Increased BOTNET protocol to version 3, there can be call of procedure on remote bot on BOTNET remotely. (on DCC/telnet console there is new command ".rproc").
Improvement: For security reasons and whishes to eliminate DoS attacks and to save memory resources, in the "conf.txt" file, there can be defined maximum DCC/telnet connections from one IP ("dcc_max_sessions_per_ip=3").
Bug fix: Redundant new line character in timestamp of filesystem event.

Release version 1.0.13
Date: 2005/01/10
Bug fix: In filesystem, notify messages for files: possibility of buffer overflow.
Improvement: Now the filesystem notify messagess for file are also checked for length ("msg_force_secure_lines" in "conf.txt" times 128 characters per line).
Improvement: Now bot should accept compressed IPv6 numeric notation syntax in host mask, and/or on receive it from IRC server as host for user ("123::4:5").
Improvement: In file "conf.txt" there can be now "dcc_max_message_size" set to number of maximum bytes for message - helps to control amount of memory resources.
Improvement: Now events in the filesystem are also timestamp-ed.

Release version 1.0.12
Date: 2005/01/09
Bug fix: Redirect to other server (if enabled) was malfunctioning.
Bug fix: Identd module shutdown is now on 001 numeric reply, not on any; if there was 020 (wait request) it was sutted down which could be abortive.

Release version 1.0.11
Date: 2005/01/05
Improvement: Security: Now can be specified DCC/telnet log in lockout after numerous bad login's. It is strongly recommended that you set "lockout_duration=300" and "lockout_count=5" in your "conf.txt" file! This can make intruder guessing password harder. Lockout is IP-address based, so bot remembers bad login's and records IP-addresses of origin. See documentation for users.
Bug fix: On non-Win32 platforms, there was logical error if "sock.cpp" in function "sock_async()" making all sockets blocking instead of non-blocking(!) - true / false exchange issue... (I recommend you not to drink another coffee, and go to sleep when you are overworked, or you'll make such mistakes! ;-)
Improvement: .die/.restart are now faster... removed redundant sleep()'s.
Bug fix: Sendmail: On non-Win32 platforms sendmail was not working.
Improvement: IPv6 support works also on non-Win32 platforms.
Improvement: On non-Win32 platforms added "irc_bot.lock" lock file to detect if there is not accidentally other instance running. On Win32 it was already handled in other way (try to unlink() fopen()'ed file).
...maybe some forgotten minor bug fixes...

Release version 1.0.10
Date: 2004/12/24
Improvement: Bot now parses RPL_ISUPPORT (005 numeric) message, which explains server's/network's features, such as list of modes and how to use them.
Improvement: Added command "raw" into procedure, so you can send raw data to server. Botnet protocol version 2 introduced. So if your procedure contains command "raw", this procedure will not be replicated to other bot which doesn't support Botnet protocol 2 (version <1.0.10) for compatibility reasons.
Improvement: Added file system listing to script, RPL_ISUPPORT parsed variables, and such informations.
Obsoletes: Setting "send_+R" in file "conf.txt" is now ignored for backward compatibility - now using RPL_ISUPPORT message for such informations.

Release version 1.0.9
Date: 2004/12/19
Fixed bug: Related to processing output / execution of php script on non-win32 platforms. Now 2 separate methods, one for win32, one for unix.
Improvement: Added CLI options.

Release version 1.0.8
Date: 2004/12/15
Fixed bug: Again, php script concurrency problem. Now works fine, long term various tests succeeded, it seems to be non-bugie-woogie.
Improvement: Faster filesystem operations (no more forced to save index file every moment in filesystem module, scheduled once per minute).

Release version 1.0.7
Date: 2004/12/13
Fixed bug: There was a poossiblity of crash due to bug in php script handling.
Fixed bug: Cycle channel failed if there were more than one channel to cycle.
Fixed bug: Checking of concurrency of php scripts was malfunctioning. Now really ony one php script (from same template) is executed.
Fixed bug: "link" command sometimes failed. Also botnet linking problem fixed.
Improvement: Botnet replication optimised - there is scheduling of backup + rehash now. It is done after 2 minutes from the last backup + rehash request from remote bot after object pulling, but new version of object will take effect even if backup + rehash is not executed yet.
Improvement: Bot should be compilable also under unices (tested uder i686 GCC 3.3.2 20031022 (Red Hat Linux 3.3.2-1)).
Improvement: Service (under win32) is not needed now, bot after .restart command tries to spawn itself, if succeeded returns BOT_DIE exit code, if not returns BOT_RESTART and leaves respawning on service.

Release version 1.0.6
Date: 2004/12/10
Fixed bug: Malfunctioning setting of user flags "access_to_replication" and "access_grant_replication" in DCC/telnet administration.
Fixed bug: .whois <user_name_mask> on DCC/telnet connection now gives much more (at least full basic) informations from user's definitions.
Fixed semi-bug: No more repeating groups in ".edituser"/".groups"/".add" in DCC/telnet administration. Each group is listed only once now.
Fixed semi-bug: In DCC/telnet administration ".edituser": redundant empty line.
Improvement: DIE's and RESTART's of the bot causes broadcasting kill message to all logged-in users on DCC/telnet (not BOTNET) connections ("DIE/RESTART by <user_name>").
Improvement: Rehashing of the bot (whichever is caused by user, or another bot in BOTNET) puts rehash message to all logged-in users on DCC/telnet connections.
Improvement: If .die/.restart commands has invoked user (not OS on Ctrl+C, service nor system shutdown), the same user gets full kill log with statistics to their console (DCC/telnet). That log is one that is written also to "logs/bot.log" as in previous versions.
Improvement: Added ping message on DCC/telnet (not BOTNET) connection to console to help detect if user is alive, or the connection was broken without notification from IP stack. This could prevent (in theory) hung "zombie" users on partyline. Ping message interval can be set by "dcc_chat_ping_interval=<seconds>" line in "conf.txt" file; zero for dissable.
Documentation: There was possibility of "motd.txt" file (for DCC/telnet connections) since first release; forgotten to notice it in documentation: now updated.
...maybe some forgotten minor bug fixes...

Release version 1.0.5
Date: 2004/12/09
Fixed bug: When on one channel bot got op, it thought that it is opped on every channel.
Fixed bug: Event on_other_mode was not working.

Release version 1.0.4
Date: 2004/12/08
Fixed bug: Undefined language string in file "lang01.txt" causing an empty string in DCC/telnet console.
Improvment: At BOTNET telnet/SSL connection sends at first PING, and after PONG is received sends password (this is check for SSL handshake validity).

Release version 1.0.3:
Date: 2004/11/21
Fixed bug: DCC chat login problem.
Improvement: Now DCC chat / send works over IPv6 too.

Release version 1.0.2:
Date: 2004/11/19
Fixed bug: in smart_mode enabled, there was problem when there was longer time difference between IRC server's op/voice user after net split and time when bot got the WHOIS on "new" users on channel.

Release version 1.0.1:
Date: 2004/11/17
Fixed bug related to unsuccessful reverse DNS lookup (entry wasn't inserted to resolver cache correctly).

Release version 1.0.0:
Date: 2004/11/16
Initial revision by VooDooMan.

Note: If you want to join a mailing-list to get along with new releases, please send me a mail to ghostvoodooman [NOSPAM] (at) [NOSPAM] users (dot) [NOSPAM!] sourceforge (dot) net with subject "VooDoo cIRCle" (to know that your mail is not a spam).


OpenSSL linkage

I, Marian "VooDooMan" Meravy explicitly grant all users the permission to compile and link this software product (VooDoo cIRCle IRC bot) against OpenSSL library.

Notes about upgrading to version 1.1.beta11 from earlier 1.1.x


Basic configuration knowledge

Note, that configuration of this IRC bot is not as easy as configuration of for example IRC bot Eggdrop.

Main logic of the bot is stored in file "logic.txt". This file contains:

  1. definitions of users, which contains:
    1. name of user
    2. their host masks
    3. full name masks
    4. replication parameters used for replication of user between other bots (botnet)
    5. group membership of user
    6. access rights
    7. channel definitions for this user
  2. definitions of procedures, which can be executed in special cases
  3. definitions of channels rules
  4. definitions of private queries for the bot
  5. additionally, list of all groups (which is generated automatically, so you don't need to add them)

Access privileges are in two categories:
  1. "access_to...", this means that user has access to that feature.
  2. "access_grant...", this means that user can grant access to other user to this feature. Example: if there is a group called "my_friends_group", and user has right "access_grant_group" to this group, then user can add or exclude other users to / from this group.
  3. There is also special category applicable only to procedures, "access_usage_procedure", it means that user can assign procedures in this group to events.

Structure of logic.txt file:


 
user YOUR_BOT_NAME
{
   last_changed 0
   host_bot
   host "mybot!*mybot@host.org"
   member_of_group "bots"
}
user USER_NAME
{
   last_changed 0
   host "nick!ident@host.com"
   host "*!ident@another.host.com"
   full_name "I am an IRC user. My real name is unknown..."
   access_to_partyline 1
   replication another_bot push
   access_grant_partyline 0
   access_to_backup 0
   access_to_rehash 0
   access_grant_backup 0
   access_grant_rehash 0
   access_to_+user 0
   access_grant_+user 0
   access_to_+proc 0
   access_grant_+proc 0
   access_grant_replication 0
   partyline_msg_flood 5 10
   meta "key" "value"
   meta "description" "this is an user!"
   channel "#your_channel"
   {
      member_of_group "your_channel_user"
      on_deop revenge2($channel,$source,$target,$source_nick,$target_nick)
      on_ban revenge2($channel,$source,$target,$source_nick,$target_nick)
      on_kick revenge2($channel,$source,$target,$source_nick,$target_nick)
      on_banned banned($channel,$user,$ban_mask)
      on_privmsg 
      msg_flood 3 10
      notice_flood 3 30
      repeat_flood 2 10
      nick_flood 3 30
      join_flood 3 60
      mode_flood 5 10
      allow_dynamic "super_users" "+@" "@"
      allow_dynamic "other_users" "+@" "+"
      dynamic1 
      dynamic2 
      can_send_unknown_users 1
   }
}
Let's go to explain what it means.

String "YOUR_BOT_NAME" should be name of your bot. Note, that this need not to be the same as Nick name of your bot.

Line beginning with "host" contains nick, ident and host name in format <nick>!<ident>@<host>. You can user wildcards, such as "?" for one character, and "*" for zero or any number of characters. You can specify more than one host masks, but at least one. Note that these host masks MUST be in double-quotes ("nick!ident@host").

Line beginning with "full_name" contains full name of user (as shown in WHOIS). You can also use wild cards as in host masks. Note that VooDoo cIRCle identifies user by host mask and full names too! Tip: if you want to disable checking to full name, just simply use this: full_name "*"

Line "last_changed 0" contains time stamp for case of replication this user. Time stamp is number of seconds since 1.1.1970 (it is UNIX standard time stamp). You can set this to zero, if you edit logic.txt file for the first time. This time stamp is used when your bot is replicating this user with another bot via "botnet". Botnet is two or more bots connected together by IP network.

Line "host_bot" means, that this user is the bot itself. Note that this line must NOT to be set to other users! When you have "host_bot" line, you need not have host masks defined for this user (for bot itself), but it is strongly recommended to add host mask for your bot, for case of broken line, when new instance of bot's connection to IRC server is made, and the other one instance falls for "ping timeout", to know that it was bot itself. (There is known problem with flood detection routine, when new instance think of old bot as user "unknown" and ban-kick itself for flood. If there is a host mask present, bot knowns, that it is it itself and applies the flood rules for itself - if there are some defined).


Let's go to next user, "USER_NAME" - this should contain user-friendly name of some user.

Line beginning with "replication" word means, that this user will be replicated to bot named "another_bot". You MUST in this case create user "another_bot". Here is example of record for "another_bot" in logic.txt:

user "another_bot"
{
   host "a_bot!ident@host.org"
   full_name "This is another bot"
   replication_partner
   access_to_+user 1
}


There must be line "replication_partner" in order to link with this bot. You should also set "access_XXX" privileges, that this another bot will have access in your main bot.

Replication types can be:

1) "push" - this object (user, procedure or channel definition) will be pushed to another bot, if that bot has an older version for that object
2) "pull" - this object will be pulled from another bot, if this bot has an older version than other bot
3) "pushpull" - this object will be pushed or pulled to / from another bot, the replication will be done, if one of them has older version of object

You could ask how the remote bot knows if it has older or newer version of some object. There is "last_changed" property, which is set to current time when the object is modified. Bots also sends to each other their current system time, and computes time difference. If the object is older that 60 seconds, it will be pulled according to specified replication rules.


Line "access_to_partyline 1" means, that this user has access to party line. Party line is telnet or DCC connection to bot, often used for its administration, or for chatting. If there is "0" (zero), user doesn't have access.

Line "access_grant_partyline 0" means that user cannot grant access to party line to other user. If there is "1" (one), user can.

Basic knowledge:
Flags "access_to_XXX" means, if user has access to feature "XXX",
Flags "access_grant_XXX" means, if user can grant access to feature "XXX" to other user (can set "access_to_XXX" flag for other user).
Flags "access_to_XXX" and "access_grant_XXX" is followed by space and number of "0" (zero) or "1". "0" means no access, "1" means access is granted.

You can use "*" (an asterisk) wich means 'all groups', but it is not a wild card, wild cards in this case are not allowed.

Other access flags has little bit similar meaning:



"access_to_backup": whether user can use ".backup" command at party line.
"access_to_rehash": whether user can use ".rehash" command at party line.
"access_grant_backup": whether user can grant access to usage of ".backup" command at party line.
"access_grant_rehash": whether user can grant access to usage of ".rehash" command at party line.
"access_to_+user": whether user can grant access to usage of ".+user" command at party line.
"access_grant_+user": whether user can grant access to usage of ".+user" command at party line.
"access_to_+proc": whether user can grant access to usage of ".+proc" command at party line.
"access_grant_+proc": whether user can grant access to usage of ".+proc" command at party line.
"access_grant_replication": whether user can modify replication parameters to other bots on the botnet.
"access_to_restart": whether user can use ".restart" command on DCC / telnet connection to restart the bot.
"access_grant_restart": whether user can grant to other one access to ".restart"
"access_to_die": whether user can use ".die" command on DCC / telnet connection to shutdown the bot.
"access_grant_die": whether user can grant to other one access to ".die"
"access_to_filesystem": whether user has access to filesystem, thus can upload, download files stored in local bot's filesystem directory.
"access_grant_filesystem" whether user can grant to other one access to filesystem
"access_to_private": whether user can modify "private" section of file "logic.txt"
"access_grant_private": whether user can grant "access_to_private" right to other users.
"access_to_can_send_all_users": whether user can send message / file to all users (filesystem).
"access_grant_can_send_all_users": whether user can grant privilege to other user to send message / file to all users.
"access_to_can_send_unknown_users": whether user can send message / file to unknown users (according to flag "host_unknown")
"access_grant_can_send_unknown_users": whether user can grant privilege to other user to send message / file to unknown users (according to flag "host_unknown")
"access_to_upgrade": whether user can use command ".upgrade". NOTE: You need to have at least version 1.0.20 of remote bot on the BOTNET in order to replicate this attribute to it.
"access_grant_upgrade": whether user can grant privilege to use command ".upgrade" to other user. NOTE: You need to have at least version 1.0.20 of remote bot on the BOTNET in order to replicate this attribute to it.
"access_to_apply": whether user can use ".apply" command. "access_grant_apply": whether user can grant privilege to use ".apply" command to other user.

Let's go to channel definition for our "USER_NAME" user.

There are also meta-data used for PHP scripting. It is useful for example for declension in PHP script in some human languages the bot to speak in. See PHP scripting section.

After word "channel" is name of the channel, in which user has some defined rules. Note that name of channel MUST be in double-quotes.

Line beginning with "member_of_group" contains group membership of user on this channel, in double-quotes.

Line beginning with "partyline_msg_flood"

defines flood limits on DCC/telnet connection, including all commands. The first number is number of lines, the second is number of seconds.

Lines beginning with "on_" are events. These events contain name and declaration of procedure, which is executed on specified event. Syntax is: procedure_name($parameter1,$parameter2) and so on. Note that there must NOT be any space character!

List of events that can be assigned to user on channel:



Note for users migrating from versions prior to 1.0.54:

The behavior of events has been changed in version 1.0.54. If variable "$nick", or "$source_nick" contains an empty string (use
if_match $nick ""
), then the IRC server has changed mode on channel, and then variable "$source", or "$source_user" (name of originating user as in "logic.txt") contains name of IRC server which made MODE (or possibly other command). This is possible, for example, after net burst.

Note for users migrating from versions prior to 1.1.0:

Following events have specified mandatory argumens. Procedure/function as handler must have at least number of arguments as specified. Check "on_flood" specification, since there is added one argument. If handler has less number of arguments, it will not be called, and it will end up in logs with message. See this section for more info.
  1. on_deop - this procedure will be called when specified user on specified channel is deopped (-o).
    Syntax of called procedure: procedure_name($channel,$source,$target,$source_nick,$target_nick).
    Parameters:
    1. $channel - contains channel name
    2. $source - contains name of user who is deopping (name of user is as specified in logic.txt as "user-friendly name")
    3. $target - contains name of user who is deopped (name of user is as specified in logic.txt as "user-friendly name")
    4. $source_nick - contains current nick of user who is deopping
    5. $target_nick - contains current nick of user who is deopped
  2. on_ban - this procedure will be called when specified user has just been banned
    Syntax of called procedure: procedure_name($channel,$source,$target,$source_nick,$target_nick,$ban_mask)
    Parameters and syntax are similar as on_deop, except of "$ban_mask" contains the mask that is set as ban.
  3. on_kick - this procedure will be called when specified user has been kicked
    Parameters and syntax are same as on_deop.
  4. on_banned - this procedure is called when your bot has just joined channel, and finds out that specified user is banned (matches the ban mask) and is not listed in exception list.
    Syntax:
    Procedure_name($channel,$user,$ban_mask)
    Parameters:
    1. $channel - contains name of channel
    2. $user - user name as specified in logic.txt
    3. $ban_mask - mask of ban that is set
  5. on_privmsg - this procedure is called when this user posts a message to the channel
    Syntax:
    Procedure_name($channel,$source,$source_nick,$msg)
    Parameters:
    1. $channel - contains channel name
    2. $source - user name as specified in "logic.txt" file
    3. $source_nick - nick name of user
    4. $msg - the message
  6. on_notice - this procedure is called when this user posts a notice to the channel
    Syntax and parameters are same as on_privmsg.
  7. on_unban - this procedure is called when this user is unbanned (-b nick!ident@host)
    Syntax:
    procedure_name($channel,$source,$target,$source_nick,$target_nick,$ban_mask)
    Parameters:
    1. $channel - name of channel
    2. $source - name of user as specified in "logic.txt" file who has unbanned someone
    3. $target - name of user who was unbanned
    4. $source_nick - nick name of user who has set -b flag
    5. $taget_nick - nick name of user who has been unbanned - empty string if user is not on channel
    6. $ban_mask - mask that has been passed as parameter to -b (-b mask)
  8. on_op - this procedure will be called if some user has been opped (+o)
    Syntax:
    procedure_name($channel,$source,$target,$source_nick,$target_nick)
    Parameters:
    (same as on_deop)
  9. on_voice - this procedure will be called if this user has been voiced (+v)
    Syntax and parameters are same as on_deop / on_op
  10. on_devoice - this procedure will be called when this user has been devoiced (-v)
    Syntax and parameters are same as on_voice
  11. on_creator - this procedure will be called if some user has been set as creator of channel (some IRC networks use it) - (+O)
    Syntax and parameters are same as on_op
  12. on_decreator - this procedure will be called if some user has been reset as creator of channel (some IRC networks use it) - (-O)
    Syntax and parameters are same as on_op
  13. on_join - this procedure will be called when this user joins the channel
    Syntax:
    join($channel,$user,$nick,$dynamic1,$dynamic2,$passive)
    Parameters
    1. $channel - name of channel
    2. $user - user name as in "logic.txt"
    3. $nick - nick name of user
    4. $dynamic1 - dynamic "plus" modes that user has been specified by others (if someone gave them +v or +o, this parameter will contains string "@" for +o, "+" for +v, or both, or an empty string)
    5. $dynamic2 - dynamic "minus" modes that user has been specified by others (if someone gave them -v or -o, this parameter will contain string "@" for -o, "+" for -v, or both, or an empty string)
    6. $passive - contains mode of user (e.g. "@" or "+",...) if this user is already on channel, after your bot has just joined the channel, or "0" (zero) if have user just joined channel. Also contains "1" (one) if it is a "passive join", which means that user is already on channel when bot has just joined (it is good case for validate of user's modes). You should use "if_in", and "!if_in" commands for comparsion.
  14. on_flood - this procedure will be called when user excess its flood limit
    Syntax:
    flood($channel,$source,$source_nick,$type,$num,$sec,$sec_of,$list)
    Parameters:
    1. $channel - name of channel
    2. $source - name of user in "logic.txt"
    3. $source_nick - nick name of user
    4. $type - string determining type of flood, can be one of these:
      1. "message" - user posts too many messages to channel
      2. "notice" - user posts too many notices to channel
      3. "nick" - user changes their nick too many times in a shot time
      4. "mode" - user changes mode of channel too many times in a short time
      5. "join" - user joined and parted/quit channel too many times in a short time
      6. "repeat" - user posts to the channel too many same messages / notices in a short time
      7. "ctcp" - user sends CTCP (ping, version,...) requests to all users in the channel (to whole channel) too many times in a short time ("ACTION" is exception here, it is considered as "message", and against "repeat" as well
      Note: "too many xxx in a short time" means that exceeded limit defined for the user as "xxx_flood" limit property (for example "ctcp_flood")
    5. $num - number of occurences (first parameter of flood definition)
    6. $sec - number of seconds that flood took
    7. $sec_of - number of total seconds defined (second parameter of flood definition)
    8. $list - array of strings containing all messages of specified type that user has posted. In case of mode flood there are entries like "+o nick", "-v nick" and so. You need function handler to use this array.

  15. on_except - this procedure is called when someone sets +e (exception to ban) to channel
    Syntax:
    except($channel,$source,$target,$source_nick,$target_nick,$prefix,$mask)
    Parameters are similar, but $prefix contians one-character string "+".
  16. on_unexcept - this procedure is called when someone sets -e (exception to ban) to channel
    Syntax:
    unexcept($channel,$source,$target,$source_nick,$target_nick,$prefix,$mask)
    Parameters are similar, but $prefix contians one-character string "-"
  17. on_invite - this procedure is called when someone sets +I (invite and also exception to ban) to channel
    Syntax:
    invite($channel,$source,$target,$source_nick,$target_nick,$prefix,$mask)
    Parameters are similar, but $prefix contians one-character string "+".
  18. on_uninvite - this procedure is called when someone sets -I (invite and also exception to ban) to channel
    Syntax:
    uninvite($channel,$source,$target,$source_nick,$target_nick,$prefix,$mask)
    Parameters are similar, but $prefix contians one-character string "-".
  19. on_not_invited - this procedure is called when bot joins a channel and has found that someone is not on +I invite list
    Syntax:
    not_invited($channel,$user,$mask)
  20. on_not_in_reop - this procedure is called when bot joins a channel and found that someone is not on +R reop hints (IRCnet)
    Syntax:
    not_in_reop($channel,$user,$mask)
  21. on_reop - this procedure is called when someone set / removes R mode (reop hints - IRCnet) for some user
    Syntax:
    reop($channel,$source_user,$target,$source_nick,$target_nick,$prefix,$mask)
    Where $prefix contains "+" for +R mode, or "-" for -R mode.
  22. on_other_mode - this procedure is called when nick gets mode other than +o, +v and +O on some exotic extended IRC networks.
    Syntax is:
    other_mode($channel,$source_user,$target_user,$source_nick,$target_nick,$prefix,$mode_char)
    Where "$prefix" is '+' for set, or '-' for reset, "$mode_char" can be '%', '~', and so on...
  23. on_other_mode_mask - this procedure is called when bot joins a channel and found that someone has mode with mask, or someone just set that mode. This is to support exotic IRC servers.
    Syntax:
    other_mode_mask($channel,$source_user,$target,$source_nick,$target_nick,$prefix,$mode,$mask)
    For instance, if bot detects from ISUPPORT (005 numeric) that there is (hypotetical) mode 'X' that has a parameter, $prefix will contain "+" or "-" (set or unset respectively), $mode will contain "X" in our case, and $mask particular parameter. Bot first checks if $mask affects some user(s) and trigger event for that user. If the $mask doesn't match any user, it will trigger event on "unknown" user (marged by tag "host_unknown". If this mode "X"'s parameter is not a host mask on your IRC network, you may want to catch setting/unsetting this mode by binding event to procedure/function using "bind" command/built-in function in your script. In your instance, $type (the first argument to bind command/bind() function) could be "+X@channel" or "-X@channel", e.g. to catch both '+' and '-', first argument to bind() function should be "?X@channel" wild-carded mask.
  24. can_send_unknown_users - this is set to one (1) if user can send message / file to unknown user if it appears on the channel (filesystem). Otherwise, it is zero (0). Note, that if there is one (1), unknown when unknown user wants to receive message / file, it must have privilege "access_to_filesystem" (consider user flagged by "host_unknown"). If message / file has attribute READ for unknown users, note, that every user can receive / download it.


List of flood limits assigned to specific user on channel:


After specified flood keyword, there is number of occurrences and number of seconds, delimited by space. For example:
msg_flood 5 10
means that when user posts 5 messages in 10 seconds, it will be considered as flood, and specified procedure is called.
  1. msg_flood - flood limit for PRIVMSG (common message).
  2. notice_flood - flood limit for NOTICE.
  3. repeat_flood - flood limit for repeating. If there is "repeat_flood 3 10", repeat flood procedure will be called when user posts 3 very same messages in 10 seconds.
  4. nick_flood - when user changes their nick many times.
  5. join_flood - when user joins and parts channel many times.
  6. mode_flood - when user changes mode of channel or user many times.
  7. ctcp_flood - when user sends to channel (=to all users) CTCP request (for example /ctcp #channel ping), thus any quoted message, except of ACTION - it is considered against repeat flood and message flood definitions.

Line beginning with "allow_dynamic" contains definitions about dynamic modes. Note that all parameters MUST be in double-quotes.
Dynamic modes are useful for "learning" your bot. For example, when someone in specified group sets +o ("@" mode) to this user, bot should automatically set to this user +o when they join. It is useful when you have on your channel another bot, from another vendor, and it is configured to give someone +o status, and that bot is in that dynamic group, your bot writes it down, and will be automatically set +o for that user. This is called "dynamic modes". Note, that this "learning" should NOT be applied on "unknown user", because that would mean that anyone who is considered as unknown will have +o status. This learning is useful only for known users in "logic.txt".
First parameter is name of group of user, from which are dynamic modes accepted.
Second parameter is which modes are accepted with "+" prefix. There is "+" for +v mode; "@" for +o mode, or "+@" for +v and +o mode;
Third parameter is similar to second one, but there are modes with "-" prefix ("+" for -v mode, "@" for -o mode and "+@" for -v and -o mode).

Finally, line "dynamic1" stores minus dynamic modes, and "dynamic2" plus dynamic modes.

Note that bot will NOT automatically give dynamic modes (+o, -o, +v, -v), unless you assign on_join event procedure, which checks for dynamic modes and does it itself, after considering suitable reason.


Channel definitions



Here is example part of logic.txt:

channel "#your_channel"
{
   last_changed 0
   member_of_group "my_channel"
   replication another_bot push
   on_mode mode($channel,$source,$source_nick,$plus_modes,$minus_modes)
   on_key key($channel,$source,$source_nick,$prefix,$key)
   on_limit limit($channel,$source,$source_nick,$prefix,$limit)
   on_ircop ircop($channel,$source,$source_nick,$on)
   on_privmsg proc_chan_msg($channel,$source,$source_nick,$msg)
   on_part part($channel,$source,$source_nick,$msg,$type)
   on_dynamic_ban dynamic_ban($channel,$source,$source_nick,$prefix,$ban_mask)
   on_ctcp ctcp($source,$source_nick,$channel,$command,$parameters)
   dynamic_ban "some!ident@host.org" "do not do a lame things!"
   partyline_dynbans_editors "super_users"
   allow_dynamic "super_users" "sp" "sp"
   dynamic1 
   dynamic2 
}
After word "channel", there should be name of your channel, in double-quotes.

"last_changed" property is relevant for replication.
"member_of_group" - contains group membership of channel.
"replication" - defines replication rules same as user object.
"on_mode" procedure will be called when someone changes mode of channel (for example +s, +nt, ...)

Events on channel definition:


  1. on_mode
    Syntax:
    proc_name($channel,$source,$source_nick,$plus_modes,$minus_modes)
    Paramters:
    1. $channel - name of channel
    2. $source - name of user who changed the mode as defined in logic.txt
    3. $source_nick - current nick name of user who changed mnode
    4. $plus_modes - contains mode character; for +n, it is "n", for +t it is "t", or can be an empty string
    5. $minus_modes - contains mode character; for -n, it is "n", for -t it is "t", or can be an empty string
  2. "on_key" procedure will be called if someone on channel sets or clears key to channel (+k)
    Syntax:
    proc_key($channel,$source,$source_nick,$prefix,$key)
    Parameters - same as on_mode, but:
    1. $prefix - contains "+" for +k, or "-" for -k
    2. $key - contains key as parameter to +/-k mode

  3. "on_limit" procedure will be called if someone on channel sets users limit (+l)
    Syntax:
    proc_limit($channel,$source,$source_nick,$prefix,$limit)
    Parameters - same as on_key, but:
    1. $limit - contains limit that has been set

    "allow_dynamic" contains rule for dynamic modes. See "allow_dynamic" for users for details. The parameters can be such as "sp" for +/-sp modes, or "i" for +i, ...
     
  4. "on_ircop" procedure will be called if on the channel is irc operator present after he joined, parted channel, or he is present on channel at bot's join
    Syntax:
    proc_ircop($channel,$source,$source_nick,$on)
    1. $channel - name of channel
    2. $source - name of user from logic.txt (if present)
    3. $source_nick - nick name of the irc op
    4. $on - contains string "1" (one) if irc op is present, or "0" (zero) if irc op has left the channel
  5. "on_privmsg" procedure will be called when anyone posts a PRIVMSG to channel

    Syntax:
    proc_chan_msg($channel,$source,$source_nick,$msg)

    1. $channel - name of channel
    2. $source - name of user from logic.txt (if present)
    3. $source_nick - nick name
    4. $msg - message content
  6. "on_notice" procedure will be called when anyone posts a NOTICE to channel
    Syntax and parameters are same as on_privmsg.
  7. "on_part" procedure will be called when someone parts channel or quits the IRC

    Syntax:
    part($channel,$source,$source_nick,$msg,$type)

    1. $channel - name of channel
    2. $source - name of user from logic.txt (if present)
    3. $source_nick - nick name
    4. $msg - reason of part / quit, or kick message when it was a kick
    5. $type - type of exit, one of following: "PART", "QUIT", "KICK"

  8. "on_dynamic_ban" procedure will be called when someone sets or removes ban (+/-b mask)

    Syntax:
    dynamic_ban($channel,$source,$source_nick,$prefix,$ban_mask)

    1. $channel - name of channel
    2. $source - name of user from logic.txt who set/removed the ban
    3. $source_nick - and his nick
    4. $prefix - contains "+" for +b and "-" for -b was set
    5. $ban_mask - mask of the set/removed ban

    Notes:
    Dynamic ban is ban, that doesn't need to be set on channel (remember that most IRC networks limits number of bans on channel to 30), so there is a list of dynamic bans, and when someone joins a channel and bot detects that there is dynamic ban entry in its configuration, it can set ban (for couple of minutes) and kick this user. In this procedure, it is useful to check if $source user is member of group who can set/remove dynamic ban. The bot doesn't remember dynamic ban, so you need to use "dynamic_ban" command to set dynamic ban. Also, bot will not automatically set channel ban and kick user that matches dynamic ban mask, you need to do it explicitly in logic.txt file in some procedure.

  9. "on_ctcp" procedure will be called if someone posts a CTCP request to channel or private query of the bot.

    Syntax:
    on_ctcp ctcp($source,$source_nick,$channel,$command,$parameters)

    Parameters

    1. $source - name of user as defined in "logic.txt"
    2. $source_nick - nick of user
    3. $channel - name of channel
    4. $command - command part of the quoted message (such as "VERSION", "DCC", "PING", "ACTION")
    5. $parameters - text after $command

    See also private definitions of "on_ctcp".

  10. "on_server_msg" will be called when message from IRC server is posted to channel.

    Syntax:
    on_server_msg server_msg($channel,$source,$type,$msg,$server,$port)

    Parameters

    1. $channel - name of channel
    2. $source - name of server which post message
    3. $type - type of message: string "PRIVMSG" or "NOTICE"
    4. $server - host of server which we are now on
    5. $port - port of server which we are now on

    See also private definitions of "on_server_msg".

  11. "allow_dynamic" contains rule for dynamic modes. See "allow_dynamic" for users for details. The parameters can be such as "sp" for +/-sp modes, or "i" for +i, ... 
  12. "dynamic_ban" (there can be multiple lines) has first argument mask of dynamic ban, and second reason which can be used for kick reason.

  13. "partyline_dynbans_editors" (there can be multiple lines beginning with this) defines which group of users that they are member of can set, or unset dynamic ban entries via DCC CHAT or telnet connection (note that the also need to have access_to_partyline privilege).

 

Private definitions - handles private queries

  1. "on_privmsg" procedure will be called if someone posts a message to query of the bot

    Syntax:
    private_msg($source,$source_nick,$msg)

    Parameters

    1. $source - name of user as defined in "logic.txt"
    2. $source_nick - nick of user
    3. $msg - message

  2. "on_notice" procedure will be called if someone posts a notice to query of the bot

    Syntax and parameters are same as "on_privmsg".

  3. "on_ctcp" procedure will be called if someone posts a CTCP request to channel or private query of the bot.

    Syntax:
    on_ctcp ctcp($source,$source_nick,$channel,$command,$parameters)

    Parameters

    1. $source - name of user as defined in "logic.txt"
    2. $source_nick - nick of user
    3. $channel - name of channel or an empty string if it is a private query
    4. $command - command part of the quoted message (such as "VERSION", "DCC", "PING", "ACTION")
    5. $parameters - text after $command

    Note: This event will be triggered also when user posts a CTCP request to channel, together with channel's definition "on_ctcp" event. Your procedure will receive also "ACTION"'s.
    "DCC", "PING" and "TIME" should be ignored, because they are handled by the bot automatically. When someone posts message "\001ACTION is doing a bugie-woogie style of crashing\001", $command will contain "ACTION" and $parameters will contain string "is doing a bugie-woogie style of crashing".

  4. "on_filesys_got_new" procedure will be called if someone posts adds message or file to filesystem.

    Syntax:
    on_filesys_got_new filesys_got_new($source,$nick,$ident,$host,$internal_name)

    Parameters

    1. $source - name of user as defined in "logic.txt"
    2. $nick - nick of user (empty if user has added a message via DCC/telnet connection)
    3. $ident - ident of user (empty if user has added a message via DCC/telnet connection)
    4. $host - host of user (emptyif user has added a message via DCC/telnet connection, or "127.0.0.1"/"::1" if it was user from localhost)
    5. $ineternal_name - internal name of filesystem's object

    Note: This event will not be replicated to/from bot version < 1.0.28, that is BOTNET protocol version 7 due to compatibility reasons.

    Your procedure should look like this:

    See PHP scripting section.

  5. "on_fnc" procedure will be called if bot has been forced to change its nick (applicable only on IRCnet).

    Syntax:
    on_fnc fnc($old_nick,$new_nick)

    Parameters

    1. $old_nick - bot's old nick
    2. $new_nick - bot's new nick

    Note: This event will not be replicated to/from bot version < 1.0.28, that is BOTNET protocol version 7 due to compatibility reasons.

    Your procedure should look like this:

    This attempts to change nick after 30 minutes and 2 seconds - on IRCnet is currently the old nick temporarily unavailable for 30 minutes after nick collision.

  6. "on_broadcast" will be called when message from IRC operator is sent to all users which match specific mask.

    Syntax:
    on_broadcast bcast($source,$source_nick,$source_ident,$source_host,$bcast_mask,$type,$msg,$server,$port)

    Parameters

    1. $source - name of originating user as in "logic.txt"
    2. $source_nick - nick name of originating user who sent message (probably IRC operator)
    3. $source_ident - ident of originator
    4. $source_host - host of originator
    5. $bcast_mask - mask used to broadcast (something like "$$irc.somedomain.org")
    6. $type - string of type of message: "PRIVMSG" or "NOTICE"
    7. $msg - the whole message
    8. $server - host of server which we are now on
    9. $port - port of server which we are now on

    Note that if broadcast message is CTCP PRIVMSG, the proper event will be also called to process CTCP message.

    Note: This event will not be replicated to/from bot version < 1.0.33, that is BOTNET protocol version 8 due to compatibility reasons.

  7. "on_server_msg" will be called when message from IRC server is posted to bot as private message.

    Syntax:
    on_server_msg server_msg($source,$type,$msg,$server,$port)

    Parameters

    1. $source - name of server which post message
    2. $type - type of message: string "PRIVMSG" or "NOTICE"
    3. $server - host of server which we are now on
    4. $port - port of server which we are now on

    See also channel definitions of "on_server_msg".

    Note: This event will not be replicated to/from bot version < 1.0.33, that is BOTNET protocol version 8 due to compatibility reasons.

  8. "on_internal_event" will be called when something happen in the internals of the bot.

    Note: this event could be dangerous if it would generate another event for logs, so overflow can occur. It should really contain only logical commands, as "if_in" and so, and commands "admin_msg". You can use it for console to know what is going on with your bot.

    Syntax:
    on_internal_event internal_event($type,$timestamp,$time_string,$flags1,$flags2,$flags3,$flags4,$severity_numeric,$severity_string,$msg1,$msg2,$server,$port)

    Parameters

    1. $type - type of event (e.g. "@rehash@", "@backup@")
    2. $timestamp - Unix timestamp (number of seconds until UNIX epoch: 1970-01-01 as number in string)
    3. $time_string - e.g. "Wed Jul 06 14:40:45 2005"
    4. $flags1 - flags #1 - type-specific as what $type contains
    5. $flags2 - flags #2 - type-specific as what $type contains
    6. $flags3 - flags #3 - type-specific as what $type contains
    7. $flags4 - flags #4 - type-specific as what $type contains
    8. $severity_numeric - severity number as string; $severity_string severity as string:
      1. $severity_numeric=="0"; $severity_string=="N/A"; This means that no severity is given. Often used for events that has no severity.
      2. $severity_numeric=="1"; $severity_string=="informational"; This event is informational.
      3. $severity_numeric=="3"; $severity_string=="warning"; This event is warning.
      4. $severity_numeric=="5"; $severity_string=="error"; This event is error.
      5. $severity_numeric=="7"; $severity_string=="critical error"; This event is critical error.
      6. $severity_numeric=="9"; $severity_string=="fatal error"; This event is fatal error.
    9. $msg1 - type-specific message #1 as what $type contains
    10. $msg2 - type-specific message #2 as what $type contains
    11. $server - host/IP of server we are connected to
    12. $port - Port of server we are connected to as string
    Note: This event will not be replicated to/from bot version < 1.0.52, that is BOTNET protocol version 11 due to compatibility reasons.

    Types of events follows:

      1. $type=="@rehash@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - string, who caused rehashing
      5. $flags2 - not used yet, should contain an empty string
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "1"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - "Trying to rehash..."
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above

      Note: Before rehash

      1. $type=="@rehash_done@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - string, who caused rehashing
      5. $flags2 - string "OK" for success; "ERROR" for error
      6. $flags3 - an empty string for success; if not, string number of error line in "logic.txt"
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "1" for successful rehash; "5" for error, so roll-back to old configuration is going to be performed
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Message "Rehashing succeeded."; in case of not success contains error string describing which line of configuration script ("logic.txt") is errorneous.
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above

      Note: After rehash

      1. $type=="@rehash_rollback_ok@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - not used yet, should contain an empty string
      5. $flags2 - not used yet, should contain an empty string
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "1"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Message: log from roll-back engine (more informations about which file was used, from which date, and so on.
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above

      Note: After successful roll-back

      1. $type=="@rehash_rollback_error@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - not used yet, should contain an empty string
      5. $flags2 - not used yet, should contain an empty string
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "5"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Message: "Don't have any backup files for roll-back."
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above

      Note: After unsuccessful roll-back

      1. $type=="@backup@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - string, who caused backup
      5. $flags2 - not used yet, should contain an empty string
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "1" for success of backup, or "3" for ignored backup (e.g. bot is in UPGRADE state)
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - contains an empty string if $severity_numeric=="1", error message if $severity_numeric=="3"
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above
      1. $type=="@apply@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - string, who caused ".apply" command
      5. $flags2 - not used yet, should contain an empty string
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "1"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Message of success
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above
      1. $type=="@restart@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - string, who caused ".restart" command
      5. $flags2 - not used yet, should contain an empty string
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "1"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - not used yet, should contain an empty string
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above
      1. $type=="@restart_error@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - string, who caused ".restart" command
      5. $flags2 - not used yet, should contain an empty string
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "9"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Message why restart was not successful (e.g. "RESTART: Error spawning new instance. Something should run it.")
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above

      Note: This could occur if bot wasn't spawned by service, and ".restart" command failed to re-spawn the bot.

      1. $type=="@die@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - string, who caused ".die" command
      5. $flags2 - not used yet, should contain an empty string
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "1"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - not used yet, should contain an empty string
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above
      1. $type=="@upgrade@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - string, who caused ".die" command
      5. $flags2 - file name of new binary
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "1" for ".upgrade" command; contains "5" for error while performing UPGRADE
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - if $severity_numeric=="1": an empty string (before new instance has been spawned), or contains success message (after new instance has been spawned); if $severity_numeric=="5": error message
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above
      1. $type=="@ircop@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - Nick name of IRC operator
      5. $flags2 - Full host mask of IRC operator (e.g. "nick!user@host")
      6. $flags3 - Channel name
      7. $flags4 - String "ON" if IRC operator joined channel, or is found out that they is on the channel; "OFF" if left channel
      8. $severity_numeric - contains "3"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - not used yet, should contain an empty string
      11. $msg1 - Full name / real name of IRC operator from WHOIS
      12. $server - see above
      13. $port - see above

      Note: It will be fired if an IRC operator is found on some channel.

      1. $type=="@botnet_link@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - Remote bot name (as defined in "logic.txt")
      5. $flags2 - "LINKED", "DELINKED", "BAD_PASSWORD_HERE" for bad password on our side, "BAD_PASSWORD_THERE" for bad password on the other side
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "1" if remote bot has been linked; contains "3" if remote bot has been de-linked, or other error
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - There is explanation message for human
      11. $msg1 - not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above

      Note: There you can get informations about linking/delinking remote bots.

      1. $type=="@botnet_replication@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - Remote bot name (as defined in "logic.txt")
      5. $flags2 - "channel" for channel, "user" for user
      6. $flags3 - name of object
      7. $flags4 - Error reason (or "OK" for okay)
      8. $severity_numeric - contains "1" if replication was performed okay; contains "5" if there is replication error
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - There is explanation message for human
      11. $msg2 - contains "PUSH", "PULL", or "PULL_REQUEST" describing type of replication, or "REMOTE" for remote bot rejected replication, or "LOCAL" if local bot rejected replication
      12. $server - see above
      13. $port - see above

      Note: It will be fired if replication event occur on BOTNET.

      1. $type=="@log@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - Type of log message: "debug", "irc", "socket", "bot", "identd", "channel", "botnet_debug", "botnet", "ssl", "broadcast" (broadcast messages from IRC operators), "custom" for module's LOG command/log_print function, "clients"
      5. $flags2 - If $flags1=="irc": "IN" for incomming message, "OUT" for outgoing message; if $flags1=="socket": OS error number as text; if $flags1=="channel": name of channel, or "status" for status messages; if $flags1=="botnet_debug": name of remote bot (from "logic.txt"); if $flags1=="botnet": name of remote bot (from "logic.txt"); if $flags1=="broadcast": Nick name of IRC operator - originator of PRIVMSG/NOTICE; module's name in case of $flags1=="custom"; if $flags1=="clients", there is numeric ID of client connection
      6. $flags3 - not used yet, should contain an empty string
      7. $flags4 - not used yet, should contain an empty string
      8. $severity_numeric - contains "1"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Log message; if $flags1=="socket": OS error message
      11. $msg2 - if $flags1=="socket": Human message of I/O error; else: not used yet, should contain an empty string
      12. $server - see above
      13. $port - see above
      1. $type=="@connection@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - Type of connection: "DCC4" for IPv4, "DCC6" for IPv6, "telnet4" for IPv4, "telnet6" for IPv6
      5. $flags2 - Remote IP address
      6. $flags3 - Local IP address
      7. $flags4 - Local port
      8. $severity_numeric - contains "1"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Informationl message
      11. $msg2 - Not used yet
      12. $server - see above
      13. $port - see above
      1. $type=="@connection_login@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - User name as in logic.txt
      5. $flags2 - Remote IP address
      6. $flags3 - Local IP address
      7. $flags4 - Local port
      8. $severity_numeric - contains "1" for success, or "3" for bad login
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Informationl message describing more informations
      11. $msg2 - If it is warning, there is who the user is considered as (recognised via hostmasks in logic.txt), or an empty string for telnet connection
      12. $server - see above
      13. $port - see above
      1. $type=="@dcc_request@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - User name as in logic.txt
      5. $flags2 - Nick
      6. $flags3 - Hostmask
      7. $flags4 - Not used yet
      8. $severity_numeric - contains "1"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Informationl message
      11. $msg2 - DCC quoted string of request
      12. $server - see above
      13. $port - see above
      1. $type=="@dcc_request_flood@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - User name as in logic.txt
      5. $flags2 - Nick
      6. $flags3 - Hostmask
      7. $flags4 - Not used yet
      8. $severity_numeric - contains "3"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Informationl message
      11. $msg2 - DCC quoted string of request
      12. $server - see above
      13. $port - see above
      1. $type=="@dcc_request_access@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - User name as in logic.txt
      5. $flags2 - Nick
      6. $flags3 - Hostmask
      7. $flags4 - Not used yet
      8. $severity_numeric - contains "3"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Informationl message saying if user has no access to the partyline or filesystem
      11. $msg2 - DCC quoted string of request
      12. $server - see above
      13. $port - see above
      1. $type=="@end_of_init_burst@"
      2. $timestamp==(see above)
      3. $time_string==(see above)
      4. $flags1 - Not used yet
      5. $flags2 - Not used yet
      6. $flags3 - Not used yet
      7. $flags4 - Not used yet
      8. $severity_numeric - contains "1"
      9. $severity_string - according to $severity_numeric: (see above)
      10. $msg1 - Not used yet
      11. $msg2 - Not used yet
      12. $server - see above
      13. $port - see above
      Note: After bot JOINs a channel (often at starup), it is in initialization state, I call it "WHOIS burst". It needs to do WHOIS on every user on every channel to know who is who and which rules to apply on them. Also it send MODE commands for channel, to get +e, +I, +b and, on IRCnet, +R list of masks. It may take up to few minutes to queue of commands gets empty, when these commands were processed. After this burst this event is generated. If you have script that sends something to channel, command is also put to queue, and you are wondering why script is not working. It's just because that command is in queue, and it takes some time when it gets in place. So this event helps you to know if the queue is already empty - bot ended initialization burst state.

    Note: You can use "if_match" and "!if_match" on "$type" argument to filter it out, and then command "admin_msg". To send ALL events, use procedure:


Procedure and function commands and syntax

Procedures are slightly faster than functions because of simple syntax.

Basic knowledge about procedures:

You can use php-like scripting syntax. Scripting of procedures in logic.txt is poor, for advanced scripting you should use external PHP script (see "SCRIPT" command, which executes a PHP script), or function. There are some limitations: use only one SPACE as white-space (except of at beginning of the line), don't use semi-colon ";" at the end of the line, and beginning and end of block ("{" and "}" brackets) must be one separate line. Procedures cannot return value, and can handle only strings, or numbers as string.

Special escape sequences:

  1. \\ gives backslash
  2. \" gives double-quote
  3. \' gives single-quote
  4. \r gives ASCII carriage return character
  5. \n gives ASCII new line character
  6. \t gives ASCII horisontal TAB character
  7. \a gives ASCII bell (alert) character
  8. \b gives ASCII backspace character
  9. \f gives ASCII form feed character
  10. \r gives ASCII character
  11. \v gives ASCII vertical TAB character
  12. \? gives question mark
  13. \$ gives dollar sign
  14. \xA1 gives A1 hex character
  15. \123 gives 123 octal character

If the procedure contains in declaration, for example "$channel" and "$nick" variable, you can use this command for giving user +o status:

op HIGH $channel $nick

(see definition of "op" command)

Contatenating strings:

If you want to ban (+b) some user on specific channel, you can use this command:

ban_mask $channel "*!".$ident."@".$host

which means that ban mask will be set on channel name in variable "$channel". If we assume that "$ident" variable contains user's ident (for example "someuser") and "$host" variable contains user host (for example "user.host.org"), the ban mask will be "*!someuser@user.host.org". Note that there CANNOT be any space character between double-quote mark, dot and dollar sign.

For commands "op", "deop", "voice", "devoice", "msg", "msgq", "notice", "noticeq" and "chan_mode" there is first parameter indicating priority of action (it will be put to another buffer if "compress_mode_wait" if conf.txt is non-zero). Commands "ban_mask", "unban_mask" and "kick" are always considered as CRITICAL priority. The valid priorities are:

  1. LOW
  2. HIGH
  3. CRITICAL - the message will be sent immediately to IRC server.
If you have properly configured "irc_bot_flood_bytes", "irc_bot_flood_seconds" and "irc_bot_flood_lines" in "conf.txt", then excess flood should not occur. LOW and HIGH classes has queue each. First, HIGH queue is sent to main queue (where CRITICAL goes) waiting to put to server as soon as possible (according to mentioned flood control keys in "conf.txt"). When HIGH becomes empty, then LOW takes place. You should consider to use always LOW (at least for PRIVMSG), because if HIGH queue will become full of commands, then issued kicks/bans with HIGH priorities needs to wait. It is good practice to use LOW where possible. HIGH and CRITICAL is recommended only if really needed.

Functions have similar syntax as in PHP script. For example:

function test($arg1, $arg2, &$ref_var)
{
    $ref_var=$arg1 || !$arg2;
    return ($arg1=="abc")?0:10;
}

There are special control commands, each begins with '#' sign as first character on the line, example:
function foo()
{
#last_changed 12345678
#remote_bot_call other_bot_name
#replication bot2 pushpull
#member_of_group group1
   log_print("boo! this is a function foo()");
}
These commands has similar meaning as attributes of procedures.
Referenced variable can be only as function argument, or in foreach() construct. There are implemeted construscts like:
if(conditional_expression1)
    command1;
else if(conditional_expression2)
    command2;
for(init_expression; conditional_expression; iterative_expression)
    command3;
foreach($array)
   command3;
foreach($array as $element)
   command4;
foreach($array as &$element)
   command5;
foreach($array as $key => $value)
   command6;
foreach($array as $key => &$value)
   command7;
switch($value) {
    case FALSE:
        command;
        break;
    case "abc":
    case "123":
        command;
        // fall through
    default:
        command;
}
while(--$x!=0) {
    command;
}
do {
    command;
} while($x);

Loops can be broken by break, or continue. You can use also goto command, but be sure not to jump outside from loop, or into loop; you can break things doing so.
again:
    $x=test($x);
    if($x)
        goto again;

Operator precedence is in folowing talbe, associativity is slightly different than in PHP.
Precendece Associativity Operator
1 non-associative
/i
2 left
(
3 left
[
4 non-associative
$x++ $x-- ++$x --$x
5 right
~ (int) (string) (bool)
6 right
!
8 left
* / %
9 left
+ - .
10 left
<< >>
11 non-associative
< <= > >=
12 non-associative
== != === !==
13 left
&
14 left
^
15 left
|
16 left
&&
17 left
||
18 left
?:
19 right
= += -= *= /= .= %= &= |= ^= <<= >>=
20 left
and
21 left
xor
22 left
or
23 non-associative
=>
24 left
,
25 right
return
The lower number of precedence the higher precedence. Associativity means that when we have two operators of the same precedence, it will be evaluated from left to right in case of "left" associativity. However, you cannot do these things as in PHP:
$x=-+1;
if(!$a=foo())
First one because '-' and '+' has same precedence, the second one because '!' has higher precedence, but '=' needs l-value. The right is:
$x=-(+1);
if(!($a=foo()))

There is also array index extension. Because name of nicks and channels are not case-sensitive, you can do this:
$nicks["mYnIcK"/i]="foo";
$nicks[$somenick/i]="bar";

Which means that this index will be evaluated case-insensitive; if there is ambiguity, the first index that matches will be used.
Pushing next value to array is done with:
$nicks[]="foo";

Following code creates associative array, as in PHP:
$ar=array(1 => "a", 2 => "b");

There is internal "int" counter associated with each array, which assigns value to unique "int" index, starting from zero.
Unsetting variable is done as follows:
$foo=NULL;

There are few primitive types of variable: "int", "string", "bool" and "array". It is recommended to create array and then assign values as follows:
$foo=array();
$foo["test"]=2;

Arrays can have only "int" or "string" index.
Typecast is done by "(int)", "(string)", or "(bool)". Example:
$foo="1";
$foo_int=(int)$foo;
$foo_str=(string)$foo;
$foo_bool=(bool)$foo;

"bool" type can have values "TRUE" or "FALSE".
Everything in double-quotes is scanned for dollar sign ('$') to evaluate as variable, but in single-quotes not, e.g.
$x="def";
$y="abc$x";
the $y will contain "abcdef", but
$x="def";
$y='abc$x';
the $y will contain "abc$x".

Everything here is case-sensitive, including variable names, indexes to array (if they are string and not specified with "/i"), name of types in typecast, and keywords like "foreach", "NULL", "TRUE", "FALSE".

There are also three keywords, "LOW", "HIGH" and "CRITICAL" to use for built-in functions which require priority to be specified.
Another special three keywords are used for seeking in the file, they are "SEEK_SET", "SEEK_CUR" and "SEEK_END".

Full list of constants (periodically-updated):

SEEK_SET
SEEK_CUR
SEEK_END

CASE_SERVER
CASE_ASCII
CASE_RFC1459

TRUE
FALSE

NULL

LOW
HIGH
CRITICAL

PCRE_ERROR_NOMATCH
PCRE_ERROR_NULL
PCRE_ERROR_BADOPTION
PCRE_ERROR_BADMAGIC
PCRE_ERROR_UNKNOWN_OPCODE
PCRE_ERROR_NOMEMORY
PCRE_ERROR_NOSUBSTRING
PCRE_ERROR_MATCHLIMIT
PCRE_ERROR_CALLOUT
PCRE_ERROR_BADUTF8
PCRE_ERROR_BADUTF8_OFFSET
PCRE_ERROR_PARTIAL
PCRE_ERROR_BADPARTIAL
PCRE_ERROR_INTERNAL
PCRE_ERROR_BADCOUNT
PCRE_ERROR_DFA_UITEM
PCRE_ERROR_DFA_UCOND
PCRE_ERROR_DFA_UMLIMIT
PCRE_ERROR_DFA_WSSIZE
PCRE_ERROR_DFA_RECURSE
PCRE_ERROR_RECURSIONLIMIT
PCRE_ERROR_NULLWSLIMIT
PCRE_ERROR_BADNEWLINE

PREG_NO_ERROR
PREG_INTERNAL_ERROR
PREG_BACKTRACK_LIMIT_ERROR
PREG_RECURSION_LIMIT_ERROR
PREG_BAD_UTF8_ERROR

PREG_GREP_INVERT
PREG_PATTERN_ORDER
PREG_SET_ORDER
PREG_OFFSET_CAPTURE
PREG_SPLIT_NO_EMPTY
PREG_SPLIT_DELIM_CAPTURE
PREG_SPLIT_OFFSET_CAPTURE

Let's go to definition and usage of commands in procedures, and their equivalents, built-in functions (for functions):

  1. "op" command

    Definition:

    Gives +o flag to user

    Syntax for procedure:

    op LOW "#channel_name" "nick"

    Syntax for function:

    op(LOW,"#channel_name","nick");

  2. "deop" command

    Definition:

    Gives -o flag to user

    Syntax for procedure:

    deop HIGH "#channel_name" "nick"

    Syntax for function:

    deop(HIGH,"#channel_name","nick");

  3. "voice" command

    Definition:

    Gives +v flag to user

    Syntax for procedure:

    voice LOW "#channel_name" "nick"

    Syntax for function:

    voice(LOW,"#channel_name","nick");

  4. "devoice" command

    Gives -v flag to user

    Syntax for procedure:

    devoice HIGH "#channel_name" "nick"

    Syntax for function:

    devoice(HIGH,"#channel_name","nick");

  5. "kick" command

    Definition:

    Kicks user away from channel

    Syntax for procedure:

    kick "#channel_name" "nick" "reason"

    Syntax for function:

    kick(HIGH,"#channel_name","nick","reason");

    NB: function equivalent has priority as first argument.

  6. "msg" command

    Definition:

    Sends user message as private message

    Syntax for procedure:

    msg LOW "nick" "message for you is here!"

    msg LOW "#channel" "message for the channel!"

    Syntax for function:

    msg(LOW,"nick","message for you is here!");

    msg(LOW,"#channel","message for the channel!");

  7. "msgq" command

    Definition:

    Sends quoted message (message will begin and end with 0x01 character)

    Syntax for procedure:

    msgq LOW "nick" "" "ACTION says hello!"

    Syntax for function:

    msgq(LOW,"nick","","ACTION says hello!");

    So the result will be like:

    PRIVMSG nick :<0x01>ACTION says hello!<0x01>

    Note: If there is not an empty string for third parameter, you should add to end of second parameter a SPACE before ending quote, because second and third parameters will be concatenated together, but in between them there will be 0x01 character.

  8. "if_match" command

    Definition:

    Compares two strings or variables (case sensitive), if they are the same, executes next block in "{" brackets, if not, skips next block.

    Syntax for procedure:

    if_match $some_variable "check for this string"
    {
       msg LOW "nick" "Strings ARE the same!"
    }

    Syntax for function:

    if($some_variable===$some_variable "check for this string")

  9. "!if_match" command

    Definition:

    Compares two strings or variables (case sensitive), if they are NOT the same, executes next block in "{" brackets, if yes, skips next block.

    Syntax for procedure:

    !if_match $some_variable "check for this string"
    {
       msg LOW "nick" "Strings are NOT the same!"
    }

    Syntax for function:

    if($some_variable!==$some_variable "check for this string")

  10. "if_match_case_insensitive" command

    Definition:

    Compares two strings or variables (case insensitive), if they are the same, executes next block in "{" brackets, if not, skips next block.

    Syntax for procedure:

    if_match_case_insensitive $some_variable "check for this string"
    {
       msg LOW "nick" "Strings ARE the same! (case insensitive comparsion)"
    }

    Syntax for function:

    if(strtolower($some_variable)===strtolower("check for this string"))

  11. "!if_match_case_insensitive" command

    Definition:

    Compares two strings or variables (case insensitive), if they are NOT the same, executes next block in "{" brackets, if yes, skips next block.

    Syntax:

    !if_match_case_insensitive $some_variable "check for this string"
    {
       msg LOW "nick" "Strings are NOT the same! (case insensitive comparsion)"
    }

    Syntax for function:

    if(strtolower($some_variable)!==strtolower("check for this string"))

  12. "if_in" command

    Definition:

    Scans if string as second parameter is a part of string as first parameter

    Syntax for procedure:

    if_in $some_variable "some"
    {
       msg LOW "nick" "String ".$some_variable." contains string \"some\""
    }

    Syntax for function:

    if(strpos($some_variable,"some")!==FALSE)

  13. "!if_in" command

    Definition:

    Scans if string as second parameter is NOT a part of string as first parameter

    Syntax for procedure:

    !if_in $some_variable "some"
    {
       msg LOW "nick" "String ".$some_variable." does NOT contain string \"some\""
    }

    Syntax for function:

    if(strpos($some_variable,"some")===FALSE)
  14. "if_group" command

    Definition:

    Checks if object named as first parameter is member of group specified in the second parameter.

    Syntax for procedure:

    if_group $some_user "group_of_super_users"
    {
       msg LOW "nick" $some_user." is member of group group_of_super_users!"
    }

    Syntax for function:

    in_group($some_user,"my_group")

    returns TRUE if user is in that group)
  15. "!if_group" command

    Definition:

    Checks if object named as first parameter is NOT member of group specified in the second parameter.

    Syntax procedure:

    !if_group $some_user "group_of_super_users"
    {
       msg LOW "nick" $some_user." is NOT member of group group_of_super_users!"
    }

    Syntax for function:

    in_group($some_user,"my_group")

    returns TRUE if user is in that group)
  16. "return" command

    Definition:

    Returns from procedure (terminates the execution of procedure).

    Syntax for procedure:

    return

    Syntax for function:

    return;

    return "foo";

  17. "timer_once" command

    Definition:

    Sets a timer, and when specified time elapses, executes specified procedure, and then deletes a timer (executes it only once).

    Syntax for procedure:

    timer_once "name_of_timer" 0:00:05:00 unbanproc($channel,"*!".$ident."@".$host,$source_nick)

    Syntax for function:

    timer_once("name_of_timer","0:00:05:00")
        unbanproc($channel,"*!".$ident."@".$host,$source_nick);

    "0:00:05:00" means that timer executes procedure "unbanproc" after 0 days, 00 hours, 05 minutes and 00 seconds.

  18. "timer_every" command

    Definition:

    Sets a timer, and when specified time elapses, executes specified procedure, and then resets time counter, and when time elapses again, it again executes a procedure. It doesn't deletes a timer.

    Syntax for procedure:

    timer_every "name_of_timer" 0:00:05:00 msg_to_user($nick,"Once again, 5 minutes has elapsed")

    Syntax for function:

    timer_every("name_of_timer","0:00:05:00")
        msg_to_user($nick,"Once again, 5 minutes has elapsed");

    "0:00:05:00" means that timer executes procedure "msg_to_proc" after 0 days, 00 hours, 05 minutes and 00 seconds.

  19. "execute" command

    Definition:

    Calls a procedure/function.

    Syntax for procedure:

    execute some_procedure($parameter1,"parameter #2")

    Syntax for function:

    some_procedure($parameter1,"parameter #2");

  20. "SMTP" command

    Definition:

    Sends an e-mail.

    Syntax for procedure:

    SMTP
    {
        server "mail.somehost.org"
        port 25
        HELO "somehost.org"
        MAIL_FROM "MyBot@somehost.org"
        RCPT_TO "your_eamil@somehost.org"
        DATA
        From: My Bot <MyBot@somehost.org>
        To: VooDoo cIRCle administrator <your_email@somehost.org>
        Subject: WARNING!
        -
        $nick has de-opped me on channel $channel !!!
        .
    }

    Syntax for function:

    smtp_raw1($local_ip,$server_host,$port,$helo_string,$mail_from,$rcpt_to,$data,...);

    Example

      smtp_raw1("0.0.0.0","mail.somehost.org",25,"somehost.org","test@somehost.org",
          "recipient@somehost.org","Subject: Test","","hello, this is e-mail",".");

    Starting from argument $data, there can be any number of arguments, bot places \r\n between each. Do not forget to include an empty string in $data, indicating to SMTP server separator from message headers and body. Also, the last arguments is dot on sigle line indicating to SMTP server end of message.

    Note: See RFC 2821 (Simple Mail Transfer Protocol).

  21. "NET_SEND" command (Windows NT only!)

    Definition:

    Sends an administrator message.

    Syntax for procedure:

    NET_SEND "127.0.0.1" "BOT WARNING! Check your e-mail messages!"

    or:

    NET_SEND "your_computer_name" "BOT WARNING! Check your e-mail messages!"
    

    Syntax for function:

    net_send("127.0.0.1","hello!");

  22. "LOG" command / "log_print" function

    Definition:

    Writes a message to the log (core module: file "logs/debug.log"; other modules: file "logs/<module_name>.log" in module's directory)

    Syntax for procedure:

    LOG "There is a log message"

    Syntax for function:

    log_print("Log message");

  23. "join" command

    Definition:

    Joins a channel.

    Syntax for procedure:

    join "#your_channel"
    join "#your_channel" "key"

    Syntax for function:

    join("#your_channel");
    join("#your_channel","key");
  24. "part" command

    Definition:

    Parts a channel.

    Syntax for procedure:

    part $channel_name $reason

    Syntax for function:

    part($channel_name,$reason);
  25. "disconnect" command

    Definition:

    Disconnects from IRC server (should be called before connection commands)

    Syntax:

    disconnect
  26. "irc_server" command
    Definition:

    Adds a server and port for later "try_connect" command

    Syntax for procedure:

    irc_server "irc.host.org" 6667
    irc_server "irc2.host.org" 6667

    Syntax for function:

    irc_server("irc.host.org",6667);

    Note: Since version 1.0.57 this command is obsolete, and you can use it only for IPv4 IRC servers.

  27. "irc_server_ex" command
    Definition:

    Adds a server and port for later "try_connect" command

    Syntax for procedure:

    irc_server_ex "" "0.0.0.0" "irc.host.org" 6667
    irc_server_ex "" "::" "irc.host.org" 6667
    irc_server_ex "@irc_ssl=irc.somedomain.org@" "0.0.0.0" "irc.somedomain.org" 6697
    

    Syntax for function:

    irc_server("","0.0.0.0","irc.host.org",6667);
    irc_server("","::","irc.host.org",6667);
    irc_server("@irc_ssl=irc.somedomain.org@","0.0.0.0","irc.somedomain.org",6697);
    

    First argument contains flags about connection. Currently supported is in format as shown above, it uses SSL. If it is empty, normal unencrypted IRC protocol will be used. Note that you need to add SSL certificate of IRC server to trusted CAs list. In this case, section "[irc_ssl=irc.somedomain.org]" will be used from file "ssl.txt". See "ssl.txt" file documentation.

    Second argument is local IP address to bind to (use "0.0.0.0" for all local IPv4 addresses, "::" for all local IPv6 addresses - if you don't know which to use, or your local host address is DHCP-assigned), third is remote IP address/host, and last one is port number.
    Note: You can specify here also IPv6 host or address; on Win32 works only if bot was compiled with IPv6 support, on non-Win32 should work if kernel allow it (e.g. is compiled with IPv6 support).
    Note: If your procedure contains this command, it will not be replicated to remote bots version 1.0.56 and below, that is BOTNET protocol version 12 and below for compatibility reasons, since this command appeared in version 1.0.57.

    Note: For functions, there is "irc_server()" built-in function with 4 arguments as its procedure's "irc_server_ex" equivalent.

  28. "try_connect" and "if_error" command sequence
    Definition:

    Tries to connect to IRC server, with values and order given by "irc_server" command, and moves server list iterator to the next server / port.

    Syntax for procedure:

    label again
    try_connect
    if_error
    {
       sleep 10
       goto again
    }

    Syntax for function:

    again:
    try_connect();
    if_error() {
       sleep(10);
       goto again;
    }
    Notes: this sequence tries to connect to IRC server, if an error occurred, it waits 10 seconds and jumps to label again (see "goto" and "label" commands)

  29. "bot_nick" command

    Definition:

    Sets the nick name of bot (you can define multiple nicks, for case that nick is taken over)

    Syntax for procedure:

    bot_nick "MyBot"
    bot_nick "MyBot2"

    Syntax for function:

    bot_nick("MyBot","MyBot2");

    In function, there can be more than one argument, to set many nicks at once.

  30. "bot_ident" command

    Definition:

    Sets the bot's ident name. When the bot is connecting to IRC server, it enables the IDENT server (for IPv4 network), and after successful reply to ident request it shuts it down.

    Syntax for procedure:

    bot_ident "MyBotRulez"

    Syntax for function:

    bot_ident(4,$local_ip,"MyBotRulez");
    Note:
    You should use this command to make bot know what to say to IRC server in USER command, even if your ISP or system is already running IDENT daemon. To disable internal ident daemon emulation use parameter "disable_ident_daemon" in file conf.txt. If this command is not present, bot takes current nick, converts it to lowercase and removes non-alphabet characters.
  31. "bot_ident_ipv6" command

    Definition:

    Sets the bot's ident name. When the bot is connecting to IRC server, it enables the IDENT server (for IPv6 network), and after successful reply to ident request it shuts it down. Should be omited if OS has its own IDENT daemon.

    Syntax for procedure:

    bot_ident_ipv6 "MyBotRulez"

    Syntax for function:

    bot_ident(6,$local_ip,"MyBotRulez");
    Note:
    If your procedure contains this command, the whole procedure will not be replicated to bot of version <1.0.18, that is BOTNET protocol <4, for compatibility reasons, since this command was introduced in version 1.0.18.
    Note:
    You should use this command to make bot know what to say to IRC server in USER command, even if your ISP or system is already running IDENT daemon. To disable internal ident daemon emulation use parameter "disable_ident_daemon" in file conf.txt. If this command is not present, bot takes current nick, converts it to lowercase and removes non-alphabet characters.

  32. "bot_fullname" command

    Definition:

    Sets the full name of the bot.

    Syntax for procedure:

    bot_fullname "This is a VooDoo cIRCle bot! GNU rulez!"

    Syntax for function:

    bot_fullname("This is a VooDoo cIRCle bot! GNU rulez!");
  33. "bot_auth" command

    Definition:

    Sends authentication to IRC server.

    Syntax for procedure:

    label again
    disconnect
    bot_nick "MyBot"
    bot_nick "MyBot2"
    bot_ident "MyBotRulez"
    bot_fullname "This is a VooDoo cIRCle bot! GNU rulez!"
    bot_auth
    wait_if_error
    {
       disconnect
       sleep 60
       goto again
    }
    

    Syntax for function:

    again:
    disconnect();
    bot_nick("MyBot");
    bot_nick("MyBot2");
    bot_ident(4,"0.0.0.0","MyBotRulez");
    bot_ident(6,"::","MyBotRulez");
    bot_fullname("This is a VooDoo cIRCle bot! GNU rulez!");
    bot_auth();
    wait_if_error()
    {
       disconnect();
       sleep(60);
       goto again;
    }
    
  34. "allow_redirect" command

    Definition:

    Allows bot to use different server, if the IRC server is overloaded and sends on connect message saying "I am overloaded, so use this server/port instead"

    Syntax for procedure:

    allow_redirect 1

    Syntax for function:

    allow_redirect(1);
  35. "sleep" command

    Definition:

    Waits (do nothing) for specified time

    Syntax for procedure:

    sleep 30

    Syntax for function:

    sleep(30);

    Note: this exaple waits 30 seconds

  36. "restart" command

    Definition:

    Bot exites with return code 2 (two), which means for parent process that bot wants to restart itself.

    Syntax for procedure:

    restart

    Syntax for function:

    restart();
  37. "notice" command

    Definition:

    Send a notice message to specified nick

    Syntax for procedure:

    notice LOW "nick" "This is a notice!"

    Syntax for function:

    notice(LOW,"nick","This is a notice!");
  38. "noticeq" command

    Definition:

    Sends quoted notice (message will begin and end with 0x01 character)

    Syntax for procedure:

    noitceq LOW "nick" "" "VERSION VooDoo_cIRCle"

    Syntax for function:

    noitceq(LOW,"nick","","VERSION VooDoo_cIRCle");

    So the result will be like:

    NOTICE nick :<0x01>VERSION VooDoo_cIRCle<0x01>

    Note: If there is not an empty string for second parameter, you should add to end of second parameter a SPACE before ending quote, because second and third parameters will be concatenated together, but in between them there will be 0x01 character.

  39. "unban_mask" command

    Definition:

    Removes a ban mask (-b)

    Syntax for procedure:

    unban_mask $channel "*!*@*.org"

    Syntax for function:

    unban_mask(LOW,$channel,"*!*@*.org");

    NB: function equivalent has priority as first argument.

  40. "ban_mask" command

    Definition:

    Sets a ban mask (+b)

    Syntax for procedure:

    ban_mask $channel "*!*@*.org"

    Syntax for function:

    ban_mask(LOW,$channel,"*!*@*.org");

    NB: function equivalent has priority as first argument.

  41. "dcc_server" command

    Definition:

    Binds to specified IPv4 address and port, and listens on that port for DCC clients

    Syntax for procedure:

    dcc_server 0 "10.0.0.1" 2010 type

    Notes: the first parameter (here is it zero) means that this is DCC server group zero. If it is zero, the dcc connection to bot can be established by sending "dcc" or "dcc 0" message to query of the bot. If it is, for example "1" (one), this DCC server will be accessible by sending "dcc 1" to query of the bot. You can specify more than one DCC server (each with different group number). For example one for WAN clients, and one for LAN clients, which resolves some proxy/firewall limitation issues.

    "type" means type of DCC server. This parameter is optional. It can have values "chat" or "send". If it is a "chat", this DCC server is for chatting with bot, or when it is "send", it is for sending files. This is support for mIRC protocol, for commands /dcc chat IP_address:port

    Example:

    dcc_server 0 "10.0.0.1" 2010
    dcc_server 1 "127.0.0.1" 2011 chat
    dcc_server 2 "127.0.0.1" 2012 send
     

    For some firewall issues, you can use this configuration, and connect to DCC CHAT or DCC SEND with mIRC by these commands:

    /dcc chat 127.0.0.1:2011

    /dcc send 127.0.0.1:2012

    Note, that you need to set property key "127.0.0.1_dcc_user" in file "conf.txt", thus bot knows who is the one who connecting with loop-back IP address (still the password is required; see property dcc_always_want_nick)..

    Syntax for function:

    dcc_server(4,0,"10.0.0.1",2010);
    dcc_server(4,0,"10.0.0.1",2011,"chat");
    

    There is extra first argument indicating IPv4 protocol version.

    Note: When there is an empty string as bind IP (second argument for procedure version, third for function version), it will be bound dynamically, when we get our host from IRC server (via self-WHOIS) resolved to IP address. This works currently for IPv4 only. It can be useful for DHCP-assigned IPv4 address. When resulting IP address will change, then server socket is re-bound to new address.

  42. "dcc_server_ipv6" command

    Definition:

    Binds to specified IPv6 address and port, and listens on that port for DCC clients

    Syntax procedure:

    dcc_server_ipv6 0 "fe80::210:a7ff:fe28:8b4d%5" 2013 type

    (see "dcc_server" command)

  43. "if_error" command

    (see "try_connect" command)

  44. "label" command

    Definition:

    Label checkpoint for "goto" command. In case of procedure (not function), it must be written BEFORE "goto" command.

    Syntax for procedure:

    label jump_here

    Syntax for function:

    jump_here:
  45. "goto" command

    Definition:

    Jumps to specified "label". Must be AFTER "label" command.

    Syntax for procedure:

    label jump_here
    ...
    goto jump_here

    Syntax for function:

    jump_here:
    ...
    goto jump_here;
  46. "ident" command

    Definition:

    Returns ident name of specified nick

    Syntax for procedure:

    $ident=ident $source_nick

    Syntax for function:

    $ident=ident($source_nick);
    Note: this command sets variable "$ident" to ident name of nick in "$source_nick" variable

  47. "host" command

    Definition:

    Returns host name of specified nick

    Syntax for procedure:

    $host=host $source_nick

    Syntax for function:

    $host=host($source_nick);

    Note: this command sets variable "$host" to host name of nick in "$source_nick" variable

  48. "SCRIPT" command

    Definition:

    Executes an external script. Currently is supported only PHP and perl.

    Syntax for procedure:

    SCRIPT "php" 1 $channel ($source_nick,$msg)
    SCRIPT "php_2" 3 $channel ($source_nick,$msg)
    SCRIPT "php_2@noremove" 4 $channel ($source_nick,$msg)
    SCRIPT "perl" 10 $channel ($source_nick,$msg)
      

    Syntax for function:

    script("php",1,$channel,$source_nick,$msg);
    script("php_2",3,$channel);
    script("php_2@noremove",4,$channel);
    script("perl",10,$channel,$source_nick,$msg);
      

    Note: The first parameter is type of script (must be "php" or "php_2" or "perl"). Second parameter is number of script in "conf.txt" file. Third parameter is name of channel to pass to script, and rest are parameters for that script. In case of function, first three arguments are mandatory, the rest are arguments for script.

    As of version 1.1.beta11.pl6, there can be flag "noremove" (list of flags follows after '@' sign), meaning that temporary file for script output will not be removed, which can be useful for debugging your scripts. Note that procedure/function containing this flag should not be replicated to older versions of bot in order to work properly (compatibility).

    See sections PHP scripting (old method), PHP scripting ("php_2" method), and PERL scripting.

  49. "telnet_server" command

    Definition:

    Binds to specified IPv4 address and port, to listen for telnet users and other bots in the botnet.

    Syntax for procedure:

    telnet_server "10.0.0.1" 4444

    Syntax for function:

    telnet_server(4,"10.0.0.1",4444);

    Note: When there is an empty string as bind IP (first argument for procedure version, second for function version), it will be bound dynamically, when we get our host from IRC server (via self-WHOIS) resolved to IP address. This works currently for IPv4 only. It can be useful for DHCP-assigned IPv4 address. When resulting IP address will change, then server socket is re-bound to new address.

  50. "telnet_server_ipv6" command

    Definition:

    Binds to specified IPv6 address and port, to listen for telnet users and other bots in the botnet.

    Syntax for procedure:

    telnet_server_ipv6 "::1" 4444

    Syntax for function:

    telnet_server(6,"::1",4444);

    Note: When there is an empty string as bind IP (first argument for procedure version, second for function version), it will be bound dynamically, when we get our host from IRC server (via self-WHOIS) resolved to IP address. This works currently for IPv4 only. It can be useful for DHCP-assigned IPv4 address. When resulting IP address will change, then server socket is re-bound to new address.

  51. "link" command

    Definition:

    Links to another bot on the botnet.

    Syntax for procedure:

    link telnet "other_bot" "0.0.0.0" "10.0.0.1" 6666 bot_unlinked("other_bot")
    link telnet_ssl "other_bot" "0.0.0.0" "10.0.0.1" 6666 bot_unlinked("other_bot")
    link ssl "other_bot" "0.0.0.0" "10.0.0.1" 6666 bot_unlinked("other_bot")

    Note: The first parameter is type of connection (currently only "telnet" and "telnet_ssl" connection are supported) describes if to use plain binary telnet connection, or encapsulated in SSL tunnel. Note that for SSL connection, the other bot should have properly configured the certificate chain to use (see "ssl.txt"). Second parameter is name of remote bot (as in "logic.txt"). The third parameter is local IPv4 address to bind to. Fourth parameter is remote address for other bot. Fifth parameter is remote port. And last parameter is function to call when bot connection will be broken (this is useful to call "link" command in this procedure)

    Syntax for function:

    link(4,"telnet","other_bot","0.0.0.0","10.0.0.1",6666,"bot_unlinked(\"other_bot\")");
    link(6,"telnet_ssl","other_bot","::","someipv6host.org",6666,"bot_unlinked(\"other_bot\")");
    link(4,"ssl","other_bot","0.0.0.0","host.org",6666,"bot_unlinked(\"other_bot\")");

    There is extra first argument in front of all, indicating IP version (4/6). If there is zero (or in case of procedure), it will be guessed (if host contains ":" then IPv6, else IPv4), but don't rely on this.

    See section ssl.txt.

  52. "work" command

    Definition:

    After successful connect and authentication on IRC server, you should use this command. When connection to IRC server will be broken, bot will continue execution after this command.

    Syntax for procedure:

    work

    Syntax for function:

    work();
  53. "chan_mode" command

    Definition:

    Changes the mode of channel.

    Syntax:

    chan_mode LOW "#your_channel" "+tn"
  54. "change_nick" command

    Definition:

    Changes the nick of the bot.

    Syntax for procedure:

    change_nick "MyBot"
    change_nick $nick

    Syntax for function:

    change_nick("MyBot");
    change_nick($nick);
  55. "kill_timers" command

    Definition:

    Kills all timers that matches the mask by their name, so they won't be called anymore, until they are defined again.

    Syntax for procedure:

    kill_timers "timer_*"
    kill_timers "timer_1"

    Syntax for function:

    kill_timers("timer_*");
    kill_timers("timer_1");
  56. "get_chan_mode" command

    Definition:

    Returns channel mode of specified channel

    Syntax for procedure:

    $mode=get_chan_mode $channel

    Syntax for function:

    $mode=get_chan_mode($channel);

    Note: this command sets variable "$mode" to channel mode of channel in "$channel" variable (e.g. "nt",...)

  57. "get_chan_topic" command

    Definition:

    Returns channel topic of specified channel

    Syntax for procedure:

    $topic=get_chan_topic $channel

    Syntax for function:

    $topic=get_chan_topic($channel);

    Note: this command sets variable "$topic" to channel topic of channel in "$channel" variable (e.g. "There is a topic!", or an empty string for no topic)

  58. "topic" command

    Definition:

    Sets a new topic for channel

    Syntax for procedure:

    topic $channel "A new topic!"

    Syntax for function:

    topic(LOW,$channel,"A new topic!");

    NB: function equivalent has priority as first argument.

  59. "check_dynamic_bans" command

    Definition:

    Checks if there's an entry for dynamic ban

    Syntax for procedure:

    $match=check_dynamic_bans $channel $nick $reason

    Syntax for function:

    $match=check_dynamic_bans($channel,$nick);
    $match=check_dynamic_bans($channel,$nick,$reason);
    

    Notes:

    Above command checks for dynamic ban entry on given channel and user on that channel with given nick, if there's an entry, it sets $match variable to "1", if not to "0". Also if there's a match, it sets variable $reason to dynamic ban's reason. In function, $reason argument is optional. This command/function performs delayed DNS lookup if needed. If DNS lookup was scheduled, $match will contain also "2" character, and should be called again later (via timers), for example 5 seconds later.

    Future compatibility note:

    For testing return value ($match here), use:

    if_in $match "1"

    Or, for function:

    if(strpos($match,"1")!==FALSE)

    Recommended usage for procedure:

    procedure xxx($channel,$user,$nick,$dynamic1,$dynamic2,$passive)
    {
        $match=check_dynamic_bans $channel $nick $reason
        if_in $match "2"
        {
            rem "call this procedure with same arguments later"
            timer_once "dynamic ban check" 0:00:00:05 xxx($channel,$user,$nick,$dynamic1,$dynamic2,$passive)
            return
        }
        if_in $match "1"
        {
            $ident=ident $nick
            $host=host $nick
            deop_ban_mask CRITICAL $channel $nick "*!".$ident."@".$host
            kick $channel $nick $reason
        }
    }
    

    Recommended usage for function:

    function xxx($channel,$user,$nick,$dynamic1,$dynamic2,$passive)
    {
        $match=check_dynamic_bans($channel,$nick,$reason);
        if(strpos($match,"2")!==FALSE) {
            // call this procedure with same arguments later
            timer_once("dynamic ban check","0:00:00:05")
                xxx($channel,$user,$nick,$dynamic1,$dynamic2,$passive);
            return;
        }
        if(strpos($match,"1")!==FALSE) {
            $ident=ident($nick);
            $host=host($nick);
            deop_ban_mask(CRITICAL,$channel,$nick,"*!".$ident."@".$host);
            kick(CRITICAL,$channel,$nick,$reason);
        }
    }
    
  60. "dynamic_ban" command

    Definiton:

    Sets a dynamic ban entry

    Syntax for procedure:

    dynamic_ban $channel $prefix $ban_mask $reason

    Syntax for function:

    dynamic_ban($channel,$prefix,$ban_mask,$reason);

    Note: argument "$prefix" can only be "+" to set dynamic ban, or "-" to remove dynamic ban.

    For function, $reason argument is optional. If omited, an empty string will be used.

  61. "process_on_banned" command

    Definition:

    Forces bot to process "on_banned" events if it finds out that some user(s) is banned. Useful to call after "ban_mask" command (see notes below).

    Syntax for procedure:

    process_on_banned $channel $nick."!".$ident."@".$host

    Syntax for function:

    process_on_banned($channel,$nick."!".$ident."@".$host);

    Notes:

    Do not call this command directly after "ban_mask" command, because bot has queue for commands to IRC server. Every command is placed there, and it waits for incoming "MODE" command from server as confirmation that ban was set. It can be useful call a procedure with this command approximately 5 seconds after command "ban_mask":

    procedure process_banned($channel,$mask)
    {
        process_on_banned $channel $mask
    }
    ...
        $ident=ident $nick
        $host=host $nick
        ban_mask $channel $nick."!".$ident."@".$host
        kick $channel $nick $reason
    timer_once "process_banned" 0:00:00:10 process_banned($channel,$nick."!".$ident."@".$host)
  62. "raw" command

    Definition:

    Send raw command to IRC server.

    Syntax for procedure:

    raw HIGH "MODE ".$channel." +h someone"
    raw LOW "PRIVMSG ".$channel." :I have set mode +h to someone!"
    raw CRITICAL "KICK ".$channel." ".$nick." :Go away!"
    

    Syntax for function:

    raw(HIGH,"MODE ".$channel." +h someone");
    raw(LOW,"PRIVMSG ".$channel." :I have set mode +h to someone!");
    raw(CRITICAL,"KICK ".$channel." ".$nick." :Go away!");
    

    Notes:

    If your procedure contains this command, the whole procedure will not be replicated to bot of version <1.0.10, that is BOTNET protocol <2, for compatibility reasons, since this command was introduced in version 1.0.10.

    Use "CRITICAL" priority at your own risk, because message with this priority class is sent immediately to server. See notes about priorities at beginning of section.

  63. "remote_execute" command

    Definition:

    Calls a procedure stored on remote bot on BOTNET.

    Syntax for procedure:

    $result=remote_execute "botname" some_procedure($parameter1,"parameter #2")

    Syntax for function:

    $result=remote_execute("botname","some_procedure",$parameter1,"parameter #2");
    Notes: This executes above procedure on bot named "botname". In the variable "$result" there will be stored string saying if it was successful. NOTE! You should test this string with command:
    if_in $result "something"
    (or "!if_in")
    in case of function
    if(strpos($result,"something")!==FALSE)
    because of future compatibility, since there could be more flags. In the above example the "something" could be one of following:
    "@not_linked@" - this means that bot (as above named "botname") is not linked at the moment, so it has failed.
    "@remote_not_supported@ " - this means that another bot is VooDoo cIRCle version < 1.0.14, that is BOTNET protocol version < 3, so it doesn't support to call procedures remotely.
    "@args_too_long@" - this means that you have exceeded number of bytes in the arguments of your call. There is limit approximatelly 63 kilobytes (i.e. 64512 characters as for string arguments).
    "@ok@" - this means that remote procdure call packet has been successfully sent.

    NOTE: Even if it returns "@ok@" it doesn't mean that procedure on remote side has been executed. This is unreliable, because that procedure on remote side MUST be allowed for source bot to be executed (flag "remote_bot_call", see command ".rproc" on DCC/telnet connection). Also the packet may not be delivered due to error on network.

    Example of procedure that could be called from bot named "abc" remotely:
    procedure test($channel,$what)
    {
        last_changed 0
        remote_bot_call abc
        msg LOW $channel $what
    }

    If your procedure contains this command, the whole procedure will not be replicated to bot of version <1.0.14, that is BOTNET protocol < 3, for compatibility reasons, since this command was introduced in version 1.0.14.
    Example of function that could be called from bot named "abc" remotely:
    function test($channel,$what)
    {
    #last_changed 0
    #remote_bot_call abc
        msg(LOW,$channel,$what);
    }

    Since version 1.1.beta9, you can also remotely call procedure/function of specific module on remote bot (if that module is loaded). Use this syntax:
    $result=remote_execute("botname","my_module::some_procedure",$parameter1,"parameter #2");
    Where "my_module" is module name on remote bot. Of course, your bot needs to have proper "remote_bot_call" attribute set on remote side on particular procedure/function.

  64. "delete_irc_servers" command

    Definition:

    Erases server mask from irc server list. It is good to re-initialize list of servers before chunk of commands "irc_server".

    Syntax for procedure:

    delete_irc_servers "*"
    delete_irc_servers "[*.org]:*"
    delete_irc_servers "[irc.non-existing-domain.org]:6667"

    Syntax for function:

    delete_irc_servers("*");
    delete_irc_servers("[*.org]:*","[irc.non-existing-domain.org]:6667");

    Note: Domain/IP of server must be enclosed in "[]" and port is defined after ":". In case of "*", it matches all possible combinations - so each.

    Note: If your procedure contains this command, the whole procedure will not be replicated to bot of version <1.0.24, that is BOTNET protocol < 6, for compatibility reasons, since this command was introduced in version 1.0.24.

    Note: Function equivalent can have more arguments (more masks at once).

  65. "delete_nicks" command

    Definition:

    Erases bot's nick mask from nick list. It is good to re-initialize list of servers before chunk commands "bot_nick".

    Syntax for procedure:

    delete_nicks "*"
    delete_nicks "Nick*"

    Syntax for function:

    delete_nicks("*");
    delete_nicks("Nick*");

    Note: If your procedure contains this command, the whole procedure will not be replicated to bot of version <1.0.24, that is BOTNET protocol < 6, for compatibility reasons, since this command was introduced in version 1.0.24.

    Note: Function equivalent can have more arguments (more masks at once).

  66. "admin_msg" command

    Definition:

    Sends an administrative message to local users, or to users on other connected bots (a message to DCC/telnet connections).

    Syntax for procedure:

    admin_msg "@telnet@" "Voo*Man" "Hello!"
    admin_msg "@telnet@" "*" "Bot is going down in 5 minutes for maintenance."
    admin_msg "@telnet@" "VooDooMan@*" "Hello VooDooMan on all connected bots!"
    admin_msg "@telnet@" "*@*" "Bot will be delinked and go down in 5 minutes."

    Syntax for function:

    admin_msg("@telnet@","Voo*Man","Hello!");
    admin_msg("@telnet@","*","Bot is going down in 5 minutes for maintenance.");
    admin_msg("@telnet@","VooDooMan@*","Hello VooDooMan on all connected bots!");
    admin_msg("@telnet@","*@*","Bot will be delinked and go down in 5 minutes.");

    Notes:
    The first argument are flags telling where the message will go to, and SHOULD contain sub-string "@telnet@". In the future, there may be also other flags specified, now, others are ignored. If the string doesn't contain "@telnet@", nothing will be done.
    The second argument is mask of users (using wildcards "*", "?", and "#" for one numeric character) to send message to. If they are connected to DCC/telnet connection, they will receive message. If this string contains at-sign ("@"), then follows mask of names of bots to send message to users on those bots. Names of users and bots used to match the specified mask are taken from user's / bot's name as defined in "logic.txt".
    The third argument is the whole message.

    Examples:

    admin_msg "@telnet@" "*" "message here!"
    (will send message to all DCC/telnet-connected users, but LOCALLY connected, because here is missing "@" character.)

    admin_msg "@telnet@" "user*" "message here!"
    (will send message to all DCC/telnet-connected users whose names - as name defined in "logic.txt" - begins with "user", but LOCALLY connected, because here is missing "@" character.)

    admin_msg "@telnet@" "user*@bot2" "message here!"
    (will send message to all DCC/telnet-connected users whose names - as name defined in "logic.txt" - begins with "user", but only those connected to bot named "bot2" - as in file "logic.txt". This requires bot "bot2" to be currently linked.)

    admin_msg "@telnet@" "*@*" "message here!"
    (will send message to all DCC/telnet-connected users on all connected bots.)

    Note: The message will receive also user(s) who is connected to DCC/telnet connection, but it is not required them to be on any partyline channel.

    Note: The message to other bot(s) is forwarded between all linked bots on all the BOTNET, and on remote bot it is passed to all linked bots on its side, to provide propagation of the message, but message is processed (e.g. sent to users) on one bot only if that bot's name matches bot name mask (which is following to at-sign in second argument).

    Note (compatibility): If your procedure contains this command, the whole procedure will not be replicated to bot of version <1.0.50, that is BOTNET protocol < 10, for compatibility reasons, since this command was introduced in version 1.0.50.

    Note (compatibility): Bot of version < 1.0.50 will also forward messages to other bots, but will not process it (e.g. will not show it to its locally-connected users).

    Good tip. Administrators of multiple linked bot(s) will find useful this procedure:
    set on this procedure right "access_usage_procedure" to yourself, and then use this commands on DCC/telnet connection:

    .execute shutdown()
    This example will produce message similar to this on locally connected users:

    *** ADMIN MESSAGE on Wed Jun 29 09:51:32 2005 received from bot (this local bot) sent to *: Bot will be restarted for maintenance, you will need to re-establish your DCC/telnet connection.

    and on other linked bots:

    *** ADMIN MESSAGE on Wed Jun 29 09:51:32 2005 received from bot your_bot_name_here sent to *@*: Bot will be de-linked for maintenance.

    This will inform users on partyline channels that something unusual will happen, to not to worry and not to spam you with messages on IRC saying "hey! why users connected to your bot has left our partyline channel, saying that botnet-split occurred?!?! what are you doing with that bot?!".
  67. "rem" command

    Definition:

    Bot ignores this command. It is intended for remarks.

    Syntax for procedure:

    rem "Hello World! This procedure sucks!"

    Syntax for function:

    rem("Hello World! This function sucks!");
    rem();
    rem("hello",$world);
    

    Notes:

    Note (compatibility): If your procedure contains this command, the whole procedure will not be replicated to bot of version <1.0.54, that is BOTNET protocol < 12, for compatibility reasons, since this command was introduced in version 1.0.54.

    The function equivalent can have any number of arguments, but, for faster processing, you should use comments like this:

    /* comment here */
    $x=y; // here is comment to the end of line
    $x= /* comment */ $x /* comment */ +1;
    
  68. "eval" command

    Definition:

    Evaluates function-like expression against local variables

    Syntax for procedure:

    $result=eval "\$x*=2; return \$x;"

    Syntax for function:

    $result=eval("\$x*=2; return \$x;");

    Evaluates expression. Result can be catched by "return" statement in expression, like in PHP. It is implemented by creation of temporary function with body taken from argument.

  69. "explode" function

    Definition:

    Splits string into array

    Syntax for function:

    $ar=explode($separator,$string,$limit);

    Splits $string into $ar, around $separator. $limit argument is optional. It specifies maximum limit for number of elements in new result array, should be one, or more, no negative value.

  70. "ord" function

    Definition:

    Converts first character of string into ordinal number.

    Syntax for function:

    $num=ord("a");
  71. "bind" command

    Definition:

    Binds function to event

    Syntax for procedure:

    bind $type_mask $user_mask $channel_mask $line_mask $before $func_name

    Use '0' for $before argument for FALSE, or '1' for TRUE (without quotes)

    Syntax for function:

    bind($type_mask,$user_mask,$channel_mask,$line_mask,$before,$func_name);

    (see modules section)

    Note: Command is processed after short delay.

    Remember that all fields have to match to call event, as well as "$before" boolean field.

  72. "unbind" command

    Definition:

    Unbinds function to event

    Syntax for procedure:

    unbind $type_mask $user_mask $channel_mask $line_mask $before $func_name
    Use '0' for $before argument for FALSE, or '1' for TRUE (without quotes)

    Syntax for function:

    unbind($type_mask,$user_mask,$channel_mask,$line_mask,$before,$func_name);

    (see modules section)

    For successful unbind, it needs very same arguments as passed to "bind" before.

    Note: Command is processed after short delay.

  73. "bind_ex" command

    Definition:

    Binds function to event

    Syntax for procedure:

    bind_ex $type_mask $user_mask $channel_mask $line_mask $before $func_name

    Use '0' for $before argument for FALSE, or '1' for TRUE (without quotes)

    Syntax for function:

    bind_ex($type_mask,$user_mask,$channel_mask,$line_mask,$before,$func_name);

    (see modules section)

    Note: Command is processed after short delay.

    This command/function provides extended matching capabilities. Each mask (except for $before) can have more flags. E.g. "@exact@hello" will match "hello" string case-sensitive. "@exact_ci_ascii@hello" will match "hello" in ASCII case-insensitive mapping. "@exact_ci_rfc@hello" will match "hello" in case-insensitive matching according to RFC for IRC. "@exact_ci_server@hello" will match "hello" in case-insensitive matching in mapping according to server's case mapping has reported (i.e. RFC or ASCII). "@mask@he*o" will match case-sensitive "hello". "@mask@@mask_ci_ascii@h?llo" will match wild-carded mask ("*?#") case-insensitive in ASCII case mapping, "@mask@@mask_ci_rfc@h?LLo" will match wild-carded mask ("*?#") in case-insensitive mask in RFC mapping, "@mask@@mask_ci_server@h?llo" in wild-carded mask ("*?#") in case-insenisitve matter as reported by server (i.e. RFC or ASCII). "@match@@preg@@match_all@@set_order@/hello/" will match "/hello/" pattern with PCRE library, as "preg_match_all()" function. It defaults to "@pattern_order@", however, this is not implemented, so you should always use "@set_order@". "@match@@preg@@match_all@@offset_capture@/hello/" will match "/hello/" pattern with offset capturing, as function "preg_match_all()". It is allowed to enter pattern such as "@offset_capture@/hello/" that will match "/hello/" pattern with PCRE library, however always specify "@exact@" (for exact match), or "@mask@" (for wildcarded match), or "@match@@preg@" / "@match_all@@preg@" for PCRE match, along with other flags, for future compatibility. These 3 cases can be used in one mask exclusively.

    If your pattern begins with '@' sign, you can use "@@" as last flag as an escape, then "@". So it will look like "@mask@@@@*" for "@*" mask.

    If there is match on all arguments, and regexp "@preg@@match@/o/" is used on for instance "$line_mask", for "foobar" array $dispatch["meta"]["line_matches"] looks like this:

    [(INT) 0] => (STRING) "o"

    If "@preg@@match_all@@set_order@" rather than "@match@" used, then array looks like this:

    [(INT) 0] => (ARRAY)
        [(INT) 0] => (STRING) "o"
    [(INT) 1] => (ARRAY)
        [(INT) 0] => (STRING) "o"

    If "@preg@@match_all@@set_order@@offset_capture@" is used, then array looks like this:

    [(INT) 0] => (ARRAY)
        [(INT) 0] => (ARRAY)
            [(INT) 0] => (STRING) "o"
            [(INT) 1] => (INT) 1
    [(INT) 1] => (ARRAY)
        [(INT) 0] => (ARRAY)
            [(INT) 0] => (STRING) "o"
            [(INT) 1] => (INT) 2

    If wildcard match or exact match is used, then this array doens't exist. Remember as in "bind()" command/ function, all fields need to have at least one match to call event, as well as "$before" boolean has to match. Possible arrays in "meta" sub-array when regular expression match is used are:

    $dispatch["meta"]["type_matches"]
    $dispatch["meta"]["user_matches"]
    $dispatch["meta"]["channel_matches"]
    $dispatch["meta"]["line_matches"]

    Compatibility: If your procedure contains this command, it will not be replicated to bots of version less than 1.1.33 (cvs release), that is BOTNET protocol version less than 1009 for compatibility reasons. You should not replicate functions containing this call to such bots.

  74. "unbind_ex" command

    Definition:

    Unbinds function to event

    Syntax for procedure:

    unbind $type_mask $user_mask $channel_mask $line_mask $before $func_name
    Use '0' for $before argument for FALSE, or '1' for TRUE (without quotes)

    Syntax for function:

    unbind($type_mask,$user_mask,$channel_mask,$line_mask,$before,$func_name);

    (see modules section)

    For successful unbind, it needs very same arguments as passed to "bind_ex" before.

    Note: Command is processed after short delay.

    Compatibility: If your procedure contains this command, it will not be replicated to bots of version less than 1.1.33 (cvs release), that is BOTNET protocol version less than 1009 for compatibility reasons. You should not replicate functions containing this call to such bots.

  75. "dispatch" function

    Definition:

    Generates message

    Syntax for function:

    dispatch($type,$user,$channel,$line,$meta);

    (see modules section)

    Note: In $dispatch structure, "$before" parameter is TRUE.

  76. "var_dump" function

    Definition:

    Dumps variable content

    Syntax for function:

    $result_str=var_dump($var);
    log_print($result_str);
    

    Useful for debugging script

  77. "mask_match" function

    Definition:

    Returns TRUE if string matches mask

    Syntax for function:

    $result=mask_match($mask,$what);
  78. "time" function

    Definition:

    Returns current unix time (number of elapsed seconds from 1970-01-01 00:00)

    Syntax for function:

    $result=time();
  79. "strtoupper" function

    Definition:

    Converts ASCII string to upper case

    Syntax for function:

    $result=strtoupper($what);
    $result=strtoupper($what,CASE_SERVER);
    $result=strtoupper($what,CASE_ASCII);
    $result=strtoupper($what,CASE_RFC1459);

    Second optional argument tells which case mapping we should use; CASE_SERVER uses case mapping reported by IRC server, CASE_ASCII (default) uses ASCII mapping, and CASE_RFC1459 is for Scandinavian case mapping used by some IRC servers, where upper case []\^ maps to lower case {}|~.

  80. "strtolower" function

    Definition:

    Converts ASCII string to lower case

    Syntax for function:

    $result=strtolower($what);
    $result=strtolower($what,CASE_SERVER);
    $result=strtolower($what,CASE_ASCII);
    $result=strtolower($what,CASE_RFC1459);

    Second optional argument tells which case mapping we should use; CASE_SERVER uses case mapping reported by IRC server, CASE_ASCII (default) uses ASCII mapping, and CASE_RFC1459 is for Scandinavian case mapping used by some IRC servers, where upper case []\^ maps to lower case {}|~.

  81. "strpos" function

    Definition:

    Finds first occurence of substring in string, or FALSE if nothing found

    Syntax for function:

    $result=strpos($haystack,$needle);
  82. "strlen" function

    Definition:

    Returns length of string

    Syntax for function:

    $result=strlen($str);
  83. "load_module" command

    Definition:

    Loads module

    Syntax for procedure:

    load_module $name

    Syntax for function:

    load_module($name);

    Note: Command is processed after short delay.

  84. "unload_module" command

    Definition:

    Unloads module

    Syntax for procedure:

    unload_module $name

    Syntax for function:

    unload_module($name);

    Note: Command is processed after short delay.

  85. "count" function

    Definition:

    Returns number of elements in array, or one if argument is not an array

    Syntax for function:

    $result=count($ar);
  86. "chr" function

    Definition:

    Converts ASCII code (number) to string with one character

    Syntax for function:

    $result=chr(32);
  87. "get_nick_mode" command

    Definition:

    Gets mode of nick on channel

    Syntax for procedure:

    $mode=get_nick_mode $channel $nick

    Syntax for function:

    $mode=get_nick_mode($channel,$nick);

    Note: If nick has no mode on that channel, it returns "0" (zero) as string. In case of chan-op, we get "@" string. Note, that user can have more modes at once, e.g. "@+".

  88. "get_bot_nick" command

    Definition:

    Returns our current nick

    Syntax for procedure:

    $nick=get_bot_nick

    Syntax for function:

    $nick=get_bot_nick();

    Note: Since version 1.1.beta28, this has been adjusted. If we are only trying to connect to IRC server, or in a deep sleep (by "sleep" command/function), so our nick has not been confirmed by IRC server, the procedure version of this command will return string "0" (since nick "0" is not a valid nick on IRC). Built-in function version will return FALSE value, so check it by something like if($nick!==FALSE) first.

  89. "get_event_id" command

    Definition:

    Returns name of event (in procedure/function which is handler for on_XXX event)

    Syntax for procedure:

    $id=get_event_id

    Syntax for function:

    $id=get_event_id();
  90. "set" command

    Definition:

    Sets new value for variable

    Syntax for procedure:

    $where=set "what"

    Sample syntax for function: use something like:

    $where="what";
  91. "isset" command

    Definition:

    Returns TRUE if variable is set

    Sample syntax for function:

    if(isset($what))
  92. "array" command

    Definition:

    Initializes an array

    Sample syntax for function:

    $ar=array("hello", 10 => "world", 123);
  93. "NULL" command

    Definition:

    Unsets variable

    Syntax for function:

    $x=NULL;
  94. "deop_ban_mask" command

    Definition:

    Gives -o flag to user, and sets +b ban mask

    Syntax for procedure:

    deop_ban_mask CRITICAL "#channel_name" "nick" "mask"

    Syntax for function:

    deop_ban_mask(HIGH,"#channel_name","nick","*!*@somehost.org");

    Note: Use this command to deop-and-ban at once. It will generate MODE to channel: "-o+b nick *!*@somehost.org", to ensure that user will not have a chance to remove ban for hisself. If you only set ban, and if he's opped, he could remove the ban instantly.

    NB: Because procedure's "kick" command has always "CRITICAL" priority (and you cannot change it), you should set in procedure "CRITICAL" priority for this command as well - if it is followed by "kick" (both SHOULD have same priority, because in other case, they go separately into different queues). In function, there is choice to have custom priority.

    Compatibility: If your procedure contains this command, it will not be replicated to bots of version less than 1.1.beta3, that is BOTNET protocol version less than 1002 for compatibility reasons.

  95. "md5" function

    Definition:

    Computes MD5 hash from string argument

    Syntax for function:

    $hash=md5("hello!");

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  96. "rand" function

    Definition:

    Returns random INT number

    Syntax for function:

    $test=rand();

    $test=rand(10);

    $test=rand(-100,2000);

    If no arguments are given, it returns number between zero and value returned by function "getrandmax()" inclusive.

    If only one argument is passed, it returns number between this argument and value returned by function "getrandmax()" inclusive.

    If two arguments are passed, it returns number between first and second argument inclusive.

    If second argument is less than value of first argument, it acts like it were exchanged, e.g. "rand(100,-10)" is exactly like "rand(-10,100)".

    If both arguments are equal, it returns number that equals to these arguments, e.g. "rand(10,10)" always returns "10".

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  97. "getrandmax" function

    Definition:

    Returns maximum INT number that rand() function can return

    Syntax for function:

    $max=getrandmax();

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  98. "fopen" function

    Definition:

    Opens file in module's "data" directory

    Syntax for function:

    $f=fopen("test.txt","r");

    Function actually returns INT as file descriptor, that should be closed by "fclose()" function, and this file will be also closed on module's unload.

    If function fails, it returns FALSE instead. You should use "if($f===FALSE)" to test for return value.

    For security reasons, you cannot specify directory, but only name of file. All files used by this function are in module's "data" directory. In other case, function returns FALSE.

    For information about second argument (file open mode) see C or C++ language reference manual.

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  99. "fgets" function

    Definition:

    Reads string from open file

    Syntax for function:

    $line=fgets($f);

    $line=fgets($f,2048);

    First argument should be file descriptor returned by "fopen()". If second argument is not given, function tries to read up to 1024 characters from file. Use second argument to override this limit.

    If function fails (e.g. first argument is not valid file descriptor, or there are no more data in file / end-of-file has been reached), it returns FALSE instead. You should use "if($line===FALSE)" to test for return value.

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  100. "fputs" function

    Definition:

    Write string to open file

    Syntax for function:

    $written=fputs($f,"hello!");

    $written=fputs($f,$str,10);

    $written=fputs($f,$str,$limit);

    First argument should be file descriptor returned by "fopen()". Second argument is string that should be written to file. If third argument is not given, function tries to write full string, if it is given, it will stop after $limit characters have been written, or end of string is reached, whichever comes first.

    If function fails (e.g. first argument is not valid file descriptor, or there is error from OS reported), it returns FALSE. If succeeded, it returns number of characters actually written. You should use "if($written===FALSE)" to test for return value.

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  101. "fclose" function

    Definition:

    Closes open file

    Syntax for function:

    $ok=fclose($f);

    Argument should be file descriptor returned by "fopen()".

    If function fails (e.g. first argument is not valid file descriptor, or there is error from OS reported), it returns FALSE. If succeeded, it returns TRUE.

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  102. "fseek" function

    Definition:

    Sets position pointer on open file

    Syntax for function:

    $res=fseek($f,100);

    $res=fseek($f,0,SEEK_END);

    $res=fseek($f,-10,SEEK_CUR);

    $res=fseek($f,$offset,$whence);

    First argument should be file descriptor returned by "fopen()".

    Second argument is offset to seek for.

    Third argument is optional, it could be one of these constants: "SEEK_SET" (to set offset from beginning of the file), "SEEK_CUR" (to set offset relative to current position - you can use negative value for $offset), or "SEEK_END" (to set offset relative to end of file - you can use negative value for $offset). Refer to C or C++ reference manual for more informations.

    If third argument is not given, it is assumed to be SEEK_SET.

    Return value is zero for success, or -1 (negative one) for error (e.g. invalid file descriptor). Note that it is possible to seek beyond end-of-file, and it is not considered as error.

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  103. "ftell" function

    Definition:

    Gets position pointer on open file

    Syntax for function:

    $pos=ftell($f);

    First argument should be file descriptor returned by "fopen()".

    Return value is current position offset in open file for success, or FALSE for error (e.g. invalid file descriptor). You should use "if($pos===FALSE)" to test this condition.

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  104. "fread" function

    Definition:

    Read data from files opened by "fopen()"

    Syntax for function:

    $data=fread($handle, $length);

    First argument should be file descriptor returned by "fopen()".

    Return value is the data read from file, up to $length bytes (or less if end-of-file is reached) for success, or FALSE for error (e.g. invalid file descriptor, or in case of I/O error). You should use "if($data===FALSE)" to test this condition.

    Limitation: do not pass as $length > 4294967295. On most platforms, this will cause integer overflow (because we are using 32-bit version of ftell() C/C++ function) and end up in negative number. In such care, this condition is handled as you were pass to $length a negative number, and then the function will succeed, but will try to read zero bytes from file (i.e. $data will === "").

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  105. "make_valid_filename" function

    Definition:

    Generates valid file name

    Syntax for function:

    $name=make_valid_filename("hello! I am such* a bad ? n/a\m/e of #file!!!");

    This function obfuscates its argument to make name of file that is valid. If argument is an empty string, it returns string "_empty_". Each occurence of "_" character is converted into "_-_" sequence. Non-alphanumeric characters are converted to "_xx_" sequence, where "xx" is lower-case hexadecimal representation of that character.

    This function is useful for creating file of user's request (possibly on IRC), but note that you can exceed maximum length of file name/path defined by OS/filesystem.

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  106. "trim" function

    Definition:

    Strips whitespace, or other character from beginning and end of string

    Syntax for function:

    $new_str=trim($str);

    $new_str=trim($str,$blacklist);

    Second optional argument is string of characters that should be stripped from beginning and end of $str string.

    If second argument is not given, it assumes to be " \t\r\n\x0B", that is, a space, "\t" (tab), "\r" (carriage return), "\n" (new-line), and "\x0B" (vertical tab).

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta9, that is BOTNET protocol version less than 1003 for compatibility reasons (function will fail if it reaches this function).

  107. "feof" function

    Definition:

    Checks whether we have reached end of file

    Syntax for function:

    $end=feof($f);

    Argument should be file descriptor returned by "fopen()".

    Returns TRUE if we are at the end; FALSE if not, or '$f' is not valid file file descriptor returned by 'fopen()'.

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta11.pl6, that is BOTNET protocol version less than 1005 for compatibility reasons (function will fail if it reaches this function).

  108. "filesize" function

    Definition:

    Retrieves size of file

    Syntax for function:

    $size=filesize("my_file.txt");

    $fd=fopen("my_file.txt","r"); $size=filesize($fd);

    Argument can be either string as a name of file, or file descriptor returned by "fopen()".

    Returns size of file in bytes, or FALSE in case of error.

    Compatibility: It is unsafe to replicate function containing this function to bots prior to version 1.1.beta31-cvs6 for compatibility reasons (function will fail if it reaches this function).

  109. "ssl_server" command

    Definition:

    Binds to specified address and port, to listen for ssl users and other bots in the botnet.

    Syntax for procedure:

    ssl_server 4 "10.0.0.1" 4444

    Syntax for function:

    ssl_server(4,"10.0.0.1",4444);

    First argument is version of IP (4 for IPv4, 6 for IPv6), second is bind address and third is bind port.

    Note: When there is an empty string as bind IP (second argument), it will be bound dynamically, when we get our host from IRC server (via self-WHOIS) resolved to IP address. This works currently for IPv4 only. It can be useful for DHCP-assigned IPv4 address. When resulting IP address will change, then server socket is re-bound to new address.

    See section ssl.txt.

  110. "load_bin_module" command

    Definition:

    Loads a binary module

    Syntax for procedure:

    load_bin_module $name $so_file

    Syntax for function:

    load_bin_module($name,$so_file);

    Example for procedure (loads binary seen module, with "seen.so" on *NIX)

    load_bin_module "seen" "seen.so"

    Example for function (loads binary seen module, with "seen.dll" on Win32)

    load_bin_module("seen","seen.dll");

    Note: Command is processed after short delay.

    Note: To unload module, simply call "unload_module".

    Note: If your procedure contains this command, the procedure will not be replicated to bots with botnet protocol less than 1007, that is less than version 1.1.beta18 for compatibility reasons.

  111. "have_func" function

    Definition:

    Checks whether bult-in function is implemented

    Syntax for function:

    $result=have_func('eval');

    Note: Function returns TRUE if built-in function usable in script is implemented in your version of bot.

    Note: You should start using this function, after adding new built-in functions to newer versions of bot. If result you get is FALSE, you shuld log message to your module's log file about non-implemented function, so user will see that bot upgrade is needed to module work properly.

    Compatibility note: If your function uses this function, replication of such function to bots older than version 1.1.beta29 will do harm, since this function first appeared in version 1.1.beta29.

  112. "preg_grep" function

    Definition:

    Return array entries that match the pattern

    Syntax for function:

    $array=preg_grep($pattern, $input [, $flags]);

    $input can be string or array, $flags could be PREG_GREP_INVERT pre-defined constant.

    See PHP documentation for more info.

    Compatibility note: If your function uses this function, replication of such function to bots older than version 1.1.beta31-cvs2 will do harm, since this function first appeared in version 1.1.beta31-cvs2. You can use 'have_func()' function in script to check if this function is supported/implemented.

  113. "preg_match_all" function

    Definition:

    Performs full match against PCRE RegExp pattern

    Syntax for function:

    $number_of_matches=preg_match_all($pattern,$subject,$matches [, $flags [, $offset ]]);

    Array with matches is returned to variable $matches, $flags could be PREG_PATTERN_ORDER, PREG_SET_ORDER, PREG_OFFSET_CAPTURE pre-defined constants, or their bitwise-OR combinations; if not speciefied, it defaults to PREG_PATTERN_ORDER, however, PREG_PATTERN_ORDER is not implemented.

    See PHP documentation for more info.

    Compatibility note: If your function uses this function, replication of such function to bots older than version 1.1.beta31-cvs2 will do harm, since this function first appeared in version 1.1.beta31-cvs2. You can use 'have_func()' function in script to check if this function is supported/implemented.

  114. "preg_match" function

    Definition:

    Performs match against PCRE RegExp pattern

    Syntax for function:

    $number_of_matches=preg_match($pattern,$subject,[ $matches [, $flags [, $offset ]]]);

    Array with matches is returned to variable $matches, $flags can be zero or PREG_OFFSET_CAPTURE pre-defined constants.

    See PHP documentation for more info.

    Compatibility note: If your function uses this function, replication of such function to bots older than version 1.1.beta31-cvs2 will do harm, since this function first appeared in version 1.1.beta31-cvs2. You can use 'have_func()' function in script to check if this function is supported/implemented.

  115. "preg_split" function

    Definition:

    Splits string against PCRE RegExp pattern

    Syntax for function:

    $array=preg_split($pattern,$subject [, int $limit  [, int $flags  ]] );

    Array with matches is returned to variable $matches, $flags can be either PREG_SPLIT_NO_EMPTY, PREG_SPLIT_DELIM_CAPTURE, or PREG_SPLIT_OFFSET_CAPTURE pre-defined constants, however only PREG_SPLIT_OFFSET_CAPTURE is implemented.

    $limit should be -1 in meaning of "no limit".

    See PHP documentation for more info.

    Compatibility note: If your function uses this function, replication of such function to bots older than version 1.1.beta31-cvs2 will do harm, since this function first appeared in version 1.1.beta31-cvs2. You can use 'have_func()' function in script to check if this function is supported/implemented.

  116. "preg_replace" function

    Definition:

    PCRE RegExp search and replace

    Syntax for function:

    $result=preg_replace($pattern,$replacement,$subject [, int $limit  [, int &$count  ]] );

    $limit should be -1 in meaning of "no limit".

    See PHP documentation for more info.

    Note: Pattern modifier 'e' is not supported yet.

    Compatibility note: If your function uses this function, replication of such function to bots older than version 1.1.beta31-cvs2 will do harm, since this function first appeared in version 1.1.beta31-cvs2. You can use 'have_func()' function in script to check if this function is supported/implemented.

  117. "preg_last_error" function

    Definition:

    Checks last PCRE library error

    Syntax for function:

    $rc=cmd_preg_last_error([$message]);

    Returns last PCRE library error code, and, if optional argument is provided, it will receive a human-readable error message.

    See PHP documentation for more info.

    Compatibility note: If your function uses this function, replication of such function to bots older than version 1.1.beta31-cvs2 will do harm, since this function first appeared in version 1.1.beta31-cvs2. You can use 'have_func()' function in script to check if this function is supported/implemented.

  118. "get_bot_name" command

    Definition:

    Retrieves name of bot

    Syntax for procedure

    $name=get_bot_name

    Syntax for function:

    $name=get_bot_name();

    Compatibility note: If your procedure contains this command, the whole procedure will not be replicated to bot of version <1.1.beta31, that is BOTNET protocol <1008, for compatibility reasons, since this command was introduced in version 1.1.beta32 cvs pre-release.

    Compatibility note: If your function uses this function, replication of such function to bots older than version 1.1.beta32 will do harm, since this function first appeared in version 1.1.beta32 cvs pre-release. You can use 'have_func()' function in script to check if this function is supported/implemented.

  119. "get_current_irc_server" command

    Definition:

    Retrieves current IRC server and port we are connected to, or trying to connect to

    Syntax for procedure

    get_current_irc_server $irc_server_host $port

    Syntax for function:

    get_current_irc_server($irc_server_host,$port);

    Note: These two arguments muset be l-value and will be overwritten by IRC server connection informations.

    Compatibility note: If your procedure contains this command, the whole procedure will not be replicated to bot of version <1.1.beta31, that is BOTNET protocol <1008, for compatibility reasons, since this command was introduced in version 1.1.beta32 cvs pre-release.

    Compatibility note: If your function uses this function, replication of such function to bots older than version 1.1.beta32 will do harm, since this function first appeared in version 1.1.beta32 cvs pre-release. You can use 'have_func()' function in script to check if this function is supported/implemented.


Modules and messages - Intro


Directory structure for modules (here, 'seen' module is used as an example, and "bin_seen" for binary module):
botroot/
    `-logic.txt
    `-conf.txt
    `-modules/
        `-seen/
            `-logic.txt
            `-conf.txt
            `-logs/
            `-scripts/
            `-data/
        `-bin_seen/
            `-logic.txt
            `-conf.txt
            `-seen.so
            `-logs/
            `-scripts/
            `-data/

Module has its own logic.txt, conf.txt files, own logs and scripts, own global variables (except of built-in globals, which are same in all modules), living their own life. Main module, which has logic.txt and conf.txt files in root directory of bot is called "core" module. Other modules has same name as name of their directory under "modules" directory. If key and value in module's conf.txt file could not be found, it is taken from core module's conf.txt. It is useful to not specify in module's conf.txt key "php_processor" (path to PHP processor), which should be same as in core's conf.txt, so it will be inherited from core's conf.txt, but "php_script_dir" should be "./scripts/", or ".\scripts\" in win32. File logic.txt in modules is same as in core module, but can contain only procedures and functions. The entry point of module (procedure/function which will be executed on module's load) has this syntax:
procedure _sys_startup($mod_name)
or,
function _sys_startup($mod_name)
Argument $mod_name will contain name of module.

It is recommended that your core module will contain following code, which will allow you to load/unload modules via DCC/telnet, and some of them automatically at bot startup:

function init_modules()
{
    bind("partyline","*","*",".+module *",FALSE,"partyline_load_module");
    bind("partyline","*","*",".-module *",FALSE,"partyline_unload_module");
    load_module("seen");
}
function partyline_load_module($dispatch)
{
    if(!in_group($dispatch["user"],"super_users")) {
        admin_msg("@telnet@",$dispatch["user"],"You don't have privileges to use this command.");
        return;
    }
    $ar=explode(" ",$dispatch["line"],3);
    if(count($ar)==2)
        load_module($ar[1]);
    else if(count($ar)==3)
        load_bin_module($ar[1],$ar[2]);
}
function partyline_unload_module($dispatch)
{
    if(!in_group($dispatch["user"],"super_users")) {
        admin_msg("@telnet@",$dispatch["user"],"You don't have privileges to use this command.");
        return;
    }
    $ar=explode(" ",$dispatch["line"],2);
    if(strtolower($ar[1])=="core")
        admin_msg("@telnet@",$dispatch["user"],"Cannot unload core module.");
    else
        unload_module($ar[1]);
}

In above code, you should call function init_modules() once on bot startup, in procedure via:
execute init_modules()
in function:
init_modules();

Which binds DCC/telnet commands ".+module <modulename>" for loading module, and ".-module <modulename>" for unloading module. As seen in code, these commands can be used only by users which are member of group "super_users". Also, this code loads "seen" module.
To load binary module, use ".+module <modulename> <DLL/SO_file.dll>". On *NIX, it has ".so" suffix, on Win32 ".dll".

With binary modules you can do things much faster. See "seen" binary module code for more info, to use it as example for binary module development. You can communicate with DLL (under Win32) or "SO" (under *NIX). In binary module, you can bind your own event (see section Messages below) in DLL/SO, and generate this event by "dispatch" command/built-in function in "logic.txt". If you need to pass data in reverse direction, from DLL/SO to "logic.txt", you can use "eval" function interface in DLL/SO, and so call there function/procedure placed in "logic.txt".

Valid name for module (i.e. the directory under "modules/", where module resides) can contain alphabetical characters, either upper- or lower-case, numbers, uderscore ('_') and dash ('-') characters. Additionally, for binary modules, name of .so/.dll file can contain also dot ('.'), but its name must not be '.' or '..' (which are used for special directory names in filesystem hierarchy). When attemp to load of a new module is made, note that you cannot load new module that has case-insensitively same name as already loaded module (e.g. 'mymodule' vs. 'myMODULE'), even on underlying case-sensitive filesystem implementation.

Messages

You can bind/unbind function to specific event via commands bind and unbind. Bound function must have this declaration:
function myfunction($dispatch)

$dispatch is array which contains informations about event.
Events has these informations in $disptach array:
$dispatch["type"] - Type of event (e.g. "+o@channel".
$dispatch["user"] - Name of user/originator of event, if applicable.
$dispatch["channel"] - IRC channel, if applicable.
$dispatch["line"] - Line of commnad, if applicable.
$dispatch["meta"] - More data associated with event (see below).
$dispatch["origin"] - Contains string "@dcc@@telnet@" (if origin of event is from DCC, or telnet), or "@irc@" if origin of event is from IRC protocol, or "@raw@" for raw IRC protocol bound event, or "@filesys@" for filesystem event, or "@fnc@" for force nick change event (IRCnet), or "@server@" for server notices/messages. These flags could be updated in future, so to avoid problems with future compatibility, use logic similar to checking if this variable contains, for example, sub-string "@dcc@".
$dispatch["nick"] - Only set if $dispatch["origin"] contains sub-string "@irc@": There is nickname of originating user (e.g. user who triggered an event).
$dispatch["ident"] - Only set if $dispatch["origin"] contains sub-string "@irc@": There is ident of originating user (e.g. user who triggered an event).
$dispatch["host"] - Only set if $dispatch["origin"] contains sub-string "@irc@": There is host of originating user (e.g. user who triggered an event).
$dispatch["event_type"] - e.g. "channel" - see $dispatch["type"] above; first appeared in version 1.1.beta31-cvs6.

Beside those data in array, there are extra informations specific to particular event. Specification follows:
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"+i@channel"/"-i@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["prefix"] - "+", or "-"
$disptach["meta"]["mode"] - "i"
User set/unset +i channel mode
"+k@channel"/"-k@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["prefix"] - "+", or "-"
$disptach["meta"]["key"] - new key
User set/unset +k channel mode
"+l@channel"/"-l@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["prefix"] - "+", or "-"
$disptach["meta"]["limit"] - new limit
User set/unset +l channel mode
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"topic@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["topic"] - new topic
User set topic on channel
"+o@user"/"-o@user" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["target"] - target user
$disptach["meta"]["target_nick"] - target nick
$disptach["meta"]["prefix"] - "+", or "-"
$disptach["meta"]["mode_char"] - "o"
$disptach["meta"]["mode"] - "o" (from version 1.1.beta31-cvs6 on)
$disptach["meta"]["target_ident"] - ident of target nick (from version 1.1.beta31-cvs6 on)
$disptach["meta"]["target_host"] - host name of target nick (from version 1.1.beta31-cvs6 on)
$disptach["meta"]["symbol"] - "@" (from version 1.1.beta31-cvs6 on)
User set/unset +o mode to nick
"+v@user"/"-v@user" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["target"] - target user
$disptach["meta"]["target_nick"] - target nick
$disptach["meta"]["prefix"] - "+", or "-"
$disptach["meta"]["mode_char"] - "v"
$disptach["meta"]["mode"] - "o" (from version 1.1.beta31-cvs6 on)
$disptach["meta"]["target_ident"] - ident of target nick (from version 1.1.beta31-cvs6 on)
$disptach["meta"]["target_host"] - host name of target nick (from version 1.1.beta31-cvs6 on)
$disptach["meta"]["symbol"] - "+" (from version 1.1.beta31-cvs6 on)
User set/unset +v mode to nick
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"+b@channel"/"-b@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["prefix"] - "+", or "-"
$disptach["meta"]["mask"] - mask
$disptach["meta"]["mode"] - "b" (from version 1.1.beta31-cvs6 on)
User set/unset +b mask on channel
"+e@channel"/"-e@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["prefix"] - "+", or "-"
$disptach["meta"]["mask"] - mask
$disptach["meta"]["mode"] - "e" (from version 1.1.beta31-cvs6 on)
User set/unset +e mask on channel
"+I@channel"/"-I@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["prefix"] - "+", or "-"
$disptach["meta"]["mask"] - mask
$disptach["meta"]["mode"] - "I" (from version 1.1.beta31-cvs6 on)
User set/unset +I mask on channel
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"+R@channel"/"-R@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["prefix"] - "+", or "-"
$disptach["meta"]["mask"] - mask
$disptach["meta"]["mode"] - "R" (from version 1.1.beta31-cvs6 on)
User set/unset +R mask on channel
"join@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["user"] - user
$disptach["meta"]["nick"] - nick
$disptach["meta"]["passive"] - passive flag - see on_join event
User joined the channel
"nick@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["user"] - user
$disptach["meta"]["nick"] - new nick
$disptach["meta"]["old_nick"] - old nick (from version 1.1.beta31-cvs6 on)
User changed nick
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"kick@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["target"] - target user
$disptach["meta"]["source_nick"] - source nick
$disptach["meta"]["target_nick"] - target nick
$disptach["meta"]["target_ident"] - target ident (from version 1.1.beta31-cvs6 on)
$disptach["meta"]["target_host"] - target host (from version 1.1.beta31-cvs6 on)
User kicked nick off channel
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"flood@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["nick"] - nick
$disptach["meta"]["type"] - flood type (e.g. "ctcp")
$disptach["meta"]["num"] - number of messages
$disptach["meta"]["sec"] - number of seconds
$disptach["meta"]["sec_of"] - number of allowed seconds
User triggered flood - see on_flood event
"ctcp@channel" source user channel "" $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - nick
$disptach["meta"]["command"] - ctcp command
$disptach["meta"]["parameters"] - ctcp parameters
Received ctcp message - see private and channel definition's on_ctcp
Note that prior to this event there is event of type "privmsg@channel" triggered.
"ctcp@private" source user channel "" $disptach["meta"]["channel"] - UNSET/NULL
$disptach["meta"]["source"] - source user
$disptach["meta"]["source_nick"] - nick
$disptach["meta"]["command"] - ctcp command
$disptach["meta"]["parameters"] - ctcp parameters
Received ctcp message - see private and channel definition's on_ctcp
Note that prior to this event there is event of type "privmsg@private" triggered.
"got_new@filesys" user name "" "" $disptach["meta"]["user_name"] - user name
$disptach["meta"]["nick"] - nick (if applicable/online)
$disptach["meta"]["ident"] - ident (if applicable/online)
$disptach["meta"]["host"] - host (if applicable/online)
$disptach["meta"]["internal_name"] - internal name of file
Got new filesystem object - see private definition's on_filesys_got_new
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"fnc@private" "" "" "" $disptach["meta"]["old_nick"] - old nick
$disptach["meta"]["new_nick"] - new nick
IRC server forced nick change on your bot (IRCnet only)
"privmsg@channel" user channel message $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - user
$disptach["meta"]["source_nick"] - nick
$disptach["meta"]["msg"] - message
User posted message to channel
"notice@channel" user channel message $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - user
$disptach["meta"]["source_nick"] - nick
$disptach["meta"]["msg"] - message
User posted notice to channel
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"privmsg@private" user "" message $disptach["meta"]["channel"] - UNSET/NULL
$disptach["meta"]["source"] - user
$disptach["meta"]["source_nick"] - nick
$disptach["meta"]["msg"] - message
User posted message to bot's query
"notice@private" user "" message $disptach["meta"]["channel"] - UNSET/NULL
$disptach["meta"]["source"] - user
$disptach["meta"]["source_nick"] - nick
$disptach["meta"]["msg"] - message
User posted notice to bot's query
"ircop@channel" user channel message $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - user
$disptach["meta"]["source_nick"] - nick
$disptach["meta"]["on"] - on flag - see channel definition's on_ircop event
IRC-op joined/left channel
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"part@channel" user channel message $disptach["meta"]["channel"] - channel
$disptach["meta"]["source"] - user
$disptach["meta"]["source_nick"] - nick
$disptach["meta"]["msg"] - Quit/part message
$disptach["meta"]["type"] - type - see channel definition's on_part event
User quit/part channel
"broadcast@private" user "" "" $disptach["meta"]["source"] - user
$disptach["meta"]["source_nick"] - nick
$disptach["meta"]["ident"] - ident
$disptach["meta"]["host"] - host
$disptach["meta"]["bcast_mask"] - broadcast mask
$disptach["meta"]["type"] - type
$disptach["meta"]["msg"] - message
IRC-op is broadcasting message - see private definition's on_broadcast event
Note that if broadcast message is a CTCP, "ctcp@private" event will be triggered after this one
"server_msg@channel" source channel "" $disptach["meta"]["source"] - source
$disptach["meta"]["channel"] - channel
$disptach["meta"]["type"] - type
$disptach["meta"]["msg"] - message
Server is speaking to channel - see channel definition's on_server_msg
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"server_msg@private" user "" "" $disptach["meta"]["source"] - source
$disptach["meta"]["type"] - type
$disptach["meta"]["msg"] - message
Server is speaking to bot's query - see private definition's on_server_msg
"partyline" user partyline channel the user is on, if any message/command $disptach["meta"] - empty User issued command, or message on DCC/telnet connection
"endofwhois@nick" user "" "" $disptach["meta"]["user"] - user name
$disptach["meta"]["nick"] - nick
We got full information about nick, the end of WHOIS, so global variables are full up
$disptach["type"] $disptach["user"] $disptach["channel"] $disptach["line"] $disptach["meta"] Description
"irc_raw" "" "" raw message from IRC server $disptach["meta"] - empty Raw message from IRC server. Warning: Calling bound function for this event may significantly speed down your bot! You should curtail it with proper mask to $line argument of bind.

There can be more $dispatch["type"] types, e.g. "+h@channel" (half-op), since some networks has more modes than RFC specifies.
When calling bind/unbind command/built-in function, we specify masks with same wildcards as in IRC host masks. There is also argument $before, which is boolean type. If we bind event with FALSE as $before, bound function is called after event is processed, e.g. after global variables are modified. For example, we want to call bound function before global variables are modified (nick is removed from list of nicks on channel in case of KICK, if after, there will be no entry for particular nick in global variables). See global variables specification.
Events that have implemented $before=TRUE are:

"+o@user", mode for nick on channel, and similar
"+t@channel", mode for channel, and similar
"+k@channel", "+l@channel", key, limit for channel and similar
"+b@channel", masks for channel, and similar
"topic@channel", topic for channel
"kick@channel", KICK of nick
"irc_raw", Raw message from IRC server

If we want to comunicate between modules, we need to call dispatch($type,$user,$channel,$line,$meta) function. It is recommended to use unique $type argument, e.g. "my_event@my_module_name".


Built-in global variables

Use command "global" in functions, to import global variable into current function:

global $_users;

Values in built-in global variables are read-only, so script cannot modify them; only to add new values, e.g.:
global $_users;
$users["mynick"/i]["my_custom"]=10;

Following is structure of built-in global variables, list is generated by "log_print(var_dump($_users))" and similar. These structures will be improved in future, so check this section in future releases.
Use
$_users["nick"/i]
to access particular nick;
$_channels["#channel"/i]
to access channel. I think structures are clear to understand, $_users["nick"/i]["name"] contains name of user as specified in logic.txt. Built-in global "$_uptime" contains number of elapsed seconds since bot startup.
$_users
(ARRAY)
    [(STRING) "botnick"] => (ARRAY)
        [(STRING) "nick"] => (STRING) "botnick"
        [(STRING) "host_unknown"] => (BOOL) FALSE
        [(STRING) "host_bot"] => (BOOL) TRUE
        [(STRING) "irc_op"] => (BOOL) FALSE
        [(STRING) "channels"] => (ARRAY)
            [(STRING) "#voodooman"] => (ARRAY)
                [(STRING) "channel"] => (STRING) "#voodooman"
                [(STRING) "mode"] => (STRING) "0"
        [(STRING) "ident"] => (STRING) "~botnick"
        [(STRING) "host"] => (STRING) "10.0.0.2"
        [(STRING) "fullname"] => (STRING) "Hi! I am bot!"
        [(STRING) "name"] => (STRING) "bot1"
        [(STRING) "hostmasks"] => (ARRAY)
            [(INT) 0] => (STRING) "*!bot@10.0.0.1"
            [(INT) 1] => (STRING) "*!?bot@10.0.0.1"
        [(STRING) "fullname_masks"] => (ARRAY)
            [(INT) 0] => (STRING) "http://vdm.host.sk/"
        [(STRING) "groups"] => (ARRAY)
            [(INT) 0] => (STRING) "super_users"
            [(INT) 1] => (STRING) "bots"
        [(STRING) "raw_whois"] => (ARRAY)
            [(INT) 0] => (STRING) ":vdm.no-ip.org 311 botnick botnick ~botnick 10.0.0.2 * :http://vdm.host.sk/"
            [(INT) 1] => (STRING) ":vdm.no-ip.org 378 botnick botnick :is connecting from *@10.0.0.2 10.0.0.2"
            [(INT) 2] => (STRING) ":vdm.no-ip.org 319 botnick botnick :#VooDooMan "
            [(INT) 3] => (STRING) ":vdm.no-ip.org 312 botnick botnick vdm.no-ip.org :VooDooMan\x27s server"
            [(INT) 4] => (STRING) ":vdm.no-ip.org 671 botnick botnick :is using a Secure Connection"
            [(INT) 5] => (STRING) ":vdm.no-ip.org 317 botnick botnick 2 1136324921 :seconds idle, signon time"
            [(INT) 6] => (STRING) ":vdm.no-ip.org 318 botnick botnick :End of /WHOIS list."
    [(STRING) "VooDooMan"] => (ARRAY)
        [(STRING) "nick"] => (STRING) "VooDooMan"
        [(STRING) "host_unknown"] => (BOOL) FALSE
        [(STRING) "host_bot"] => (BOOL) FALSE
        [(STRING) "irc_op"] => (BOOL) FALSE
        [(STRING) "channels"] => (ARRAY)
            [(STRING) "#voodooman"] => (ARRAY)
                [(STRING) "channel"] => (STRING) "#voodooman"
                [(STRING) "mode"] => (STRING) "@"
        [(STRING) "ident"] => (STRING) "~vdmfun"
        [(STRING) "host"] => (STRING) "10.0.0.2"
        [(STRING) "fullname"] => (STRING) "http://vdm.host.sk/"
        [(STRING) "name"] => (STRING) "VooDooMan"
        [(STRING) "hostmasks"] => (ARRAY)
            [(INT) 0] => (STRING) "V??D??Man!vdmfun@10.0.0.2"
            [(INT) 1] => (STRING) "V??D??Man!?vdmfun@10.0.0.2"
        [(STRING) "fullname_masks"] => (ARRAY)
            [(INT) 0] => (STRING) "http://vdm.dynu.com/"
            [(INT) 1] => (STRING) "http://vdm.host.sk/"
        [(STRING) "groups"] => (ARRAY)
            [(INT) 0] => (STRING) "super_users"
            [(INT) 1] => (STRING) "group2"
        [(STRING) "raw_whois"] => (ARRAY)
            [(INT) 0] => (STRING) ":vdm.no-ip.org 311 botnick VooDooMan ~vdmfun 192.168.0.1 * :http://vdm.host.sk/"
            [(INT) 1] => (STRING) ":vdm.no-ip.org 319 botnick VooDooMan :@#VooDooMan "
            [(INT) 2] => (STRING) ":vdm.no-ip.org 312 botnick VooDooMan vdm.no-ip.org :VooDooMan\x27s server"
            [(INT) 3] => (STRING) ":vdm.no-ip.org 317 botnick VooDooMan 4033 1136320890 :seconds idle, signon time"
            [(INT) 4] => (STRING) ":vdm.no-ip.org 318 botnick VooDooMan :End of /WHOIS list."
$_channels
(ARRAY)
    [(STRING) "#voodooman"] => (ARRAY)
        [(STRING) "key"] => (STRING) ""
        [(STRING) "limit"] => (STRING) ""
        [(STRING) "mode"] => (STRING) ""
        [(STRING) "topic"] => (STRING) ""
        [(STRING) "bans"] => (ARRAY)
            [(INT) 0] => (STRING) "*!flooder@flood.org"
            [(INT) 2] => (STRING) "flooder!flooder@*.org"
        [(STRING) "exceptions"] => (ARRAY)
        [(STRING) "invites"] => (ARRAY)
        [(STRING) "reops"] => (ARRAY)
$_user_mode_prefix
(ARRAY)
    [(STRING) "q"] => (STRING) "~"
    [(STRING) "a"] => (STRING) "&"
    [(STRING) "o"] => (STRING) "@"
    [(STRING) "h"] => (STRING) "%"
    [(STRING) "v"] => (STRING) "+"
$_isupport
(ARRAY)
    [(STRING) "SILENCE"] => (STRING) "15"
    [(STRING) "MODES"] => (STRING) "12"
    [(STRING) "CHANTYPES"] => (STRING) "#"
    [(STRING) "PREFIX"] => (STRING) "(qaohv)~&@%+"
    [(STRING) "CHANMODES"] => (STRING) "beI,kfL,lj,psmntirRcOAQKVGCuzNSMTG"
    [(STRING) "NETWORK"] => (STRING) "ROXnet"
    [(STRING) "CASEMAPPING"] => (STRING) "ascii"
    [(STRING) "EXTBAN"] => (STRING) "~,cqnr"
    [(STRING) "ELIST"] => (STRING) "MNUCT"
    [(STRING) "STATUSMSG"] => (STRING) "~&@%+"
    [(STRING) "EXCEPTS"] => (STRING) ""
    [(STRING) "INVEX"] => (STRING) ""
    [(STRING) "CMDS"] => (STRING) "KNOCK,MAP,DCCALLOW,USERIP"
$_uptime
(INT) 136

File "conf.txt"

Let's got to explain what each line means:

  1. botname - name of your bot
  2. admin - your e-mail
  3. botnet_penalty - number of seconds, to penalty bot when it passes bad password (for high CPU usage protection)
  4. log_echo_debug - set to 1 (one) if you want to see in the console debug messages
  5. log_echo_irc - set to 1 (one) if you want to see in the console IRC messages
  6. log_echo_socket - set to 1 (one) if you want to see in the console socket error messages
  7. log_echo_bot - set to 1 (one) if you want to see in the console bot messages
  8. log_echo_identd - set to 1 (one) if you want to see in the console IDENTD messages
  9. log_echo_botnet - set to 1 (one) if you want to see in the console botnet messages
  10. log_echo_botnet_debug - set to 1 (one) if you want to see in the console botnet debug messages
  11. log_echo_clients - set to 1 (one) if you want to see in the console messages about clients connections
  12. log_debug - set to 1 (one) if you want to log debug messages to file in logs directory
  13. log_irc - set to 1 (one) if you want to log IRC messages to file in logs directory
  14. log_socket - set to 1 (one) if you want to log socket error messages to file in logs directory
  15. log_bot - set to 1 (one) if you want to log bot messages to file in logs directory
  16. log_identd - set to 1 (one) if you want to log IDENTD messages to file in logs directory
  17. log_botnet - set to 1 (one) if you want to log botnet messages to file in logs directory
  18. log_botnet_debug - set to 1 (one) if you want to log botnet debug messages to file in logs directory
  19. log_clients - set to 1 (one) if you want to log messages about connecting clients to file in logs directory
  20. php_processor - full path to PHP preprocessor (in most cases on Windows(TM) it is c:\php\php.exe); You can use forward-slashes even on Win32, it will be converted to back-slashes
  21. php_processor_args - Additional arguments for PHP preprocessor
  22. php_script_dir - relative path (from irc_bot.exe) to scripts directory - should be ./scripts/ ; You can use forward-slashes even on Win32, it will be converted to back-slashes
  23. php_1 - name of PHP file for script #1
  24. php_2 - name of PHP file for script #2, ...
  25. php_2_1 - name of PHP file for script #1 for method php_2
  26. perl_processor - full path to PERL processor (in most cases on Windows(TM) it is c:\Perl\bin\perl.exe); You can use forward-slashes even on Win32, it will be converted to back-slashes
  27. perl_processor_args - Additional arguments for PERL processor
  28. perl_script_dir - relative path (from irc_bot.exe) to scripts directory - should be ./scripts/ ; You can use forward-slashes even on Win32, it will be converted to back-slashes
  29. perl_1 - name of PERL file for script #1
  30. perl_2 - name of PERL file for script #2, ...
  31. dcc_bind_ip - IPv4 address that should TCP listening socket bound for DCC connections
  32. dcc_bind_ip6 - IPv6 address that should TCP listening socket bound for DCC connections
  33. notify_interval - number in minutes for noitifying users about filesystem messages / files
  34. dcc_max_transfers - number of maximum DCC concurrent transfers
  35. ctcp_lag_user_msgs - number of CTCP (and also DCC) requests limit for time (see next field) to ban user from using DCC/CTCP (for flood protection)
  36. ctcp_lag_user_seconds - number of seconds to ban user for (see previous filed)
  37. dcc_send_timeout - time in seconds considered as timeout if nothing has been transferred via DCC
  38. irc_bot_flood_bytes - maximum number of bytes to send to IRC sever (PRIVMSG or NOTICE) to prevent flood
  39. irc_bot_flood_seconds - number of seconds to live entry in flood history to prevent flood (see above line)
  40. irc_bot_flood_lines - maximum number of lines (commands) to send to IRC server to prevent flood (see above 2 lines)
  41. 127.0.0.1_dcc_user - name of user, who is considered as it, when it is connecting from loop-back IP address to DCC server (either IPv4's "127.0.0.1", and IPv6's "::1").
  42. msg_force_secure_lines - maximum number of lines of message stored in filesystem. If number of lines is greater than this value, the message will be forced to set flag SECURE, to prevent flood, thus user need to connect via DCC CHAT to read it.
  43. irc_bot_flood_other_seconds - Number of seconds to wait for bot when sending for example WHOIS and MODE commands to prevent flood.
  44. try_reverse_lookup - if set to 1 (one), bot tries to use reverse lookup DNS resolution, if some user has as host obtained from IRC server IPv4 address instead of DNS name - it helps to bot identify user, even if IRC server accidentally could not perform reverse lookup successfully.
  45. important_ident_daemon - if set to 1 (one), when bot detects that it could not bind socket for IDENT daemon, it will not connect to IRC server, until socket could be bound.
  46. compress_mode_wait - number of seconds to put each mode (except of +/-b, e, I) to queue for, to "compress" modes (it will not be send 2 times +o and once +v, but +oov)
  47. smart_mode - only applicable if compress_mode_wait is non-zero. If set to 1 (one) bot will remove from queue modes that are set by other users, bots, and servers after net split, if same channel name, nick, and mode (including "+" and "-") are in the queue.
  48. send_+R - ignored for backward compatibility. Now the bot is using RPL_ISUPPORT - 005 information message to decide if to send "MODE #channel +R"
  49. dcc_chat_ping_interval - Ping message interval in seconds on DCC/telnet (not BOTNET) connection to console to help detect if user is alive, or the connection was broken without notification from IP stack. This could prevent (in theory) hung "zombie" users on partyline. Ping message interval can be set in seconds, or zero for dissable.
  50. lockout_duration - Lock out IP address for this interval in seconds. (see bellow)
  51. lockout_count - Number of unsuccessful log ins from one IP address to be considered as intruder is guessing password, so lock this IP address for "lockout_duration" seconds. (see above)
  52. dcc_max_message_size - Number of bytes as maximum size of message to other user via filesystem - helps to control memory resources. When set to 0 (zero), it is ignored.
  53. dcc_max_sessions_per_ip - Number of maximum sessions on DCC/telnet connection for one IP. Useful for defence against DoS attacks, and to save memory resources. If it is exceeded, the session with largest idle time is closed.
  54. auto_backup_interval - Number of seconds of interval to automatically backup configuration (as command ".backup" does). Zero (0) to disable.
  55. disable_ident_daemon - Set to "1" (one) if your ISP or your system runs IDENT daemon, so bot will disable its internal ident daemon emulator. Still you should use command "bot_ident" to make bot know what to pass as argument to "USER" command for IRC server. If set to "1", value of "important_ident_daemon" is ignored.
  56. dcc_always_want_nick - Set to "1" (one) if you want to force user connecting on DCC connection is required to enter their nick name (as in "logic.txt"), and then password. If set to 0 (zero), they are only required to enter password (bot recognizes them by host mask) - this was default on versions prior to 1.0.52. Security note: If it is turned on, and user types nick of someone else who don't have password set yet, bot rejects it and closes connection with error message. This is because of security reasons.
  57. irc_part_msg_on_cycle - Set there string as PART message on channel cycle (PART/JOIN to get op)
  58. irc_part_msg_on_.part_w_reason - Set there PART message on ".part reason here!" command when reason is supplied. Sub-string "%reason;" will be replaced by reason, and "%uname;" by name of user who caused it, but can be both omitted. Use "%%" sequence to replace it by single "%".
  59. irc_part_msg_on_.part_wo_reason - Set there PART message on ".part" command when no reason is supplied. Sub-string "%uname;" will be replaced by name of user who caused it, but can be omitted. Use "%%" sequence to replace it by single "%".
  60. irc_quit_msg_on_.die - Set there QUIT message on ".die" command. Sub-string "%uname;" will be replaced by name of user who caused it, but can be omitted. Use "%%" sequence to replace it by single "%".
  61. irc_quit_msg_on_.restart - Set there QUIT message on ".restart" command. Sub-string "%uname;" will be replaced by name of user who caused it, but can be omitted. Use "%%" sequence to replace it by single "%".
  62. dcc_send_chunk_size - Set size of one chunk of DCC frame in bytes when sending file to remote client. If omitted, or set to 0 (zero), the default value of 512 is used. It is always rounded off to lower multiple of 512. You can increase this value to 16384 for better speed; 512 for best compatibility.
  63. eval_script_timeout - Maximum number of seconds when executing/evaluating procedure/function (except of command/function "work"/"work()"). If not defined, or set to zero, default value of 10 seconds takes place.
  64. max_logic_backups - Maximum number of backups of "logic.txt" file. Will save then under name "logic.txt.bakXXX". If unset, or set to zero, or more than 1000, default value of 1000 will be used, that is, up to "logic.txt.bak999".
  65. rot_log - Set to "1", if you wish to rotate logs, or to zero if not. If set to "2", all old log will be kept (not deleted) and backup of old logs will be stored in directory with current date, in format "YYYY-MM-DD".
  66. log_rot_switch_time - If "rot_log" is set to "1", there is time when logs should be switched in format "HHMM", so "1505" will be at 3:05pm. Logs will be saved under module's "log/log.1" (yesterday), "log/log.2" (day before yesterday), and so on, up to "log_rot_keep_days" key's value.
  67. log_rot_keep_days - See "log_rot_switch_time" key.
  68. dcc_bind_ip_dynamic - If set to non-zero, then our IPv4 address reported by IRC server (self-WHOIS) will be used for DCC.
  69. dcc_bind_ip6_dynamic - If set to non-zero, then our IPv6 address reported by IRC server (self-WHOIS) will be used for DCC.
  70. max_array_recursion - Ignored for backward compatibility. Meaning for older versions: Maximum recursion depth while processing arrays. If not defined, or set to zero, default value of 10 takes place.
  71. max_proc_recursion - Ignored for backward compatibility as of version 1.1.beta11. Meaning for older versions: Maximum recursion depth when executing procedure. If not defined, or set to zero, default value of 10 takes place.
  72. max_eval_recursion - Ignored for backward compatibility as of version 1.1.beta11. Meaning for older versions: Maximum recursion depth when evaluating expression in function. If not defined, or set to zero, default value of 10 takes place
  73. eval_stack_size - Number of stack frames in evaluation procedures and functions. Value of 200 is reasonable enough. Note, that this is NOT number of recursion depth, because iterative evaluation needs some extra stack frames to work. If not set, or set to "0", it defaults to 200.
  74. time_offset - Local timezone offset. If you are in zone GMT+2, set to "+0200", for GMT-6 and 30 minutes set to "-0630".
  75. umask - Unices: If this key is not present at all, default umask(077) will be called at bot startup. If value is 'x' or 'X' (e.g. "umask=X"), umask will not be called, so it will be inherited from calling software (e.g. shell, or cron daemon). Third case is, value as octal number, and it will be set on bot startup.
  76. log_cumul - set to 1 (one) if you want to log messages all messages from all logs into "logs/cumul.log" - a cumulative log. Useful for debugging/bug reporting, where order of entries in all log files is important.
  77. sendmail - First appeared in version 1.1.beta28. This bot requires its own binary program, which was formely called "sendmail(.exe)". To resolve ambiguinity with standard *NIX's program called "sendmail", it was renamed to "vdc_sendmail(.exe)". This setting contains path relative to directory from where bot was ran (i.e. bot's root directory) to its own vdc_sendmail(.exe) program, used for sending an e-mail. On *NIX, this could be such as "./sendmail/vdc_sendmail", for Win32 ".\sendmail\vdc_sendmail.exe" - you can use forward slashes ('/') on Win32, they will be converted to '\'. It is required for directory "sendmail" in bot's root to exist, since there will be placed temporary files with SMTP messages. If not defined, on *NIX defaults to "./sendmail/vdc_sendmail", on Win32 ".\sendmail\vdc_sendmail.exe".
  78. dcc_disable_reverse_ip_check - First appeared in version 1.1.beta31-cvs7. Some networks implement IP cloaking ("+x" user mode). If you set this to non-zero, bot will accept DCC requests event if reverse DNS query will not agree with IP address of sender of DCC invitation. If set to 0 (zero), bot will reject request if IP address doesn't match, which is better for security reasons.
  79. sys_startup_script_timeout_protect - First appeared in CVS pre-release 2008-06-16 after version 1.1.beta31. If set to non-zero, the bot will ignore "eval_script_timeout" timeout in call to module's "_sys_startup" procedure/function and its sub-sequent calls if it occurs. E.g. for core module, on heavy-loaded machine this can occur and causes bot to shutdown itself. Set to non-zero to protect against this case to improve stability, but beware of infinite loop in module's startup script!

Quick start

You should start with this logic.txt file:


Botnet and replication

Botnet are two or more bots (of same vendor) connected together.

Compatibility note: VooDoo cIRCle version 1.1.x series are not linkable with 1.0.x series, because we wanted to get rid of stolen non-GPL'ed code for rle encoding. In 1.1.x series we use zlib compression library, which is GPL-compatible.

Basic knowlegde:

replication PUSH - means that this bot will push this object to another bot if it has an old version of object

replication PULL - means that this bot will request other bot to get object from it if it has a newer version of object

replication PUSHPULL - means that this and another bot will check who has newer version of object, and, if needed, it will be replicated

In order to replicate object (an user, procedure, channel definition, or private section), one bot need to be PUSH, the second PULL or PUSHPULL, or vice-versa, or both PUSHPULL.

Example to add to logic.txt file of bot1:

and bot2:

You can also add line:

replication bot_name push

to procedures, channel definitions and private section. Note that the other bot needs privileges, such as "access_to_+user 1" to add a new user. Since version 1.0.26, the remote bot needs to have locally flags "access_usage_procedure" on procedures which are assigned to user's on_XXX events; if event has already assigned procedure, it needs also this flag for old assigned procedure. Also, since version 1.0.26, remote bot needs to have also flag "access_grant_can_send_unknown_users 1" in order to change from "can_send_unknown_users 0" to "can_send_unknown_users 1", or vice-versa, to existing user, or to set to "can_send_unknown_users 1" to new user in process of creating/updating new/existing user.

You must also set password for this bot in pass.txt encoded via MD5 algorithm, and set it also to remote bot itself. You can use ".chpass" command on DCC/telnet connection, if you have "access_to_user" flag for that bot.

It is strongly recommended that all your bots on the botnet are connected in "mesh topology" - each one with each one. But do not connect your bot1 to link to bot2, and bot2 to link to bot1 - use only one connection to other bot. However, there is algorhitm to detect and kill these doubled connections attempts.

Example of link procedure:

and then call procedure "link_bot_once" in "_sys_startup" procedure.

There is another scenario used when we don't know predefined IP address of remote bot (DHCP), so we use for "on_join" event procedure "another_bot_join()":

 


PHP scripting (old method)

Your PHP script should look like:

Note, that you need comment lines with strings "// INIT" and "// RESULT" keep untouched, since bot will replace them with channel information. Result code, that will be processed by php preprocessor will look like this:

The bot processes the output of PHP script (stdout pipe). So the result should look like this:

Which means than on second line raw NOTICE command put to queue with high priority to put to IRC server, on next one raw message for low queue, another one, deop some nick in critical mode (the raw message is sent IMMEDIATELY to IRC server - which is not recommended, because multiple of these could violate flood rules on server, and your bot could end up with "excess flood" - should be used only for deopping and banning at critical moments). On another one, there is put log entry for channel "#channel" into logs, and on the last one, there is execution of procedure in "logic.txt" - this feature was introduced in version 1.0.14.

To modify filesystem attributes, use script that looks like:

Note that you need use doubled escape characters in NotifyUserMessage and NotifyOwnerMessage messages, so "\n" should be "\\n" in order to bot process it correctly, because "\n" will generate new line.

See section about filesystem too.


PHP scripting ("php_2" method)

Your PHP script should look like:

Note, that you need comment lines with strings "// INIT" and "// RESULT" keep untouched, since bot will replace them with channel information. Result code, that will be processed by php preprocessor will look like this:

The bot processes the output of PHP script (stdout pipe). So the result should look like this:

Which means than on second line raw NOTICE command put to queue with high priority to put to IRC server, on next one raw message for low queue, another one, deop some nick in critical mode (the raw message is sent IMMEDIATELY to IRC server - which is not recommended, because multiple of these could violate flood rules on server, and your bot could end up with "excess flood" - should be used only for deopping and banning at critical moments). On another one, there is put log entry for channel "#channel" into logs, and on the last one, there is execution of procedure in "logic.txt" - this feature was introduced in version 1.0.14.

To modify filesystem attributes, use script that looks like:

Note that you need use doubled escape characters in NotifyUserMessage and NotifyOwnerMessage messages, so "\n" should be "\\n" in order to bot process it correctly, because "\n" will generate new line.

See section about filesystem too.


PERL scripting

Thanks to Varun, who ported PHP API library to PERL, we use PERL script as external script for scripting.
Scripting is very similar as "php_2" method for scripting. See that section for more informations.

Your script should look like this one:


Note important comments "# INIT" and "# RESULT" which will be replaced by bot with initialisation and termination code. They need to be there exactly as shown above, on single line. Resulting script which will be passed to PERL processor will look like:


DCC / telnet commands

When you are connecting via telnet, you MUST enter your "nick name", it is the name from "logic.txt" (user "your_name_here"), but it is case-sensitive, so "MyNaMe" is NOT the same as "myname"!

Note: Every command MUST begin with dot ("."), in other case, if you are on a partyline channel, it will go to the partyline chat.

  1. .help

    Displays list of these commands.

  2. .whois <name>

    Displays parameters for user as known in logic.txt (under user "your_name_here")

    Examples:

    .whois your_name_here

    .whois your*

    .whois *name*

  3. .+user

    Adds new user. You need enough privileges (access_to_+user).

  4. .edituser

    Use this for editing an user. You need enought privileges (access_to_group XXX, and that user must be member of group XXX)

  5. .+proc

    Adds new procedure. You need enough privileges (access_to_+proc).

  6. .editproc

    Use this to edit a procedure. You need enough privileges ("access_to_group XXX", when procedure/function is member of group "XXX")

  7. .editchan

    Use this to edit channel definitions.

    You need enough privileges (access_to_channel)

  8. .+chan

    Use this to add a channel definition.

    Tip: You can make templates since version 1.0.54 with this command. Just make unused dummy channel (for example "my_channel_template" - you can ommit '#' hash symbol, as it is template), and you can derive settings from existing channel (if you have proper rights on that channel, procedures, groups, etc), or from this template. Template is like ordinary channel, so it can be freely replicated to other bots on BOTNET (if you set so).

  9. .quit

    Closes DCC / telnet connection.

  10. .backup

    Saves configuration to logic.txt

    Note: This command should be followed by ".rehash" to make changes affected.

  11. .rehash

    Rehashes configuration (reloads logic.txt)

  12. .filesystem

    Enters the filesystem.

    Note: You need to have privilege ("access_to_filesystem").

    See section filesystem.

  13. .msg

    Use this to store message in filesystem for another user

  14. .getfile <filename> <optional_dcc_group>

    Gets file from filesystem.

    Note: You need to have privilege ("access_to_filesystem").

    The last parameter is optional, and indicates which DCC server to user (see dcc_server command for details).

    Examples:

    .getfile abc.txt

    .getfile sound.mp3

    .getfile abc.txt 1

    Note: Name of the file is case-sensitive!

    See section filesystem.

  15. .partyline <partyline_channel_(optional)>

    Enters the partyline channel.

    Examples:

    .partyline
    (Enters partyline channel "partyline")

    .partyline my_channel
    (Enters partyline channel "my_channel")

  16. .leave

    Leaves a partyline channel.

  17. .restart

    Restarts a bot.

    Note: The bot MUST be invoked by service, in order to run again. In other case, it simply dies.

    Note: You need privilege "access_to_restart".

  18. .die

    Causes the bot to die.

    Note: You need privilege "access_to_die".

  19. .+group <groupname>

    Adds a new group of name <groupname>.

    Tip: Always do this before you add a new object (user, procedure), in order to put it to a new group!

  20. .private

    Edits a private query messages for bot.

    Note: You need to have privilege "access_to_private".

  21. .replication

    Edits a replication parameters for objects.

    Note: You need to have privilege "access_grant_replication".

  22. .terminator

    Puts / removes user to / from terminator.

    Note: You need to have enough privileges ("access_to_group XXX", and that user must be member of group XXX).

  23. .lang

    Changes current bot's language for current DCC / telnet connection.

    Note: There is only english ("en") supported yet. I am searching for localizers! :-)

  24. .part

    Parts (leaves) a channel, as first parameter is channel name and, optionally, following with reason

    Examples:

    .part #channel

    .part #channel just testing :-)

    Note: You need to have access_to_channel privilege on that channel.

  25. .join

    Joins a channel as first parameter and, optionally, followed by channel key (if the channel is +k for key, this can be omitted, so bot will try every key that has in the key history for that channel)

    Example:

    .join #channel

    .join #channel this_is_key

    Note: You need to have access_to_channel privilege on that channel.

  26. .rproc

    By typing this command you can edit list of another bots on BOTNET wheter they can call procedures remotely. At default it is dissabled on all procedures. You'll get list of procedures of those you have access to (if you have "access_to_group XXX", then procedure/function need to be member of group "XXX") to select one, and then you can edit list of bots for it.

  27. .upgrade

    This command has been introduced in version 1.0.20. It is for safer upgrading of your bot. Place new executable binary of new version into directory "upgrade", with name of file that doesn't contain space character. As a first parameter to this command use name of that file (plain, just a file name, not path!). At this moment bot will close any listening sockets (in order to new instance of bot could bind/reuse them), and in the console (the old bot) will inform you if new instance of bot, that will be ran, joins channels. This is done by comparing host and full name mask associated with user (bot) with "host_bot" attribute in file "logic.txt". Also, you will be informed when new instance of bot changes its nick, or if it have received "+o", "-o", "+v", and "-v" status on channels. If this mode change has origin of the old instance of bot, note that there is queue for "LOW" and "HIGH" priorities, for example, of command "op" in "logic.txt", so if you have "compress_mode_wait" enabled, it may take that numer of seconds (or few more) from you receive information in the console to real post the mode change to server. If the new instance is not detected to join another channel (the old bot is on) for 3 minutes, the old instance is automatically shuted down. You can force shut down by command ".die".

    Note: You need to have "access_to_upgrade" privilege in order to use this command.

  28. .chpass

    Changes password. Syntax:
    .chpass <name_of_user> <new_password>

    Note: Name of user is also case-sensitive. You can change your own password; if you need to change other user's password, you need to have access_to_group privilege on group that is that user member of.

    This command sets "remote_password" - useful to change your password or password of another user.

  29. .showbots

    Shows bots that are linked to local bot, and those which were delinked (marks them as "trying to connect").

  30. .broadcastping

    Broadcasts to each connected bot ping message and shows pong's and their lag. Note that this is done by special partyline message, as you have had posted it to some channel, so bots in the Botnet are forwarding this message, thus you can get doubled results. This message is also limited by partyline flood limit setting.

  31. .execute

    Executes a procedure stored in "logic.txt".

    Example:
    .execute unban_user("#mychannel","nick!ident@host.org")

    Note: You need "access_usage_procedure" right on procedure you want to execute.

  32. .apply

    This command causes re-validation of users on channels (something like "soft rehash"), e.g. who should get +o, or +v status. For example, if you want to delegate some user to be dynamic ban editor on some channel, and you don't want to give them "access_to_backup" and "access_to_rehash" rights, they should have "access_to_apply" right and use this command to apply changes they made. See section "Good tips" for explanation why you should not to give "access_to_backup" and "access_to_rehash" rights to common users, because ".backup" and ".rehash" in reverse order could be dangerous.

    Note: You need "access_to_apply" right in order to use this command.

  33. .pass

    This commnad lets you modify file "pass.txt".

    Syntax:
    .pass <name_of_user>

    Note: You need "access_to_group" right in order to use this command.

  34. .stat or .stats

    This command displays statistics.

  35. .touch

    This command updates "last_changed" attribute on objects to current time. It is useful to use it to force BOTNET replication.
    Example syntax:
    .touch *abc*
    It has one argument, mask of objects. Mask is matched against users, channel definitions, procedures, and functions. Also private definition can be matched, it has magic name "PRIVATE" (note the upper-case). So when you say ".touch PRIVATE", or ".touch P*TE", it affects private definition.
    Note that this command affects only object that you have access to (you need access_to_group to group of which objects are member of). It also displays list of affected objects.
    Note if you have procedure "procedure abc($test)", the mask is matched against full declaration, so you can affect this procedure by ".touch abc(*". You can use wildcards "*" for zero or any number of characters, "?" for one mandatory character, or "#" for one numeric character.
    Note that if you intend to force BOTNET replication, issue ".apply" command after ".touch <mask>" to let your local bot know that it should begin to process new configuration rules (with "last_changed" attribute updated by ".touch").
    Note that if any object is not member of any group (i.e. procedure doesn't contain any "member_of_group <group_name>", or functions deosn't contain any "#member_of_group <group_name>" attribute, you don't have access to it at all, even if your user's definition contains 'access_to_procedure "*"', so ".touch" command will not affect them (this is truth for other commands as well).

  36. .info

    This command displays basic informations about state of your bot, such as current nickname and PID (process ID). Also, it displays name it has from logic.txt and conf.txt, which should be identical (case-sensitive) in order to BOTNET work correctly.


Notes about delegation of some user to maintain their channel

You can delegate some user to maintain channel. It is done by access right of course. You should use command/function "get_event_id" and check, for example in "on_privmsg" handler if it contains string "on_privmsg", in order to make sure that delegated user have not assigned this event to some other procedure/function, which could be harmful. Since version 1.1.0, there is check before event handler is called, that handler have at least number of arguments as specified. It is because delegated user could, for example, assign event handler with predefined $channel argument to something else (constant string), and thus do harm to channels that he should not have access to.

Compilation

Please, see text files in source package distribution in direcotry

docs/compile/*.txt
for platform-specific build steps.

Filesystem

There are in the filesystem stored messages and files.

Files and messages are these attributes:

  1. Inernal name (this is name of file stored in the filesystem, it is only for internal purposes)

  2. Public name - this is original name of file from user who sent it, and it is representing the public name (.getfile <public_name> command). For case of message, this is the subject of the message.

  3. Subject of the message (see Public name)

  4. Time - timestamp of creation of the object.

  5. Published - internal flag, indicating that the user who uploaded the file has set attributes.

  6. Complete - internal flag, indicating that user has successfully uploaded the file via DCC SEND, or if file is not complete, thus user will be notified that it should try apply DCC RESUME, or DCC SEND to overwrite the file and upload it again.

  7. Expiration - timestamp when will be object discarded.

Access attributes of the object:

  1. OWNER - this flag is set if the user is owner, thus have right to delete object, or set attributes, and an expiration. Note that there can be multiple owners for one object.

  2. READ - this flag is set if user can read the message, or download the file via DCC SEND.

  3. DELETE - this right gives user right to delete the object from the filesystem.

  4. SECURE - this flag is set if authentication before download the file / read the message is required (user is notified that it must connect via DCC CHAT, authenticate by password, and then it gets thru). Note, that there is "conf.txt" file, which contains value for key "msg_force_secure_lines", so if number of line of this message excess this value, message is automatically flagged as SECUREd, to prevent bot from flooding the IRC server with PRIVMSG.

  5. NOTIFY_OWNER - this flag is set if owner(s) is (are) notified if someone have read the message or downloaded the file.

  6. NOTIFY_USER - this flag is set if user who has READ permission should be notified to download file, or the message will be sent to them, or if there is SECURE flag set, it will be notified that it should connect via DCC CHAT and read the message.

Every object also has set of events, saying such as "user was notified according to flag NOTIFY_USER", "user has read the message", or "owner was already notified about someone has read message / downloaded the file".


VooDoo cIRCle service (Windows(TM) only)

Installation of service:

  1. enter directory with file "vdcsvc.exe"

  2. run command "vdcsvc.exe -install"

Configuration of service:

Configuration file must be stored in "C:\vdc.txt"

Contents of this file:

  1. First line is a path, where is located file "irc_bot.exe" and configuration files

  2. Second line is a number of seconds to wait to run the bot, after the service has started. (This allows you to run more bots, avoiding IDENTD server conflicts).

  3. Third line must contains only . (a dot)

  4. Fourth line is path to next bot (as step 1.).

Example:

This example runs two bots.


File "pass.txt"

Since version 1.0.57, file "pass.txt" will be rebuit to new structure.
There is exampe of file


Keys used:
  1. botnet12_compatibility - "0" or "1". Set to "1" (one) if this user is remote bot of version 1.0.56 of below, that is BOTNET protocol 12 and below. In this case, keys "local_password" and "remote_password" must contain same value, and old-style authentication will be used. If it contains "0" (zero), new style of authentication will be used, so remote bot's password need not to be same as local password, so it resolves security issue of knowing local bot's password on remote side.
  2. disabled - "0" or "1". If set to one, this user/bot cannot log in. It is strongly recommended to disable user account of your bot for security reasons (because it is impossible for your bot to authenticate at itself).
  3. local_password - contains local password (hashed with MD5) to use for authentication on remote side of BOTNET connection - unused for common users.
  4. remote_password - contains password (hashed with MD5) to expect from remote bot connection to use.
  5. use_ssl - Set to "1" (one) if remote bot should use SSL, and proper entries should be configured in file "ssl.txt". Can be used for common users too (there is GUI sub-project XTelnet that is able to connect via SSL). Note that if set to "1", any attemps to use non-SSL connection will be refused for this user/bot.
  6. zlib_level - Sets compression level of OUTgoing packets for BOTNET. "0" for no compression, "9" for best (but slower). Note, that we need to accept any compression level of incomming packets, so if you want to save your incomming bandwidth, contact administrator of remote bot to set this flag. We can only control compression level for outgoing packets. Compression is done by zlib library.
In example above, section "[username]" is for common user with name "username", "[your_bot]" is name of your bot (note that this account should be disabled for security reasons), and "[another_bot]" is name of another bot. On side of "another_bot", there should be values of local and remote passwords exchanged.
Use command ".pass <name_of_user>" to change these values on DCC/telnet connection. You need to have "access_to_group" right on user's group you want to modify.
New style of authentication resolves issue, that remote bot can discover your bot's password. Now password is sent in ireversible encryption, so it cannot be discovered. Only if remote party really knows password (hashed), communication can begin. Or better said, both parties need to know remote password. Also, you can specify password for each bot separately. However, it is recommended that you set up SSL communication with your own CA (certification authority) and your own certificates for better security. See chapter about SSL.

SSL: ssl.txt file

There is possibility for these bots on BOTNET to talk via SSL to each other. Here is sample file describing certificates:

Note: All certificates must be in PEM format.

This means that bot will accept ONLY connecting client's certificate issued by CA's with its certificates stored in file "cert\CAs.crt" passed one by one.

As Telnet Server, it uses as server's certificate chain and key files "cert\server.crt" and "cert\server.key" respectively.

As a client connecting to other bot, it will use certificate chain and key files "cert\client.crt" and "cert\client.key" respectively.

"[abc]" section means, that when remote bot with name "abc" (from logic.txt file) connects, it will be checked against file "cert\abc.crt" (against its SHA1 hash) - this client should use this certificate.

The last section shown is for connecting to SSL-enabled IRC server. As IRC client, bot will use these client's certificate and private key. Note that you need to add server's certificate chain to file defined under key "accept_ca_certs". See command "irc_server_ex".

  1. (only valid for SSL-enabled IRC server section) If "disable_ca_verification" is set to "1", you don't need to add server's certificate chain to file defined under key "accept_ca_certs" (which is useful for security reasons). Also, "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE" and "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN" errors will be ignored in this case (for OpenSSL), and "GNUTLS_CERT_SIGNER_NOT_FOUND", "GNUTLS_CERT_SIGNER_NOT_CA", "GNUTLS_CERT_INVALID", for GnuTLS. If not present, defaults to as thought it were set to "0".
  2. (only valid for SSL-enabled IRC server section) Key "server_cert" is path to file of expected IRC server's certificate. You can use "--get-ssl-cert" command-line option to retrieve certificate of IRC server. See documentation here. If not present at all, or set to an empty string, bot accepts any certificate (which is not secure in case of DNS forgery attack).
  3. (only valid for SSL-enabled IRC server section) If key "ignore_expired_cert" is set to "1", bot will ignore such errors as certificate has expired, or was not activated/valid yet. Useful for broken IRCd's confinguration. If not present, defaults to as thought it were set to "0".

Important security note: You should ALWAYS generate your own certificates, and/or certificates of your own Certification Authority due to security reasons. You should use default ones in distribution only for testing.

Something about differences between "telnet_server" and "ssl_server". "telnet_server" can accept remote users and bot connections. Bot first send its name, and if it has locally configured SSL, then socket switches to SSL mode. This is not so secure, as intruder can change bot's name in network packets. Hack will end up by error, if he change name of bot to some other bot's name, the certificate of remote bot will not match defined certificate; if he change it to existing user, connection will not be locally switched to SSL, but only remotely, which will end up by SSL error on remote side, and reconnection; if he would change it to non-existing user, it will end up by disconnection. While "ssl_server" is pure-ssl-enabled socket, so there can connect users or bots via SSL from the beginning of connection, which is more secure. This feature was added in version 1.1.beta16, and you can use XTelnet subproject to connect as SSL client. Note, that you need to have enabled SSL in "pass.txt" and set proper certificate in "ssl.txt".


MOTD: Message Of The Day motd.txt file

There could be "motd.txt" file (in the root of bot, i.e. the same directory as core module's config files), which is copied to console when user successfully logs-in on DCC/telnet interface. This feature was there since first release, but it was forgotten in this documentation.

Character case mapping issues

In version 1.1.beta27 case mapping behavior has been adjusted.
In procedures, commands such as "match_case_insensitive" are now using case mapping reported by IRC server in RPL_ISUPPORT (005 numeric) message. This can be either "ascii", or, on some IRC implementations "rfc1459".
RFC1495 maps upper case characters []\^ to lower case {}|~ (even mapping ^ to ~ was forgotten to mention in RFC).
On DCC/telnet interface, there is always ASCII mapping, as it was in recent versions. In built-in functions, there is ASCII mapping as it was in recent versions, except for "strtolower" and "strtoupper", where you can now explicitely specify case mapping to use as optional second argument.
In matching of masks, e.g. bans and user's masks, case mapping reported by IRC server is now used.
If IRC server will not specify case mapping, on bot's initialization it defaults to ASCII, after reconnection, it is case mapping specified by last IRC connection.

CLI - command line interface

Command-line options as follows:
-h or --help prints out supported options.
-v or --version prints out ONLY version, then exits.
-i or --interactive runs in interactive mode (opposite to --daemon) - default on win32
-d or --daemon runs in background, returns to shell (opposite to --interactive) - default for non-win32, not applicable in win32.
--eval-test-1 runs bot's self test. Return code is zero if no error were encountered.
--get-ssl-cert expects 3 following arguments: local address to bind to (either IPv4 and IPv6, you can use widlcard "0.0.0.0" or "::" respectively, to let kernel discover the right local address according to routing tables), second is remote SSL (IRC+SSL) server host, and third is TCP/TCPv6 port. This command retrieves certificate of remote peer, and in case of return code zero, ehoes it to console, in other case an error has occurred and error string is ehoed. Example:
./src/irc_bot --get-ssl-cert 0.0.0.0 ssl.irc.example.org 7000 > ./cert/ssl.irc.example.org.crt
(above example is for unices, but equivaltent for Windoze can be used as well; get certificate of IPv4 server ssl.irc.example.org running on port tcp/7000)
.\src\irc_bot.exe --get-ssl-cert :: ssl.irc6.example.org 7000 > .\cert\ssl.irc6.example.org.crt
(above example is for Windoze, but equivaltent for unices can be used as well; get certificate of IPv6 server ssl.irc6.example.org running on port tcp/7000)

File "logs/irc_bot.action"

There is special file in directory "logs" of core (main) module, called "irc_bot.action". This file was originally implemented to comunicate with control service under Windows(TM). This file not really exist, however, if bot finds out that it exists, it is read for command and then deleted immediately. Here is list of allowed commands:
  1. die
  2. restart
  3. rehash
  4. flushdns
Commands "rehash" and "flushdns" were added in version 1.1.beta17. Command "flushdns" causes the internal DNS cache to be flushed (each DNS request result is cached for time of 2 hours, then it expires; this can be tuned in file "params.h", seek for "DNS_CACHE_VALIDITY" preprocessor define).

You can use this command to control this file on *NIX:

echo 'rehash'>logs/irc_bot.action
and on Windows(TM):
echo rehash>logs\irc_bot.action
Of course, under Windows(TM) you need to use backslash in path.

Also, make sure you will not include a space character between command (e.g. "rehash") and redirection character (">"). Bot expects the command followed by EOL sequence in this file, where EOL sequence can be '\n', '\r', '\n\r' or '\r\n'.


Good tips

  1. When you creating new user, ALWAYS put them to group that you have "access_to_group" privilege, or you will not have access to them!

  2. On DCC / telnet connection, you should type ".help" command to get available commands. Note, that you would not have access to some of them, unless you set it "logic.txt" or (if you have privileges) via DCC / telnet.

  3. Always do ".backup" and then ".rehash" on DCC/telnet connection, not in reverse order, because ".rehash" flushes current configuration and reloads it from file "logic.txt" and you could lost your changes. You can consider using ".apply" in combination with "auto_backup_interval" attribute in "conf.txt" file


Security notes

In multi-user environment, please ensure that bot's root directory (and sub-content in it) is only accessible by you. It is YOUR job to set correct permissions on filesystem level. Bot will never access files outside (to upper level) of bot's root directory, that is, current working directory in the moment the bot has been ran (except for "ssl.txt" file that defines certificates for SSL; however, this file can't be edited via DCC/telnet, so there is no concern about security).

In the distribution, there are sample SSL certificates and keys, please, use these files only for testing purposes, e.g. only on secure LAN, not to be accessible by internet. You should generate your own certificates and keys either of your own certification authority, bot(s), and users. There is great cross-platform project called "xca" (search the google) for these purposes.

Let your users know that their passwords should be long enough, say more than 10 characters, and (at least) not to be able to crack them with dictionary method. Of course, almost all dictionaries used for these purposes have built-in leetspeak (1337-speak), so do not use it either. The only moment when geek is not using leetspeak is when they type their own passwords.

Set password lockout policy to be reasonably restrictive.

Read the logs often. Backup and archive logs for later analysis.

On unices, there can be problem if you are reading logs from IRC on text console. Some messages from some users can contain control characters which can confuse your terminal, or, in worse case, exploit (potential) security bug in your terminal client software implementation. I strongly recommend using this command to read logs:

cat logs/irc.log | tr -c [:print:]\\n \? | less
which pipes output of cat'ed log file to "tr" - standard POSIX transliteration tool, which replaces all non-printable characters except new line character by '?' character, and pipes output to "less" tool - or you can use another favorite pager tool of course.

Signal handling (unices and Win)

Unices:

On systems where process can handle signals, bot ignores most of them, or, at least logs them to log. There are several signals that are handled in a special way:

SIGTERM, SIGHUP: Bot starts shutdown/die sequence.

SIGINT: Bot starts shutdown/die sequence. If this signal arrive again (e.g. another Ctrl+C), bot exits immediately, without finishing the gracefull shutdown.

SIGUSR1: Bot will do rehash of configuration files.

Win:

On Windows(TM) we have no signals, but API allows callback function to be set that acts like a signal handler on unices, in case of console application.

CTRL_C_EVENT, CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_SHUTDOWN_EVENT: User pressed Ctrl+C, or Ctrl+BREAK, or user clicked on 'X' button of console window, or the system is going down for system shutdown, respectively: bot starts shutdown sequence/die. If any of CTRL_C_EVENT, CTRL_BREAK_EVENT, or CTRL_CLOSE_EVENT signal is signalled again (i.e. twice), bot exits immediately, without finishing the gracefull shutdown.

CTRL_LOGOFF_EVENT: User is logging-off: bot ignores this signal, because there is no guarantee of which user is actually logging-off.


FAQ's

I hope, that this section will contain more information later, since this is the very first release.

Q: How can I delete user?
A: You cannot delete user, because of simple reason. When you would delete user, another bot in the botnet would find out, that bot on which you have deleted an user doesn't have this user, so the replication would cause to user exist again. Instead of deletion, you should use command ".terminator" in DCC / telnet connection, and set user as "terminator". Bot will flag this user as terminator, and update its last_changed value, so the record (with terminator flag) should replicate to all bots. If an user is "terminator", it tells the bot to silently ignore them at all, but it still exists in the database.

Q: Which host masks/wildcards are supported?
A: You can use wildcard "*" to match any or zero number of characters, "?" to match one character, or "#" to match one numeral character (0-9) for nick, ident, or host. You can match host by CIDR notation, but in this case, you can't use wildcards in host part. If host mask is for instance "*!ident@0:0:0:0:0:ffff:10.0.0.2/120" (any nick, "ident" as ident, and IPv4-mapped address "10.0.0.2" with CIDR 120 bit long) will match users with any nick, "ident" as ident, and IPv4 address "10.0.0.x", where "x" is any number (0-255). So you can freely use IPv6 addresses, or IPv4-mapped IPv6 adresses, as well. IPv4 addresses, given by IRC server, or you, will be converted to IPv4-mapped IPv6 address first. Another example for host mask is "nick!ident@10.0.0.#", which match user with "nick" as nickname, "ident" as ident and IP address "10.0.0.x", where "x" stands for any one numeral character (0-9). For your consideration: It should be better for this instance to use host mask "nick!ident@10.0.0.0/24", which means that "x" can be number in range 0-255. You can also specify wildcarded host name in the mask, such as "*!ident@*.net". If you specify exact host name, such as "*!ident@host.net", the bot will try to resolve it to IPv4 address, and then, if succeed, convert it to IPv4-mapped IPv6 address and then check for match. Remember: Do not mix both CIDR notation and wildcards in host name part of host mask, so host mask "*!ident@10.0.*.23/24" is wrong.

Q: Does IPv6 host masks for IPv6 IRC users work even bot is not compiled with IPv6 support?
A: Yes, it works. IPv6 support in VooDoo cIRCle is experimental, and fact that it is compiled with this support means only that you can use IPv6 socket for telnet user/bot connections. There is also IPv6 connection to IRC server, and DCC CHAT/SEND thru IPv6 as well. However, if the bot is not compiled with IPv6 support, DNS resolving of IPv6 host (needed to satisfy host masks) will not work.

Q: How could I compile bot with IPv6 support?
A: Define global preprocessor directive:
#define IPv6
or un-comment that one in file "params.h", but do not touch directive INET6 in match.cpp, because this code is hacked from ircd for IRCnet, and it is only for matching IPv6 host masks, not for IP traffic, so it must be defined to work properly.

Q: There is feature that supports recognition also by their "full name mask". Can I turn it off?
A: The full name is field in the WHOIS command, initally set by USER command at IRC protocol authentication. In some IRC clients it is "real name" field in connection dialog. If you don't want to use this feature, you can simply set for particular user full name mask of "*" wildcard, so it will match any full name.

Q: How can I compile this bot?
A: See documentation for your platform in the source package in direcory "voodoo_circle-src/docs/compile/".

If you have some questions, feel free to send me a mail to ghostvoodooman [NOSPAM] (at) [NOSPAM] users (dot) [NOSPAM!] sourceforge (dot) net. (Please use "VooDoo cIRCle" as the subject, so I will know that it is not a spam).


Additional information

This IRC bot was developed and tested on Windows(TM) 2003 Server(TM) (Athlon(TM) XP 2400+), Windows(TM) Vista Ultimate 64 bit edition, Gentoo Linux(TM) kernel 2.6.x (Intel(TM) 32 bit 2 x 800 MHz SMP), Gentoo Linux(TM) kernel 2.6.x (Intel(TM) 64 bit 4 x 2 GHz SMP Xen virtualization), using these compilers:

I can't recall all versions of GCC that I was using on Linux(TM) platforms, but it were from 3.x to 4.x series without any compile problems/errors, nor erroneous code generation.

Successfully tested on IRCnet, UnderNet, UnrealIRCd.

I am now searching for "porter developer" who could port this bot to other Operating System(s). I am also searching for localizers, who could localize file "lang01.txt" to other languages. If you are, or you know some, please, send me a mail.


How to report a bug

If you are *REALLY* sure you found a bug, that assumes you checked the documentation twice, tripple *and* more times, and you are really *SURE* it is not bug in you script or configuration, then you should send a bug report.

If bot crashes, or you are seeing unusual error messages in logs like e.g. "assertion failure" or "intenal error", then you do not need to check documentation, because such crash or error is really *SERIOUS* bug which should not happen in any case, nor in case of your mistake, or even typo in script/configuration files. In this this case, you should include a core dump. On Windows(TM), please use official builds, as generated "minidump" (as Microsoft(TM) call the core dump) is bound to my sources and debugging informations of my build, so I can trace the possible sources problem.

On UN*X platform, like Linux(TM), in this example I will use "bash" shell, use command like this, or equivalent command in shell program you are using, before starting the bot:

$ ulimit -c 204800 ; echo "RESULT CODE IS: $?"
This command enables core to be dumped, at maximum of 200 megabytes (which should be enough). If you get an error message from this commnad, or message printed says that result code is other than "0", please consult administrator of the shell server regarding of enable of core dump files and/or increasing of their limit size for your account to 204800 kilobytes (after this procedure, you need to login again to gain a new shell session).

Please, enable "cumul.log" and send it to me with along with bug report, and possibly, strip off any passwords or other private informations from that log. Also, if the bot is compiled with HEAP debugging, and generally with debugging support (both are strongly recommended, but slows down the bot about two times in execution of built-in "functions" scripting in your scripts), send me also log file with file name such as "debug.2536.2008-08-19T06-09-46+0000.log", where number "2536" is PID (a number identificator of bot's process). If you have more files like these in "logs" directory, look into "cumul.log", there is string in my case "[2008-08-19T08:10:49+0200] [IRC ] [668] [2536] :OUT :PING :1219126249" and there is the same PID that matches bot's PID, so you should send log file that corresponds to case of bug/crash of bot. There is also file called "irc_bot.pid" which is removed when bot dies gracefully; if it has crashed, this file is not removed - so there you can find in this file PID number of bot instance that crashed in case of crash.

In case of error occurred in other module than "core" module, send me also logs of that particular module as well. Bot's "core" module logs are located in root directory of bot, that is current working directory in time when bot was ran, in subdirectory "<bot_root>/logs". In case of another than "core" module, it is "<bot_root>/modules/<name_of_module>/logs". If you are using your custom not-ordinary module, I mean your custom binary module, please, tripple check your code and send me sources along with information how to reproduce the bug.

Please, always include informations like what you were doing when an error occurred, and please, please, try to reproduce the bug, and send me these informations as well. "cumul.log" file, file with such name as "debug.2536.2008-08-19T06-09-46+0000.log" and a core dump (on Windows(TM) "minidump" with ".dmp" extension in bot's root directory), and informations about how to reproduce the bug are very welcome.

Security issues about core dumps: All passwords that users type while logging into DCC/telnet/ssl-telnet are overwritten by an 'X' character in the memory instantly after they are not needed, either on successful or unsuccessful authentication. However, SSL private keys are always stored in memory (because of limitation of OpenSSL/GNUTLS libraries used), so they will be included in the core dump. After sending me a cure dump, please, change all SSL keys for your security's sake - even though I will not try to extract these security-sensitive informations from core dumps.

If you are not using Windows(TM) official builds, or you are running bot on some UN*X platform, please do not disable heap debugging and debugging support. When heap debugging (and generally debugging support) is disabled, memory leaks are not reported (if there are any, it is a serious bug!), and memory after bot free it is not zeroed, which means if you don't have some exotic patches to Linux(TM) kernel, such as "PaX" or "GRsec" (e.g. you are running bot on virtual Xen server), any user can read that memory after they allocate it - and it might be a security hole! E.g. it might contain your SSL private key or any other sensitive information the bot stores in the memory.

Laconic information in bug report such as "It crashed! You suck!" is completely useless. If you are not a programmer, you probably don't know that even a little, a small information that you consider irrelevant is *VERY* important to me and might help to find source of a bug and might help to fix that bug! Please be as much verbose as you can!

Please send bug report even if you feel you find a "cosmetical bug"/"cosmetical problem" (either you found workaround or not), so you can help to improve the future of bot!

One last note about logs. Read logs. Read logs often. If you read logs often, read them more often. They could include strange messages that are indicating a bug. Of course, you should not read channel logs when you were not on that channel at that moment, according to RFC memo titled Netiquette Guidelines (http://www.rfc-editor.org/html/rfc1855.html) - you SHOULD respect this memo, as you are in role of "administrator" of a bot - see the section for administrators in that memo.


Credits

At first, thank to Jarkko Oikarinen for ideas and code for first IRC protocol, and to all the people who help to develop and keep IRC alive.

I would like to thank to MacO (http://www.cw.sk/) for founding name VooDoo cIRCle, and for logo for this bot.

My thanks also goes:

To Robey Pointer, and the Eggheads Development Team for developing IRC bot Eggdrop (for inspiration).

To http://www.sourceforge.net/, and Free Software Foundation, Inc. for great ideology.

To Varun for kind help with porting PHP library for external scripts to PERL. Without him, PERL scripting would not be there.

To Pipo Krempa for kind admin support on server tarantula. He even enabled core dumps only for me, when there was security vulnerability in Linux kernel related to core dumps. Thank you very much Pipo for your support on developing of this bot.

To Pharmacy, for benzodiazepines, which are making a good mood for coding ;-) and also for Magnesium pills I am using to get energy when I'm  beginning to be overworked.

And last, but not least, to caffeine and nicotine for better (but shorter) life ;-)

Son is asking: Father? Do you think it is truth what they say that IRC, ICQ, and all those web-chats degenerate the people? Father answers: IMHO LOL.


Legal informations

Altrhrough I personally dislike these informations to be included in the documentation... I must include them.

All names can be trademarks, or registered trademarks of their respective owners.


GNU GENERAL PUBLIC LICENSE

GNU logo

Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.  
59 Temple Place - Suite 330, Boston, MA  02111-1307, USA

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.

b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.

c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

one line to give the program's name and an idea of what it does.
Copyright (C) yyyy  name of author

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
type `show w'.  This is free software, and you are welcome
to redistribute it under certain conditions; type `show c' 
for details.

The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright
interest in the program `Gnomovision'
(which makes passes at compilers) written 
by James Hacker.

signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice

Get VooDoo cIRCle at SourceForge.net. Fast, secure and Free Open Source software downloads

Valid HTML 4.01!