Skip to content

Commit

Permalink
First working test
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Jun 6, 2016
1 parent 16056e8 commit 140959e
Show file tree
Hide file tree
Showing 20 changed files with 133 additions and 298 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
lib/.precomp
t/release/.precomp
*~
4 changes: 3 additions & 1 deletion examples/bot.pl6
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ my $irc = IRC::Client.new(
:debug<1>
# :channels<#zofbot>
# :host<irc.freenode.net>
:port<6667>
:servers(
mine => { :port<5667> },
inspircd => { :port<6667> },
inspircd => { },
# freenode => { :host<irc.freenode.net> },
)
:plugins(MyPlug.new)
).run;
8 changes: 4 additions & 4 deletions lib/IRC/Client.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ method run {
"USER $!username $!username $!host :$!userreal",
:server($s-name);

my $left-overs = '';
react {
CATCH { warn .backtrace }

whenever $s-conf<sock>.Supply :bin -> $buf is copy {
state $left-overs = '';
my $str = try $buf.decode: 'utf8';
$str or $str = $buf.decode: 'latin-1';
$str = $left-overs ~ $str;
$str = ($left-overs//'') ~ $str;

(my $events, $left-overs)
= self!parse: $str, :server($s-name);
Expand Down Expand Up @@ -84,8 +84,8 @@ method !handle-event ($e) {
}
when 'PING' { $e.reply }
when 'JOIN' {
say "Joined channel $e.channel()"
if $e.nick eq %!servers{ $e.server }<nick>;
# say "Joined channel $e.channel() on $e.server()"
# if $e.nick eq %!servers{ $e.server }<nick>;
}
}

Expand Down
5 changes: 5 additions & 0 deletions lib/IRC/Client/Grammar/Actions.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ method message ($match) {
:channel( %args<params>[0] ),
|%msg-args;
}
when 'NICK' {
$msg = IRC::Client::Message::Nick.new:
:new-nick( %args<params>[0] ),
|%msg-args;
}
when 'NOTICE' { $msg = msg-notice %args, %msg-args }
when 'MODE' { $msg = msg-mode %args, %msg-args }
when 'PING' { $msg = IRC::Client::Message::Ping.new: |%msg-args }
Expand Down
1 change: 1 addition & 0 deletions lib/IRC/Client/Message.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ role Notice::Me does Notice { }
role Mode does M { has @.modes; }
role Mode::Channel does Mode { has $.channel; }
role Mode::Me does Mode { }
role Nick does M { has $.new-nick; }
role Numeric does M { }
role Part does M { has $.channel; }
role Quit does M { }
Expand Down
2 changes: 0 additions & 2 deletions lib/IRC/Client/Message/Numeric.pm6

This file was deleted.

4 changes: 0 additions & 4 deletions lib/IRC/Client/Message/Privmsg.pm6

This file was deleted.

5 changes: 0 additions & 5 deletions lib/IRC/Client/Message/Privmsg/Channel.pm6

This file was deleted.

2 changes: 0 additions & 2 deletions lib/IRC/Client/Message/Privmsg/Me.pm6

This file was deleted.

4 changes: 0 additions & 4 deletions lib/IRC/Client/Message/Unknown.pm6

This file was deleted.

174 changes: 0 additions & 174 deletions lib/old-IRC/Client.pm6

This file was deleted.

3 changes: 0 additions & 3 deletions lib/old-IRC/Client/Plugin.pm6

This file was deleted.

8 changes: 0 additions & 8 deletions lib/old-IRC/Client/Plugin/Debugger.pm6

This file was deleted.

2 changes: 0 additions & 2 deletions lib/old-IRC/Client/Plugin/PingPong.pm6

This file was deleted.

20 changes: 0 additions & 20 deletions lib/old-IRC/Grammar.pm6

This file was deleted.

26 changes: 0 additions & 26 deletions lib/old-IRC/Grammar/Actions.pm6

This file was deleted.

7 changes: 0 additions & 7 deletions lib/old-IRC/Parser.pm6

This file was deleted.

Loading

0 comments on commit 140959e

Please sign in to comment.