diff options
Diffstat (limited to 'scripts/watch.pl')
| -rw-r--r-- | scripts/watch.pl | 63 | 
1 files changed, 33 insertions, 30 deletions
| diff --git a/scripts/watch.pl b/scripts/watch.pl index 5fbf14e..e0a297a 100644 --- a/scripts/watch.pl +++ b/scripts/watch.pl @@ -6,6 +6,8 @@  # esta en el irc, este script solamente podra ser usado en redes  # que lo permitan, como por ejemplo irc-hispano. +use strict; +use vars qw($VERSION %IRSSI);  $VERSION = '1.0';  %IRSSI = (   authors     => 'ThEbUtChE', @@ -30,10 +32,10 @@ sub watch_list      my($nick);      local(*FILE); -    open FILE, "< $file"; +    open FILE, "<", $file;      while (<FILE>) { -	@nick = split; -	Irssi::print "Notify \002@nick[0]\002"; +	    my @nick = split; +	    Irssi::print "Notify \002@nick[0]\002";      }      close FILE;  } @@ -45,13 +47,13 @@ sub esta_notify      my($file) = Irssi::get_irssi_dir."/watch";      my($nick);      local(*FILE); -    open FILE, "< $file"; +    open FILE, "<", $file;      while (<FILE>) { -        @nick = split; -	if (@nick[0] eq $ni) { return 1; } +        my @nick = split; +	    if (@nick[0] eq $ni) { return 1; }      }      close FILE; -return 0; +    return 0;  }  sub watch_add @@ -62,11 +64,11 @@ sub watch_add  	if ($nick eq "") { Irssi::print "Debes decir un nick a incluir en la lista."; return;   	} elsif (esta_notify($nick)) { Irssi::print "El nick ya esta en el notify."; return; } -    open FILE, ">> $file"; +    open FILE, ">>", $file;                  print FILE join("\t","$nick\n");      close FILE; -Irssi::print "El nick $nick ha sido metido en el notify"; -Irssi::active_win()->command("quote watch +$nick"); +    Irssi::print "El nick $nick ha sido metido en el notify"; +    Irssi::active_win()->command("quote watch +$nick");  } @@ -80,43 +82,43 @@ sub watch_del          if ($ni eq "") { Irssi::print "Debes decir un nick a borrar de la lista."; return;          } elsif (!esta_notify($ni)) { Irssi::print "El nick no esta en el notify."; return; } -    open FILE2, "> $file2"; +    open FILE2, ">", $file2;          print FILE2 "";      close FILE2; -    open FILE, "< $file"; -    open FILE2, ">> $file2"; +    open FILE, "<", $file; +    open FILE2, ">>", $file2;      while (<FILE>) { -        @nick = split; +        my @nick = split;          if (@nick[0] eq $ni) {  -	} else { -                print FILE2 join("\t","@nick[0]\n"); -	} +	    } else { +            print FILE2 join("\t","@nick[0]\n"); +	    }      }      close FILE;      close FILE2; -    open FILE, "> $file"; +    open FILE, ">", $file;  	print FILE "";      close FILE; -    open FILE, ">> $file"; -    open FILE2, "< $file2"; +    open FILE, ">>", $file; +    open FILE2, "<", $file2;      while (<FILE2>) { -        @nick = split; +        my @nick = split;  		print FILE join("\t","@nick[0]\n");      }      close FILE;      close FILE2; -Irssi::active_win()->command("quote watch -$ni"); -Irssi::print "Usuario \002$ni\002 Borrado de la lista de notify"; +    Irssi::active_win()->command("quote watch -$ni"); +    Irssi::print "Usuario \002$ni\002 Borrado de la lista de notify";  }  sub watch_list_online  { -Irssi::active_win()->command("quote watch l"); +    Irssi::active_win()->command("quote watch l");  }  sub watch  @@ -140,13 +142,13 @@ sub mete_lista      my($nick);      local(*FILE);  	my $ret; -    open FILE, "< $file"; +    open FILE, "<", $file;      while (<FILE>) { -        @nick = split; -	$ret .= "+@nick[0],"; +        my @nick = split; +	    $ret .= "+@nick[0],";      }  	chop $ret; -Irssi::active_win()->command("quote watch $ret"); +    Irssi::active_win()->command("quote watch $ret");      close FILE;  } @@ -154,15 +156,16 @@ sub event_is_online  {  	my ($server, $data) = @_;  	my ($me, $nick, $ident, $host) = split(/ /, $data); -Irssi::print "\002$nick\002 \0034[\003$ident\@$host\0034]\003 has joined to IRC"; +    Irssi::print "\002$nick\002 \0034[\003$ident\@$host\0034]\003 has joined to IRC";  }  sub event_is_offline  {  	my ($server, $data) = @_;  	my ($me, $nick) = split(/ /, $data); -Irssi::print "\002$nick\002 has left IRC"; +    Irssi::print "\002$nick\002 has left IRC";  } +  sub null  {  } | 
