source: trollforge/mao/xmpp-ruin/jid-ruin.pl @ 334

Revision 334, 1.7 KB checked in by mao, 3 years ago (diff)
Line 
1#!/usr/bin/perl
2use strict;
3use utf8;
4use AnyEvent;
5use AnyEvent::XMPP qw/xep-86/;
6use AnyEvent::XMPP::Client;
7use Encode;
8
9binmode STDOUT, ":utf8";
10
11my $j = AnyEvent->condvar;
12
13open(ACCS, "<", "accounts.txt");
14my @accounts = <ACCS>;
15close(ACCS);
16use Data::Dumper;
17
18foreach my $account(@accounts) {
19  chomp $account;
20  #print $account;
21  my ($user, $pw) = split ":" => $account;
22  ruin($user, $pw);
23}
24
25sub 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;
Note: See TracBrowser for help on using the repository browser.