X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fchatty;a=blobdiff_plain;f=lib%2FChatty%2FController%2FChat.pm;h=01cb23410c479a48155ffae17e10fecc46e5940f;hp=9be0e796e28449eefb4e31fbaad02c3e7cef997d;hb=57f9bfbe0bd9f89a602c5f16bff100af84ae7f83;hpb=6177b7c3d795a2505f95269ab2dd1d4c6f05a525 diff --git a/lib/Chatty/Controller/Chat.pm b/lib/Chatty/Controller/Chat.pm index 9be0e79..01cb234 100644 --- a/lib/Chatty/Controller/Chat.pm +++ b/lib/Chatty/Controller/Chat.pm @@ -92,7 +92,18 @@ 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 (defined $msg) { + return if $msg eq ''; + $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