/usr/share/irssi/scripts/away2web.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 | #!/usr/bin/perl
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "2003100201";
%IRSSI = (
authors => "Oskari 'Okko' Ojala",
contact => "sorter.irssi-scripts\@okko.net",
name => "away2web",
description => "Write /away information to a file to be used on web pages",
license => "BSD",
changed => "$VERSION",
);
use Irssi 20020324;
#
# Writes /away information to a file. A web page script (cgi / php / pl..) can
# then read the file and display online/offline information.
#
# The web page script is left as an excersise for the user because the platforms
# vary. :-)
#
# Tip: You can also modify this script to directly write HTML and then just include
# the file on your web page.
#
#
# Format of the file:
# First line: Either "1" or "0". 0=Offline (away), 1=Online (not away).
# Second line: The away reason (message). If the user is Online, second line is
# empty but exists.
#
# File is written to ~/.irssi/away2web-status.
#
sub catch_away {
my $server = shift;
open(STATUSFILE, q{>}, $ENV{'HOME'}.'/.irssi/away2web-status') || die ("away2web.pl: Could not open file for writing:".$!);
if ($server->{usermode_away}) {
# User is offline.
print STATUSFILE "0\n";
} else {
# User is online.
print STATUSFILE "1\n";
}
print STATUSFILE $server->{'away_reason'}."\n";
close(STATUSFILE);
}
Irssi::signal_add("away mode changed", "catch_away");
print CLIENTCRAP '%B>>%n '.$IRSSI{name}.' '.$VERSION.' (c) '.$IRSSI{authors}.' loaded';
# end of script.
|