summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-01-07 01:17:23 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-01-07 01:24:34 +0100
commit852609ae698aafb5970d780518cdc016da87cabb (patch)
treebe804778e3a92761c79837c2cab7036ee8895c91
parenteaaea4319b21e4ddb4e3077f74255f3f0082122d (diff)
twitter: auth when checking friends timeline
Fixes issue #20.
-rw-r--r--data/rbot/plugins/twitter.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/data/rbot/plugins/twitter.rb b/data/rbot/plugins/twitter.rb
index a5ca23f8..94a1374e 100644
--- a/data/rbot/plugins/twitter.rb
+++ b/data/rbot/plugins/twitter.rb
@@ -62,7 +62,14 @@ class TwitterPlugin < Plugin
uri = "http://twitter.com/statuses/user_timeline/#{user}.xml?count=#{count}"
else
count = @bot.config['twitter.friends_status_count']
- uri = "http://twitter.com/statuses/friends_timeline/#{user}.xml"
+ auth = ""
+ if m.private?
+ auth << URI.escape(@registry[m.sourcenick + "_username"])
+ auth << ":"
+ auth << URI.escape(@registry[m.sourcenick + "_password"])
+ auth << "@"
+ end
+ uri = "http://#{auth}twitter.com/statuses/friends_timeline/#{user}.xml"
end
response = @bot.httputil.get(uri, :headers => @header, :cache => false)