X-Git-Url: https://ruin.nu/git/?p=NDIRC.git;a=blobdiff_plain;f=Context.pm;h=02aac95a7ba84819a49e6713acc7c241bec48d85;hp=d7c28bbd808014058d2dc698f7b8219bc87b9216;hb=e8c94cdebefdc428ea92fde6db63f18d3e8399b2;hpb=278eecdf5493a966306382275536293de763c94e diff --git a/Context.pm b/Context.pm index d7c28bb..02aac95 100644 --- a/Context.pm +++ b/Context.pm @@ -97,10 +97,44 @@ sub check_user_roles { sub reply { my ($self,$msg) = @_; + my @command = split / /, $self->reply_string; + $self->message(@command, $msg); +} + +sub message { + my ($self,$command, $target, $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->command($command, $target, $msg); +} + +sub command { + my ($self,@command) = @_; + + $self->server->yield(@command); +} + +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 {