Browse files

Indent

  • Loading branch information...
1 parent 734f7eb commit 68d49193db6f1c63fbde845704eb8f9f3485efcf Crab Qiu committed Jun 11, 2012
Showing with 43 additions and 40 deletions.
  1. +43 −40 lib/Net/IRC/Event.pm
View
83 lib/Net/IRC/Event.pm
@@ -1,46 +1,49 @@
use v6;
class Net::IRC::Event {
- #EVERY event has to have these:
- has $.raw is rw;
- has $.command is rw;
- has $.conn is rw;
- has $.state is rw;
-
- #Most events can have these.
- has $.who is rw;
- has $.what is rw;
- has $.where is rw;
-
- ##Utility methods
- method msg($text, $to = $.where) {
- ##IRC RFC specifies 510 bytes as the maximum allowed to send per line.
- #I'm going with 480, as 510 seems to get cut off on some servers.
+ #EVERY event has to have these:
+ has $.raw is rw;
+ has $.command is rw;
+ has $.conn is rw;
+ has $.state is rw;
+
+ #Most events can have these.
+ has $.who is rw;
+ has $.what is rw;
+ has $.where is rw;
- my $prepend = "PRIVMSG $to :";
- my $maxlen = 480-$prepend.bytes;
- for $text.split(/\c13?\c10/) -> $line is rw {
- while $line.bytes > $maxlen {
- #Break up the line using a nearby space if possible.
- my $index = $line.rindex(" ", $maxlen) || $maxlen;
- $.conn.sendln($prepend~$line.substr(0, $index));
- $line = $line.substr($index+1);
- }
- $.conn.sendln($prepend~$line);
- }
- }
-
- method act($text, $to = $.where) {
- $.conn.sendln("PRIVMSG $to :\c01ACTION $text\c01")
- }
-
- method send_ctcp($text, $to = $.where) {
- $.conn.sendln("NOTICE $to :\c01$text\c01");
- }
-
-
- method Str {
- $.what ?? ~$.what !! $.raw;
- }
+
+ ##Utility methods
+ method msg($text, $to = $.where) {
+ ##IRC RFC specifies 510 bytes as the maximum allowed to send per line.
+ #I'm going with 480, as 510 seems to get cut off on some servers.
+
+ my $prepend = "PRIVMSG $to :";
+ my $maxlen = 480-$prepend.bytes;
+ for $text.split(/\c13?\c10/) -> $line is rw {
+ while $line.bytes > $maxlen {
+ #Break up the line using a nearby space if possible.
+ my $index = $line.rindex(" ", $maxlen) || $maxlen;
+ $.conn.sendln($prepend~$line.substr(0, $index));
+ $line = $line.substr($index+1);
+ }
+ $.conn.sendln($prepend~$line);
+ }
+ }
+
+ method act($text, $to = $.where) {
+ $.conn.sendln("PRIVMSG $to :\c01ACTION $text\c01")
+ }
+
+ method send_ctcp($text, $to = $.where) {
+ $.conn.sendln("NOTICE $to :\c01$text\c01");
+ }
+
+
+ method Str {
+ $.what ?? ~$.what !! $.raw;
+ }
}
+
+# vim: ft=perl6 expandtab sw=4

0 comments on commit 68d4919

Please sign in to comment.