<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,6 +12,10 @@ require 'post'
 
 $history = DRbObject.new(nil, &quot;druby://localhost:8777&quot;)
 
+def is_valid?(text)
+  word.size &gt; 2 &amp;&amp; !%(test foobar asdf).member?(text) &amp;&amp; !text.strip.empty?
+end
+
 get '/ajax/last' do
   if $history.empty?
     init_post = Post.new
@@ -31,9 +35,10 @@ post '/ajax/next' do
   seq = params[:num].to_i
 
   p = Post.new
+  text = params[:text]
 
-  if curr_sz == (seq + 1)
-    p.text = CGI.escapeHTML(params[:text])
+  if curr_sz == (seq + 1) and is_valid?(text)
+    p.text = CGI.escapeHTML(text)
     p.user = params[:user].gsub(/[^-.\w]/, '')
     p.ts = Time.now
     p.num = curr_sz</diff>
      <filename>server.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>90b33bff88a5d8236d084592c3aad6beca12a4c7</id>
    </parent>
  </parents>
  <author>
    <name>User</name>
    <email>lennon@rcoder.net</email>
  </author>
  <url>http://github.com/rcoder/misfict/commit/76e5df911177dbf4e5551c2a664e03f153687e54</url>
  <id>76e5df911177dbf4e5551c2a664e03f153687e54</id>
  <committed-date>2009-03-19T18:03:44-07:00</committed-date>
  <authored-date>2009-03-19T18:03:44-07:00</authored-date>
  <message>basic validation of input</message>
  <tree>68f946c2c8fb6b577aff25812aa2d8529bb2aa43</tree>
  <committer>
    <name>User</name>
    <email>lennon@rcoder.net</email>
  </committer>
</commit>
