mms2r 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +13 -0
- data/Manifest.txt +1 -0
- data/README.txt +35 -18
- data/Rakefile +11 -7
- data/conf/aliases.yml +3 -0
- data/conf/mms2r_media.yml +16 -1
- data/lib/mms2r.rb +3 -2
- data/lib/mms2r/media.rb +30 -27
- data/mms2r.gemspec +12 -9
- data/test/fixtures/handsets.yml +119 -0
- data/test/fixtures/luxgsm-image-01.mail +2 -1
- data/test/test_helper.rb +20 -17
- data/test/test_mms2r_media.rb +25 -24
- metadata +29 -14
data/History.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
### 3.1.0 / 2010-07-09 (Dick "Magic Ears" Knubbler - music producer)
|
2
|
+
* 8 minor enhancements
|
3
|
+
* Detects additional Bell/AT&T domain sbcglobal.net as a handset
|
4
|
+
* Detects additional Virgin mobile domains pixmbl.com vmobl.com as a handset
|
5
|
+
* Expanded mobile phone detection for handset makers by : Casio, Google Nexus
|
6
|
+
One, LG Electronics, Motorola, Pantech, Qualcom, Samsung, Sprint, UTStarCom
|
7
|
+
* EXIF Reader (exifr) is integral to MMS2R and is now a required gem
|
8
|
+
* upgrade Mail to 2.2.5
|
9
|
+
* depend on latest gems
|
10
|
+
* corrected example - Jason Hooper
|
11
|
+
* added As Seen On The Internet to README that lists sites known to be using
|
12
|
+
MMS2R in some fashion
|
13
|
+
|
1
14
|
### 3.0.1 / 2010-03-28 (Lavona Succuboso - leader of "Succuboso Explosion")
|
2
15
|
|
3
16
|
* 1 minor enhancement
|
data/Manifest.txt
CHANGED
@@ -71,6 +71,7 @@ test/fixtures/cingularme-text-02.mail
|
|
71
71
|
test/fixtures/dobson-image-01.mail
|
72
72
|
test/fixtures/dot.jpg
|
73
73
|
test/fixtures/generic.mail
|
74
|
+
test/fixtures/handsets.yml
|
74
75
|
test/fixtures/helio-image-01.mail
|
75
76
|
test/fixtures/helio-message-01.mail
|
76
77
|
test/fixtures/iconv-fr-text-01.mail
|
data/README.txt
CHANGED
@@ -31,7 +31,7 @@ Corpus of carriers currently processed by MMS2R:
|
|
31
31
|
* AT&T/Cingular/Legacy: mms.att.net, txt.att.net, mmode.com, mms.mycingular.com,
|
32
32
|
cingularme.com, mobile.mycingular.com pics.cingularme.com
|
33
33
|
* Bell Canada: txt.bell.ca
|
34
|
-
* Bell South / Suncom: bellsouth.net
|
34
|
+
* Bell South / Suncom / SBC Global: bellsouth.net, sbcglobal.net
|
35
35
|
* Cricket Wireless: mms.mycricket.com
|
36
36
|
* Dobson/Cellular One: mms.dobson.net
|
37
37
|
* Helio: mms.myhelio.com
|
@@ -57,27 +57,48 @@ Corpus of carriers currently processed by MMS2R:
|
|
57
57
|
* Unicel: unicel.com, info2go.com
|
58
58
|
(note: mobile number is tucked away in a text/plain part for unicel.com)
|
59
59
|
* Verizon: vzwpix.com, vtext.com
|
60
|
-
* Virgin Mobile: vmpix.com
|
60
|
+
* Virgin Mobile: vmpix.com, pixmbl.com, vmobl.com
|
61
61
|
* Virgin Mobile of Canada: vmobile.ca
|
62
62
|
* Vodacom: mms.vodacom4me.co.za
|
63
63
|
|
64
64
|
Corpus of smart phones known to MMS2R:
|
65
|
-
*
|
65
|
+
* Apple iPhone variants
|
66
|
+
* Blackberry / Research In Motion variants
|
67
|
+
* Casio variants
|
66
68
|
* Droid variants
|
69
|
+
* Google / Nexus One variants
|
67
70
|
* HTC variants (T-Mobile Dash, Sprint HERO)
|
68
|
-
*
|
71
|
+
* LG Electronics variants
|
72
|
+
* Motorola variants
|
73
|
+
* Pantech variants
|
74
|
+
* Qualcom variants
|
75
|
+
* Samsung variants
|
76
|
+
* Sprint variants
|
77
|
+
* UTStarCom variants
|
78
|
+
|
79
|
+
As Seen On The Internets - sites known to be using MMS2R in some fashion
|
80
|
+
|
81
|
+
* twitpic.com [http://www.twitpic.com/]
|
82
|
+
* fanchatter.com [http://www.fanchatter.com/]
|
83
|
+
* camura.com [http://www.camura.com/]
|
84
|
+
* eachday.com [http://www.eachday.com/]
|
85
|
+
* beenup2.com [http://www.beenup2.com/]
|
86
|
+
* snapmylife.com [http://www.snapmylife.com/]
|
87
|
+
* email the author to be listed here
|
88
|
+
|
69
89
|
|
70
90
|
== FEATURES
|
71
91
|
|
72
92
|
* #default_media and #default_text methods return a File that can be used in
|
73
|
-
attachment_fu
|
74
|
-
* #process supports blocks
|
93
|
+
attachment_fu or Paperclip
|
94
|
+
* #process supports blocks for enumerating over the content of the MMS
|
75
95
|
* #process can be made lazy when :process => :lazy is passed to new
|
76
96
|
* logging is enabled when :logger => your_logger is passed to new
|
77
97
|
* an mms instance acts like a Mail object, any methods not defined on the
|
78
|
-
instance are delegated to
|
98
|
+
instance are delegated to it's underlying Mail object
|
79
99
|
* #device_type? returns a symbol representing a device or smartphone type
|
80
|
-
Known smartphones thus far: iPhone, BlackBerry, T-Mobile Dash, Droid
|
100
|
+
Known smartphones thus far: iPhone, BlackBerry, T-Mobile Dash, Droid,
|
101
|
+
Samsung
|
81
102
|
|
82
103
|
== BOOKS
|
83
104
|
|
@@ -92,7 +113,7 @@ http://peepcode.com/products/mms2r-pdf
|
|
92
113
|
# required for the example
|
93
114
|
require 'fileutils'
|
94
115
|
|
95
|
-
mail = MMS2R.new(Mail.read('some_saved_mail.file'))
|
116
|
+
mail = MMS2R::Media.new(Mail.read('some_saved_mail.file'))
|
96
117
|
puts "mail has default carrier subject" if mail.subject.empty?
|
97
118
|
|
98
119
|
# access the sender's phone number
|
@@ -153,14 +174,10 @@ http://peepcode.com/products/mms2r-pdf
|
|
153
174
|
|
154
175
|
== REQUIREMENTS
|
155
176
|
|
156
|
-
* Mail
|
157
|
-
* Nokogiri (
|
158
|
-
* UUIDTools
|
159
|
-
|
160
|
-
== OPTIONAL
|
161
|
-
|
162
|
-
* exifr - install exifr for exif access on default jpeg or tiff media, and
|
163
|
-
smart phone detection
|
177
|
+
* Mail (mail)
|
178
|
+
* Nokogiri (nokogiri)
|
179
|
+
* UUIDTools (uuidtools)
|
180
|
+
* EXIF Reader (exif)
|
164
181
|
|
165
182
|
== INSTALL
|
166
183
|
|
@@ -172,7 +189,7 @@ git clone git://github.com/monde/mms2r.git
|
|
172
189
|
|
173
190
|
== AUTHORS
|
174
191
|
|
175
|
-
Copyright (c) 2007-
|
192
|
+
Copyright (c) 2007-2010 by Mike Mondragon (blog[http://plasti.cx/])
|
176
193
|
|
177
194
|
MMS2R's Flickr page[http://www.flickr.com/photos/8627919@N05/]
|
178
195
|
|
data/Rakefile
CHANGED
@@ -21,18 +21,22 @@ Hoe.spec('mms2r') do |p|
|
|
21
21
|
p.url = p.paragraphs_of('README.txt', 1).first.strip
|
22
22
|
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
23
23
|
p.extra_deps << ['nokogiri', '>= 1.4.0']
|
24
|
-
p.extra_deps << ['mail', '>= 2.
|
25
|
-
p.extra_deps << ['uuidtools', '>= 2.1.
|
24
|
+
p.extra_deps << ['mail', '>= 2.2.5']
|
25
|
+
p.extra_deps << ['uuidtools', '>= 2.1.1']
|
26
|
+
p.extra_deps << ['exifr', '>= 1.0.1']
|
26
27
|
p.clean_globs << 'coverage'
|
27
28
|
end
|
28
29
|
|
29
30
|
begin
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
require 'rcov/rcovtask'
|
32
|
+
Rcov::RcovTask.new do |rcov|
|
33
|
+
rcov.pattern = 'test/**/test_*.rb'
|
34
|
+
rcov.verbose = true
|
35
|
+
rcov.rcov_opts << "--exclude rcov.rb"
|
34
36
|
end
|
35
|
-
rescue
|
37
|
+
rescue
|
38
|
+
task :rcov => :check_dependencies
|
36
39
|
end
|
37
40
|
|
41
|
+
|
38
42
|
# vim: syntax=Ruby
|
data/conf/aliases.yml
CHANGED
@@ -5,6 +5,7 @@ mmode.com: mms.att.net
|
|
5
5
|
mms.mycingular.com: mms.att.net
|
6
6
|
mobile.mycingular.com: mms.att.net
|
7
7
|
pics.cingularme.com: mms.att.net
|
8
|
+
sbcglobal.net: mms.att.net
|
8
9
|
vtext.com: vzwpix.com
|
9
10
|
orange.fr: orangemms.net
|
10
11
|
mmsemail.orange.pl: orangemms.net
|
@@ -14,4 +15,6 @@ tmo.blackberry.net: tmomail.net
|
|
14
15
|
info2go.com: unicel.com
|
15
16
|
mms.telusmobility.com: msg.telus.com
|
16
17
|
sprintpcs.com: pm.sprint.com
|
18
|
+
pixmbl.com: vmpix.com
|
17
19
|
vmobile.ca: vmpix.com
|
20
|
+
vmobl.com: vmpix.com
|
data/conf/mms2r_media.yml
CHANGED
@@ -41,8 +41,23 @@ device_types:
|
|
41
41
|
# created and sent by the device, the regex is used by mms2r to detect the
|
42
42
|
# model string
|
43
43
|
models:
|
44
|
-
:iphone: !ruby/regexp /iPhone/i
|
45
44
|
:blackberry: !ruby/regexp /BlackBerry/i
|
46
45
|
:dash: !ruby/regexp /T-Mobile Dash/i
|
47
46
|
:droid: !ruby/regexp /Droid/i
|
48
47
|
:htc: !ruby/regexp /HTC|Eris|HERO200/i
|
48
|
+
:iphone: !ruby/regexp /iPhone/i
|
49
|
+
makes:
|
50
|
+
:apple: !ruby/regexp /^Apple$/i
|
51
|
+
:casio: !ruby/regexp /^CASIO$/i
|
52
|
+
:dash: !ruby/regexp /T-Mobile Dash/i
|
53
|
+
:google: !ruby/regexp /^google$/i
|
54
|
+
:htc: !ruby/regexp /^HTC/i
|
55
|
+
:lge: !ruby/regexp /^(LG|CX87BL05)/i
|
56
|
+
:motorola: !ruby/regexp /^Motorola/i
|
57
|
+
:pantech: !ruby/regexp /^PANTECH$/i
|
58
|
+
:qualcomm: !ruby/regexp /^MSM6/i
|
59
|
+
:research_in_motion: !ruby/regexp /^(RIM|Research In Motion)$/i
|
60
|
+
:samsung: !ruby/regexp /^(SAMSUNG|ES.M800|M6550B-SAM-4480)/i
|
61
|
+
:seoul_electronics: !ruby/regexp /^ISUS0/i
|
62
|
+
:sprint: !ruby/regexp /^Sprint$/i
|
63
|
+
:utstarcom: !ruby/regexp /^T1A_UC1.88$/i
|
data/lib/mms2r.rb
CHANGED
@@ -39,7 +39,7 @@ module MMS2R
|
|
39
39
|
##
|
40
40
|
# MMS2R library version
|
41
41
|
|
42
|
-
VERSION = '3.0
|
42
|
+
VERSION = '3.1.0'
|
43
43
|
|
44
44
|
end
|
45
45
|
|
@@ -54,14 +54,15 @@ module MMS2R
|
|
54
54
|
end
|
55
55
|
|
56
56
|
require 'rubygems'
|
57
|
+
gem 'mail', '= 2.2.5'
|
57
58
|
require 'mail'
|
58
|
-
gem 'mail', '>= 2.1.2'
|
59
59
|
require 'fileutils'
|
60
60
|
require 'pathname'
|
61
61
|
require 'tmpdir'
|
62
62
|
require 'yaml'
|
63
63
|
require 'uuidtools'
|
64
64
|
require 'iconv'
|
65
|
+
require 'exifr'
|
65
66
|
|
66
67
|
require File.join(File.dirname(__FILE__), 'mail_ext')
|
67
68
|
require File.join(File.dirname(__FILE__), 'mms2r', 'media')
|
data/lib/mms2r/media.rb
CHANGED
@@ -185,7 +185,7 @@ module MMS2R
|
|
185
185
|
ret = case
|
186
186
|
when from.include?(from_domain)
|
187
187
|
from_domain
|
188
|
-
when return_path.
|
188
|
+
when return_path.present?
|
189
189
|
return_path
|
190
190
|
else
|
191
191
|
from_domain
|
@@ -218,6 +218,7 @@ module MMS2R
|
|
218
218
|
@number = nil
|
219
219
|
@subject = nil
|
220
220
|
@body = nil
|
221
|
+
@exif = nil
|
221
222
|
@default_media = nil
|
222
223
|
@default_text = nil
|
223
224
|
|
@@ -428,12 +429,13 @@ module MMS2R
|
|
428
429
|
# See the transform section in the discussion of the built-in
|
429
430
|
# configuration.
|
430
431
|
|
431
|
-
def transform_text(type, text,
|
432
|
-
|
432
|
+
def transform_text(type, text, original_encoding = 'ISO-8859-1')
|
433
|
+
|
434
|
+
return type, text if !config['transform'] || !(transforms = config['transform'][type])
|
433
435
|
|
434
436
|
#convert to UTF-8
|
435
437
|
begin
|
436
|
-
c = Iconv.new('UTF-8',
|
438
|
+
c = Iconv.new('UTF-8', original_encoding )
|
437
439
|
utf_t = c.iconv(text)
|
438
440
|
rescue Exception => e
|
439
441
|
utf_t = text
|
@@ -540,26 +542,25 @@ module MMS2R
|
|
540
542
|
|
541
543
|
def device_type?
|
542
544
|
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
545
|
+
file = attachment(['image'])
|
546
|
+
if file
|
547
|
+
original = file.original_filename
|
548
|
+
@exif = case original
|
549
|
+
when /\.je?pg$/i
|
550
|
+
EXIFR::JPEG.new(file)
|
551
|
+
when /\.tiff?$/i
|
552
|
+
EXIFR::TIFF.new(file)
|
553
|
+
end
|
554
|
+
if @exif
|
555
|
+
models = config['device_types']['models'] rescue {}
|
556
|
+
models.each do |model, regex|
|
557
|
+
return model if @exif.model =~ regex
|
558
|
+
end
|
559
|
+
makes = config['device_types']['makes'] rescue {}
|
560
|
+
makes.each do |make, regex|
|
561
|
+
return make if @exif.make =~ regex
|
560
562
|
end
|
561
563
|
end
|
562
|
-
rescue LoadError => err
|
563
564
|
end
|
564
565
|
|
565
566
|
headers = config['device_types']['headers'] rescue {}
|
@@ -746,11 +747,13 @@ module MMS2R
|
|
746
747
|
mime_type = nil
|
747
748
|
|
748
749
|
#get the largest file
|
749
|
-
files.each do |
|
750
|
-
if File.size(
|
751
|
-
size = File.size(
|
752
|
-
file = File.new(
|
753
|
-
|
750
|
+
files.each do |path|
|
751
|
+
if File.size(path) > size
|
752
|
+
size = File.size(path)
|
753
|
+
file = File.new(path)
|
754
|
+
media.each do |type,files|
|
755
|
+
mime_type = type if files.detect{ |_path| _path == path }
|
756
|
+
end
|
754
757
|
end
|
755
758
|
end
|
756
759
|
|
data/mms2r.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{mms2r}
|
5
|
-
s.version = "3.
|
5
|
+
s.version = "3.1.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 = %q{2010-
|
9
|
+
s.date = %q{2010-07-09}
|
10
10
|
s.description = %q{== DESCRIPTION
|
11
11
|
|
12
12
|
MMS2R is a library that decodes the parts of an MMS message to disk while
|
@@ -22,7 +22,7 @@ MMS2R can be used to process any multipart email to conveniently access the
|
|
22
22
|
parts the mail is comprised of.}
|
23
23
|
s.email = ["mikemondragon@gmail.com"]
|
24
24
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.TMail.txt", "README.txt"]
|
25
|
-
s.files = ["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", "dev_tools/github.rb", "init.rb", "lib/mail_ext.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/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/dobson-image-01.mail", "test/fixtures/dot.jpg", "test/fixtures/generic.mail", "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-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/test_1nbox_net.rb", "test/test_bell_canada.rb", "test/test_bellsouth_net.rb", "test/test_github.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"]
|
25
|
+
s.files = [".gitignore", "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", "dev_tools/github.rb", "init.rb", "lib/mail_ext.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/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/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-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/test_1nbox_net.rb", "test/test_bell_canada.rb", "test/test_bellsouth_net.rb", "test/test_github.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"]
|
26
26
|
s.homepage = %q{http://mms2r.rubyforge.org/
|
27
27
|
}
|
28
28
|
s.rdoc_options = ["--main", "README.txt"]
|
@@ -38,23 +38,26 @@ parts the mail is comprised of.}
|
|
38
38
|
|
39
39
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
40
40
|
s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.0"])
|
41
|
-
s.add_runtime_dependency(%q<mail>, [">= 2.
|
42
|
-
s.add_runtime_dependency(%q<uuidtools>, [">= 2.1.
|
41
|
+
s.add_runtime_dependency(%q<mail>, [">= 2.2.5"])
|
42
|
+
s.add_runtime_dependency(%q<uuidtools>, [">= 2.1.1"])
|
43
|
+
s.add_runtime_dependency(%q<exifr>, [">= 1.0.1"])
|
43
44
|
s.add_development_dependency(%q<rubyforge>, [">= 2.0.3"])
|
44
45
|
s.add_development_dependency(%q<gemcutter>, [">= 0.4.1"])
|
45
46
|
s.add_development_dependency(%q<hoe>, [">= 2.5.0"])
|
46
47
|
else
|
47
48
|
s.add_dependency(%q<nokogiri>, [">= 1.4.0"])
|
48
|
-
s.add_dependency(%q<mail>, [">= 2.
|
49
|
-
s.add_dependency(%q<uuidtools>, [">= 2.1.
|
49
|
+
s.add_dependency(%q<mail>, [">= 2.2.5"])
|
50
|
+
s.add_dependency(%q<uuidtools>, [">= 2.1.1"])
|
51
|
+
s.add_dependency(%q<exifr>, [">= 1.0.1"])
|
50
52
|
s.add_dependency(%q<rubyforge>, [">= 2.0.3"])
|
51
53
|
s.add_dependency(%q<gemcutter>, [">= 0.4.1"])
|
52
54
|
s.add_dependency(%q<hoe>, [">= 2.5.0"])
|
53
55
|
end
|
54
56
|
else
|
55
57
|
s.add_dependency(%q<nokogiri>, [">= 1.4.0"])
|
56
|
-
s.add_dependency(%q<mail>, [">= 2.
|
57
|
-
s.add_dependency(%q<uuidtools>, [">= 2.1.
|
58
|
+
s.add_dependency(%q<mail>, [">= 2.2.5"])
|
59
|
+
s.add_dependency(%q<uuidtools>, [">= 2.1.1"])
|
60
|
+
s.add_dependency(%q<exifr>, [">= 1.0.1"])
|
58
61
|
s.add_dependency(%q<rubyforge>, [">= 2.0.3"])
|
59
62
|
s.add_dependency(%q<gemcutter>, [">= 0.4.1"])
|
60
63
|
s.add_dependency(%q<hoe>, [">= 2.5.0"])
|
@@ -0,0 +1,119 @@
|
|
1
|
+
---
|
2
|
+
- - Apple
|
3
|
+
- iPhone
|
4
|
+
- - Apple
|
5
|
+
- iPhone 3G
|
6
|
+
- - Apple
|
7
|
+
- iPhone 3GS
|
8
|
+
- - CASIO
|
9
|
+
- G'z One TYPE-S
|
10
|
+
- - CASIO
|
11
|
+
- G'zOne ROCK
|
12
|
+
- - CX87BL05
|
13
|
+
- LG8700
|
14
|
+
- - ES.M800
|
15
|
+
- SPH-M800
|
16
|
+
- - HTC
|
17
|
+
- Eris
|
18
|
+
- - HTC
|
19
|
+
- HERO200
|
20
|
+
- - HTC
|
21
|
+
- HTC_TyTN_II
|
22
|
+
- - HTC
|
23
|
+
- RAPH800
|
24
|
+
- - HTC
|
25
|
+
- T-Mobile G1
|
26
|
+
- - HTC
|
27
|
+
- T-Mobile myTouch 3G
|
28
|
+
- - HTC-ST7377
|
29
|
+
- HTC-ST7377
|
30
|
+
- - ISUS02232009
|
31
|
+
- Seoul Electronics & Telecom SIM120B 1.3M
|
32
|
+
- - ISUS09012008
|
33
|
+
- Seoul Electronics & Telecom SIM120B 1.3M
|
34
|
+
- - LG Electronics
|
35
|
+
- VX-8800
|
36
|
+
- - LG Electronics
|
37
|
+
- VX-9700
|
38
|
+
- - LG Electronics
|
39
|
+
- VX11000
|
40
|
+
- - LG Electronics, Inc.
|
41
|
+
- LG RUMOR2
|
42
|
+
- - LGE
|
43
|
+
- CU920
|
44
|
+
- - M6550B-SAM-4480
|
45
|
+
- SYSTEMLSI S5K4BAFB 2.0 MP
|
46
|
+
- - MSM6100
|
47
|
+
- Omni_vision-9650
|
48
|
+
- - MSM6500
|
49
|
+
- LSI_S5K4AAFA
|
50
|
+
- - Motorola
|
51
|
+
- 1.3 Megapixel
|
52
|
+
- - Motorola
|
53
|
+
- Droid
|
54
|
+
- - Motorola
|
55
|
+
- Motorola Phone
|
56
|
+
- - Motorola C.451.01.04.17.08
|
57
|
+
- 2.0 Megapixel
|
58
|
+
- - PANTECH
|
59
|
+
- C790
|
60
|
+
- - RIM
|
61
|
+
- BlackBerry 8100 Series
|
62
|
+
- - Research In Motion
|
63
|
+
- BlackBerry 8310
|
64
|
+
- - Research In Motion
|
65
|
+
- BlackBerry 8320
|
66
|
+
- - Research In Motion
|
67
|
+
- BlackBerry 8330
|
68
|
+
- - Research In Motion
|
69
|
+
- BlackBerry 8330m
|
70
|
+
- - Research In Motion
|
71
|
+
- BlackBerry 8530
|
72
|
+
- - Research In Motion
|
73
|
+
- BlackBerry 8900
|
74
|
+
- - Research In Motion
|
75
|
+
- BlackBerry 9700
|
76
|
+
- - SAMSUNG
|
77
|
+
- SAMSUNG
|
78
|
+
- - SAMSUNG
|
79
|
+
- SCH-U350
|
80
|
+
- - SAMSUNG
|
81
|
+
- SCH-U450
|
82
|
+
- - SAMSUNG
|
83
|
+
- SCH-U490
|
84
|
+
- - SAMSUNG
|
85
|
+
- SGH-A167
|
86
|
+
- - SAMSUNG
|
87
|
+
- SGH-A437
|
88
|
+
- - SAMSUNG
|
89
|
+
- SGH-E250
|
90
|
+
- - SAMSUNG
|
91
|
+
- SGH-T459
|
92
|
+
- - SAMSUNG
|
93
|
+
- SGH-T729
|
94
|
+
- - SAMSUNG
|
95
|
+
- SPH-M900
|
96
|
+
- - SAMSUNG
|
97
|
+
- Samsung SCH-U750
|
98
|
+
- - SAMSUNG Electronics
|
99
|
+
- SGH-i637
|
100
|
+
- - Samsung Electronics
|
101
|
+
- A727
|
102
|
+
- - Samsung Electronics
|
103
|
+
- A767
|
104
|
+
- - Samsung Electronics
|
105
|
+
- SGH-A737
|
106
|
+
- - Samsung Electronics
|
107
|
+
- SGH-T749
|
108
|
+
- - Samsung Electronics
|
109
|
+
- SGH-T819
|
110
|
+
- - Samsung Electronics
|
111
|
+
- T639
|
112
|
+
- - Sprint
|
113
|
+
- KATANA Eclipse X
|
114
|
+
- - T-Mobile Dash
|
115
|
+
- T-Mobile Dash
|
116
|
+
- - T1A_UC1.88
|
117
|
+
- Micron MT9M113 1.3MP YUV
|
118
|
+
- - google
|
119
|
+
- Nexus One
|
@@ -21,6 +21,7 @@ Mime-Version: 1.0
|
|
21
21
|
Content-Type: multipart/mixed;
|
22
22
|
boundary="----=_Part_3189_7839582.1195059640065"
|
23
23
|
|
24
|
+
|
24
25
|
------=_Part_3189_7839582.1195059640065
|
25
26
|
Content-Type: multipart/alternative;
|
26
27
|
boundary="----=_Part_3191_16589396.1195059640154"
|
@@ -168,7 +169,7 @@ ECkC/IANDMCEog5xBQZAA8yD2gQpICXmLxwiegyI4J6n0qrWOU1XzNJhQPbE8YPkLY8Uc1iwPJiX
|
|
168
169
|
KnTogk/B47AlMLHlPq3DeNdYBwXFI9A6m6dFDGBATTiR6eUYhzky6TQDWOCST5e61BIYNamZIxE6
|
169
170
|
W/okohUipbf76i/K2lSoqrU7b10qjQjEIcAOtrCFzWtcKyMgADs=
|
170
171
|
------=_Part_3189_7839582.1195059640065
|
171
|
-
Content-Type:
|
172
|
+
Content-Type: image/gif; name=Drinks.gif
|
172
173
|
Content-Transfer-Encoding: base64
|
173
174
|
Content-Disposition: attachment; filename=Drinks.gif
|
174
175
|
Content-Description: Drinks.gif
|
data/test/test_helper.rb
CHANGED
@@ -3,11 +3,10 @@ require 'set'
|
|
3
3
|
require 'net/http'
|
4
4
|
require 'net/https'
|
5
5
|
require 'pp'
|
6
|
-
require 'exifr'
|
7
6
|
require 'tempfile'
|
8
7
|
require 'test/unit'
|
9
8
|
require 'mocha'
|
10
|
-
require File.join(File.dirname(__FILE__),
|
9
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'mms2r')
|
11
10
|
|
12
11
|
begin require 'redgreen'; rescue LoadError; end
|
13
12
|
|
@@ -20,30 +19,34 @@ module MMS2R
|
|
20
19
|
assert(File::size(file) == size, "file #{file} is #{File::size(file)} bytes, not #{size} bytes")
|
21
20
|
end
|
22
21
|
|
22
|
+
def fixture(file)
|
23
|
+
File.join(File.expand_path(File.dirname(__FILE__)), "fixtures", file)
|
24
|
+
end
|
25
|
+
|
23
26
|
def mail_fixture(file)
|
24
|
-
|
27
|
+
fixture(file)
|
25
28
|
end
|
26
29
|
|
27
30
|
def mail(name)
|
28
31
|
Mail.read(mail_fixture(name))
|
29
32
|
end
|
30
33
|
|
31
|
-
def smart_phone_mock(model_text = 'iPhone', jpeg = true)
|
32
|
-
mail =
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
def smart_phone_mock(make_text = 'Apple', model_text = 'iPhone', jpeg = true)
|
35
|
+
mail = stub('mail',
|
36
|
+
:from => ['joe@example.com'],
|
37
|
+
:return_path => '<joe@example.com>',
|
38
|
+
:message_id => 'abcd0123',
|
39
|
+
:multipart? => true,
|
40
|
+
:header => {})
|
37
41
|
|
38
|
-
part =
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
part = stub('part',
|
43
|
+
:part_type? => "image/#{jpeg ? 'jpeg' : 'tiff'}",
|
44
|
+
:body => Mail::Body.new('abc'),
|
45
|
+
:multipart? => false,
|
46
|
+
:filename => "foo.#{jpeg ? 'jpg' : 'tif'}" )
|
43
47
|
|
44
|
-
mail.
|
45
|
-
exif =
|
46
|
-
exif.expects(:model).at_least_once.returns(model_text)
|
48
|
+
mail.stubs(:parts).returns([part])
|
49
|
+
exif = stub('exif', :make => make_text, :model => model_text)
|
47
50
|
if jpeg
|
48
51
|
EXIFR::JPEG.expects(:new).at_least_once.returns(exif)
|
49
52
|
else
|
data/test/test_mms2r_media.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "test_helper")
|
1
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
|
2
2
|
|
3
3
|
class TestMms2rMedia < Test::Unit::TestCase
|
4
4
|
include MMS2R::TestHelper
|
@@ -232,24 +232,24 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
232
232
|
assert_equal ['text/plain', ''], mms.transform_text('text/plain', " \n\nimage/jpeg")
|
233
233
|
|
234
234
|
# has a bad regexp
|
235
|
-
mms.expects(:config).
|
235
|
+
mms.expects(:config).at_least_once.returns({'transform' => {type => [['(hello)', 'world']]}})
|
236
236
|
assert_equal result, mms.transform_text(type, text)
|
237
237
|
|
238
238
|
# matches in config
|
239
|
-
mms.expects(:config).
|
239
|
+
mms.expects(:config).at_least_once.returns({'transform' => {type => [["/(hello)/", 'world']]}})
|
240
240
|
assert_equal [type, 'world'], mms.transform_text(type, text)
|
241
241
|
|
242
|
-
mms.expects(:config).
|
242
|
+
mms.expects(:config).at_least_once.returns({'transform' => {type => [['/^Ignore this part, (.+)/', '\1']]}})
|
243
243
|
assert_equal [type, text], mms.transform_text(type, "Ignore this part, " + text)
|
244
244
|
|
245
245
|
# chaining transforms
|
246
|
-
mms.expects(:config).
|
246
|
+
mms.expects(:config).at_least_once.returns({'transform' => {type => [['/(hello)/', 'world'],
|
247
247
|
['/(world)/', 'mars']]}})
|
248
248
|
assert_equal [type, 'mars'], mms.transform_text(type, text)
|
249
249
|
|
250
250
|
# has a Iconv problem
|
251
251
|
Iconv.expects(:new).raises
|
252
|
-
mms.expects(:config).
|
252
|
+
mms.expects(:config).at_least_once.returns({'transform' => {type => [['(hello)', 'world']]}})
|
253
253
|
assert_equal result, mms.transform_text(type, text)
|
254
254
|
end
|
255
255
|
|
@@ -264,7 +264,6 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
264
264
|
assert_not_nil file
|
265
265
|
assert_equal true, File::exist?(file)
|
266
266
|
text = IO.readlines("#{file}").join
|
267
|
-
#assert_match(/D'ici un mois Géorgie/, text)
|
268
267
|
assert_match(/D'ici un mois G\303\251orgie/, text)
|
269
268
|
assert_match(/D'ici un mois Géorgie/, text)
|
270
269
|
assert_equal("sample email message Fwd: sub D'ici un mois G\303\251orgie", mms.subject)
|
@@ -323,12 +322,12 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
323
322
|
assert_nil mms.send(:attachment, ['text'])
|
324
323
|
end
|
325
324
|
|
326
|
-
def test_type_from_filename
|
325
|
+
def test_type_from_filename
|
327
326
|
mms = MMS2R::Media.new stub_mail
|
328
327
|
assert_equal 'image/jpeg', mms.send(:type_from_filename, "example.jpg")
|
329
328
|
end
|
330
329
|
|
331
|
-
def test_type_from_filename_should_be_nil
|
330
|
+
def test_type_from_filename_should_be_nil
|
332
331
|
mms = MMS2R::Media.new stub_mail
|
333
332
|
assert_nil mms.send(:type_from_filename, "example.example")
|
334
333
|
end
|
@@ -766,67 +765,69 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
766
765
|
end
|
767
766
|
|
768
767
|
def test_exif
|
769
|
-
mail = smart_phone_mock
|
768
|
+
mail = smart_phone_mock
|
770
769
|
mms = MMS2R::Media.new(mail)
|
771
770
|
assert_equal 'iPhone', mms.exif.model
|
772
771
|
end
|
773
772
|
|
774
|
-
def test_exif_load_error
|
775
|
-
mms = MMS2R::Media.new stub_mail
|
776
|
-
mms.expects(:require).with('exifr').raises(LoadError)
|
777
|
-
|
778
|
-
assert_equal :unknown, mms.device_type?
|
779
|
-
end
|
780
|
-
|
781
773
|
def test_iphone_device_type_by_exif
|
782
|
-
mail = smart_phone_mock
|
774
|
+
mail = smart_phone_mock
|
783
775
|
mms = MMS2R::Media.new(mail)
|
784
776
|
assert_equal :iphone, mms.device_type?
|
785
777
|
assert_equal true, mms.is_mobile?
|
786
778
|
end
|
787
779
|
|
788
780
|
def test_faux_tiff_iphone_device_type_by_exif
|
789
|
-
mail = smart_phone_mock('iPhone', jpeg = false)
|
781
|
+
mail = smart_phone_mock('Apple', 'iPhone', jpeg = false)
|
790
782
|
mms = MMS2R::Media.new(mail)
|
791
783
|
assert_equal :iphone, mms.device_type?
|
792
784
|
assert_equal true, mms.is_mobile?
|
793
785
|
end
|
794
786
|
|
795
787
|
def test_blackberry_device_type_by_exif
|
796
|
-
mail = smart_phone_mock('BlackBerry')
|
788
|
+
mail = smart_phone_mock('Research In Motion', 'BlackBerry')
|
797
789
|
mms = MMS2R::Media.new(mail)
|
798
790
|
assert_equal :blackberry, mms.device_type?
|
799
791
|
assert_equal true, mms.is_mobile?
|
800
792
|
end
|
801
793
|
|
802
794
|
def test_dash_device_type_by_exif
|
803
|
-
mail = smart_phone_mock('T-Mobile Dash')
|
795
|
+
mail = smart_phone_mock('T-Mobile Dash', 'T-Mobile Dash')
|
804
796
|
mms = MMS2R::Media.new(mail)
|
805
797
|
assert_equal :dash, mms.device_type?
|
806
798
|
assert_equal true, mms.is_mobile?
|
807
799
|
end
|
808
800
|
|
809
801
|
def test_droid_device_type_by_exif
|
810
|
-
mail = smart_phone_mock('Droid')
|
802
|
+
mail = smart_phone_mock('Motorola', 'Droid')
|
811
803
|
mms = MMS2R::Media.new(mail)
|
812
804
|
assert_equal :droid, mms.device_type?
|
813
805
|
assert_equal true, mms.is_mobile?
|
814
806
|
end
|
815
807
|
|
816
808
|
def test_htc_eris_device_type_by_exif
|
817
|
-
mail = smart_phone_mock('Eris')
|
809
|
+
mail = smart_phone_mock('HTC', 'Eris')
|
818
810
|
mms = MMS2R::Media.new(mail)
|
819
811
|
assert_equal :htc, mms.device_type?
|
820
812
|
assert_equal true, mms.is_mobile?
|
821
813
|
end
|
822
814
|
|
823
815
|
def test_htc_hero_device_type_by_exif
|
824
|
-
mail = smart_phone_mock('HERO200')
|
816
|
+
mail = smart_phone_mock('HTC', 'HERO200')
|
825
817
|
mms = MMS2R::Media.new(mail)
|
826
818
|
assert_equal :htc, mms.device_type?
|
827
819
|
assert_equal true, mms.is_mobile?
|
828
820
|
end
|
829
821
|
|
822
|
+
def test_handsets_by_exif
|
823
|
+
handsets = YAML.load_file(fixture('handsets.yml'))
|
824
|
+
handsets.each do |handset|
|
825
|
+
mail = smart_phone_mock(handset.first, handset.last)
|
826
|
+
mms = MMS2R::Media.new(mail)
|
827
|
+
assert_equal true, mms.is_mobile?, "mms with make #{mms.exif.make}, and model #{mms.exif.model}, should be considered a mobile device"
|
828
|
+
end
|
829
|
+
end
|
830
|
+
|
830
831
|
def test_blackberry_device_type
|
831
832
|
berries = ['att-blackberry.mail',
|
832
833
|
'suncom-blackberry.mail',
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 3
|
7
|
-
- 0
|
8
7
|
- 1
|
9
|
-
|
8
|
+
- 0
|
9
|
+
version: 3.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mike Mondragon
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-07-09 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -40,9 +40,9 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
segments:
|
42
42
|
- 2
|
43
|
-
-
|
44
|
-
-
|
45
|
-
version: 2.
|
43
|
+
- 2
|
44
|
+
- 5
|
45
|
+
version: 2.2.5
|
46
46
|
type: :runtime
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
@@ -55,14 +55,28 @@ dependencies:
|
|
55
55
|
segments:
|
56
56
|
- 2
|
57
57
|
- 1
|
58
|
-
-
|
59
|
-
version: 2.1.
|
58
|
+
- 1
|
59
|
+
version: 2.1.1
|
60
60
|
type: :runtime
|
61
61
|
version_requirements: *id003
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: exifr
|
64
64
|
prerelease: false
|
65
65
|
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 1
|
71
|
+
- 0
|
72
|
+
- 1
|
73
|
+
version: 1.0.1
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: rubyforge
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
81
|
- - ">="
|
68
82
|
- !ruby/object:Gem::Version
|
@@ -72,11 +86,11 @@ dependencies:
|
|
72
86
|
- 3
|
73
87
|
version: 2.0.3
|
74
88
|
type: :development
|
75
|
-
version_requirements: *
|
89
|
+
version_requirements: *id005
|
76
90
|
- !ruby/object:Gem::Dependency
|
77
91
|
name: gemcutter
|
78
92
|
prerelease: false
|
79
|
-
requirement: &
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
80
94
|
requirements:
|
81
95
|
- - ">="
|
82
96
|
- !ruby/object:Gem::Version
|
@@ -86,11 +100,11 @@ dependencies:
|
|
86
100
|
- 1
|
87
101
|
version: 0.4.1
|
88
102
|
type: :development
|
89
|
-
version_requirements: *
|
103
|
+
version_requirements: *id006
|
90
104
|
- !ruby/object:Gem::Dependency
|
91
105
|
name: hoe
|
92
106
|
prerelease: false
|
93
|
-
requirement: &
|
107
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
94
108
|
requirements:
|
95
109
|
- - ">="
|
96
110
|
- !ruby/object:Gem::Version
|
@@ -100,7 +114,7 @@ dependencies:
|
|
100
114
|
- 0
|
101
115
|
version: 2.5.0
|
102
116
|
type: :development
|
103
|
-
version_requirements: *
|
117
|
+
version_requirements: *id007
|
104
118
|
description: |-
|
105
119
|
== DESCRIPTION
|
106
120
|
|
@@ -200,6 +214,7 @@ files:
|
|
200
214
|
- test/fixtures/dobson-image-01.mail
|
201
215
|
- test/fixtures/dot.jpg
|
202
216
|
- test/fixtures/generic.mail
|
217
|
+
- test/fixtures/handsets.yml
|
203
218
|
- test/fixtures/helio-image-01.mail
|
204
219
|
- test/fixtures/helio-message-01.mail
|
205
220
|
- test/fixtures/iconv-fr-text-01.mail
|