]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Factoids/DBCommon.pl
take a few more things literally
[infobot.git] / src / Factoids / DBCommon.pl
index c672255166389215871c6009e341af8a868d4a31..1d7c4991544d731d1f6f2bacc0b87b2e8d63567d 100644 (file)
@@ -10,7 +10,7 @@
 #####
 # Usage: &setFactInfo($faqtoid, $key, $val);
 sub setFactInfo {
-    &sqlSet("factoids",
+    &sqlSet('factoids',
        { factoid_key => $_[0] },
        { $_[1] => $_[2] }
     );
@@ -19,13 +19,13 @@ sub setFactInfo {
 #####
 # Usage: &getFactInfo($faqtoid, [$what]);
 sub getFactInfo {
-    return &sqlSelect("factoids", $_[1], { factoid_key => $_[0] } );
+    return &sqlSelect('factoids', $_[1], { factoid_key => $_[0] } );
 }
 
 #####
 # Usage: &getFactoid($faqtoid);
 sub getFactoid {
-    return &getFactInfo($_[0], "factoid_value");
+    return &getFactInfo($_[0], 'factoid_value');
 }
 
 #####
@@ -33,7 +33,7 @@ sub getFactoid {
 sub delFactoid {
     my ($faqtoid) = @_;
 
-    &sqlDelete("factoids", { factoid_key => $faqtoid } );
+    &sqlDelete('factoids', { factoid_key => $faqtoid } );
     &status("DELETED $faqtoid");
 
     return 1;
@@ -43,10 +43,10 @@ sub delFactoid {
 # Usage: &IsLocked($faqtoid);
 sub IsLocked {
     my ($faqtoid) = @_;
-    my $thisnuh   = &getFactInfo($faqtoid, "locked_by");
+    my $thisnuh   = &getFactInfo($faqtoid, 'locked_by');
 
-    if (defined $thisnuh and $thisnuh ne "") {
-       if (!&IsHostMatch($thisnuh) and &IsFlag("o") ne "o") {
+    if (defined $thisnuh and $thisnuh ne '') {
+       if (!&IsHostMatch($thisnuh) and &IsFlag('o') ne 'o') {
            &performReply("cannot alter locked factoids");
            return 1;
        }
@@ -59,7 +59,7 @@ sub IsLocked {
 # Usage: &AddModified($faqtoid,$nuh);
 sub AddModified {
     my ($faqtoid,$nuh) = @_;
-    my $modified_by = &getFactInfo($faqtoid, "modified_by");
+    my $modified_by = &getFactInfo($faqtoid, 'modified_by');
     my (@modifiedlist, @modified, %modified);
 
     if (defined $modified_by) {
@@ -83,8 +83,8 @@ sub AddModified {
     }
     shift(@modifiedlist) while (scalar @modifiedlist > 3);
 
-    &setFactInfo($faqtoid, "modified_by",   join(",",@modifiedlist));
-    &setFactInfo($faqtoid, "modified_time", time());
+    &setFactInfo($faqtoid, 'modified_by',   join(",",@modifiedlist));
+    &setFactInfo($faqtoid, 'modified_time', time());
 
     return 1;
 }
@@ -98,28 +98,28 @@ sub AddModified {
 sub CmdLock {
     my ($faqtoid) = @_;
 
-    my $thisnuh = &getFactInfo($faqtoid,"locked_by");
+    my $thisnuh = &getFactInfo($faqtoid,'locked_by');
 
-    if (defined $thisnuh and $thisnuh ne "") {
+    if (defined $thisnuh and $thisnuh ne '') {
        my $locked_by = (split(/\!/,$thisnuh))[0];
        &msg($who,"factoid \002$faqtoid\002 has already been locked by $locked_by.");
        return 0;
     }
 
-    $thisnuh ||= &getFactInfo($faqtoid,"created_by");
+    $thisnuh ||= &getFactInfo($faqtoid,'created_by');
 
     # fixes bug found on 19991103.
     # code needs to be reorganised though.
-    if ($thisnuh ne "") {
-       if (!&IsHostMatch($thisnuh) && IsFlag("o") ne "o") {
+    if ($thisnuh ne '') {
+       if (!&IsHostMatch($thisnuh) && IsFlag('o') ne 'o') {
            &msg($who, "sorry, you are not allowed to lock '$faqtoid'.");
            return 0;
        }
     }
 
     &performReply("locking factoid \002$faqtoid\002");
-    &setFactInfo($faqtoid,"locked_by",$nuh);
-    &setFactInfo($faqtoid,"locked_time", time());
+    &setFactInfo($faqtoid,'locked_by',$nuh);
+    &setFactInfo($faqtoid,'locked_time', time());
 
     return 1;
 }
@@ -129,21 +129,21 @@ sub CmdLock {
 sub CmdUnLock {
     my ($faqtoid) = @_;
 
-    my $thisnuh = &getFactInfo($faqtoid,"locked_by");
+    my $thisnuh = &getFactInfo($faqtoid,'locked_by');
 
     if (!defined $thisnuh) {
        &msg($who, "factoid \002$faqtoid\002 is not locked.");
        return 0;
     }
 
-    if ($thisnuh ne "" and !&IsHostMatch($thisnuh) and &IsFlag("o") ne "o") {
+    if ($thisnuh ne '' and !&IsHostMatch($thisnuh) and &IsFlag('o') ne 'o') {
        &msg($who, "sorry, you are not allowed to unlock factoid '$faqtoid'.");
        return 0;
     }
 
     &performReply("unlocking factoid \002$faqtoid\002");
-    &setFactInfo($faqtoid,"locked_by",   "");
-    &setFactInfo($faqtoid,"locked_time", "0"); # pgsql complains if NOT NULL set. So set 0 which is the default
+    &setFactInfo($faqtoid,'locked_by',   '');
+    &setFactInfo($faqtoid,'locked_time', '0'); # pgsql complains if NOT NULL set. So set 0 which is the default
 
     return 1;
 }