mms2r 1.0.7 → 1.1.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/History.txt +19 -1
- data/Manifest.txt +38 -19
- data/README.txt +40 -8
- data/Rakefile +2 -2
- data/conf/mms2r_cingular_me_media_subject.yml +3 -0
- data/conf/{mms2r_cingularmedia_transform.yml → mms2r_cingular_me_media_transform.yml} +1 -0
- data/conf/mms2r_dobson_media_ignore.yml +4 -0
- data/conf/mms2r_media_ignore.yml +4 -0
- data/conf/mms2r_media_subject.yml +3 -0
- data/conf/mms2r_my_cingular_media_subject.yml +3 -0
- data/conf/mms2r_nextel_media_ignore.yml +11 -0
- data/conf/mms2r_sprint_media_ignore.yml +5 -0
- data/conf/mms2r_sprint_media_subject.yml +3 -0
- data/conf/{mms2r_tmobilemedia_ignore.yml → mms2r_t_mobile_media_ignore.yml} +2 -5
- data/conf/mms2r_verizon_media_ignore.yml +4 -0
- data/conf/mms2r_verizon_media_transform.yml +6 -0
- data/dev_tools/debug_sprint_hpricot_parsing.rb +82 -0
- data/lib/mms2r.rb +61 -0
- data/lib/mms2r/cingular_me_media.rb +23 -0
- data/lib/mms2r/dobson_media.rb +4 -5
- data/lib/mms2r/{mmode_media.rb → m_mode_media.rb} +4 -4
- data/lib/mms2r/media.rb +283 -160
- data/lib/mms2r/my_cingular_media.rb +15 -0
- data/lib/mms2r/nextel_media.rb +9 -3
- data/lib/mms2r/sprint_media.rb +137 -29
- data/lib/mms2r/sprint_pcs_media.rb +16 -0
- data/lib/mms2r/t_mobile_media.rb +21 -0
- data/lib/mms2r/verizon_media.rb +11 -3
- data/lib/mms2r/vtext_media.rb +16 -0
- data/test/files/cingularme-text-02.mail +14 -0
- data/test/files/hello_world_empty_text.mail +6 -0
- data/test/files/hello_world_mail_multipart.mail +7 -0
- data/test/files/{cingular-image-01.mail → mycingular-image-01.mail} +0 -0
- data/test/files/simple-with-two-images-two-texts.mail +49 -0
- data/test/files/{sprint-image-02.mail → sprint-broken-image-01.mail} +1 -1
- data/test/files/sprint-image-01.mail +1 -1
- data/test/files/sprint-pcs-text-01.mail +8 -0
- data/test/files/sprint-text-01.mail +195 -8
- data/test/files/sprint-two-images-01.mail +198 -0
- data/test/files/sprint-video-01.mail +1 -1
- data/test/files/verizon-image-02.mail +1 -1
- data/test/files/vtext-text-01.mail +1 -1
- data/test/test_mms2r_cingular_me_media.rb +51 -0
- data/test/test_mms2r_dobson_media.rb +46 -0
- data/test/{test_mms2r_mmode.rb → test_mms2r_m_mode_media.rb} +1 -1
- data/test/test_mms2r_media.rb +160 -74
- data/test/test_mms2r_my_cingular_media.rb +31 -0
- data/test/test_mms2r_nextel_media.rb +100 -0
- data/test/test_mms2r_sprint_media.rb +221 -0
- data/test/test_mms2r_sprint_pcs_media.rb +27 -0
- data/test/{test_mms2r_tmobile.rb → test_mms2r_t_mobile_media.rb} +13 -13
- data/test/test_mms2r_verizon_media.rb +96 -0
- data/test/test_mms2r_vtext_media.rb +28 -0
- data/vendor/plugins/mms2r/lib/autotest/discover.rb +3 -0
- data/vendor/plugins/mms2r/lib/autotest/mms2r.rb +33 -0
- metadata +62 -37
- data/conf/mms2r_nextelmedia_ignore.yml +0 -10
- data/conf/mms2r_sprintmedia_ignore.yml +0 -10
- data/conf/mms2r_verizonmedia_ignore.yml +0 -3
- data/conf/mms2r_verizonmedia_transform.yml +0 -3
- data/lib/mms2r/cingular_media.rb +0 -11
- data/lib/mms2r/tmobile_media.rb +0 -11
- data/lib/mms2r/version.rb +0 -12
- data/test/test_mms2r_cingular.rb +0 -58
- data/test/test_mms2r_dobson.rb +0 -36
- data/test/test_mms2r_nextel.rb +0 -132
- data/test/test_mms2r_sprint.rb +0 -174
- data/test/test_mms2r_verizon.rb +0 -102
data/History.txt
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
== 1.1.0 / 2007-06-08 (Toki Wartooth)
|
2
|
+
|
3
|
+
* get_body to return body text (Luke Francl)
|
4
|
+
* get_subject returns "" for default subjects now
|
5
|
+
* default subjects listed in yaml by carrier in conf directory
|
6
|
+
* added granularity to Cingular, Sprint, and Verizon carrier services (Will Jessup)
|
7
|
+
* refactored Sprint instance to process all media (Will Jessup + Mike)
|
8
|
+
* optimized text transformations (Will Jessup)
|
9
|
+
* properly handle ISO-8859-1 and UTF-8 text (Will Jessup)
|
10
|
+
* autotest powers activate! (ZenTest autotest discovery enabled)
|
11
|
+
* configuration file ignores, transforms, and subjects all store Regexp's
|
12
|
+
* Put vendor Text::Format & TMail::Mail as an external subversion dependency
|
13
|
+
to the 1.2 stable branch of Rails ActionMailer
|
14
|
+
* added get_number method to return the phone number associated with this MMS
|
15
|
+
* get_media and get_text attachment_fu helper return the largest piece of media
|
16
|
+
of that type if the more than one exits in the media (Luke Francl)
|
17
|
+
* added block support to process() method (Shane Vitarana)
|
18
|
+
|
1
19
|
== 1.0.7 / 2007-04-27 (Senator Stampingston)
|
2
20
|
|
3
21
|
* patch submitted by Luke Francl
|
@@ -20,7 +38,7 @@
|
|
20
38
|
* made ignore_media? start its text check from the start of the file (Luke)
|
21
39
|
* added new text transform for Verizon messages (Luke)
|
22
40
|
* updated Nextel ignore conf (Luke)
|
23
|
-
* added
|
41
|
+
* added additional samples and tests for T-Mobile & Verizon (Luke)
|
24
42
|
* cleaned up MMS2R::Media documentation
|
25
43
|
* added Sprint broken image test for when media goes stale on their content server
|
26
44
|
* fixed teardown typo in lots of plases
|
data/Manifest.txt
CHANGED
@@ -2,22 +2,31 @@ History.txt
|
|
2
2
|
Manifest.txt
|
3
3
|
README.txt
|
4
4
|
Rakefile
|
5
|
-
conf/
|
6
|
-
conf/
|
7
|
-
conf/
|
8
|
-
conf/
|
9
|
-
conf/
|
10
|
-
conf/
|
5
|
+
conf/mms2r_cingular_me_media_subject.yml
|
6
|
+
conf/mms2r_cingular_me_media_transform.yml
|
7
|
+
conf/mms2r_dobson_media_ignore.yml
|
8
|
+
conf/mms2r_media_ignore.yml
|
9
|
+
conf/mms2r_media_subject.yml
|
10
|
+
conf/mms2r_my_cingular_media_subject.yml
|
11
|
+
conf/mms2r_nextel_media_ignore.yml
|
12
|
+
conf/mms2r_sprint_media_ignore.yml
|
13
|
+
conf/mms2r_sprint_media_subject.yml
|
14
|
+
conf/mms2r_t_mobile_media_ignore.yml
|
15
|
+
conf/mms2r_verizon_media_ignore.yml
|
16
|
+
conf/mms2r_verizon_media_transform.yml
|
17
|
+
dev_tools/debug_sprint_hpricot_parsing.rb
|
11
18
|
lib/mms2r.rb
|
12
|
-
lib/mms2r/
|
19
|
+
lib/mms2r/cingular_me_media.rb
|
13
20
|
lib/mms2r/dobson_media.rb
|
21
|
+
lib/mms2r/m_mode_media.rb
|
14
22
|
lib/mms2r/media.rb
|
15
|
-
lib/mms2r/
|
23
|
+
lib/mms2r/my_cingular_media.rb
|
16
24
|
lib/mms2r/nextel_media.rb
|
17
25
|
lib/mms2r/sprint_media.rb
|
18
|
-
lib/mms2r/
|
26
|
+
lib/mms2r/sprint_pcs_media.rb
|
27
|
+
lib/mms2r/t_mobile_media.rb
|
19
28
|
lib/mms2r/verizon_media.rb
|
20
|
-
lib/mms2r/
|
29
|
+
lib/mms2r/vtext_media.rb
|
21
30
|
lib/vendor/text/format.rb
|
22
31
|
lib/vendor/tmail.rb
|
23
32
|
lib/vendor/tmail/address.rb
|
@@ -42,23 +51,28 @@ lib/vendor/tmail/scanner_r.rb
|
|
42
51
|
lib/vendor/tmail/stringio.rb
|
43
52
|
lib/vendor/tmail/tmail.rb
|
44
53
|
lib/vendor/tmail/utils.rb
|
45
|
-
test/files/cingular-image-01.mail
|
46
54
|
test/files/cingularme-text-01.mail
|
55
|
+
test/files/cingularme-text-02.mail
|
47
56
|
test/files/dobson-image-01.mail
|
48
57
|
test/files/dot.jpg
|
58
|
+
test/files/hello_world_empty_text.mail
|
49
59
|
test/files/hello_world_mail_multipart.mail
|
50
60
|
test/files/hello_world_mail_plain_no_content_type.mail
|
51
61
|
test/files/hello_world_mail_plain_with_content_type.mail
|
52
62
|
test/files/mmode-image-01.mail
|
63
|
+
test/files/mycingular-image-01.mail
|
53
64
|
test/files/nextel-image-01.mail
|
54
65
|
test/files/nextel-image-02.mail
|
55
66
|
test/files/nextel-image-03.mail
|
56
67
|
test/files/nextel-image-04.mail
|
68
|
+
test/files/simple-with-two-images-two-texts.mail
|
57
69
|
test/files/simple_image.mail
|
58
70
|
test/files/simple_multipart_alternative.mail
|
71
|
+
test/files/sprint-broken-image-01.mail
|
59
72
|
test/files/sprint-image-01.mail
|
60
|
-
test/files/sprint-
|
73
|
+
test/files/sprint-pcs-text-01.mail
|
61
74
|
test/files/sprint-text-01.mail
|
75
|
+
test/files/sprint-two-images-01.mail
|
62
76
|
test/files/sprint-video-01.mail
|
63
77
|
test/files/sprint.mov
|
64
78
|
test/files/tmobile-image-01.mail
|
@@ -69,11 +83,16 @@ test/files/verizon-text-01.mail
|
|
69
83
|
test/files/verizon-video-01.mail
|
70
84
|
test/files/vtext-text-01.mail
|
71
85
|
test/test_helper.rb
|
72
|
-
test/
|
73
|
-
test/
|
86
|
+
test/test_mms2r_cingular_me_media.rb
|
87
|
+
test/test_mms2r_dobson_media.rb
|
88
|
+
test/test_mms2r_m_mode_media.rb
|
74
89
|
test/test_mms2r_media.rb
|
75
|
-
test/
|
76
|
-
test/
|
77
|
-
test/
|
78
|
-
test/
|
79
|
-
test/
|
90
|
+
test/test_mms2r_my_cingular_media.rb
|
91
|
+
test/test_mms2r_nextel_media.rb
|
92
|
+
test/test_mms2r_sprint_media.rb
|
93
|
+
test/test_mms2r_sprint_pcs_media.rb
|
94
|
+
test/test_mms2r_t_mobile_media.rb
|
95
|
+
test/test_mms2r_verizon_media.rb
|
96
|
+
test/test_mms2r_vtext_media.rb
|
97
|
+
vendor/plugins/mms2r/lib/autotest/discover.rb
|
98
|
+
vendor/plugins/mms2r/lib/autotest/mms2r.rb
|
data/README.txt
CHANGED
@@ -8,7 +8,7 @@ MMS2R is a library that decodes the parts of an MMS message to disk while
|
|
8
8
|
stripping out advertising injected by the cellphone carriers. MMS messages are
|
9
9
|
multipart email and the carriers often inject branding into these messages. Use
|
10
10
|
MMS2R if you want to get at the real user generated content from a MMS without
|
11
|
-
having to deal with the
|
11
|
+
having to deal with the cruft from the carriers.
|
12
12
|
|
13
13
|
If MMS2R is not aware of a particular carrier no extra processing is done
|
14
14
|
to the MMS other than decoding and consolidating its media.
|
@@ -31,15 +31,18 @@ Corpus of carriers currently processed by MMS2R:
|
|
31
31
|
|
32
32
|
== FEATURES
|
33
33
|
|
34
|
-
* TMail from 1.3.1 of ActionMailer is shipped as a vendor library with MMS2R
|
35
34
|
* get_media and get_text methods return a File that can be used in attachment_fu
|
35
|
+
|
36
36
|
== SYNOPSIS:
|
37
37
|
|
38
|
+
# required to use the MMS2R gem proper
|
38
39
|
require 'rubygems'
|
39
40
|
require 'mms2r'
|
40
|
-
|
41
|
+
|
42
|
+
# required for the example
|
41
43
|
require 'tmail'
|
42
44
|
require 'fileutils'
|
45
|
+
require 'logger'
|
43
46
|
|
44
47
|
# TMail::Mail.parse is what ActionMailer::Base.receive(email) does, see:
|
45
48
|
# http://wiki.rubyonrails.com/rails/pages/HowToReceiveEmailsWithActionMailer
|
@@ -50,14 +53,17 @@ Corpus of carriers currently processed by MMS2R:
|
|
50
53
|
# writes the user generated media to disk in a temporary subdirectory
|
51
54
|
mms.process
|
52
55
|
|
53
|
-
puts "MMS has default carrier subject!" if mms.get_subject.
|
56
|
+
puts "MMS has default carrier subject!" if mms.get_subject.eql?("")
|
57
|
+
|
58
|
+
# access the senders phone number
|
59
|
+
puts "MMS was from phone #{mms.get_number}"
|
54
60
|
|
55
|
-
# most MMS are either image or video, get_media will
|
56
|
-
#
|
61
|
+
# most MMS are either image or video, get_media will return the largest
|
62
|
+
# (non-advertising) video or image found
|
57
63
|
file = mms.get_media
|
58
64
|
puts "MMS had a media: #{file.inspect}" unless file.nil?
|
59
65
|
|
60
|
-
# get_text
|
66
|
+
# get_text return the largest (non-advertising) text found
|
61
67
|
file = mms.get_text
|
62
68
|
puts "MMS had some text: #{file.inspect}" unless file.nil?
|
63
69
|
|
@@ -80,6 +86,14 @@ Corpus of carriers currently processed by MMS2R:
|
|
80
86
|
#remove all the media that was put to temporary disk
|
81
87
|
mms.purge
|
82
88
|
|
89
|
+
# Block support, process and receive all media types of video.
|
90
|
+
# Purge is called at the conclusion of the block so be sure
|
91
|
+
# to do something with the bits you are looking for
|
92
|
+
mms.process do |media_type, files|
|
93
|
+
# assumes a Clip model
|
94
|
+
Clip.create(:uploaded_data => files.first, :title => "From phone") if media_type =~ /video/
|
95
|
+
end
|
96
|
+
|
83
97
|
== REQUIREMENTS:
|
84
98
|
|
85
99
|
* Hpricot
|
@@ -88,15 +102,33 @@ Corpus of carriers currently processed by MMS2R:
|
|
88
102
|
|
89
103
|
* sudo gem install mms2r
|
90
104
|
|
105
|
+
== CONTRIBUTE:
|
106
|
+
|
107
|
+
If you contribute a patch that we accept then generally we'll
|
108
|
+
give you developer rights for the project on RubyForge. Please
|
109
|
+
ensure your work includes 100% test converage. Your text
|
110
|
+
coverage can be verified with the rcov rake task. The library
|
111
|
+
is ZenTest autotest discovery enabled so running autotest in the
|
112
|
+
root of the project is very helpful during development.
|
113
|
+
|
91
114
|
== Authors
|
92
115
|
|
93
116
|
Copyright (c) 2007 by Mike Mondragon (blog[http://blog.mondragon.cc/])
|
94
117
|
|
118
|
+
MMS2R's Flickr page[http://www.flickr.com/photos/8627919@N05/]
|
119
|
+
|
120
|
+
== Contributors
|
121
|
+
|
122
|
+
* Luke Francl (blog[http://railspikes.com/])
|
123
|
+
* Will Jessup (blog[http://www.willjessup.com/])
|
124
|
+
* Shane Vitarana (blog[http://www.shanesbrain.net/])
|
125
|
+
|
95
126
|
== LICENSE:
|
96
127
|
|
97
128
|
(The MIT License)
|
98
129
|
|
99
|
-
Copyright (c) 2007 Mike Mondragon
|
130
|
+
Copyright (c) 2007 Mike Mondragon (mikemondragon@gmail.com).
|
131
|
+
All rights reserved.
|
100
132
|
|
101
133
|
Permission is hereby granted, free of charge, to any person obtaining
|
102
134
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -11,8 +11,8 @@ require 'mms2r/media'
|
|
11
11
|
Hoe.new('mms2r', MMS2R::Media::VERSION) do |p|
|
12
12
|
p.rubyforge_name = 'mms2r'
|
13
13
|
p.author = 'Mike Mondragon'
|
14
|
-
p.email = '
|
15
|
-
p.summary = 'Extract media from MMS'
|
14
|
+
p.email = 'mikemondragon@gmail.com'
|
15
|
+
p.summary = 'Extract user media from MMS (and not carrier cruft)'
|
16
16
|
p.description = p.paragraphs_of('README.txt', 2..6).join("\n\n")
|
17
17
|
p.url = p.paragraphs_of('README.txt', 1).first.strip
|
18
18
|
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
text/plain:
|
3
|
+
- !ruby/regexp /^This is an MMS message. 20\d\d Sprint Nextel. All rights reserved./
|
4
|
+
- !ruby/regexp /^This is an MMS message. Please go to http:\/\/mms.nextel.com\/mms\/anon\/do\/legacy\/viewDirect/
|
5
|
+
- !ruby/regexp /^This is a multi-part message in MIME format./
|
6
|
+
text/html:
|
7
|
+
- !ruby/regexp /^<html><body> This is an MMS message. <br><center> 20\d\d Sprint Nextel. All rights reserved <br><\/center> <\/body><\/html>/
|
8
|
+
- !ruby/regexp /^<html><body> <center>This is an MMS message. <br><center> 20\d\d Sprint Nextel. All rights reserved<\/center><br><img/
|
9
|
+
- !ruby/regexp /^<html><body> This is an MMS message. <br><center> 20\d\d Sprint Nextel. All rights reserved<\/center> <\/body><\/html>/
|
10
|
+
- !ruby/regexp /^<html><body> This is an MMS message. Please go to <a href="http:\/\/mms.nextel.com\/mms\/anon\/do\/legacy\/viewDirect/
|
11
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'hpricot'
|
3
|
+
require 'net/http'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'hpricot'
|
6
|
+
require 'pp'
|
7
|
+
|
8
|
+
if ARGV[0].nil?
|
9
|
+
puts "please execute with a file path to a Sprint HTML file that was extracted from a MMS"
|
10
|
+
puts "ruby #{$0} MYFILE"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
|
14
|
+
doc = open(ARGV[0]) { |f| Hpricot(f) }
|
15
|
+
|
16
|
+
puts "TITLE: #{doc.at('title').inner_html}"
|
17
|
+
|
18
|
+
#phone number is tucked away in the comment in the head
|
19
|
+
c = doc.search("/html/head/comment//").last
|
20
|
+
t = c.content.gsub(/\s+/m," ").strip
|
21
|
+
number = / name="MDN">(\d+)</.match(t)[1]
|
22
|
+
puts "NUMBER: #{number}"
|
23
|
+
|
24
|
+
#if there is a text message with the MMS its in the
|
25
|
+
#inner html of the only pre on the page
|
26
|
+
text = doc.search("/html/body//pre").first.inner_html
|
27
|
+
puts "TEXT: #{text}"
|
28
|
+
|
29
|
+
# just see what they say this MMS is it really doesn't
|
30
|
+
# mean anything, the content is in paux image with
|
31
|
+
# a RECIPIENT in its URI path
|
32
|
+
trs = doc.search("/html/body//tr")
|
33
|
+
text = trs[3].search("/td/p/font/b/")
|
34
|
+
case text.text
|
35
|
+
when /You have a Video Mail from/
|
36
|
+
puts "it claims to be a video"
|
37
|
+
when /You have a Picture Mail from /
|
38
|
+
puts "it claims to be an image"
|
39
|
+
else
|
40
|
+
puts "what is it? #{text.text}"
|
41
|
+
end
|
42
|
+
|
43
|
+
# group all the images together
|
44
|
+
srcs = Array.new
|
45
|
+
imgs = doc.search("/html/body//img")
|
46
|
+
imgs.each do |i|
|
47
|
+
src = i.attributes['src']
|
48
|
+
#next unless /pictures.sprintpcs.com\/+mmps\/RECIPIENT\//.match(src)
|
49
|
+
#we don't want to double fetch content and we only
|
50
|
+
#want to fetch media from the content server, you get
|
51
|
+
#a clue about that as there is a RECIPIENT in the URI path
|
52
|
+
next unless /mmps\/RECIPIENT\//.match(src)
|
53
|
+
next if srcs.detect{|s| s.eql?(src)}
|
54
|
+
srcs << src
|
55
|
+
end
|
56
|
+
|
57
|
+
# now fetch the media
|
58
|
+
puts "there are #{srcs.size} sources to fetch"
|
59
|
+
cnt = 0
|
60
|
+
srcs.each do |src|
|
61
|
+
puts "--"
|
62
|
+
puts "FETCHING:\n #{src}"
|
63
|
+
|
64
|
+
url = URI.parse(src)
|
65
|
+
#res = Net::HTTP.get_response(url)
|
66
|
+
agent = "Mozilla/5.0 (X11; U; Minix3 i686 (x86_64); en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1"
|
67
|
+
res = Net::HTTP.start(url.host, url.port) { |http|
|
68
|
+
req = Net::HTTP::Get.new(url.request_uri, {'User-Agent' => agent})
|
69
|
+
http.request(req)
|
70
|
+
}
|
71
|
+
|
72
|
+
# prep and write a file
|
73
|
+
base = /\/RECIPIENT\/([^\/]+)\//.match(src)[1]
|
74
|
+
ext = /^[^\/]+\/(.+)/.match(res.content_type)[1]
|
75
|
+
file_name ="#{base}.#{cnt}.#{ext}"
|
76
|
+
puts "writing file: #{file_name}"
|
77
|
+
File.open(file_name,'w'){ |f| f.write(res.body) }
|
78
|
+
puts "file is sized #{File.size(file_name)}"
|
79
|
+
cnt = cnt + 1
|
80
|
+
end
|
81
|
+
|
82
|
+
puts "no images or video" if srcs.size == 0
|
data/lib/mms2r.rb
CHANGED
@@ -1,3 +1,64 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2007 by Mike Mondragon (mikemondragon@gmail.com)
|
3
|
+
#
|
4
|
+
# Please see the LICENSE file for licensing information.
|
5
|
+
#++
|
6
|
+
|
1
7
|
$:.unshift(File.dirname(__FILE__) + "/vendor/")
|
8
|
+
require 'mms2r/media'
|
9
|
+
require 'mms2r/cingular_me_media'
|
10
|
+
require 'mms2r/dobson_media'
|
11
|
+
require 'mms2r/m_mode_media'
|
12
|
+
require 'mms2r/my_cingular_media'
|
13
|
+
require 'mms2r/nextel_media'
|
14
|
+
require 'mms2r/sprint_media'
|
15
|
+
require 'mms2r/sprint_pcs_media'
|
16
|
+
require 'mms2r/t_mobile_media'
|
17
|
+
require 'mms2r/verizon_media'
|
18
|
+
require 'mms2r/vtext_media'
|
19
|
+
|
2
20
|
module MMS2R
|
21
|
+
|
22
|
+
##
|
23
|
+
# A hash of carriers that MMS2r is currently aware of.
|
24
|
+
# The factory create method uses the hostname portion
|
25
|
+
# of an MMS's From header to select the correct type
|
26
|
+
# of MMS2R::Media product. If a specific media product
|
27
|
+
# is not available MMS2R::Media should be used.
|
28
|
+
|
29
|
+
CARRIER_CLASSES = {
|
30
|
+
'cingularme.com' => MMS2R::CingularMeMedia,
|
31
|
+
'mms.dobson.net' => MMS2R::DobsonMedia,
|
32
|
+
'mmode.com' => MMS2R::MModeMedia,
|
33
|
+
'mms.mycingular.com' => MMS2R::MyCingularMedia,
|
34
|
+
'messaging.nextel.com' => MMS2R::NextelMedia,
|
35
|
+
'pm.sprint.com' => MMS2R::SprintMedia,
|
36
|
+
'messaging.sprintpcs.com' => MMS2R::SprintPcsMedia,
|
37
|
+
'tmomail.net' => MMS2R::TMobileMedia,
|
38
|
+
'vzwpix.com' => MMS2R::VerizonMedia,
|
39
|
+
'vtext.com' => MMS2R::VtextMedia
|
40
|
+
}
|
41
|
+
|
42
|
+
##
|
43
|
+
# A hash of file extensions for common mimetypes
|
44
|
+
|
45
|
+
EXT = {
|
46
|
+
'text/plain' => 'txt',
|
47
|
+
'text/html' => 'html',
|
48
|
+
'image/png' => 'png',
|
49
|
+
'image/gif' => 'gif',
|
50
|
+
'image/jpeg' => 'jpg',
|
51
|
+
'video/quicktime' => 'mov',
|
52
|
+
'video/3gpp2' => '3g2'
|
53
|
+
}
|
54
|
+
|
55
|
+
class MMS2R::Media
|
56
|
+
|
57
|
+
##
|
58
|
+
# MMS2R Library version
|
59
|
+
|
60
|
+
VERSION = '1.1.0'
|
61
|
+
|
62
|
+
end
|
63
|
+
|
3
64
|
end
|