mms2r 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/History.txt +12 -1
- data/Manifest.txt +1 -1
- data/README.txt +18 -11
- data/Rakefile +6 -5
- data/conf/mms2r_media.yml +16 -0
- data/conf/vzwpix.com.yml +2 -2
- data/dev_tools/{debug_sprint_hpricot_parsing.rb → debug_sprint_nokogiri_parsing.rb} +24 -19
- data/lib/mms2r/media/sprint.rb +4 -2
- data/lib/mms2r/media.rb +14 -22
- data/lib/mms2r.rb +2 -1
- data/mms2r.gemspec +17 -17
- data/test/test_helper.rb +29 -2
- data/test/test_mms2r_media.rb +66 -2
- data/test/test_pm_sprint_com.rb +5 -5
- metadata +20 -46
data/.gitignore
CHANGED
data/History.txt
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
### 2.
|
1
|
+
### 2.4.0 / 2009-12-20 (Dr. Nanemiltred Philtendrieden - specialist on celebrity death)
|
2
|
+
|
3
|
+
* 1 new feature
|
4
|
+
* replace Hpricot with Nokogiri for html parsing of Sprint data
|
5
|
+
|
6
|
+
* 3 minor enhancements
|
7
|
+
* smartphone identities stored :
|
8
|
+
* identify Motorola Droid as a smartphone
|
9
|
+
* identify T-Mobile Dash as a smartphone
|
10
|
+
* use uuidtools for naming temp directories - kbaum
|
11
|
+
|
12
|
+
### 2.3.0 / 2009-08-30 (Snakes 'n' Barrels Greatest Hits)
|
2
13
|
* 5 new features
|
3
14
|
* detect smartphone status/type based on model metadata from jpeg and tiff
|
4
15
|
exif data using exifr gem, access exif data with MMS2R::Media#exif
|
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
http://mms2r.rubyforge.org/
|
4
4
|
by Mike Mondragon
|
5
5
|
http://rubyforge.org/tracker/?group_id=3065
|
6
|
-
http://github.com/monde/mms2r
|
6
|
+
http://github.com/monde/mms2r
|
7
7
|
http://peepcode.com/products/mms2r-pdf
|
8
8
|
|
9
9
|
== DESCRIPTION
|
@@ -17,6 +17,9 @@ having to deal with the cruft from the carriers.
|
|
17
17
|
If MMS2R is not aware of a particular carrier no extra processing is done to the
|
18
18
|
MMS other than decoding and consolidating its media.
|
19
19
|
|
20
|
+
MMS2R can be used to process any multipart email to conveniently access the
|
21
|
+
parts the mail is comprised of.
|
22
|
+
|
20
23
|
Contact the author to add additional carriers to be processed by the library.
|
21
24
|
Suggestions and patches appreciated and welcomed!
|
22
25
|
|
@@ -64,6 +67,10 @@ Corpus of carriers currently processed by MMS2R:
|
|
64
67
|
* #process supports blocks to for enumerating over the content of the MMS
|
65
68
|
* #process can be made lazy when :process => :lazy is passed to new
|
66
69
|
* logging is enabled when :logger => your_logger is passed to new
|
70
|
+
* an mms instance acts like a tmail object, any methods not defined on the
|
71
|
+
instance are delegated to its underlying tmail object
|
72
|
+
* #device_type? returns a symbol representing a device or smartphone type
|
73
|
+
Known smartphones thus far: iPhone, BlackBerry, T-Mobile Dash, Droid
|
67
74
|
|
68
75
|
== BOOKS
|
69
76
|
|
@@ -117,9 +124,11 @@ http://peepcode.com/products/mms2r-pdf
|
|
117
124
|
# check if the mail is from a mobile phone
|
118
125
|
puts "mail is from a mobile phone #{mail.is_mobile?}"
|
119
126
|
|
127
|
+
# determine the device type of the phone
|
128
|
+
puts "mail is from a mobile phone of type #{mail.device_type?}"
|
129
|
+
|
120
130
|
# inspect default media's exif data if exifr gem is installed and default
|
121
131
|
# media is a jpeg or tiff
|
122
|
-
puts "mail is from a mobile phone #{mail.is_mobile?}"
|
123
132
|
puts "mail's default media's exif data is:"
|
124
133
|
puts mms.exif.inspect
|
125
134
|
|
@@ -140,8 +149,9 @@ http://peepcode.com/products/mms2r-pdf
|
|
140
149
|
|
141
150
|
== REQUIREMENTS
|
142
151
|
|
143
|
-
* Hpricot
|
144
152
|
* TMail
|
153
|
+
* Nokogiri (for mms from Sprint)
|
154
|
+
* UUIDTools
|
145
155
|
|
146
156
|
== OPTIONAL
|
147
157
|
|
@@ -150,17 +160,11 @@ http://peepcode.com/products/mms2r-pdf
|
|
150
160
|
|
151
161
|
== INSTALL
|
152
162
|
|
153
|
-
conventional
|
154
163
|
* sudo gem install mms2r
|
155
164
|
|
156
|
-
github
|
157
|
-
* sudo gem sources -a http://gems.github.com
|
158
|
-
* sudo gem install monde-mms2r
|
159
|
-
|
160
165
|
== SOURCE
|
161
166
|
|
162
167
|
git clone git://github.com/monde/mms2r.git
|
163
|
-
svn co svn://rubyforge.org/var/svn/mms2r/trunk mms2r
|
164
168
|
|
165
169
|
== AUTHORS
|
166
170
|
|
@@ -177,14 +181,17 @@ MMS2R's Flickr page[http://www.flickr.com/photos/8627919@N05/]
|
|
177
181
|
* Jason Haruska (blog[http://software.haruska.com/])
|
178
182
|
* Dave Myron (company[http://contentfree.com/])
|
179
183
|
* Vijay Yellapragada
|
180
|
-
* Jesse Dp
|
184
|
+
* Jesse Dp (github profile[http://github.com/jessedp])
|
181
185
|
* David Alm
|
182
186
|
* Jeremy Wilkins
|
183
|
-
* Matt Conway
|
187
|
+
* Matt Conway (github profile[http://github.com/wr0ngway])
|
184
188
|
* Kai Kai
|
185
189
|
* Michael DelGaudio
|
186
190
|
* Sai Emrys (blog[http://saizai.com])
|
187
191
|
* Brendan Lim (github profile[http://github.com/brendanlim])
|
192
|
+
* Scott Taylor (github profile[http://github.com/smtlaissezfaire])
|
193
|
+
* Jaap van der Meer (github profile[http://github.com/japetheape])
|
194
|
+
* Karl Baum (github profile[http://github.com/kbaum])
|
188
195
|
|
189
196
|
== LICENSE
|
190
197
|
|
data/Rakefile
CHANGED
@@ -13,14 +13,15 @@ require 'mms2r'
|
|
13
13
|
|
14
14
|
Hoe.new('mms2r', MMS2R::Media::VERSION) do |p|
|
15
15
|
p.rubyforge_name = 'mms2r'
|
16
|
-
p.author = 'Mike Mondragon'
|
17
|
-
p.email = 'mikemondragon@gmail.com'
|
16
|
+
p.author = ['Mike Mondragon']
|
17
|
+
p.email = ['mikemondragon@gmail.com']
|
18
18
|
p.summary = 'Extract user media from MMS (and not carrier cruft)'
|
19
|
-
p.description = p.paragraphs_of('README.txt', 2..
|
19
|
+
p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
|
20
20
|
p.url = p.paragraphs_of('README.txt', 1).first.strip
|
21
|
-
p.changes = p.paragraphs_of('History.txt', 0..
|
22
|
-
p.extra_deps << ['
|
21
|
+
p.changes = p.paragraphs_of('History.txt', 0..2).join("\n\n")
|
22
|
+
p.extra_deps << ['nokogiri']
|
23
23
|
p.extra_deps << ['tmail']
|
24
|
+
p.extra_deps << ['uuidtools']
|
24
25
|
p.clean_globs << 'coverage'
|
25
26
|
end
|
26
27
|
|
data/conf/mms2r_media.yml
CHANGED
@@ -29,3 +29,19 @@ device_types:
|
|
29
29
|
:iphone: !ruby/regexp /iPhone Mail/i
|
30
30
|
x-rim-org-msg-ref-id:
|
31
31
|
:blackberry: !ruby/regexp /.+/
|
32
|
+
# TODO do something about the assortment of camera models that have
|
33
|
+
# been seen:
|
34
|
+
# 1.3 Megapixel, 2.0 Megapixel, BlackBerry, CU920, G'z One TYPE-S,
|
35
|
+
# Hermes, iPhone, LG8700, LSI_S5K4AAFA, Micron MT9M113 1.3MP YUV,
|
36
|
+
# Motorola Phone, Omni_vision-9650, Pre,
|
37
|
+
# Seoul Electronics & Telecom SIM120B 1.3M, SGH-T729, SGH-T819,
|
38
|
+
# SPH-M540, SPH-M800, SYSTEMLSI S5K4BAFB 2.0 MP, VX-9700
|
39
|
+
#
|
40
|
+
# NOTE: These model strings are stored in the exif model header of an image file
|
41
|
+
# created and sent by the device, the regex is used by mms2r to detect the
|
42
|
+
# model string
|
43
|
+
models:
|
44
|
+
:iphone: !ruby/regexp /iPhone/i
|
45
|
+
:blackberry: !ruby/regexp /BlackBerry/i
|
46
|
+
:dash: !ruby/regexp /T-Mobile Dash/i
|
47
|
+
:droid: !ruby/regexp /Droid/i
|
data/conf/vzwpix.com.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
---
|
2
2
|
ignore:
|
3
3
|
text/plain:
|
4
|
-
- /\AThis message was sent using .* from Verizon Wireless!.*/m
|
4
|
+
- /\AThis message (was|has been) sent using .* from Verizon Wireless!.*/m
|
5
5
|
transform:
|
6
6
|
text/plain:
|
7
|
-
- - /\A(.+?)\s+This message was sent using .* from Verizon Wireless!.*/m
|
7
|
+
- - /\A(.+?)\s+This message (was|has been) sent using .* from Verizon Wireless!.*/m
|
8
8
|
- "\1"
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'nokogiri'
|
3
3
|
require 'net/http'
|
4
|
+
require 'cgi'
|
4
5
|
require 'rubygems'
|
5
|
-
require 'hpricot'
|
6
6
|
require 'pp'
|
7
7
|
|
8
8
|
if ARGV[0].nil?
|
@@ -11,12 +11,12 @@ if ARGV[0].nil?
|
|
11
11
|
exit
|
12
12
|
end
|
13
13
|
|
14
|
-
doc = open(ARGV[0]) { |f|
|
14
|
+
doc = open(ARGV[0]) { |f| Nokogiri(f) }
|
15
15
|
|
16
16
|
puts "TITLE: #{doc.at('title').inner_html}"
|
17
17
|
|
18
18
|
#phone number is tucked away in the comment in the head
|
19
|
-
c = doc.search("/html/head/comment
|
19
|
+
c = doc.search("/html/head/comment()").last
|
20
20
|
t = c.content.gsub(/\s+/m," ").strip
|
21
21
|
number = / name="MDN">(\d+)</.match(t)[1]
|
22
22
|
puts "NUMBER: #{number}"
|
@@ -26,16 +26,14 @@ puts "NUMBER: #{number}"
|
|
26
26
|
text = doc.search("/html/body//pre").first.inner_html
|
27
27
|
puts "TEXT: #{text}"
|
28
28
|
|
29
|
-
# just see what they say this MMS is it really doesn't
|
30
|
-
#
|
31
|
-
|
32
|
-
trs = doc.search("/html/body//tr")
|
33
|
-
text = trs[3].search("/td/p/font/b/")
|
29
|
+
# just see what they say this MMS is it really doesn't mean anything, the
|
30
|
+
# content is in faux image with a RECIPIENT in its URI path
|
31
|
+
text = doc.search("/html/body//tr[2]/td//b")
|
34
32
|
case text.text
|
35
33
|
when /You have a Video Mail from/
|
36
|
-
puts "it claims to be a video"
|
34
|
+
puts "it claims to be a video: #{text}"
|
37
35
|
when /You have a Picture Mail from /
|
38
|
-
puts "it claims to be an image"
|
36
|
+
puts "it claims to be an image: #{text}"
|
39
37
|
else
|
40
38
|
puts "what is it? #{text.text}"
|
41
39
|
end
|
@@ -59,15 +57,22 @@ puts "there are #{srcs.size} sources to fetch"
|
|
59
57
|
cnt = 0
|
60
58
|
srcs.each do |src|
|
61
59
|
puts "--"
|
62
|
-
puts "FETCHING:\n #{src}"
|
60
|
+
puts "FETCHING:\n #{src.text}"
|
63
61
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
62
|
+
url = URI.parse(CGI.unescapeHTML(src.text))
|
63
|
+
query={}
|
64
|
+
url.query.split('&').each{|a| p=a.split('='); query[p[0]] = p[1]}
|
65
|
+
query.delete_if{|k, v| k == 'limitsize' or k == 'squareoutput' }
|
66
|
+
url.query = query.map{|k,v| "#{k}=#{v}"}.join("&")
|
67
|
+
# sprint is a ghetto, they expect to see & for video request
|
68
|
+
url.query = url.query.gsub(/&/, "&") if @is_video
|
69
|
+
|
70
|
+
#res = Net::HTTP.get_response(url)
|
71
|
+
agent = "Mozilla/5.0 (X11; U; Minix3 i686 (x86_64); en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1"
|
72
|
+
res = Net::HTTP.start(url.host, url.port) { |http|
|
73
|
+
req = Net::HTTP::Get.new(url.request_uri, {'User-Agent' => agent})
|
74
|
+
http.request(req)
|
75
|
+
}
|
71
76
|
|
72
77
|
# prep and write a file
|
73
78
|
base = /\/RECIPIENT\/([^\/]+)\//.match(src)[1]
|
data/lib/mms2r/media/sprint.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
require 'net/http'
|
8
8
|
require 'rubygems'
|
9
|
-
require '
|
9
|
+
require 'nokogiri'
|
10
10
|
require 'cgi'
|
11
11
|
|
12
12
|
module MMS2R
|
@@ -46,7 +46,7 @@ module MMS2R
|
|
46
46
|
doc = nil
|
47
47
|
parts.each do |p|
|
48
48
|
next unless p.part_type? == 'text/html'
|
49
|
-
d =
|
49
|
+
d = Nokogiri(p.body)
|
50
50
|
title = d.at('title').inner_html
|
51
51
|
if title =~ /You have new Picture Mail!/
|
52
52
|
doc = d
|
@@ -115,6 +115,8 @@ module MMS2R
|
|
115
115
|
imgs = doc.search("/html/body//img")
|
116
116
|
imgs.each do |i|
|
117
117
|
src = i.attributes['src']
|
118
|
+
next unless src
|
119
|
+
src = src.text
|
118
120
|
# we don't want to double fetch content and we only
|
119
121
|
# want to fetch media from the content server, you get
|
120
122
|
# a clue about that as there is a RECIPIENT in the URI path
|
data/lib/mms2r/media.rb
CHANGED
@@ -218,7 +218,7 @@ module MMS2R
|
|
218
218
|
@carrier = opts[:domain]
|
219
219
|
@dir_count = 0
|
220
220
|
@media_dir = File.join(self.tmp_dir(),
|
221
|
-
self.safe_message_id(@mail.message_id))
|
221
|
+
"#{self.safe_message_id(@mail.message_id)}_#{UUIDTools::UUID.random_create}")
|
222
222
|
@media = {}
|
223
223
|
@was_processed = false
|
224
224
|
@number = nil
|
@@ -534,11 +534,16 @@ module MMS2R
|
|
534
534
|
end
|
535
535
|
|
536
536
|
##
|
537
|
-
# Best guess of the mobile device type. Simple heuristics thus far
|
538
|
-
#
|
539
|
-
#
|
537
|
+
# Best guess of the mobile device type. Simple heuristics thus far by
|
538
|
+
# inspecting mail headers and jpeg/tiff exif metadata.
|
539
|
+
# Smart phone types are
|
540
|
+
# :iphone :blackberry :dash :droid
|
541
|
+
# If the message is from a carrier known to MMS2R, and not a smart phone
|
542
|
+
# its type is returned as :handset
|
543
|
+
# Otherwise device type is :unknown
|
540
544
|
|
541
545
|
def device_type?
|
546
|
+
|
542
547
|
begin
|
543
548
|
# rely on native exif first with exifr gem if its loaded
|
544
549
|
require 'exifr'
|
@@ -546,28 +551,15 @@ module MMS2R
|
|
546
551
|
if file
|
547
552
|
original = file.original_filename
|
548
553
|
@exif = case original
|
549
|
-
when /\.
|
550
|
-
EXIFR::JPEG.new(file)
|
551
|
-
when /\.jepg$/i
|
554
|
+
when /\.je?pg$/i
|
552
555
|
EXIFR::JPEG.new(file)
|
553
|
-
when /\.
|
554
|
-
EXIFR::TIFF.new(file)
|
555
|
-
when /\.tiff$/i
|
556
|
+
when /\.tiff?$/i
|
556
557
|
EXIFR::TIFF.new(file)
|
557
558
|
end
|
558
559
|
if @exif
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
# Hermes, iPhone, LG8700, LSI_S5K4AAFA, Micron MT9M113 1.3MP YUV,
|
563
|
-
# Motorola Phone, Omni_vision-9650, Pre,
|
564
|
-
# Seoul Electronics & Telecom SIM120B 1.3M, SGH-T729, SGH-T819,
|
565
|
-
# SPH-M540, SPH-M800, SYSTEMLSI S5K4BAFB 2.0 MP, VX-9700
|
566
|
-
case @exif.model
|
567
|
-
when/iPhone/i
|
568
|
-
return :iphone
|
569
|
-
when/BlackBerry/i
|
570
|
-
return :blackberry
|
560
|
+
models = config['device_types']['models'] rescue {}
|
561
|
+
models.each do |model, regex|
|
562
|
+
return model if @exif.model =~ regex
|
571
563
|
end
|
572
564
|
end
|
573
565
|
end
|
data/lib/mms2r.rb
CHANGED
@@ -39,7 +39,7 @@ module MMS2R
|
|
39
39
|
##
|
40
40
|
# MMS2R library version
|
41
41
|
|
42
|
-
VERSION = '2.
|
42
|
+
VERSION = '2.4.0'
|
43
43
|
|
44
44
|
end
|
45
45
|
|
@@ -59,6 +59,7 @@ require 'fileutils'
|
|
59
59
|
require 'pathname'
|
60
60
|
require 'tmpdir'
|
61
61
|
require 'yaml'
|
62
|
+
require 'uuidtools'
|
62
63
|
|
63
64
|
require File.join(File.dirname(__FILE__), 'tmail_ext')
|
64
65
|
require File.join(File.dirname(__FILE__), 'mms2r', 'media')
|
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 = "2.
|
5
|
+
s.version = "2.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 = %q{2009-
|
9
|
+
s.date = %q{2009-12-20}
|
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
|
@@ -18,20 +18,17 @@ having to deal with the cruft from the carriers.
|
|
18
18
|
If MMS2R is not aware of a particular carrier no extra processing is done to the
|
19
19
|
MMS other than decoding and consolidating its media.
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
s.
|
26
|
-
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
27
|
-
s.files = [".gitignore", "History.txt", "Manifest.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.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_hpricot_parsing.rb", "dev_tools/github.rb", "init.rb", "lib/mms2r.rb", "lib/mms2r/media.rb", "lib/mms2r/media/sprint.rb", "lib/tmail_ext.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/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_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"]
|
28
|
-
s.has_rdoc = true
|
21
|
+
MMS2R can be used to process any multipart email to conveniently access the
|
22
|
+
parts the mail is comprised of.}
|
23
|
+
s.email = ["mikemondragon@gmail.com"]
|
24
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt", "email.txt"]
|
25
|
+
s.files = [".gitignore", "History.txt", "Manifest.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.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", "email.txt", "init.rb", "lib/mms2r.rb", "lib/mms2r/media.rb", "lib/mms2r/media/sprint.rb", "lib/tmail_ext.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/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_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"]
|
29
26
|
s.homepage = %q{http://mms2r.rubyforge.org/
|
30
27
|
}
|
31
28
|
s.rdoc_options = ["--main", "README.txt"]
|
32
29
|
s.require_paths = ["lib"]
|
33
30
|
s.rubyforge_project = %q{mms2r}
|
34
|
-
s.rubygems_version = %q{1.3.
|
31
|
+
s.rubygems_version = %q{1.3.5}
|
35
32
|
s.summary = %q{Extract user media from MMS (and not carrier cruft)}
|
36
33
|
s.test_files = ["test/test_mms_o2online_de.rb", "test/test_helper.rb", "test/test_pm_sprint_com.rb", "test/test_sms_sasktel_com.rb", "test/test_mms_mobileiam_ma.rb", "test/test_msg_telus_com.rb", "test/test_messaging_sprintpcs_com.rb", "test/test_mms_myhelio_com.rb", "test/test_mms_3ireland_ie.rb", "test/test_mms_ae.rb", "test/test_mms_att_net.rb", "test/test_mediamessaging_o2_co_uk.rb", "test/test_bell_canada.rb", "test/test_mms_mtn_co_za.rb", "test/test_vmpix_com.rb", "test/test_github.rb", "test/test_vzwpix_com.rb", "test/test_bellsouth_net.rb", "test/test_unicel_com.rb", "test/test_waw_plspictures_com.rb", "test/test_mms_luxgsm_lu.rb", "test/test_mms_netcom_no.rb", "test/test_mms_mycricket_com.rb", "test/test_mms2r_media.rb", "test/test_rci_rogers_com.rb", "test/test_messaging_nextel_com.rb", "test/test_mms_vodacom4me_co_za.rb", "test/test_tmomail_net.rb", "test/test_1nbox_net.rb", "test/test_pxt_vodafone_net_nz.rb", "test/test_mobile_indosat_net_id.rb", "test/test_mms_three_co_uk.rb", "test/test_mms_alltel_com.rb", "test/test_mms_dobson_net.rb", "test/test_orangemms_net.rb"]
|
37
34
|
|
@@ -40,17 +37,20 @@ Corpus of carriers currently processed by MMS2R:}
|
|
40
37
|
s.specification_version = 3
|
41
38
|
|
42
39
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
43
|
-
s.add_runtime_dependency(%q<
|
40
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
44
41
|
s.add_runtime_dependency(%q<tmail>, [">= 0"])
|
45
|
-
s.
|
42
|
+
s.add_runtime_dependency(%q<uuidtools>, [">= 0"])
|
43
|
+
s.add_development_dependency(%q<hoe>, [">= 2.4.0"])
|
46
44
|
else
|
47
|
-
s.add_dependency(%q<
|
45
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
48
46
|
s.add_dependency(%q<tmail>, [">= 0"])
|
49
|
-
s.add_dependency(%q<
|
47
|
+
s.add_dependency(%q<uuidtools>, [">= 0"])
|
48
|
+
s.add_dependency(%q<hoe>, [">= 2.4.0"])
|
50
49
|
end
|
51
50
|
else
|
52
|
-
s.add_dependency(%q<
|
51
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
53
52
|
s.add_dependency(%q<tmail>, [">= 0"])
|
54
|
-
s.add_dependency(%q<
|
53
|
+
s.add_dependency(%q<uuidtools>, [">= 0"])
|
54
|
+
s.add_dependency(%q<hoe>, [">= 2.4.0"])
|
55
55
|
end
|
56
56
|
end
|
data/test/test_helper.rb
CHANGED
@@ -2,16 +2,18 @@ require 'set'
|
|
2
2
|
require 'net/http'
|
3
3
|
require 'net/https'
|
4
4
|
require 'pp'
|
5
|
+
require 'exifr'
|
6
|
+
begin require 'redgreen'; rescue LoadError; end
|
5
7
|
|
6
8
|
module MMS2R
|
7
9
|
module TestHelper
|
8
|
-
|
10
|
+
|
9
11
|
def assert_file_size(file, size)
|
10
12
|
assert_not_nil(file, "file was nil")
|
11
13
|
assert(File::exist?(file), "file #{file} does not exist")
|
12
14
|
assert(File::size(file) == size, "file #{file} is #{File::size(file)} bytes, not #{size} bytes")
|
13
15
|
end
|
14
|
-
|
16
|
+
|
15
17
|
def load_mail(file)
|
16
18
|
IO.readlines(mail_fixture(file))
|
17
19
|
end
|
@@ -19,6 +21,31 @@ module MMS2R
|
|
19
21
|
def mail_fixture(file)
|
20
22
|
"#{File.dirname(__FILE__)}/fixtures/#{file}"
|
21
23
|
end
|
24
|
+
|
25
|
+
def smart_phone_mock(model_text = 'iPhone', jpeg = true)
|
26
|
+
mail = mock('mail')
|
27
|
+
mail.expects(:header).at_least_once.returns({'return-path' => '<joe@null.example.com>'})
|
28
|
+
mail.expects(:from).at_least_once.returns(['joe@example.com'])
|
29
|
+
mail.expects(:message_id).returns('abcd0123')
|
30
|
+
mail.expects(:multipart?).returns(true)
|
31
|
+
part = mock('part')
|
32
|
+
part.expects(:part_type?).at_least_once.returns("image/#{jpeg ? 'jpeg' : 'tiff'}")
|
33
|
+
part.expects(:sub_header).with('content-type', 'name').returns(nil)
|
34
|
+
part.expects(:sub_header).with('content-disposition', 'filename').returns(nil)
|
35
|
+
part.expects("[]".to_sym).with('content-location').at_least_once.returns("Photo_12.#{jpeg ? 'jpg' : 'tif'}")
|
36
|
+
part.expects(:main_type).with('text').returns(nil)
|
37
|
+
part.expects(:content_type).at_least_once.returns("image/#{jpeg ? 'jpeg' : 'tiff'}")
|
38
|
+
part.expects(:body).at_least_once.returns('abc')
|
39
|
+
mail.expects(:parts).returns([part])
|
40
|
+
exif = mock('exif')
|
41
|
+
exif.expects(:model).at_least_once.returns(model_text)
|
42
|
+
if jpeg
|
43
|
+
EXIFR::JPEG.expects(:new).at_least_once.returns(exif)
|
44
|
+
else
|
45
|
+
EXIFR::TIFF.expects(:new).at_least_once.returns(exif)
|
46
|
+
end
|
47
|
+
mail
|
48
|
+
end
|
22
49
|
end
|
23
50
|
end
|
24
51
|
|
data/test/test_mms2r_media.rb
CHANGED
@@ -51,6 +51,11 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
51
51
|
stub('mail', attrs)
|
52
52
|
end
|
53
53
|
|
54
|
+
def test_class_parse
|
55
|
+
mms = MMS2R.parse(load_mail('generic.mail').join)
|
56
|
+
assert_equal ['noreply@rubyforge.org'], mms.from
|
57
|
+
end
|
58
|
+
|
54
59
|
def temp_text_file(text)
|
55
60
|
tf = Tempfile.new("test" + Time.now.to_f.to_s)
|
56
61
|
tf.puts(text)
|
@@ -94,7 +99,18 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
94
99
|
|
95
100
|
def test_base_initialize_config
|
96
101
|
config = MMS2R::Media.initialize_config(nil)
|
97
|
-
|
102
|
+
|
103
|
+
# test defaults shipped in mms2r_media.yml
|
104
|
+
assert_not_nil config
|
105
|
+
assert_equal true, config['ignore'].is_a?(Hash)
|
106
|
+
assert_equal true, config['transform'].is_a?(Hash)
|
107
|
+
assert_equal true, config['number'].is_a?(Array)
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_instance_initialize_config
|
111
|
+
mms = MMS2R::Media.new(stub_mail())
|
112
|
+
config = mms.initialize_config(nil)
|
113
|
+
|
98
114
|
# test defaults shipped in mms2r_media.yml
|
99
115
|
assert_not_nil config
|
100
116
|
assert_equal true, config['ignore'].is_a?(Hash)
|
@@ -727,7 +743,7 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
727
743
|
assert_equal false, mms.is_mobile?
|
728
744
|
end
|
729
745
|
|
730
|
-
def
|
746
|
+
def test_iphone_device_type_by_header
|
731
747
|
iphones = ['att-iphone-01.mail',
|
732
748
|
'iphone-image-01.mail']
|
733
749
|
iphones.each do |iphone|
|
@@ -738,6 +754,54 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
738
754
|
end
|
739
755
|
end
|
740
756
|
|
757
|
+
def test_exif
|
758
|
+
mail = smart_phone_mock('iPhone')
|
759
|
+
mms = MMS2R::Media.new(mail)
|
760
|
+
assert_equal 'iPhone', mms.exif.model
|
761
|
+
end
|
762
|
+
|
763
|
+
def test_exif_load_error
|
764
|
+
mms = MMS2R::Media.new(stub_mail())
|
765
|
+
mms.expects(:require).with('exifr').raises(LoadError)
|
766
|
+
|
767
|
+
assert_equal :unknown, mms.device_type?
|
768
|
+
end
|
769
|
+
|
770
|
+
def test_iphone_device_type_by_exif
|
771
|
+
mail = smart_phone_mock('iPhone')
|
772
|
+
mms = MMS2R::Media.new(mail)
|
773
|
+
assert_equal :iphone, mms.device_type?
|
774
|
+
assert_equal true, mms.is_mobile?
|
775
|
+
end
|
776
|
+
|
777
|
+
def test_faux_tiff_iphone_device_type_by_exif
|
778
|
+
mail = smart_phone_mock('iPhone', jpeg = false)
|
779
|
+
mms = MMS2R::Media.new(mail)
|
780
|
+
assert_equal :iphone, mms.device_type?
|
781
|
+
assert_equal true, mms.is_mobile?
|
782
|
+
end
|
783
|
+
|
784
|
+
def test_blackberry_device_type_by_exif
|
785
|
+
mail = smart_phone_mock('BlackBerry')
|
786
|
+
mms = MMS2R::Media.new(mail)
|
787
|
+
assert_equal :blackberry, mms.device_type?
|
788
|
+
assert_equal true, mms.is_mobile?
|
789
|
+
end
|
790
|
+
|
791
|
+
def test_dash_device_type_by_exif
|
792
|
+
mail = smart_phone_mock('T-Mobile Dash')
|
793
|
+
mms = MMS2R::Media.new(mail)
|
794
|
+
assert_equal :dash, mms.device_type?
|
795
|
+
assert_equal true, mms.is_mobile?
|
796
|
+
end
|
797
|
+
|
798
|
+
def test_droid_device_type_by_exif
|
799
|
+
mail = smart_phone_mock('Droid')
|
800
|
+
mms = MMS2R::Media.new(mail)
|
801
|
+
assert_equal :droid, mms.device_type?
|
802
|
+
assert_equal true, mms.is_mobile?
|
803
|
+
end
|
804
|
+
|
741
805
|
def test_blackberry_device_type
|
742
806
|
berries = ['att-blackberry.mail',
|
743
807
|
'suncom-blackberry.mail',
|
data/test/test_pm_sprint_com.rb
CHANGED
@@ -16,7 +16,7 @@ class TestPmSprintCom < Test::Unit::TestCase
|
|
16
16
|
res.expects(:content_type).at_least_once.returns('image/jpeg')
|
17
17
|
res.expects(:body).once.returns(body)
|
18
18
|
res.expects(:code).never
|
19
|
-
Net::HTTP.expects(:get_response).once.
|
19
|
+
Net::HTTP.expects(:get_response).once.returns res
|
20
20
|
end
|
21
21
|
|
22
22
|
def mock_sprint_purged_image(message_id)
|
@@ -26,7 +26,7 @@ class TestPmSprintCom < Test::Unit::TestCase
|
|
26
26
|
res.expects(:content_type).once.returns('text/html')
|
27
27
|
res.expects(:code).once.returns('500')
|
28
28
|
res.expects(:body).never
|
29
|
-
Net::HTTP.expects(:get_response).once.
|
29
|
+
Net::HTTP.expects(:get_response).once.returns res
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_mms_should_have_text
|
@@ -60,7 +60,7 @@ class TestPmSprintCom < Test::Unit::TestCase
|
|
60
60
|
res.expects(:content_type).at_least_once.returns('video/quicktime')
|
61
61
|
res.expects(:body).once.returns(body)
|
62
62
|
res.expects(:code).never
|
63
|
-
Net::HTTP.expects(:get_response).once.
|
63
|
+
Net::HTTP.expects(:get_response).once.returns res
|
64
64
|
|
65
65
|
mms = MMS2R::Media.new(mail)
|
66
66
|
|
@@ -127,7 +127,7 @@ class TestPmSprintCom < Test::Unit::TestCase
|
|
127
127
|
res1.expects(:content_type).at_least_once.returns('image/jpeg')
|
128
128
|
res1.expects(:body).once.returns(body1)
|
129
129
|
res1.expects(:code).never
|
130
|
-
Net::HTTP.expects(:get_response).
|
130
|
+
Net::HTTP.expects(:get_response).returns res1
|
131
131
|
|
132
132
|
uri2 = URI.parse('http://pictures.sprintpcs.com/mmps/RECIPIENT/001_104058d23d79fb6a_1/3?wm=1&ext=.jpg&iconifyVideo=true&inviteToken=5E1rJSPk5hYDkUnY7op0&outquality=90')
|
133
133
|
|
@@ -136,7 +136,7 @@ class TestPmSprintCom < Test::Unit::TestCase
|
|
136
136
|
res2.expects(:content_type).at_least_once.returns('image/jpeg')
|
137
137
|
res2.expects(:body).once.returns(body2)
|
138
138
|
res2.expects(:code).never
|
139
|
-
Net::HTTP.expects(:get_response).
|
139
|
+
Net::HTTP.expects(:get_response).returns res2
|
140
140
|
mms = MMS2R::Media.new(mail)
|
141
141
|
|
142
142
|
assert_equal 1, mms.media.size
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mms2r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Mondragon
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-20 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: nokogiri
|
17
17
|
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -32,6 +32,16 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: "0"
|
34
34
|
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: uuidtools
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
35
45
|
- !ruby/object:Gem::Dependency
|
36
46
|
name: hoe
|
37
47
|
type: :development
|
@@ -40,7 +50,7 @@ dependencies:
|
|
40
50
|
requirements:
|
41
51
|
- - ">="
|
42
52
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
53
|
+
version: 2.4.0
|
44
54
|
version:
|
45
55
|
description: |-
|
46
56
|
== DESCRIPTION
|
@@ -54,46 +64,10 @@ description: |-
|
|
54
64
|
If MMS2R is not aware of a particular carrier no extra processing is done to the
|
55
65
|
MMS other than decoding and consolidating its media.
|
56
66
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
* 1nbox/Idea: 1nbox.net
|
63
|
-
* 3 Ireland: mms.3ireland.ie
|
64
|
-
* Alltel: mms.alltel.com
|
65
|
-
* AT&T/Cingular/Legacy: mms.att.net, txt.att.net, mmode.com, mms.mycingular.com,
|
66
|
-
cingularme.com, mobile.mycingular.com pics.cingularme.com
|
67
|
-
* Bell Canada: txt.bell.ca
|
68
|
-
* Bell South / Suncom: bellsouth.net
|
69
|
-
* Cricket Wireless: mms.mycricket.com
|
70
|
-
* Dobson/Cellular One: mms.dobson.net
|
71
|
-
* Helio: mms.myhelio.com
|
72
|
-
* Hutchison 3G UK Ltd: mms.three.co.uk
|
73
|
-
* INDOSAT M2: mobile.indosat.net.id
|
74
|
-
* LUXGSM S.A.: mms.luxgsm.lu
|
75
|
-
* Maroc Telecom / mms.mobileiam.ma
|
76
|
-
* MTM South Africa: mms.mtn.co.za
|
77
|
-
* NetCom (Norway): mms.netcom.no
|
78
|
-
* Nextel: messaging.nextel.com
|
79
|
-
* O2 Germany: mms.o2online.de
|
80
|
-
* O2 UK: mediamessaging.o2.co.uk
|
81
|
-
* Orange & Regional Oranges: orangemms.net, mmsemail.orange.pl, orange.fr
|
82
|
-
* PLSPICTURES.COM mms hosting: waw.plspictures.com
|
83
|
-
* PXT New Zealand: pxt.vodafone.net.nz
|
84
|
-
* Rogers of Canada: rci.rogers.com
|
85
|
-
* SaskTel: sms.sasktel.com
|
86
|
-
* Sprint: pm.sprint.com, messaging.sprintpcs.com, sprintpcs.com
|
87
|
-
* T-Mobile: tmomail.net, mmsreply.t-mobile.co.uk, tmo.blackberry.net
|
88
|
-
* TELUS Corporation (Canada): mms.telusmobility.com, msg.telus.com
|
89
|
-
* UAE MMS: mms.ae
|
90
|
-
* Unicel: unicel.com, info2go.com
|
91
|
-
(note: mobile number is tucked away in a text/plain part for unicel.com)
|
92
|
-
* Verizon: vzwpix.com, vtext.com
|
93
|
-
* Virgin Mobile: vmpix.com
|
94
|
-
* Virgin Mobile of Canada: vmobile.ca
|
95
|
-
* Vodacom: mms.vodacom4me.co.za
|
96
|
-
email: mikemondragon@gmail.com
|
67
|
+
MMS2R can be used to process any multipart email to conveniently access the
|
68
|
+
parts the mail is comprised of.
|
69
|
+
email:
|
70
|
+
- mikemondragon@gmail.com
|
97
71
|
executables: []
|
98
72
|
|
99
73
|
extensions: []
|
@@ -143,7 +117,7 @@ files:
|
|
143
117
|
- conf/vzwpix.com.yml
|
144
118
|
- conf/waw.plspictures.com.yml
|
145
119
|
- dev_tools/anonymizer.rb
|
146
|
-
- dev_tools/
|
120
|
+
- dev_tools/debug_sprint_nokogiri_parsing.rb
|
147
121
|
- dev_tools/github.rb
|
148
122
|
- init.rb
|
149
123
|
- lib/mms2r.rb
|
@@ -302,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
302
276
|
requirements: []
|
303
277
|
|
304
278
|
rubyforge_project: mms2r
|
305
|
-
rubygems_version: 1.3.
|
279
|
+
rubygems_version: 1.3.5
|
306
280
|
signing_key:
|
307
281
|
specification_version: 3
|
308
282
|
summary: Extract user media from MMS (and not carrier cruft)
|