From 198f43f61a0b55da01a9c4994412f9c0219adea9 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Sun, 17 Jul 2005 22:56:16 +0000 Subject: [PATCH] starting on an http interface for configuring the bot --- rbot/plugins/httpd.rb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 rbot/plugins/httpd.rb 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 = "rbot httpd plugin" + resp.body += "#{@bot.status}
" + resp.body += "hello from rbot." + resp.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") -- 2.39.2