From 84976c37cb80caa7b505dec788acfb52eb513c86 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 14 Sep 2007 22:14:06 +0000 Subject: twitter plugin: minor refactoring --- data/rbot/plugins/twitter.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'data/rbot/plugins') diff --git a/data/rbot/plugins/twitter.rb b/data/rbot/plugins/twitter.rb index 65bc8eb7..daa237c0 100644 --- a/data/rbot/plugins/twitter.rb +++ b/data/rbot/plugins/twitter.rb @@ -47,9 +47,10 @@ class TwitterPlugin < Plugin return false end + user = URI.escape(nick) # TODO configurable count - uri = "http://twitter.com/statuses/user_timeline/#{URI.escape(nick)}.xml?count=3" + uri = "http://twitter.com/statuses/user_timeline/#{user}.xml?count=3" response = @bot.httputil.get(uri, :headers => @header, :cache => false) debug response @@ -90,9 +91,13 @@ class TwitterPlugin < Plugin return false end - uri = "http://#{URI.escape(@registry[m.sourcenick + "_username"])}:#{URI.escape(@registry[m.sourcenick + "_password"])}@twitter.com/statuses/update.xml" + user = URI.escape(@registry[m.sourcenick + "_username"]) + pass = URI.escape(@registry[m.sourcenick + "_password"]) + uri = "http://#{user}:#{pass}@twitter.com/statuses/update.xml" - response = @bot.httputil.post(uri, "status=#{CGI.escape(params[:status].to_s)}", :headers => @header) + body = "status=#{CGI.escape(params[:status].to_s)}" + + response = @bot.httputil.post(uri, body, :headers => @header) debug response if response.class == Net::HTTPOK -- cgit v1.2.3