From 787c3322e0c1acdccb457c47bea76f31c5747f52 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Thu, 10 Mar 2005 12:11:17 +0000 Subject: fix http usage, other tweaks --- rbot/plugins/google.rb | 22 +++++++++++----------- rbot/plugins/nickserv.rb | 8 +++++++- 2 files changed, 18 insertions(+), 12 deletions(-) (limited to 'rbot/plugins') diff --git a/rbot/plugins/google.rb b/rbot/plugins/google.rb index 5fa466e7..2e9aacba 100644 --- a/rbot/plugins/google.rb +++ b/rbot/plugins/google.rb @@ -29,21 +29,21 @@ class GooglePlugin < Plugin http = Net::HTTP.new("www.google.com", 80, proxy_host, proxy_port) - http.start {|http| - begin - resp , = http.get(query) + begin + http.start {|http| + resp = http.get(query) if resp.code == "302" result = resp['location'] end - rescue => e - p e - if e.response && e.response['location'] - result = e.response['location'] - else - result = "error!" - end + } + rescue => e + p e + if e.response && e.response['location'] + result = e.response['location'] + else + result = "error!" end - } + end m.reply "#{m.params}: #{result}" end end diff --git a/rbot/plugins/nickserv.rb b/rbot/plugins/nickserv.rb index 6067ec3e..94c57e6d 100644 --- a/rbot/plugins/nickserv.rb +++ b/rbot/plugins/nickserv.rb @@ -9,7 +9,7 @@ class NickServPlugin < Plugin when "password" return "nickserv password : remember the password for nick and use it to identify in future" when "register" - return "nickserv register []: register the current nick, choosing a random password unless is supplied - current nick must not already be registered for this to work" + return "nickserv register [ []]: register the current nick, choosing a random password unless is supplied - current nick must not already be registered for this to work. Also specify email if required by your services" when "identify" return "nickserv identify: identify with nickserv - shouldn't be needed - bot should identify with nickserv immediately on request - however this could be useful after splits or service disruptions, or when you just set the password for the current nick" when "listnicks" @@ -44,6 +44,12 @@ class NickServPlugin < Plugin @bot.sendmsg "PRIVMSG", "NickServ", "REGISTER " + passwd @registry[@bot.nick] = passwd @bot.okay m.replyto + when (/^register\s*(\S*)\s*(.*)$/) + passwd = $1 + email = $2 + @bot.sendmsg "PRIVMSG", "NickServ", "REGISTER " + passwd + " " + email + @registry[@bot.nick] = passwd + @bot.okay m.replyto when (/^register\s*(.*)\s*$/) passwd = $1 @bot.sendmsg "PRIVMSG", "NickServ", "REGISTER " + passwd -- cgit v1.2.3