mms2r 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,50 @@
1
+ Delivered-To: 2068675309@example.com
2
+ Received: by 10.142.113.15 with SMTP id l15cs32090wfc;
3
+ Thu, 11 Sep 2008 17:07:26 -0700 (PDT)
4
+ Received: by 10.187.219.6 with SMTP id w6mr487134faq.29.1221178044522;
5
+ Thu, 11 Sep 2008 17:07:24 -0700 (PDT)
6
+ Received: by 10.187.158.20 with HTTP; Thu, 11 Sep 2008 17:07:24 -0700 (PDT)
7
+ Message-ID: <5b40cfb70809111707s2b7044d3gbfb5ed3c253d0909@mail.gmail.com>
8
+ Date: Thu, 11 Sep 2008 17:07:24 -0700
9
+ From: tommy.tutone@example.com
10
+ Reply-To: tommy.tutone@example.com
11
+ To: "Mike Mondragon" <2068675309@example.com>
12
+ Subject: =?ISO-8859-1?Q?sample_email_message_Fwd:_sub_D'ici_un_mois_G=E9orgie?=
13
+ MIME-Version: 1.0
14
+ Content-Type: multipart/mixed;
15
+ boundary="----=_Part_41747_21712304.1221178044508"
16
+
17
+ ------=_Part_41747_21712304.1221178044508
18
+ Content-Type: multipart/alternative;
19
+ boundary="----=_Part_41748_5000436.1221178044508"
20
+
21
+ ------=_Part_41748_5000436.1221178044508
22
+ Content-Type: text/plain; charset=ISO-8859-1
23
+ Content-Transfer-Encoding: quoted-printable
24
+ Content-Disposition: inline
25
+
26
+ D'ici un mois G=E9orgie body
27
+
28
+
29
+ Mike, this is the French email message I test against with.
30
+
31
+ Kai
32
+
33
+ ------=_Part_41748_5000436.1221178044508
34
+ Content-Type: text/html; charset=ISO-8859-1
35
+ Content-Transfer-Encoding: quoted-printable
36
+ Content-Disposition: inline
37
+
38
+ <div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr"><div class=3D"=
39
+ gmail_quote"><div><div><div dir=3D"ltr"><div class=3D"gmail_quote">D&#39;ic=
40
+ i un mois G=E9orgie&nbsp; body&nbsp;&nbsp;</div><div class=3D"gmail_quote">=
41
+ <div dir=3D"ltr"><br></div><div dir=3D"ltr">
42
+ <br></div><div dir=3D"ltr">Mike, this is the French email message I test ag=
43
+ ainst with.</div><div dir=3D"ltr"><br></div><div dir=3D"ltr">Kai</div>
44
+ </div><br></div>
45
+ </div></div></div><br></div>
46
+ </div><br></div>
47
+
48
+ ------=_Part_41748_5000436.1221178044508--
49
+
50
+ ------=_Part_41747_21712304.1221178044508--
@@ -0,0 +1,43 @@
1
+ Delivered-To: tommy.tutone@example.com
2
+ Received: by 10.150.147.19 with SMTP id u19cs11331ybd;
3
+ Wed, 14 May 2008 13:10:38 -0700 (PDT)
4
+ Received: by 10.142.48.14 with SMTP id v14mr603069wfv.14.1210795836194;
5
+ Wed, 14 May 2008 13:10:36 -0700 (PDT)
6
+ Return-Path: <2068675309@info2go.com>
7
+ Received: from mail.info2go.com (mail.info2go.com [65.168.87.50])
8
+ by mx.google.com with ESMTP id 32si3572167wfa.18.2008.05.14.13.10.34;
9
+ Wed, 14 May 2008 13:10:36 -0700 (PDT)
10
+ Received-SPF: pass (google.com: best guess record for domain of 2068675309@info2go.com designates 65.168.87.50 as permitted sender) client-ip=65.168.87.50;
11
+ Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of 2068675309@info2go.com designates 65.168.87.50 as permitted sender) smtp.mail=2068675309@info2go.com
12
+ Received: from md.rcc.ericyhost.com (HELO iw-00) ([63.99.231.53])
13
+ by mail.info2go.com with ESMTP; 14 May 2008 15:10:34 -0500
14
+ Return-Path: <12068675309@info2go.com>
15
+ Received: from null ([192.168.100.100])
16
+ by MD2 SMTP SERVER (Message Director SMTP Server v2.39) with SMTP ID 923
17
+ for <tommy.tutone@example.com>;
18
+ Wed, 14 May 2008 15:10:33 -0500 (CDT)
19
+ Message-ID: <25058795.1210795833731.JavaMail.root@iw-00>
20
+ Date: Wed, 14 May 2008 15:08:33 -0500 (CDT)
21
+ From: 2068675309@info2go.com
22
+ To: tommy.tutone@example.com
23
+ Mime-Version: 1.0
24
+ Content-Type: image/jpeg; name=Image047.jpeg
25
+ X-Mms-Delivery-Time: Wed, 14 May 08 15:08:33 CDT
26
+ X-Mms-MMS-Version: 1.0
27
+ X-Mms-Message-Class: Personal
28
+ X-Mms-Message-Type: m-send-req
29
+ X-Mms-Message-Size: 22307
30
+ X-Mms-Transaction-ID: 109@info2go.com
31
+ X-Mms-Message-ID: 20732598@info2go.com
32
+ X-Priority: 3
33
+ Content-Disposition: attachment; filename=Image047.jpeg
34
+ Content-Transfer-Encoding: base64
35
+ X-HostedBy: Ericsson
36
+
37
+ /9j/4AAQSkZJRgABAQEASABIAAD/4QAWRXhpZgAATU0AKgAAAAgAAAAAAAD//gAXQ3JlYXRl
38
+ ZCB3aXRoIFRoZSBHSU1Q/9sAQwAFAwQEBAMFBAQEBQUFBgcMCAcHBwcPCwsJDBEPEhIRDxER
39
+ ExYcFxMUGhURERghGBodHR8fHxMXIiQiHiQcHh8e/9sAQwEFBQUHBgcOCAgOHhQRFB4eHh4e
40
+ Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4e/8AAEQgAAQAB
41
+ AwEiAAIRAQMRAf/EABUAAQEAAAAAAAAAAAAAAAAAAAAH/8QAFBABAAAAAAAAAAAAAAAAAAAA
42
+ AP/EABUBAQEAAAAAAAAAAAAAAAAAAAcI/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQAC
43
+ EQMRAD8AlgA6WW//2Q==
@@ -0,0 +1,89 @@
1
+ Delivered-To: tommy.tutone@example.com
2
+ Received: by 10.143.15.17 with SMTP id s17cs49532wfi;
3
+ Fri, 1 Aug 2008 12:56:15 -0700 (PDT)
4
+ Received: by 10.64.242.5 with SMTP id p5mr1182245qbh.33.1217620573911;
5
+ Fri, 01 Aug 2008 12:56:13 -0700 (PDT)
6
+ Return-Path: <2068675309@mms.telusmobility.com>
7
+ Received: from mmsda.int.eng.telusmobility.com (mms.eng.telusmobility.com [216.198.139.111])
8
+ by mx.google.com with ESMTP id s30si3336570qbs.8.2008.08.01.12.56.13;
9
+ Fri, 01 Aug 2008 12:56:13 -0700 (PDT)
10
+ Received-SPF: pass (google.com: domain of 2068675309@mms.telusmobility.com designates 216.198.139.111 as permitted sender) client-ip=216.198.139.111;
11
+ Authentication-Results: mx.google.com; spf=pass (google.com: domain of 2068675309@mms.telusmobility.com designates 216.198.139.111 as permitted sender) smtp.mail=2068675309@mms.telusmobility.com
12
+ Received: from koorb.mms.telusmobility.com ([10.33.238.7])
13
+ by mmsda.int.eng.telusmobility.com
14
+ (InterMail vM.7.05.02.00 201-2174-114-20060621) with ESMTP
15
+ id <20080801195612.UQZW332.mmsda.int.eng.telusmobility.com@koorb.mms.telusmobility.com>
16
+ for <tommy.tutone@example.com>; Fri, 1 Aug 2008 15:56:12 -0400
17
+ Received: from opwvsmtp ([10.33.238.128]) by mmsra.mms.telusmobility.com
18
+ (InterMail vM.6.01.05.00 201-2131-123-20050610) with SMTP
19
+ id <20080801172350.BSAN10761.mmsra.mms.telusmobility.com@opwvsmtp>
20
+ for <tommy.tutone@example.com>; Fri, 1 Aug 2008 13:23:50 -0400
21
+ Content-Type: multipart/related; boundary="489346a65c46qwerty_0000"; type="multipart/alternative"
22
+ To: <tommy.tutone@example.com>
23
+ Date: Fri, 01 Aug 2008 17:23:50 GMT
24
+ From: 2068675309@msg.telus.com
25
+ Sender: "2068675309" <2068675309@msg.telus.com>
26
+ MIME-Version: 1.0
27
+ Message-Id: <20080801172350.BSAN10761.mmsra.mms.telusmobility.com@opwvsmtp>
28
+
29
+ This is a multi-part message in MIME format.
30
+
31
+ --489346a65c46qwerty_0000
32
+ Content-Type: multipart/alternative; boundary="prez_1234567890_ldksjfa"
33
+
34
+
35
+ --prez_1234567890_ldksjfa
36
+ Content-Type: text/plain; charset="utf-8"
37
+
38
+ This is an MMS message. Please go to http://mms.telusmobility.com/do/LegacyLogin to view the message.
39
+ --prez_1234567890_ldksjfa
40
+ Content-Type: text/html; charset="utf-8"
41
+
42
+ <html><body>
43
+
44
+ <html>
45
+ <HEAD>
46
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
47
+ <LINK HREF="http://www.telusmobility.com/css/styles.css" TYPE="text/css" REL="stylesheet">
48
+ </head>
49
+ <body link="#49166D" alink="#A559DD" vlink="#49166D">
50
+ <center> <p><br><p>
51
+ <img src="cid:ORpaXzL8GX.jpg" border="0" alt="Lil%20bud%202.jpg"><p>
52
+ </center>
53
+ <br>
54
+ <table width="640" border="0" align="center" cellpadding="0">
55
+ <tr>
56
+ <td width="304" valign="top"> <div align="left"><span class="textlevelone">You've received a Message from a TELUS phone.</span>
57
+ <p class="smalltext3">For more information on TELUS Mobility's Picture or Video Messaging, visit telusmobility.com/snap.
58
+ <p class="smalltext3">If you don't hear or see the file, <a href="http://www.apple.com/quicktime/download" target="_blank" class="smalltext3">download the Quick Time player</a>.<br>
59
+ <p class="smalltext3"><img src="http://www.telusmobility.com/images/logos/telusmobitliy_214x60.gif" width="214" height="60"></div></td>
60
+ <td width="1" class="bgtblgray"><image src="/images/spacer.gif" width="1" height="1"></td>
61
+ <td width="10" valign="top">&nbsp;</td>
62
+ <td width="315" valign="top"><span class="textlevelone">Vous avez re&ccedil;u un Message d'un t&eacute;l&eacute;phone TELUS.</span>
63
+ <p class="smalltext3">Pour obtenir plus d'information sur la messagerie photo ou vid&eacute;o de TELUS, allez &agrave; telusmobilite.com/clic.
64
+ <p class="smalltext3">Si vous ne voyez ni n'entendez le fichier, <a href="http://www.apple.com/ca/fr/quicktime/" target="_blank" class="smalltext3">veuillez t&eacute;l&eacute;charger QuickTime</a>.
65
+ <p class="smalltext3"><img src="http://www.telusmobilite.com/images/logos/telusmobitliy_214x60.gif" width="214" height="60"></td>
66
+ </tr>
67
+ </table>
68
+ </body>
69
+ </html>
70
+ </body></html>
71
+
72
+ --prez_1234567890_ldksjfa--
73
+
74
+ --489346a65c46qwerty_0000
75
+ Content-ID: <ORpaXzL8GX.jpg>
76
+ Content-Type: image/jpeg; filename="Lil bud 2.jpg"; name="Lil%20bud%202.jpg"
77
+ Content-Disposition: inline; filename="Lil%2520bud%25202.jpg"
78
+ Content-Transfer-Encoding: base64
79
+
80
+ /9j/4AAQSkZJRgABAQEASABIAAD/4QAWRXhpZgAATU0AKgAAAAgAAAAAAAD//gAXQ3JlYXRl
81
+ ZCB3aXRoIFRoZSBHSU1Q/9sAQwAFAwQEBAMFBAQEBQUFBgcMCAcHBwcPCwsJDBEPEhIRDxER
82
+ ExYcFxMUGhURERghGBodHR8fHxMXIiQiHiQcHh8e/9sAQwEFBQUHBgcOCAgOHhQRFB4eHh4e
83
+ Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4e/8AAEQgAAQAB
84
+ AwEiAAIRAQMRAf/EABUAAQEAAAAAAAAAAAAAAAAAAAAH/8QAFBABAAAAAAAAAAAAAAAAAAAA
85
+ AP/EABUBAQEAAAAAAAAAAAAAAAAAAAcI/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQAC
86
+ EQMRAD8AlgA6WW//2Q==
87
+
88
+ --489346a65c46qwerty_0000--
89
+
@@ -0,0 +1,60 @@
1
+ Delivered-To: tommy.tutone@example.com
2
+ Received: by 10.142.113.15 with SMTP id l15cs203338wfc;
3
+ Sun, 21 Sep 2008 14:22:52 -0700 (PDT)
4
+ Received: by 10.150.152.17 with SMTP id z17mr6152577ybd.235.1222032171610;
5
+ Sun, 21 Sep 2008 14:22:51 -0700 (PDT)
6
+ Return-Path: <joeexample@unicel.com>
7
+ Received: from mail.rccw.com (mail.unicel.com [63.109.157.69])
8
+ by mx.google.com with ESMTP id 34si4350125yxl.8.2008.09.21.14.22.48;
9
+ Sun, 21 Sep 2008 14:22:51 -0700 (PDT)
10
+ Received-SPF: pass (google.com: best guess record for domain of joeexample@unicel.com designates 63.109.157.69 as permitted sender) client-ip=63.109.157.69;
11
+ Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of joeexample@unicel.com designates 63.109.157.69 as permitted sender) smtp.mail=joeexample@unicel.com
12
+ X-IronPort-AV: E=Sophos;i="4.32,442,1217826000";
13
+ d="jpg'145?scan'145,208,145";a="94699573"
14
+ Received: from unknown (HELO rccsmwtx.intrcc.com) ([10.41.4.152])
15
+ by mail.intrcc.com with ESMTP; 21 Sep 2008 16:22:48 -0500
16
+ Received: from 10.41.4.152 ([10.41.4.152]) by rccsmwtx.intrcc.com ([10.41.4.152]) with Microsoft Exchange Server HTTP-DAV ;
17
+ Sun, 21 Sep 2008 21:22:46 +0000
18
+ From: "Joe Example" <joeexample@unicel.com>
19
+ To: <tommy.tutone@example.com>
20
+ Message-ID: <daf401c91c30$3155db88$9804290a@intrcc.com>
21
+ Date: Sat, 20 Sep 2008 11:24:34 -0700
22
+ Subject: Unicel
23
+ X-Mailer: Moto-EZX
24
+ thread-topic: Unicel
25
+ thread-index: AckcMDFVHiWAjuguTiqL9b1BbfXCxQ==
26
+ MIME-Version: 1.0
27
+ Content-Type: multipart/mixed;
28
+ boundary="------------69EFAA5FBF6199713ED715F7";
29
+ charset="iso-8859-1"
30
+ X-Priority: 3
31
+ Content-Transfer-Encoding: quoted-printable
32
+ X-MOT-Smart-Send-RefFolderID: 0
33
+ X-MOT-Smart-Send-RefMessageID: 0
34
+ X-MOT-Smart-Send-Data-Length: 10
35
+ X-MOT-Smart-Send-Type: 0
36
+
37
+ --------------69EFAA5FBF6199713ED715F7
38
+ Content-Type: text/plain;
39
+ charset=iso-8859-1
40
+ Content-Transfer-Encoding: quoted-printable
41
+ X-MOT-AS-Attn-Size: 0
42
+
43
+ 2068675309
44
+
45
+ --------------69EFAA5FBF6199713ED715F7
46
+ Content-Type: image/jpeg;
47
+ charset=us-ascii;
48
+ name="moto_0002.jpg"
49
+ Content-Transfer-Encoding: base64
50
+ X-MOT-AS-Attn-Size: 0
51
+
52
+ /9j/4AAQSkZJRgABAQEASABIAAD/4QAWRXhpZgAATU0AKgAAAAgAAAAAAAD//gAXQ3JlYXRl
53
+ ZCB3aXRoIFRoZSBHSU1Q/9sAQwAFAwQEBAMFBAQEBQUFBgcMCAcHBwcPCwsJDBEPEhIRDxER
54
+ ExYcFxMUGhURERghGBodHR8fHxMXIiQiHiQcHh8e/9sAQwEFBQUHBgcOCAgOHhQRFB4eHh4e
55
+ Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4e/8AAEQgAAQAB
56
+ AwEiAAIRAQMRAf/EABUAAQEAAAAAAAAAAAAAAAAAAAAH/8QAFBABAAAAAAAAAAAAAAAAAAAA
57
+ AP/EABUBAQEAAAAAAAAAAAAAAAAAAAcI/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQAC
58
+ EQMRAD8AlgA6WW//2Q==
59
+
60
+ --------------69EFAA5FBF6199713ED715F7--
@@ -0,0 +1,44 @@
1
+ require File.join(File.dirname(__FILE__), "..", "lib", "mms2r")
2
+ require File.join(File.dirname(__FILE__), "test_helper")
3
+ require 'test/unit'
4
+ require 'rubygems'
5
+ require 'mocha'
6
+ gem 'tmail', '>= 1.2.1'
7
+ require 'tmail'
8
+
9
+ class TestBellCanada < Test::Unit::TestCase
10
+ include MMS2R::TestHelper
11
+
12
+ def test_image_and_text_and_number
13
+ mail = TMail::Mail.parse(load_mail('bell-canada-image-01.mail').join)
14
+ mms = MMS2R::Media.new(mail)
15
+
16
+ assert_equal "2068675309", mms.number
17
+ assert_equal "A Picture/Video Message!", mms.subject
18
+
19
+ assert_equal 4, mms.media.size
20
+ assert_equal 1, mms.media['image/jpeg'].size
21
+ assert_equal 6, mms.media['image/gif'].size
22
+ assert_equal 1, mms.media['text/html'].size
23
+ assert_equal 1, mms.media['text/plain'].size
24
+
25
+ # make sure transform strips out massive dtd at start of doc
26
+ assert_equal 3331, File.size(mms.media['text/html'].first)
27
+
28
+ mms.purge
29
+ end
30
+
31
+
32
+ def test_default_media_should_return_user_generated_content
33
+ mail = TMail::Mail.parse(load_mail('bell-canada-image-01.mail').join)
34
+ mms = MMS2R::Media.new(mail)
35
+ file = mms.default_media
36
+
37
+ # make sure the users jpg is the one that we default to
38
+ assert_equal 31962, file.size
39
+ assert_equal '.jpg', File.extname(file.path)
40
+
41
+ mms.purge
42
+ end
43
+
44
+ end
@@ -0,0 +1,13 @@
1
+ # based on Trouble shooting section in http://gems.github.com/
2
+ require 'test/unit'
3
+ require 'rubygems'
4
+
5
+ class TestGithub < Test::Unit::TestCase
6
+
7
+ def test_build_github_gem
8
+ result = `ruby #{File.join(File.dirname(__FILE__), "..", "dev_tools", "github.rb")}`
9
+ puts result
10
+ assert_equal 0, $?.exitstatus
11
+ end
12
+
13
+ end
@@ -13,7 +13,11 @@ module MMS2R
13
13
  end
14
14
 
15
15
  def load_mail(file)
16
- IO.readlines("#{File.dirname(__FILE__)}/fixtures/#{file}")
16
+ IO.readlines(mail_fixture(file))
17
+ end
18
+
19
+ def mail_fixture(file)
20
+ "#{File.dirname(__FILE__)}/fixtures/#{file}"
17
21
  end
18
22
  end
19
23
  end
@@ -245,6 +245,24 @@ class TestMms2rMedia < Test::Unit::TestCase
245
245
  assert_equal result, mms.transform_text(type, text)
246
246
  end
247
247
 
248
+ def test_transform_text_to_utf8
249
+ mail = TMail::Mail.load(mail_fixture('iconv-fr-text-01.mail'))
250
+ mms = MMS2R::Media.new(mail)
251
+
252
+ assert_equal 2, mms.media.size
253
+ assert_equal 1, mms.media['text/plain'].size
254
+ assert_equal 1, mms.media['text/html'].size
255
+ file = mms.media['text/plain'][0]
256
+ assert_not_nil file
257
+ assert_equal true, File::exist?(file)
258
+ text = IO.readlines("#{file}").join
259
+ #assert_match(/D'ici un mois Géorgie/, text)
260
+ assert_match(/D'ici un mois G\303\203\302\251orgie/, text)
261
+ assert_equal("sample email message Fwd: sub D'ici un mois G\303\203\302\251orgie",
262
+ mms.subject)
263
+ mms.purge
264
+ end
265
+
248
266
  def test_subject
249
267
  s = 'hello world'
250
268
  mail = stub_mail()
@@ -378,6 +396,20 @@ class TestMms2rMedia < Test::Unit::TestCase
378
396
  assert_equal temp_big_video, mms.default_media.local_path
379
397
  end
380
398
 
399
+ def test_default_media_treats_gif_and_jpg_equally
400
+ #it doesn't matter that these are text files, we just need say they are images
401
+ temp_big = temp_text_file("hello world")
402
+ temp_small = temp_text_file("hello")
403
+
404
+ mms = MMS2R::Media.new(stub_mail())
405
+ mms.stubs(:media).returns({'image/jpeg' => [temp_big], 'image/gif' => [temp_small]})
406
+ assert_equal temp_big, mms.default_media.local_path
407
+
408
+ mms = MMS2R::Media.new(stub_mail())
409
+ mms.stubs(:media).returns({'image/gif' => [temp_big], 'image/jpg' => [temp_small]})
410
+ assert_equal temp_big, mms.default_media.local_path
411
+ end
412
+
381
413
  def test_purge
382
414
  mms = MMS2R::Media.new(stub_mail())
383
415
  mms.purge
@@ -0,0 +1,28 @@
1
+ require File.join(File.dirname(__FILE__), "..", "lib", "mms2r")
2
+ require File.join(File.dirname(__FILE__), "test_helper")
3
+ require 'test/unit'
4
+ require 'rubygems'
5
+ require 'mocha'
6
+ gem 'tmail', '>= 1.2.1'
7
+ require 'tmail'
8
+
9
+ class TestMsgTelusCom < Test::Unit::TestCase
10
+ include MMS2R::TestHelper
11
+
12
+ def test_subject_number_image
13
+ mail = TMail::Mail.parse(load_mail('telus-image-01.mail').join)
14
+ mms = MMS2R::Media.new(mail)
15
+
16
+ assert_equal "", mms.subject
17
+ assert_equal "2068675309", mms.number
18
+
19
+ assert_equal 1, mms.media.size
20
+ assert_equal 1, mms.media['image/jpeg'].size
21
+
22
+ image = mms.media['image/jpeg'].detect{|f| /Lil%20bud%202.jpg/ =~ f}
23
+ assert_equal 337, File.size(image)
24
+
25
+ mms.purge
26
+ end
27
+
28
+ end
@@ -0,0 +1,49 @@
1
+ require File.join(File.dirname(__FILE__), "..", "lib", "mms2r")
2
+ require File.join(File.dirname(__FILE__), "test_helper")
3
+ require 'test/unit'
4
+ require 'rubygems'
5
+ require 'mocha'
6
+ gem 'tmail', '>= 1.2.1'
7
+ require 'tmail'
8
+
9
+ class TestMmsUnicelCom < Test::Unit::TestCase
10
+ include MMS2R::TestHelper
11
+
12
+ def test_subject_number_image_unicel
13
+ mail = TMail::Mail.parse(load_mail('unicel-image-01.mail').join)
14
+ mms = MMS2R::Media.new(mail)
15
+
16
+ assert_equal "", mms.subject
17
+ # assert_equal "1234567890", mms.number
18
+
19
+ assert_equal 2, mms.media.size
20
+ assert_equal 1, mms.media['text/plain'].size
21
+ assert_equal 1, mms.media['image/jpeg'].size
22
+
23
+ image = mms.media['image/jpeg'].detect{|f| /moto_0002\.jpg/ =~ f}
24
+ assert_equal 337, File.size(image)
25
+
26
+ file = mms.media['text/plain'][0]
27
+ text = IO.readlines("#{file}").join
28
+ assert_match(/2068675309/, text)
29
+
30
+ mms.purge
31
+ end
32
+
33
+ def test_subject_number_image_info2go
34
+ mail = TMail::Mail.parse(load_mail('info2go-image-01.mail').join)
35
+ mms = MMS2R::Media.new(mail)
36
+
37
+ assert_equal "", mms.subject
38
+ assert_equal "2068675309", mms.number
39
+
40
+ assert_equal 1, mms.media.size
41
+ assert_equal 1, mms.media['image/jpeg'].size
42
+
43
+ image = mms.media['image/jpeg'].detect{|f| /Image047\.jpeg/ =~ f}
44
+ assert_equal 337, File.size(image)
45
+
46
+ mms.purge
47
+ end
48
+
49
+ 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.1.0
4
+ version: 2.1.1
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: 2008-07-30 00:00:00 -07:00
12
+ date: 2008-09-24 00:00:00 -07: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.7.0
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 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 * 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 * Vodacom: mms.vodacom4me.co.za * Verizon: vzwpix.com, vtext.com * PLSPICTURES.COM mms hosting: waw.plspictures.com"
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 * Unicel: unicel.com, info2go.com (note: mobile number is tucked away in a text/plain part for unicel.com) * Vodacom: mms.vodacom4me.co.za * Verizon: vzwpix.com, vtext.com"
46
46
  email: mikemondragon@gmail.com
47
47
  executables: []
48
48
 
@@ -53,6 +53,7 @@ extra_rdoc_files:
53
53
  - Manifest.txt
54
54
  - README.txt
55
55
  files:
56
+ - .gitignore
56
57
  - History.txt
57
58
  - Manifest.txt
58
59
  - README.txt
@@ -77,20 +78,25 @@ files:
77
78
  - conf/mms.vodacom4me.co.za.yml
78
79
  - conf/mms2r_media.yml
79
80
  - conf/mobile.indosat.net.id.yml
81
+ - conf/msg.telus.com.yml
80
82
  - conf/orangemms.net.yml
81
83
  - conf/pm.sprint.com.yml
82
84
  - conf/pxt.vodafone.net.nz.yml
83
85
  - conf/rci.rogers.com.yml
84
86
  - conf/sms.sasktel.com.yml
85
87
  - conf/tmomail.net.yml
88
+ - conf/txt.bell.ca.yml
89
+ - conf/unicel.com.yml
86
90
  - conf/vzwpix.com.yml
87
91
  - conf/waw.plspictures.com.yml
88
92
  - dev_tools/anonymizer.rb
89
93
  - dev_tools/debug_sprint_hpricot_parsing.rb
94
+ - dev_tools/github.rb
90
95
  - lib/mms2r.rb
91
96
  - lib/mms2r/media.rb
92
97
  - lib/mms2r/media/sprint.rb
93
98
  - lib/tmail_ext.rb
99
+ - mms2r.gemspec
94
100
  - test/fixtures/1nbox-2images-01.mail
95
101
  - test/fixtures/1nbox-2images-02.mail
96
102
  - test/fixtures/1nbox-2images-03.mail
@@ -108,14 +114,17 @@ files:
108
114
  - test/fixtures/att-iphone-02.mail
109
115
  - test/fixtures/att-iphone-03.mail
110
116
  - test/fixtures/att-text-01.mail
117
+ - test/fixtures/bell-canada-image-01.mail
111
118
  - test/fixtures/cingularme-text-01.mail
112
119
  - test/fixtures/cingularme-text-02.mail
113
120
  - test/fixtures/dobson-image-01.mail
114
121
  - test/fixtures/dot.jpg
115
122
  - test/fixtures/helio-image-01.mail
116
123
  - test/fixtures/helio-message-01.mail
124
+ - test/fixtures/iconv-fr-text-01.mail
117
125
  - test/fixtures/indosat-image-01.mail
118
126
  - test/fixtures/indosat-image-02.mail
127
+ - test/fixtures/info2go-image-01.mail
119
128
  - test/fixtures/luxgsm-image-01.mail
120
129
  - test/fixtures/maroctelecom-france-mms-01.mail
121
130
  - test/fixtures/mediamessaging_o2_co_uk-image-01.mail
@@ -147,11 +156,13 @@ files:
147
156
  - test/fixtures/sprint-video-01.mail
148
157
  - test/fixtures/sprint.mov
149
158
  - test/fixtures/suncom-blackberry.mail
159
+ - test/fixtures/telus-image-01.mail
150
160
  - test/fixtures/three-uk-image-01.mail
151
161
  - test/fixtures/tmobile-blackberry-02.mail
152
162
  - test/fixtures/tmobile-blackberry.mail
153
163
  - test/fixtures/tmobile-image-01.mail
154
164
  - test/fixtures/tmobile-image-02.mail
165
+ - test/fixtures/unicel-image-01.mail
155
166
  - test/fixtures/verizon-blackberry.mail
156
167
  - test/fixtures/verizon-image-01.mail
157
168
  - test/fixtures/verizon-image-02.mail
@@ -165,7 +176,9 @@ files:
165
176
  - test/fixtures/vtext-text-01.mail
166
177
  - test/fixtures/waw.plspictures.com-image-01.mail
167
178
  - test/test_1nbox_net.rb
179
+ - test/test_bell_canada.rb
168
180
  - test/test_bellsouth_net.rb
181
+ - test/test_github.rb
169
182
  - test/test_helper.rb
170
183
  - test/test_mediamessaging_o2_co_uk.rb
171
184
  - test/test_messaging_nextel_com.rb
@@ -185,12 +198,14 @@ files:
185
198
  - test/test_mms_three_co_uk.rb
186
199
  - test/test_mms_vodacom4me_co_za.rb
187
200
  - test/test_mobile_indosat_net_id.rb
201
+ - test/test_msg_telus_com.rb
188
202
  - test/test_orangemms_net.rb
189
203
  - test/test_pm_sprint_com.rb
190
204
  - test/test_pxt_vodafone_net_nz.rb
191
205
  - test/test_rci_rogers_com.rb
192
206
  - test/test_sms_sasktel_com.rb
193
207
  - test/test_tmomail_net.rb
208
+ - test/test_unicel_com.rb
194
209
  - test/test_vzwpix_com.rb
195
210
  - test/test_waw_plspictures_com.rb
196
211
  - vendor/plugins/mms2r/lib/autotest/discover.rb
@@ -229,6 +244,7 @@ test_files:
229
244
  - test/test_pxt_vodafone_net_nz.rb
230
245
  - test/test_mms_mycricket_com.rb
231
246
  - test/test_mobile_indosat_net_id.rb
247
+ - test/test_unicel_com.rb
232
248
  - test/test_pm_sprint_com.rb
233
249
  - test/test_messaging_sprintpcs_com.rb
234
250
  - test/test_vzwpix_com.rb
@@ -236,6 +252,7 @@ test_files:
236
252
  - test/test_mms2r_media.rb
237
253
  - test/test_waw_plspictures_com.rb
238
254
  - test/test_mms_3ireland_ie.rb
255
+ - test/test_msg_telus_com.rb
239
256
  - test/test_bellsouth_net.rb
240
257
  - test/test_mms_o2online_de.rb
241
258
  - test/test_mms_att_net.rb
@@ -247,6 +264,8 @@ test_files:
247
264
  - test/test_mms_three_co_uk.rb
248
265
  - test/test_mms_dobson_net.rb
249
266
  - test/test_mms_luxgsm_lu.rb
267
+ - test/test_bell_canada.rb
268
+ - test/test_github.rb
250
269
  - test/test_orangemms_net.rb
251
270
  - test/test_helper.rb
252
271
  - test/test_mms_mobileiam_ma.rb