]> ruin.nu Git - NDIRC.git/commitdiff
Add message command for generic messages
authorMichael Andreen <harv@ruin.nu>
Sat, 9 May 2009 20:05:47 +0000 (22:05 +0200)
committerMichael Andreen <harv@ruin.nu>
Sat, 9 May 2009 20:05:47 +0000 (22:05 +0200)
Context.pm
Misc.pm

index d7c28bbd808014058d2dc698f7b8219bc87b9216..9d37655729453ed454caeede43a69fff538621ce 100644 (file)
@@ -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`<b>(.*?)</b>`${\(chr(2))}$1${\(chr(15))}`gi;
        $msg =~ s`<c(\d+)>(.*?)</c>`${\(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 bd159933d5203675d5071e4e5a444d1054c09a80..66ef54562b77ff842781bf4b51e233d8d2c37a77 100644 (file)
--- 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";
                }
        }