| 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 | |
|---|
| 8 | die "usage: $0 <target jid>" unless $ARGV[0]; |
|---|
| 9 | |
|---|
| 10 | my $target = $ARGV[0]; |
|---|
| 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 ("LOL" => $target, $cl->get_account($user), 'normal'); |
|---|
| 39 | $cl->send_message ("LOL" => $target, $cl->get_account($user), 'error'); |
|---|
| 40 | $cl->send_message ("LOL" => $target, $cl->get_account($user), 'headline'); |
|---|
| 41 | 0 |
|---|
| 42 | }, |
|---|
| 43 | roster_update => sub { |
|---|
| 44 | my ($cl, $acc, $roster, $contacts) = @_; |
|---|
| 45 | #$roster->debug_dump; |
|---|
| 46 | #print "OEOFWEFIEJWFEWO\n" if not $roster->is_retrieved; |
|---|
| 47 | 1 |
|---|
| 48 | }, |
|---|
| 49 | presence_update => sub { |
|---|
| 50 | my ($cl, $acc, $roster, $contact, $old, $new) = @_; |
|---|
| 51 | #$roster->debug_dump; |
|---|
| 52 | 1 |
|---|
| 53 | }, |
|---|
| 54 | error => sub { |
|---|
| 55 | my ($cl, $acc, $error) = @_; |
|---|
| 56 | print "ERROR: ".$error->string."\n"; |
|---|
| 57 | }, |
|---|
| 58 | disconnect => sub { warn "DISCON[@_]\n"; 1 }, |
|---|
| 59 | ); |
|---|
| 60 | |
|---|
| 61 | #$cl->reg_cb (contact_request_subscribe => sub { |
|---|
| 62 | # my ($cl, $acc, $roster, $contact) = @_; |
|---|
| 63 | # $contact->send_subscribe; |
|---|
| 64 | # 0 |
|---|
| 65 | #}); |
|---|
| 66 | |
|---|
| 67 | #$cl->reg_cb (contact_did_unsubscribe => sub { |
|---|
| 68 | # my ($cl, $acc, $roster, $contact, $rdoit) = @_; |
|---|
| 69 | # 1 |
|---|
| 70 | #}); |
|---|
| 71 | |
|---|
| 72 | #$cl->reg_cb (roster_update => sub { |
|---|
| 73 | # my ($cl, $acc, $roster, $contacts) = @_; |
|---|
| 74 | # $roster->debug_dump; |
|---|
| 75 | # 0 |
|---|
| 76 | #}); |
|---|
| 77 | |
|---|
| 78 | $cl->start; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | #my $timer = |
|---|
| 82 | # $cl->send_message ("Hello!" => 'd@jabbim.com'); |
|---|
| 83 | |
|---|
| 84 | $j->wait; |
|---|