]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blob - data/rbot/plugins/remotectl.rb
script plugin: script echo and eval mark the message as replied
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / remotectl.rb
1 #-- vim:sw=4:et
2 #++
3 #
4 # :title: RemoteCtl plugin
5 #
6 # Author:: jsn (dmitry kim) <dmitry dot kim at gmail dot org>
7 # Copyright:: (C) 2007 dmitry kim
8 # License:: in public domain
9 #
10 # Adds druby remote command execution to rbot. See 'bin/rbot-remote' for
11 # example usage.
12
13 class RemoteCtlPlugin < Plugin
14     include RemotePlugin
15
16     def remote_command(m, params)
17         s = params[:string].to_s
18         u = @bot.server.user("remote:#{m.source.username}")
19         @bot.auth.login(u, m.source.username, m.source.password)
20         new_m = PrivMessage.new(@bot, @bot.server, u, @bot.myself, s)
21         @bot.plugins.delegate "listen", new_m
22         @bot.plugins.privmsg(new_m)
23     end
24 end
25
26 me = RemoteCtlPlugin.new
27
28 me.remote_map 'dispatch *string',
29     :action => 'remote_command'
30
31 me.default_auth('*', false)