]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
[kernel] change source
authorbw1 <redacted>
Sun, 11 Mar 2018 19:53:39 +0000 (20:53 +0100)
committerbw1 <redacted>
Sun, 11 Mar 2018 19:53:39 +0000 (20:53 +0100)
scripts/kernel.pl

index 048dd1de6f330bfacd1c1f4f782bb72aeb7dde40..435a0685b4707ce5a69284cd060c24d71d7e6a75 100644 (file)
@@ -4,56 +4,29 @@
 
 use strict;
 use Irssi;
-use IO::Socket;
+use LWP::Simple;
 
 use vars qw($VERSION %IRSSI);
 
-$VERSION = '0.9';
+$VERSION = '0.10';
 %IRSSI = (
     authors     => 'Johan "Ion" Kiviniemi',
     contact     => 'ion at hassers.org',
     name        => 'Kernel',
     description => 'Fetches the version(s) of the latest Linux kernel(s).',
     license     => 'Public Domain',
-    url         => 'http://ion.amigafin.org/irssi/',
-    changed     => 'Tue Mar 12 22:20 EET 2002',
+    url         => 'http://scripts.irssi.org/',
+    changed     => '2018-03-11',
 );
 
-sub finger($$) {
-    # Yes, Net::Finger is already done and i'm reinventing the wheel.
-    my ($user, $host) = @_;
-    my $buffer;
-    if (my $socket = IO::Socket::INET->new(
-            PeerHost => $host,
-            PeerPort => 'finger(79)',
-            Proto    => 'tcp',
-        ))
-    {
-        if (syswrite $socket, "$user\n") {
-            unless (sysread $socket, $buffer, 1024) {
-                # Should i use $! here?
-                Irssi::print(
-                    "Unable to read from the socket: $!",
-                    Irssi::MSGLEVEL_CLIENTERROR
-                );
-            }
-        } else {
-            # ..and here?
-            Irssi::print(
-                "Unable to write to the socket: $!",
-                Irssi::MSGLEVEL_CLIENTERROR
-            );
-        }
-    } else {
-        Irssi::print("Connection to $host failed: $!",
-            Irssi::MSGLEVEL_CLIENTERROR);
-    }
-    return $buffer;
+sub wget {
+       my $con =get("https://www.kernel.org/finger_banner");
+       return $con;
 }
 
 sub get_version {
     my @version;
-    if (my $finger = finger("", "finger.kernel.org")) {
+    if (my $finger = wget()) {
         # The magic of the regexps :)
         @version = $finger =~ /:\s*(\S+)\s*$/gm;
         # Modify this to do whatever you want.
git clone https://git.99rst.org/PROJECT