<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,7 +12,7 @@ $Data::Dumper::Indent = 1;
 use vars qw($VERSION %IRSSI);
 
 $VERSION = &quot;2.0.6&quot;;
-my ($REV) = '$Rev: 487 $' =~ /(\d+)/;
+my ($REV) = '$Rev: 488 $' =~ /(\d+)/;
 %IRSSI = (
     authors     =&gt; 'Dan Boger',
     contact     =&gt; 'zigdon@gmail.com',
@@ -21,7 +21,7 @@ my ($REV) = '$Rev: 487 $' =~ /(\d+)/;
       . 'Can optionally set your bitlbee /away message to same',
     license =&gt; 'GNU GPL v2',
     url     =&gt; 'http://twirssi.com',
-    changed =&gt; '$Date: 2009-02-24 11:27:26 -0800 (Tue, 24 Feb 2009) $',
+    changed =&gt; '$Date: 2009-02-24 13:57:57 -0800 (Tue, 24 Feb 2009) $',
 );
 
 my $window;
@@ -416,7 +416,7 @@ sub cmd_login {
         }
         %nicks = %friends;
         $nicks{$user} = 0;
-        &amp;get_updates;
+        return 1;
     } else {
         &amp;notice(&quot;Login failed&quot;);
     }
@@ -844,8 +844,15 @@ sub monitor_child {
     print scalar localtime, &quot; - checking child log at $filename ($attempt)&quot;
       if &amp;debug;
     my $new_last_poll;
+
+    # first time we run we don't want to print out *everything*, so we just
+    # pretend
+    my $suppress = 0;
+    $suppress = 1 unless keys %tweet_cache;
+
     if ( open FILE, $filename ) {
         my @lines;
+        my %new_cache;
         while (&lt;FILE&gt;) {
             chomp;
             last if /^__friends__/;
@@ -858,8 +865,11 @@ sub monitor_child {
             }
 
             if ( not $meta{type} or $meta{type} ne 'searchid' ) {
-                next if exists $meta{id} and exists $tweet_cache{ $meta{id} };
-                $tweet_cache{ $meta{id} } = time;
+                $new_cache{ $meta{id} } = time;
+
+                if ( exists $meta{id} and exists $tweet_cache{ $meta{id} } ) {
+                    next;
+                }
             }
 
             my $account = &quot;&quot;;
@@ -944,12 +954,16 @@ sub monitor_child {
 
         if ($new_last_poll) {
             print &quot;new last_poll = $new_last_poll&quot; if &amp;debug;
-            for my $line (@lines) {
-                $window-&gt;printformat(
-                    $line-&gt;[0],
-                    &quot;twirssi_&quot; . $line-&gt;[1],
-                    @$line[ 2 .. $#$line ]
-                );
+            if ($suppress) {
+                print &quot;First call, not printing updates&quot; if &amp;debug;
+            } else {
+                foreach my $line (@lines) {
+                    $window-&gt;printformat(
+                        $line-&gt;[0],
+                        &quot;twirssi_&quot; . $line-&gt;[1],
+                        @$line[ 2 .. $#$line ]
+                    );
+                }
             }
 
             close FILE;
@@ -957,6 +971,10 @@ sub monitor_child {
               or warn &quot;Failed to remove $filename: $!&quot;
               unless &amp;debug;
 
+            # commit the pending cache lines to the actual cache, now that
+            # we've printed our output
+            %tweet_cache = ( %tweet_cache, %new_cache );
+
             # keep enough cached tweets, to make sure we don't show duplicates.
             foreach ( keys %tweet_cache ) {
                 next if $tweet_cache{$_} &gt;= $last_poll - 3600;
@@ -1218,6 +1236,11 @@ if ($window) {
             print &quot;nicks: &quot;,   join &quot;, &quot;, sort keys %nicks;
             print &quot;searches: &quot;, Dumper \%{ $id_map{__searches} };
             print &quot;last poll: $last_poll&quot;;
+            if ( open DUMP, &quot;&gt;/tmp/twirssi.cache.txt&quot; ) {
+                print DUMP Dumper \%tweet_cache;
+                close DUMP;
+                print &quot;cache written out to /tmp/twirssi.cache.txt&quot;;
+            }
         }
     );
     Irssi::command_bind(
@@ -1286,6 +1309,7 @@ if ($window) {
         and my $autopass = Irssi::settings_get_str(&quot;twitter_passwords&quot;) )
     {
         &amp;cmd_login();
+        &amp;get_updates;
     }
 
 } else {</diff>
      <filename>twirssi.pl</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b677a10fcaf483e05489407db9b4362f18f062a1</id>
    </parent>
  </parents>
  <author>
    <name>Dan Boger</name>
    <login></login>
    <email>zigdon@irc.peeron.com</email>
  </author>
  <url>http://github.com/bssteph/twirssi/commit/eb3ecf0e24972c2a6f779dcd01f4471f274ac70b</url>
  <id>eb3ecf0e24972c2a6f779dcd01f4471f274ac70b</id>
  <committed-date>2009-02-24T13:58:13-08:00</committed-date>
  <authored-date>2009-02-24T13:58:13-08:00</authored-date>
  <message>r488 - Don't cahce tweets until we actually display them.  Dump now dumps out the duplicate cache too.  When we first call updates, nothing will be shown, instead of spamming 20x num-of-accounts</message>
  <tree>9ec49581150ec27d7606bc79abd73e784cfe8664</tree>
  <committer>
    <name>Dan Boger</name>
    <login></login>
    <email>zigdon@irc.peeron.com</email>
  </committer>
</commit>
