summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/host.rb
blob: e81386ceb5fa61b86cabaaca9fa6b28745d4f9d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class HostPlugin < Plugin
  Config.register Config::StringValue.new('host.path',
     :default => 'host',
     :desc => _('Path to the host program'))

  def help(plugin, topic="")
    "host <domain> => query nameserver about domain names and zones for <domain>"
  end

  def host_path
    @bot.config["host.path"]
  end

  def privmsg(m)
    unless(m.params =~ /^(\w|-|\.)+$/)
      m.reply "incorrect usage: " + help(m.plugin)
      return
    end
    m.reply Utils.safe_exec(host_path, m.params)
  end
end
plugin = HostPlugin.new
plugin.register("host")