This file is indexed.

/usr/share/nadoka/plugins/dictbot.nb is in nadoka 0.7.6-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
=begin

This plugin is test version.

=end

require 'uri'
require 'open-uri'
require 'kconv'

class DictBot < Nadoka::NDK_Bot
  def bot_initialize
    @available_channel = @bot_config[:ch] || /.*/
    
  end
  
  
  def on_privmsg prefix, ch, msg
    if @available_channel === ch
      if /\Adic(.)>\s*(.+)\s*/ =~ msg
        res = yahoo_dict $1, $2.toeuc
        send_notice(ch, res)
      end
    end
  end


  YAHOO_DICT_TYPE ={
    't' => 2,
    'e' => 1,
    'j' => 0,
    'w' => 3,
    'r' => 5,
  }
  def yahoo_dict type, word
    "dict bot> " +
    if type = YAHOO_DICT_TYPE[type]
      word = URI.encode(word)
      uri = "http://dic.yahoo.co.jp/dsearch?p=#{word}&stype=0&dtype=#{type}"
      open(uri){|f|
        if /<meta name="description" content=\"(.+?)\">/ =~ f.read
          "#{$1.tosjis.tojis} - #{uri}"
        else
          uri
        end
      }
    else
      "unknown type: #{type}"
    end
  end
end