summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/rbot5
-rw-r--r--lib/rbot/compat19.rb76
-rw-r--r--lib/rbot/config-compat.rb23
-rw-r--r--lib/rbot/core/unicode.rb95
-rw-r--r--lib/rbot/ircbot.rb1
5 files changed, 0 insertions, 200 deletions
diff --git a/bin/rbot b/bin/rbot
index 722ac358..700fe08c 100755
--- a/bin/rbot
+++ b/bin/rbot
@@ -89,11 +89,6 @@ if File.directory? "#{defaultlib}/rbot"
end
begin
- # ruby 1.9 specific fixes
- unless RUBY_VERSION < '1.9'
- require 'rbot/compat19'
- end
-
require 'rbot/ircbot'
rescue LoadError => e
puts "Error: couldn't find the rbot/ircbot module (or one of its dependencies)\n"
diff --git a/lib/rbot/compat19.rb b/lib/rbot/compat19.rb
deleted file mode 100644
index 2082ff51..00000000
--- a/lib/rbot/compat19.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-#-- vim:sw=2:et
-#++
-#
-# :title: ruby 1.9 compatibility (monkey)patches
-
-require 'timeout'
-require "thread"
-
-class ConditionVariable
-
- def wait(mutex, timeout=nil)
- begin
- # TODO: mutex should not be used
- @waiters_mutex.synchronize do
- if @waiters.instance_of? Hash # ruby 2.0.0?
- @waiters[Thread.current] = true
- else
- @waiters.push(Thread.current)
- end
- end
- if timeout
- elapsed = mutex.sleep timeout if timeout > 0.0
- unless timeout > 0.0 and elapsed < timeout
- t = @waiters_mutex.synchronize { @waiters.delete Thread.current }
- signal unless t # if we got notified, pass it along
- raise TimeoutError, "wait timed out"
- end
- else
- mutex.sleep
- end
- end
- nil
- end
-
-end
-
-require 'monitor'
-
-module MonitorMixin
-
- class ConditionVariable
-
- def wait(timeout = nil)
- #if timeout
- # raise NotImplementedError, "timeout is not implemented yet"
- #end
- @monitor.__send__(:mon_check_owner)
- count = @monitor.__send__(:mon_exit_for_cond)
- begin
- @cond.wait(@monitor.instance_variable_get("@mon_mutex"), timeout)
- return true
- rescue TimeoutError
- return false
- ensure
- @monitor.__send__(:mon_enter_for_cond, count)
- end
- end
-
- def signal
- @monitor.__send__(:mon_check_owner)
- @cond.signal
- end
-
- def broadcast
- @monitor.__send__(:mon_check_owner)
- @cond.broadcast
- end
-
- end # ConditionVariable
-
- def self.extend_object(obj)
- super(obj)
- obj.__send__(:mon_initialize)
- end
-
-end # MonitorMixin
diff --git a/lib/rbot/config-compat.rb b/lib/rbot/config-compat.rb
deleted file mode 100644
index 43c50a02..00000000
--- a/lib/rbot/config-compat.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#-- vim:sw=2:et
-#++
-# :title: Config namespace backwards compatibility
-#
-# The move of everything rbot-related to the Irc::Bot::* namespace from Irc::*
-# would cause off-repo plugins to fail if they register any configuration key,
-# so we have to handle this case.
-#
-# Author:: Giuseppe Bilotta (giuseppe.bilotta@gmail.com)
-
-module Irc
- Config = Bot::Config
- module BotConfig
- def BotConfig.register(*args)
- warn "deprecated usage: please use Irc::Bot::Config instead of Irc::BotConfig (e.g. Config.register instead of BotConfig.register, Config::<type>Value instead of BotConfig<type>Value"
- Bot::Config.register(*args)
- end
- end
-
- Bot::Config.constants.each { |c|
- Irc.module_eval("BotConfig#{c} = Bot::Config::#{c}")
- }
-end
diff --git a/lib/rbot/core/unicode.rb b/lib/rbot/core/unicode.rb
deleted file mode 100644
index ece8e644..00000000
--- a/lib/rbot/core/unicode.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-#-- vim:sw=4:et
-#++
-#
-# :title: Unicode plugin
-#
-# Author:: jsn (Dmitry Kim) <dmitry dot kim at gmail dot org>
-#
-# This plugin adds unicode-awareness to rbot. When it's loaded, all the
-# character strings inside of rbot are assumed to be in proper utf-8
-# encoding. The plugin takes care of translation to/from utf-8 on server IO,
-# if necessary (translation charsets are configurable).
-
-# TODO autoconfigure using server-provided allowed charset when these are
-# available, see also comment in irc.rb
-
-require 'iconv'
-
-class UnicodePlugin < CoreBotModule
- Config.register Config::BooleanValue.new(
- 'encoding.enable', :default => true,
- :desc => "Support for non-ascii charsets",
- :on_change => Proc.new { |bot, v| reconfigure_filter(bot) })
-
- Config.register Config::ArrayValue.new(
- 'encoding.charsets', :default => ['utf-8', 'cp1252', 'iso-8859-15'],
- :desc => "Ordered list of iconv(3) charsets the bot should try",
- :validate_item => Proc.new { |x| !!(Iconv.new('utf-8', x) rescue nil) },
- :on_change => Proc.new { |bot, v| reconfigure_filter(bot) })
-
- class UnicodeFilter
- def initialize(oenc, *iencs)
- o = oenc.dup
- o += '//ignore' if !o.include?('/')
- i = iencs[0].dup
- # i += '//ignore' if !i.include?('/')
- @iencs = iencs.dup
- @iconvs = @iencs.map { |_| Iconv.new('utf-8', _) }
- debug "*** o = #{o}, i = #{i}, iencs = #{iencs.inspect}"
- @default_in = Iconv.new('utf-8//ignore', i)
- @default_out = Iconv.new(o, 'utf-8//ignore')
- end
-
- def in(data)
- rv = nil
- @iconvs.each_with_index { |ic, idx|
- begin
- debug "trying #{@iencs[idx]}"
- rv = ic.iconv(data)
- break
- rescue
- end
- }
-
- rv = @default_in.iconv(data) if !rv
- debug ">> #{rv.inspect}"
- return rv
- end
-
- def out(data)
- rv = @default_out.iconv(data) rescue data # XXX: yeah, i know :/
- debug "<< #{rv}"
- rv
- end
- end
-
-
- def initialize(*a)
- super
- @@old_kcode = $KCODE
- self.class.reconfigure_filter(@bot)
- end
-
- def cleanup
- debug "cleaning up encodings"
- @bot.socket.filter = nil
- $KCODE = @@old_kcode
- super
- end
-
- def UnicodePlugin.reconfigure_filter(bot)
- debug "configuring encodings"
- enable = bot.config['encoding.enable']
- if not enable
- bot.socket.filter = nil
- $KCODE = @@old_kcode
- return
- end
- charsets = bot.config['encoding.charsets']
- charsets = ['utf-8'] if charsets.empty?
- bot.socket.filter = UnicodeFilter.new(charsets[0], *charsets)
- $KCODE = 'u'
- end
-end
-
-UnicodePlugin.new
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index ed3c910c..311334b5 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -144,7 +144,6 @@ end
require 'rbot/load-gettext'
require 'rbot/config'
-require 'rbot/config-compat'
require 'rbot/irc'
require 'rbot/rfc2812'