<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/html/transcript.html</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -159,16 +159,32 @@ module Tinder
     # Get the transcript for the given date (Returns a hash in the same format as #listen)
     #
     #   room.transcript(room.available_transcripts.first)
-    #   #=&gt; [{:message=&gt;&quot;foobar!&quot;, :user_id=&gt;&quot;99999&quot;, :person=&gt;&quot;Brandon&quot;, :id=&gt;&quot;18659245&quot;}]
+    #   #=&gt; [{:message=&gt;&quot;foobar!&quot;,
+    #         :user_id=&gt;&quot;99999&quot;,
+    #         :person=&gt;&quot;Brandon&quot;,
+    #         :id=&gt;&quot;18659245&quot;,
+    #         :timestamp=&gt;=&gt;Tue May 05 07:15:00 -0700 2009}]
     #
-    def transcript(date)
-      (Hpricot(get(&quot;room/#{id}/transcript/#{date.to_date.strftime('%Y/%m/%d')}&quot;).body) / &quot;.message&quot;).collect do |message|
+    # The timestamp slot will typically have a granularity of five minutes.
+    #
+    def transcript(transcript_date)
+      url = &quot;room/#{id}/transcript/#{transcript_date.to_date.strftime('%Y/%m/%d')}&quot;
+      date, time = nil, nil
+      (Hpricot(get(url).body) / &quot;.message&quot;).collect do |message|
         person = (message / '.person span').first
         body = (message / '.body div').first
+        if d = (message / '.date span').first
+            date = d.inner_html
+        end
+        if t = (message / '.time div').first
+            time = t.inner_html
+        end
         {:id =&gt; message.attributes['id'].scan(/message_(\d+)/).to_s,
           :person =&gt; person ? person.inner_html : nil,
           :user_id =&gt; message.attributes['class'].scan(/user_(\d+)/).to_s,
-          :message =&gt; body ? body.inner_html : nil
+          :message =&gt; body ? body.inner_html : nil,
+          # Use the transcript_date to fill in the correct year
+          :timestamp =&gt; Time.parse(&quot;#{date} #{time}&quot;, transcript_date)
         }
       end
     end</diff>
      <filename>lib/tinder/room.rb</filename>
    </modified>
    <modified>
      <diff>@@ -71,7 +71,7 @@ campfire.users # users in all rooms&lt;/code&gt;&lt;/pre&gt;
 
 &lt;h3&gt;Transcripts&lt;/h3&gt;
 &lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;transcript = room.transcript(room.available_transcripts.first)
-#=&amp;gt; [{:message=&amp;gt;&amp;quot;foobar!&amp;quot;, :user_id=&amp;gt;&amp;quot;99999&amp;quot;, :person=&amp;gt;&amp;quot;Brandon&amp;quot;, :id=&amp;gt;&amp;quot;18659245&amp;quot;}]
+#=&amp;gt; [{:message=&amp;gt;&amp;quot;foobar!&amp;quot;, :user_id=&amp;gt;&amp;quot;99999&amp;quot;, :person=&amp;gt;&amp;quot;Brandon&amp;quot;, :id=&amp;gt;&amp;quot;18659245&amp;quot;, :timestamp=&amp;gt;Tue May 05 07:15:00 -0700 2009}]
 &lt;/code&gt;&lt;/pre&gt;
 
         &lt;p&gt;See the &lt;a href=&quot;tinder&quot;&gt;API documentation&lt;/a&gt; for more details.&lt;/p&gt;</diff>
      <filename>site/index.html</filename>
    </modified>
    <modified>
      <diff>@@ -185,4 +185,36 @@ describe &quot;Accessing a room&quot; do
      end
   end
   
-end
\ No newline at end of file
+end
+
+describe &quot;Accessing a room's transcript&quot; do
+
+  before do
+    @room = Tinder::Room.new nil, 42
+    @html = File.read(File.dirname(__FILE__) + '/html/transcript.html')
+    @response = mock(&quot;response&quot;)
+    @response.stub!(:body).and_return(@html)
+    @room.stub!(:get).with(&quot;room/42/transcript/2009/05/05&quot;).
+        and_return(@response)
+    require 'time'
+    @transcript = @room.transcript(Time.parse(&quot;2009-05-05&quot;))
+  end
+
+  it &quot;should return some messages&quot; do
+    @transcript.should_not be_empty
+  end
+
+  describe &quot;the first message&quot; do
+      # This is a timestamp message
+      it &quot;should include a timestamp&quot; do
+        @transcript.first[:timestamp].should == Time.parse(&quot;2009-05-05 09:35&quot;)
+      end
+  end
+
+  describe &quot;the second message&quot; do
+      it &quot;should include a timestamp&quot; do
+        @transcript.second[:timestamp].should == Time.parse(&quot;2009-05-05 09:35&quot;)
+      end
+  end
+ 
+end</diff>
      <filename>spec/campfire_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8a4ca908a323ebf0791e8b2ccd382718b6fa84b7</id>
    </parent>
  </parents>
  <author>
    <name>Marcel Cary</name>
    <email>marcel@oak.homeunix.org</email>
  </author>
  <url>http://github.com/collectiveidea/tinder/commit/a62978979ffae4e27d821fa6a0cce2ed7d21a651</url>
  <id>a62978979ffae4e27d821fa6a0cce2ed7d21a651</id>
  <committed-date>2009-07-07T06:10:43-07:00</committed-date>
  <authored-date>2009-05-03T07:19:55-07:00</authored-date>
  <message>Add parsing of the periodic timestamps to the transcript API

I need to be able to search transcripts to lookup the time at which
various events happened.

Campfire transcripts don't have exact timestamps.  But there is a
timestamp inserted every five minutes or so, which can be used to give
a rough sense of time.  Currently, the Tinder API doesn't provide
any way to access this timing information.

Make that approximate timestamp available as part of each message hash
in a transcript until the next timestamp is encountered.</message>
  <tree>7675a2906a5c148a07a5c2dcc18b8aad22579b13</tree>
  <committer>
    <name>Brandon Keepers</name>
    <email>brandon@collectiveidea.com</email>
  </committer>
</commit>
