summaryrefslogtreecommitdiffstats
path: root/modules/services.pl
blob: d110b60d3d36c6f72db493e4969d4b5d7a416222 (plain) (blame)
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
use warnings;
use strict;

sub doServices {
  my ($conn, $event) = @_;
  if ($event->{from} eq 'NickServ!NickServ@services.')
  {
    print "NickServ: $event->{args}->[0]\n";
    if ( $event->{args}->[0] eq 'This nickname is owned by someone else' )
    {
      $conn->privmsg( 'NickServ', "identify $::pass" );
    }
    elsif ( $event->{args}->[0] eq 'Password accepted - you are now recognized' )
    {
      $conn->join($_) foreach ( @{$::settings->{autojoins}} );
    }
    elsif ($event->{args}->[0] =~ /has been killed$/ )
    {
      $conn->nick( $::settings->{nick} );
    }
    elsif ($event->{args}->[0] =~ /Password Incorrect/ )
    {
      $conn->join($_) foreach ( @{$::settings->{autojoins}} );
    }
  }
  elsif ($event->{from} eq 'ChanServ!ChanServ@services.')
  {
    print "ChanServ: $event->{args}->[0] \n";
    if ($event->{args}->[0] =~ /You are already opped on \[.(.*).\]/)
    {
      doQueue($conn, $1);
    }
    elsif ( $event->{args}->[0] =~ /^All.*bans matching.*have been cleared on(.*)/)
    {
      $conn->join($1);
    }
  }
}

sub Services::killsub {
  undef &doServices;
}

return 1;