<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,6 @@
 
+v4.2.2. Fix Delicious integration.
+
 v4.2.1. Small fix for tryruby compatibility.
 
 v4.2. Add channel logging; clean up options handling; fix docs.</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-%w[open3 daemons socket singleton open-uri cgi pathname hpricot yaml net/https].map{|s| require s}
+%w[open3 daemons socket singleton open-uri cgi pathname hpricot yaml net/https timeout].map{|s| require s}
 
 =begin rdoc
 In-channel commands:
@@ -88,7 +88,7 @@ class Kirby
               when /^reset_irb/ then reset_irb
               when /^add_svn (.+?)(\s|\r|\n|$)/ then @svns[$1] = 0 and say @svns.inspect
               when /^add_atom (.+?)(\s|\r|\n|$)/ then @atoms[$1] = '' and say @atoms.inspect
-              when /(http:\/\/.*?)(\s|\r|\n|$)/ then post($1) if config[:delicious_pass] 
+              when /(http(s|):\/\/.*?)(\s|\r|\n|$)/ then post($1) if config[:delicious_pass] 
             end
           end
       end
@@ -168,23 +168,43 @@ class Kirby
     File.open(config[:atoms], 'w') {|f| f.puts YAML.dump(@atoms)}
   end
   
-  # Post a url to the del.icio.us account.
+  # Post a url to the del.i	cio.us account.
   def post url
-    puts &quot;POST: #{url}&quot; if config[:debug]
-    query = {:url =&gt; url,
-      :description =&gt; (((Hpricot(open(url))/:title).first.innerHTML or url) rescue url),
-      :tags =&gt; (Hpricot(open(&quot;http://del.icio.us/url/check?url=#{CGI.escape(url)}&quot;))/'.alphacloud'/:a).map{|s| s.innerHTML}.join(&quot; &quot;),
-      :replace =&gt; 'yes' }
-    begin
+    Timeout.timeout(60) do
+      puts &quot;POST: #{url}&quot; if config[:debug]
+  
+      tags = (Hpricot(open(&quot;http://del.icio.us/url/check?url=#{CGI.escape(url)}&quot;))/
+      '#top-tags'/'li')[0..10].map do |li| 
+        (li/'span').innerHTML[/(.*?)&lt;em/, 1]
+      end.join(&quot; &quot;)
+      puts &quot;POST-TAGS: #{tags}&quot; if config[:debug]
+      
+      description = begin
+        Timeout.timeout(5) do 
+          (((Hpricot(open(url))/:title).first.innerHTML or url) rescue url)
+        end
+      rescue Timeout::Error
+        puts &quot;POST: URL timeout&quot; if config[:debug]
+        url
+      end
+      
+      query = { :url =&gt; url, :description =&gt; description, :tags =&gt; tags, :replace =&gt; 'yes' }
+
       http = Net::HTTP.new('api.del.icio.us', 443)         
       http.use_ssl = true      
+      http.verify_mode = OpenSSL::SSL::VERIFY_NONE
       response = http.start do |http|
-        req = Net::HTTP::Get.new('/v1/posts/add?' + query.map{|k,v| &quot;#{k}=#{CGI.escape(v)}&quot;}.join('&amp;'))
+        post_url = '/v1/posts/add?' + query.map {|k,v| &quot;#{k}=#{CGI.escape(v)}&quot;}.join('&amp;')
+        puts &quot;POST: post url #{post_url}&quot; if config[:debug]
+        req = Net::HTTP::Get.new(post_url, {&quot;User-Agent&quot; =&gt; &quot;Kirby&quot;})
         req.basic_auth config[:delicious_user], config[:delicious_pass]
         http.request(req)
       end.body
+
       puts &quot;POST: #{response.inspect}&quot; if config[:debug]
     end
+  rescue Exception =&gt; e
+    puts &quot;POST: #{e.inspect}&quot; if config[:debug]
   end
   
 end</diff>
      <filename>lib/kirby.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>37de367b32216e14e156fcbf2c5ebfb14cbe5d3f</id>
    </parent>
  </parents>
  <author>
    <name>Evan Weaver</name>
    <email>eweaver@twitter.com</email>
  </author>
  <url>http://github.com/fauna/kirby/commit/64a2a22b5f134dbd97852e89e49e1f2ffb6a3b26</url>
  <id>64a2a22b5f134dbd97852e89e49e1f2ffb6a3b26</id>
  <committed-date>2009-07-01T22:39:36-07:00</committed-date>
  <authored-date>2009-07-01T22:17:10-07:00</authored-date>
  <message>Fix delicious integration.</message>
  <tree>a367e0900ca84a6a31b0e227eada4f7584d22c9f</tree>
  <committer>
    <name>Evan Weaver</name>
    <email>eweaver@twitter.com</email>
  </committer>
</commit>
