X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Context.pm;h=abe59b24cf538b477f794153241a11649a1865b7;hb=1ccb344994c1b517c662da9f236cf1c640780177;hp=5d0fb1c34f44d0747eb462f91747514a112b3a05;hpb=4f1948e0fe10075464732db5cc2168207c00c7aa;p=NDIRC.git diff --git a/Context.pm b/Context.pm index 5d0fb1c..abe59b2 100644 --- a/Context.pm +++ b/Context.pm @@ -97,7 +97,37 @@ sub check_user_roles { sub reply { my ($self,$msg) = @_; - $self->server->command($self->reply_string . $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("$command $msg"); +} + +sub intel_log { + my ($c,$planet, $message) = @_; + my $log = $c->model->prepare_cached(q{ +INSERT INTO forum_posts (ftid,uid,message) VALUES( + (SELECT ftid FROM planets WHERE pid = $3) + ,(SELECT uid FROM users WHERE hostmask ILIKE $1) + ,$2) + }); + $log->execute($c->host,$message,$planet); +} + +sub def_log { + my ($c,$call, $message) = @_; + my $log = $c->model->prepare(q{ +INSERT INTO forum_posts (ftid,uid,message) VALUES( + (SELECT ftid FROM calls WHERE call = $3) + ,(SELECT uid FROM users WHERE hostmask ILIKE $1),$2) + }); + $log->execute($c->host,$message,$call); } sub _build_roles {