aboutsummaryrefslogtreecommitdiff
path: root/lib/IRC/Client
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2016-07-28 13:36:53 -0400
committerZoffix Znet <cpan@zoffix.com>2016-07-28 13:36:53 -0400
commit11c9eec8eb2b5afabcee34c30e5bc3a092453724 (patch)
tree51be95c715f796abc479e0aa60cca689e2f7c4dd /lib/IRC/Client
parent1096903f251437e4a89caf84a7aedaed756d5a71 (diff)
Implement multi-server interface
Diffstat (limited to 'lib/IRC/Client')
-rw-r--r--lib/IRC/Client/Message.pm64
-rw-r--r--lib/IRC/Client/Server.pm617
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/IRC/Client/Message.pm6 b/lib/IRC/Client/Message.pm6
index 9559fd1..89295e3 100644
--- a/lib/IRC/Client/Message.pm6
+++ b/lib/IRC/Client/Message.pm6
@@ -7,7 +7,7 @@ role IRC::Client::Message {
has Str:D $.host is required;
has Str:D $.usermask is required;
has Str:D $.command is required;
- has Str:D $.server is required;
+ has $.server is required;
has $.args is required;
method Str { ":$!usermask $!command $!args[]" }
@@ -34,7 +34,7 @@ role Ping does M {
role Privmsg does M {
has $.text is rw;
has Bool $.replied is rw = False;
- method Str { $.text }
+ method ACCEPTS ($what) { $.text ~~ $what }
}
role Privmsg::Channel does Privmsg {
has $.channel;
diff --git a/lib/IRC/Client/Server.pm6 b/lib/IRC/Client/Server.pm6
new file mode 100644
index 0000000..86f5253
--- /dev/null
+++ b/lib/IRC/Client/Server.pm6
@@ -0,0 +1,17 @@
+unit class IRC::Client::Server;
+
+has @.channels where .all ~~ Str;
+has @.nick where .all ~~ Str;
+has Int $.port where 0 <= $_ <= 65535;
+has Str $.label;
+has Str $.host;
+has Str $.password;
+has Str $.username;
+has Str $.userhost;
+has Str $.userreal;
+has Str $.current-nick is rw;
+has Promise $.promise is rw;
+has Bool $.is-connected is rw;
+has IO::Socket::Async $.socket is rw;
+
+method Str { $!label }