=begin ############################################################################### # # Copyright (c) 2009 by Dominik Honnef # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ############################################################################### # History: # 2009-12-13, Dominik Honnef : # version 0.0.1 # ############################################################################### =end require 'weechat' include Weechat include Script::Skeleton include Weechat::Helper @script = { :name => "tabs", :author => "Dominik Honnef ", :license => "GPL3", :description => "A script for replacing tabs with spaces.", :version => "0.0.1", :gem_version => "0.0.1", } @config = Script::Config.new( 'spaces' => [Fixnum, 4] ) def setup Modifier.new("weechat_print") do |plugin, buffer, tags, line| if plugin.name == 'irc' line.message.gsub!("\t", " " * @config.spaces) end line.to_s end end