blob: ccfb42e2de69f6fcaf1ae25c706e643066a7e81e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
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
super
end
def help(plugin, topic="")
"no help yet"
end
def privmsg(m)
end
end
plugin = HttpPlugin.new
plugin.register("http")
|