<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -69,26 +69,26 @@ module Twibot
 
         processed[:tweet] = tweets.first.id if tweets.length &gt; 0
         processed[:reply] = tweets.first.id if tweets.length &gt; 0
-        
+
         # for searches, use latest tweet on public timeline
         #
         if handle_tweets &amp;&amp; config[:timeline_for].to_s != &quot;public&quot;
           sandbox { tweets = twitter.timeline_for(:public, { :count =&gt; 1 }) }
         end
         if tweets.length &gt; 0
-          handlers[:search].each_key {|q| processed[:search][q] = tweets.first.id }
+          handlers_for_type(:search).each_key {|q| processed[:search][q] = tweets.first.id }
         end
-        
+
         load_followers
-        
+
       when Numeric, /\d+/ # a tweet ID to start from
         processed[:tweet] = processed[:reply] = processed[:message] = config[:process]
         handlers[:search].each_key {|q| processed[:search][q] = config[:process] }
       else abort &quot;Unknown process option #{config[:process]}, aborting...&quot;
       end
-      
+
       load_friends unless handlers_for_type(:follower).empty?
-      
+
       poll
     end
 
@@ -107,60 +107,60 @@ module Twibot
         message_count += receive_replies || 0
         message_count += receive_tweets || 0
         message_count += receive_searches || 0
-        
+
         receive_followers
-        
+
         run_hook :after_all, message_count
-        
+
         interval = message_count &gt; 0 ? min_interval : [interval + step, max].min
-        
+
         log.debug &quot;#{config[:host]} sleeping for #{interval}s&quot;
         sleep interval
       end
     end
-    
-    
+
+
     def friend_ids
       @friend_ids ||= {}
     end
-    
+
     def add_friend!(user_or_id, only_local=false)
       id = id_for_user_or_id(user_or_id)
       sandbox(0) { twitter.friend(:add, id) } unless only_local
       friend_ids[id] = true
     end
-    
+
     def remove_friend!(user_or_id, only_local=false)
       id = id_for_user_or_id(user_or_id)
       sandbox(0) { twitter.friend(:remove, id) } unless only_local
       friend_ids[id] = false
     end
-    
+
     def is_friend?(user_or_id)
       !!friend_ids[id_for_user_or_id(user_or_id)]
     end
-    
+
     def follower_ids
       @follower_ids ||= {}
     end
-    
+
     def add_follower!(user_or_id)
       follower_ids[id_for_user_or_id(user_or_id)] = true
     end
-    
+
     def remove_follower!(user_or_id)
       follower_ids[id_for_user_or_id(user_or_id)] = false
     end
-    
+
     def is_follower?(user_or_id)
       !!follower_ids[id_for_user_or_id(user_or_id)]
     end
-    
+
     def id_for_user_or_id(user_or_id)
       (user_or_id.respond_to?(:screen_name) ? user_or_id.id : user_or_id).to_i
     end
-    
-    
+
+
     #
     # retrieve a list of friend ids and store it as a Hash
     #
@@ -169,7 +169,7 @@ module Twibot
         twitter.graph(:friends, config[:login]).each {|id| add_friend!(id, true) }
       end
     end
-    
+
     #
     # retrieve a list of friend ids and store it as a Hash
     #
@@ -178,22 +178,22 @@ module Twibot
         twitter.graph(:followers, config[:login]).each {|id| add_follower!(id) }
       end
     end
-    
-    
+
+
     #
     # returns a Hash of all registered hooks
     #
     def hooks
       @hooks ||= {}
     end
-    
+
     #
     # registers a block to be called at the given +event+
     #
     def add_hook(event, &amp;blk)
       hooks[event.to_sym] = blk
     end
-    
+
     #
     # calls the hook method for the +event+ if one has
     # been defined
@@ -201,7 +201,7 @@ module Twibot
     def run_hook(event, *args)
       hooks[event.to_sym].call(*args) if hooks[event.to_sym].respond_to? :call
     end
-    
+
     #
     # Receive direct messages
     #
@@ -249,22 +249,22 @@ module Twibot
     #
     def receive_searches
       result_count = 0
-      
+
       handlers_for_type(:search).each_pair do |query, search_handlers|
         options = { :q =&gt; query, :rpp =&gt; 100 }
         [:lang, :geocode].each do |param|
           options[param] = search_handlers.first.options[param] if search_handlers.first.options[param]
         end
         options[:since_id] = processed[:search][query] if processed[:search][query]
-        
+
         result_count += sandbox(0) do
           dispatch_messages([:search, query], twitter.search(options.merge(options)), %w{tweet tweets}.map {|l| &quot;#{l} for \&quot;#{query}\&quot;&quot;})
         end
       end
-      
+
       result_count
     end
-    
+
     #
     # Receive any new followers
     #
@@ -279,7 +279,7 @@ module Twibot
       end
       log.info &quot;#{config[:host]}: Received #{newbies.size} new #{newbies.size == 1 ? 'follower' : 'followers'}&quot;
     end
-    
+
     #
     # Dispatch a collection of messages
     #
@@ -296,7 +296,7 @@ module Twibot
       log.info &quot;#{config[:host]}: Received #{num} #{num == 1 ? labels[0] : labels[1]}&quot;
       num
     end
-    
+
     #
     # invokes the given block, running the before and
     # after hooks for the given type
@@ -308,7 +308,7 @@ module Twibot
       run_hook :&quot;after_#{event}&quot;
       value
     end
-    
+
     #
     # Return logger instance
     #</diff>
      <filename>lib/twibot/bot.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,15 +7,15 @@ module Twibot
       handlers_for_type(type) &lt;&lt; handler
       handler
     end
-    
+
     def handlers_for_type(type)
       if type.is_a? Array
         handlers[type.first][type.last] ||= []
       else
-        handlers[type]
+        handlers[type] || {}
       end
     end
-    
+
     def dispatch(type, message)
       handlers_for_type(type).each { |handler| handler.dispatch(message) }
     end</diff>
      <filename>lib/twibot/handlers.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2679b4a966823f6e4190e1dad115fbda3b3850af</id>
    </parent>
  </parents>
  <author>
    <name>Christian Johansen</name>
    <email>christian@cjohansen.no</email>
  </author>
  <url>http://github.com/cjohansen/twibot/commit/8cd96251d9de93e21795c7ea659cef39d202f4ae</url>
  <id>8cd96251d9de93e21795c7ea659cef39d202f4ae</id>
  <committed-date>2009-08-14T13:59:34-07:00</committed-date>
  <authored-date>2009-08-14T13:59:34-07:00</authored-date>
  <message>always return hash from handlers_for_type</message>
  <tree>68b2f06cdb1f21949d7b82ca1b40e9fbbb8d0644</tree>
  <committer>
    <name>Christian Johansen</name>
    <email>christian@cjohansen.no</email>
  </committer>
</commit>
