Class: Mail::SubjectField
- Inherits:
-
NamedUnstructuredField
- Object
- NamedUnstructuredField
- Mail::SubjectField
- Defined in:
- lib/jpmobile/mail.rb
Overview
for subject
Instance Attribute Summary
Attributes inherited from NamedUnstructuredField
Instance Method Summary collapse
- #decode_b_value_for_mobile(str) ⇒ Object
- #decoded_with_jpmobile ⇒ Object (also: #decoded)
- #encoded_with_jpmobile ⇒ Object (also: #encoded)
Instance Method Details
#decode_b_value_for_mobile(str) ⇒ Object
479 480 481 482 483 484 485 486 487 488 |
# File 'lib/jpmobile/mail.rb', line 479 def decode_b_value_for_mobile(str) match = str.match(/=\?(.+)?\?[Bb]\?(.*)\?=/m) if match charset = match[1] str = Utilities.decode_base64(match[2]) @mobile.decode_transfer_encoding(str, charset) else str end end |
#decoded_with_jpmobile ⇒ Object Also known as: decoded
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
# File 'lib/jpmobile/mail.rb', line 455 def decoded_with_jpmobile if @mobile return value unless value =~ /=\?[^?]+\?([QB])\?[^?]*?\?=/mi Encodings.collapse_adjacent_encodings(value).each {|line| line.gsub!(/=\?[^?]+\?([QB])\?[^?]*?\?=/mi) do |string| case Regexp.last_match(1) when 'B', 'b' then decode_b_value_for_mobile(string) when 'Q', 'q' then Encodings.q_value_decode(string) else line end end }.join else decoded_without_jpmobile end end |
#encoded_with_jpmobile ⇒ Object Also known as: encoded
442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'lib/jpmobile/mail.rb', line 442 def encoded_with_jpmobile if @mobile if @mobile.to_mail_subject_encoded?(value) "#{name}: #{value}\r\n" else # convert encoding "#{name}: " + @mobile.to_mail_subject(value) + "\r\n" end else encoded_without_jpmobile end end |