summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-09-14 22:14:02 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-09-14 22:14:02 +0000
commit2c2fc6a7228aa4919c735fd9d247892440839be5 (patch)
tree53e36fc1095813af27c2123457115d76d54782a5
parentd611c8bfc1d1a240b30a6757229bcc3c8bb697db (diff)
twitter plugin: identify ourselves as the twitter client
-rw-r--r--data/rbot/plugins/twitter.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/data/rbot/plugins/twitter.rb b/data/rbot/plugins/twitter.rb
index f04ca673..449c6c28 100644
--- a/data/rbot/plugins/twitter.rb
+++ b/data/rbot/plugins/twitter.rb
@@ -26,6 +26,10 @@ class TwitterPlugin < Plugin
val
end
end
+
+ @header = {
+ 'X-Twitter-Client' => 'rbot twitter plugin'
+ }
end
# return a help string when the bot is asked for help on this plugin
@@ -46,7 +50,7 @@ class TwitterPlugin < Plugin
# TODO configurable count
uri = "http://twitter.com/statuses/user_timeline/#{URI.escape(nick)}.xml?count=3"
- response = @bot.httputil.get(uri, :cache => false)
+ response = @bot.httputil.get(uri, :headers => @header, :cache => false)
debug response
texts = []
@@ -87,7 +91,7 @@ class TwitterPlugin < Plugin
uri = "http://#{URI.escape(@registry[m.sourcenick + "_username"])}:#{URI.escape(@registry[m.sourcenick + "_password"])}@twitter.com/statuses/update.xml"
- response = @bot.httputil.post(uri, "status=#{CGI.escape(params[:status].to_s)}")
+ response = @bot.httputil.post(uri, "status=#{CGI.escape(params[:status].to_s)}", :headers => @header)
debug response
if response.class == Net::HTTPOK