mms2r 3.5.1 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,10 +1,11 @@
1
1
  # -*- ruby -*-
2
2
 
3
- source :gemcutter
3
+ source :rubygems
4
4
 
5
5
  gem "nokogiri"
6
6
  gem "mail"
7
7
  gem "exifr"
8
+ # gem "psych"
8
9
 
9
10
  group :development, :test do
10
11
  gem "rdoc"
data/Gemfile.lock CHANGED
@@ -2,25 +2,25 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  exifr (1.1.1)
5
- gemcutter (0.7.0)
6
- hoe (2.12.3)
5
+ gemcutter (0.7.1)
6
+ hoe (2.12.5)
7
7
  rake (~> 0.8)
8
8
  i18n (0.6.0)
9
- json (1.6.1)
10
- json_pure (1.6.1)
11
- mail (2.3.0)
9
+ json (1.6.5)
10
+ json_pure (1.6.5)
11
+ mail (2.4.0)
12
12
  i18n (>= 0.4.0)
13
13
  mime-types (~> 1.16)
14
14
  treetop (~> 1.4.8)
15
15
  metaclass (0.0.1)
16
16
  mime-types (1.17.2)
17
- mocha (0.10.0)
17
+ mocha (0.10.2)
18
18
  metaclass (~> 0.0.1)
19
19
  nokogiri (1.5.0)
20
- polyglot (0.3.2)
20
+ polyglot (0.3.3)
21
21
  rake (0.9.2.2)
22
22
  rcov (0.9.11)
23
- rdoc (3.11)
23
+ rdoc (3.12)
24
24
  json (~> 1.4)
25
25
  rubyforge (2.0.4)
26
26
  json_pure (>= 1.1.7)
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ ### 3.6.0 / 2012-01-19 (Agent 216 - assassin, master of infiltration and sabotage)
2
+
3
+ * 1 major enhancement
4
+ * Ruby 1.8.7, 1.9.2, and 1.9.3 compatible
5
+ * 1 bug fix
6
+ * A fix for the utf-8 encoding issue with ruby 1.9.2 - minimul / Christian
7
+
1
8
  ### 3.5.1 / 2011-12-11 (Mashed Potato Johnson - oldest living blues guitarist in the world)
2
9
 
3
10
  * 1 bug fix
data/Manifest.txt CHANGED
@@ -82,6 +82,7 @@ test/fixtures/iconv-fr-text-01.mail
82
82
  test/fixtures/indosat-image-01.mail
83
83
  test/fixtures/indosat-image-02.mail
84
84
  test/fixtures/info2go-image-01.mail
85
+ test/fixtures/invalid-byte-seq-outlook.mail
85
86
  test/fixtures/iphone-image-01.mail
86
87
  test/fixtures/iphone-image-02.mail
87
88
  test/fixtures/luxgsm-image-01.mail
@@ -148,6 +149,7 @@ test/test_1nbox_net.rb
148
149
  test/test_bell_canada.rb
149
150
  test/test_bellsouth_net.rb
150
151
  test/test_helper.rb
152
+ test/test_invalid_byte_seq_outlook.rb
151
153
  test/test_mediamessaging_o2_co_uk.rb
152
154
  test/test_messaging_nextel_com.rb
153
155
  test/test_messaging_sprintpcs_com.rb
data/Rakefile CHANGED
@@ -7,6 +7,7 @@ rescue LoadError
7
7
  require 'hoe'
8
8
  end
9
9
 
10
+
10
11
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "lib")
11
12
  require 'mms2r'
12
13
  require 'rake'
data/lib/mms2r.rb CHANGED
@@ -39,7 +39,7 @@ module MMS2R
39
39
  ##
40
40
  # MMS2R library version
41
41
 
42
- VERSION = '3.5.1'
42
+ VERSION = '3.6.0'
43
43
 
44
44
  ##
45
45
  # Spoof User-Agent, primarily for the Sprint CDN
@@ -65,8 +65,14 @@ end
65
65
  end
66
66
  end
67
67
 
68
- # HAX to not deal with Psych YAML parser in Ruby >= 1.9
69
- #YAML::ENGINE.yamler= 'syck' if defined?(YAML::ENGINE)
68
+ if RUBY_VERSION >= "1.9"
69
+ begin
70
+ require 'psych'
71
+ YAML::ENGINE.yamler= 'syck' if defined?(YAML::ENGINE)
72
+ rescue LoadError
73
+ end
74
+ end
75
+
70
76
 
71
77
  require File.join(File.dirname(__FILE__), 'ext/mail')
72
78
  require File.join(File.dirname(__FILE__), 'ext/object')
data/lib/mms2r/media.rb CHANGED
@@ -266,6 +266,16 @@ module MMS2R
266
266
  def body
267
267
  text_file = default_text
268
268
  @body = text_file ? IO.readlines(text_file.path).join.strip : ""
269
+ @body.force_encoding("ISO-8859-1") if RUBY_VERSION >= "1.9" && @body.encoding == "ASCII-8BIT"
270
+
271
+ begin
272
+ ic = Iconv.new('UTF-8', 'ISO-8859-1' )
273
+ @body = ic.iconv(@body)
274
+ @body << ic.iconv(nil)
275
+ ic.close
276
+ rescue Exception => e
277
+ end
278
+
269
279
  if @body.blank? && html_file = default_html
270
280
  html = Nokogiri::HTML(IO.read(html_file.path))
271
281
  @body = (html.xpath("//head/title").map(&:text) + html.xpath("//body/*").map(&:text)).join(" ")
@@ -434,16 +444,13 @@ module MMS2R
434
444
  def transform_text(type, text, original_encoding = 'ISO-8859-1')
435
445
  return type, text if !config['transform'] || !(transforms = config['transform'][type])
436
446
 
437
- if RUBY_VERSION < "1.9"
438
- #convert to UTF-8
439
- begin
440
- c = Iconv.new('UTF-8', original_encoding )
441
- utf_t = c.iconv(text)
442
- rescue Exception => e
443
- utf_t = text
444
- end
445
- else
446
- utf_t = text.encoding == "ASCII-8BIT" ? text.force_encoding("ISO-8859-1").encode("UTF-8") : text
447
+ begin
448
+ ic = Iconv.new('UTF-8', original_encoding )
449
+ utf_t = ic.iconv(text)
450
+ utf_t << ic.iconv(nil)
451
+ ic.close
452
+ rescue Exception => e
453
+ utf_t = text
447
454
  end
448
455
 
449
456
  transforms.each do |transform|
@@ -586,12 +593,12 @@ module MMS2R
586
593
 
587
594
  headers = config['device_types']['headers'] rescue {}
588
595
  headers.keys.each do |header|
589
- if mail.header[header.downcase]
596
+ if mail.header[header]
590
597
  # headers[header] refers to a hash of smart phone types with regex values
591
598
  # that if they match, the header signals the type should be returned
592
599
  headers[header].each do |type, regex|
593
- return type if mail.header[header.downcase].decoded =~ regex
594
- field = mail.header.fields.detect { |field| field.name.downcase == header.downcase }
600
+ return type if mail.header[header].decoded =~ regex
601
+ field = mail.header.fields.detect { |field| field.name == header }
595
602
  return type if field && field.to_s =~ regex
596
603
  end
597
604
  end
@@ -0,0 +1,342 @@
1
+ Delivered-To: testemail@mail.com
2
+ Received: by 10.52.184.102 with SMTP id et6cs208438vdc;
3
+ Mon, 16 Jan 2012 14:19:35 -0800 (PST)
4
+ Received: by 10.180.20.69 with SMTP id l5mr17988972wie.19.1326752373488;
5
+ Mon, 16 Jan 2012 14:19:33 -0800 (PST)
6
+ Return-Path: <nelson+caf_=nelson=testemail@mail.com>
7
+ Received: from mail-wi0-f172.toogle.com (mail-wi0-f172.toogle.com [209.85.212.172])
8
+ by mx.toogle.com with ESMTPS id c7si13165326wia.5.2012.01.16.14.19.32
9
+ (version=TLSv1/SSLv3 cipher=OTHER);
10
+ Mon, 16 Jan 2012 14:19:33 -0800 (PST)
11
+ Received-SPF: neutral (toogle.com: 209.85.212.172 is neither permitted nor denied by best guess record for domain of nelson+caf_=nelson=testemail@mail.com) client-ip=209.85.212.172;
12
+ Authentication-Results: mx.toogle.com; spf=neutral (toogle.com: 209.85.212.172 is neither permitted nor denied by best guess record for domain of nelson+caf_=nelson=testemail@mail.com) smtp.mail=nelson+caf_=nelson=testemail@mail.com
13
+ Received: by wics10 with SMTP id s10so1698315wic.31
14
+ for <testemail@mail.com>; Mon, 16 Jan 2012 14:19:32 -0800 (PST)
15
+ Received: by 10.180.73.72 with SMTP id j8mr12775876wiv.2.1326752372616;
16
+ Mon, 16 Jan 2012 14:19:32 -0800 (PST)
17
+ X-Forwarded-To: testemail@mail.com
18
+ X-Forwarded-For: testemail@mail.com testemail@mail.com
19
+ Delivered-To: testemail@mail.com
20
+ Received: by 10.216.22.196 with SMTP id t46cs153584wet;
21
+ Mon, 16 Jan 2012 14:19:31 -0800 (PST)
22
+ Received: by 10.236.168.37 with SMTP id j25mr19473152yhl.92.1326752370735;
23
+ Mon, 16 Jan 2012 14:19:30 -0800 (PST)
24
+ Return-Path: <testemail@mail.com>
25
+ Received: from barracuda.ngSmith.com (barracuda.ngSmith.com. [192.168.97.98])
26
+ by mx.toogle.com with ESMTP id i66si8419543yhn.66.2012.01.16.14.19.28;
27
+ Mon, 16 Jan 2012 14:19:30 -0800 (PST)
28
+ Received-SPF: pass (toogle.com: best guess record for domain of testemail@mail.com designates 192.168.97.98 as permitted sender) client-ip=192.168.97.98;
29
+ X-ASG-Debug-ID: 1326752367-0199b2096162000001-x7cFak
30
+ Received: from Mail.NGSmith.com (legacy.ngSmith.com [192.168.0.61]) by barracuda.ngSmith.com with ESMTP id f6DuStHCxnYrGzVR for <testemail@mail.com>; Mon, 16 Jan 2012 16:19:27 -0600 (CST)
31
+ X-Barracuda-Envelope-From: testemail@mail.com
32
+ Received: from MSPEXCH1.ngSmith.com ([fe80::ecf7:ebc1:c6af:b594]) by
33
+ MSPEXCH2.ngSmith.com ([fe80::4106:cc1:bb08:dd9f%15]) with mapi id
34
+ 14.01.0339.001; Mon, 16 Jan 2012 16:19:27 -0600
35
+ From: Aaron Doe <testemail@mail.com>
36
+ X-Barracuda-Apparent-Source-IP: fe80::ecf7:ebc1:c6af:b594
37
+ To: ProformaExpress <testemail@mail.com>
38
+ Subject: RE: Issue 14794:Don M. says.. Aaron - I completed RNS Test Question
39
+ 3, which was done as a 'Cargo Control Number' query. H
40
+ Thread-Topic: Issue 14794:Don M. says.. Aaron - I completed RNS Test
41
+ Question 3, which was done as a 'Cargo Control Number' query. H
42
+ X-ASG-Orig-Subj: RE: Issue 14794:Don M. says.. Aaron - I completed RNS Test Question
43
+ 3, which was done as a 'Cargo Control Number' query. H
44
+ Thread-Index: AQHM1JquY55Wte0hREivWFQKTv0KkpYPkFyF
45
+ Date: Mon, 16 Jan 2012 22:19:26 +0000
46
+ Message-ID: <testemail@mail.com>
47
+ References: <testemail@mail.com-64-64-167.mail>
48
+ In-Reply-To: <testemail@mail.com-64-64-167.mail>
49
+ Accept-Language: en-US
50
+ Content-Language: en-US
51
+ X-MS-Has-Attach:
52
+ X-MS-TNEF-Correlator:
53
+ x-originating-ip: [192.168.106.241]
54
+ Content-Type: text/plain; charset="Windows-1252"
55
+ Content-Transfer-Encoding: quoted-printable
56
+ MIME-Version: 1.0
57
+ X-Barracuda-Connect: legacy.ngSmith.com[192.168.0.61]
58
+ X-Barracuda-Start-Time: 1326752367
59
+ X-Barracuda-URL: http://192.168.0.95:8000/cgi-mod/mark.cgi
60
+ X-Virus-Scanned: by bsmtpd at ngSmith.com
61
+ X-Barracuda-Spam-Score: 0.00
62
+ X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests=
63
+ X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.86107
64
+ Rule breakdown below
65
+ pts rule name description
66
+ ---- ---------------------- --------------------------------------------------
67
+
68
+ Don,
69
+
70
+ Please have express change "CC" to "ABT"
71
+ Aaron
72
+
73
+ ________________________________
74
+ From: ProformaExpress [testemail@mail.com]
75
+ Sent: Monday, January 16, 2012 4:10 PM
76
+ To: Christian Doe; Pat Doe; Don Doe; Jim Doe; Michael H=
77
+ anson; Tim Doe; Aaron Doe
78
+ Subject: Issue 14794:Don M. says.. Aaron - I completed RNS Test Question 3,=
79
+ which was done as a 'Cargo Control Number' query. H
80
+
81
+
82
+ Direct link to Issue 14794<http://trakr.net/list/ProformaExpress/rev=
83
+ ise/14794> I am working on this<http://trakr.net/list/ProformaExpr=
84
+ ess/work/19406>
85
+
86
+
87
+ #10 Don Doe said less than a minute ago [Mon, Jan 16, 2012 02:10 PM =
88
+ PST] status:active
89
+
90
+
91
+
92
+ Aaron - I completed RNS Test Question 3, which was done as a 'Cargo Control=
93
+ Number' query.
94
+
95
+ Having a problem, per attached, where the EDIFACT file is showing the Notif=
96
+ ication_Qualifier (Reference Qualifier) as - TN - which should only be used=
97
+ for Transaction Number queries.
98
+
99
+ In this case the EDIFACT file should be showing 'ABT' for a Cargo Control N=
100
+ umber Query - not TN.
101
+
102
+ The Express XML is showing 'CC' for the 'Notification_Qualifier' on Cargo C=
103
+ ontrol Number queries.
104
+
105
+ When you get the CC, it has to be shown as ABT in the EDIFACT.
106
+
107
+ The last test question (2) required query by Transaction Number - so TN was=
108
+ correct.
109
+
110
+ When you get 'CC' - please change to 'ABT' in the EDIFACT.
111
+
112
+ Let me know if you need additional information.
113
+
114
+ Thanks
115
+
116
+
117
+
118
+
119
+ Wrong_Reference_Qualifier.xlsx<http://trakr.net/uploads/1/14794/Wron=
120
+ g_Reference_Qualifier.xlsx> view<http://trakr.net/uploads/1/14794/Wr=
121
+ ong_Reference_Qualifier.xlsx?viewer=3D1>
122
+
123
+
124
+
125
+ Email(s) sent to: Christian Doe,Pat Doe,Don Doe,Jim,=
126
+ Michael Doe,Tim Doe,Aaron Doe
127
+ Direct link to Issue 14794<http://trakr.net/list/ProformaExp=
128
+ ress/revise/14794>
129
+
130
+ All attachments for this issue:
131
+
132
+ Wrong_Reference_Qualifier.xlsx<http://trakr.net/uploads/1/14794/Wron=
133
+ g_Reference_Qualifier.xlsx> view<http://trakr.net/uploads/1/14794/Wr=
134
+ ong_Reference_Qualifier.xlsx?viewer=3D1>
135
+ RNS_Query_by_Transaction_Number.xlsx<http://trakr.net/uploads/1/1479=
136
+ 4/RNS_Query_by_Transaction_Number.xlsx> view<http://trakr.net/upload=
137
+ s/1/14794/RNS_Query_by_Transaction_Number.xlsx?viewer=3D1>
138
+ RNS_Qeury_specifics.xlsx<http://trakr.net/uploads/1/14794/RNS_Qeury_=
139
+ specifics.xlsx> view<http://trakr.net/uploads/1/14794/RNS_Qeury_spec=
140
+ ifics.xlsx?viewer=3D1>
141
+
142
+
143
+ Issue History..
144
+ #9 Don Doe said about 7 hours ago [Mon, Jan 16, 2012 07:10 AM PST] =
145
+
146
+ status:active
147
+
148
+
149
+
150
+ Per Judi's email below - RNS Question 2 is correct.
151
+ Have sent # 3 now.
152
+
153
+ Question 2 was sent on Thursday so she is taking a couple days,
154
+ or more, to get back with the question status.
155
+ _________________________________________
156
+ From: Johnson, Judi
157
+ Sent: Monday, January 16, 2012 9:27 AM
158
+ To: Don Doe
159
+ Subject: RE: RNS Client Test Package =96 Question 2
160
+
161
+ Hi Don
162
+ That is correct
163
+ Go to test 3
164
+ Bye Judi
165
+ _________________________________________
166
+ From: Don Doe [mailto:testemail@mail.com<mailto:testemail@mail.com>]
167
+ Sent: January 12, 2012 5:03 PM
168
+ To: Johnson, Judi
169
+ Subject: RE: RNS Client Test Package - 1
170
+ Importance: High
171
+
172
+ Hi Judi,
173
+
174
+ I have sent the RNS Transaction for Test Question 2 again.
175
+ The programmer has fixed the RNS Transaction showing TN for Transaction Num=
176
+ ber.
177
+
178
+
179
+
180
+
181
+ #8 Don Doe said 4 days ago [Thu, Jan 12, 2012 07:58 AM PST] =
182
+ status:active
183
+
184
+
185
+
186
+ OK - sending it again.
187
+ Thanks
188
+
189
+
190
+
191
+
192
+ #7 Aaron Doe said 4 days ago [Thu, Jan 12, 2012 07:48 AM PST] =
193
+ status:active
194
+
195
+
196
+
197
+ Refreshed the map. I tested and it is working now.
198
+
199
+ Aaron
200
+
201
+
202
+
203
+
204
+ #6 Don Doe said 4 days ago [Thu, Jan 12, 2012 06:26 AM PST] =
205
+ status:active
206
+
207
+
208
+
209
+ I just re-sent the RNS Query Test 2 again - but got the same results.
210
+
211
+ Express sent - <notification_qualifier>TN</notification_qualifier>
212
+
213
+ But - ABT was sent to CBSA again:
214
+ UNB+UNOA:2+6128547363+RCCECECPT:12+120112:0810+22++CUSREP'UNG+CUSREP+612854=
215
+ 7363+PARSPDN+120112:0810+22+UN+D:96A'UNH+0022+CUSREP:D:96A:UN'BGM+998'DTM+1=
216
+ 32:20120112:203'RFF+ABT:14142123913549'UNT+5+0022'UNE+1+22'UNZ+1+22'
217
+
218
+
219
+
220
+
221
+ #5 Aaron Doe said 4 days ago [Thu, Jan 12, 2012 02:25 AM PST] =
222
+ status:active
223
+
224
+
225
+
226
+ The qualifier is mapped. Please retest.
227
+
228
+
229
+
230
+
231
+ #4 Don Doe said 5 days ago [Wed, Jan 11, 2012 11:02 AM PST] =
232
+ status:active
233
+
234
+
235
+
236
+ Aaron - TN or ABT are both being included in the XML when oppopriate.
237
+ Can you not go by this?
238
+
239
+ Getting for the Transaction Number query -
240
+ <Notification_qualifier>TN</Notification_qualifier>
241
+ or
242
+ <Notification_qualifier>ABT</Notification_qualifier>
243
+
244
+ Do you have to have an indicator also?
245
+
246
+ Should I recreate the RNS transaction to send or are you sending the one yo=
247
+ u fixed?
248
+ Thanks
249
+
250
+
251
+
252
+
253
+
254
+ #3 Aaron Doe said 5 days ago [Wed, Jan 11, 2012 10:25 AM PST] =
255
+ status:active
256
+
257
+
258
+
259
+ I changed =93ABT=94 to =93TN=94. If you need to switch between the CCN and =
260
+ the TN I will need an indicator in the xml. Don recheck step 1.
261
+
262
+
263
+
264
+
265
+ #2 Don Doe said 5 days ago [Wed, Jan 11, 2012 07:51 AM PST] =
266
+ status:active
267
+
268
+
269
+
270
+ When completing the RNS Query Test 2 - sending by Transaction Number - have=
271
+ to send "TN" for the Reference Qualifier, per attached.
272
+
273
+ But the EDIFACT sent shows ABT (for Cargo Control Number) in error. .
274
+
275
+ The XML file sent from Express - also attached - does show TN - but the EDI=
276
+ FACT file is showing: ABT
277
+
278
+ Please correct - as soon as possible.
279
+
280
+ Thanks
281
+
282
+
283
+
284
+
285
+ RNS_Query_by_Transaction_Number.xlsx<http://trakr.net/uploads/1/1479=
286
+ 4/RNS_Query_by_Transaction_Number.xlsx> view<http://trakr.net/upload=
287
+ s/1/14794/RNS_Query_by_Transaction_Number.xlsx?viewer=3D1>
288
+
289
+
290
+
291
+
292
+ #1 Don Doe said 6 days ago [Tue, Jan 10, 2012 07:58 PM PST] =
293
+ status:active
294
+
295
+
296
+
297
+ I completed the RNS Test Question 2 today. Still waiting to hear the result=
298
+ s from Judi at CBSA.
299
+
300
+ Question 2 requires that you do the query using the Transaction Id.
301
+ In this case, Judi told me to use - 14142123913549 for the Transaction Id -=
302
+ which I did.
303
+
304
+ But, per attached, the Query Responses grid doesn't tell you that this quer=
305
+ y was completed by "Transaction Id" and doesn't show the "Transaction Id" u=
306
+ sed with the query.
307
+
308
+ Need to have a column that shows whether the RNS Query was done by Cargo Co=
309
+ ntrol Number (CCN), Conveyance Reference, or Transaction Id.
310
+
311
+ Also need to be able to see the Transaction #, CCN, or Conveyance Reference=
312
+ used within the Query Responses.
313
+
314
+ This would let the user know what type of query was sent and make it easier=
315
+ to know which RNS Query is which.
316
+
317
+ Let me know if any questions.
318
+
319
+ Thanks.
320
+
321
+
322
+
323
+
324
+ RNS_Qeury_specifics.xlsx<http://trakr.net/uploads/1/14794/RNS_Qeury_=
325
+ specifics.xlsx> view<http://trakr.net/uploads/1/14794/RNS_Qeury_spec=
326
+ ifics.xlsx?viewer=3D1>
327
+
328
+
329
+ C-TPAT SVI Partner ID: norBro01937 / norCon01149=0D
330
+
331
+ This message and any attachments are intended solely for the addressee(s) a=
332
+ nd are confidential. If you receive this message in error, please delete i=
333
+ t and immediately notify the sender. Norman G. Smith, Inc. accepts no lia=
334
+ bility for any claims in connection with the content or the transmission of=
335
+ this message. To better protect yourself, we suggest you obtain written a=
336
+ dvice from the applicable Government agency. =0D
337
+ All business is transacted subject to our Terms and Conditions of Service. =
338
+ Visit http://www.ngSmith.com/tools/forms/eng/terms_conditions.pdf for a f=
339
+ ull copy.=0D=0D
340
+
341
+
342
+
@@ -0,0 +1,27 @@
1
+ require "test_helper"
2
+
3
+ class TestInvalidByteSeqOutlook < Test::Unit::TestCase
4
+ include MMS2R::TestHelper
5
+
6
+ def test_bad_outlook
7
+ mail = mail('invalid-byte-seq-outlook.mail')
8
+ mms = MMS2R::Media.new(mail)
9
+ body = mms.body
10
+ =begin
11
+
12
+ assert_equal "+919812345678", mms.number
13
+ assert_equal "1nbox.net", mms.carrier
14
+ assert_equal 2, mms.media.size
15
+
16
+ assert_not_nil mms.media['text/plain']
17
+ assert_equal 1, mms.media['text/plain'].size
18
+ assert_equal "testing123456789012", open(mms.media['text/plain'].first).read
19
+
20
+ assert_not_nil mms.media['image/jpeg']
21
+ assert_equal 1, mms.media['text/plain'].size
22
+ assert_match(/@003\.jpg$/, mms.media['image/jpeg'].first)
23
+ =end
24
+
25
+ mms.purge
26
+ end
27
+ end
@@ -11,13 +11,15 @@ class TestMms2rMedia < Test::Unit::TestCase
11
11
  end
12
12
 
13
13
  def setup
14
- @tmpdir = File.join(Dir.tmpdir, "#{Time.now.to_i}-t")
14
+ @oldtmpdir = MMS2R::Media.tmp_dir || File.join(Dir.tmpdir, "#{Time.now.to_i}-#{rand(1000)}")
15
+ @oldconfdir = MMS2R::Media.conf_dir || File.join(Dir.tmpdir, "#{Time.now.to_i}-#{rand(1000)}")
16
+ FileUtils.mkdir_p(@oldtmpdir)
17
+ FileUtils.mkdir_p(@oldconfdir)
18
+
19
+ @tmpdir = File.join(Dir.tmpdir, "#{Time.now.to_i}-#{rand(1000)}")
15
20
  FileUtils.mkdir_p(@tmpdir)
16
- @confdir = File.join(Dir.tmpdir, "#{Time.now.to_i}-c")
21
+ @confdir = File.join(Dir.tmpdir, "#{Time.now.to_i}-#{rand(1000)}")
17
22
  FileUtils.mkdir_p(@confdir)
18
-
19
- @oldtmpdir = MMS2R::Media.tmp_dir
20
- @oldconfdir = MMS2R::Media.conf_dir
21
23
  end
22
24
 
23
25
  def teardown
@@ -231,19 +233,17 @@ class TestMms2rMedia < Test::Unit::TestCase
231
233
  text_lines = IO.readlines("#{file}")
232
234
  text = text_lines.join
233
235
 
234
- # ASCII-8BIT -> D'ici un mois G\xC3\xA9orgie
235
- # UTF-8 -> D'ici un mois Géorgie
236
+ # ASCII-8BIT -> D'ici un mois G\xE9orgie
237
+ # UTF-8 -> D'ici un mois Géorgie
236
238
 
237
239
  if RUBY_VERSION < "1.9"
238
- assert_equal("D'ici un mois Géorgie body", text_lines.first.strip)
239
240
  assert_equal("sample email message Fwd: sub D'ici un mois Géorgie", mms.subject)
241
+ assert_equal("D'ici un mois Géorgie body", text_lines.first.strip)
240
242
  else
241
- #assert_equal("D'ici un mois Géorgie body", text_lines.first.strip)
242
- assert_equal("D'ici un mois G\xE9orgie body", text_lines.first.strip)
243
- assert_equal("sample email message Fwd: sub D'ici un mois Géorgie", mms.subject)
243
+ assert_equal(Iconv.new('UTF-8', 'ISO-8859-1').iconv("sample email message Fwd: sub D'ici un mois Géorgie"), mms.subject)
244
+ assert_equal(Iconv.new('UTF-8', 'ISO-8859-1').iconv("D'ici un mois G\xE9orgie body"), text_lines.first.strip)
244
245
  end
245
246
 
246
- mms.purge
247
247
  end
248
248
 
249
249
  def test_subject
metadata CHANGED
@@ -1,109 +1,112 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mms2r
3
- version: !ruby/object:Gem::Version
4
- version: 3.5.1
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 3.6.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Mike Mondragon
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-12 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
12
+
13
+ date: 2012-01-19 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
15
16
  name: nokogiri
16
- requirement: &24888520 !ruby/object:Gem::Requirement
17
+ requirement: &id001 !ruby/object:Gem::Requirement
17
18
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
21
22
  version: 1.4.4
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *24888520
25
- - !ruby/object:Gem::Dependency
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
26
27
  name: mail
27
- requirement: &24887600 !ruby/object:Gem::Requirement
28
+ requirement: &id002 !ruby/object:Gem::Requirement
28
29
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
32
33
  version: 2.2.10
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *24887600
36
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
37
38
  name: uuidtools
38
- requirement: &24886540 !ruby/object:Gem::Requirement
39
+ requirement: &id003 !ruby/object:Gem::Requirement
39
40
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
43
44
  version: 2.1.1
44
45
  type: :runtime
45
46
  prerelease: false
46
- version_requirements: *24886540
47
- - !ruby/object:Gem::Dependency
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
48
49
  name: exifr
49
- requirement: &24885680 !ruby/object:Gem::Requirement
50
+ requirement: &id004 !ruby/object:Gem::Requirement
50
51
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
54
55
  version: 1.0.3
55
56
  type: :runtime
56
57
  prerelease: false
57
- version_requirements: *24885680
58
- - !ruby/object:Gem::Dependency
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: rdoc
61
+ requirement: &id005 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: "3.10"
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *id005
70
+ - !ruby/object:Gem::Dependency
59
71
  name: hoe
60
- requirement: &24884840 !ruby/object:Gem::Requirement
72
+ requirement: &id006 !ruby/object:Gem::Requirement
61
73
  none: false
62
- requirements:
74
+ requirements:
63
75
  - - ~>
64
- - !ruby/object:Gem::Version
65
- version: '2.12'
76
+ - !ruby/object:Gem::Version
77
+ version: "2.12"
66
78
  type: :development
67
79
  prerelease: false
68
- version_requirements: *24884840
69
- description: ! '== DESCRIPTION
70
-
71
-
80
+ version_requirements: *id006
81
+ description: |-
82
+ == DESCRIPTION
83
+
72
84
  MMS2R by Mike Mondragon
73
-
74
85
  http://mms2r.rubyforge.org/
75
-
76
86
  https://github.com/monde/mms2r
77
-
78
87
  https://github.com/monde/mms2r/issues
79
-
80
88
  http://peepcode.com/products/mms2r-pdf
81
-
82
-
89
+
83
90
  MMS2R is a library that decodes the parts of an MMS message to disk while
84
-
85
91
  stripping out advertising injected by the mobile carriers. MMS messages are
86
-
87
92
  multipart email and the carriers often inject branding into these messages. Use
88
-
89
93
  MMS2R if you want to get at the real user generated content from a MMS without
90
-
91
94
  having to deal with the cruft from the carriers.
92
-
93
-
95
+
94
96
  If MMS2R is not aware of a particular carrier no extra processing is done to the
95
-
96
- MMS other than decoding and consolidating its media.'
97
- email:
97
+ MMS other than decoding and consolidating its media.
98
+ email:
98
99
  - mikemondragon@gmail.com
99
100
  executables: []
101
+
100
102
  extensions: []
101
- extra_rdoc_files:
103
+
104
+ extra_rdoc_files:
102
105
  - History.txt
103
106
  - Manifest.txt
104
107
  - README.TMail.txt
105
108
  - README.txt
106
- files:
109
+ files:
107
110
  - .gitignore
108
111
  - Gemfile
109
112
  - Gemfile.lock
@@ -188,6 +191,7 @@ files:
188
191
  - test/fixtures/indosat-image-01.mail
189
192
  - test/fixtures/indosat-image-02.mail
190
193
  - test/fixtures/info2go-image-01.mail
194
+ - test/fixtures/invalid-byte-seq-outlook.mail
191
195
  - test/fixtures/iphone-image-01.mail
192
196
  - test/fixtures/iphone-image-02.mail
193
197
  - test/fixtures/luxgsm-image-01.mail
@@ -254,6 +258,7 @@ files:
254
258
  - test/test_bell_canada.rb
255
259
  - test/test_bellsouth_net.rb
256
260
  - test/test_helper.rb
261
+ - test/test_invalid_byte_seq_outlook.rb
257
262
  - test/test_mediamessaging_o2_co_uk.rb
258
263
  - test/test_messaging_nextel_com.rb
259
264
  - test/test_messaging_sprintpcs_com.rb
@@ -291,31 +296,36 @@ files:
291
296
  - .gemtest
292
297
  homepage: https://github.com/monde/mms2r
293
298
  licenses: []
299
+
294
300
  post_install_message:
295
- rdoc_options:
301
+ rdoc_options:
296
302
  - --main
297
303
  - README.txt
298
- require_paths:
304
+ require_paths:
299
305
  - lib
300
- required_ruby_version: !ruby/object:Gem::Requirement
306
+ required_ruby_version: !ruby/object:Gem::Requirement
301
307
  none: false
302
- requirements:
303
- - - ! '>='
304
- - !ruby/object:Gem::Version
305
- version: '0'
306
- required_rubygems_version: !ruby/object:Gem::Requirement
308
+ requirements:
309
+ - - ">="
310
+ - !ruby/object:Gem::Version
311
+ hash: -1579114988942475097
312
+ segments:
313
+ - 0
314
+ version: "0"
315
+ required_rubygems_version: !ruby/object:Gem::Requirement
307
316
  none: false
308
- requirements:
309
- - - ! '>='
310
- - !ruby/object:Gem::Version
311
- version: '0'
317
+ requirements:
318
+ - - ">="
319
+ - !ruby/object:Gem::Version
320
+ version: "0"
312
321
  requirements: []
322
+
313
323
  rubyforge_project: mms2r
314
324
  rubygems_version: 1.8.10
315
325
  signing_key:
316
326
  specification_version: 3
317
327
  summary: Extract user media from MMS (and not carrier cruft)
318
- test_files:
328
+ test_files:
319
329
  - test/test_orangemms_net.rb
320
330
  - test/test_waw_plspictures_com.rb
321
331
  - test/test_mediamessaging_o2_co_uk.rb
@@ -331,6 +341,7 @@ test_files:
331
341
  - test/test_mms_att_net.rb
332
342
  - test/test_mobile_indosat_net_id.rb
333
343
  - test/test_messaging_nextel_com.rb
344
+ - test/test_invalid_byte_seq_outlook.rb
334
345
  - test/test_mms_mtn_co_za.rb
335
346
  - test/test_mms_vodacom4me_co_za.rb
336
347
  - test/test_pxt_vodafone_net_nz.rb