summaryrefslogtreecommitdiffstats
path: root/config-default/commands.xml
diff options
context:
space:
mode:
authorLibravatarJanik Kleinhoff <janik@kleinhoff.de>2015-09-04 03:44:40 +0000
committerLibravatarJanik Kleinhoff <janik@kleinhoff.de>2015-09-04 03:44:40 +0000
commitacdcedfa7099659be22df3dd57ec4926809dc1a6 (patch)
tree0c1c03c2e0a6c98ef9f7a8f934f2d56a86b1f46e /config-default/commands.xml
parent266be47956ae2ad397c52f26d00b88b5dc713da6 (diff)
Allow running without a database
This is mostly a workaround for the DB being a bit of a PITA to set up, but not all we do requires a DB so we might as well offer to run without one.
Diffstat (limited to 'config-default/commands.xml')
-rw-r--r--config-default/commands.xml8
1 files changed, 8 insertions, 0 deletions
diff --git a/config-default/commands.xml b/config-default/commands.xml
index 5674fac..6e12076 100644
--- a/config-default/commands.xml
+++ b/config-default/commands.xml
@@ -123,6 +123,11 @@
</command>
<command cmd="^;sql (main|log) (.*)" flag="d">
<![CDATA[
+ if (!defined $::db) {
+ $conn->privmsg($event->replyto, "I am set to run without a database, fool.");
+ return;
+ }
+
my $dbh = $::db->{DBH};
if ($1 eq 'log') {
$dbh = $::db->{DBH_LOG};
@@ -175,6 +180,7 @@
</command>
<command cmd="^;query (\S+) ?(\S+)?$">
<![CDATA[
+ return unless defined $::db;
my $channel = defined($2) ? $1 : '%';
my @nuh = split(/(\!|\@)/, defined($2) ? $2 : $1);
my $result = $::db->query($channel, $nuh[0], $nuh[2], $nuh[4]);
@@ -183,6 +189,7 @@
</command>
<command cmd="^;investigate (\S+) *$">
<![CDATA[
+ return unless defined $::db;
my $nick = lc $1;
unless (defined($::sn{$nick})) {
$conn->privmsg($event->replyto, "I don't see $nick in my state tracking database, so I can't run any queries on their info, sorry :(" .
@@ -223,6 +230,7 @@
</command>
<command cmd="^;investigate2 (\S+) ?(\d*) *$" flag="s">
<![CDATA[
+ return unless defined $::db;
my $nick = lc $1;
my $skip = 0;
$skip = $2 if (defined($2) and ($2 ne ""));