1 |
elmex |
1.1 |
#!/usr/bin/perl |
2 |
root |
1.2 |
|
3 |
elmex |
1.1 |
use strict; |
4 |
root |
1.2 |
|
5 |
|
|
use Event; |
6 |
elmex |
1.1 |
use Net::Knuddels; |
7 |
|
|
|
8 |
root |
1.3 |
my $client = new Net::Knuddels::Client PeerAddr => "213.61.5.150:2710"; |
9 |
elmex |
1.1 |
|
10 |
root |
1.3 |
$client->login; |
11 |
elmex |
1.1 |
|
12 |
|
|
my %channels; |
13 |
|
|
|
14 |
root |
1.3 |
$client->register (b => sub { |
15 |
elmex |
1.1 |
for (@_) { |
16 |
|
|
if ($_ ne "-") { |
17 |
|
|
|
18 |
|
|
} else { |
19 |
|
|
|
20 |
|
|
|
21 |
|
|
} |
22 |
|
|
} |
23 |
|
|
}); |
24 |
|
|
|
25 |
root |
1.3 |
$client->register (UNHANDLED => sub { |
26 |
root |
1.2 |
use Dumpvalue; |
27 |
|
|
print "---\n"; |
28 |
|
|
Dumpvalue->new (compactDump => 1, veryCompact => 1, quoteHighBit => 1, tick => '"')->dumpValue ([@_]); |
29 |
|
|
}); |
30 |
|
|
|
31 |
root |
1.3 |
$client->register (login => sub { |
32 |
|
|
$client->set_nick ("Zwickau", "Net-Knuddels", "lolfe"); |
33 |
root |
1.2 |
}); |
34 |
|
|
|
35 |
root |
1.3 |
$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 |
elmex |
1.1 |
|
47 |
root |
1.2 |
Event::loop; |
48 |
elmex |
1.1 |
|
49 |
|
|
|