summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-09-14 22:14:06 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-09-14 22:14:06 +0000
commit84976c37cb80caa7b505dec788acfb52eb513c86 (patch)
tree8cbe820fa8f986bf950a0350e9d323c45a18c80d
parent09404cd444f9a9acacbffcb917b180454bf95c7e (diff)
twitter plugin: minor refactoring
-rw-r--r--data/rbot/plugins/twitter.rb11
1 files changed, 8 insertions, 3 deletions
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