diff options
Diffstat (limited to 'lib/IRC/Client.pm6')
-rw-r--r-- | lib/IRC/Client.pm6 | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6 index e130174..8c0b2c1 100644 --- a/lib/IRC/Client.pm6 +++ b/lib/IRC/Client.pm6 @@ -24,13 +24,17 @@ class IRC::Client:ver<2.001001> { await IO::Socket::Async.connect( $!host, $!port ).then({ $!sock = .result; $.ssay("NICK $!nick\n"); - $.ssay("USER $!username $!userhost $!host :$!userreal\n"); - $.ssay("JOIN $_\n") for @!channels; + $.ssay("USER $!username $!username $!host :$!userreal\n"); + $.ssay("JOIN {@!channels[]} x\n"); .irc-connected: self for @!plugs.grep(*.^can: 'irc-connected'); + # my $left-overs = ''; react { - whenever $!sock.Supply -> $str is copy { + whenever $!sock.Supply :bin -> $buf is copy { + my $str = try $buf.decode: 'utf8'; + $str or $str = $buf.decode: 'latin-1'; + # $str ~= $left-overs; $!debug and "[server {DateTime.now}] {$str}".put; my $events = parse-irc $str; EVENTS: for @$events -> $e { @@ -80,7 +84,7 @@ class IRC::Client:ver<2.001001> { say "Closing connection"; $!sock.close; - CATCH { warn .backtrace } + # CATCH { warn .backtrace } }); } @@ -91,7 +95,7 @@ class IRC::Client:ver<2.001001> { } method privmsg (Str $who, Str $what) { - my $msg = ":$!nick!$!username\@$!userhost PRIVMSG $who :$what\n"; + my $msg = "PRIVMSG $who :$what\n"; $!debug and "{plug-name}$msg".put; $!sock.print("$msg\n"); self; |