changeset 261:e82ae84408ca

quotedb: Move settings/config into separate file.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 23 Jan 2015 09:47:35 +0200
parents 9300c92f0ccd
children 416642f28d1e
files config.quotedb.example quotedb.tcl
diffstat 2 files changed, 70 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config.quotedb.example	Fri Jan 23 09:47:35 2015 +0200
@@ -0,0 +1,63 @@
+##########################################################################
+#
+# QuoteDB script configuration
+#
+##########################################################################
+
+###
+### General options
+###
+# Path and filename of the SQLite database
+set qdb_file "quotedb.sqlite"
+
+# Verbosity (1 = be verbose, 0 = be quiet)
+set qdb_verbose 0
+
+
+# 1 = Enable logging of various script actions into bot's log
+# 0 = Don't.
+set qdb_logmsg 1
+
+
+# What IRC "command" should we use to send messages:
+# (Valid alternatives are "PRIVMSG" and "NOTICE")
+set qdb_preferredmsg "PRIVMSG"
+
+# Foo.
+set qdb_max_deltime 15
+set qdb_max_modtime 30
+
+
+###
+### Search related settings
+###
+
+# Limit how many quotes should the "!<cmd> find" command show at most.
+set qdb_showmax_pub 3
+
+# Same as above, but for private message search.
+set qdb_showmax_priv 5
+
+
+# EXAMPLE!
+bind pub - !quote quote_pub_cmd
+bind msg - !quote quote_msg_cmd
+proc quote_pub_cmd {unick uhost uhand uchan utext} { qdb_command "!quote" "quotedb" $unick $uhost $uhand $uchan $utext 1 }
+proc quote_msg_cmd {unick uhost uhand utext}       { qdb_command "quote" "quotedb" $unick $uhost $uhand "" $utext 0 }
+
+
+bind pub - !spede spede_pub_cmd
+bind msg - !spede spede_msg_cmd
+proc spede_pub_cmd {unick uhost uhand uchan utext} { qdb_command "!spede" "spededb" $unick $uhost $uhand $uchan $utext 1 }
+proc spede_msg_cmd {unick uhost uhand utext}       { qdb_command "spede" "spededb" $unick $uhost $uhand "" $utext 0 }
+
+bind pub - !mn mn_pub_cmd
+bind msg - !mn mn_msg_cmd
+proc mn_pub_cmd {unick uhost uhand uchan utext}    { qdb_command "!mn" "mndb" $unick $uhost $uhand $uchan $utext 1 }
+proc mn_msg_cmd {unick uhost uhand utext}          { qdb_command "mn" "mndb" $unick $uhost $uhand "" $utext 0 }
+
+bind pub - !tuksu tuksu_pub_cmd
+bind msg - !tuksu tuksu_msg_cmd
+proc tuksu_pub_cmd {unick uhost uhand uchan utext} { qdb_command "!tuksu" "tuksudb" $unick $uhost $uhand $uchan $utext 1 }
+proc tuksu_msg_cmd {unick uhost uhand utext}       { qdb_command "tuksu" "tuksudb" $unick $uhost $uhand "" $utext 0 }
+
--- a/quotedb.tcl	Fri Jan 23 09:45:52 2015 +0200
+++ b/quotedb.tcl	Fri Jan 23 09:47:35 2015 +0200
@@ -1,85 +1,24 @@
 ##########################################################################
 #
-# QuoteDB v2.1 by Matti 'ccr' Hamalainen <ccr@tnsp.org>
-# (C) Copyright 2003-2011 Tecnic Software productions (TNSP)
+# QuoteDB v2.2 by Matti 'ccr' Hamalainen <ccr@tnsp.org>
+# (C) Copyright 2003-2015 Tecnic Software productions (TNSP)
 #
 # Not for public use or distribution. If you happen to find this,
 # send your questions and/or problems to /dev/null, thank you.
 #
 ##########################################################################
-#
-#
-##########################################################################
 
-###
-### General options
-###
-# Path and filename of the SQLite database
-set qdb_file "quotedb.sqlite"
-
-# Verbosity (1 = be verbose, 0 = be quiet)
-set qdb_verbose 0
-
-
-# 1 = Enable logging of various script actions into bot's log
-# 0 = Don't.
-set qdb_logmsg 1
-
-
-# What IRC "command" should we use to send messages:
-# (Valid alternatives are "PRIVMSG" and "NOTICE")
-set qdb_preferredmsg "PRIVMSG"
-
-# Foo.
-set qdb_max_deltime 15
-set qdb_max_modtime 30
-
-
-###
-### Search related settings
-###
-
-# Limit how many quotes should the "!<cmd> find" command show at most.
-set qdb_showmax_pub 3
-
-# Same as above, but for private message search.
-set qdb_showmax_priv 5
+### The configuration should be in config.quotedb in same directory
+### as this script. Or change the line below to point where ever
+### you wish. See "config.quotedb.example" for an example config file.
+source [file dirname [info script]]/config.quotedb
 
 
 ##########################################################################
 # No need to look below this line
 ##########################################################################
 set qdb_name "QuoteDB"
-set qdb_version "2.1"
-
-
-#-------------------------------------------------------------------------
-### Binding initializations
-
-
-# EXAMPLE!
-bind pub - !quote quote_pub_cmd
-bind msg - !quote quote_msg_cmd
-proc quote_pub_cmd {unick uhost uhand uchan utext} { qdb_command "!quote" "quotedb" $unick $uhost $uhand $uchan $utext 1 }
-proc quote_msg_cmd {unick uhost uhand utext}       { qdb_command "quote" "quotedb" $unick $uhost $uhand "" $utext 0 }
-
-
-bind pub - !spede spede_pub_cmd
-bind msg - !spede spede_msg_cmd
-proc spede_pub_cmd {unick uhost uhand uchan utext} { qdb_command "!spede" "spededb" $unick $uhost $uhand $uchan $utext 1 }
-proc spede_msg_cmd {unick uhost uhand utext}       { qdb_command "spede" "spededb" $unick $uhost $uhand "" $utext 0 }
-
-bind pub - !mn mn_pub_cmd
-bind msg - !mn mn_msg_cmd
-proc mn_pub_cmd {unick uhost uhand uchan utext}    { qdb_command "!mn" "mndb" $unick $uhost $uhand $uchan $utext 1 }
-proc mn_msg_cmd {unick uhost uhand utext}          { qdb_command "mn" "mndb" $unick $uhost $uhand "" $utext 0 }
-
-bind pub - !tuksu tuksu_pub_cmd
-bind msg - !tuksu tuksu_msg_cmd
-proc tuksu_pub_cmd {unick uhost uhand uchan utext} { qdb_command "!tuksu" "tuksudb" $unick $uhost $uhand $uchan $utext 1 }
-proc tuksu_msg_cmd {unick uhost uhand utext}       { qdb_command "tuksu" "tuksudb" $unick $uhost $uhand "" $utext 0 }
-
-
+set qdb_version "2.2"
 
 #-------------------------------------------------------------------------
 ### Initialization messages