<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w
use strict;
use Irssi;
#use Irssi::Irc;
use Socket;
use vars qw($VERSION %IRSSI);
# Tämän todella huonon skriptin teki Elventhor
# Things to do:
# 1. Joissain webchateissa on identin alussa ~. Sen voisi stripata.
# 2. Voisimme kirjoittaa tämän informaation oikean ikkunaan
#    - Tämän korjasi Samwise kun odotteli raid-arrayn synkkautumista
# 3. Jos ei resolvaudu niin ei tarttis ahdistua
#
# Jos haluat korjata, niin mailaa minullekin. elventhor@elventhor.net
#
# Tulostaa hostin automaagisesti, /webchat heksa tulostaa manuaalisesti. Have fun.
sub msg_join {
        my ($server, $channame, $nick, $host, $channel) = @_;
	my $webchat = 0;
	my $host2;
	if( $host =~ /chat.lysti.net/i )
	{
		$webchat = 1;
		$host =~ s/@.*//;
		$host =~ s/L//;
	}
       if ($host =~ /webchat.xs4all.nl/i) 
	{
		$webchat = 1;
		$host =~ s/@.*//;
	}
	if ($host =~ /webchat.irc.cz/i) 
	{
		$webchat = 1;
		$host =~ s/@.*//;
		$host =~ s/~//;
				
	}
	if($host =~ /webirc.peili.org/i)
	{
		$webchat = 1;
		$host =~ s/@.*//;
		$host =~ s/~//;
	}
	if($webchat == 1){
		my @heksat = split(/ */, $host);
		my $hex1 = hex($heksat[0].$heksat[1]);
		my $hex2 = hex($heksat[2].$heksat[3]);
		my $hex3 = hex($heksat[4].$heksat[5]);
		my $hex4 = hex($heksat[6].$heksat[7]);
		my $ip = $hex1.".".$hex2.".".$hex3.".".$hex4;
		my $hostname = gethostbyaddr(inet_aton($ip), AF_INET) or Irssi::print "Can't resolve $ip: $!\n";
		my $printchan=$server-&gt;channel_find($channame);
		if($hostname eq ""){
			$printchan-&gt;print("$nick is from $ip", MSGLEVEL_JOINS);
		}else{
			$printchan-&gt;print("$nick is from $hostname", MSGLEVEL_JOINS);
		}
#		$server-&gt;send_raw("who $hostname");
#		Irssi::print($hostname);
	}
#	$server-&gt;command('who '.$hostname);
}
sub cmd_webchat {
                my ($data, $server, $channame, $nick, $host, $channel) = @_;
                my @heksat = split(/ */, $data);
                my $hex1 = hex($heksat[0].$heksat[1]);
                my $hex2 = hex($heksat[2].$heksat[3]);
                my $hex3 = hex($heksat[4].$heksat[5]);
                my $hex4 = hex($heksat[6].$heksat[7]);
                my $ip = $hex1.".".$hex2.".".$hex3.".".$hex4;
                my $hostname = gethostbyaddr(inet_aton($ip), AF_INET) or Irssi::print "Can't resolve $ip: $!\n";
                Irssi::print("$ip / $hostname");
}

Irssi::command_bind("webchat", "cmd_webchat");
Irssi::signal_add( 'message join' =&gt; \&amp;msg_join );
</pre></body></html>