]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
AUTHORS update.
authorTom Gilbert <tom@linuxbrit.co.uk>
Wed, 10 Aug 2005 23:12:50 +0000 (23:12 +0000)
committerTom Gilbert <tom@linuxbrit.co.uk>
Wed, 10 Aug 2005 23:12:50 +0000 (23:12 +0000)
Added two plugins from Robin Kearney <robin@riviera.org.uk>

AUTHORS
ChangeLog
TODO
data/rbot/plugins/bash.rb [new file with mode: 0644]
data/rbot/plugins/karma.rb
data/rbot/plugins/lart.rb
data/rbot/plugins/threat.rb [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index e045b6f85af35247ffe7ab66273c14259d27cec3..0c01959de6d66c83e43da22cd0e847c6eb8b856a 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -3,12 +3,17 @@ o Tom Gilbert (giblet) <tom@linuxbrit.co.uk>
 
 Patch contributors
 o Peter Suschlik (pesu) <peter@zilium.de>
+o Alexey I. Froloff <raorn@altlinux.ru>
+o Ari Pollak <ajp@aripollak.com>
+o Rudolf Polzer <atfield-dt@durchnull.de>
+o RenĂ© Nussbaumer <public@killerfox.forkbomb.ch>
 
 Module contributors
 o dice.rb  - David Dorward (Dorward) <david@david.us-lot.org>
 o lart.rb  - Michael Brailsford <brailsmt@yahoo.com>
 o stats.rb - Michael Brailsford <brailsmt@yahoo.com>
 o ri.rb    - Michael Brailsford <brailsmt@yahoo.com>
+o bash/threat - Robin Kearney <robin@riviera.org.uk>
 
 "Testing" (having fun breaking rbot creatively)
 o Paul Duncan (pabs) <pabs@pablotron.org>
index 8cfa72b8cb1595d1a144895e2e62ffed8fb96a3c..9be8c62cc32ef3748400e8541b515154ebd17fef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Thu Aug 11 00:04:31 BST 2005  Tom Gilbert <tom@linuxbrit.co.uk>
+
+  * Patches from "Alexey I. Froloff" <raorn@altlinux.ru>
+       * Do not use "/home/#{Etc.getlogin}/" for default home directory, use
+       "#{Etc.getpwnam(Etc.getlogin).dir}/" instead.
+       * Do not try to load same plugin from different locations.  Added ability
+       to disable system-wide plugins - create PLUGIN.rb.disabled in user's
+       plugins directory.
+       * For example, to disable freshmeat plugin installed in /usr/share/rbot/plugins/freshmeat.rb one can create empty file ~/.rbot/plugins/freshmeat.rb.disabled
+
 Mon Aug 08 23:08:01 BST 2005  Tom Gilbert <tom@linuxbrit.co.uk>
 
   * new markov plugin for random inane chat
diff --git a/TODO b/TODO
index ff120780c9f27d85eae1c9290a1a4f06baa3b842..4172eea61061b4709c8cde26a592f93dc1bea481 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,3 +1,5 @@
+o if searchquote (or similar) has 3 results, roundrobin between them as
+asked, don't respond a random one
 o freeze/thaw factoids (make them readonly) at higher auth
 o respond to insults
 o feed back errors from plugins (optional)
diff --git a/data/rbot/plugins/bash.rb b/data/rbot/plugins/bash.rb
new file mode 100644 (file)
index 0000000..6f954a1
--- /dev/null
@@ -0,0 +1,56 @@
+# bash.org xml plugin for rbot
+# by Robin Kearney (robin@riviera.org.uk)
+#
+# its a bit of a quick hack, but it works for us :)
+#
+require 'rexml/document'
+require 'uri/common'
+
+class BashPlugin < Plugin
+  include REXML
+  def help(plugin, topic="")
+    "bash => print a random quote from bash.org, bash quote_id => print that quote id from bash.org, bash latest => print the latest quote from bash.org (currently broken, need to get josh@bash.org to fix the xml)"
+  end
+  def privmsg(m)
+    if m.params && m.params =~ /^([-\d]+)$/
+      id = $1
+      bash m, id
+       elsif(m.params == "latest")
+         bash m, id
+    else
+      bash m
+    end
+  end
+  
+  def bash(m, id=0)
+
+       if(id != 0)
+       xml = @bot.httputil.get URI.parse("http://bash.org/xml/?" + id + "&num=1")
+       elsif(id == "latest")
+       xml = @bot.httputil.get URI.parse("http://bash.org/xml/?latest&num=1")
+       else
+       xml = @bot.httputil.get URI.parse("http://bash.org/xml/?random&num=1")
+       end     
+    unless xml
+      m.reply "bash.org rss parse failed"
+      return
+    end
+    doc = Document.new xml
+    unless doc
+      m.reply "bash.org rss parse failed"
+      return
+    end
+       doc.elements.each("*/item") {|e|
+               if(id != 0) 
+                       reply = e.elements["title"].text.gsub(/QDB: /,"") + " " + e.elements["link"].text.gsub(/QDB: /,"") + "\n"
+                       reply = reply + e.elements["description"].text.gsub(/\<br \/\>/, "\n")
+               else
+                       reply = e.elements["title"].text.gsub(/QDB: /,"") + " " + e.elements["link"].text.gsub(/QDB: /,"") + "\n"
+                       reply = reply + e.elements["description"].text.gsub(/\<br \/\>/, "\n")
+               end
+               m.reply reply
+       }
+  end
+end
+plugin = BashPlugin.new
+plugin.register("bash")
index 148427a53cd15f36872f8c5abd2ba2ec7fc08bb4..824ffa956445e3f98ef375a7286c63d0df57232b 100644 (file)
@@ -52,7 +52,7 @@ class KarmaPlugin < Plugin
   
   
   def help(plugin, topic="")
-    "karma module: <thing>++/<thing>-- => increase/decrease karma for <thing>, karma for <thing>? => show karma for <thing>, karmastats => show stats. Karma is a community rating system - only in-channel messages can affect karma and you cannot adjust your own."
+    "karma module: Listens to everyone's chat. <thing>++/<thing>-- => increase/decrease karma for <thing>, karma for <thing>? => show karma for <thing>, karmastats => show stats. Karma is a community rating system - only in-channel messages can affect karma and you cannot adjust your own."
   end
   def listen(m)
     return unless m.kind_of?(PrivMessage) && m.public?
index de76719716acc2c54d48981306642c560a09363d..54c335af74603a6cc27cdb68d060f2431370e521 100644 (file)
@@ -78,7 +78,7 @@ class LartPlugin < Plugin
        #}}}
        #{{{
        def help(plugin, topic="")
-               "Lart:  The lart plugin allows you to punish/praise someone in the channel.  You can also add new punishments and new praises as well as delete them.  For the curious, LART is an acronym for Luser Attitude Readjustment Tool.\nUsage:  punish/lart <nick> <reason>  --  punishes <nick> for <reason>.  The reason is optional.\n        praise <nick> <reason>  --  praises <nick> for <reason>.  The reason is optional.\n        mod[lart|punish|praise] [add|remove]  --  Add or remove a lart or praise."
+               "Lart: The lart plugin allows you to punish/praise someone in the channel. You can also add new punishments and new praises as well as delete them. For the curious, LART is an acronym for Luser Attitude Readjustment Tool. Usage: punish/lart <nick> [<reason>] -- punishes <nick> for <reason>. praise <nick> [<reason>] -- praises <nick> for <reason>. [add|rm][lart|punish|praise] -- Add or remove a lart or praise."
        end
        #}}}
        # The following are command handlers    {{{
diff --git a/data/rbot/plugins/threat.rb b/data/rbot/plugins/threat.rb
new file mode 100644 (file)
index 0000000..ae70910
--- /dev/null
@@ -0,0 +1,55 @@
+# Security threat level plugin for rbot
+# by Robin Kearney (robin@riviera.org.uk)
+#
+# inspired by elliots fascination with the us
+# threat level.
+#
+# again a dirty hack but it works, just...
+#
+
+require 'uri/common'
+
+class ThreatPlugin < Plugin
+
+  def help(plugin, topic="")
+    "threat => prints out the current threat level as reported by http://www.dhs.gov/"
+  end
+
+  def privmsg(m)
+       color = ""
+    red = "\x0304" # severe
+       orange = "\x0307" # high
+       yellow = "\x0308" # elevated
+       blue = "\x0312" # guarded
+       green = "\x0303" # low
+       black = "\x0301" # default
+
+       page = @bot.httputil.get URI.parse("http://www.dhs.gov/dhspublic/")
+       if page =~ / <img.*dhs\/images\/dhs-advisory-(.*).gif.*/
+      state = $1
+    end
+    case state
+      when "severe"
+               color = red
+      when "high"
+               color = orange
+      when "elevated"
+               color = yellow
+      when "guarded"
+               color = blue
+      when "low"
+               color = green
+       else
+         color = black
+       end
+
+       m.reply color + "Today " + m.sourcenick + " the threat level is " + state.capitalize
+
+       return
+  end
+
+end
+plugin = ThreatPlugin.new
+plugin.register("threat")
+
+