… | |
… | |
15 | $cl->reg_cb ( |
15 | $cl->reg_cb ( |
16 | contact_request_subscribe => sub { |
16 | contact_request_subscribe => sub { |
17 | my ($xmpp, $acc, $roster, $contact, $rdoit) = @_; |
17 | my ($xmpp, $acc, $roster, $contact, $rdoit) = @_; |
18 | $$rdoit = 1; |
18 | $$rdoit = 1; |
19 | $contact->send_subscribe; |
19 | $contact->send_subscribe; |
20 | 1 |
|
|
21 | }, |
20 | }, |
22 | error => sub { |
21 | error => sub { |
23 | my ($cl, $acc, $err) = @_; |
22 | my ($cl, $acc, $err) = @_; |
24 | print "ERROR: " . $err->string . "\n"; |
23 | print "ERROR: " . $err->string . "\n"; |
25 | 1 |
|
|
26 | }, |
24 | }, |
27 | session_ready => sub { |
25 | session_ready => sub { |
28 | my ($cl, $acc) = @_; |
26 | my ($cl, $acc) = @_; |
29 | $d->request_info ($acc->connection (), 'ukaetec@conference.jabber.org', undef, sub { |
27 | $d->request_info ($acc->connection (), 'ukaetec@conference.jabber.org', undef, sub { |
30 | my ($d, $i, $e) = @_; |
28 | my ($d, $i, $e) = @_; |
… | |
… | |
33 | my $df = Net::XMPP2::Ext::DataForm->new; |
31 | my $df = Net::XMPP2::Ext::DataForm->new; |
34 | $df->from_node (@q); |
32 | $df->from_node (@q); |
35 | print "occupants: " . $df->get_field ('muc#roominfo_occupants')->{values}->[0] . "\n"; |
33 | print "occupants: " . $df->get_field ('muc#roominfo_occupants')->{values}->[0] . "\n"; |
36 | }); |
34 | }); |
37 | print "session ready\n"; |
35 | print "session ready\n"; |
38 | 0 |
36 | $cl->unreg_me |
39 | }, |
37 | }, |
40 | message => sub { |
38 | message => sub { |
41 | my ($cl, $acc, $msg) = @_; |
39 | my ($cl, $acc, $msg) = @_; |
42 | print "message from: " . $msg->from . ": " . $msg->any_body . "\n"; |
40 | print "message from: " . $msg->from . ": " . $msg->any_body . "\n"; |
43 | if ($msg->any_body =~ /remove/) { |
41 | if ($msg->any_body =~ /remove/) { |
44 | $cl->remove_extension ($d); |
42 | $cl->remove_extension ($d); |
45 | } elsif ($msg->any_body =~ /add/) { |
43 | } elsif ($msg->any_body =~ /add/) { |
46 | $cl->add_extension ($d); |
44 | $cl->add_extension ($d); |
47 | } |
45 | } |
48 | 1 |
|
|
49 | } |
46 | } |
50 | ); |
47 | ); |
51 | |
48 | |
52 | $cl->start; |
49 | $cl->start; |
53 | $j->wait; |
50 | $j->wait; |