]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
[8-ball] move '.8-ball' file
authorbw1 <redacted>
Tue, 16 Jul 2019 21:37:33 +0000 (23:37 +0200)
committerbw1 <redacted>
Tue, 16 Jul 2019 21:37:33 +0000 (23:37 +0200)
scripts/8-ball.pl

index ddc6b8eff140c3fa20f3f36f2f59a585f07c57d0..cb8a0df78503fa02a5c385e45f439a804bcf8597 100644 (file)
@@ -29,7 +29,7 @@ use vars qw($VERSION %IRSSI);
 
 use Irssi qw(command_bind signal_add);
 use IO::File;
-$VERSION = '0.22';
+$VERSION = '0.23';
 %IRSSI = (
        authors         => 'Patrik Akerfeldt',
        contact         => 'patrik.akerfeldt@gmail.com',
@@ -38,6 +38,8 @@ $VERSION = '0.22';
        license         => 'GPL',
 );
 
+my $filename= Irssi::get_irssi_dir().'/8-ball';
+
 sub own_question {
        my ($server, $msg, $target) = @_;
        question($server, $msg, "", $target);
@@ -82,13 +84,13 @@ sub question {
                 my ($fh, $count);
                 $fh = new IO::File;
                 $count = 0;
-                if ($fh->open("< .8-ball")){
+                if ($fh->open($filename, 'r')){
                         $count = <$fh>;
                         $fh->close;
                 }
                 $count++;
                $fh = new IO::File;
-                if ($fh->open("> .8-ball")){
+                if ($fh->open($filename, 'w')){
                         print $fh $count;
                         $fh->close;
                 }else{
@@ -101,7 +103,7 @@ sub question {
                my ($fh, $count);
                 $fh = new IO::File;
                 $count = 0;
-                if ($fh->open("< .8-ball")){
+                if ($fh->open($filename, 'r')){
                         $count = <$fh>;
                         $server->command('msg '.$target.' 8-ball says: I\'ve got '.$count.' questions so far.');
                        $fh->close;
@@ -125,3 +127,5 @@ sub question {
 
 signal_add("message public", "public_question");
 signal_add("message own_public", "own_question");
+
+# vim:set ts=8 sw=8:
git clone https://git.99rst.org/PROJECT