diff options
author | Dmitry Kim <dmitry point kim at gmail point com> | 2007-08-31 23:59:02 +0000 |
---|---|---|
committer | Dmitry Kim <dmitry point kim at gmail point com> | 2007-08-31 23:59:02 +0000 |
commit | 0cc10dda002cdd1568aed585c38fa6cf63db77fd (patch) | |
tree | 9e4d3c3b5b029508ed5e6f9341aa143ba2bcc313 /data | |
parent | 55a1893a1cb5a7872339f2280cc5927b97f16327 (diff) |
* (plugins/grouphug) thread, don't block (tm)
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/grouphug.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/data/rbot/plugins/grouphug.rb b/data/rbot/plugins/grouphug.rb index 15735b9f..32a6e55e 100644 --- a/data/rbot/plugins/grouphug.rb +++ b/data/rbot/plugins/grouphug.rb @@ -20,16 +20,19 @@ class GrouphugPlugin < Plugin opts.delete(:cache) end - begin - data = @bot.httputil.get("http://grouphug.us/#{path}", opts) - - reg = Regexp.new( '(<td class="conf-text")(.*?)(<p>)(.*?)(</p>)', Regexp::MULTILINE ) - confession = reg.match( data )[4].ircify_html - confession = "no confession ##{params[:num]} found" if confession.empty? and params[:num] - - m.reply confession - rescue - m.reply "failed to connect to grouphug.us" + Thread.start do + begin + data = @bot.httputil.get("http://grouphug.us/#{path}", opts) + + reg = Regexp.new('(<td class="conf-text")(.*?)(<p>)(.*?)(</p>)', + Regexp::MULTILINE) + confession = reg.match( data )[4].ircify_html + confession = "no confession ##{params[:num]} found" if confession.empty? and params[:num] + + m.reply confession + rescue + m.reply "failed to connect to grouphug.us" + end end end end |