/usr/share/irssi/scripts/upgradeinfo.pl is in irssi-scripts 20170711.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | # upgradeinfo - irssi 0.8.6.CVS
#
# $Id: upgradeinfo.pl,v 1.7 2003/02/04 02:29:57 peder Exp $
#
# Copyright (C) 2002, 2003 by Peder Stray <peder@ninja.no>
#
use strict;
use Irssi 20021204.1123;
use Irssi::TextUI;
# ======[ Script Header ]===============================================
use vars qw{$VERSION %IRSSI};
($VERSION) = '$Revision: 1.7 $' =~ / (\d+\.\d+) /;
%IRSSI = (
name => 'upgradeinfo',
authors => 'Peder Stray',
contact => 'peder@ninja.no',
url => 'http://ninja.no/irssi/upgradeinfo.pl',
license => 'GPL',
description => 'Statusbaritem notifying you about updated binary',
sbitems => 'upgradeinfo',
);
# ======[ Variables ]===================================================
my($load_time) = 0; # modification time of binary at load
my($file_time) = 0; # modification time of binary file
my($timer) = 0; # ID of current timer
# ======[ Commands ]====================================================
# --------[ UPGRADEINFO ]-----------------------------------------------
sub cmd_upgradeinfo {
my($param,$serv,$chan) = @_;
print CLIENTCRAP sprintf ">> load: %s", scalar localtime $load_time;
print CLIENTCRAP sprintf ">> file: %s", scalar localtime $file_time;
}
# ======[ Signal Hooks ]================================================
# --------[ sig_setup_changed ]-----------------------------------------
sub sig_setup_changed {
my($interval) = Irssi::settings_get_int('upgrade_check_interval');
Irssi::timeout_remove($timer);
if ($interval < 1) {
$interval = 0;
}
return unless $interval;
$interval *= 1000;
$timer = Irssi::timeout_add($interval, 'ui_check' , undef);
}
# ======[ Statusbar Hooks ]=============================================
# --------[ sb_upgradeinfo ]--------------------------------------------
sub sb_upgradeinfo {
my($item, $get_size_only) = @_;
my $format = "";
my($time);
my($timefmt) = Irssi::settings_get_str('upgrade_time_format');
$time = $file_time - $load_time;
if ($time) {
$time = sprintf($timefmt,
$time/60/60/24,
$time/60/60%24,
$time/60%60,
$time%60
);
$time =~ s/^(0+\D+)+//;
$format = "{sb %r$time%n}";
}
$item->default_handler($get_size_only, $format, undef, 1);
}
# ======[ Timers ]======================================================
# --------[ ui_check ]--------------------------------------------------
sub ui_check {
$file_time = (stat Irssi::get_irssi_binary)[9];
Irssi::statusbar_items_redraw('upgradeinfo');
}
# ======[ Setup ]=======================================================
# --------[ Register commands ]-----------------------------------------
Irssi::command_bind('upgradeinfo', 'cmd_upgradeinfo');
# --------[ Register formats ]------------------------------------------
# --------[ Register settings ]-----------------------------------------
Irssi::settings_add_int('upgrade', 'upgrade_check_interval', 300);
Irssi::settings_add_str('upgrade', 'upgrade_time_format', '%d+%02d:%02d');
# --------[ Register signals ]------------------------------------------
Irssi::signal_add('setup changed', 'sig_setup_changed');
# --------[ Register statusbar items ]----------------------------------
Irssi::statusbar_item_register('upgradeinfo', undef, 'sb_upgradeinfo');
# --------[ Other setup ]-----------------------------------------------
$load_time = (stat Irssi::get_irssi_binary)[9];
$file_time = $load_time;
sig_setup_changed;
# ======[ END ]=========================================================
# Local Variables:
# header-initial-hide: t
# mode: header-minor
# end:
|