| 1 | #!/usr/bin/perl |
|---|
| 2 | use strict; |
|---|
| 3 | use utf8; |
|---|
| 4 | use AnyEvent; |
|---|
| 5 | use AnyEvent::XMPP qw/xep-86/; |
|---|
| 6 | use AnyEvent::XMPP::Client; |
|---|
| 7 | use Encode; |
|---|
| 8 | |
|---|
| 9 | binmode STDOUT, ":utf8"; |
|---|
| 10 | |
|---|
| 11 | my $j = AnyEvent->condvar; |
|---|
| 12 | |
|---|
| 13 | open(ACCS, "<", "accounts.txt"); |
|---|
| 14 | my @accounts = <ACCS>; |
|---|
| 15 | close(ACCS); |
|---|
| 16 | use Data::Dumper; |
|---|
| 17 | |
|---|
| 18 | foreach my $account(@accounts) { |
|---|
| 19 | chomp $account; |
|---|
| 20 | #print $account; |
|---|
| 21 | my ($user, $pw) = split ":" => $account; |
|---|
| 22 | ruin($user, $pw); |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | sub ruin { |
|---|
| 26 | my $user = shift; |
|---|
| 27 | my $pw = shift; |
|---|
| 28 | my $cl = AnyEvent::XMPP::Client->new (debug => 0); |
|---|
| 29 | |
|---|
| 30 | $cl->add_account ($user, $pw); |
|---|
| 31 | |
|---|
| 32 | $cl->set_presence ('away', 'FUCK YOU', 1); |
|---|
| 33 | |
|---|
| 34 | $cl->reg_cb ( |
|---|
| 35 | session_ready => sub { |
|---|
| 36 | print "Connected!\n"; |
|---|
| 37 | #print Dumper($_[0]); |
|---|
| 38 | $cl->send_message ("Connected!" => 'd@jabbim.com'); |
|---|
| 39 | #sleep 5; |
|---|
| 40 | 0 |
|---|
| 41 | }, |
|---|
| 42 | roster_update => sub { |
|---|
| 43 | my ($cl, $acc, $roster, $contacts) = @_; |
|---|
| 44 | #$roster->debug_dump; |
|---|
| 45 | #print "OEOFWEFIEJWFEWO\n" if not $roster->is_retrieved; |
|---|
| 46 | 1 |
|---|
| 47 | }, |
|---|
| 48 | presence_update => sub { |
|---|
| 49 | my ($cl, $acc, $roster, $contact, $old, $new) = @_; |
|---|
| 50 | #$roster->debug_dump; |
|---|
| 51 | 1 |
|---|
| 52 | }, |
|---|
| 53 | error => sub { |
|---|
| 54 | my ($cl, $acc, $error) = @_; |
|---|
| 55 | print "ERROR: ".$error->string."\n"; |
|---|
| 56 | }, |
|---|
| 57 | disconnect => sub { warn "DISCON[@_]\n"; 1 }, |
|---|
| 58 | ); |
|---|
| 59 | |
|---|
| 60 | #$cl->reg_cb (contact_request_subscribe => sub { |
|---|
| 61 | # my ($cl, $acc, $roster, $contact) = @_; |
|---|
| 62 | # $contact->send_subscribe; |
|---|
| 63 | # 0 |
|---|
| 64 | #}); |
|---|
| 65 | |
|---|
| 66 | #$cl->reg_cb (contact_did_unsubscribe => sub { |
|---|
| 67 | # my ($cl, $acc, $roster, $contact, $rdoit) = @_; |
|---|
| 68 | # 1 |
|---|
| 69 | #}); |
|---|
| 70 | |
|---|
| 71 | #$cl->reg_cb (roster_update => sub { |
|---|
| 72 | # my ($cl, $acc, $roster, $contacts) = @_; |
|---|
| 73 | # $roster->debug_dump; |
|---|
| 74 | # 0 |
|---|
| 75 | #}); |
|---|
| 76 | |
|---|
| 77 | $cl->start; |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | #my $timer = |
|---|
| 81 | # $cl->send_message ("Hello!" => 'd@jabbim.com'); |
|---|
| 82 | |
|---|
| 83 | $j->wait; |
|---|