mms2r 3.3.1 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/Gemfile +11 -11
- data/Gemfile.lock +28 -24
- data/History.txt +7 -0
- data/Manifest.txt +5 -4
- data/README.txt +8 -5
- data/conf/1nbox.net.yml +4 -4
- data/conf/aliases.yml +1 -1
- data/conf/mediamessaging.o2.co.uk.yml +1 -1
- data/conf/messaging.nextel.com.yml +8 -8
- data/conf/mms.3ireland.ie.yml +8 -8
- data/conf/mms.ae.yml +1 -1
- data/conf/mms.alltel.com.yml +2 -2
- data/conf/mms.att.net.yml +9 -9
- data/conf/mms.dobson.net.yml +3 -3
- data/conf/mms.luxgsm.lu.yml +8 -8
- data/conf/mms.mobileiam.ma.yml +6 -6
- data/conf/mms.mtn.co.za.yml +4 -4
- data/conf/mms.myhelio.com.yml +7 -7
- data/conf/mms.netcom.no.yml +2 -2
- data/conf/mms.o2online.de.yml +6 -6
- data/conf/mms.three.co.uk.yml +9 -9
- data/conf/mms.uscc.net.mail +6 -6
- data/conf/mms.vodacom4me.co.za.yml +4 -4
- data/conf/mms2r_media.yml +20 -20
- data/conf/mobile.indosat.net.id.yml +4 -4
- data/conf/msg.telus.com.yml +2 -2
- data/conf/orangemms.net.yml +7 -7
- data/conf/pm.sprint.com.yml +8 -8
- data/conf/pxt.vodafone.net.nz.yml +3 -3
- data/conf/rci.rogers.com.yml +7 -7
- data/conf/sms.sasktel.com.yml +9 -9
- data/conf/tmomail.net.yml +22 -22
- data/conf/txt.bell.ca.yml +2 -2
- data/conf/unicel.com.yml +3 -3
- data/conf/vmpix.com.yml +7 -7
- data/conf/vzwpix.com.yml +6 -6
- data/conf/waw.plspictures.com.yml +8 -9
- data/dev_tools/anonymizer.rb +1 -1
- data/lib/{mail_ext.rb → ext/mail.rb} +0 -0
- data/lib/ext/object.rb +11 -0
- data/lib/mms2r.rb +10 -20
- data/lib/mms2r/media.rb +33 -29
- data/mms2r.gemspec +23 -43
- data/test/fixtures/ad_new.txt +5 -0
- data/test/fixtures/dici_un_mois_georgie.txt +1 -0
- data/test/hax.rb +8 -0
- data/test/test_1nbox_net.rb +2 -2
- data/test/test_bell_canada.rb +1 -1
- data/test/test_bellsouth_net.rb +2 -2
- data/test/test_helper.rb +5 -9
- data/test/test_mediamessaging_o2_co_uk.rb +1 -1
- data/test/test_messaging_nextel_com.rb +1 -1
- data/test/test_messaging_sprintpcs_com.rb +1 -1
- data/test/test_mms2r_media.rb +35 -23
- data/test/test_mms_3ireland_ie.rb +1 -1
- data/test/test_mms_ae.rb +1 -1
- data/test/test_mms_alltel_com.rb +1 -1
- data/test/test_mms_att_net.rb +2 -2
- data/test/test_mms_dobson_net.rb +1 -1
- data/test/test_mms_luxgsm_lu.rb +1 -1
- data/test/test_mms_mobileiam_ma.rb +1 -1
- data/test/test_mms_mtn_co_za.rb +1 -1
- data/test/test_mms_mycricket_com.rb +1 -1
- data/test/test_mms_myhelio_com.rb +1 -1
- data/test/test_mms_netcom_no.rb +1 -1
- data/test/test_mms_o2online_de.rb +1 -1
- data/test/test_mms_three_co_uk.rb +1 -1
- data/test/test_mms_uscc_net.rb +1 -1
- data/test/test_mms_vodacom4me_co_za.rb +1 -1
- data/test/test_mobile_indosat_net_id.rb +1 -1
- data/test/test_msg_telus_com.rb +1 -1
- data/test/test_orangemms_net.rb +1 -1
- data/test/test_pm_sprint_com.rb +1 -1
- data/test/test_pxt_vodafone_net_nz.rb +1 -1
- data/test/test_rci_rogers_com.rb +1 -1
- data/test/test_sms_sasktel_com.rb +1 -1
- data/test/test_tmomail_net.rb +4 -4
- data/test/test_unicel_com.rb +1 -1
- data/test/test_vmpix_com.rb +1 -1
- data/test/test_vzwpix_com.rb +3 -7
- data/test/test_waw_plspictures_com.rb +1 -1
- metadata +91 -118
- data/.gitignore +0 -7
- data/dev_tools/github.rb +0 -8
- data/test/test_github.rb +0 -12
data/mms2r.gemspec
CHANGED
@@ -1,65 +1,45 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version = "3.
|
4
|
+
s.name = "mms2r"
|
5
|
+
s.version = "3.4.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Mike Mondragon"]
|
9
|
-
s.date =
|
10
|
-
s.description =
|
11
|
-
|
12
|
-
MMS2R is a library that decodes the parts of an MMS message to disk while
|
13
|
-
stripping out advertising injected by the mobile carriers. MMS messages are
|
14
|
-
multipart email and the carriers often inject branding into these messages. Use
|
15
|
-
MMS2R if you want to get at the real user generated content from a MMS without
|
16
|
-
having to deal with the cruft from the carriers.
|
17
|
-
|
18
|
-
If MMS2R is not aware of a particular carrier no extra processing is done to the
|
19
|
-
MMS other than decoding and consolidating its media.
|
20
|
-
|
21
|
-
MMS2R can be used to process any multipart email to conveniently access the
|
22
|
-
parts the mail is comprised of.}
|
9
|
+
s.date = "2011-10-31"
|
10
|
+
s.description = "== DESCRIPTION\n\nMMS2R by Mike Mondragon\nhttp://mms2r.rubyforge.org/\nhttps://github.com/monde/mms2r\nhttps://github.com/monde/mms2r/issues\nhttp://peepcode.com/products/mms2r-pdf\n\nMMS2R is a library that decodes the parts of an MMS message to disk while\nstripping out advertising injected by the mobile carriers. MMS messages are\nmultipart email and the carriers often inject branding into these messages. Use\nMMS2R if you want to get at the real user generated content from a MMS without\nhaving to deal with the cruft from the carriers.\n\nIf MMS2R is not aware of a particular carrier no extra processing is done to the\nMMS other than decoding and consolidating its media."
|
23
11
|
s.email = ["mikemondragon@gmail.com"]
|
24
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.TMail.txt", "README.txt"]
|
25
|
-
s.files = [".
|
26
|
-
s.homepage =
|
27
|
-
}
|
13
|
+
s.files = ["Gemfile", "Gemfile.lock", "History.txt", "Manifest.txt", "README.TMail.txt", "README.txt", "Rakefile", "conf/1nbox.net.yml", "conf/aliases.yml", "conf/bellsouth.net.yml", "conf/from.yml", "conf/mediamessaging.o2.co.uk.yml", "conf/messaging.nextel.com.yml", "conf/mms.3ireland.ie.yml", "conf/mms.ae.yml", "conf/mms.alltel.com.yml", "conf/mms.att.net.yml", "conf/mms.dobson.net.yml", "conf/mms.luxgsm.lu.yml", "conf/mms.mobileiam.ma.yml", "conf/mms.mtn.co.za.yml", "conf/mms.mycricket.com.yml", "conf/mms.myhelio.com.yml", "conf/mms.netcom.no.yml", "conf/mms.o2online.de.yml", "conf/mms.three.co.uk.yml", "conf/mms.uscc.net.mail", "conf/mms.vodacom4me.co.za.yml", "conf/mms2r_media.yml", "conf/mobile.indosat.net.id.yml", "conf/msg.telus.com.yml", "conf/orangemms.net.yml", "conf/pm.sprint.com.yml", "conf/pxt.vodafone.net.nz.yml", "conf/rci.rogers.com.yml", "conf/sms.sasktel.com.yml", "conf/tmomail.net.yml", "conf/txt.bell.ca.yml", "conf/unicel.com.yml", "conf/vmpix.com.yml", "conf/vzwpix.com.yml", "conf/waw.plspictures.com.yml", "dev_tools/anonymizer.rb", "dev_tools/debug_sprint_nokogiri_parsing.rb", "init.rb", "lib/ext/mail.rb", "lib/ext/object.rb", "lib/mms2r.rb", "lib/mms2r/media.rb", "lib/mms2r/media/sprint.rb", "mms2r.gemspec", "test/fixtures/1nbox-2images-01.mail", "test/fixtures/1nbox-2images-02.mail", "test/fixtures/1nbox-2images-03.mail", "test/fixtures/1nbox-2images-04.mail", "test/fixtures/3ireland-mms-01.mail", "test/fixtures/ad_new.txt", "test/fixtures/alltel-image-01.mail", "test/fixtures/alltel-mms-01.mail", "test/fixtures/alltel-mms-03.mail", "test/fixtures/apple-double-image-01.mail", "test/fixtures/att-blackberry-02.mail", "test/fixtures/att-blackberry.mail", "test/fixtures/att-image-01.mail", "test/fixtures/att-image-02.mail", "test/fixtures/att-iphone-01.mail", "test/fixtures/att-iphone-02.mail", "test/fixtures/att-iphone-03.mail", "test/fixtures/att-text-01.mail", "test/fixtures/bell-canada-image-01.mail", "test/fixtures/cingularme-text-01.mail", "test/fixtures/cingularme-text-02.mail", "test/fixtures/dici_un_mois_georgie.txt", "test/fixtures/dobson-image-01.mail", "test/fixtures/dot.jpg", "test/fixtures/generic.mail", "test/fixtures/handsets.yml", "test/fixtures/helio-image-01.mail", "test/fixtures/helio-message-01.mail", "test/fixtures/iconv-fr-text-01.mail", "test/fixtures/indosat-image-01.mail", "test/fixtures/indosat-image-02.mail", "test/fixtures/info2go-image-01.mail", "test/fixtures/iphone-image-01.mail", "test/fixtures/luxgsm-image-01.mail", "test/fixtures/maroctelecom-france-mms-01.mail", "test/fixtures/mediamessaging_o2_co_uk-image-01.mail", "test/fixtures/mmode-image-01.mail", "test/fixtures/mms.ae-image-01.mail", "test/fixtures/mms.mycricket.com-pic-and-text.mail", "test/fixtures/mms.mycricket.com-pic.mail", "test/fixtures/mmsreply.t-mobile.co.uk-text-image-01.mail", "test/fixtures/mobile.mycingular.com-text-01.mail", "test/fixtures/mtn-southafrica-mms.mail", "test/fixtures/mycingular-image-01.mail", "test/fixtures/netcom-image-01.mail", "test/fixtures/nextel-image-01.mail", "test/fixtures/nextel-image-02.mail", "test/fixtures/nextel-image-03.mail", "test/fixtures/nextel-image-04.mail", "test/fixtures/o2-de-image-01.mail", "test/fixtures/orange-uk-image-01.mail", "test/fixtures/orangefrance-text-and-image.mail", "test/fixtures/orangepoland-text-01.mail", "test/fixtures/orangepoland-text-02.mail", "test/fixtures/pics.cingularme.com-image-01.mail", "test/fixtures/pxt-image-01.mail", "test/fixtures/rogers-canada-mms-01.mail", "test/fixtures/sasktel-image-01.mail", "test/fixtures/sprint-broken-image-01.mail", "test/fixtures/sprint-image-01.mail", "test/fixtures/sprint-new-image-01.mail", "test/fixtures/sprint-pcs-text-01.mail", "test/fixtures/sprint-purged-image-01.mail", "test/fixtures/sprint-text-01.mail", "test/fixtures/sprint-two-images-01.mail", "test/fixtures/sprint-video-01.mail", "test/fixtures/sprint.mov", "test/fixtures/suncom-blackberry.mail", "test/fixtures/telus-image-01.mail", "test/fixtures/three-uk-image-01.mail", "test/fixtures/tmo.blackberry.net-image-01.mail", "test/fixtures/tmobile-blackberry-02.mail", "test/fixtures/tmobile-blackberry.mail", "test/fixtures/tmobile-image-01.mail", "test/fixtures/tmobile-image-02.mail", "test/fixtures/unicel-image-01.mail", "test/fixtures/us-cellular-image-01.mail", "test/fixtures/verizon-blackberry.mail", "test/fixtures/verizon-image-01.mail", "test/fixtures/verizon-image-02.mail", "test/fixtures/verizon-image-03.mail", "test/fixtures/verizon-text-01.mail", "test/fixtures/verizon-video-01.mail", "test/fixtures/virgin-mobile-image-01.mail", "test/fixtures/virgin.ca-text-01.mail", "test/fixtures/vodacom4me-co-za-01.mail", "test/fixtures/vodacom4me-co-za-02.mail", "test/fixtures/vodacom4me-southafrica-mms-01.mail", "test/fixtures/vodacom4me-southafrica-mms-04.mail", "test/fixtures/vtext-text-01.mail", "test/fixtures/vzwpix.com-image-01.mail", "test/fixtures/waw.plspictures.com-image-01.mail", "test/hax.rb", "test/test_1nbox_net.rb", "test/test_bell_canada.rb", "test/test_bellsouth_net.rb", "test/test_helper.rb", "test/test_mediamessaging_o2_co_uk.rb", "test/test_messaging_nextel_com.rb", "test/test_messaging_sprintpcs_com.rb", "test/test_mms2r_media.rb", "test/test_mms_3ireland_ie.rb", "test/test_mms_ae.rb", "test/test_mms_alltel_com.rb", "test/test_mms_att_net.rb", "test/test_mms_dobson_net.rb", "test/test_mms_luxgsm_lu.rb", "test/test_mms_mobileiam_ma.rb", "test/test_mms_mtn_co_za.rb", "test/test_mms_mycricket_com.rb", "test/test_mms_myhelio_com.rb", "test/test_mms_netcom_no.rb", "test/test_mms_o2online_de.rb", "test/test_mms_three_co_uk.rb", "test/test_mms_uscc_net.rb", "test/test_mms_vodacom4me_co_za.rb", "test/test_mobile_indosat_net_id.rb", "test/test_msg_telus_com.rb", "test/test_orangemms_net.rb", "test/test_pm_sprint_com.rb", "test/test_pxt_vodafone_net_nz.rb", "test/test_rci_rogers_com.rb", "test/test_sms_sasktel_com.rb", "test/test_tmomail_net.rb", "test/test_unicel_com.rb", "test/test_vmpix_com.rb", "test/test_vzwpix_com.rb", "test/test_waw_plspictures_com.rb", "vendor/plugins/mms2r/lib/autotest/discover.rb", "vendor/plugins/mms2r/lib/autotest/mms2r.rb", ".gemtest"]
|
14
|
+
s.homepage = "https://github.com/monde/mms2r"
|
28
15
|
s.rdoc_options = ["--main", "README.txt"]
|
29
16
|
s.require_paths = ["lib"]
|
30
|
-
s.rubyforge_project =
|
31
|
-
s.rubygems_version =
|
32
|
-
s.summary =
|
33
|
-
s.test_files = ["test/
|
17
|
+
s.rubyforge_project = "mms2r"
|
18
|
+
s.rubygems_version = "1.8.10"
|
19
|
+
s.summary = "Extract user media from MMS (and not carrier cruft)"
|
20
|
+
s.test_files = ["test/test_orangemms_net.rb", "test/test_waw_plspictures_com.rb", "test/test_mediamessaging_o2_co_uk.rb", "test/test_vzwpix_com.rb", "test/test_unicel_com.rb", "test/test_messaging_sprintpcs_com.rb", "test/test_mms_luxgsm_lu.rb", "test/test_rci_rogers_com.rb", "test/test_mms_uscc_net.rb", "test/test_mms_netcom_no.rb", "test/test_1nbox_net.rb", "test/test_sms_sasktel_com.rb", "test/test_mms_att_net.rb", "test/test_mobile_indosat_net_id.rb", "test/test_messaging_nextel_com.rb", "test/test_mms_mtn_co_za.rb", "test/test_mms_vodacom4me_co_za.rb", "test/test_pxt_vodafone_net_nz.rb", "test/test_mms_dobson_net.rb", "test/test_helper.rb", "test/test_msg_telus_com.rb", "test/test_mms_o2online_de.rb", "test/test_mms2r_media.rb", "test/test_bell_canada.rb", "test/test_tmomail_net.rb", "test/test_mms_3ireland_ie.rb", "test/test_pm_sprint_com.rb", "test/test_mms_alltel_com.rb", "test/test_mms_mobileiam_ma.rb", "test/test_mms_mycricket_com.rb", "test/test_bellsouth_net.rb", "test/test_mms_three_co_uk.rb", "test/test_vmpix_com.rb", "test/test_mms_myhelio_com.rb", "test/test_mms_ae.rb"]
|
34
21
|
|
35
22
|
if s.respond_to? :specification_version then
|
36
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
37
23
|
s.specification_version = 3
|
38
24
|
|
39
|
-
if Gem::Version.new(Gem::
|
40
|
-
s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.
|
41
|
-
s.add_runtime_dependency(%q<mail>, [">= 2.2.
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.4"])
|
27
|
+
s.add_runtime_dependency(%q<mail>, [">= 2.2.10"])
|
42
28
|
s.add_runtime_dependency(%q<uuidtools>, [">= 2.1.1"])
|
43
|
-
s.add_runtime_dependency(%q<exifr>, [">= 1.0.
|
44
|
-
s.add_development_dependency(%q<
|
45
|
-
s.add_development_dependency(%q<gemcutter>, [">= 0.4.1"])
|
46
|
-
s.add_development_dependency(%q<hoe>, [">= 2.5.0"])
|
29
|
+
s.add_runtime_dependency(%q<exifr>, [">= 1.0.3"])
|
30
|
+
s.add_development_dependency(%q<hoe>, ["~> 2.12"])
|
47
31
|
else
|
48
|
-
s.add_dependency(%q<nokogiri>, [">= 1.4.
|
49
|
-
s.add_dependency(%q<mail>, [">= 2.2.
|
32
|
+
s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
|
33
|
+
s.add_dependency(%q<mail>, [">= 2.2.10"])
|
50
34
|
s.add_dependency(%q<uuidtools>, [">= 2.1.1"])
|
51
|
-
s.add_dependency(%q<exifr>, [">= 1.0.
|
52
|
-
s.add_dependency(%q<
|
53
|
-
s.add_dependency(%q<gemcutter>, [">= 0.4.1"])
|
54
|
-
s.add_dependency(%q<hoe>, [">= 2.5.0"])
|
35
|
+
s.add_dependency(%q<exifr>, [">= 1.0.3"])
|
36
|
+
s.add_dependency(%q<hoe>, ["~> 2.12"])
|
55
37
|
end
|
56
38
|
else
|
57
|
-
s.add_dependency(%q<nokogiri>, [">= 1.4.
|
58
|
-
s.add_dependency(%q<mail>, [">= 2.2.
|
39
|
+
s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
|
40
|
+
s.add_dependency(%q<mail>, [">= 2.2.10"])
|
59
41
|
s.add_dependency(%q<uuidtools>, [">= 2.1.1"])
|
60
|
-
s.add_dependency(%q<exifr>, [">= 1.0.
|
61
|
-
s.add_dependency(%q<
|
62
|
-
s.add_dependency(%q<gemcutter>, [">= 0.4.1"])
|
63
|
-
s.add_dependency(%q<hoe>, [">= 2.5.0"])
|
42
|
+
s.add_dependency(%q<exifr>, [">= 1.0.3"])
|
43
|
+
s.add_dependency(%q<hoe>, ["~> 2.12"])
|
64
44
|
end
|
65
45
|
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
This message was sent using the Picture and Video Messaging service from Verizon Wireless!
|
2
|
+
|
3
|
+
To learn how you can snap pictures and capture videos with your wireless phone visit www.verizonwireless.com/picture.
|
4
|
+
|
5
|
+
Note: To play video messages sent to email, QuickTime® 6.5 or higher is required.
|
@@ -0,0 +1 @@
|
|
1
|
+
D'ici un mois Géorgie
|
data/test/hax.rb
ADDED
data/test/test_1nbox_net.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class Test1nboxNet < Test::Unit::TestCase
|
4
4
|
include MMS2R::TestHelper
|
@@ -48,7 +48,7 @@ class Test1nboxNet < Test::Unit::TestCase
|
|
48
48
|
|
49
49
|
assert_not_nil mms.media['image/jpeg']
|
50
50
|
assert_equal 1, mms.media['image/jpeg'].size
|
51
|
-
assert_match(
|
51
|
+
assert_match(/\/Copy of test1\.jpg$/, mms.media['image/jpeg'].first)
|
52
52
|
|
53
53
|
mms.purge
|
54
54
|
end
|
data/test/test_bell_canada.rb
CHANGED
data/test/test_bellsouth_net.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class TestBellsouthNet < Test::Unit::TestCase
|
4
4
|
include MMS2R::TestHelper
|
@@ -11,7 +11,7 @@ class TestBellsouthNet < Test::Unit::TestCase
|
|
11
11
|
assert_nil mms.media['text/plain']
|
12
12
|
|
13
13
|
assert_not_nil mms.media['image/jpeg'].first
|
14
|
-
assert_match(
|
14
|
+
assert_match(/\/IMG00065\.jpg$/, mms.media['image/jpeg'].first)
|
15
15
|
mms.purge
|
16
16
|
end
|
17
17
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,14 +1,6 @@
|
|
1
1
|
# do it like rake http://ozmm.org/posts/do_it_like_rake.html
|
2
|
-
begin
|
3
|
-
gem 'test-unit', '= 1.2.3'
|
4
|
-
require 'test/unit'
|
5
|
-
rescue NoMethodError
|
6
|
-
require 'rubygems'
|
7
|
-
gem 'test-unit', '= 1.2.3'
|
8
|
-
require 'test/unit'
|
9
|
-
end
|
10
2
|
|
11
|
-
%W{ set net/http net/https pp tempfile mocha }.each do |g|
|
3
|
+
%W{ test/unit set net/http net/https pp tempfile mocha }.each do |g|
|
12
4
|
begin
|
13
5
|
require g
|
14
6
|
rescue LoadError
|
@@ -36,6 +28,10 @@ module MMS2R
|
|
36
28
|
File.join(File.expand_path(File.dirname(__FILE__)), "fixtures", file)
|
37
29
|
end
|
38
30
|
|
31
|
+
def fixture_data(name)
|
32
|
+
open(fixture(name)).read
|
33
|
+
end
|
34
|
+
|
39
35
|
def mail_fixture(file)
|
40
36
|
fixture(file)
|
41
37
|
end
|
data/test/test_mms2r_media.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require "test_helper"
|
2
4
|
|
3
5
|
class TestMms2rMedia < Test::Unit::TestCase
|
4
6
|
include MMS2R::TestHelper
|
@@ -109,13 +111,13 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
109
111
|
end
|
110
112
|
|
111
113
|
def test_initialize_config_contatenation
|
112
|
-
c = {'ignore' => {'text/plain' => [
|
113
|
-
'transform' => {'text/plain' => [
|
114
|
-
'number' => ['from',
|
114
|
+
c = {'ignore' => {'text/plain' => [/A TEST/]},
|
115
|
+
'transform' => {'text/plain' => [/FOO/, '']},
|
116
|
+
'number' => ['from', /^([^\s]+)\s.*/, '\1']
|
115
117
|
}
|
116
118
|
config = MMS2R::Media.initialize_config(c)
|
117
|
-
assert_not_nil config['ignore']['text/plain'].detect{|v| v ==
|
118
|
-
assert_not_nil config['transform']['text/plain'].detect{|v| v ==
|
119
|
+
assert_not_nil config['ignore']['text/plain'].detect{|v| v == /A TEST/}
|
120
|
+
assert_not_nil config['transform']['text/plain'].detect{|v| v == /FOO/}
|
119
121
|
assert_not_nil config['number'].first == 'from'
|
120
122
|
end
|
121
123
|
|
@@ -145,7 +147,7 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
145
147
|
YAML.expects(:load_file).at_least_once.with(mms_yaml).returns({})
|
146
148
|
YAML.expects(:load_file).at_least_once.with(aliases_yaml).returns({})
|
147
149
|
YAML.expects(:load_file).at_least_once.with(from_yaml).returns([])
|
148
|
-
YAML.expects(:load_file).
|
150
|
+
YAML.expects(:load_file).never.with(example_yaml)
|
149
151
|
mms = MMS2R::Media.new stub_mail
|
150
152
|
end
|
151
153
|
|
@@ -159,7 +161,7 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
159
161
|
def test_mms_phone_number_from_config
|
160
162
|
mail = stub_mail(:from => '"+2068675309" <TESTER@mms.vodacom4me.co.za>')
|
161
163
|
mms = MMS2R::Media.new(mail)
|
162
|
-
mms.expects(:config).once.returns({'number' => ['from',
|
164
|
+
mms.expects(:config).once.returns({'number' => ['from', /^([^\s]+)\s.*/, '\1']})
|
163
165
|
assert_equal '+2068675309', mms.number
|
164
166
|
end
|
165
167
|
|
@@ -172,7 +174,7 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
172
174
|
end
|
173
175
|
end
|
174
176
|
|
175
|
-
def
|
177
|
+
def test_transform_text_plain
|
176
178
|
mail = stub_mail
|
177
179
|
mail.stubs(:from).returns(nil)
|
178
180
|
mms = MMS2R::Media.new(mail)
|
@@ -196,19 +198,18 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
196
198
|
assert_equal result, mms.transform_text(type, text)
|
197
199
|
|
198
200
|
# matches in config
|
199
|
-
mms.expects(:config).at_least_once.returns({'transform' => {type => [[
|
201
|
+
mms.expects(:config).at_least_once.returns({'transform' => {type => [[/(hello)/, 'world']]}})
|
200
202
|
assert_equal [type, 'world'], mms.transform_text(type, text)
|
201
203
|
|
202
|
-
mms.expects(:config).at_least_once.returns({'transform' => {type => [[
|
204
|
+
mms.expects(:config).at_least_once.returns({'transform' => {type => [[/^Ignore this part, (.+)/, '\1']]}})
|
203
205
|
assert_equal [type, text], mms.transform_text(type, "Ignore this part, " + text)
|
204
206
|
|
205
207
|
# chaining transforms
|
206
|
-
mms.expects(:config).at_least_once.returns({'transform' => {type => [[
|
207
|
-
[
|
208
|
+
mms.expects(:config).at_least_once.returns({'transform' => {type => [[/(hello)/, 'world'],
|
209
|
+
[/(world)/, 'mars']]}})
|
208
210
|
assert_equal [type, 'mars'], mms.transform_text(type, text)
|
209
211
|
|
210
212
|
# has a Iconv problem
|
211
|
-
Iconv.expects(:new).raises
|
212
213
|
mms.expects(:config).at_least_once.returns({'transform' => {type => [['(hello)', 'world']]}})
|
213
214
|
assert_equal result, mms.transform_text(type, text)
|
214
215
|
end
|
@@ -223,11 +224,21 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
223
224
|
file = mms.media['text/plain'][0]
|
224
225
|
assert_not_nil file
|
225
226
|
assert_equal true, File::exist?(file)
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
227
|
+
text_lines = IO.readlines("#{file}")
|
228
|
+
text = text_lines.join
|
229
|
+
|
230
|
+
# ASCII-8BIT -> D'ici un mois G\xC3\xA9orgie
|
231
|
+
# UTF-8 -> D'ici un mois Géorgie
|
232
|
+
|
233
|
+
if RUBY_VERSION < "1.9"
|
234
|
+
assert_equal("D'ici un mois Géorgie body", text_lines.first.strip)
|
235
|
+
assert_equal("sample email message Fwd: sub D'ici un mois Géorgie", mms.subject)
|
236
|
+
else
|
237
|
+
#assert_equal("D'ici un mois Géorgie body", text_lines.first.strip)
|
238
|
+
assert_equal("D'ici un mois G\xE9orgie body", text_lines.first.strip)
|
239
|
+
assert_equal("sample email message Fwd: sub D'ici un mois Géorgie", mms.subject)
|
240
|
+
end
|
241
|
+
|
231
242
|
mms.purge
|
232
243
|
end
|
233
244
|
|
@@ -266,7 +277,7 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
266
277
|
mms = MMS2R::Media.new(mail)
|
267
278
|
mms.stubs(:config).returns(
|
268
279
|
{ 'ignore' => {},
|
269
|
-
'transform' => {'text/plain' => [[
|
280
|
+
'transform' => {'text/plain' => [[/Default Subject: (.+)/, '\1']]}})
|
270
281
|
assert_equal 'hello world', mms.subject
|
271
282
|
end
|
272
283
|
|
@@ -318,7 +329,8 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
318
329
|
mms = MMS2R::Media.new stub_mail
|
319
330
|
temp_big = temp_text_file("hello world")
|
320
331
|
mms.stubs(:default_text).returns(File.new(temp_big))
|
321
|
-
|
332
|
+
body = mms.body
|
333
|
+
assert_equal "hello world", body
|
322
334
|
end
|
323
335
|
|
324
336
|
def test_body_when_html
|
@@ -451,7 +463,7 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
451
463
|
|
452
464
|
def test_ignore_media_by_filename_regexp
|
453
465
|
name = 'foo.txt'
|
454
|
-
regexp =
|
466
|
+
regexp = /foo\.txt/i
|
455
467
|
type = 'text/plain'
|
456
468
|
mms = MMS2R::Media.new stub_mail
|
457
469
|
mms.stubs(:config).returns({'ignore' => {type => [regexp, 'nil.txt']}})
|
@@ -470,7 +482,7 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
470
482
|
def test_ignore_media_by_regexp_on_file_content
|
471
483
|
name = 'foo.txt'
|
472
484
|
content = "aaaaaaahello worldbbbbbbbbb"
|
473
|
-
regexp =
|
485
|
+
regexp = /.*Hello World.*/i
|
474
486
|
type = 'text/plain'
|
475
487
|
mms = MMS2R::Media.new stub_mail
|
476
488
|
mms.stubs(:config).returns({'ignore' => {type => ['nil.txt', regexp]}})
|
data/test/test_mms_ae.rb
CHANGED
data/test/test_mms_alltel_com.rb
CHANGED
data/test/test_mms_att_net.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class TestMmsAttNet < Test::Unit::TestCase
|
4
4
|
include MMS2R::TestHelper
|
@@ -106,7 +106,7 @@ class TestMmsAttNet < Test::Unit::TestCase
|
|
106
106
|
assert_equal "Hello world", IO.readlines(mms.media['text/plain'].first).join.strip
|
107
107
|
|
108
108
|
assert_not_nil mms.media['image/jpeg'].first
|
109
|
-
assert_match(
|
109
|
+
assert_match(/\/BC-WAKE\.jpg$/, mms.media['image/jpeg'].first)
|
110
110
|
end
|
111
111
|
|
112
112
|
def test_image_from_blackberry2
|
data/test/test_mms_dobson_net.rb
CHANGED
data/test/test_mms_luxgsm_lu.rb
CHANGED
data/test/test_mms_mtn_co_za.rb
CHANGED
data/test/test_mms_netcom_no.rb
CHANGED
data/test/test_mms_uscc_net.rb
CHANGED