mms2r 2.1.3 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +22 -0
- data/Manifest.txt +6 -0
- data/README.txt +4 -3
- data/Rakefile +1 -1
- data/conf/aliases.yml +5 -0
- data/conf/from.yml +2 -0
- data/conf/mms.att.net.yml +2 -0
- data/conf/mms2r_media.yml +9 -1
- data/conf/vmpix.com.yml +4 -0
- data/lib/mms2r.rb +2 -2
- data/lib/mms2r/media.rb +152 -43
- data/lib/mms2r/media/sprint.rb +4 -4
- data/mms2r.gemspec +9 -7
- data/test/fixtures/generic.mail +50 -0
- data/test/fixtures/mobile.mycingular.com-text-01.mail +25 -0
- data/test/fixtures/pics.cingularme.com-image-01.mail +44 -0
- data/test/fixtures/tmo.blackberry.net-image-01.mail +48 -0
- data/test/fixtures/virgin.ca-text-01.mail +21 -0
- data/test/test_1nbox_net.rb +1 -1
- data/test/test_mms2r_media.rb +82 -9
- data/test/test_mms_3ireland_ie.rb +1 -1
- data/test/test_mms_att_net.rb +26 -0
- data/test/test_tmomail_net.rb +20 -2
- data/test/test_unicel_com.rb +1 -1
- data/test/test_vmpix_com.rb +10 -0
- data/vendor/plugins/mms2r/lib/autotest/mms2r.rb +1 -1
- metadata +35 -29
data/History.txt
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
### 2.2.0 / 2009-01-04 (Rikki Kixx - owner of a franchise of rehab centers)
|
2
|
+
|
3
|
+
* 3 new features
|
4
|
+
* MMS2R::Media#is_mobile? best guess if the sender was a mobile device
|
5
|
+
* MMS2R::Media#device_type? best guess of the mobile device type. Simple
|
6
|
+
heuristics thus far for :blackberry :iphone :handset :unknown
|
7
|
+
could be expanded for exif probing or additinal shifting of mail header
|
8
|
+
* from array in conf/from.yml to provide granularity to determine carrier
|
9
|
+
domain (caused by tmo.blackberry.net)
|
10
|
+
|
11
|
+
* 4 minor enhancements
|
12
|
+
* support for Virgin Canada messaging service vmobile.ca
|
13
|
+
* support for text service messaging.sprintpcs.com
|
14
|
+
* additional BlackBerry coverage from T-Mobile tmo.blackberry.net provider
|
15
|
+
* legacy support for mobile.mycingular.com, pics.cingularme.com
|
16
|
+
|
17
|
+
* 3 bug fixes
|
18
|
+
* iPhone default subject - jesse dp
|
19
|
+
http://rubyforge.org/tracker/?func=detail&atid=11789&aid=22951&group_id=3065
|
20
|
+
* add sprintpcs.com to pm.sprint.com aliases
|
21
|
+
* fix OS X long filename issues - Matt Conway
|
22
|
+
|
1
23
|
### 2.1.3 / 2008-11-06 (Dr. Ramonolith Chesterfield - Military pharmaceutical psychotropic drug manufacturing expert
|
2
24
|
|
3
25
|
* 1 minor enhancement
|
data/Manifest.txt
CHANGED
@@ -6,6 +6,7 @@ Rakefile
|
|
6
6
|
conf/1nbox.net.yml
|
7
7
|
conf/aliases.yml
|
8
8
|
conf/bellsouth.net.yml
|
9
|
+
conf/from.yml
|
9
10
|
conf/mediamessaging.o2.co.uk.yml
|
10
11
|
conf/messaging.nextel.com.yml
|
11
12
|
conf/mms.3ireland.ie.yml
|
@@ -66,6 +67,7 @@ test/fixtures/cingularme-text-01.mail
|
|
66
67
|
test/fixtures/cingularme-text-02.mail
|
67
68
|
test/fixtures/dobson-image-01.mail
|
68
69
|
test/fixtures/dot.jpg
|
70
|
+
test/fixtures/generic.mail
|
69
71
|
test/fixtures/helio-image-01.mail
|
70
72
|
test/fixtures/helio-message-01.mail
|
71
73
|
test/fixtures/iconv-fr-text-01.mail
|
@@ -80,6 +82,7 @@ test/fixtures/mms.ae-image-01.mail
|
|
80
82
|
test/fixtures/mms.mycricket.com-pic-and-text.mail
|
81
83
|
test/fixtures/mms.mycricket.com-pic.mail
|
82
84
|
test/fixtures/mmsreply.t-mobile.co.uk-text-image-01.mail
|
85
|
+
test/fixtures/mobile.mycingular.com-text-01.mail
|
83
86
|
test/fixtures/mtn-southafrica-mms.mail
|
84
87
|
test/fixtures/mycingular-image-01.mail
|
85
88
|
test/fixtures/netcom-image-01.mail
|
@@ -92,6 +95,7 @@ test/fixtures/orange-uk-image-01.mail
|
|
92
95
|
test/fixtures/orangefrance-text-and-image.mail
|
93
96
|
test/fixtures/orangepoland-text-01.mail
|
94
97
|
test/fixtures/orangepoland-text-02.mail
|
98
|
+
test/fixtures/pics.cingularme.com-image-01.mail
|
95
99
|
test/fixtures/pxt-image-01.mail
|
96
100
|
test/fixtures/rogers-canada-mms-01.mail
|
97
101
|
test/fixtures/sasktel-image-01.mail
|
@@ -106,6 +110,7 @@ test/fixtures/sprint.mov
|
|
106
110
|
test/fixtures/suncom-blackberry.mail
|
107
111
|
test/fixtures/telus-image-01.mail
|
108
112
|
test/fixtures/three-uk-image-01.mail
|
113
|
+
test/fixtures/tmo.blackberry.net-image-01.mail
|
109
114
|
test/fixtures/tmobile-blackberry-02.mail
|
110
115
|
test/fixtures/tmobile-blackberry.mail
|
111
116
|
test/fixtures/tmobile-image-01.mail
|
@@ -118,6 +123,7 @@ test/fixtures/verizon-image-03.mail
|
|
118
123
|
test/fixtures/verizon-text-01.mail
|
119
124
|
test/fixtures/verizon-video-01.mail
|
120
125
|
test/fixtures/virgin-mobile-image-01.mail
|
126
|
+
test/fixtures/virgin.ca-text-01.mail
|
121
127
|
test/fixtures/vodacom4me-co-za-01.mail
|
122
128
|
test/fixtures/vodacom4me-co-za-02.mail
|
123
129
|
test/fixtures/vodacom4me-southafrica-mms-01.mail
|
data/README.txt
CHANGED
@@ -26,7 +26,7 @@ Corpus of carriers currently processed by MMS2R:
|
|
26
26
|
* 3 Ireland: mms.3ireland.ie
|
27
27
|
* Alltel: mms.alltel.com
|
28
28
|
* AT&T/Cingular/Legacy: mms.att.net, txt.att.net, mmode.com, mms.mycingular.com,
|
29
|
-
cingularme.com
|
29
|
+
cingularme.com, mobile.mycingular.com pics.cingularme.com
|
30
30
|
* Bell Canada: txt.bell.ca
|
31
31
|
* Bell South / Suncom: bellsouth.net
|
32
32
|
* Cricket Wireless: mms.mycricket.com
|
@@ -46,14 +46,15 @@ Corpus of carriers currently processed by MMS2R:
|
|
46
46
|
* PXT New Zealand: pxt.vodafone.net.nz
|
47
47
|
* Rogers of Canada: rci.rogers.com
|
48
48
|
* SaskTel: sms.sasktel.com
|
49
|
-
* Sprint: pm.sprint.com, messaging.sprintpcs.com
|
50
|
-
* T-Mobile: tmomail.net, mmsreply.t-mobile.co.uk
|
49
|
+
* Sprint: pm.sprint.com, messaging.sprintpcs.com, sprintpcs.com
|
50
|
+
* T-Mobile: tmomail.net, mmsreply.t-mobile.co.uk, tmo.blackberry.net
|
51
51
|
* TELUS Corporation (Canada): mms.telusmobility.com, msg.telus.com
|
52
52
|
* UAE MMS: mms.ae
|
53
53
|
* Unicel: unicel.com, info2go.com
|
54
54
|
(note: mobile number is tucked away in a text/plain part for unicel.com)
|
55
55
|
* Verizon: vzwpix.com, vtext.com
|
56
56
|
* Virgin Mobile: vmpix.com
|
57
|
+
* Virgin Mobile of Canada: vmobile.ca
|
57
58
|
* Vodacom: mms.vodacom4me.co.za
|
58
59
|
|
59
60
|
== FEATURES
|
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ Hoe.new('mms2r', MMS2R::Media::VERSION) do |p|
|
|
18
18
|
p.summary = 'Extract user media from MMS (and not carrier cruft)'
|
19
19
|
p.description = p.paragraphs_of('README.txt', 2..6).join("\n\n")
|
20
20
|
p.url = p.paragraphs_of('README.txt', 1).first.strip
|
21
|
-
p.changes = p.paragraphs_of('History.txt', 0..
|
21
|
+
p.changes = p.paragraphs_of('History.txt', 0..3).join("\n\n")
|
22
22
|
p.extra_deps << ['hpricot', '>= 0.6.0']
|
23
23
|
p.extra_deps << ['tmail', '>= 1.2.1']
|
24
24
|
p.clean_globs << 'coverage'
|
data/conf/aliases.yml
CHANGED
@@ -3,10 +3,15 @@ txt.att.net: mms.att.net
|
|
3
3
|
cingularme.com: mms.att.net
|
4
4
|
mmode.com: mms.att.net
|
5
5
|
mms.mycingular.com: mms.att.net
|
6
|
+
mobile.mycingular.com: mms.att.net
|
7
|
+
pics.cingularme.com: mms.att.net
|
6
8
|
vtext.com: vzwpix.com
|
7
9
|
orange.fr: orangemms.net
|
8
10
|
mmsemail.orange.pl: orangemms.net
|
9
11
|
message.alltel.com: mms.alltel.com
|
10
12
|
mmsreply.t-mobile.co.uk: tmomail.net
|
13
|
+
tmo.blackberry.net: tmomail.net
|
11
14
|
info2go.com: unicel.com
|
12
15
|
mms.telusmobility.com: msg.telus.com
|
16
|
+
sprintpcs.com: pm.sprint.com
|
17
|
+
vmobile.ca: vmpix.com
|
data/conf/from.yml
ADDED
data/conf/mms.att.net.yml
CHANGED
data/conf/mms2r_media.yml
CHANGED
@@ -10,7 +10,15 @@ transform:
|
|
10
10
|
- "\1"
|
11
11
|
- - /\A(.*?)Sent from my Verizon Wireless BlackBerry$/im
|
12
12
|
- "\1"
|
13
|
-
- - /\A(.*?)Sent from my iPhone.?$/im
|
13
|
+
- - /\A(.*?)Sent from (my|your) iPhone.?$/im
|
14
14
|
- "\1"
|
15
15
|
- - /\A(.*?)\s+image\/jpeg$/im
|
16
16
|
- "\1"
|
17
|
+
device_types:
|
18
|
+
headers:
|
19
|
+
X-Mailer:
|
20
|
+
- !ruby/regexp /^iPhone Mail/i
|
21
|
+
- :iphone
|
22
|
+
X-rim-org-msg-ref-id:
|
23
|
+
- !ruby/regexp /.+/
|
24
|
+
- :blackberry
|
data/conf/vmpix.com.yml
CHANGED
data/lib/mms2r.rb
CHANGED
@@ -39,14 +39,14 @@ module MMS2R
|
|
39
39
|
##
|
40
40
|
# MMS2R library version
|
41
41
|
|
42
|
-
VERSION = '2.
|
42
|
+
VERSION = '2.2.0'
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
48
|
require 'rubygems'
|
49
|
-
gem 'tmail', '>= 1.2.
|
49
|
+
gem 'tmail', '>= 1.2.3'
|
50
50
|
require 'tmail/mail'
|
51
51
|
require 'fileutils'
|
52
52
|
require 'pathname'
|
data/lib/mms2r/media.rb
CHANGED
@@ -107,8 +107,9 @@ module MMS2R
|
|
107
107
|
# alias new so that we can use ::create to select the media processor and
|
108
108
|
# then initialize the new object
|
109
109
|
alias orig_new new
|
110
|
-
def new(mail, opts=
|
111
|
-
klass = MMS2R::Media.create(mail)
|
110
|
+
def new(mail, opts = {})
|
111
|
+
klass, carrier = MMS2R::Media.create(mail)
|
112
|
+
opts[:domain] = carrier
|
112
113
|
klass.orig_new(mail, opts)
|
113
114
|
end
|
114
115
|
end
|
@@ -147,18 +148,52 @@ module MMS2R
|
|
147
148
|
# object.
|
148
149
|
|
149
150
|
def self.create(mail)
|
150
|
-
d = lambda{['mms2r.media',MMS2R::Media]} #sets a default to detect
|
151
|
-
|
152
|
-
|
153
|
-
|
151
|
+
d = lambda{ ['mms2r.media', MMS2R::Media] } #sets a default to detect
|
152
|
+
from_domain = self.domain(mail)
|
153
|
+
processor = MMS2R::CARRIERS.detect(d) do |domain, klass|
|
154
|
+
return klass, domain if from_domain == domain
|
155
|
+
end
|
156
|
+
[MMS2R::Media, from_domain]
|
157
|
+
end
|
158
|
+
|
159
|
+
##
|
160
|
+
# Determine if return-path or from is going to be used to desiginate the
|
161
|
+
# origin carrier. If the domain in the From header is listed in
|
162
|
+
# conf/from.yaml then that is the carrier domain. Else if there is a
|
163
|
+
# Return-Path header its address's domain is the carrier doamin, else
|
164
|
+
# use From header's address domain.
|
165
|
+
|
166
|
+
def self.domain(mail)
|
167
|
+
return_path = case
|
168
|
+
when mail.header['return-path']
|
169
|
+
matched = /^<.+@([^@]+)>$/.match(mail.header['return-path'].to_s.strip)
|
170
|
+
matched ? matched[1] : ''
|
154
171
|
else
|
155
|
-
|
172
|
+
''
|
156
173
|
end
|
157
|
-
|
158
|
-
|
159
|
-
|
174
|
+
|
175
|
+
from_domain = case
|
176
|
+
when mail.from && mail.from.first
|
177
|
+
mail.from.first.split('@').last
|
178
|
+
else
|
179
|
+
''
|
180
|
+
end
|
181
|
+
|
182
|
+
f = File.join(self.conf_dir(), "from.yml")
|
183
|
+
from = YAML::load_file(f) rescue {}
|
184
|
+
|
185
|
+
ret = case
|
186
|
+
when from.include?(from_domain)
|
187
|
+
from_domain
|
188
|
+
when return_path.any?
|
189
|
+
return_path
|
190
|
+
else
|
191
|
+
from_domain
|
192
|
+
end
|
193
|
+
ret
|
160
194
|
end
|
161
195
|
|
196
|
+
|
162
197
|
##
|
163
198
|
# Initialize a new MMS2R::Media comprised of a mail.
|
164
199
|
#
|
@@ -172,17 +207,12 @@ module MMS2R
|
|
172
207
|
def initialize(mail, opts={})
|
173
208
|
|
174
209
|
@mail = mail
|
175
|
-
@logger = opts[:logger]
|
176
|
-
|
210
|
+
@logger = opts[:logger]
|
211
|
+
log("#{self.class} created", :info)
|
212
|
+
@carrier = opts[:domain]
|
177
213
|
@dir_count = 0
|
178
|
-
@media_dir = File.join(self.
|
179
|
-
self.
|
180
|
-
|
181
|
-
if mail.header['return-path'] && mail.header['return-path'].to_s.strip =~ /^<.+@([^@]+)>$/
|
182
|
-
@carrier = $1
|
183
|
-
else
|
184
|
-
@carrier = mail.from.first.split('@').last rescue 'mms2r.media'
|
185
|
-
end
|
214
|
+
@media_dir = File.join(self.tmp_dir(),
|
215
|
+
self.safe_message_id(@mail.message_id))
|
186
216
|
@media = {}
|
187
217
|
@was_processed = false
|
188
218
|
@number = nil
|
@@ -191,13 +221,11 @@ module MMS2R
|
|
191
221
|
@default_media = nil
|
192
222
|
@default_text = nil
|
193
223
|
|
194
|
-
f = File.join(self.
|
224
|
+
f = File.join(self.conf_dir(), "aliases.yml")
|
195
225
|
@aliases = YAML::load_file(f) rescue {}
|
196
226
|
|
197
|
-
conf = @aliases[@carrier]
|
198
|
-
|
199
|
-
conf += ".yml"
|
200
|
-
f = File.join(self.class.conf_dir(), conf)
|
227
|
+
conf = "#{@aliases[@carrier] || @carrier}.yml"
|
228
|
+
f = File.join(self.conf_dir(), conf)
|
201
229
|
c = YAML::load_file(f) rescue {}
|
202
230
|
@config = self.class.initialize_config(c)
|
203
231
|
|
@@ -213,9 +241,9 @@ module MMS2R
|
|
213
241
|
|
214
242
|
def number
|
215
243
|
unless @number
|
216
|
-
params = config['number']
|
217
|
-
if params
|
218
|
-
@number =
|
244
|
+
params = config['number']
|
245
|
+
if params && (header = mail.header[params[0]])
|
246
|
+
@number = header.to_s.gsub(eval(params[1]), params[2])
|
219
247
|
end
|
220
248
|
end
|
221
249
|
@number ||= mail.from.first.split('@').first rescue ""
|
@@ -229,7 +257,7 @@ module MMS2R
|
|
229
257
|
|
230
258
|
unless @subject
|
231
259
|
subject = mail.subject.strip rescue ""
|
232
|
-
ignores = config['ignore']['text/plain']
|
260
|
+
ignores = config['ignore']['text/plain']
|
233
261
|
if ignores && ignores.detect{|s| s == subject}
|
234
262
|
@subject = ""
|
235
263
|
else
|
@@ -300,7 +328,7 @@ module MMS2R
|
|
300
328
|
|
301
329
|
def process() # :yields: media_type, file
|
302
330
|
unless @was_processed
|
303
|
-
|
331
|
+
log("#{self.class} processing", :info)
|
304
332
|
|
305
333
|
parts = mail.multipart? ? mail.parts : [mail]
|
306
334
|
|
@@ -349,9 +377,9 @@ module MMS2R
|
|
349
377
|
def ignore_media?(type,part)
|
350
378
|
ignores = config['ignore'][type] || []
|
351
379
|
ignore = ignores.detect{|test| filename?(part) == test}
|
352
|
-
ignore ||= ignores.detect{|test| filename?(part) =~ eval(test) if test.index('/') == 0
|
353
|
-
ignore ||= ignores.detect{|test| part.body.strip =~ eval(test) if test.index('/') == 0
|
354
|
-
ignore ||= (part.body.strip.size == 0 ? true : nil)
|
380
|
+
ignore ||= ignores.detect{|test| filename?(part) =~ eval(test) if test.index('/') == 0 }
|
381
|
+
ignore ||= ignores.detect{|test| part.body.strip =~ eval(test) if test.index('/') == 0 }
|
382
|
+
ignore ||= (part.body.strip.size == 0 ? true : nil)
|
355
383
|
ignore.nil? ? false : true
|
356
384
|
end
|
357
385
|
|
@@ -386,7 +414,7 @@ module MMS2R
|
|
386
414
|
end
|
387
415
|
return type, nil if content.nil? || content.empty?
|
388
416
|
|
389
|
-
|
417
|
+
log("#{self.class} writing file #{file}", :info)
|
390
418
|
File.open(file, mode){ |f| f.write(content) }
|
391
419
|
return type, file
|
392
420
|
end
|
@@ -397,7 +425,7 @@ module MMS2R
|
|
397
425
|
# configuration.
|
398
426
|
|
399
427
|
def transform_text(type, text, original_nencoding = 'ISO-8859-1')
|
400
|
-
return type, text unless transforms = config['transform'][type]
|
428
|
+
return type, text unless transforms = config['transform'][type]
|
401
429
|
|
402
430
|
#convert to UTF-8
|
403
431
|
begin
|
@@ -445,7 +473,7 @@ module MMS2R
|
|
445
473
|
# for this producer and all of the media that it contains.
|
446
474
|
|
447
475
|
def purge()
|
448
|
-
|
476
|
+
log("#{self.class} purging #{@media_dir} and all its contents", :info)
|
449
477
|
FileUtils.rm_rf(@media_dir)
|
450
478
|
end
|
451
479
|
|
@@ -479,11 +507,51 @@ module MMS2R
|
|
479
507
|
if part['content-id'] && part['content-id'].real_body.strip =~ /^<(.+)>$/
|
480
508
|
name = $1
|
481
509
|
else
|
482
|
-
name = "#{Time.now.to_f}.#{self.
|
510
|
+
name = "#{Time.now.to_f}.#{self.default_ext(part.part_type?)}"
|
483
511
|
end
|
484
512
|
end
|
485
513
|
# XXX fwiw, janky look for dot extension 1 to 4 chars long
|
486
|
-
name =~ /\..{1,4}$/ ? name : "#{name}.#{self.
|
514
|
+
name = (name =~ /\..{1,4}$/ ? name : "#{name}.#{self.default_ext(part.part_type?)}")
|
515
|
+
|
516
|
+
# handle excessively large filenames
|
517
|
+
if name.size > 255
|
518
|
+
ext = File.extname(name)
|
519
|
+
base = File.basename(name, ext)
|
520
|
+
name = "#{base[0, 255 - ext.size]}#{ext}"
|
521
|
+
end
|
522
|
+
|
523
|
+
name
|
524
|
+
end
|
525
|
+
|
526
|
+
def aliases
|
527
|
+
@aliases
|
528
|
+
end
|
529
|
+
|
530
|
+
##
|
531
|
+
# Best guess of the mobile device type. Simple heuristics thus far for
|
532
|
+
# :iphone :blackberry :handset :unknown . Could be expanded for exif
|
533
|
+
# probing or shifting mail header schemes
|
534
|
+
|
535
|
+
def device_type?
|
536
|
+
headers = config['device_types']['headers'] rescue {}
|
537
|
+
headers.keys.each do |header|
|
538
|
+
if mail.header[header.downcase]
|
539
|
+
regex, type = headers[header]
|
540
|
+
return type if mail.header[header.downcase].to_s =~ regex
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
544
|
+
return :handset if File.exist?(File.join(self.conf_dir,
|
545
|
+
"#{self.aliases[self.carrier] || self.carrier}.yml"))
|
546
|
+
|
547
|
+
:unknown
|
548
|
+
end
|
549
|
+
|
550
|
+
##
|
551
|
+
# The source of the MMS was some sort of mobile or smart phone
|
552
|
+
|
553
|
+
def is_mobile?
|
554
|
+
self.device_type? != :unknown
|
487
555
|
end
|
488
556
|
|
489
557
|
##
|
@@ -525,9 +593,11 @@ module MMS2R
|
|
525
593
|
# Returns a default file extension based on a content type
|
526
594
|
|
527
595
|
def self.default_ext(content_type)
|
528
|
-
|
529
|
-
|
530
|
-
|
596
|
+
if MMS2R::EXT[content_type]
|
597
|
+
MMS2R::EXT[content_type]
|
598
|
+
elsif content_type
|
599
|
+
content_type.split('/').last
|
600
|
+
end
|
531
601
|
end
|
532
602
|
|
533
603
|
##
|
@@ -537,7 +607,7 @@ module MMS2R
|
|
537
607
|
def self.initialize_config(c)
|
538
608
|
f = File.join(self.conf_dir(), "mms2r_media.yml")
|
539
609
|
conf = YAML::load_file(f) rescue {}
|
540
|
-
conf['ignore']
|
610
|
+
conf['ignore'] ||= {} unless conf['ignore']
|
541
611
|
conf['transform'] = {} unless conf['transform']
|
542
612
|
conf['number'] = [] unless conf['number']
|
543
613
|
return conf unless c
|
@@ -557,6 +627,45 @@ module MMS2R
|
|
557
627
|
conf
|
558
628
|
end
|
559
629
|
|
630
|
+
def log(message, level = :info)
|
631
|
+
@logger.send(level, message) unless @logger.nil?
|
632
|
+
end
|
633
|
+
|
634
|
+
##
|
635
|
+
# convenience accessor for self.class.conf_dir
|
636
|
+
|
637
|
+
def conf_dir
|
638
|
+
self.class.conf_dir
|
639
|
+
end
|
640
|
+
|
641
|
+
##
|
642
|
+
# convenience accessor for self.class.conf_dir
|
643
|
+
|
644
|
+
def tmp_dir
|
645
|
+
self.class.tmp_dir
|
646
|
+
end
|
647
|
+
|
648
|
+
##
|
649
|
+
# convenience accessor for self.class.default_ext
|
650
|
+
|
651
|
+
def default_ext(type)
|
652
|
+
self.class.default_ext(type)
|
653
|
+
end
|
654
|
+
|
655
|
+
##
|
656
|
+
# convenience accessor for self.class.safe_message_id
|
657
|
+
|
658
|
+
def safe_message_id(message_id)
|
659
|
+
self.class.safe_message_id(message_id)
|
660
|
+
end
|
661
|
+
|
662
|
+
##
|
663
|
+
# convenience accessor for self.class.initialize_confg
|
664
|
+
|
665
|
+
def initialize_config(config)
|
666
|
+
self.class.initialize_config(config)
|
667
|
+
end
|
668
|
+
|
560
669
|
private
|
561
670
|
|
562
671
|
##
|
@@ -601,7 +710,7 @@ module MMS2R
|
|
601
710
|
if File.size(f) > size
|
602
711
|
size = File.size(f)
|
603
712
|
file = File.new(f)
|
604
|
-
mime_type = media.detect{|type,files| files.detect{|fl| fl == f}}[0]
|
713
|
+
mime_type = media.detect{|type,files| files.detect{|fl| fl == f}}[0]
|
605
714
|
end
|
606
715
|
end
|
607
716
|
|
data/lib/mms2r/media/sprint.rb
CHANGED
@@ -38,7 +38,7 @@ module MMS2R
|
|
38
38
|
|
39
39
|
def process
|
40
40
|
unless @was_processed
|
41
|
-
|
41
|
+
log("#{self.class} processing", :info)
|
42
42
|
#sprint MMS are multipart
|
43
43
|
parts = @mail.parts
|
44
44
|
|
@@ -141,14 +141,14 @@ module MMS2R
|
|
141
141
|
|
142
142
|
res = Net::HTTP.get_response(url)
|
143
143
|
rescue StandardError => err
|
144
|
-
|
144
|
+
log("#{self.class} processing error, #{$!}", :error)
|
145
145
|
next
|
146
146
|
end
|
147
147
|
|
148
148
|
# if the Sprint content server uses response code 500 when the content is purged
|
149
149
|
# the content type will text/html and the body will be the message
|
150
150
|
if res.content_type == 'text/html' && res.code == "500"
|
151
|
-
|
151
|
+
log("Sprint content server returned response code 500", :error)
|
152
152
|
next
|
153
153
|
end
|
154
154
|
|
@@ -179,7 +179,7 @@ module MMS2R
|
|
179
179
|
|
180
180
|
def sprint_write_file(type, content, file = nil)
|
181
181
|
file = sprint_temp_file(type) if file.nil?
|
182
|
-
|
182
|
+
log("#{self.class} writing file #{file}", :info)
|
183
183
|
File.open(file,'w'){ |f| f.write(content) }
|
184
184
|
return type, file
|
185
185
|
end
|
data/mms2r.gemspec
CHANGED
@@ -1,29 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = %q{mms2r}
|
3
|
-
s.version = "2.
|
5
|
+
s.version = "2.2.0"
|
4
6
|
|
5
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
8
|
s.authors = ["Mike Mondragon"]
|
7
|
-
s.date = %q{2008-
|
8
|
-
s.description = %q{== DESCRIPTION MMS2R is a library that decodes the parts of an MMS message to disk while stripping out advertising injected by the mobile carriers. MMS messages are multipart email and the carriers often inject branding into these messages. Use MMS2R if you want to get at the real user generated content from a MMS without having to deal with the cruft from the carriers. If MMS2R is not aware of a particular carrier no extra processing is done to the MMS other than decoding and consolidating its media. Contact the author to add additional carriers to be processed by the library. Suggestions and patches appreciated and welcomed! Corpus of carriers currently processed by MMS2R: * 1nbox/Idea: 1nbox.net * 3 Ireland: mms.3ireland.ie * Alltel: mms.alltel.com * AT&T/Cingular/Legacy: mms.att.net, txt.att.net, mmode.com, mms.mycingular.com, cingularme.com * Bell Canada: txt.bell.ca * Bell South / Suncom: bellsouth.net * Cricket Wireless: mms.mycricket.com * Dobson/Cellular One: mms.dobson.net * Helio: mms.myhelio.com * Hutchison 3G UK Ltd: mms.three.co.uk * INDOSAT M2: mobile.indosat.net.id * LUXGSM S.A.: mms.luxgsm.lu * Maroc Telecom / mms.mobileiam.ma * MTM South Africa: mms.mtn.co.za * NetCom (Norway): mms.netcom.no * Nextel: messaging.nextel.com * O2 Germany: mms.o2online.de * O2 UK: mediamessaging.o2.co.uk * Orange & Regional Oranges: orangemms.net, mmsemail.orange.pl, orange.fr * PLSPICTURES.COM mms hosting: waw.plspictures.com * PXT New Zealand: pxt.vodafone.net.nz * Rogers of Canada: rci.rogers.com * SaskTel: sms.sasktel.com * Sprint: pm.sprint.com, messaging.sprintpcs.com * T-Mobile: tmomail.net, mmsreply.t-mobile.co.uk * TELUS Corporation (Canada): mms.telusmobility.com, msg.telus.com * Unicel: unicel.com, info2go.com (note: mobile number is tucked away in a text/plain part for unicel.com) * Verizon: vzwpix.com, vtext.com * Virgin Mobile: vmpix.com * Vodacom: mms.vodacom4me.co.za}
|
9
|
+
s.date = %q{2008-12-16}
|
10
|
+
s.description = %q{== DESCRIPTION MMS2R is a library that decodes the parts of an MMS message to disk while stripping out advertising injected by the mobile carriers. MMS messages are multipart email and the carriers often inject branding into these messages. Use MMS2R if you want to get at the real user generated content from a MMS without having to deal with the cruft from the carriers. If MMS2R is not aware of a particular carrier no extra processing is done to the MMS other than decoding and consolidating its media. Contact the author to add additional carriers to be processed by the library. Suggestions and patches appreciated and welcomed! Corpus of carriers currently processed by MMS2R: * 1nbox/Idea: 1nbox.net * 3 Ireland: mms.3ireland.ie * Alltel: mms.alltel.com * AT&T/Cingular/Legacy: mms.att.net, txt.att.net, mmode.com, mms.mycingular.com, cingularme.com, mobile.mycingular.com pics.cingularme.com * Bell Canada: txt.bell.ca * Bell South / Suncom: bellsouth.net * Cricket Wireless: mms.mycricket.com * Dobson/Cellular One: mms.dobson.net * Helio: mms.myhelio.com * Hutchison 3G UK Ltd: mms.three.co.uk * INDOSAT M2: mobile.indosat.net.id * LUXGSM S.A.: mms.luxgsm.lu * Maroc Telecom / mms.mobileiam.ma * MTM South Africa: mms.mtn.co.za * NetCom (Norway): mms.netcom.no * Nextel: messaging.nextel.com * O2 Germany: mms.o2online.de * O2 UK: mediamessaging.o2.co.uk * Orange & Regional Oranges: orangemms.net, mmsemail.orange.pl, orange.fr * PLSPICTURES.COM mms hosting: waw.plspictures.com * PXT New Zealand: pxt.vodafone.net.nz * Rogers of Canada: rci.rogers.com * SaskTel: sms.sasktel.com * Sprint: pm.sprint.com, messaging.sprintpcs.com, sprintpcs.com * T-Mobile: tmomail.net, mmsreply.t-mobile.co.uk, tmo.blackberry.net * TELUS Corporation (Canada): mms.telusmobility.com, msg.telus.com * UAE MMS: mms.ae * Unicel: unicel.com, info2go.com (note: mobile number is tucked away in a text/plain part for unicel.com) * Verizon: vzwpix.com, vtext.com * Virgin Mobile: vmpix.com * Virgin Mobile of Canada: vmobile.ca * Vodacom: mms.vodacom4me.co.za}
|
9
11
|
s.email = %q{mikemondragon@gmail.com}
|
10
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
11
|
-
s.files = [".gitignore", "History.txt", "Manifest.txt", "README.txt", "Rakefile", "conf/1nbox.net.yml", "conf/aliases.yml", "conf/bellsouth.net.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", "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/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/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/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/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/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/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/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"]
|
13
|
+
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", "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/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/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"]
|
12
14
|
s.has_rdoc = true
|
13
15
|
s.homepage = %q{by Mike Mondragon
|
14
16
|
}
|
15
17
|
s.rdoc_options = ["--main", "README.txt"]
|
16
18
|
s.require_paths = ["lib"]
|
17
19
|
s.rubyforge_project = %q{mms2r}
|
18
|
-
s.rubygems_version = %q{1.
|
20
|
+
s.rubygems_version = %q{1.3.1}
|
19
21
|
s.summary = %q{Extract user media from MMS (and not carrier cruft)}
|
20
|
-
s.test_files = ["test/
|
22
|
+
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"]
|
21
23
|
|
22
24
|
if s.respond_to? :specification_version then
|
23
25
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
26
|
s.specification_version = 2
|
25
27
|
|
26
|
-
if
|
28
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
29
|
s.add_runtime_dependency(%q<hpricot>, [">= 0.6.0"])
|
28
30
|
s.add_runtime_dependency(%q<tmail>, [">= 1.2.1"])
|
29
31
|
s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
|
@@ -0,0 +1,50 @@
|
|
1
|
+
Delivered-To: someone@gmail.com
|
2
|
+
Received: by 10.143.32.12 with SMTP id k12cs339474wfj;
|
3
|
+
Mon, 1 Dec 2008 11:21:47 -0800 (PST)
|
4
|
+
Received: by 10.100.168.18 with SMTP id q18mr6081458ane.7.1228159306677;
|
5
|
+
Mon, 01 Dec 2008 11:21:46 -0800 (PST)
|
6
|
+
Return-Path: <noreply@rubyforge.org>
|
7
|
+
Received: from rubyforge.org (rubyforge.org [205.234.109.19])
|
8
|
+
by mx.google.com with ESMTP id d21si5824438and.26.2008.12.01.11.21.46;
|
9
|
+
Mon, 01 Dec 2008 11:21:46 -0800 (PST)
|
10
|
+
Received-SPF: pass (google.com: domain of noreply@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19;
|
11
|
+
Authentication-Results: mx.google.com; spf=pass (google.com: domain of noreply@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=noreply@rubyforge.org
|
12
|
+
Received: by rubyforge.org (Postfix, from userid 502)
|
13
|
+
id 037671588057; Mon, 1 Dec 2008 14:21:45 -0500 (EST)
|
14
|
+
To: noreply@rubyforge.org
|
15
|
+
From: <noreply@rubyforge.org>
|
16
|
+
Subject: [ mms2r-Patches-22951 ] iPhone default subject line varient
|
17
|
+
Content-type: text/plain; charset=UTF-8
|
18
|
+
Message-Id: <20081201192146.037671588057@rubyforge.org>
|
19
|
+
Date: Mon, 1 Dec 2008 14:21:45 -0500 (EST)
|
20
|
+
|
21
|
+
Patches item #22951, was opened at 2008-11-23 14:47
|
22
|
+
You can respond by visiting:
|
23
|
+
http://rubyforge.org/tracker/?func=detail&atid=11789&aid=22951&group_id=3065
|
24
|
+
|
25
|
+
Category: None
|
26
|
+
Group: None
|
27
|
+
Status: Open
|
28
|
+
Resolution: None
|
29
|
+
Priority: 3
|
30
|
+
Submitted By: jesse dp (jessedp)
|
31
|
+
>Assigned to: Mike Mondragon (mikemondragon)
|
32
|
+
Summary: iPhone default subject line varient
|
33
|
+
|
34
|
+
Initial Comment:
|
35
|
+
On line 13 of conf/mms2r_media.yml, we've changed:
|
36
|
+
|
37
|
+
- - /\A(.*?)Sent from my iPhone.?$/im
|
38
|
+
|
39
|
+
to:
|
40
|
+
|
41
|
+
- - /\A(.*?)Sent from (my|your) iPhone.?$/im
|
42
|
+
|
43
|
+
|
44
|
+
b/c apparently that's a variation of their default subject too
|
45
|
+
|
46
|
+
|
47
|
+
----------------------------------------------------------------------
|
48
|
+
|
49
|
+
You can respond by visiting:
|
50
|
+
http://rubyforge.org/tracker/?func=detail&atid=11789&aid=22951&group_id=3065
|
@@ -0,0 +1,25 @@
|
|
1
|
+
X-Gmail-Received: 7105037d3e995bef64ac4dc4c60acf6ebb21ffca
|
2
|
+
Delivered-To: tommy.tutone@example.com
|
3
|
+
Received: by 10.36.78.1 with SMTP id a1cs107902nzb;
|
4
|
+
Mon, 3 Jul 2006 19:40:19 -0700 (PDT)
|
5
|
+
Received: by 10.70.128.8 with SMTP id a8mr6891405wxd;
|
6
|
+
Mon, 03 Jul 2006 19:40:19 -0700 (PDT)
|
7
|
+
Return-Path: <2068675309@mobile.mycingular.com>
|
8
|
+
Received: from wcmta2.mycingular.net (wcmta2.mycingular.net [66.102.172.232])
|
9
|
+
by mx.gmail.com with ESMTP id i20si5782410wxd.2006.07.03.19.40.19;
|
10
|
+
Mon, 03 Jul 2006 19:40:19 -0700 (PDT)
|
11
|
+
Received-SPF: neutral (gmail.com: 66.102.172.232 is neither permitted nor denied by best guess record for domain of 2068675309@mobile.mycingular.com)
|
12
|
+
Received: from mobile.mycingular.com (wcmmg1.mycingular.net [10.46.26.18])
|
13
|
+
by wcmta2.mycingular.net (8.12.11/8.12.11) with SMTP id k642eI4M028656
|
14
|
+
for tommy.tutone@example.com; Mon, 3 Jul 2006 21:40:18 -0500 (CDT)
|
15
|
+
(envelope-from 2068675309@mobile.mycingular.com)
|
16
|
+
Date: Mon, 3 Jul 2006 21:40:18 -0500 (CDT)
|
17
|
+
Message-Id: <200607040240.k642eI4M028656@wcmta2.mycingular.net>
|
18
|
+
FROM: 2068675309@mobile.mycingular.com
|
19
|
+
TO: tommy.tutone@example.com
|
20
|
+
|
21
|
+
I hate people that send text messages about skateboarding.
|
22
|
+
|
23
|
+
--
|
24
|
+
|
25
|
+
Mobile Email from a Cingular Wireless Customer http://www.cingular.com
|
@@ -0,0 +1,44 @@
|
|
1
|
+
X-Gmail-Received: 58ec38dd448cbbe3fa2ca3cc92bc3384a1c0442e
|
2
|
+
Delivered-To: tommy.tutone@example.com
|
3
|
+
Received: by 10.35.116.17 with SMTP id t17cs497674pym;
|
4
|
+
Wed, 25 Oct 2006 17:03:38 -0700 (PDT)
|
5
|
+
Received: by 10.65.180.7 with SMTP id h7mr1899344qbp;
|
6
|
+
Wed, 25 Oct 2006 17:03:38 -0700 (PDT)
|
7
|
+
Return-Path: <2068675309@pics.cingularme.com>
|
8
|
+
Received: from atlmtaow01.cingularme.com (atlmtaow01.cingularme.com [66.102.165.6])
|
9
|
+
|
10
|
+
Wed, 25 Oct 2006 17:03:38 -0700 (PDT)
|
11
|
+
Received-SPF: pass (google.com: domain of 2068675309@pics.cingularme.com designates 66.102.165.6 as permitted sender)
|
12
|
+
X-Mms-MMS-Version: 18
|
13
|
+
Date: Wed, 25 Oct 2006 20:03:37 -0400
|
14
|
+
X-Nokia-Ag-Internal: ; smiltype=true; internaldate=1161821017233
|
15
|
+
Content-Type: multipart/mixed; boundary="----=_Part_773748_29039988.1161821017355"
|
16
|
+
X-Mms-Delivery-Report: 0
|
17
|
+
Received: from alpagw01 ([209.183.34.196]) by atlmtaow01.cingularme.com (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20061026000337.PKXW18952.atlmtaow01.cingularme.com@alpagw01> for <tommy.tutone@example.com>; Wed, 25 Oct 2006 20:03:37 -0400
|
18
|
+
X-Mms-Transaction-ID: E0FE5F627738A9
|
19
|
+
From: <2068675309@pics.cingularme.com>
|
20
|
+
To: tommy.tutone@example.com
|
21
|
+
X-Mms-Message-Class: 0
|
22
|
+
X-Mms-Read-Reply: 1
|
23
|
+
Mime-Version: 1.0
|
24
|
+
Message-ID: <22965942.1161821017378.JavaMail.wluser@alpagw01>
|
25
|
+
X-Mms-Priority: 1
|
26
|
+
X-Mms-Message-Type: 0
|
27
|
+
Subject: Multimedia message
|
28
|
+
X-Nokia-Ag-Version: 2.0
|
29
|
+
|
30
|
+
------=_Part_773748_29039988.1161821017355
|
31
|
+
Content-Type: image/jpeg
|
32
|
+
Content-Transfer-Encoding: base64
|
33
|
+
Content-Location: 10252006.jpg
|
34
|
+
Content-Disposition: inline
|
35
|
+
|
36
|
+
/9j/4AAQSkZJRgABAQEASABIAAD/4QAWRXhpZgAATU0AKgAAAAgAAAAAAAD//gAXQ3JlYXRl
|
37
|
+
ZCB3aXRoIFRoZSBHSU1Q/9sAQwAFAwQEBAMFBAQEBQUFBgcMCAcHBwcPCwsJDBEPEhIRDxER
|
38
|
+
ExYcFxMUGhURERghGBodHR8fHxMXIiQiHiQcHh8e/9sAQwEFBQUHBgcOCAgOHhQRFB4eHh4e
|
39
|
+
Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4e/8AAEQgAAQAB
|
40
|
+
AwEiAAIRAQMRAf/EABUAAQEAAAAAAAAAAAAAAAAAAAAH/8QAFBABAAAAAAAAAAAAAAAAAAAA
|
41
|
+
AP/EABUBAQEAAAAAAAAAAAAAAAAAAAcI/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQAC
|
42
|
+
EQMRAD8AlgA6WW//2Q==
|
43
|
+
------=_Part_773748_29039988.1161821017355--
|
44
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Delivered-To: tommy.tutone@example.com
|
2
|
+
Received: by 10.150.57.8 with SMTP id f8cs65257yba;
|
3
|
+
Fri, 18 Apr 2008 21:41:30 -0700 (PDT)
|
4
|
+
Received: by 10.64.3.5 with SMTP id 5mr6524564qbc.42.1208580089389;
|
5
|
+
Fri, 18 Apr 2008 21:41:29 -0700 (PDT)
|
6
|
+
Return-Path: <SRS0=jU8yvZ=VE=tmo.blackberry.net=awindsor@srs.bis.na.blackberry.com>
|
7
|
+
Received: from smtp02.bis.na.blackberry.com (smtp02.bis.na.blackberry.com [216.9.248.49])
|
8
|
+
by mx.google.com with ESMTP id c6si658202qbc.11.2008.04.18.21.41.28;
|
9
|
+
Fri, 18 Apr 2008 21:41:29 -0700 (PDT)
|
10
|
+
Received-SPF: pass (google.com: domain of SRS0=jU8yvZ=VE=tmo.blackberry.net=awindsor@srs.bis.na.blackberry.com designates 216.9.248.49 as permitted sender) client-ip=216.9.248.49;
|
11
|
+
Authentication-Results: mx.google.com; spf=pass (google.com: domain of SRS0=jU8yvZ=VE=tmo.blackberry.net=awindsor@srs.bis.na.blackberry.com designates 216.9.248.49 as permitted sender) smtp.mail=SRS0=jU8yvZ=VE=tmo.blackberry.net=awindsor@srs.bis.na.blackberry.com
|
12
|
+
Received: from bxe011.bisx.prod.on.blackberry (bxe011.bisx.prod.on.blackberry [172.20.225.30])
|
13
|
+
by srs.bis.na.blackberry.com (8.13.7 TEAMON/8.13.7) with ESMTP id m3J4Y75g014164
|
14
|
+
for tommy.tutone@example.com; Sat, 19 Apr 2008 04:41:27 GMT
|
15
|
+
X-rim-org-msg-ref-id: 2032055546
|
16
|
+
Return-Receipt-To: 2068675309@tmo.blackberry.net
|
17
|
+
Message-ID: <2032055546-1208580087-cardhu_decombobulator_blackberry.rim.net-600368080-@bxe011.bisx.prod.on.blackberry>
|
18
|
+
Reply-To: 2068675309@tmo.blackberry.net
|
19
|
+
X-Priority: Normal
|
20
|
+
Sensitivity: Normal
|
21
|
+
Importance: Normal
|
22
|
+
To: tommy.tutone@example.com
|
23
|
+
Subject: IMG00440.jpg
|
24
|
+
From: 2068675309@tmo.blackberry.net
|
25
|
+
Date: Sat, 19 Apr 2008 04:38:59 +0000
|
26
|
+
Content-Type: multipart/mixed; boundary="part181419-boundary-1741380772-2064863822"
|
27
|
+
MIME-Version: 1.0
|
28
|
+
|
29
|
+
|
30
|
+
--part181419-boundary-1741380772-2064863822
|
31
|
+
Content-Type: text/plain
|
32
|
+
|
33
|
+
|
34
|
+
Sent via BlackBerry from T-Mobile
|
35
|
+
--part181419-boundary-1741380772-2064863822
|
36
|
+
Content-Transfer-Encoding: base64
|
37
|
+
Content-Type: image/jpeg
|
38
|
+
Content-Disposition: attachment; filename="=?Windows-1252?B?SU1HMDA0NDAuanBn?="
|
39
|
+
|
40
|
+
/9j/4AAQSkZJRgABAQEASABIAAD/4QAWRXhpZgAATU0AKgAAAAgAAAAAAAD//gAXQ3JlYXRl
|
41
|
+
ZCB3aXRoIFRoZSBHSU1Q/9sAQwAFAwQEBAMFBAQEBQUFBgcMCAcHBwcPCwsJDBEPEhIRDxER
|
42
|
+
ExYcFxMUGhURERghGBodHR8fHxMXIiQiHiQcHh8e/9sAQwEFBQUHBgcOCAgOHhQRFB4eHh4e
|
43
|
+
Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4e/8AAEQgAAQAB
|
44
|
+
AwEiAAIRAQMRAf/EABUAAQEAAAAAAAAAAAAAAAAAAAAH/8QAFBABAAAAAAAAAAAAAAAAAAAA
|
45
|
+
AP/EABUBAQEAAAAAAAAAAAAAAAAAAAcI/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQAC
|
46
|
+
EQMRAD8AlgA6WW//2Q==
|
47
|
+
|
48
|
+
--part181419-boundary-1741380772-2064863822--
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Return-Path: <2068675309@vmobile.ca>
|
2
|
+
X-Original-To: tommy.tutone@example.com
|
3
|
+
Delivered-To: tommy.tutone@example.com
|
4
|
+
Received: from E0100DaMtrMta03.bellmobilite.ca (txt.bellmobility.ca [206.47.78.138])
|
5
|
+
by corkboard.it (Postfix) with ESMTP id 259F0112BB9A
|
6
|
+
for <tommy.tutone@example.com>; Wed, 3 Dec 2008 16:37:58 -0500 (EST)
|
7
|
+
Received: from txt.bell.ca (erwdbmgejb01 [172.25.79.138])
|
8
|
+
by E0100DaMtrMta03.bellmobilite.ca (8.11.7p3+Sun/8.11.7) with ESMTP id mB3Lbr304876
|
9
|
+
for <tommy.tutone@example.com>; Wed, 3 Dec 2008 16:37:53 -0500 (EST)
|
10
|
+
Message-Id: <200812032137.mB3Lbr304876@E0100DaMtrMta03.bellmobilite.ca>
|
11
|
+
Date: 03 Dec 08 16:37:53 -0500
|
12
|
+
From: 2068675309@vmobile.ca
|
13
|
+
To: tommy.tutone@example.com
|
14
|
+
Importance: normal
|
15
|
+
|
16
|
+
Hello World
|
17
|
+
|
18
|
+
----------------------------------------------------------------
|
19
|
+
Sent by Text Messaging from a mobile device.
|
20
|
+
Envoy� par messagerie texte d'un appareil mobile.
|
21
|
+
----------------------------------------------------------------
|
data/test/test_1nbox_net.rb
CHANGED
data/test/test_mms2r_media.rb
CHANGED
@@ -118,7 +118,7 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
118
118
|
mail.expects(:header).at_least_once.returns({})
|
119
119
|
mail.expects(:from).at_least_once.returns(['joe@unknown.example.com'])
|
120
120
|
mms = MMS2R::Media.create(mail)
|
121
|
-
assert_equal MMS2R::Media, mms
|
121
|
+
assert_equal [MMS2R::Media, 'unknown.example.com'] , mms
|
122
122
|
end
|
123
123
|
|
124
124
|
def test_create_with_special_processor
|
@@ -127,15 +127,16 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
127
127
|
mail.expects(:header).at_least_once.returns({})
|
128
128
|
mail.expects(:from).at_least_once.returns(['joe@null.example.com'])
|
129
129
|
mms = MMS2R::Media.create(mail)
|
130
|
-
assert_equal MMS2R::Media::NullCarrier, mms
|
130
|
+
assert_equal [MMS2R::Media::NullCarrier, 'null.example.com'], mms
|
131
131
|
end
|
132
132
|
|
133
133
|
def test_create_with_special_processor_and_return_path
|
134
134
|
MMS2R.register('null.example.com', MMS2R::Media::NullCarrier)
|
135
135
|
mail = mock()
|
136
136
|
mail.expects(:header).at_least_once.returns({'return-path' => '<joe@null.example.com>'})
|
137
|
+
mail.expects(:from).at_least_once.returns([])
|
137
138
|
mms = MMS2R::Media.create(mail)
|
138
|
-
assert_equal MMS2R::Media::NullCarrier, mms
|
139
|
+
assert_equal [MMS2R::Media::NullCarrier, 'null.example.com'], mms
|
139
140
|
end
|
140
141
|
|
141
142
|
def test_create_should_fail_gracefully_with_broken_from
|
@@ -220,7 +221,7 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
220
221
|
assert_equal ['text/plain', ''], mms.transform_text('text/plain', "Sent via BlackBerry from T-Mobile")
|
221
222
|
assert_equal ['text/plain', ''], mms.transform_text('text/plain', "Sent from my Verizon Wireless BlackBerry")
|
222
223
|
assert_equal ['text/plain', ''], mms.transform_text('text/plain', 'Sent from my iPhone')
|
223
|
-
assert_equal ['text/plain', ''], mms.transform_text('text/plain', 'Sent from
|
224
|
+
assert_equal ['text/plain', ''], mms.transform_text('text/plain', 'Sent from your iPhone.')
|
224
225
|
assert_equal ['text/plain', ''], mms.transform_text('text/plain', " \n\nimage/jpeg")
|
225
226
|
|
226
227
|
# has a bad regexp
|
@@ -296,7 +297,9 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
296
297
|
mail = stub_mail()
|
297
298
|
mail.stubs(:subject).returns(s)
|
298
299
|
mms = MMS2R::Media.new(mail)
|
299
|
-
mms.stubs(:config).returns(
|
300
|
+
mms.stubs(:config).returns(
|
301
|
+
{ 'ignore' => {},
|
302
|
+
'transform' => {'text/plain' => [['/Default Subject: (.+)/', '\1']]}})
|
300
303
|
assert_equal 'hello world', mms.subject
|
301
304
|
end
|
302
305
|
|
@@ -423,17 +426,24 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
423
426
|
mms.stubs(:config).returns({'ignore' => {type => [name]}})
|
424
427
|
|
425
428
|
# type is not in the ingore
|
426
|
-
part = stub(:sub_header => name)
|
429
|
+
part = stub(:sub_header => name, :body => 'a')
|
427
430
|
assert_equal false, mms.ignore_media?('text/test', part)
|
428
431
|
# type and filename are in the ingore
|
429
432
|
part = stub(:sub_header => name)
|
430
433
|
assert_equal true, mms.ignore_media?(type, part)
|
431
434
|
# type but not file name are in the ignore
|
432
|
-
part = stub(:sub_header => 'bar.txt')
|
435
|
+
part = stub(:sub_header => 'bar.txt', :body => 'a')
|
433
436
|
assert_equal false, mms.ignore_media?(type, part)
|
434
437
|
end
|
435
438
|
|
436
439
|
def test_filename
|
440
|
+
name = 'x' * 300 + '.txt'
|
441
|
+
mms = MMS2R::Media.new(stub_mail())
|
442
|
+
part = stub(:sub_header => name, :content_type => 'text/plain')
|
443
|
+
assert_equal 'x' * 251 + '.txt', mms.filename?(part)
|
444
|
+
end
|
445
|
+
|
446
|
+
def test_long_filename
|
437
447
|
name = 'foo.txt'
|
438
448
|
mms = MMS2R::Media.new(stub_mail())
|
439
449
|
part = stub(:sub_header => name, :content_type => 'text/plain')
|
@@ -460,13 +470,13 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
460
470
|
mms.stubs(:config).returns({'ignore' => {type => [regexp, 'nil.txt']}})
|
461
471
|
|
462
472
|
# type is not in the ingore
|
463
|
-
part = stub(:sub_header => name)
|
473
|
+
part = stub(:sub_header => name, :body => 'a')
|
464
474
|
assert_equal false, mms.ignore_media?('text/test', part)
|
465
475
|
# type and regexp for the filename are in the ingore
|
466
476
|
part = stub(:sub_header => name)
|
467
477
|
assert_equal true, mms.ignore_media?(type, part)
|
468
478
|
# type but not regexp for filename are in the ignore
|
469
|
-
part = stub(:sub_header => 'bar.txt')
|
479
|
+
part = stub(:sub_header => 'bar.txt', :body => 'a')
|
470
480
|
assert_equal false, mms.ignore_media?(type, part)
|
471
481
|
end
|
472
482
|
|
@@ -684,4 +694,67 @@ class TestMms2rMedia < Test::Unit::TestCase
|
|
684
694
|
mms.purge
|
685
695
|
end
|
686
696
|
|
697
|
+
def test_domain_from_return_path
|
698
|
+
mail = mock()
|
699
|
+
mail.expects(:header).at_least_once.returns({'return-path' => '<joe@null.example.com>'})
|
700
|
+
mail.expects(:from).at_least_once.returns([])
|
701
|
+
domain = MMS2R::Media.domain(mail)
|
702
|
+
assert_equal 'null.example.com', domain
|
703
|
+
end
|
704
|
+
|
705
|
+
def test_domain_from_from
|
706
|
+
mail = mock()
|
707
|
+
mail.expects(:header).at_least_once.returns({})
|
708
|
+
mail.expects(:from).at_least_once.returns(['joe@null.example.com'])
|
709
|
+
domain = MMS2R::Media.domain(mail)
|
710
|
+
assert_equal 'null.example.com', domain
|
711
|
+
end
|
712
|
+
|
713
|
+
def test_domain_from_from_yaml
|
714
|
+
f = File.join(MMS2R::Media.conf_dir, 'from.yml')
|
715
|
+
YAML.expects(:load_file).once.with(f).returns(['example.com'])
|
716
|
+
mail = mock()
|
717
|
+
mail.expects(:header).at_least_once.returns({'return-path' => '<joe@null.example.com>'})
|
718
|
+
mail.expects(:from).at_least_once.returns(['joe@example.com'])
|
719
|
+
domain = MMS2R::Media.domain(mail)
|
720
|
+
assert_equal 'example.com', domain
|
721
|
+
end
|
722
|
+
|
723
|
+
def test_unknown_device_type
|
724
|
+
mail = TMail::Mail.load(mail_fixture('generic.mail'))
|
725
|
+
mms = MMS2R::Media.new(mail)
|
726
|
+
assert_equal :unknown, mms.device_type?
|
727
|
+
assert_equal false, mms.is_mobile?
|
728
|
+
end
|
729
|
+
|
730
|
+
def test_iphone_device_type
|
731
|
+
mail = TMail::Mail.load(mail_fixture('att-iphone-01.mail'))
|
732
|
+
mms = MMS2R::Media.new(mail)
|
733
|
+
assert_equal :iphone, mms.device_type?
|
734
|
+
assert_equal true, mms.is_mobile?
|
735
|
+
end
|
736
|
+
|
737
|
+
def test_blackberry_device_type
|
738
|
+
berries = ['att-blackberry.mail',
|
739
|
+
'suncom-blackberry.mail',
|
740
|
+
'tmobile-blackberry-02.mail',
|
741
|
+
'tmobile-blackberry.mail',
|
742
|
+
'tmo.blackberry.net-image-01.mail',
|
743
|
+
'verizon-blackberry.mail',
|
744
|
+
'verizon-blackberry.mail']
|
745
|
+
berries.each do |berry|
|
746
|
+
mail = TMail::Mail.load(mail_fixture(berry))
|
747
|
+
mms = MMS2R::Media.new(mail)
|
748
|
+
assert_equal :blackberry, mms.device_type?, "fixture #{berry} was not a blackberrry"
|
749
|
+
assert_equal true, mms.is_mobile?
|
750
|
+
end
|
751
|
+
end
|
752
|
+
|
753
|
+
def test_handset_device_type
|
754
|
+
mail = TMail::Mail.load(mail_fixture('att-image-01.mail'))
|
755
|
+
mms = MMS2R::Media.new(mail)
|
756
|
+
assert_equal :handset, mms.device_type?
|
757
|
+
assert_equal true, mms.is_mobile?
|
758
|
+
end
|
759
|
+
|
687
760
|
end
|
data/test/test_mms_att_net.rb
CHANGED
@@ -113,4 +113,30 @@ class TestMmsAttNet < Test::Unit::TestCase
|
|
113
113
|
assert_not_nil mms.media['image/jpeg'].first
|
114
114
|
assert_match(/IMG00367.jpg/, mms.media['image/jpeg'].first)
|
115
115
|
end
|
116
|
+
|
117
|
+
def test_mobile_mycingular_com
|
118
|
+
# mobile.mycingular.com service
|
119
|
+
mail = TMail::Mail.parse(load_mail('mobile.mycingular.com-text-01.mail').join)
|
120
|
+
mms = MMS2R::Media.new(mail)
|
121
|
+
|
122
|
+
assert_equal 'mobile.mycingular.com', mms.carrier
|
123
|
+
assert_equal 1, mms.media.size
|
124
|
+
assert_not_nil(mms.media['text/plain'])
|
125
|
+
assert_equal "I hate people that send text messages about skateboarding.", IO.read(mms.media['text/plain'][0])
|
126
|
+
|
127
|
+
mms.purge
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_pics_cingularme_com
|
131
|
+
# pics.cingularme.com service
|
132
|
+
mail = TMail::Mail.parse(load_mail('pics.cingularme.com-image-01.mail').join)
|
133
|
+
mms = MMS2R::Media.new(mail)
|
134
|
+
|
135
|
+
|
136
|
+
# TODO this fixture is either mailformed or exposes a tmail problem
|
137
|
+
# since its legacy content fix if necessary
|
138
|
+
assert_equal 'pics.cingularme.com', mms.carrier
|
139
|
+
|
140
|
+
mms.purge
|
141
|
+
end
|
116
142
|
end
|
data/test/test_tmomail_net.rb
CHANGED
@@ -6,7 +6,7 @@ require 'mocha'
|
|
6
6
|
gem 'tmail', '>= 1.2.1'
|
7
7
|
require 'tmail'
|
8
8
|
|
9
|
-
class
|
9
|
+
class TestTmomailNet < Test::Unit::TestCase
|
10
10
|
include MMS2R::TestHelper
|
11
11
|
|
12
12
|
def test_ignore_simple_image
|
@@ -85,6 +85,24 @@ class TestTmobileNet < Test::Unit::TestCase
|
|
85
85
|
file = mms.default_media
|
86
86
|
assert_equal 'Image002.jpg', file.original_filename
|
87
87
|
|
88
|
-
|
88
|
+
mms.purge
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_tmo_blackberry_net
|
92
|
+
mail = TMail::Mail.parse(load_mail('tmo.blackberry.net-image-01.mail').join)
|
93
|
+
mms = MMS2R::Media.new(mail)
|
94
|
+
|
95
|
+
assert_equal '2068675309', mms.number
|
96
|
+
assert_equal 'IMG00440.jpg', mms.subject
|
97
|
+
assert_equal 'tmo.blackberry.net', mms.carrier
|
98
|
+
|
99
|
+
assert_equal 1, mms.media.size
|
100
|
+
assert_equal 1, mms.media['image/jpeg'].size
|
101
|
+
|
102
|
+
assert_file_size mms.media['image/jpeg'][0], 337
|
103
|
+
file = mms.default_media
|
104
|
+
assert_equal '=?Windows-1252?B?SU1HMDA0NDAuanBn?=.jpg', file.original_filename
|
105
|
+
|
106
|
+
mms.purge
|
89
107
|
end
|
90
108
|
end
|
data/test/test_unicel_com.rb
CHANGED
data/test/test_vmpix_com.rb
CHANGED
@@ -43,4 +43,14 @@ class TestVmpixCom < Test::Unit::TestCase
|
|
43
43
|
mms.purge
|
44
44
|
end
|
45
45
|
|
46
|
+
def test_only_valid_content_should_be_retained_for_virgin_canada_text
|
47
|
+
mail = TMail::Mail.parse(load_mail('virgin.ca-text-01.mail').join)
|
48
|
+
mms = MMS2R::Media.new(mail)
|
49
|
+
assert_equal 'vmobile.ca', mms.carrier
|
50
|
+
assert_equal 1, mms.media.size
|
51
|
+
assert_equal 1, mms.media['text/plain'].size
|
52
|
+
assert_equal "Hello World", IO.read(mms.media['text/plain'][0]).strip
|
53
|
+
mms.purge
|
54
|
+
end
|
55
|
+
|
46
56
|
end
|
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Mondragon
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-04 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.8.2
|
44
44
|
version:
|
45
|
-
description: "== DESCRIPTION MMS2R is a library that decodes the parts of an MMS message to disk while stripping out advertising injected by the mobile carriers. MMS messages are multipart email and the carriers often inject branding into these messages. Use MMS2R if you want to get at the real user generated content from a MMS without having to deal with the cruft from the carriers. If MMS2R is not aware of a particular carrier no extra processing is done to the MMS other than decoding and consolidating its media. Contact the author to add additional carriers to be processed by the library. Suggestions and patches appreciated and welcomed! Corpus of carriers currently processed by MMS2R: * 1nbox/Idea: 1nbox.net * 3 Ireland: mms.3ireland.ie * Alltel: mms.alltel.com * AT&T/Cingular/Legacy: mms.att.net, txt.att.net, mmode.com, mms.mycingular.com, cingularme.com * Bell Canada: txt.bell.ca * Bell South / Suncom: bellsouth.net * Cricket Wireless: mms.mycricket.com * Dobson/Cellular One: mms.dobson.net * Helio: mms.myhelio.com * Hutchison 3G UK Ltd: mms.three.co.uk * INDOSAT M2: mobile.indosat.net.id * LUXGSM S.A.: mms.luxgsm.lu * Maroc Telecom / mms.mobileiam.ma * MTM South Africa: mms.mtn.co.za * NetCom (Norway): mms.netcom.no * Nextel: messaging.nextel.com * O2 Germany: mms.o2online.de * O2 UK: mediamessaging.o2.co.uk * Orange & Regional Oranges: orangemms.net, mmsemail.orange.pl, orange.fr * PLSPICTURES.COM mms hosting: waw.plspictures.com * PXT New Zealand: pxt.vodafone.net.nz * Rogers of Canada: rci.rogers.com * SaskTel: sms.sasktel.com * Sprint: pm.sprint.com, messaging.sprintpcs.com * T-Mobile: tmomail.net, mmsreply.t-mobile.co.uk * TELUS Corporation (Canada): mms.telusmobility.com, msg.telus.com * UAE MMS: mms.ae * Unicel: unicel.com, info2go.com (note: mobile number is tucked away in a text/plain part for unicel.com) * Verizon: vzwpix.com, vtext.com * Virgin Mobile: vmpix.com * Vodacom: mms.vodacom4me.co.za"
|
45
|
+
description: "== DESCRIPTION MMS2R is a library that decodes the parts of an MMS message to disk while stripping out advertising injected by the mobile carriers. MMS messages are multipart email and the carriers often inject branding into these messages. Use MMS2R if you want to get at the real user generated content from a MMS without having to deal with the cruft from the carriers. If MMS2R is not aware of a particular carrier no extra processing is done to the MMS other than decoding and consolidating its media. Contact the author to add additional carriers to be processed by the library. Suggestions and patches appreciated and welcomed! Corpus of carriers currently processed by MMS2R: * 1nbox/Idea: 1nbox.net * 3 Ireland: mms.3ireland.ie * Alltel: mms.alltel.com * AT&T/Cingular/Legacy: mms.att.net, txt.att.net, mmode.com, mms.mycingular.com, cingularme.com, mobile.mycingular.com pics.cingularme.com * Bell Canada: txt.bell.ca * Bell South / Suncom: bellsouth.net * Cricket Wireless: mms.mycricket.com * Dobson/Cellular One: mms.dobson.net * Helio: mms.myhelio.com * Hutchison 3G UK Ltd: mms.three.co.uk * INDOSAT M2: mobile.indosat.net.id * LUXGSM S.A.: mms.luxgsm.lu * Maroc Telecom / mms.mobileiam.ma * MTM South Africa: mms.mtn.co.za * NetCom (Norway): mms.netcom.no * Nextel: messaging.nextel.com * O2 Germany: mms.o2online.de * O2 UK: mediamessaging.o2.co.uk * Orange & Regional Oranges: orangemms.net, mmsemail.orange.pl, orange.fr * PLSPICTURES.COM mms hosting: waw.plspictures.com * PXT New Zealand: pxt.vodafone.net.nz * Rogers of Canada: rci.rogers.com * SaskTel: sms.sasktel.com * Sprint: pm.sprint.com, messaging.sprintpcs.com, sprintpcs.com * T-Mobile: tmomail.net, mmsreply.t-mobile.co.uk, tmo.blackberry.net * TELUS Corporation (Canada): mms.telusmobility.com, msg.telus.com * UAE MMS: mms.ae * Unicel: unicel.com, info2go.com (note: mobile number is tucked away in a text/plain part for unicel.com) * Verizon: vzwpix.com, vtext.com * Virgin Mobile: vmpix.com * Virgin Mobile of Canada: vmobile.ca * Vodacom: mms.vodacom4me.co.za"
|
46
46
|
email: mikemondragon@gmail.com
|
47
47
|
executables: []
|
48
48
|
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- conf/1nbox.net.yml
|
62
62
|
- conf/aliases.yml
|
63
63
|
- conf/bellsouth.net.yml
|
64
|
+
- conf/from.yml
|
64
65
|
- conf/mediamessaging.o2.co.uk.yml
|
65
66
|
- conf/messaging.nextel.com.yml
|
66
67
|
- conf/mms.3ireland.ie.yml
|
@@ -121,6 +122,7 @@ files:
|
|
121
122
|
- test/fixtures/cingularme-text-02.mail
|
122
123
|
- test/fixtures/dobson-image-01.mail
|
123
124
|
- test/fixtures/dot.jpg
|
125
|
+
- test/fixtures/generic.mail
|
124
126
|
- test/fixtures/helio-image-01.mail
|
125
127
|
- test/fixtures/helio-message-01.mail
|
126
128
|
- test/fixtures/iconv-fr-text-01.mail
|
@@ -135,6 +137,7 @@ files:
|
|
135
137
|
- test/fixtures/mms.mycricket.com-pic-and-text.mail
|
136
138
|
- test/fixtures/mms.mycricket.com-pic.mail
|
137
139
|
- test/fixtures/mmsreply.t-mobile.co.uk-text-image-01.mail
|
140
|
+
- test/fixtures/mobile.mycingular.com-text-01.mail
|
138
141
|
- test/fixtures/mtn-southafrica-mms.mail
|
139
142
|
- test/fixtures/mycingular-image-01.mail
|
140
143
|
- test/fixtures/netcom-image-01.mail
|
@@ -147,6 +150,7 @@ files:
|
|
147
150
|
- test/fixtures/orangefrance-text-and-image.mail
|
148
151
|
- test/fixtures/orangepoland-text-01.mail
|
149
152
|
- test/fixtures/orangepoland-text-02.mail
|
153
|
+
- test/fixtures/pics.cingularme.com-image-01.mail
|
150
154
|
- test/fixtures/pxt-image-01.mail
|
151
155
|
- test/fixtures/rogers-canada-mms-01.mail
|
152
156
|
- test/fixtures/sasktel-image-01.mail
|
@@ -161,6 +165,7 @@ files:
|
|
161
165
|
- test/fixtures/suncom-blackberry.mail
|
162
166
|
- test/fixtures/telus-image-01.mail
|
163
167
|
- test/fixtures/three-uk-image-01.mail
|
168
|
+
- test/fixtures/tmo.blackberry.net-image-01.mail
|
164
169
|
- test/fixtures/tmobile-blackberry-02.mail
|
165
170
|
- test/fixtures/tmobile-blackberry.mail
|
166
171
|
- test/fixtures/tmobile-image-01.mail
|
@@ -173,6 +178,7 @@ files:
|
|
173
178
|
- test/fixtures/verizon-text-01.mail
|
174
179
|
- test/fixtures/verizon-video-01.mail
|
175
180
|
- test/fixtures/virgin-mobile-image-01.mail
|
181
|
+
- test/fixtures/virgin.ca-text-01.mail
|
176
182
|
- test/fixtures/vodacom4me-co-za-01.mail
|
177
183
|
- test/fixtures/vodacom4me-co-za-02.mail
|
178
184
|
- test/fixtures/vodacom4me-southafrica-mms-01.mail
|
@@ -241,43 +247,43 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
247
|
requirements: []
|
242
248
|
|
243
249
|
rubyforge_project: mms2r
|
244
|
-
rubygems_version: 1.
|
250
|
+
rubygems_version: 1.3.1
|
245
251
|
signing_key:
|
246
252
|
specification_version: 2
|
247
253
|
summary: Extract user media from MMS (and not carrier cruft)
|
248
254
|
test_files:
|
249
|
-
- test/
|
250
|
-
- test/
|
251
|
-
- test/test_mms_mycricket_com.rb
|
252
|
-
- test/test_mobile_indosat_net_id.rb
|
253
|
-
- test/test_unicel_com.rb
|
255
|
+
- test/test_mms_o2online_de.rb
|
256
|
+
- test/test_helper.rb
|
254
257
|
- test/test_pm_sprint_com.rb
|
258
|
+
- test/test_sms_sasktel_com.rb
|
259
|
+
- test/test_mms_mobileiam_ma.rb
|
260
|
+
- test/test_msg_telus_com.rb
|
255
261
|
- test/test_messaging_sprintpcs_com.rb
|
256
|
-
- test/
|
257
|
-
- test/test_mms_alltel_com.rb
|
258
|
-
- test/test_mms2r_media.rb
|
259
|
-
- test/test_waw_plspictures_com.rb
|
260
|
-
- test/test_mms_ae.rb
|
262
|
+
- test/test_mms_myhelio_com.rb
|
261
263
|
- test/test_mms_3ireland_ie.rb
|
262
|
-
- test/
|
263
|
-
- test/test_bellsouth_net.rb
|
264
|
-
- test/test_mms_o2online_de.rb
|
264
|
+
- test/test_mms_ae.rb
|
265
265
|
- test/test_mms_att_net.rb
|
266
|
+
- test/test_mediamessaging_o2_co_uk.rb
|
267
|
+
- test/test_bell_canada.rb
|
268
|
+
- test/test_mms_mtn_co_za.rb
|
269
|
+
- test/test_vmpix_com.rb
|
270
|
+
- test/test_github.rb
|
271
|
+
- test/test_vzwpix_com.rb
|
272
|
+
- test/test_bellsouth_net.rb
|
273
|
+
- test/test_unicel_com.rb
|
274
|
+
- test/test_waw_plspictures_com.rb
|
275
|
+
- test/test_mms_luxgsm_lu.rb
|
266
276
|
- test/test_mms_netcom_no.rb
|
277
|
+
- test/test_mms_mycricket_com.rb
|
278
|
+
- test/test_mms2r_media.rb
|
267
279
|
- test/test_rci_rogers_com.rb
|
268
|
-
- test/
|
280
|
+
- test/test_messaging_nextel_com.rb
|
281
|
+
- test/test_mms_vodacom4me_co_za.rb
|
269
282
|
- test/test_tmomail_net.rb
|
270
|
-
- test/
|
283
|
+
- test/test_1nbox_net.rb
|
284
|
+
- test/test_pxt_vodafone_net_nz.rb
|
285
|
+
- test/test_mobile_indosat_net_id.rb
|
271
286
|
- test/test_mms_three_co_uk.rb
|
287
|
+
- test/test_mms_alltel_com.rb
|
272
288
|
- test/test_mms_dobson_net.rb
|
273
|
-
- test/test_mms_luxgsm_lu.rb
|
274
|
-
- test/test_bell_canada.rb
|
275
|
-
- test/test_github.rb
|
276
289
|
- test/test_orangemms_net.rb
|
277
|
-
- test/test_helper.rb
|
278
|
-
- test/test_vmpix_com.rb
|
279
|
-
- test/test_mms_mobileiam_ma.rb
|
280
|
-
- test/test_messaging_nextel_com.rb
|
281
|
-
- test/test_mediamessaging_o2_co_uk.rb
|
282
|
-
- test/test_1nbox_net.rb
|
283
|
-
- test/test_mms_vodacom4me_co_za.rb
|