From: Michael Andreen Date: Sat, 9 May 2009 20:05:47 +0000 (+0200) Subject: Add message command for generic messages X-Git-Url: https://ruin.nu/git/?a=commitdiff_plain;h=bbda5c4f4358094b8599e814484d837dc3ee7d86;hp=a4de7ad56ba78ac03799e330466e9f971b7bb39f;p=NDIRC.git Add message command for generic messages --- diff --git a/Context.pm b/Context.pm index d7c28bb..9d37655 100644 --- a/Context.pm +++ b/Context.pm @@ -97,10 +97,16 @@ sub check_user_roles { sub reply { my ($self,$msg) = @_; + $self->message($self->reply_string , $msg); +} + +sub message { + my ($self,$command,$msg) = @_; + $msg =~ s`(.*?)`${\(chr(2))}$1${\(chr(15))}`gi; $msg =~ s`(.*?)`${\(chr(3))}$1$2${\(chr(15))}`gi; - $self->server->command($self->reply_string . $msg); + $self->server->command("$command $msg"); } sub _build_roles { diff --git a/Misc.pm b/Misc.pm index bd15993..66ef545 100644 --- a/Misc.pm +++ b/Misc.pm @@ -53,13 +53,13 @@ sub parseCommand { my $reply_string; given ($p){ when ('!'){ - $reply_string = "msg $nick "; + $reply_string = "msg $nick"; } when ('~'){ - $reply_string = "msg $channel "; + $reply_string = "msg $channel"; } default { - $reply_string = "notice $nick "; + $reply_string = "notice $nick"; } }