diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-02-18 14:27:43 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-02-18 14:27:43 +0000 |
commit | edd1cf77be07ae507014574141e920ad23eb164d (patch) | |
tree | ff4e21c5ba40f32d0713391c9a04dc90cb2742c2 /data | |
parent | 1dc872c99dccc0c34cb15c4083b7a70d4266d635 (diff) |
Plugin header boilerplating.
New plugin.header file provided, to be used as model for the header of new plugins. Many existing plugins have been adjusted to provide the same info the same way. I might have misplaced some information, so please let me know if this is the case.
Also augmented a couple of copyright notices to include the 'rbot development team' alongside Tom Gilbert.
Diffstat (limited to 'data')
27 files changed, 472 insertions, 336 deletions
diff --git a/data/rbot/plugins/azgame.rb b/data/rbot/plugins/azgame.rb index dab112cd..a6979830 100644 --- a/data/rbot/plugins/azgame.rb +++ b/data/rbot/plugins/azgame.rb @@ -1,11 +1,17 @@ -# vim: set et sw=2:
-# A-Z Game: guess the word by reducing the interval of allowed ones
+#-- vim:sw=2:et
+#++
+#
+# :title: A-Z Game Plugin for rbot
+#
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+# Author:: Yaohan Chen <yaohan.chen@gmail.com>: Japanese support
#
-# Author: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
-# Author: Yaohan Chen <yaohan.chen@gmail.com>: Japanese support
+# Copyright:: (C) 2006 Giuseppe Bilotta
+# Copyright:: (C) 2007 GIuseppe Bilotta, Yaohan Chen
#
-# (C) 2006 Giuseppe Bilotta
-# (C) 2007 Yaohan Chen
+# License:: GPL v2
+#
+# A-Z Game: guess the word by reducing the interval of allowed ones
#
# TODO allow manual addition of words
diff --git a/data/rbot/plugins/bans.rb b/data/rbot/plugins/bans.rb index dfbe116d..17281d4c 100644 --- a/data/rbot/plugins/bans.rb +++ b/data/rbot/plugins/bans.rb @@ -1,10 +1,19 @@ -# BansPlugin v3 for 0.9.11
+#-- vim:sw=2:et
+#++
#
-# Managing kick and bans, automatically removing bans after timeouts, quiet bans, and kickban/quietban based on regexp
+# :title: Bans Plugin v3 for rbot 0.9.11 and later
#
-# (c) 2006 Marco Gulino <marco@kmobiletools.org>
-# (c) 2007 kamu <mr.kamu@gmail.com>
-# (c) 2007 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+# Author:: Marco Gulino <marco@kmobiletools.org>
+# Author:: kamu <mr.kamu@gmail.com>
+# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+#
+# Copyright:: (C) 2006 Marco Gulino
+# Copyright:: (C) 2007 kamu, Giuseppe Bilotta
+#
+# License:: GPL V2.
+#
+# Managing kick and bans, automatically removing bans after timeouts, quiet
+# bans, and kickban/quietban based on regexp
#
# v1 -> v2 (kamu's version, never released)
# * reworked
@@ -13,15 +22,15 @@ #
# v2 -> v3 (GB)
# * remove the 'bans' prefix from most of the commands
-# * (un)quiet has been renamed to (un)silence because 'quiet' was used to tell the bot to keep quiet
+# * (un)quiet has been renamed to (un)silence because 'quiet' was used to
+# tell the bot to keep quiet
# * both (un)quiet and (un)silence are accepted as actions
# * use the more descriptive 'onjoin' term for autoactions
-# * convert v1's (0.9.10) :bans and :bansmasks to BadWordActions and WhitelistEntries
+# * convert v1's (0.9.10) :bans and :bansmasks to BadWordActions and
+# WhitelistEntries
# * enhanced list manipulation facilities
# * fixed regexp usage in requirements for plugin map
# * add proper auth management
-#
-# Licensed under GPL V2.
OnJoinAction = Struct.new("OnJoinAction", :host, :action, :channel, :reason)
BadWordAction = Struct.new("BadWordAction", :regexp, :action, :channel, :timer, :reason)
diff --git a/data/rbot/plugins/debugger.rb b/data/rbot/plugins/debugger.rb index 2851d6a9..6eabdfea 100644 --- a/data/rbot/plugins/debugger.rb +++ b/data/rbot/plugins/debugger.rb @@ -1,7 +1,11 @@ -# Debugging/profiling for rbot +#-- vim:sw=2:et +#++ # -# (c) 2006 Giuseppe Bilotta <giuseppe.bilotta@gmail.com> -# Licensed under GPL V2. +# :title: Debugging/profiling for rbot +# +# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com> +# Copyright:: (C) 2006-2007 Giuseppe Bilotta +# License:: GPL v2 class DebugPlugin < Plugin BotConfig.register BotConfigIntegerValue.new('debug.interval', diff --git a/data/rbot/plugins/dict.rb b/data/rbot/plugins/dict.rb index 4e1bb721..149233d3 100644 --- a/data/rbot/plugins/dict.rb +++ b/data/rbot/plugins/dict.rb @@ -1,16 +1,21 @@ -# vim: set sw=2 et:
+#-- vim:sw=2:et
+#++
#
-# dict plugin: provides a link to the definition of a word in one of the supported
+# :title: Dictionary lookup plugin for rbot
+#
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta
+# License:: GPL v2
+#
+# Provides a link to the definition of a word in one of the supported
# dictionaries. Currently available are
# * the Oxford dictionary for (British) English
# * the De Mauro/Paravia dictionary for Italian
# * the Chambers dictionary for English (accepts both US and UK)
#
-# other plugins can use this one to check if a given word is valid in italian
+# Other plugins can use this one to check if a given word is valid in italian
# or english by using the is_italian?/is_british?/is_english? methods
#
-# Author: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
-#
# TODO: cache results and reuse them if get_cached returns a cache copy
require 'uri'
diff --git a/data/rbot/plugins/digg.rb b/data/rbot/plugins/digg.rb index 8e3aeb4e..43b7c9f5 100644 --- a/data/rbot/plugins/digg.rb +++ b/data/rbot/plugins/digg.rb @@ -1,4 +1,4 @@ -# Hacked up slashdot headlines plugin... +# Hacked up digg headlines plugin... require 'time' require 'rexml/document' diff --git a/data/rbot/plugins/forecast.rb b/data/rbot/plugins/forecast.rb index 63e3127c..d0847b59 100644 --- a/data/rbot/plugins/forecast.rb +++ b/data/rbot/plugins/forecast.rb @@ -1,8 +1,11 @@ +#-- vim:sw=2:et +#++ # -# Forecast plugin for rbot -# by MrChucho (mrchucho@mrchucho.net) -# Copyright (C) 2006 Ralph M. Churchill +# :title: Forecast plugin for rbot # +# Author:: MrChucho (mrchucho@mrchucho.net) +# Copyright:: (C) 2006 Ralph M. Churchill + require 'soap/wsdlDriver' require 'open-uri' require 'rexml/document' diff --git a/data/rbot/plugins/grouphug.rb b/data/rbot/plugins/grouphug.rb index 87a7e32c..75093665 100644 --- a/data/rbot/plugins/grouphug.rb +++ b/data/rbot/plugins/grouphug.rb @@ -1,9 +1,11 @@ -# Plugin for the Ruby IRC bot (http://linuxbrit.co.uk/rbot/) -# (c) 2005 Mark Kretschmann <markey@web.de> -# Licensed under GPL V2. - -require "net/http" - +#-- vim:sw=2:et +#++ +# +# :title: Grouphug Plugin for rbot +# +# Author:: Mark Kretschmann <markey@web.de> +# Copyright:: (C) 2005 Mark Kretschmann +# License:: GPL v2 class GrouphugPlugin < Plugin def help( plugin, topic="" ) @@ -14,7 +16,7 @@ class GrouphugPlugin < Plugin path = "random" path = "confessions/#{params[:num]}" if params[:num] begin - data = bot.httputil.get_cached(URI.parse("http://grouphug.us/#{path}")) + data = @bot.httputil.get_cached(URI.parse("http://grouphug.us/#{path}")) reg = Regexp.new( '(<td class="conf-text")(.*?)(<p>)(.*?)(</p>)', Regexp::MULTILINE ) confession = reg.match( data )[4].ircify_html diff --git a/data/rbot/plugins/hl2.rb b/data/rbot/plugins/hl2.rb index e0623433..152afdb9 100644 --- a/data/rbot/plugins/hl2.rb +++ b/data/rbot/plugins/hl2.rb @@ -1,16 +1,21 @@ -# Plugin for the Ruby IRC bot (http://linuxbrit.co.uk/rbot/)
+#-- vim:sw=2:et
+#++
+#
+# :title: Half-Life 2 plugin for rbot
+#
+# Author:: Ole Christian Rynning <oc@rynning.no>
+# Copyright:: (C) 2006 Ole Christian Rynning
+# License:: GPL v2
#
# Simple Half-Life 2 (Source Engine) plugin to query online
# servers to see if its online and kicking and how many users.
#
# Added 2 seconds timeout to the response. And sockets are now
# closing properly.
-#
-# (c) 2006 Ole Christian Rynning <oc@rynning.no>
-# Licensed under GPL V2.
require 'socket'
require 'timeout'
+
class HL2Plugin < Plugin
A2S_INFO = "\xFF\xFF\xFF\xFF\x54\x53\x6F\x75\x72\x63\x65\x20\x45\x6E\x67\x69\x6E\x65\x20\x51\x75\x65\x72\x79\x00"
@@ -50,6 +55,7 @@ class HL2Plugin < Plugin end
end
+
plugin = HL2Plugin.new
plugin.map 'hl2 :conn_str'
diff --git a/data/rbot/plugins/imdb.rb b/data/rbot/plugins/imdb.rb index 48c49dc3..6cbdaf53 100644 --- a/data/rbot/plugins/imdb.rb +++ b/data/rbot/plugins/imdb.rb @@ -1,6 +1,11 @@ -# IMDB plugin for RubyBot -# (c) 2005 Arnaud Cornet <arnaud.cornet@gmail.com> -# Licensed under MIT License. +#-- vim:sw=2:et +#++ +# +# :title: IMDB plugin for rbot +# +# Author:: Arnaud Cornet <arnaud.cornet@gmail.com> +# Copyright:: (C) 2005 Arnaud Cornet +# License:: MIT license require 'net/http' require 'cgi' diff --git a/data/rbot/plugins/iplookup.rb b/data/rbot/plugins/iplookup.rb index 9da167b0..715595e2 100644 --- a/data/rbot/plugins/iplookup.rb +++ b/data/rbot/plugins/iplookup.rb @@ -1,227 +1,227 @@ -#################################################################
-# IP Lookup Plugin
-# ----------------------------
-# by Chris Gahan (chris@ill-logic.com)
-#
-# Purpose:
-# ------------------
-# Lets you lookup the owner and their address for any IP address
-# or IRC user.
-#
-#################################################################
-
-require 'socket'
-require 'resolv'
-
-#################################################################
-## ARIN Whois module...
-##
-
-module ArinWhois
-
- class Chunk < Hash
- def customer?
- keys.grep(/^(City|Address|StateProv|(Org|Cust)Name)$/).any?
- end
-
- def network?
- keys.grep(/^(CIDR|NetHandle|Parent)$/).any?
- end
-
- def contact?
- keys.grep(/^(R|Org)(Tech|Abuse)(Handle|Name|Phone|Email)$/).any?
- end
-
- def valid?
- customer? or network? or contact?
- end
-
- def owner
- self[keys.grep(/^(Org|Cust)Name$/).first]
- end
-
- def location
- [ self['City'], self['StateProv'], self['Country'] ].compact.join(', ')
- end
-
- def address
- [ self['Address'], location, self['PostalCode'] ].compact.join(', ')
- end
-
- end
-
- class ArinWhoisParser
-
- def initialize(data)
- @data = data
- end
-
- def split_array_at(a, &block)
- return a unless a.any?
- a = a.to_a
-
- results = []
- last_cutpoint = 0
-
- a.each_with_index do |el,i|
- if block.call(el)
- unless i == 0
- results << a[last_cutpoint...i]
- last_cutpoint = i
- end
- end
- end
-
- if last_cutpoint < a.size or last_cutpoint == 0
- results << a[last_cutpoint..-1]
- end
-
- results
- end
-
- # Whois output format
- # ------------------------
- # Owner info block:
- # {Org,Cust}Name
- # Address
- # City
- # StateProv
- # PostalCode
- # Country (2-digit)
- #
- # Network Information:
- # CIDR (69.195.25.0/25)
- # NetHandle (NET-72-14-192-0-1)
- # Parent (NET-72-0-0-0-0)
- #
- # Contacts:
- # ({R,Org}{Tech,Abuse}{Handle,Name,Phone,Email})*
-
- def parse_chunks
- return if @data =~ /^No match found /
- chunks = @data.gsub(/^# ARIN WHOIS database, last updated.+/m, '').scan(/(([^\n]+\n)+\n)/m)
- chunks.map do |chunk|
- result = Chunk.new
-
- chunk[0].scan(/([A-Za-z]+?):(.*)/).each do |tuple|
- tuple[1].strip!
- result[tuple[0]] = tuple[1].empty? ? nil : tuple[1]
- end
-
- result
- end
- end
-
-
- def get_parsed_data
- return unless chunks = parse_chunks
-
- results = split_array_at(parse_chunks) {|chunk|chunk.customer?}
- results.map do |chunks|
- {
- :customer => chunks.select{|x|x.customer?}[0],
- :net => chunks.select{|x|x.network?}[0],
- :contacts => chunks.select{|x|x.contact?}
- }
- end
- end
-
- # Return a hash with :customer, :net, and :contacts info filled in.
- def get_most_specific_owner
- return unless datas = get_parsed_data
-
- datas_with_bitmasks = datas.map do |data|
- bitmask = data[:net]['CIDR'].split('/')[1].to_i
- [bitmask, data]
- end
- #datas_with_bitmasks.sort.each{|x|puts x[0]}
- winner = datas_with_bitmasks.sort[-1][1]
- end
-
- end # of class ArinWhoisParser
-
-module_function
-
- def raw_whois(query_string, host)
- s = TCPsocket.open(host, 43)
- s.write(query_string+"\n")
- ret = s.read
- s.close
- return ret
- end
-
- def lookup(ip)
- data = raw_whois("+#{ip}", 'whois.arin.net')
- arin = ArinWhoisParser.new data
- arin.get_most_specific_owner
- end
-
- def lookup_location(ip)
- result = lookup(ip)
- result[:customer].location
- end
-
- def lookup_address(ip)
- result = lookup(ip)
- result[:customer].address
- end
-
- def lookup_info(ip)
- if result = lookup(ip)
- "#{result[:net]['CIDR']} => #{result[:customer].owner} (#{result[:customer].address})"
- else
- "Address not found."
- end
- end
-
-end
-
-
-
-#################################################################
-## The Plugin
-##
-
-class IPLookupPlugin < Plugin
+################################################################# +# IP Lookup Plugin +# ---------------------------- +# by Chris Gahan (chris@ill-logic.com) +# +# Purpose: +# ------------------ +# Lets you lookup the owner and their address for any IP address +# or IRC user. +# +################################################################# + +require 'socket' +require 'resolv' + +################################################################# +## ARIN Whois module... +## + +module ArinWhois + + class Chunk < Hash + def customer? + keys.grep(/^(City|Address|StateProv|(Org|Cust)Name)$/).any? + end + + def network? + keys.grep(/^(CIDR|NetHandle|Parent)$/).any? + end + + def contact? + keys.grep(/^(R|Org)(Tech|Abuse)(Handle|Name|Phone|Email)$/).any? + end + + def valid? + customer? or network? or contact? + end + + def owner + self[keys.grep(/^(Org|Cust)Name$/).first] + end + + def location + [ self['City'], self['StateProv'], self['Country'] ].compact.join(', ') + end + + def address + [ self['Address'], location, self['PostalCode'] ].compact.join(', ') + end + + end + + class ArinWhoisParser + + def initialize(data) + @data = data + end + + def split_array_at(a, &block) + return a unless a.any? + a = a.to_a + + results = [] + last_cutpoint = 0 + + a.each_with_index do |el,i| + if block.call(el) + unless i == 0 + results << a[last_cutpoint...i] + last_cutpoint = i + end + end + end + + if last_cutpoint < a.size or last_cutpoint == 0 + results << a[last_cutpoint..-1] + end + + results + end + + # Whois output format + # ------------------------ + # Owner info block: + # {Org,Cust}Name + # Address + # City + # StateProv + # PostalCode + # Country (2-digit) + # + # Network Information: + # CIDR (69.195.25.0/25) + # NetHandle (NET-72-14-192-0-1) + # Parent (NET-72-0-0-0-0) + # + # Contacts: + # ({R,Org}{Tech,Abuse}{Handle,Name,Phone,Email})* + + def parse_chunks + return if @data =~ /^No match found / + chunks = @data.gsub(/^# ARIN WHOIS database, last updated.+/m, '').scan(/(([^\n]+\n)+\n)/m) + chunks.map do |chunk| + result = Chunk.new + + chunk[0].scan(/([A-Za-z]+?):(.*)/).each do |tuple| + tuple[1].strip! + result[tuple[0]] = tuple[1].empty? ? nil : tuple[1] + end + + result + end + end + + + def get_parsed_data + return unless chunks = parse_chunks + + results = split_array_at(parse_chunks) {|chunk|chunk.customer?} + results.map do |chunks| + { + :customer => chunks.select{|x|x.customer?}[0], + :net => chunks.select{|x|x.network?}[0], + :contacts => chunks.select{|x|x.contact?} + } + end + end + + # Return a hash with :customer, :net, and :contacts info filled in. + def get_most_specific_owner + return unless datas = get_parsed_data + + datas_with_bitmasks = datas.map do |data| + bitmask = data[:net]['CIDR'].split('/')[1].to_i + [bitmask, data] + end + #datas_with_bitmasks.sort.each{|x|puts x[0]} + winner = datas_with_bitmasks.sort[-1][1] + end + + end # of class ArinWhoisParser + +module_function + + def raw_whois(query_string, host) + s = TCPsocket.open(host, 43) + s.write(query_string+"\n") + ret = s.read + s.close + return ret + end + + def lookup(ip) + data = raw_whois("+#{ip}", 'whois.arin.net') + arin = ArinWhoisParser.new data + arin.get_most_specific_owner + end + + def lookup_location(ip) + result = lookup(ip) + result[:customer].location + end + + def lookup_address(ip) + result = lookup(ip) + result[:customer].address + end + + def lookup_info(ip) + if result = lookup(ip) + "#{result[:net]['CIDR']} => #{result[:customer].owner} (#{result[:customer].address})" + else + "Address not found." + end + end + +end + + + +################################################################# +## The Plugin +## + +class IPLookupPlugin < Plugin def help(plugin, topic="") "iplookup [ip address / domain name] => lookup info about the owner of the IP address from the ARIN whois database" - end
-
- def iplookup(m, params)
- reply = ""
- if params[:domain]
- begin
- ip = Resolv.getaddress(params[:domain])
- reply += "#{params[:domain]} | "
- rescue => e
- m.reply "#{e.message}"
- return
- end
- else
- ip = params[:ip]
- end
-
- reply += ArinWhois.lookup_info(ip)
- m.reply reply
- end
-
- def userip(m, params)
- #users = @channels[m.channel].users
- #m.reply "users = #{users.inspect}"
- #m.reply @bot.sendq("WHO #{params[:user]}")
- end
-
-end
-
+ end + + def iplookup(m, params) + reply = "" + if params[:domain] + begin + ip = Resolv.getaddress(params[:domain]) + reply += "#{params[:domain]} | " + rescue => e + m.reply "#{e.message}" + return + end + else + ip = params[:ip] + end + + reply += ArinWhois.lookup_info(ip) + m.reply reply + end + + def userip(m, params) + #users = @channels[m.channel].users + #m.reply "users = #{users.inspect}" + #m.reply @bot.sendq("WHO #{params[:user]}") + end + +end + plugin = IPLookupPlugin.new -plugin.map 'iplookup :ip', :action => 'iplookup', :requirements => {:ip => /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/}
-plugin.map 'iplookup :domain', :action => 'iplookup', :requirements => {:domain => /^[a-z0-9\.\-]{4,255}$/i}
+plugin.map 'iplookup :ip', :action => 'iplookup', :requirements => {:ip => /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/} +plugin.map 'iplookup :domain', :action => 'iplookup', :requirements => {:domain => /^[a-z0-9\.\-]{4,255}$/i} plugin.map 'userip :user', :action => 'userip', :requirements => {:user => /\w+/} -
-
-if __FILE__ == $0
- include ArinWhois
- data = open('whoistest.txt').read
- c = ArinWhoisParser.new data
- puts c.get_parsed_data.inspect
-end
\ No newline at end of file + + +if __FILE__ == $0 + include ArinWhois + data = open('whoistest.txt').read + c = ArinWhoisParser.new data + puts c.get_parsed_data.inspect +end diff --git a/data/rbot/plugins/karma.rb b/data/rbot/plugins/karma.rb index f4716e2b..43b3f2dc 100644 --- a/data/rbot/plugins/karma.rb +++ b/data/rbot/plugins/karma.rb @@ -82,6 +82,7 @@ class KarmaPlugin < Plugin end end end + plugin = KarmaPlugin.new plugin.map 'karmastats', :action => 'stats' plugin.map 'karma :key', :defaults => {:key => false} diff --git a/data/rbot/plugins/lart.rb b/data/rbot/plugins/lart.rb index 9b627fc5..103becb1 100644 --- a/data/rbot/plugins/lart.rb +++ b/data/rbot/plugins/lart.rb @@ -1,24 +1,29 @@ -# Original Author: -# Michael Brailsford <brailsmt@yahoo.com> -# aka brailsmt -# Author: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com> -# Purpose: Provide for humorous larts and praises -# Original Copyright: -# 2002 Michael Brailsford. All rights reserved. -# Copyright: 2006 Giuseppe Bilotta. All rights reserved. -# License: This plugin is licensed under the BSD license. The terms of -# which follow. +#-- vim:sw=2:et +#++ # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: +# :title: lart/praise plugin for rbot # -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. +# Author:: Michael Brailsford <brailsmt@yahoo.com> aka brailsmt +# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com> # -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. +# Copyright:: (C) 2002 Michael Brailsford. All rights reserved. +# Copyright:: (C) 2006 Giuseppe Bilotta. All rights reserved. +# +# License:: This plugin is licensed under the BSD license. The terms of +# which follow. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Purpose:: Provide for humorous larts and praises class LartPlugin < Plugin diff --git a/data/rbot/plugins/linkbot.rb b/data/rbot/plugins/linkbot.rb index 082cbd80..29d7ad1b 100644 --- a/data/rbot/plugins/linkbot.rb +++ b/data/rbot/plugins/linkbot.rb @@ -1,8 +1,11 @@ #-- vim:sw=2:et #++ # -# Author: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com> -# Copyright (C) 2006 Giuseppe Bilotta +# :title: linkbot management for rbot +# +# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com> +# Copyright:: (C) 2006 Giuseppe Bilotta +# License:: GPL v2 # # Based on an idea by hagabaka (Yaohan Chen <yaohan.chen@gmail.com>) # @@ -14,8 +17,10 @@ # # This plugin also shows how to create 'fake' messages from a plugin, letting # the bot parse them. +# # TODO a possible enhancement to the Irc framework could be to create 'fake' # servers to make this even easier. + class LinkBot < Plugin BotConfig.register BotConfigArrayValue.new('linkbot.nicks', :default => [], diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index c87dc99d..de33136e 100644 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -192,6 +192,7 @@ class MarkovPlugin < Plugin random_markov(m, message) end end + plugin = MarkovPlugin.new plugin.map 'markov ignore :action :option', :action => "ignore" plugin.map 'markov ignore :action', :action => "ignore" diff --git a/data/rbot/plugins/nickserv.rb b/data/rbot/plugins/nickserv.rb index 7a9ff0c6..85270933 100644 --- a/data/rbot/plugins/nickserv.rb +++ b/data/rbot/plugins/nickserv.rb @@ -1,6 +1,20 @@ +#-- vim:sw=2:et +#++ +# +# :title: Nickserv management plugin for rbot +# +# Author:: Tom Gilbert (giblet) <tom@linuxbrit.co.uk> +# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com> +# +# Copyright:: (C) 2002-2005 Tom Gilbert +# Copyright:: (C) 2006 Tom Gilbert, Giuseppe Bilotta +# Copyright:: (C) 2006-2007 Giuseppe Bilotta +# # Automatically lookup nicks in @registry and identify when asked +# # Takes over proper nick if required and nick is registered -# TODO allow custom IDENTIFY and GHOST names + +# TODO:: allow custom IDENTIFY and GHOST names class NickServPlugin < Plugin diff --git a/data/rbot/plugins/plugin.header b/data/rbot/plugins/plugin.header new file mode 100644 index 00000000..539fa922 --- /dev/null +++ b/data/rbot/plugins/plugin.header @@ -0,0 +1,11 @@ +#-- vim:sw=2:et +#++ +# +# :title: Plugin title +# +# Author:: Your Name Goes Here <and.your@email> +# Copyright:: (C) YYYY Your Name +# License:: plugin licence +# +# More documentation, if needed/wanted + diff --git a/data/rbot/plugins/quiz.rb b/data/rbot/plugins/quiz.rb index 30691d4e..7e2c0f83 100644 --- a/data/rbot/plugins/quiz.rb +++ b/data/rbot/plugins/quiz.rb @@ -1,30 +1,30 @@ #-- vim:sw=2:et #++ # -# Plugin for the Ruby IRC bot (http://linuxbrit.co.uk/rbot/) -# -# A trivia quiz game. Fast paced, featureful and fun. +# :title: Quiz plugin for rbot # # Author:: Mark Kretschmann <markey@web.de> # Author:: Jocke Andersson <ajocke@gmail.com> # Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> # Author:: Yaohan Chen <yaohan.chen@gmail.com> # -# (c) 2006 Mark Kretschmann, Jocke Andersson, Giuseppe Bilotta -# (c) 2007 Giuseppe Bilotta, Yaohan Chen +# Copyright:: (C) 2006 Mark Kretschmann, Jocke Andersson, Giuseppe Bilotta +# Copyright:: (C) 2007 Giuseppe Bilotta, Yaohan Chen # -# Licensed under GPL V2. +# License:: GPL v2 +# +# A trivia quiz game. Fast paced, featureful and fun. -# FIXME interesting fact: in the Quiz class, @registry.has_key? seems to be -# case insensitive. Although this is all right for us, this leads to rank vs -# registry mismatches. So we have to make the @rank_table comparisons case -# insensitive as well. For the moment, redefine everything to downcase before -# matching the nick. +# FIXME:: interesting fact: in the Quiz class, @registry.has_key? seems to be +# case insensitive. Although this is all right for us, this leads to +# rank vs registry mismatches. So we have to make the @rank_table +# comparisons case insensitive as well. For the moment, redefine +# everything to downcase before matching the nick. # -# TODO define a class for the rank table. We might also need it for scoring in -# other games. +# TODO:: define a class for the rank table. We might also need it for scoring +# in other games. # -# TODO when Ruby 2.0 gets out, fix the FIXME 2.0 UTF-8 workarounds +# TODO:: when Ruby 2.0 gets out, fix the FIXME 2.0 UTF-8 workarounds # Class for storing question/answer pairs QuizBundle = Struct.new( "QuizBundle", :question, :answer ) diff --git a/data/rbot/plugins/roshambo.rb b/data/rbot/plugins/roshambo.rb index 74b94a4c..03338698 100644 --- a/data/rbot/plugins/roshambo.rb +++ b/data/rbot/plugins/roshambo.rb @@ -1,7 +1,13 @@ #-- vim:sw=2:et #++ +# +# :title: Roshambo (rock-paper-scissors) plugin for rbot +# +# Author:: Hans Fugal +# Copyright:: (C) 2004 Hans Fugal +# # Play the game of roshambo (rock-paper-scissors) -# Copyright (C) 2004 Hans Fugal +# # Distributed under the same license as rbot itself require 'time' diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index 6b5e62be..caebc3fc 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -1,13 +1,18 @@ #-- vim:sw=2:et
#++
#
-# RSS feed plugin for RubyBot
-# (c) 2004 Stanislav Karchebny <berkus@madfire.net>
-# (c) 2005 Ian Monroe <ian@monroe.nu>
-# (c) 2005 Mark Kretschmann <markey@web.de>
-# (c) 2006 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+# :title: RSS feed plugin for rbot
#
-# Licensed under MIT License.
+# Author:: Stanislav Karchebny <berkus@madfire.net>
+# Author:: Ian Monroe <ian@monroe.nu>
+# Author:: Mark Kretschmann <markey@web.de>
+# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+#
+# Copyright:: (C) 2004 Stanislav Karchebny
+# Copyright:: (C) 2005 Ian Monroe, Mark Kretschmann
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta
+#
+# License:: MIT license
require 'rss/parser'
require 'rss/1.0'
diff --git a/data/rbot/plugins/salut.rb b/data/rbot/plugins/salut.rb index b0bf67e7..feff2dd6 100644 --- a/data/rbot/plugins/salut.rb +++ b/data/rbot/plugins/salut.rb @@ -1,8 +1,17 @@ -# vim: set sw=2 et:
+#-- vim:sw=2:et
+#++
+#
+# :title: Salutations plugin for rbot
+#
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta
+# License:: GPL v2
+#
# Salutations plugin: respond to salutations
-# TODO allow online editing of salutations
-# TODO *REMEMBER* to set @changed to true after edit
-# TODO or changes won't be saved
+#
+# TODO:: allow online editing of salutations
+#
+# TODO:: *REMEMBER* to set @changed to true after edit or changes won't be saved
class SalutPlugin < Plugin
BotConfig.register BotConfigBooleanValue.new('salut.all_languages',
diff --git a/data/rbot/plugins/script.rb b/data/rbot/plugins/script.rb index 3976517f..c091b586 100644 --- a/data/rbot/plugins/script.rb +++ b/data/rbot/plugins/script.rb @@ -1,12 +1,17 @@ -# Plugin for the Ruby IRC bot (http://linuxbrit.co.uk/rbot/) +#-- vim:sw=2:et +#++ # -# Create mini plugins on IRC. +# :title: Script plugin for rbot +# +# Author:: Mark Kretschmann <markey@web.de> +# Copyright:: (C) 2006 Mark Kretschmann +# License:: GPL v2 # -# Scripts are little Ruby programs that run in the context of the script plugin. You -# can create them directly in an IRC channel, and invoke them just like normal rbot plugins. +# Create mini plugins on IRC. # -# (c) 2006 Mark Kretschmann <markey@web.de> -# Licensed under GPL V2. +# Scripts are little Ruby programs that run in the context of the script +# plugin. You can create them directly in an IRC channel, and invoke them just +# like normal rbot plugins. Command = Struct.new( "Command", :code, :nick, :created, :channel ) diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb index becfafc2..3b7d6826 100644 --- a/data/rbot/plugins/search.rb +++ b/data/rbot/plugins/search.rb @@ -1,7 +1,18 @@ -# vim: set sw=2 et: +#-- vim:sw=2:et +#++ # -# TODO: use lr=lang_<code> or whatever is most appropriate to let google know -# it shouldn't use the bot's location to find the preferred language +# :title: Google and Wikipedia search plugin for rbot +# +# Author:: Tom Gilbert (giblet) <tom@linuxbrit.co.uk> +# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com> +# +# Copyright:: (C) 2002-2005 Tom Gilbert +# Copyright:: (C) 2006 Tom Gilbert, Giuseppe Bilotta +# Copyright:: (C) 2006-2007 Giuseppe Bilotta + +# TODO:: use lr=lang_<code> or whatever is most appropriate to let google know +# it shouldn't use the bot's location to find the preferred language + require 'uri' Net::HTTP.version_1_2 diff --git a/data/rbot/plugins/shortenurls.rb b/data/rbot/plugins/shortenurls.rb index 5d8df80a..743cad08 100644 --- a/data/rbot/plugins/shortenurls.rb +++ b/data/rbot/plugins/shortenurls.rb @@ -1,13 +1,15 @@ #-- vim:sw=2:et #++ # +# :title: ShortURL plugin for rbot +# +# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> +# Copyright:: (C) 2007 Giuseppe Bilotta +# License:: GPL v2 +# # Plugin to handle ShortURL, merges the funcionality of the old rubyurl and tinyurl plugins # Note that it's called ShortenURLs and not ShortURL, to prevent conflicts with # the actual ruby package used -# -# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> -# (C) 2007 Giuseppe Bilotta -# Based on existing rbot plugins, as mentioned above :) require "shorturl" require "uri" diff --git a/data/rbot/plugins/time.rb b/data/rbot/plugins/time.rb index 9f8b8d7c..96b101ce 100644 --- a/data/rbot/plugins/time.rb +++ b/data/rbot/plugins/time.rb @@ -1,6 +1,11 @@ -# Time Zone Plugin for rbot -# (c) 2006 Ian Monroe <ian@monroe.nu> -# Licensed under MIT License. +#-- vim:sw=2:et +#++ +# +# :title: Time Zone Plugin for rbot +# +# Author:: Ian Monroe <ian@monroe.nu> +# Copyright:: (C) 2006 Ian Monroe +# License:: MIT license require 'tzinfo' diff --git a/data/rbot/plugins/topic.rb b/data/rbot/plugins/topic.rb index 93058a01..672bf82a 100644 --- a/data/rbot/plugins/topic.rb +++ b/data/rbot/plugins/topic.rb @@ -1,4 +1,12 @@ -# Author: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com> +#-- vim:sw=2:et +#++ +# +# :title: Topic manipulation plugin for rbot +# +# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> +# Copyright:: (C) 2006-2007 Giuseppe Bilotta +# License:: GPL v2 +# # Add a bunch of topic manipulation features class TopicPlugin < Plugin diff --git a/data/rbot/plugins/weather.rb b/data/rbot/plugins/weather.rb index 07584d88..88194e90 100644 --- a/data/rbot/plugins/weather.rb +++ b/data/rbot/plugins/weather.rb @@ -1,10 +1,15 @@ -# Weather plugin for rbot +#-- vim:sw=2:et +#++ # -# NOAA National Weather Service support by MrChucho (mrchucho@mrchucho.net) -# Copyright (C) 2006 Ralph M. Churchill +# :title: Weather plugin for rbot # -# Weather Undeground support by Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com> -# Copyright (C) 2006 Giuseppe Bilotta +# Author:: MrChucho (mrchucho@mrchucho.net): NOAA National Weather Service support +# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com> +# +# Copyright:: (C) 2006 Ralph M. Churchill +# Copyright:: (C) 2006-2007 Giuseppe Bilotta +# +# License:: GPL v2 require 'uri' require 'rexml/document' diff --git a/data/rbot/plugins/wow.rb b/data/rbot/plugins/wow.rb index 4faadaf4..1106d3cc 100644 --- a/data/rbot/plugins/wow.rb +++ b/data/rbot/plugins/wow.rb @@ -1,10 +1,13 @@ +#-- vim:sw=2:et +#++ # -# World of Warcraft Realm Status plugin for rbot -# by MrChucho (mrchucho@mrchucho.net) -# Copyright (C) 2006 Ralph M. Churchill +# :title: World of Warcraft Realm Status plugin for rbot # -# Requires: insatiable appetite for World of Warcraft +# Author:: MrChucho (mrchucho@mrchucho.net) +# Copyright:: (C) 2006 Ralph M. Churchill # +# Requires:: insatiable appetite for World of Warcraft + require 'open-uri' require 'rexml/document' |