diff options
author | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-07-17 22:56:16 +0000 |
---|---|---|
committer | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-07-17 22:56:16 +0000 |
commit | 198f43f61a0b55da01a9c4994412f9c0219adea9 (patch) | |
tree | 8da6d25f87d489b1e7c067dc459541aadd7999bf /rbot | |
parent | b5f5b2a9b7db77898bf585c9f11f9a99a61ab854 (diff) |
starting on an http interface for configuring the bot
Diffstat (limited to 'rbot')
-rw-r--r-- | rbot/plugins/httpd.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/rbot/plugins/httpd.rb b/rbot/plugins/httpd.rb new file mode 100644 index 00000000..92fe3a80 --- /dev/null +++ b/rbot/plugins/httpd.rb @@ -0,0 +1,35 @@ +require 'webrick' + +class HttpPlugin < Plugin + include WEBrick + + + def initialize + super + @http_server = HTTPServer.new( + :Port => 5555 + ) + @http_server.mount_proc("/") { |req, resp| + resp['content-type'] = 'text/html' + resp.body = "<html><head><title>rbot httpd plugin</title></head><body>" + resp.body += "#{@bot.status} <br />" + resp.body += "hello from rbot." + resp.body += "</body>" + raise HTTPStatus::OK + } + Thread.new { + @http_server.start + } + end + def cleanup + @http_server.shutdown + end + def help(plugin, topic="") + "no help yet" + end + def privmsg(m) + end +end + +plugin = HttpPlugin.new +plugin.register("http") |