From 2c2fc6a7228aa4919c735fd9d247892440839be5 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 14 Sep 2007 22:14:02 +0000 Subject: twitter plugin: identify ourselves as the twitter client --- data/rbot/plugins/twitter.rb | 8 ++++++-- 1 file 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 -- cgit v1.2.3