Skip to content

Commit

Permalink
Merge pull request #7 from japhb/master
Browse files Browse the repository at this point in the history
Avoid responding to self in private chat; lue++ for original version
  • Loading branch information
Timbus committed Dec 28, 2013
2 parents 6ff9359 + 4b099a1 commit c167064
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/Net/IRC/Event.pm
Expand Up @@ -18,7 +18,7 @@ class Net::IRC::Event {


##Utility methods
method msg($text, $to = $.where) {
method msg($text, $to = self!default-to) {
##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.

Expand All @@ -35,14 +35,17 @@ class Net::IRC::Event {
}
}

method act($text, $to = $.where) {
method act($text, $to = self!default-to) {
$.conn.sendln("PRIVMSG $to :\c01ACTION $text\c01")
}

method send_ctcp($text, $to = $.where) {
method send_ctcp($text, $to = self!default-to) {
$.conn.sendln("NOTICE $to :\c01$text\c01");
}


method !default-to() {
$.where eq $.state<nick> ?? $.who !! $.where;
}

method Str {
$.what ?? ~$.what !! $.raw;
Expand Down

0 comments on commit c167064

Please sign in to comment.