mms2r 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ # -*- ruby -*-
2
+
3
+ source :gemcutter
4
+
5
+ gem "nokogiri", ">=1.4.4"
6
+ gem "mail", ">=2.2.10"
7
+ gem "uuidtools", ">=2.1.1"
8
+ gem "exifr", ">=1.0.3"
9
+
10
+ gem "rubyforge", ">=2.0.4", :group => [:development, :test]
11
+ gem "gemcutter", ">=0.4.1", :group => [:development, :test]
12
+ gem "hoe", ">=2.5.0", :group => [:development, :test]
13
+
14
+ group :test do
15
+ gem 'test-unit', '= 1.2.3'
16
+ gem 'mocha'
17
+ end
18
+
19
+ # vim: syntax=ruby
data/Gemfile.lock ADDED
@@ -0,0 +1,42 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.0.3)
5
+ exifr (1.0.3)
6
+ gemcutter (0.6.1)
7
+ hoe (2.8.0)
8
+ rake (>= 0.8.7)
9
+ i18n (0.5.0)
10
+ json_pure (1.4.6)
11
+ mail (2.2.13)
12
+ activesupport (>= 2.3.6)
13
+ i18n (>= 0.4.0)
14
+ mime-types (~> 1.16)
15
+ treetop (~> 1.4.8)
16
+ mime-types (1.16)
17
+ mocha (0.9.10)
18
+ rake
19
+ nokogiri (1.4.4)
20
+ polyglot (0.3.1)
21
+ rake (0.8.7)
22
+ rubyforge (2.0.4)
23
+ json_pure (>= 1.1.7)
24
+ test-unit (1.2.3)
25
+ hoe (>= 1.5.1)
26
+ treetop (1.4.9)
27
+ polyglot (>= 0.3.1)
28
+ uuidtools (2.1.1)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ exifr (>= 1.0.3)
35
+ gemcutter (>= 0.4.1)
36
+ hoe (>= 2.5.0)
37
+ mail (>= 2.2.10)
38
+ mocha
39
+ nokogiri (>= 1.4.4)
40
+ rubyforge (>= 2.0.4)
41
+ test-unit (= 1.2.3)
42
+ uuidtools (>= 2.1.1)
data/History.txt CHANGED
@@ -1,3 +1,15 @@
1
+ ### 3.3.0 / 2010-12-31 (Charles Foster Offdensen - CFO, dethklok)
2
+
3
+ * 1 major enhancement
4
+ * MMS2R::Media::Sprint is now a module that is extended in for processing
5
+ Sprint content rather than being child class of MMS2R::Media
6
+ Extension is the strategy to use for overwriting template methods now
7
+
8
+ * 1 minor enhancement
9
+ * process new Sprint subject - Jason Hooper
10
+ * new SaskTel mms/sms domain alias sasktel.com
11
+ * new Virgin Mobile mms/sms domain alias yrmobl.com
12
+
1
13
  ### 3.2.0 / 2010-08-17 (Antonio "Tony" DiMarco Thunderbottom - bassist)
2
14
 
3
15
  * 3 minor enhancements
data/Manifest.txt CHANGED
@@ -1,4 +1,6 @@
1
1
  .gitignore
2
+ Gemfile
3
+ Gemfile.lock
2
4
  History.txt
3
5
  Manifest.txt
4
6
  README.TMail.txt
@@ -106,6 +108,7 @@ test/fixtures/rogers-canada-mms-01.mail
106
108
  test/fixtures/sasktel-image-01.mail
107
109
  test/fixtures/sprint-broken-image-01.mail
108
110
  test/fixtures/sprint-image-01.mail
111
+ test/fixtures/sprint-new-image-01.mail
109
112
  test/fixtures/sprint-pcs-text-01.mail
110
113
  test/fixtures/sprint-purged-image-01.mail
111
114
  test/fixtures/sprint-text-01.mail
data/README.txt CHANGED
@@ -48,7 +48,7 @@ Corpus of carriers currently processed by MMS2R:
48
48
  * PLSPICTURES.COM mms hosting: waw.plspictures.com
49
49
  * PXT New Zealand: pxt.vodafone.net.nz
50
50
  * Rogers of Canada: rci.rogers.com
51
- * SaskTel: sms.sasktel.com
51
+ * SaskTel: sasktel.com, sms.sasktel.com
52
52
  * Sprint: pm.sprint.com, messaging.sprintpcs.com, sprintpcs.com
53
53
  * T-Mobile: tmomail.net, mmsreply.t-mobile.co.uk, tmo.blackberry.net
54
54
  * TELUS Corporation (Canada): mms.telusmobility.com, msg.telus.com
@@ -57,7 +57,7 @@ Corpus of carriers currently processed by MMS2R:
57
57
  * Unicel: unicel.com, info2go.com
58
58
  (note: mobile number is tucked away in a text/plain part for unicel.com)
59
59
  * Verizon: vzwpix.com, vtext.com
60
- * Virgin Mobile: vmpix.com, pixmbl.com, vmobl.com
60
+ * Virgin Mobile: vmpix.com, pixmbl.com, vmobl.com, yrmobl.com
61
61
  * Virgin Mobile of Canada: vmobile.ca
62
62
  * Vodacom: mms.vodacom4me.co.za
63
63
 
@@ -159,7 +159,7 @@ http://peepcode.com/products/mms2r-pdf
159
159
  # inspect default media's exif data if exifr gem is installed and default
160
160
  # media is a jpeg or tiff
161
161
  puts "mail's default media's exif data is:"
162
- puts mms.exif.inspect
162
+ puts mail.exif.inspect
163
163
 
164
164
  # Block support, process and receive all media types of video.
165
165
  mail.process do |media_type, files|
data/Rakefile CHANGED
@@ -14,6 +14,7 @@ end
14
14
 
15
15
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "lib")
16
16
  require 'mms2r'
17
+ require 'rake'
17
18
 
18
19
  Hoe.plugin :bundler
19
20
  Hoe.spec('mms2r') do |p|
@@ -25,10 +26,12 @@ Hoe.spec('mms2r') do |p|
25
26
  p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
26
27
  p.url = p.paragraphs_of('README.txt', 1).first.strip
27
28
  p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
28
- p.extra_deps << ['nokogiri', '>= 1.4.0']
29
- p.extra_deps << ['mail', '>= 2.2.5']
29
+ p.readme_file = 'README.txt'
30
+ p.history_file = 'History.txt'
31
+ p.extra_deps << ['nokogiri', '>= 1.4.4']
32
+ p.extra_deps << ['mail', '>= 2.2.10']
30
33
  p.extra_deps << ['uuidtools', '>= 2.1.1']
31
- p.extra_deps << ['exifr', '>= 1.0.1']
34
+ p.extra_deps << ['exifr', '>= 1.0.3']
32
35
  p.clean_globs << 'coverage'
33
36
  end
34
37
 
@@ -43,11 +46,4 @@ rescue
43
46
  task :rcov => :check_dependencies
44
47
  end
45
48
 
46
- RDoc::Task.new do |rdoc|
47
- rdoc.title = "mms2r-#{MMS2R::Media::VERSION}"
48
- rdoc.rdoc_dir = 'doc'
49
- rdoc.options << '-f' << 'horo'
50
- rdoc.options << '--main' << 'README.txt'
51
- end
52
-
53
49
  # vim: syntax=Ruby
data/conf/aliases.yml CHANGED
@@ -14,7 +14,9 @@ mmsreply.t-mobile.co.uk: tmomail.net
14
14
  tmo.blackberry.net: tmomail.net
15
15
  info2go.com: unicel.com
16
16
  mms.telusmobility.com: msg.telus.com
17
+ sasktel.com: sms.sasktel.com
17
18
  sprintpcs.com: pm.sprint.com
18
19
  pixmbl.com: vmpix.com
19
20
  vmobile.ca: vmpix.com
20
21
  vmobl.com: vmpix.com
22
+ yrmobl.com: vmpix.com
@@ -8,5 +8,7 @@ transform:
8
8
  text/plain:
9
9
  - - /^You have new Picture Mail!$/i
10
10
  - ""
11
+ - - /^New Message$/i
12
+ - ""
11
13
  - - /^PictureMail$/i
12
14
  - ""
data/lib/mms2r.rb CHANGED
@@ -39,7 +39,7 @@ module MMS2R
39
39
  ##
40
40
  # MMS2R library version
41
41
 
42
- VERSION = '3.2.0'
42
+ VERSION = '3.3.0'
43
43
 
44
44
  end
45
45
 
@@ -55,7 +55,7 @@ end
55
55
 
56
56
  %W{ mail fileutils pathname tmpdir yaml uuidtools iconv exifr }.each do |g|
57
57
  begin
58
- gem 'mail', '= 2.2.5' if g == 'mail'
58
+ gem 'mail', '= 2.2.13' if g == 'mail'
59
59
  require g
60
60
  rescue LoadError
61
61
  require 'rubygems'
data/lib/mms2r/media.rb CHANGED
@@ -107,17 +107,6 @@ module MMS2R
107
107
 
108
108
  class MMS2R::Media
109
109
 
110
- class << self #:nodoc:
111
- # alias new so that we can use ::create to select the media processor and
112
- # then initialize the new object
113
- alias orig_new new
114
- def new(mail, opts = {})
115
- klass, carrier = MMS2R::Media.create(mail)
116
- opts[:domain] = carrier
117
- klass.orig_new(mail, opts)
118
- end
119
- end
120
-
121
110
  # Pass off everything we don't do to the Mail object
122
111
  # TODO: refactor to explicit addition a la http://blog.jayfields.com/2008/02/ruby-replace-methodmissing-with-dynamic.html
123
112
  def method_missing method, *args, &block
@@ -147,20 +136,6 @@ module MMS2R
147
136
 
148
137
  attr_reader :media_dir
149
138
 
150
- ##
151
- # Factory method that creates MMS2R::Media products based on the domain
152
- # name of the carrier from which the MMS originated. mail is a Mail
153
- # object.
154
-
155
- def self.create(mail)
156
- d = lambda{ ['mms2r.media', MMS2R::Media] } #sets a default to detect
157
- from_domain = self.domain(mail)
158
- processor = MMS2R::CARRIERS.detect(d) do |domain, klass|
159
- return klass, domain if from_domain == domain
160
- end
161
- [MMS2R::Media, from_domain]
162
- end
163
-
164
139
  ##
165
140
  # Determine if return-path or from is going to be used to desiginate the
166
141
  # origin carrier. If the domain in the From header is listed in
@@ -183,7 +158,7 @@ module MMS2R
183
158
  ''
184
159
  end
185
160
 
186
- f = File.join(self.conf_dir(), "from.yml")
161
+ f = File.expand_path(File.join(self.conf_dir(), "from.yml"))
187
162
  from = YAML::load_file(f) rescue {}
188
163
 
189
164
  ret = case
@@ -213,10 +188,11 @@ module MMS2R
213
188
  @mail = mail
214
189
  @logger = opts[:logger]
215
190
  log("#{self.class} created", :info)
216
- @carrier = opts[:domain]
191
+ @carrier = self.class.domain(mail)
217
192
  @dir_count = 0
218
- @media_dir = File.join(self.tmp_dir(),
219
- "#{self.safe_message_id(@mail.message_id)}_#{UUIDTools::UUID.random_create}")
193
+ @media_dir = File.expand_path(
194
+ File.join(self.tmp_dir(),
195
+ "#{self.safe_message_id(@mail.message_id)}_#{UUIDTools::UUID.random_create}"))
220
196
  @media = {}
221
197
  @was_processed = false
222
198
  @number = nil
@@ -226,14 +202,17 @@ module MMS2R
226
202
  @default_media = nil
227
203
  @default_text = nil
228
204
 
229
- f = File.join(self.conf_dir(), "aliases.yml")
205
+ f = File.expand_path(File.join(self.conf_dir(), "aliases.yml"))
230
206
  @aliases = YAML::load_file(f) rescue {}
231
207
 
232
208
  conf = "#{@aliases[@carrier] || @carrier}.yml"
233
- f = File.join(self.conf_dir(), conf)
209
+ f = File.expand_path(File.join(self.conf_dir(), conf))
234
210
  c = YAML::load_file(f) rescue {}
235
211
  @config = self.class.initialize_config(c)
236
212
 
213
+ processor_module = MMS2R::CARRIERS[@carrier]
214
+ extend processor_module if processor_module
215
+
237
216
  lazy = (opts[:process] == :lazy) rescue false
238
217
  self.process() unless lazy
239
218
  end
@@ -475,7 +454,7 @@ module MMS2R
475
454
 
476
455
  def temp_file(part)
477
456
  file_name = filename?(part)
478
- File.join(msg_tmp_dir(),File.basename(file_name))
457
+ File.expand_path(File.join(msg_tmp_dir(),File.basename(file_name)))
479
458
  end
480
459
 
481
460
  ##
@@ -501,7 +480,7 @@ module MMS2R
501
480
 
502
481
  def msg_tmp_dir()
503
482
  @dir_count += 1
504
- dir = File.join(@media_dir, "#{@dir_count}")
483
+ dir = File.expand_path(File.join(@media_dir, "#{@dir_count}"))
505
484
  FileUtils.mkdir_p(dir)
506
485
  dir
507
486
  end
@@ -578,8 +557,9 @@ module MMS2R
578
557
  end
579
558
  end
580
559
 
581
- return :handset if File.exist?(File.join(self.conf_dir,
582
- "#{self.aliases[self.carrier] || self.carrier}.yml"))
560
+ return :handset if File.exist?( File.expand_path(
561
+ File.join(self.conf_dir, "#{self.aliases[self.carrier] || self.carrier}.yml")
562
+ ) )
583
563
 
584
564
  :unknown
585
565
  end
@@ -603,7 +583,7 @@ module MMS2R
603
583
  # Get the temporary directory where media files are written to.
604
584
 
605
585
  def self.tmp_dir
606
- @@tmp_dir ||= File.join(Dir.tmpdir, (ENV['USER'].nil? ? '':ENV['USER']), 'mms2r')
586
+ @@tmp_dir ||= File.expand_path(File.join(Dir.tmpdir, (ENV['USER'].nil? ? '':ENV['USER']), 'mms2r'))
607
587
  end
608
588
 
609
589
  ##
@@ -616,7 +596,7 @@ module MMS2R
616
596
  # Get the directory where conf files are stored.
617
597
 
618
598
  def self.conf_dir
619
- @@conf_dir ||= File.join(File.dirname(__FILE__), '..', '..', 'conf')
599
+ @@conf_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'conf'))
620
600
  end
621
601
 
622
602
  ##
@@ -650,7 +630,7 @@ module MMS2R
650
630
  # configuration.
651
631
 
652
632
  def self.initialize_config(c)
653
- f = File.join(self.conf_dir(), "mms2r_media.yml")
633
+ f = File.expand_path(File.join(self.conf_dir(), "mms2r_media.yml"))
654
634
  conf = YAML::load_file(f) rescue {}
655
635
  conf['ignore'] ||= {} unless conf['ignore']
656
636
  conf['transform'] = {} unless conf['transform']
@@ -25,7 +25,7 @@ module MMS2R
25
25
  # The default subject on these messages from the
26
26
  # carrier is "You have new Picture Mail!"
27
27
 
28
- class Sprint < MMS2R::Media
28
+ module Sprint
29
29
 
30
30
  ##
31
31
  # Override process() because Sprint doesn't attach media (images, video,
@@ -0,0 +1,171 @@
1
+ Return-Path: <someuser@pm.sprint.com>
2
+ X-Original-To: tommytutone@example.com
3
+ Delivered-To: tommytutone@example.com
4
+ Received: from smtp04.sun3.lightsurf.net (smtp.sun3.lightsurf.net [63.215.195.131])
5
+ by mail.pressfactory.com (Postfix) with ESMTP id B2B2A9B818E
6
+ for <someuser@staging.example.com>; Wed, 15 Sep 2010 17:46:35 -0500 (CDT)
7
+ Received: from pcs-nams006 (pcs-mmsc.sun3.lightsurf.net [10.0.0.152])
8
+ by smtp04.sun3.lightsurf.net (8.12.11.20060308/8.12.11) with ESMTP id o8FMkD1x021419
9
+ for <jhooper@staging.the773.com>; Wed, 15 Sep 2010 15:46:34 -0700
10
+ Date: Wed, 15 Sep 2010 15:46:34 -0700
11
+ Message-ID: <13279090.1284590794315.JavaMail.lsadm@pcs-nams006>
12
+ From: "someuser@pm.sprint.com" <someuser@pm.sprint.com>
13
+ To: tommytutone@example.com
14
+ Subject: New Message
15
+ MIME-Version: 1.0
16
+ Content-Type: multipart/alternative;
17
+ boundary="----=_Part_1414209_33449409.1284590794315"
18
+ X-Priority: 3
19
+ X-MSMail-Priority: Normal
20
+ Importance: Normal
21
+
22
+ ------=_Part_1414209_33449409.1284590794315
23
+ Content-Type: text/plain; charset=us-ascii
24
+ Content-Transfer-Encoding: 7bit
25
+
26
+ New Picture Mail from {SENDER_ADDRESS}!
27
+
28
+ Click Go/View to see.
29
+ http://pictures.sprintpcs.com/?mivt=qEzrz87zPk5JehF8a7Ro&shareName=MMS
30
+
31
+ _frsthgl
32
+
33
+
34
+ ------=_Part_1414209_33449409.1284590794315
35
+ Content-Type: text/html
36
+ Content-Transfer-Encoding: 7bit
37
+
38
+ <html>
39
+ <head><title>You have new Picture Mail!</title>
40
+ <!-- lsPictureMail-Share-qEzrz87zPk5JehF8a7Ro-comment
41
+ &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF&#45;8&quot;?&gt;
42
+ &lt;shareMessage&gt;
43
+ &lt;messageContents type=&quot;PICTURE&quot;&gt;
44
+ &lt;messageText&gt;&lt;/messageText&gt;
45
+ &lt;mediaItems&gt;
46
+ &lt;mediaItem id=&quot;1&quot;&gt;
47
+ &lt;title&gt;&lt;/title&gt;
48
+ &amp;lt;url&amp;gt;http://pictures.sprintpcs.com/getMMBOXMessageMedia?id=Xw1004H8sLv6S3x76lVPYtnvoa0u8lsCOxfK6ET0QRzlHsYxJBqo8gmk5gW%2FZUWGqyw0fwJJvr5P%0AFLU5A%2FvywOmVt7fzsEh1qaCiCTlPZhWGkNKbb8WqPOCIziOJasq%2FFnEStrmwlGcgabRtSp%2Bg9A%3D%3D%0A&amp;lt;/url&amp;gt;
49
+
50
+ &lt;urlExpiration&gt;2010&#45;09&#45;22T22:46:34Z&lt;/urlExpiration&gt;
51
+ &lt;/mediaItem&gt;
52
+ &lt;/mediaItems&gt;
53
+ &lt;/messageContents&gt;
54
+ &lt;/shareMessage&gt;
55
+
56
+ -->
57
+ <!-- lsPictureMail-UserInfo-qEzrz87zPk5JehF8a7Ro-comment
58
+ &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF&#45;8&quot;?&gt;
59
+ &lt;UserInfo timestamp=&quot;2010&#45;09&#45;15T22:46:34.312+00:00&quot; originating_from_address=&quot;someuser@pm.sprint.com&quot;&gt;&lt;credential name=&quot;MDN&quot;&gt;2068675309&lt;/credential&gt;&lt;/UserInfo&gt;
60
+ -->
61
+ </head>
62
+ <body marginheight="0" marginwidth="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
63
+ <table border="0" width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" >
64
+ <tr>
65
+ <td VALIGN="top" colspan="2" width="100%">
66
+ <div style="border-bottom:1px solid rgb(156, 154, 156); padding:20px 0px 20px 10px"><a href="http://www.sprintpcs.com"><img src="http://pictures.sprintpcs.com/retailers/PCSNEXTEL/ui-refresh/images/logo/sprint-logo-white.jpg" alt="" border="0" /></a></div>
67
+ </td>
68
+ </tr>
69
+ <tr>
70
+ <td VALIGN="top" colspan="2">
71
+ <table border="0" cellpadding="0" cellspacing="0" width="590" bgcolor="#FFFFFF">
72
+ <tr>
73
+ <td><br/><p><img src="http://pictures.sprintpcs.com/images/x.gif" border="0" width="10"/><font face="trebuchet ms, Helvetica, Arial, Verdana" size="2"><b>You have a Picture Mail from someuser@pm.sprint.com</b></font><br/><br/></p></td>
74
+ </tr>
75
+ </table>
76
+ </td>
77
+ </tr>
78
+ <tr>
79
+ <td colspan="2">
80
+ <table border="0" width="590" cellpadding="0" cellspacing="0">
81
+ <tr>
82
+ <td width="10">&nbsp;</td>
83
+ <td width="280" valign="top">
84
+ <table border="0" cellpadding="0" style="border:1px solid #9C9A9C;">
85
+ <tr>
86
+ <td>
87
+ <table border="0" bgcolor="#ffffff" cellpadding="0" cellspacing="7" style="table-layout:fixed">
88
+ <tr>
89
+ <td align="center">
90
+ <img src="http://pictures.sprintpcs.com//mmps/RECIPIENT/007_207a642442f51088_1/2?inviteToken=qEzrz87zPk5JehF8a7Ro&amp;limitsize=258,258&amp;outquality=90&amp;squareoutput=255,255,255&amp;ext=.jpg&amp;iconifyVideo=true&amp;wm=1"/>
91
+ </td>
92
+ </tr>
93
+ </table>
94
+ </td>
95
+ </tr>
96
+ </table>
97
+ </td>
98
+ <td width="20">&nbsp;</td>
99
+ <td VALIGN="top" align="right" width="280">
100
+ <table border="0" cellpadding="0" cellspacing="0" width="280" style="table-layout:fixed">
101
+ <tr>
102
+ <td><p><font face="trebuchet ms, Helvetica, Arial, Verdana" size="2"><b>Message:</b></font></p></td>
103
+ </tr>
104
+ <tr>
105
+ <td><pre style="overflow:auto; font:normal 10pt trebuchet ms; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"></pre></td>
106
+ </tr>
107
+ <tr>
108
+ <td><img src="http://pictures.sprintpcs.com/images/x.gif" border="0" height="15"/></td>
109
+ </tr>
110
+ <tr>
111
+ <td width="280">
112
+ <div style="padding:0px; background-color:#fff; font: normal 10pt trebuchet ms" width="280">
113
+ <a target="_blank" style="color: #148AB2;" href="http://pictures.sprintpcs.com/share.do?invite=qEzrz87zPk5JehF8a7Ro&amp;shareName=MMS&amp;messageState=RETRIEVED">View Entire Message</a>
114
+ <br/><br/>
115
+ Send and receive Pictures and Videos through Picture Mail<sup>SM</sup>. For more information go to <a target="_blank" style="color: #148AB2;" href="http://www.sprint.com/picturemail">www.sprint.com/picturemail.</a>
116
+ </div>
117
+ </td>
118
+ </tr>
119
+ </table>
120
+ </td>
121
+ </tr>
122
+ </table>
123
+ </td>
124
+ </tr>
125
+ <tr>
126
+ <td>
127
+ <table>
128
+ <tr>
129
+ <td>
130
+ <div style="font: normal 10pt trebuchet ms;margin-top:10px;">Please be aware your friends can forward your picture, video, and album share invitations to others or post the unique Web link to your share invitation on any number of sources (e.g. blogs), through which others could also gain access to your online photos. If you have private or sensitive photos you are sharing, please share them only with those you trust.</div>
131
+ </td>
132
+ </tr>
133
+ </table>
134
+ </td>
135
+ </tr>
136
+ <tr>
137
+ <td colspan="2">
138
+ <img src="http://pictures.sprintpcs.com/images/x.gif" width="5" height="45"/>
139
+ </td>
140
+ </tr>
141
+ <tr>
142
+ <td VALIGN="top" colspan="2" width="590">
143
+ <img src="http://pictures.sprintpcs.com/images/x.gif" height="5"/>
144
+ </td>
145
+ </tr>
146
+ <tr>
147
+ <td VALIGN="top" colspan="2" width="100%">
148
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
149
+ <tr>
150
+ <td bgcolor="#ffffff" width="100%">
151
+ <div style="border-top:1px solid rgb(156, 154, 156)">&nbsp;</div>
152
+ </td>
153
+ </tr>
154
+ <tr>
155
+ <td>
156
+ <div style="float:left"><img src="http://pictures.sprintpcs.com/retailers/PCSNEXTEL/ui-refresh/images/logo/syniverse.gif" alt="Syniverse" border="0" /></div>
157
+ <div style="float:right; padding-right:5px"><span style="font-family:trebuchet ms, Helvetica, Arial, Verdana; Font-size: 11px; Color: #000000">&#169; 2010 Sprint. All rights reserved.</span></div>
158
+ </td>
159
+ </tr>
160
+ <tr>
161
+ <td bgcolor="#ffffff" width="100%"><img src="http://pictures.sprintpcs.com/images/x.gif" border="0" height="10"/></td>
162
+ </tr>
163
+ </table>
164
+ </td>
165
+ </tr>
166
+ </table>
167
+ </body>
168
+ </html><!-- legacy_mms_arrived.txt -->
169
+
170
+ ------=_Part_1414209_33449409.1284590794315--
171
+
@@ -3,8 +3,6 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
3
3
  class TestMms2rMedia < Test::Unit::TestCase
4
4
  include MMS2R::TestHelper
5
5
 
6
- class MMS2R::Media::NullCarrier < MMS2R::Media; end
7
-
8
6
  def use_temp_dirs
9
7
  MMS2R::Media.tmp_dir = @tmpdir
10
8
  MMS2R::Media.conf_dir = @confdir
@@ -121,50 +119,6 @@ class TestMms2rMedia < Test::Unit::TestCase
121
119
  assert_not_nil config['number'].first == 'from'
122
120
  end
123
121
 
124
- def test_create_with_default_processor
125
- mail = mock()
126
- mail.expects(:from).at_least_once.returns(['joe@unknown.example.com'])
127
- mail.expects(:return_path).at_least_once.returns('joe@unknown.example.com')
128
- mms = MMS2R::Media.create(mail)
129
- assert_equal [MMS2R::Media, 'unknown.example.com'] , mms
130
- end
131
-
132
- def test_create_with_special_processor
133
- MMS2R.register('null.example.com', MMS2R::Media::NullCarrier)
134
- mail = mock()
135
- mail.expects(:from).at_least_once.returns(['joe@null.example.com'])
136
- mail.expects(:return_path).at_least_once.returns('joe@null.example.com')
137
- mms = MMS2R::Media.create(mail)
138
- assert_equal [MMS2R::Media::NullCarrier, 'null.example.com'], mms
139
- end
140
-
141
- def test_create_with_special_processor_and_return_path
142
- MMS2R.register('null.example.com', MMS2R::Media::NullCarrier)
143
- mail = mock()
144
- mail.expects(:from).at_least_once.returns([])
145
- mail.expects(:return_path).at_least_once.returns('joe@null.example.com')
146
- mms = MMS2R::Media.create(mail)
147
- assert_equal [MMS2R::Media::NullCarrier, 'null.example.com'], mms
148
- end
149
-
150
- def test_create_should_fail_gracefully_with_broken_from
151
- mail = mock()
152
- mail.expects(:from).at_least_once.returns(nil)
153
- mail.expects(:return_path).at_least_once.returns('joe@unknown.example.com')
154
- assert_nothing_raised { MMS2R::Media.create(mail) }
155
- end
156
-
157
- def test_aliased_new_returns_custom_processor_instance
158
- MMS2R.register('null.example.com', MMS2R::Media::NullCarrier)
159
- mail = stub_mail
160
- mail.expects(:from).at_least_once.returns(['joe@null.example.com'])
161
-
162
- mms = MMS2R::Media.new(mail)
163
- assert_not_nil mms
164
- assert_equal MMS2R::Media::NullCarrier, mms.class
165
- assert_equal true, mms.respond_to?(:process)
166
- end
167
-
168
122
  def test_aliased_new_returns_default_processor_instance
169
123
  mms = MMS2R::Media.new stub_mail
170
124
  assert_not_nil mms
@@ -184,8 +138,14 @@ class TestMms2rMedia < Test::Unit::TestCase
184
138
  end
185
139
 
186
140
  def test_default_processor_initialize_tries_to_open_config_for_carrier
187
- f = File.join(MMS2R::Media.conf_dir, 'example.com.yml')
188
- YAML.expects(:load_file).once.with(f)
141
+ mms_yaml = File.expand_path(File.join(MMS2R::Media.conf_dir, 'mms2r_media.yml'))
142
+ aliases_yaml = File.expand_path(File.join(MMS2R::Media.conf_dir, 'aliases.yml'))
143
+ from_yaml = File.expand_path(File.join(MMS2R::Media.conf_dir, 'from.yml'))
144
+ example_yaml = File.expand_path(File.join(MMS2R::Media.conf_dir, 'example.com.yml'))
145
+ YAML.expects(:load_file).at_least_once.with(mms_yaml).returns({})
146
+ YAML.expects(:load_file).at_least_once.with(aliases_yaml).returns({})
147
+ YAML.expects(:load_file).at_least_once.with(from_yaml).returns([])
148
+ YAML.expects(:load_file).at_least_once.with(example_yaml)
189
149
  mms = MMS2R::Media.new stub_mail
190
150
  end
191
151
 
@@ -519,7 +479,6 @@ class TestMms2rMedia < Test::Unit::TestCase
519
479
  end
520
480
 
521
481
  def test_add_file
522
- MMS2R.register('null.example.com', MMS2R::Media::NullCarrier)
523
482
  mail = stub_mail
524
483
  mail.stubs(:from).returns(['joe@null.example.com'])
525
484
 
@@ -194,13 +194,13 @@ class TestPmSprintCom < Test::Unit::TestCase
194
194
  mail = mock(:message_id => 'a')
195
195
  mail.expects(:from).at_least_once.returns(['joe@pm.sprint.com'])
196
196
  mail.expects(:return_path).at_least_once.returns('joe@pm.sprint.com')
197
- s = MMS2R::Media::Sprint.new(mail, :process => :lazy)
197
+ mms = MMS2R::Media.new(mail, :process => :lazy)
198
198
  type = 'text/plain'
199
199
  content = 'foo'
200
200
  file = Tempfile.new('sprint')
201
201
  file.close
202
202
 
203
- type, file = s.send(:sprint_write_file, type, content, file.path)
203
+ type, file = mms.send(:sprint_write_file, type, content, file.path)
204
204
  assert_equal 'text/plain', type
205
205
  assert_equal content, IO.read(file)
206
206
  end
@@ -213,4 +213,12 @@ class TestPmSprintCom < Test::Unit::TestCase
213
213
  assert_equal "", mms.subject
214
214
  end
215
215
 
216
+ def test_new_subject
217
+ mail = mail('sprint-new-image-01.mail')
218
+ mms = MMS2R::Media.new(mail)
219
+ assert_equal '2068675309', mms.number
220
+ assert_equal "pm.sprint.com", mms.carrier
221
+ assert_equal "", mms.subject
222
+ end
223
+
216
224
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mms2r
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 11
4
5
  prerelease: false
5
6
  segments:
6
7
  - 3
7
- - 2
8
+ - 3
8
9
  - 0
9
- version: 3.2.0
10
+ version: 3.3.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Mike Mondragon
@@ -14,44 +15,50 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-08-17 00:00:00 -07:00
18
+ date: 2010-12-31 00:00:00 -08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: nokogiri
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 15
27
30
  segments:
28
31
  - 1
29
32
  - 4
30
- - 0
31
- version: 1.4.0
33
+ - 4
34
+ version: 1.4.4
32
35
  type: :runtime
33
36
  version_requirements: *id001
34
37
  - !ruby/object:Gem::Dependency
35
38
  name: mail
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 19
41
46
  segments:
42
47
  - 2
43
48
  - 2
44
- - 5
45
- version: 2.2.5
49
+ - 10
50
+ version: 2.2.10
46
51
  type: :runtime
47
52
  version_requirements: *id002
48
53
  - !ruby/object:Gem::Dependency
49
54
  name: uuidtools
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ">="
54
60
  - !ruby/object:Gem::Version
61
+ hash: 9
55
62
  segments:
56
63
  - 2
57
64
  - 1
@@ -63,58 +70,34 @@ dependencies:
63
70
  name: exifr
64
71
  prerelease: false
65
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
75
  - - ">="
68
76
  - !ruby/object:Gem::Version
77
+ hash: 17
69
78
  segments:
70
79
  - 1
71
80
  - 0
72
- - 1
73
- version: 1.0.1
81
+ - 3
82
+ version: 1.0.3
74
83
  type: :runtime
75
84
  version_requirements: *id004
76
85
  - !ruby/object:Gem::Dependency
77
- name: rubyforge
86
+ name: hoe
78
87
  prerelease: false
79
88
  requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
80
90
  requirements:
81
91
  - - ">="
82
92
  - !ruby/object:Gem::Version
93
+ hash: 47
83
94
  segments:
84
95
  - 2
96
+ - 8
85
97
  - 0
86
- - 4
87
- version: 2.0.4
98
+ version: 2.8.0
88
99
  type: :development
89
100
  version_requirements: *id005
90
- - !ruby/object:Gem::Dependency
91
- name: gemcutter
92
- prerelease: false
93
- requirement: &id006 !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- segments:
98
- - 0
99
- - 4
100
- - 1
101
- version: 0.4.1
102
- type: :development
103
- version_requirements: *id006
104
- - !ruby/object:Gem::Dependency
105
- name: hoe
106
- prerelease: false
107
- requirement: &id007 !ruby/object:Gem::Requirement
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- segments:
112
- - 2
113
- - 5
114
- - 0
115
- version: 2.5.0
116
- type: :development
117
- version_requirements: *id007
118
101
  description: |-
119
102
  == DESCRIPTION
120
103
 
@@ -142,6 +125,8 @@ extra_rdoc_files:
142
125
  - README.txt
143
126
  files:
144
127
  - .gitignore
128
+ - Gemfile
129
+ - Gemfile.lock
145
130
  - History.txt
146
131
  - Manifest.txt
147
132
  - README.TMail.txt
@@ -249,6 +234,7 @@ files:
249
234
  - test/fixtures/sasktel-image-01.mail
250
235
  - test/fixtures/sprint-broken-image-01.mail
251
236
  - test/fixtures/sprint-image-01.mail
237
+ - test/fixtures/sprint-new-image-01.mail
252
238
  - test/fixtures/sprint-pcs-text-01.mail
253
239
  - test/fixtures/sprint-purged-image-01.mail
254
240
  - test/fixtures/sprint-text-01.mail
@@ -331,60 +317,64 @@ rdoc_options:
331
317
  require_paths:
332
318
  - lib
333
319
  required_ruby_version: !ruby/object:Gem::Requirement
320
+ none: false
334
321
  requirements:
335
322
  - - ">="
336
323
  - !ruby/object:Gem::Version
324
+ hash: 3
337
325
  segments:
338
326
  - 0
339
327
  version: "0"
340
328
  required_rubygems_version: !ruby/object:Gem::Requirement
329
+ none: false
341
330
  requirements:
342
331
  - - ">="
343
332
  - !ruby/object:Gem::Version
333
+ hash: 3
344
334
  segments:
345
335
  - 0
346
336
  version: "0"
347
337
  requirements: []
348
338
 
349
339
  rubyforge_project: mms2r
350
- rubygems_version: 1.3.6
340
+ rubygems_version: 1.3.7
351
341
  signing_key:
352
342
  specification_version: 3
353
343
  summary: Extract user media from MMS (and not carrier cruft)
354
344
  test_files:
355
- - test/test_mms_o2online_de.rb
356
- - test/test_helper.rb
357
- - test/test_pm_sprint_com.rb
358
- - test/test_sms_sasktel_com.rb
359
- - test/test_mms_mobileiam_ma.rb
360
- - test/test_msg_telus_com.rb
361
- - test/test_messaging_sprintpcs_com.rb
362
- - test/test_mms_myhelio_com.rb
363
- - test/test_mms_3ireland_ie.rb
364
- - test/test_mms_ae.rb
365
- - test/test_mms_att_net.rb
345
+ - test/test_orangemms_net.rb
346
+ - test/test_waw_plspictures_com.rb
366
347
  - test/test_mediamessaging_o2_co_uk.rb
367
- - test/test_bell_canada.rb
368
- - test/test_mms_mtn_co_za.rb
369
- - test/test_vmpix_com.rb
370
- - test/test_github.rb
371
348
  - test/test_vzwpix_com.rb
372
- - test/test_mms_uscc_net.rb
373
- - test/test_bellsouth_net.rb
374
349
  - test/test_unicel_com.rb
375
- - test/test_waw_plspictures_com.rb
350
+ - test/test_messaging_sprintpcs_com.rb
376
351
  - test/test_mms_luxgsm_lu.rb
377
- - test/test_mms_netcom_no.rb
378
- - test/test_mms_mycricket_com.rb
379
- - test/test_mms2r_media.rb
380
352
  - test/test_rci_rogers_com.rb
353
+ - test/test_mms_uscc_net.rb
354
+ - test/test_mms_netcom_no.rb
355
+ - test/test_1nbox_net.rb
356
+ - test/test_sms_sasktel_com.rb
357
+ - test/test_mms_att_net.rb
358
+ - test/test_mobile_indosat_net_id.rb
381
359
  - test/test_messaging_nextel_com.rb
360
+ - test/test_mms_mtn_co_za.rb
382
361
  - test/test_mms_vodacom4me_co_za.rb
383
- - test/test_tmomail_net.rb
384
- - test/test_1nbox_net.rb
385
362
  - test/test_pxt_vodafone_net_nz.rb
386
- - test/test_mobile_indosat_net_id.rb
387
- - test/test_mms_three_co_uk.rb
388
- - test/test_mms_alltel_com.rb
389
363
  - test/test_mms_dobson_net.rb
390
- - test/test_orangemms_net.rb
364
+ - test/test_helper.rb
365
+ - test/test_msg_telus_com.rb
366
+ - test/test_mms_o2online_de.rb
367
+ - test/test_mms2r_media.rb
368
+ - test/test_bell_canada.rb
369
+ - test/test_tmomail_net.rb
370
+ - test/test_mms_3ireland_ie.rb
371
+ - test/test_pm_sprint_com.rb
372
+ - test/test_mms_alltel_com.rb
373
+ - test/test_github.rb
374
+ - test/test_mms_mobileiam_ma.rb
375
+ - test/test_mms_mycricket_com.rb
376
+ - test/test_bellsouth_net.rb
377
+ - test/test_mms_three_co_uk.rb
378
+ - test/test_vmpix_com.rb
379
+ - test/test_mms_myhelio_com.rb
380
+ - test/test_mms_ae.rb