diff options
author | 2008-06-06 00:48:09 +0000 | |
---|---|---|
committer | 2008-06-06 00:48:09 +0000 | |
commit | 2579d3db253ad983884836f47930f129a07fdb00 (patch) | |
tree | a19b7a517e88a3b02577884149004e4e0c84d6f6 | |
parent | Make python location variable. (diff) | |
download | rbot-gentoo-2579d3db253ad983884836f47930f129a07fdb00.tar.gz rbot-gentoo-2579d3db253ad983884836f47930f129a07fdb00.tar.bz2 rbot-gentoo-2579d3db253ad983884836f47930f129a07fdb00.zip |
response_prefix is not needed as you can just set the config var for core.reply_with_nick instead.
-rw-r--r-- | gentoo-data.rb | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/gentoo-data.rb b/gentoo-data.rb index de76c55..73ed845 100644 --- a/gentoo-data.rb +++ b/gentoo-data.rb @@ -48,17 +48,12 @@ class GentooPlugin < Plugin return py end - def response_prefix(m) - return "#{m.source.nick}: " if m.replyto =~ /^#/ - return "" - end - def meta(m, params) cp = params[:pkg] cp = validate_package(m, cp) return if cp.nil? f = IO.popen("#{python} #{scriptdir}/metadata.py '#{cp}'") - m.reply "#{response_prefix(m)}#{f.readlines}" + m.reply "#{f.readlines}" end def meta_verbose(m, params) @@ -66,7 +61,7 @@ class GentooPlugin < Plugin cp = validate_package(m, cp) f = IO.popen("#{python} #{scriptdir}/metadata.py '#{cp}'") output = f.readlines - m.reply "#{response_prefix(m)}#{output}" + m.reply "#{output}" params[:herd] = output[0].gsub(/^.* Herd: ([^ ]+) .*$/, '\1').strip p params herd(m, params) @@ -76,12 +71,12 @@ class GentooPlugin < Plugin cp = params[:pkg] cp = validate_package(m, cp) f = IO.popen("#{python} #{scriptdir}/changelog.py '#{cp}'") - m.reply "#{response_prefix(m)}#{f.readlines}" + m.reply "#{f.readlines}" end def devaway(m, params) res = @bot.httputil.get("http://dev.gentoo.org/devaway/index-csv.php?who=#{params[:dev]}") - m.reply "#{response_prefix(m)}#{res}" + m.reply "#{res}" end def initialize @@ -107,7 +102,7 @@ class GentooPlugin < Plugin herd = herds.get_elements("/herds/herd[name='#{params[:herd]}']") if herd.empty? # TODO: Add in not-a-herd.txt - m.reply "#{response_prefix(m)}Unable to find herd '#{params[:herd]}'" + m.reply "Unable to find herd '#{params[:herd]}'" else emails = nil for maintainer in herd[0].get_elements("/herds/herd[name='#{params[:herd]}']/maintainer/email") @@ -118,7 +113,7 @@ class GentooPlugin < Plugin emails << ', ' << maintainer.text.split('@')[0] end end - m.reply "#{response_prefix(m)}(#{params[:herd]}) #{emails}" + m.reply "(#{params[:herd]}) #{emails}" end end @@ -130,7 +125,7 @@ class GentooPlugin < Plugin split_line = line.split(' = ') alias_hash[split_line[0]] = split_line[1] end - m.reply "#{response_prefix(m)}#{params[:alias]} = #{alias_hash[params[:alias]]}" + m.reply "#{params[:alias]} = #{alias_hash[params[:alias]]}" end def glsa(m, params) @@ -146,7 +141,7 @@ class GentooPlugin < Plugin refs << ', ' << ref.text end end - m.reply "#{response_prefix(m)}#{glsa_body.get_elements("/glsa/title")[0].text} #{refs}" + m.reply "#{glsa_body.get_elements("/glsa/title")[0].text} #{refs}" end def glsa_search(m, params) @@ -185,10 +180,10 @@ class GentooPlugin < Plugin when 1 return packages[0] when 0 - m.reply "#{response_prefix(m)}No matching packages for '#{pn}'." + m.reply "No matching packages for '#{pn}'." return nil else - m.reply "#{response_prefix(m)}Ambiguous name '#{pn}'. Possible options: #{packages.join(' ')}" + m.reply "Ambiguous name '#{pn}'. Possible options: #{packages.join(' ')}" return nil end rescue ::Exception => e @@ -202,11 +197,11 @@ class GentooPlugin < Plugin return if cp.nil? packages = @bot.httputil.get(url+cp).split("\n") if packages.length == 0 - m.reply "#{response_prefix(m)}No packages have a reverse #{type} on #{cp}." + m.reply "No packages have a reverse #{type} on #{cp}." elsif packages.join(' ').length > 400 - m.reply "#{response_prefix(m)}Too many packages have reverse #{type} on #{cp}, go to #{url+cp} instead." + m.reply "Too many packages have reverse #{type} on #{cp}, go to #{url+cp} instead." else - m.reply "#{response_prefix(m)}Reverse #{type} for #{cp}: #{packages.join(' ')}" + m.reply "Reverse #{type} for #{cp}: #{packages.join(' ')}" end end @@ -225,13 +220,13 @@ class GentooPlugin < Plugin f = IO.popen("#{python} #{scriptdir}/earch -c '#{cp}'") output = f.readlines if output[0] =~ /^!!!/ - m.reply "#{response_prefix(m)}Unable to find package #{cp}" + m.reply "Unable to find package #{cp}" return end pn = cp.split('/')[-1] cp = output[0].split("/#{pn}-")[0]+'/'+pn output.map!{ |l| l.gsub(/^#{cp}-/,'').chomp } - m.reply "#{response_prefix(m)}#{cp} #{output.join(' ')}" + m.reply "#{cp} #{output.join(' ')}" end @@help_gentoo = { |