X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fchatty;a=blobdiff_plain;f=lib%2FChatty%2FController%2FChat.pm;h=911c127ed95b18229c059b5891e86599a57e9a6d;hp=9be0e796e28449eefb4e31fbaad02c3e7cef997d;hb=e26179af9aaf7cae5a0aa68ad87a50e4b1e1aba5;hpb=6177b7c3d795a2505f95269ab2dd1d4c6f05a525 diff --git a/lib/Chatty/Controller/Chat.pm b/lib/Chatty/Controller/Chat.pm index 9be0e79..911c127 100644 --- a/lib/Chatty/Controller/Chat.pm +++ b/lib/Chatty/Controller/Chat.pm @@ -92,7 +92,17 @@ sub view :Chained(room) :PathPart('') :Args(1) { $c->stash(room => $c->model('DB::Room')->find($room)); $c->detach('/missing') if !$c->stash->{room}; - $c->stash(messages => [$c->model('DB::Message')->search(room => $room)]); + my $name = $c->user->obj->username; + + my $msg = $c->req->param('msg'); + if ($msg) { + $c->model('Meteor')->addMessage($room, "$name: $msg"); + $c->stash->{json} = \1; + $c->forward('View::JSON'); + return; + } + + $c->model('Meteor')->addMessage($room, "** $name has entered **"); } =head1 AUTHOR