mms2r 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 1.0.3 / 2007-04-05 (Paper Cut)
2
+
3
+ * Cleaned up packaging and errors in example found by Shane V. http://shanesbrain.net/
4
+
1
5
  == 1.0.2 / 2007-03-07
2
6
 
3
7
  * Reorganized tests and fixtures
@@ -6,7 +10,7 @@
6
10
  * Nextel => messaging.nextel.com
7
11
  * Verizon => vtext.com
8
12
 
9
- == 1.0.2 / 2007-03-07
13
+ == 1.0.1 / 2007-03-07
10
14
 
11
15
  * Flubbed RubyForge release ... do not use this.
12
16
 
data/README.txt CHANGED
@@ -1,8 +1,6 @@
1
- mms2r
1
+ = mms2r
2
2
 
3
- by Mike Mondragon
4
-
5
- http://mms2r.rubyforge.org/
3
+ http://mms2r.rubyforge.org/
6
4
 
7
5
  == DESCRIPTION:
8
6
 
@@ -41,7 +39,7 @@ TMail from 1.3.1 of ActionMailer is shipped as a vendor library with MMS2R
41
39
  require 'tmail'
42
40
  require 'fileutils'
43
41
 
44
- media = TMail::Media.parse(IO.readlines("sample-MMS.file").join)
42
+ media = TMail::Mail.parse(IO.readlines("sample-MMS.file").join)
45
43
  mms = MMS2R::Media.create(media,Logger.new(STDOUT))
46
44
 
47
45
  # process finds all the media in a MMS, strips advertsing, then
@@ -68,13 +66,16 @@ TMail from 1.3.1 of ActionMailer is shipped as a vendor library with MMS2R
68
66
 
69
67
  == REQUIREMENTS:
70
68
 
71
- * RCov
72
69
  * Hpricot
73
70
 
74
71
  == INSTALL:
75
72
 
76
73
  * sudo gem install mms2r
77
74
 
75
+ == Authors
76
+
77
+ Copyright (c) 2007 by Mike Mondragon (blog[http://blog.mondragon.cc/])
78
+
78
79
  == LICENSE:
79
80
 
80
81
  (The MIT License)
data/Rakefile CHANGED
@@ -12,12 +12,11 @@ Hoe.new('mms2r', MMS2R::Media::VERSION) do |p|
12
12
  p.rubyforge_name = 'mms2r'
13
13
  p.author = 'Mike Mondragon'
14
14
  p.email = 'mike@mondragon.cc'
15
- p.summary = 'Extract media from MMS '
16
- p.description = p.paragraphs_of('README.txt', 2..8).join("\n\n")
17
- p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
18
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
15
+ p.summary = 'Extract media from MMS'
16
+ p.description = p.paragraphs_of('README.txt', 2..6).join("\n\n")
17
+ p.url = p.paragraphs_of('README.txt', 1).first.strip
18
+ p.changes = p.paragraphs_of('History.txt', 1).join("\n\n")
19
19
  p.extra_deps << ['hpricot']
20
- p.extra_deps << ['rcov']
21
20
  p.clean_globs << 'coverage'
22
21
  end
23
22
 
@@ -2,4 +2,4 @@
2
2
  text/plain:
3
3
  - This is an MMS message. 2006 Sprint Nextel. All rights reserved.
4
4
  text/html:
5
- - <center>This is an MMS message. <br><center> 2006 Sprint Nextel. All rights reserved</center>
5
+ - This is an MMS message. <br><center> 2006 Sprint Nextel. All rights reserved</center>
@@ -80,13 +80,20 @@ module MMS2R
80
80
  # are of that type.
81
81
  attr_reader :media
82
82
 
83
+ ##
84
+ # Carrier is the domain name of the carrier. If the
85
+ # carrier is not known the carrier will be set to 'mms2r.media'
86
+
87
+ attr_reader :carrier
88
+
83
89
  ##
84
90
  # Creates a new Media comprised of a mail
85
91
  # a logger. Logger is an instance attribute allowing
86
92
  # for a logging strategy per carrier type
87
93
 
88
- def initialize(mail, logger=nil)
94
+ def initialize(mail, carrier, logger=nil)
89
95
  @mail = mail
96
+ @carrier = carrier
90
97
  @logger = logger
91
98
  @logger.info("#{self.class} created") unless @logger.nil?
92
99
  @media = Hash.new
@@ -111,9 +118,6 @@ module MMS2R
111
118
  def process_media(part)
112
119
  # TMail body auto-magically decodes quoted
113
120
  # printable for text/html type.
114
- # base64_decode is safe in TMail facade, no work is performed
115
- # if the part is not base64 encoded.
116
- part.base64_decode
117
121
  file = temp_file(part)
118
122
  if self.class.main_type?(part).eql?('text')
119
123
  type, content = transform_text(part)
@@ -267,12 +271,12 @@ module MMS2R
267
271
  # nil.
268
272
 
269
273
  def self.create(mail, logger=nil)
270
- d = lambda{['',MMS2R::Media]}
274
+ d = lambda{['mms2r.media',MMS2R::Media]}
271
275
  cc = MMS2R::CARRIER_CLASSES.detect(d) do |n, c|
272
276
  /[^@]+@(.+)/.match(mail.from[0])[1] =~ /#{Regexp.escape("#{n}")}/
273
277
  end
274
278
  cls = cc[1]
275
- cls.new(mail, logger)
279
+ cls.new(mail, cc[0], logger)
276
280
  end
277
281
 
278
282
  ##
@@ -6,7 +6,7 @@ module MMS2R
6
6
  ##
7
7
  # MMS2R Library version
8
8
 
9
- VERSION = '1.0.2'
9
+ VERSION = '1.0.3'
10
10
 
11
11
  end
12
12
  end
@@ -16,7 +16,7 @@ class MMS2RMediaTest < Test::Unit::TestCase
16
16
  GENERIC_CARRIER = 'mms.example.com'
17
17
 
18
18
  CARRIER_TO_CLASS = {
19
- 'unknowncarrier.tld' => MMS2R::Media,
19
+ 'mms2r.media' => MMS2R::Media,
20
20
  'mms.mycingular.com' => MMS2R::CingularMedia,
21
21
  'cingularme.com' => MMS2R::CingularMedia,
22
22
  'mmode.com' => MMS2R::MModeMedia,
@@ -144,6 +144,7 @@ class MMS2RMediaTest < Test::Unit::TestCase
144
144
  assert_equal(cls, mms.class, "expected a #{cls} and received a #{mms.class}")
145
145
  mms = MMS2R::Media.create(mail)
146
146
  assert_equal(cls, mms.class, "expected a #{cls} and received a #{mms.class}")
147
+ assert_equal(car, mms.carrier, "expected a #{car} and received a #{mms.carrier}")
147
148
  }
148
149
  end
149
150
 
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: mms2r
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.2
7
- date: 2007-03-07 00:00:00 -08:00
6
+ version: 1.0.3
7
+ date: 2007-04-05 00:00:00 -07:00
8
8
  summary: Extract media from MMS
9
9
  require_paths:
10
10
  - lib
11
11
  email: mike@mondragon.cc
12
- homepage:
12
+ homepage: http://mms2r.rubyforge.org/
13
13
  rubyforge_project: mms2r
14
- description: "http://mms2r.rubyforge.org/ == DESCRIPTION: MMS2R is a library that decodes the parts of an MMS message to disk while stripping out advertising injected by the cellphone 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 garbage 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. Corpus of carriers currently processed by MMS2R: * AT&T/Cingular => mmode.com * Cingular => mms.mycingular.com * Cingular => cingularme.com * Nextel => messaging.nextel.com * Sprint => pm.sprint.com * Sprint => messaging.sprintpcs.com * T-Mobile => tmomail.net * Verizon => vzwpix.com * Verizon => vtext.com == FEATURES/PROBLEMS:"
14
+ description: "== DESCRIPTION: MMS2R is a library that decodes the parts of an MMS message to disk while stripping out advertising injected by the cellphone 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 garbage 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. Corpus of carriers currently processed by MMS2R: * AT&T/Cingular => mmode.com * Cingular => mms.mycingular.com * Cingular => cingularme.com * Nextel => messaging.nextel.com * Sprint => pm.sprint.com * Sprint => messaging.sprintpcs.com * T-Mobile => tmomail.net * Verizon => vzwpix.com * Verizon => vtext.com"
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -124,15 +124,6 @@ dependencies:
124
124
  - !ruby/object:Gem::Version
125
125
  version: 0.0.0
126
126
  version:
127
- - !ruby/object:Gem::Dependency
128
- name: rcov
129
- version_requirement:
130
- version_requirements: !ruby/object:Gem::Version::Requirement
131
- requirements:
132
- - - ">"
133
- - !ruby/object:Gem::Version
134
- version: 0.0.0
135
- version:
136
127
  - !ruby/object:Gem::Dependency
137
128
  name: hoe
138
129
  version_requirement: