diff options
| author | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
|---|---|---|
| committer | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
| commit | 2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch) | |
| tree | 1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/oidenty.pl | |
| parent | 2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff) | |
| download | scripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2 | |
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/oidenty.pl')
| -rw-r--r-- | scripts/oidenty.pl | 77 | 
1 files changed, 77 insertions, 0 deletions
| diff --git a/scripts/oidenty.pl b/scripts/oidenty.pl new file mode 100644 index 0000000..f4c812b --- /dev/null +++ b/scripts/oidenty.pl @@ -0,0 +1,77 @@ +# +# psybnc like oidentd support for irssi +# +# requirements: +# - oidentd (running) +# - your user needs "spoof" permissions in the /etc/oidentd.conf +#   looks like: +#   "user youruser { +#        default { +#            allow spoof; +#        } +#   }" +# +#  if you want to spoof local user you need: +#  "allow spoof_all;"  +# +# - this script works like psybnc oidentd support.               +#   that means it writes ~/.ispoof and ~/.oidentd.conf +#   these files have to be writeable. +# +# usage: +# - just run the script. +# +# configuration: +# - the script uses the active "username" field for the connect. +#   you can alter it global via "/set user_name"  +#   or per ircnet with "/ircnet add -user ident somenet" +# +# how it works: +# on connect it writes ~/.ispoof and ~/.oidentd.conf +# you CAN have RACE CONDITIONS HERE.  +# so delay your connects a bit. +# + +use vars qw ( $VERSION %IRSSI ); + +$VERSION = "0.0.2"; +%IRSSI = ( +    authors     => 'darix', +    contact     => 'darix@irssi.org', +    name        => 'oidenty', +    description => 'oidentd support for irssi', +    license     => 'BSD License', +    url         => 'http://www.irssi.de' +); +# +use strict; +use warnings; + +use Irssi qw ( signal_add  ); +use IO::File; + +signal_add 'server looking' => sub { +    my ( $server ) = @_; + +    my $fh = new IO::File "$ENV{'HOME'}/.ispoof", "w"; +    if ( $fh ) { +        $fh->print ( "$server->{'username'}" ); +        undef $fh; +    } +    else { +        print ( CRAP "cant open $ENV{'HOME'}/.ispoof for writing. $!" ); +    } + +    $fh = new IO::File "$ENV{'HOME'}/.oidentd.conf", "w"; +    if ( $fh ) { +        $fh->print ( "global { reply \"$server->{'username'}\" }" ); +        undef $fh; +    } +    else { +        print ( CRAP "cant open $ENV{'HOME'}/.oidentd.conf for writing. $!" ); +    } + +}; + +print (CRAP "loaded $IRSSI{'name'} v$VERSION by $IRSSI{'authors'} <$IRSSI{'contact'}>. use it at \cBYOUR OWN RISK\cB"); +print (CRAP "$IRSSI{'description'}"); | 
