Last active
December 31, 2015 00:19
-
-
Save konishika/7906972 to your computer and use it in GitHub Desktop.
AnySanを往年のJISなircで利用しようかと思ったときに、毎回使う側でjisに変換するのが面倒になった時に、つかうモンキーパッチ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
no warnings 'redefine'; | |
use Encode qw/from_to/; | |
*AnySan::Provider::IRC::send_message = sub { | |
my ( $self, $message, %args ) = @_; | |
from_to( $message, 'UTF-8', 'jis' ); | |
my $channel = $args{channel}; | |
from_to( $channel, 'UTF-8', 'jis' ); | |
$self->_run( | |
sub { | |
my $type = $args{privmsg} ? 'PRIVMSG' : 'NOTICE'; | |
$self->{client}->send_chan( $channel, $type, $channel, $message, ); | |
} | |
); | |
}; | |
*AnySan::Provider::IRC::join_channel = sub { | |
my ( $self, $channel, $key ) = @_; | |
from_to( $channel, 'UTF-8', 'jis' ); | |
$self->{client}->send_srv( JOIN => $channel, $key ); | |
}; | |
*AnySan::Provider::IRC::leave_channel = sub { | |
my($self, $channel) = @_; | |
from_to( $channel, 'UTF-8', 'jis' ); | |
$self->{client}->send_srv( PART => $channel ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment