mms2r 1.1.12 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/History.txt +32 -2
  2. data/Manifest.txt +41 -79
  3. data/README.txt +50 -51
  4. data/Rakefile +3 -2
  5. data/conf/aliases.yml +8 -0
  6. data/conf/message.alltel.com.yml +14 -0
  7. data/conf/messaging.nextel.com.yml +10 -0
  8. data/conf/mms.att.net.yml +9 -0
  9. data/conf/mms.dobson.net.yml +4 -0
  10. data/conf/mms.luxgsm.lu.yml +8 -0
  11. data/conf/mms.myhelio.com.yml +12 -0
  12. data/conf/mms.netcom.no.yml +4 -0
  13. data/conf/mms.o2online.de.yml +8 -0
  14. data/conf/mms.three.co.uk.yml +15 -0
  15. data/conf/mms2r_media.yml +6 -0
  16. data/conf/orangemms.net.yml +13 -0
  17. data/conf/pm.sprint.com.yml +10 -0
  18. data/conf/pxt.vodafone.net.nz.yml +5 -0
  19. data/conf/tmomail.net.yml +16 -0
  20. data/conf/vzwpix.com.yml +8 -0
  21. data/dev_tools/anonymizer.rb +20 -0
  22. data/lib/mms2r.rb +19 -45
  23. data/lib/mms2r/media.rb +288 -300
  24. data/lib/mms2r/media/sprint.rb +189 -0
  25. data/test/fixtures/att-text-01.mail +27 -0
  26. data/test/fixtures/helio-image-01.mail +8 -8
  27. data/test/fixtures/helio-message-01.mail +327 -0
  28. data/test/fixtures/luxgsm-image-01.mail +388 -0
  29. data/test/fixtures/netcom-image-01.mail +556 -0
  30. data/test/fixtures/o2-de-image-01.mail +314 -0
  31. data/test/fixtures/orange-uk-image-01.mail +71 -0
  32. data/test/fixtures/pxt-image-01.mail +118 -0
  33. data/test/fixtures/sprint-broken-image-01.mail +1 -1
  34. data/test/fixtures/sprint-image-01.mail +211 -195
  35. data/test/fixtures/sprint-purged-image-01.mail +1 -1
  36. data/test/fixtures/sprint-two-images-01.mail +231 -198
  37. data/test/fixtures/sprint-video-01.mail +210 -195
  38. data/test/fixtures/three-uk-image-01.mail +1202 -0
  39. data/test/test_helper.rb +39 -0
  40. data/test/{test_mms2r_alltel_media.rb → test_message_alltel_com.rb} +13 -17
  41. data/test/{test_mms2r_nextel_media.rb → test_messaging_nextel_com.rb} +12 -19
  42. data/test/{test_mms2r_sprint_pcs_media.rb → test_messaging_sprintpcs_com.rb} +9 -10
  43. data/test/test_mms2r_media.rb +474 -316
  44. data/test/test_mms_att_net.rb +92 -0
  45. data/test/test_mms_dobson_net.rb +41 -0
  46. data/test/test_mms_luxgsm_lu.rb +50 -0
  47. data/test/test_mms_myhelio_com.rb +60 -0
  48. data/test/test_mms_netcom_no.rb +52 -0
  49. data/test/test_mms_o2online_de.rb +53 -0
  50. data/test/test_mms_three_co_uk.rb +42 -0
  51. data/test/test_orangemms_net.rb +100 -0
  52. data/test/test_pm_sprint_com.rb +201 -0
  53. data/test/test_pxt_vodafone_net_nz.rb +37 -0
  54. data/test/{test_mms2r_t_mobile_media.rb → test_tmomail_net.rb} +8 -19
  55. data/test/{test_mms2r_verizon_media.rb → test_vzwpix_com.rb} +34 -27
  56. data/vendor/plugins/mms2r/lib/autotest/mms2r.rb +16 -11
  57. metadata +128 -157
  58. data/conf/mms2r_alltel_media_ignore.yml +0 -13
  59. data/conf/mms2r_att_media_subject.yml +0 -3
  60. data/conf/mms2r_cingular_me_media_subject.yml +0 -3
  61. data/conf/mms2r_cingular_me_media_transform.yml +0 -7
  62. data/conf/mms2r_dobson_media_ignore.yml +0 -4
  63. data/conf/mms2r_helio_media_ignore.yml +0 -6
  64. data/conf/mms2r_media_ignore.yml +0 -5
  65. data/conf/mms2r_media_subject.yml +0 -3
  66. data/conf/mms2r_my_cingular_media_subject.yml +0 -3
  67. data/conf/mms2r_nextel_media_ignore.yml +0 -11
  68. data/conf/mms2r_orange_france_media_ignore.yml +0 -6
  69. data/conf/mms2r_orange_poland_media_subject.yml +0 -3
  70. data/conf/mms2r_sprint_media_ignore.yml +0 -7
  71. data/conf/mms2r_sprint_media_subject.yml +0 -3
  72. data/conf/mms2r_t_mobile_media_ignore.yml +0 -16
  73. data/conf/mms2r_verizon_media_ignore.yml +0 -4
  74. data/conf/mms2r_verizon_media_transform.yml +0 -5
  75. data/lib/mms2r/alltel_media.rb +0 -10
  76. data/lib/mms2r/att_media.rb +0 -13
  77. data/lib/mms2r/cingular_me_media.rb +0 -23
  78. data/lib/mms2r/dobson_media.rb +0 -13
  79. data/lib/mms2r/helio_media.rb +0 -20
  80. data/lib/mms2r/m_mode_media.rb +0 -13
  81. data/lib/mms2r/my_cingular_media.rb +0 -15
  82. data/lib/mms2r/nextel_media.rb +0 -17
  83. data/lib/mms2r/orange_france_media.rb +0 -10
  84. data/lib/mms2r/orange_poland_media.rb +0 -10
  85. data/lib/mms2r/sprint_media.rb +0 -182
  86. data/lib/mms2r/sprint_pcs_media.rb +0 -16
  87. data/lib/mms2r/t_mobile_media.rb +0 -21
  88. data/lib/mms2r/verizon_media.rb +0 -19
  89. data/lib/mms2r/vtext_media.rb +0 -16
  90. data/lib/vendor/text/format.rb +0 -1466
  91. data/lib/vendor/tmail.rb +0 -3
  92. data/lib/vendor/tmail/address.rb +0 -242
  93. data/lib/vendor/tmail/attachments.rb +0 -39
  94. data/lib/vendor/tmail/base64.rb +0 -71
  95. data/lib/vendor/tmail/config.rb +0 -69
  96. data/lib/vendor/tmail/encode.rb +0 -467
  97. data/lib/vendor/tmail/facade.rb +0 -552
  98. data/lib/vendor/tmail/header.rb +0 -914
  99. data/lib/vendor/tmail/info.rb +0 -35
  100. data/lib/vendor/tmail/loader.rb +0 -1
  101. data/lib/vendor/tmail/mail.rb +0 -447
  102. data/lib/vendor/tmail/mailbox.rb +0 -433
  103. data/lib/vendor/tmail/mbox.rb +0 -1
  104. data/lib/vendor/tmail/net.rb +0 -280
  105. data/lib/vendor/tmail/obsolete.rb +0 -135
  106. data/lib/vendor/tmail/parser.rb +0 -1522
  107. data/lib/vendor/tmail/port.rb +0 -377
  108. data/lib/vendor/tmail/quoting.rb +0 -131
  109. data/lib/vendor/tmail/scanner.rb +0 -41
  110. data/lib/vendor/tmail/scanner_r.rb +0 -263
  111. data/lib/vendor/tmail/stringio.rb +0 -277
  112. data/lib/vendor/tmail/tmail.rb +0 -1
  113. data/lib/vendor/tmail/utils.rb +0 -238
  114. data/test/fixtures/broken_from_spam.mail +0 -80
  115. data/test/fixtures/hello_world_empty_text.mail +0 -7
  116. data/test/fixtures/hello_world_mail_multipart.mail +0 -24
  117. data/test/fixtures/hello_world_mail_plain_no_content_type.mail +0 -7
  118. data/test/fixtures/hello_world_mail_plain_with_content_type.mail +0 -8
  119. data/test/fixtures/simple-with-two-images-two-texts.mail +0 -49
  120. data/test/fixtures/simple_image.mail +0 -19
  121. data/test/fixtures/simple_multipart_alternative.mail +0 -42
  122. data/test/test_mms2r_att_media.rb +0 -54
  123. data/test/test_mms2r_cingular_me_media.rb +0 -51
  124. data/test/test_mms2r_dobson_media.rb +0 -46
  125. data/test/test_mms2r_helio_media.rb +0 -49
  126. data/test/test_mms2r_m_mode_media.rb +0 -36
  127. data/test/test_mms2r_my_cingular_media.rb +0 -31
  128. data/test/test_mms2r_orange_france_media.rb +0 -53
  129. data/test/test_mms2r_orange_poland_media.rb +0 -42
  130. data/test/test_mms2r_sprint_media.rb +0 -269
  131. data/test/test_mms2r_vtext_media.rb +0 -28
@@ -1,6 +1,36 @@
1
+ == 1.2.0 / 2008-01-17 (Skwisgaar Skwigelf - fastest guitarist alive)
2
+
3
+ * added support for pxt.vodafone.net.nz PXT New Zealand
4
+ * added support for mms.o2online.de O2 Germany
5
+ * added support for orangemms.net Orange UK
6
+ * added support for txt.att.net AT&T
7
+ * added support for mms.luxgsm.lu LUXGSM S.A.
8
+ * added support for mms.netcom.no NetCom (Norway)
9
+ * added support for mms.three.co.uk Hutchison 3G UK Ltd
10
+ * removed deprecated #get_number use #number
11
+ * removed deprecated #get_subject use #subject
12
+ * removed deprecated #get_body use #body
13
+ * removed deprecated #get_media use #default_media
14
+ * removed deprecated #get_text use #default_text
15
+ * removed deprecated #get_attachment use #attachment
16
+ * fixed error when Sprint content server responds 500
17
+ * better yaml configs
18
+ * moved TMail dependency from Rails ActionMailer SVN to 'official' Gem
19
+ * ::new greedily processes MMS unless otherwise specified as an initialize
20
+ option :process => :lazy
21
+ * logger moved to initialize option :logger => some_logger
22
+ * testing using mocks and stubs instead of duck raped Net::HTTP
23
+ * fixed typo in name of method #attachement to #attachment
24
+ * fixed broken downloading of Sprint videos
25
+ * default subject back to ""
26
+ * sprint subject
27
+ * new zeland
28
+ * heckled! & flogged!
29
+ * link to Trac
30
+
1
31
  == 1.1.12 / 2007-10-21 (Dr. Ronald von Moldenberg - Endorsement specialist)
2
32
 
3
- * fetch orginal images from Sprint content server (Layton Wedgeworth)
33
+ * fetch original images from Sprint content server (Layton Wedgeworth)
4
34
  * ignore Sprint messages when requested content has been purged from their
5
35
  content server
6
36
 
@@ -39,7 +69,7 @@ Explosion)
39
69
 
40
70
  == 1.1.7 / 2007-08-25 (Adam Nergal, friend of Skwisgaar, but not Pickles)
41
71
 
42
- * Added suport for Orange of Poland, Orange mmsemail.orange.pl (Zbigniew
72
+ * Added support for Orange of Poland, Orange mmsemail.orange.pl (Zbigniew
43
73
  Sobiecki)
44
74
  * Cleaned up documentation modifiers
45
75
  * Cleaned out non-Ruby code idioms
@@ -2,90 +2,51 @@ History.txt
2
2
  Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
- conf/mms2r_alltel_media_ignore.yml
6
- conf/mms2r_att_media_subject.yml
7
- conf/mms2r_cingular_me_media_subject.yml
8
- conf/mms2r_cingular_me_media_transform.yml
9
- conf/mms2r_dobson_media_ignore.yml
10
- conf/mms2r_helio_media_ignore.yml
11
- conf/mms2r_media_ignore.yml
12
- conf/mms2r_media_subject.yml
13
- conf/mms2r_my_cingular_media_subject.yml
14
- conf/mms2r_nextel_media_ignore.yml
15
- conf/mms2r_orange_france_media_ignore.yml
16
- conf/mms2r_orange_poland_media_subject.yml
17
- conf/mms2r_sprint_media_ignore.yml
18
- conf/mms2r_sprint_media_subject.yml
19
- conf/mms2r_t_mobile_media_ignore.yml
20
- conf/mms2r_verizon_media_ignore.yml
21
- conf/mms2r_verizon_media_transform.yml
5
+ conf/aliases.yml
6
+ conf/message.alltel.com.yml
7
+ conf/messaging.nextel.com.yml
8
+ conf/mms.att.net.yml
9
+ conf/mms.dobson.net.yml
10
+ conf/mms.luxgsm.lu.yml
11
+ conf/mms.myhelio.com.yml
12
+ conf/mms.netcom.no.yml
13
+ conf/mms.o2online.de.yml
14
+ conf/mms.three.co.uk.yml
15
+ conf/mms2r_media.yml
16
+ conf/orangemms.net.yml
17
+ conf/pm.sprint.com.yml
18
+ conf/pxt.vodafone.net.nz.yml
19
+ conf/tmomail.net.yml
20
+ conf/vzwpix.com.yml
21
+ dev_tools/anonymizer.rb
22
22
  dev_tools/debug_sprint_hpricot_parsing.rb
23
23
  lib/mms2r.rb
24
- lib/mms2r/alltel_media.rb
25
- lib/mms2r/att_media.rb
26
- lib/mms2r/cingular_me_media.rb
27
- lib/mms2r/dobson_media.rb
28
- lib/mms2r/helio_media.rb
29
- lib/mms2r/m_mode_media.rb
30
24
  lib/mms2r/media.rb
31
- lib/mms2r/my_cingular_media.rb
32
- lib/mms2r/nextel_media.rb
33
- lib/mms2r/orange_france_media.rb
34
- lib/mms2r/orange_poland_media.rb
35
- lib/mms2r/sprint_media.rb
36
- lib/mms2r/sprint_pcs_media.rb
37
- lib/mms2r/t_mobile_media.rb
38
- lib/mms2r/verizon_media.rb
39
- lib/mms2r/vtext_media.rb
40
- lib/vendor/text/format.rb
41
- lib/vendor/tmail.rb
42
- lib/vendor/tmail/address.rb
43
- lib/vendor/tmail/attachments.rb
44
- lib/vendor/tmail/base64.rb
45
- lib/vendor/tmail/config.rb
46
- lib/vendor/tmail/encode.rb
47
- lib/vendor/tmail/facade.rb
48
- lib/vendor/tmail/header.rb
49
- lib/vendor/tmail/info.rb
50
- lib/vendor/tmail/loader.rb
51
- lib/vendor/tmail/mail.rb
52
- lib/vendor/tmail/mailbox.rb
53
- lib/vendor/tmail/mbox.rb
54
- lib/vendor/tmail/net.rb
55
- lib/vendor/tmail/obsolete.rb
56
- lib/vendor/tmail/parser.rb
57
- lib/vendor/tmail/port.rb
58
- lib/vendor/tmail/quoting.rb
59
- lib/vendor/tmail/scanner.rb
60
- lib/vendor/tmail/scanner_r.rb
61
- lib/vendor/tmail/stringio.rb
62
- lib/vendor/tmail/tmail.rb
63
- lib/vendor/tmail/utils.rb
25
+ lib/mms2r/media/sprint.rb
64
26
  test/fixtures/alltel-image-01.mail
65
27
  test/fixtures/att-image-01.mail
66
28
  test/fixtures/att-image-02.mail
67
- test/fixtures/broken_from_spam.mail
29
+ test/fixtures/att-text-01.mail
68
30
  test/fixtures/cingularme-text-01.mail
69
31
  test/fixtures/cingularme-text-02.mail
70
32
  test/fixtures/dobson-image-01.mail
71
33
  test/fixtures/dot.jpg
72
34
  test/fixtures/helio-image-01.mail
73
- test/fixtures/hello_world_empty_text.mail
74
- test/fixtures/hello_world_mail_multipart.mail
75
- test/fixtures/hello_world_mail_plain_no_content_type.mail
76
- test/fixtures/hello_world_mail_plain_with_content_type.mail
35
+ test/fixtures/helio-message-01.mail
36
+ test/fixtures/luxgsm-image-01.mail
77
37
  test/fixtures/mmode-image-01.mail
78
38
  test/fixtures/mycingular-image-01.mail
39
+ test/fixtures/netcom-image-01.mail
79
40
  test/fixtures/nextel-image-01.mail
80
41
  test/fixtures/nextel-image-02.mail
81
42
  test/fixtures/nextel-image-03.mail
82
43
  test/fixtures/nextel-image-04.mail
44
+ test/fixtures/o2-de-image-01.mail
45
+ test/fixtures/orange-uk-image-01.mail
83
46
  test/fixtures/orangefrance-text-and-image.mail
84
47
  test/fixtures/orangepoland-text-01.mail
85
48
  test/fixtures/orangepoland-text-02.mail
86
- test/fixtures/simple-with-two-images-two-texts.mail
87
- test/fixtures/simple_image.mail
88
- test/fixtures/simple_multipart_alternative.mail
49
+ test/fixtures/pxt-image-01.mail
89
50
  test/fixtures/sprint-broken-image-01.mail
90
51
  test/fixtures/sprint-image-01.mail
91
52
  test/fixtures/sprint-pcs-text-01.mail
@@ -94,6 +55,7 @@ test/fixtures/sprint-text-01.mail
94
55
  test/fixtures/sprint-two-images-01.mail
95
56
  test/fixtures/sprint-video-01.mail
96
57
  test/fixtures/sprint.mov
58
+ test/fixtures/three-uk-image-01.mail
97
59
  test/fixtures/tmobile-image-01.mail
98
60
  test/fixtures/tmobile-image-02.mail
99
61
  test/fixtures/verizon-image-01.mail
@@ -102,21 +64,21 @@ test/fixtures/verizon-text-01.mail
102
64
  test/fixtures/verizon-video-01.mail
103
65
  test/fixtures/vtext-text-01.mail
104
66
  test/test_helper.rb
105
- test/test_mms2r_alltel_media.rb
106
- test/test_mms2r_att_media.rb
107
- test/test_mms2r_cingular_me_media.rb
108
- test/test_mms2r_dobson_media.rb
109
- test/test_mms2r_helio_media.rb
110
- test/test_mms2r_m_mode_media.rb
67
+ test/test_message_alltel_com.rb
68
+ test/test_messaging_nextel_com.rb
69
+ test/test_messaging_sprintpcs_com.rb
111
70
  test/test_mms2r_media.rb
112
- test/test_mms2r_my_cingular_media.rb
113
- test/test_mms2r_nextel_media.rb
114
- test/test_mms2r_orange_france_media.rb
115
- test/test_mms2r_orange_poland_media.rb
116
- test/test_mms2r_sprint_media.rb
117
- test/test_mms2r_sprint_pcs_media.rb
118
- test/test_mms2r_t_mobile_media.rb
119
- test/test_mms2r_verizon_media.rb
120
- test/test_mms2r_vtext_media.rb
71
+ test/test_mms_att_net.rb
72
+ test/test_mms_dobson_net.rb
73
+ test/test_mms_luxgsm_lu.rb
74
+ test/test_mms_myhelio_com.rb
75
+ test/test_mms_netcom_no.rb
76
+ test/test_mms_o2online_de.rb
77
+ test/test_mms_three_co_uk.rb
78
+ test/test_orangemms_net.rb
79
+ test/test_pm_sprint_com.rb
80
+ test/test_pxt_vodafone_net_nz.rb
81
+ test/test_tmomail_net.rb
82
+ test/test_vzwpix_com.rb
121
83
  vendor/plugins/mms2r/lib/autotest/discover.rb
122
84
  vendor/plugins/mms2r/lib/autotest/mms2r.rb
data/README.txt CHANGED
@@ -1,67 +1,63 @@
1
1
  = mms2r
2
2
 
3
- http://mms2r.rubyforge.org/
3
+ http://mms2r.rubyforge.org/
4
+ http://rubyforge.org/tracker/?group_id=3065
4
5
 
5
6
  == DESCRIPTION:
6
7
 
7
8
  MMS2R is a library that decodes the parts of an MMS message to disk while
8
- stripping out advertising injected by the cellphone carriers. MMS messages are
9
+ stripping out advertising injected by the mobile carriers. MMS messages are
9
10
  multipart email and the carriers often inject branding into these messages. Use
10
11
  MMS2R if you want to get at the real user generated content from a MMS without
11
12
  having to deal with the cruft from the carriers.
12
13
 
13
- If MMS2R is not aware of a particular carrier no extra processing is done
14
- to the MMS other than decoding and consolidating its media.
14
+ If MMS2R is not aware of a particular carrier no extra processing is done to the
15
+ MMS other than decoding and consolidating its media.
15
16
 
16
- Contact the author to add additional carriers to be processed by the
17
- library. Suggestions and patches appreciated and welcomed!
17
+ Contact the author to add additional carriers to be processed by the library.
18
+ Suggestions and patches appreciated and welcomed!
18
19
 
19
20
  Corpus of carriers currently processed by MMS2R:
20
21
 
21
- * Alltel => message.alltel.com
22
- * AT&T => mms.att.net
23
- * AT&T/Cingular => mmode.com
24
- * Cingular => mms.mycingular.com
25
- * Cingular => cingularme.com
26
- * Dobson/Cellular One => mms.dobson.net
27
- * Helio => mms.myhelio.com
28
- * Nextel => messaging.nextel.com
29
- * Orange (Poland) => mmsemail.orange.pl
30
- * Orange (France) => orange.fr
31
- * Sprint => pm.sprint.com
32
- * Sprint => messaging.sprintpcs.com
33
- * T-Mobile => tmomail.net
34
- * Verizon => vzwpix.com
35
- * Verizon => vtext.com
22
+ * Alltel: message.alltel.com
23
+ * AT&T/Cingular/Legacy: mms.att.net, txt.att.net, mmode.com, mms.mycingular.com,
24
+ cingularme.com
25
+ * Dobson/Cellular One: mms.dobson.net
26
+ * Helio: mms.myhelio.com
27
+ * Hutchison 3G UK Ltd: mms.three.co.uk
28
+ * LUXGSM S.A.: mms.luxgsm.lu
29
+ * NetCom (Norway): mms.netcom.no
30
+ * Nextel: messaging.nextel.com
31
+ * O2 Germany: mms.o2online.de
32
+ * Orange & Regional Oranges: orangemms.net, mmsemail.orange.pl, orange.fr
33
+ * PXT New Zealand: pxt.vodafone.net.nz
34
+ * Sprint: pm.sprint.com, messaging.sprintpcs.com
35
+ * T-Mobile: tmomail.net
36
+ * Verizon: vzwpix.com, vtext.com
36
37
 
37
38
  == FEATURES
38
39
 
39
40
  * #default_media and #default_text methods return a File that can be used in
40
41
  attachment_fu
42
+ * #process supports blocks to for enumerating over the content of the MMS
43
+ * #process can be made lazy when :process => :lazy is passed to new
44
+ * logging is enabled when :logger => your_logger is passed to new
41
45
 
42
46
  == SYNOPSIS:
43
47
 
44
- # required to use the MMS2R gem proper
45
48
  require 'rubygems'
46
49
  require 'mms2r'
47
50
 
48
51
  # required for the example
49
52
  require 'tmail'
50
53
  require 'fileutils'
51
- require 'logger'
52
54
 
53
- # TMail::Mail.parse is what ActionMailer::Base.receive(email) does, see:
54
- # http://wiki.rubyonrails.com/rails/pages/HowToReceiveEmailsWithActionMailer
55
- email = TMail::Mail.parse(IO.readlines("sample-MMS.file").join)
56
- mms = MMS2R::Media.create(email,Logger.new(STDOUT))
55
+ mail = TMail::Mail.parse(IO.readlines("sample-MMS.file").join)
56
+ mms = MMS2R::Media.new(mail)
57
57
 
58
- # process finds all the media in a MMS, strips advertsing, then
59
- # writes the user generated media to disk in a temporary subdirectory
60
- mms.process
58
+ puts "MMS has default carrier subject" if mms.subject.empty?
61
59
 
62
- puts "MMS has default carrier subject!" unless mms.subject
63
-
64
- # access the senders phone number
60
+ # access the sender's phone number
65
61
  puts "MMS was from phone #{mms.number}"
66
62
 
67
63
  # most MMS are either image or video, default_media will return the largest
@@ -69,7 +65,7 @@ Corpus of carriers currently processed by MMS2R:
69
65
  file = mms.default_media
70
66
  puts "MMS had a media: #{file.inspect}" unless file.nil?
71
67
 
72
- # text return the largest (non-advertising) text found
68
+ # finds the largest (non-advertising) text found
73
69
  file = mms.default_text
74
70
  puts "MMS had some text: #{file.inspect}" unless file.nil?
75
71
 
@@ -81,28 +77,33 @@ Corpus of carriers currently processed by MMS2R:
81
77
  mms.media['text/plain'].each {|f| puts "#{f}"}
82
78
 
83
79
  # print the text (assumes MMS had text)
84
- text = IO.readlines(mms.media['text/plain'][0]).join
80
+ text = IO.readlines(mms.media['text/plain'].first).join
85
81
  puts text
86
82
 
87
83
  # save the image (assumes MMS had a jpeg)
88
- FileUtils.cp mms.media['image/jpeg'][0], '/some/where/use/ful', :verbose => true
89
-
90
- puts "does the MMS have video? #{!mms.media['video/quicktime'].nil?}"
84
+ FileUtils.cp mms.media['image/jpeg'].first, '/some/where/useful', :verbose => true
91
85
 
92
- #remove all the media that was put to temporary disk
93
- mms.purge
86
+ puts "does the MMS have quicktime video? #{!mms.media['video/quicktime'].nil?}"
94
87
 
95
88
  # Block support, process and receive all media types of video.
96
- # Purge is called at the conclusion of the block so be sure
97
- # to do something with the bits you are looking for
98
89
  mms.process do |media_type, files|
99
- # assumes a Clip model
90
+ # assumes a Clip model that is an AttachmentFu
100
91
  Clip.create(:uploaded_data => files.first, :title => "From phone") if media_type =~ /video/
101
92
  end
102
93
 
94
+ # Another AttachmentFu example, Picture model is an AttachmentFu
95
+ picture = Picture.new
96
+ picture.title = mms.subject
97
+ picture.uploaded_data = mms.default_media
98
+ picture.save!
99
+
100
+ #remove all the media that was put to temporary disk
101
+ mms.purge
102
+
103
103
  == REQUIREMENTS:
104
104
 
105
105
  * Hpricot
106
+ * TMail
106
107
 
107
108
  == INSTALL:
108
109
 
@@ -110,16 +111,14 @@ Corpus of carriers currently processed by MMS2R:
110
111
 
111
112
  == CONTRIBUTE:
112
113
 
113
- If you contribute a patch that we accept then generally we'll
114
- give you developer rights for the project on RubyForge. Please
115
- ensure your work includes 100% test converage. Your text
116
- coverage can be verified with the rcov rake task. The library
117
- is ZenTest autotest discovery enabled so running autotest in the
118
- root of the project is very helpful during development.
114
+ If you contribute a patch that is accepted then you'll get developer rights
115
+ for the project on RubyForge. Please ensure your work includes 100% test
116
+ converage. The library is ZenTest autotest discovery enabled so running
117
+ autotest in the root of the project is very helpful during development.
119
118
 
120
119
  == Authors
121
120
 
122
- Copyright (c) 2007 by Mike Mondragon (blog[http://blog.mondragon.cc/])
121
+ Copyright (c) 2007-2008 by Mike Mondragon (blog[http://blog.mondragon.cc/])
123
122
 
124
123
  MMS2R's Flickr page[http://www.flickr.com/photos/8627919@N05/]
125
124
 
@@ -133,7 +132,7 @@ MMS2R's Flickr page[http://www.flickr.com/photos/8627919@N05/]
133
132
 
134
133
  (The MIT License)
135
134
 
136
- Copyright (c) 2007 Mike Mondragon (mikemondragon@gmail.com).
135
+ Copyright (c) 2007, 2008 Mike Mondragon (mikemondragon@gmail.com).
137
136
  All rights reserved.
138
137
 
139
138
  Permission is hereby granted, free of charge, to any person obtaining
data/Rakefile CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'hoe'
5
+
5
6
  begin
6
7
  require 'rcov/rcovtask'
7
8
  rescue LoadError
8
9
  end
9
10
 
10
- $LOAD_PATH.unshift 'lib'
11
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "lib")
11
12
  require 'mms2r'
12
13
 
13
14
  Hoe.new('mms2r', MMS2R::Media::VERSION) do |p|
@@ -19,7 +20,7 @@ Hoe.new('mms2r', MMS2R::Media::VERSION) do |p|
19
20
  p.url = p.paragraphs_of('README.txt', 1).first.strip
20
21
  p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
21
22
  p.extra_deps << ['hpricot', '>= 0.6.0']
22
- p.extra_deps << ['mechanize', '>= 0.6.9']
23
+ p.extra_deps << ['tmail', '>= 1.2.1']
23
24
  p.clean_globs << 'coverage'
24
25
  end
25
26
 
@@ -0,0 +1,8 @@
1
+ ---
2
+ txt.att.net: mms.att.net
3
+ cingularme.com: mms.att.net
4
+ mmode.com: mms.att.net
5
+ mms.mycingular.com: mms.att.net
6
+ vtext.com: vzwpix.com
7
+ orange.fr: orangemms.net
8
+ mmsemail.orange.pl: orangemms.net
@@ -0,0 +1,14 @@
1
+ ---
2
+ ignore:
3
+ multipart/alternative:
4
+ - mms
5
+ text/html:
6
+ - /<html>\s+<head>\s+<title>Picture Messaging<\/title>/m
7
+ image/gif:
8
+ - spacer.gif
9
+ - header.gif
10
+ - bluebar.gif
11
+ - divider.gif
12
+ - greenbar.gif
13
+ image/jpeg:
14
+ - alltel_logo.jpg
@@ -0,0 +1,10 @@
1
+ ---
2
+ ignore:
3
+ text/plain:
4
+ - /^This is an MMS message. 20\d\d Sprint Nextel. All rights reserved./
5
+ - /^This is an MMS message. Please go to http:\/\/mms.nextel.com\/mms\/anon\/do\/legacy\/viewDirect/
6
+ - /^This is a multi-part message in MIME format./
7
+ text/html:
8
+ - /^<html><body>\s+<center>This is an MMS message. <br><center> 20\d\d Sprint Nextel. All rights reserved<\/center><br><img/m
9
+ - /^<html><body>\s+This is an MMS message. <br><center> 20\d\d Sprint Nextel. All rights reserved/m
10
+ - /^<html><body>\s+This is an MMS message. Please go to <a href="http:\/\/mms.nextel.com\/mms\/anon\/do\/legacy\/viewDirect/m
@@ -0,0 +1,9 @@
1
+ ---
2
+ transform:
3
+ text/plain:
4
+ - - /^Multimedia message$/i
5
+ - ""
6
+ - - /\A(.+?)\s+--\s+=+\s+This mobile text message is brought to you by AT&T.*/im
7
+ - "\1"
8
+ - - /\A(.+?)\s+--\s+=+\s+Brought to you by, Cingular Wireless Messaging.*/im
9
+ - "\1"