diff options
author | Chris Gahan <chris@ill-logic.com> | 2006-01-28 07:17:18 +0000 |
---|---|---|
committer | Chris Gahan <chris@ill-logic.com> | 2006-01-28 07:17:18 +0000 |
commit | 46cc000b3b9180cb9570a8b9afe1eaa31f622394 (patch) | |
tree | dfb2ef8bd7e593f04fd9827af11b073f4d75fb85 /data | |
parent | 6a606e8d5b485b578b9fcbe23f5e1fb5210f491f (diff) |
opme now says okay BEFORE opping!
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/opme.rb | 38 | ||||
-rw-r--r-- | data/rbot/plugins/url.rb | 8 |
2 files changed, 23 insertions, 23 deletions
diff --git a/data/rbot/plugins/opme.rb b/data/rbot/plugins/opme.rb index aad388a9..3df3d0d1 100644 --- a/data/rbot/plugins/opme.rb +++ b/data/rbot/plugins/opme.rb @@ -1,19 +1,19 @@ -class OpMePlugin < Plugin
-
- def help(plugin, topic="")
- return "opme <channel> => grant user ops in <channel>"
- end
-
- def privmsg(m)
- if(m.params)
- channel = m.params
- else
- channel = m.channel
- end
- target = m.sourcenick
- @bot.sendq("MODE #{channel} +o #{target}")
- m.okay
- end
-end
-plugin = OpMePlugin.new
-plugin.register("opme")
+class OpMePlugin < Plugin + + def help(plugin, topic="") + return "opme <channel> => grant user ops in <channel>" + end + + def privmsg(m) + if(m.params) + channel = m.params + else + channel = m.channel + end + target = m.sourcenick + m.okay + @bot.sendq("MODE #{channel} +o #{target}") + end +end +plugin = OpMePlugin.new +plugin.register("opme") diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb index a4e96359..78f89305 100644 --- a/data/rbot/plugins/url.rb +++ b/data/rbot/plugins/url.rb @@ -1,7 +1,7 @@ require 'net/http' require 'uri' require 'cgi' -
+ Url = Struct.new("Url", :channel, :nick, :time, :url) TITLE_RE = /<\s*?title\s*?>(.+?)<\s*?\/title\s*?>/im @@ -38,7 +38,7 @@ class UrlPlugin < Plugin url = URI.parse(uri_str) return if url.scheme !~ /https?/ - puts "+ connecting to #{url.host}:#{url.port}"
+ puts "+ connecting to #{url.host}:#{url.port}" http = @bot.httputil.get_proxy(url) title = http.start do |http| url.path = '/' if url.path == '' @@ -55,7 +55,7 @@ class UrlPlugin < Plugin if head['content-type'] =~ /^text\// # content is 'text/*' # retrieve the title from the page - puts "+ getting #{url.path}" + puts "+ getting #{url.request_uri}" response = http.request_get(url.request_uri) return get_title_from_html(response.body) else @@ -67,7 +67,7 @@ class UrlPlugin < Plugin when Net::HTTPClientError then return "[Link Info] Error getting link (#{head.code} - #{head.message})" when Net::HTTPServerError then - return "[Link Info] Error getting link (#{head.code} - #{head.message})"
+ return "[Link Info] Error getting link (#{head.code} - #{head.message})" end end rescue SocketError => e |