]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blob - data/rbot/plugins/httpd.rb.disabled
plugin(imdb): changed base url
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / httpd.rb.disabled
1 require 'webrick'
2
3 class HttpPlugin < Plugin
4   include WEBrick
5
6
7   def initialize
8     super
9     @http_server = HTTPServer.new(
10       :Port => 5555
11     )
12     @http_server.mount_proc("/") { |req, resp|
13       resp['content-type'] = 'text/html'
14       resp.body = "<html><head><title>rbot httpd plugin</title></head><body>"
15       resp.body += "#{@bot.status} <br />"
16       resp.body += "hello from rbot."
17       resp.body += "</body>"
18       raise HTTPStatus::OK
19     }
20     Thread.new {
21       @http_server.start
22     }
23   end
24   def cleanup
25     @http_server.shutdown
26     super
27   end
28   def help(plugin, topic="")
29     "no help yet"
30   end
31   def privmsg(m)
32   end
33 end
34
35 plugin = HttpPlugin.new
36 plugin.register("http")