-
Notifications
You must be signed in to change notification settings - Fork 234
/
iraident.pl
65 lines (50 loc) · 2.9 KB
/
iraident.pl
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
#!/usr/bin/perl
# This is for NickServ Russian Ircnet services
# just edit $ident_name and $password
#
# tested on irc.nov.ru
# todo:
# - before quote codepage will be great to check current
# - notify from nickserv may has a different text
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.6.1";
%IRSSI = (
authors => "DonRumata",
contact => "rumata\@dragons.ru",
name => "iraident",
description => "IrcNet.ru Auto Identify - changes nick and send identify command, then sets codepage",
license => "GPLv2",
url => "http://rumata.dragons.ru",
changed => "$VERSION",
commands => "none"
);
my $ident_name = "DonRumata_for_example";
my $password = "some_identify_string";
#my $fmt = MSGLEVEL_CLIENTNOTICES;
sub server_event_catch {
# $server = server record where the message came
# $data = the raw data received from server, with PRIVMSGs it is:
# "target :text" where target is either your nick or #channel
# $nick = the nick who sent the message
# $host = host of the nick who sent the message
my ($server, $text, $nick, $user) = @_;
if (($nick == 'NickServ') and ($user == 'Services@ircnet.ru')){
# events:
# Nick is registered or protected or not registered
if ( $text =~ /your nick will be changed/){
if ($server->{'nick'} ne $ident_name){
$server->command("NICK $ident_name");
# Irssi::print("ident string sent...",$fmt);
return;
}
return if ($server->{'usermode'} =~ /(r)/);
$server->command("MSG NickServ identify $password");
# Irssi::print("password sent",$fmt);
$server->command("QUOTE codepage koi8");
# Irssi::print("codepage sent",$fmt);
}
}
}
Irssi::signal_add('server event', 'server_event_catch');