1 |
#!/usr/bin/perl |
2 |
|
3 |
use strict; |
4 |
|
5 |
use Event; |
6 |
use Net::Knuddels; |
7 |
|
8 |
my $client = new Net::Knuddels::Client PeerAddr => "213.61.5.150:2710"; |
9 |
|
10 |
$client->login; |
11 |
|
12 |
my %channels; |
13 |
|
14 |
$client->register (b => sub { |
15 |
for (@_) { |
16 |
if ($_ ne "-") { |
17 |
|
18 |
} else { |
19 |
|
20 |
|
21 |
} |
22 |
} |
23 |
}); |
24 |
|
25 |
$client->register (UNHANDLED => sub { |
26 |
use Dumpvalue; |
27 |
print "---\n"; |
28 |
Dumpvalue->new (compactDump => 1, veryCompact => 1, quoteHighBit => 1, tick => '"')->dumpValue ([@_]); |
29 |
}); |
30 |
|
31 |
$client->register (login => sub { |
32 |
$client->set_nick ("Zwickau", "Net-Knuddels", "lolfe"); |
33 |
}); |
34 |
|
35 |
$client->register (msg_room => sub { |
36 |
my ($room, $user, $msg) = @_; |
37 |
print "($room) $user: $msg\n"; |
38 |
}); |
39 |
|
40 |
$client->register (msg_priv => sub { |
41 |
my ($room, $src, $dst, $msg) = @_; |
42 |
print "($room) ########### $src an $dst: $msg\n"; |
43 |
}); |
44 |
|
45 |
Event->io ( fd => $client->fh, poll => 'r', cb => sub { $client->ready }); |
46 |
|
47 |
Event::loop; |
48 |
|
49 |
|