[DRE-commits] [sup-mail] 18/26: Imported Upstream version 0.14.0~git.20130822.aa37476
Per Andersson
avtobiff at moszumanska.debian.org
Wed Oct 1 19:06:09 UTC 2014
This is an automated email from the git hooks/post-receive script.
avtobiff pushed a commit to branch next-0.14.1.1
in repository sup-mail.
commit df6c78e2e59723f33e4a887b5e3751eaf0394848
Author: Per Andersson <avtobiff at gmail.com>
Date: Fri Aug 23 01:01:43 2013 +0200
Imported Upstream version 0.14.0~git.20130822.aa37476
---
bin/sup | 6 +++---
lib/sup.rb | 6 +++---
lib/sup/account.rb | 2 +-
lib/sup/buffer.rb | 10 +++++-----
lib/sup/crypto.rb | 2 +-
lib/sup/message.rb | 4 ++--
lib/sup/modes/edit_message_mode.rb | 2 +-
lib/sup/textfield.rb | 2 +-
lib/sup/util.rb | 12 ++++++------
lib/sup/version.rb | 2 +-
10 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/bin/sup b/bin/sup
index ca1071a..d5c4109 100755
--- a/bin/sup
+++ b/bin/sup
@@ -293,7 +293,7 @@ begin
b.mode.load_in_background if new
when :search
completions = LabelManager.all_labels.map { |l| "label:#{LabelManager.string_for l}" }
- completions = completions.each { |l| l.fix_encoding }
+ completions = completions.each { |l| l.fix_encoding! }
completions += Index::COMPL_PREFIXES
query = BufferManager.ask_many_with_completions :search, "Search all messages (enter for saved searches): ", completions
unless query.nil?
@@ -307,7 +307,7 @@ begin
SearchResultsMode.spawn_from_query "is:unread"
when :list_labels
labels = LabelManager.all_labels.map { |l| LabelManager.string_for l }
- labels = labels.each { |l| l.fix_encoding }
+ labels = labels.each { |l| l.fix_encoding! }
user_label = bm.ask_with_completions :label, "Show threads with label (enter for listing): ", labels
unless user_label.nil?
@@ -375,7 +375,7 @@ ensure
Index.stop_lock_update_thread
end
- HookManager.run "shutdown"
+ HookManager.run "shutdown" if HookManager.instantiated?
Index.stop_sync_worker
Redwood::finish
diff --git a/lib/sup.rb b/lib/sup.rb
index 4fb4118..0748ccb 100644
--- a/lib/sup.rb
+++ b/lib/sup.rb
@@ -271,7 +271,7 @@ EOM
else
require 'etc'
require 'socket'
- name = Etc.getpwnam(ENV["USER"]).gecos.split(/,/).first.force_encoding($encoding).fix_encoding rescue nil
+ name = Etc.getpwnam(ENV["USER"]).gecos.split(/,/).first.force_encoding($encoding).fix_encoding! rescue nil
name ||= ENV["USER"]
email = ENV["USER"] + "@" +
begin
@@ -283,8 +283,8 @@ EOM
config = {
:accounts => {
:default => {
- :name => name.fix_encoding,
- :email => email.fix_encoding,
+ :name => name.dup.fix_encoding!,
+ :email => email.fix_encoding!,
:alternates => [],
:sendmail => "/usr/sbin/sendmail -oem -ti",
:signature => File.join(ENV["HOME"], ".signature"),
diff --git a/lib/sup/account.rb b/lib/sup/account.rb
index 8303157..7fc1aa8 100644
--- a/lib/sup/account.rb
+++ b/lib/sup/account.rb
@@ -52,7 +52,7 @@ class AccountManager
hash[:alternates] ||= []
fail "alternative emails are not an array: #{hash[:alternates]}" unless hash[:alternates].kind_of? Array
- [:name, :signature].each { |x| hash[x] ? hash[x].fix_encoding : nil }
+ [:name, :signature].each { |x| hash[x] ? hash[x].fix_encoding! : nil }
a = Account.new hash
@accounts[a] = true
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index d6f618c..6e5d827 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -449,7 +449,7 @@ EOS
def ask_with_completions domain, question, completions, default=nil
ask domain, question, default do |s|
- s.fix_encoding
+ s.fix_encoding!
completions.select { |x| x =~ /^#{Regexp::escape s}/iu }.map { |x| [x, x] }
end
end
@@ -466,8 +466,8 @@ EOS
raise "william screwed up completion: #{partial.inspect}"
end
- prefix.fix_encoding
- target.fix_encoding
+ prefix.fix_encoding!
+ target.fix_encoding!
completions.select { |x| x =~ /^#{Regexp::escape target}/iu }.map { |x| [prefix + x, x] }
end
end
@@ -476,10 +476,10 @@ EOS
ask domain, question, default do |partial|
prefix, target = partial.split_on_commas_with_remainder
target ||= prefix.pop || ""
- target.fix_encoding
+ target.fix_encoding!
prefix = prefix.join(", ") + (prefix.empty? ? "" : ", ")
- prefix.fix_encoding
+ prefix.fix_encoding!
completions.select { |x| x =~ /^#{Regexp::escape target}/iu }.sort_by { |c| [ContactManager.contact_for(c) ? 0 : 1, c] }.map { |x| [prefix + x, x] }
end
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 8f042cd..56cc630 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -340,7 +340,7 @@ EOS
msg = RMail::Parser.read output
if msg.header.content_type =~ %r{^multipart/} && !msg.multipart?
output = "MIME-Version: 1.0\n" + output
- output.fix_encoding
+ output.fix_encoding!
msg = RMail::Parser.read output
end
end
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index e4f16d4..9cdcea2 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -112,7 +112,7 @@ class Message
end
subj = header["subject"]
- subj = subj ? subj.fix_encoding : nil
+ subj = subj ? subj.fix_encoding! : nil
@subj = subj ? subj.gsub(/\s+/, " ").gsub(/\s+$/, "") : DEFAULT_SUBJECT
@to = Person.from_address_list header["to"]
@cc = Person.from_address_list header["cc"]
@@ -309,7 +309,7 @@ EOS
end
def indexable_chunks
- chunks.select { |c| c.is_a? Chunk::Text }
+ chunks ? chunks.select { |c| c.is_a? Chunk::Text } : []
end
def indexable_subject
diff --git a/lib/sup/modes/edit_message_mode.rb b/lib/sup/modes/edit_message_mode.rb
index e203ed0..9a924a4 100644
--- a/lib/sup/modes/edit_message_mode.rb
+++ b/lib/sup/modes/edit_message_mode.rb
@@ -178,7 +178,7 @@ EOS
def handle_new_text header, body; end
def edit_message_or_field
- lines = DECORATION_LINES + @selectors.size
+ lines = (@selectors.empty? ? 0 : DECORATION_LINES) + @selectors.size
if lines > curpos
return
elsif (curpos - lines) >= @header_lines.length
diff --git a/lib/sup/textfield.rb b/lib/sup/textfield.rb
index c69d3e3..6d535a0 100644
--- a/lib/sup/textfield.rb
+++ b/lib/sup/textfield.rb
@@ -177,7 +177,7 @@ private
# encoding) will produce erronous results, but will also do that for
# a log of other programs since it is impossible to detect which is
# which and what encoding the inputted byte chars are supposed to have.
- v.force_encoding($encoding).fix_encoding
+ v.force_encoding($encoding).fix_encoding!
end
def remove_extra_space
diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index 5cff6fa..d628828 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -125,7 +125,7 @@ module RMail
class << self
def parse(field)
field = field.dup.to_s
- field = field.fix_encoding.ascii
+ field = field.fix_encoding!.ascii
if field =~ EXTRACT_FIELD_NAME_RE
[ $1, $'.chomp ]
else
@@ -256,7 +256,7 @@ end
class String
def display_length
- @display_length ||= Unicode.width(self, false)
+ @display_length ||= Unicode.width(self.fix_encoding!, false)
end
def slice_by_display_length len
@@ -366,7 +366,7 @@ class String
# user encoding.
#
# Not Ruby 1.8 compatible
- def fix_encoding
+ def fix_encoding!
# first try to encode to utf-8 from whatever current encoding
encode!('UTF-8', :invalid => :replace, :undef => :replace)
@@ -402,7 +402,7 @@ class String
rescue Encoding::ConverterNotFoundError
debug "Encoding converter not found for #{from_encoding.inspect} or #{to_encoding.inspect}, fixing string: '#{self.to_s}', but expect weird characters."
- fix_encoding
+ fix_encoding!
end
fail "Could not create valid #{to_encoding.inspect} string out of: '#{self.to_s}'." unless valid_encoding?
@@ -411,7 +411,7 @@ class String
end
def normalize_whitespace
- fix_encoding
+ fix_encoding!
gsub(/\t/, " ").gsub(/\r/, "")
end
@@ -453,7 +453,7 @@ class String
out << b.chr
end
end
- out = out.fix_encoding # this should now be an utf-8 string of ascii
+ out = out.fix_encoding! # this should now be an utf-8 string of ascii
# compat chars.
end
diff --git a/lib/sup/version.rb b/lib/sup/version.rb
index 4f58b72..cdff2dd 100644
--- a/lib/sup/version.rb
+++ b/lib/sup/version.rb
@@ -1,3 +1,3 @@
module Redwood
- VERSION = "0.14.0"
+ VERSION = "git"
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/sup-mail.git
More information about the Pkg-ruby-extras-commits
mailing list