mms2r 1.1.12 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +32 -2
- data/Manifest.txt +41 -79
- data/README.txt +50 -51
- data/Rakefile +3 -2
- data/conf/aliases.yml +8 -0
- data/conf/message.alltel.com.yml +14 -0
- data/conf/messaging.nextel.com.yml +10 -0
- data/conf/mms.att.net.yml +9 -0
- data/conf/mms.dobson.net.yml +4 -0
- data/conf/mms.luxgsm.lu.yml +8 -0
- data/conf/mms.myhelio.com.yml +12 -0
- data/conf/mms.netcom.no.yml +4 -0
- data/conf/mms.o2online.de.yml +8 -0
- data/conf/mms.three.co.uk.yml +15 -0
- data/conf/mms2r_media.yml +6 -0
- data/conf/orangemms.net.yml +13 -0
- data/conf/pm.sprint.com.yml +10 -0
- data/conf/pxt.vodafone.net.nz.yml +5 -0
- data/conf/tmomail.net.yml +16 -0
- data/conf/vzwpix.com.yml +8 -0
- data/dev_tools/anonymizer.rb +20 -0
- data/lib/mms2r.rb +19 -45
- data/lib/mms2r/media.rb +288 -300
- data/lib/mms2r/media/sprint.rb +189 -0
- data/test/fixtures/att-text-01.mail +27 -0
- data/test/fixtures/helio-image-01.mail +8 -8
- data/test/fixtures/helio-message-01.mail +327 -0
- data/test/fixtures/luxgsm-image-01.mail +388 -0
- data/test/fixtures/netcom-image-01.mail +556 -0
- data/test/fixtures/o2-de-image-01.mail +314 -0
- data/test/fixtures/orange-uk-image-01.mail +71 -0
- data/test/fixtures/pxt-image-01.mail +118 -0
- data/test/fixtures/sprint-broken-image-01.mail +1 -1
- data/test/fixtures/sprint-image-01.mail +211 -195
- data/test/fixtures/sprint-purged-image-01.mail +1 -1
- data/test/fixtures/sprint-two-images-01.mail +231 -198
- data/test/fixtures/sprint-video-01.mail +210 -195
- data/test/fixtures/three-uk-image-01.mail +1202 -0
- data/test/test_helper.rb +39 -0
- data/test/{test_mms2r_alltel_media.rb → test_message_alltel_com.rb} +13 -17
- data/test/{test_mms2r_nextel_media.rb → test_messaging_nextel_com.rb} +12 -19
- data/test/{test_mms2r_sprint_pcs_media.rb → test_messaging_sprintpcs_com.rb} +9 -10
- data/test/test_mms2r_media.rb +474 -316
- data/test/test_mms_att_net.rb +92 -0
- data/test/test_mms_dobson_net.rb +41 -0
- data/test/test_mms_luxgsm_lu.rb +50 -0
- data/test/test_mms_myhelio_com.rb +60 -0
- data/test/test_mms_netcom_no.rb +52 -0
- data/test/test_mms_o2online_de.rb +53 -0
- data/test/test_mms_three_co_uk.rb +42 -0
- data/test/test_orangemms_net.rb +100 -0
- data/test/test_pm_sprint_com.rb +201 -0
- data/test/test_pxt_vodafone_net_nz.rb +37 -0
- data/test/{test_mms2r_t_mobile_media.rb → test_tmomail_net.rb} +8 -19
- data/test/{test_mms2r_verizon_media.rb → test_vzwpix_com.rb} +34 -27
- data/vendor/plugins/mms2r/lib/autotest/mms2r.rb +16 -11
- metadata +128 -157
- data/conf/mms2r_alltel_media_ignore.yml +0 -13
- data/conf/mms2r_att_media_subject.yml +0 -3
- data/conf/mms2r_cingular_me_media_subject.yml +0 -3
- data/conf/mms2r_cingular_me_media_transform.yml +0 -7
- data/conf/mms2r_dobson_media_ignore.yml +0 -4
- data/conf/mms2r_helio_media_ignore.yml +0 -6
- data/conf/mms2r_media_ignore.yml +0 -5
- data/conf/mms2r_media_subject.yml +0 -3
- data/conf/mms2r_my_cingular_media_subject.yml +0 -3
- data/conf/mms2r_nextel_media_ignore.yml +0 -11
- data/conf/mms2r_orange_france_media_ignore.yml +0 -6
- data/conf/mms2r_orange_poland_media_subject.yml +0 -3
- data/conf/mms2r_sprint_media_ignore.yml +0 -7
- data/conf/mms2r_sprint_media_subject.yml +0 -3
- data/conf/mms2r_t_mobile_media_ignore.yml +0 -16
- data/conf/mms2r_verizon_media_ignore.yml +0 -4
- data/conf/mms2r_verizon_media_transform.yml +0 -5
- data/lib/mms2r/alltel_media.rb +0 -10
- data/lib/mms2r/att_media.rb +0 -13
- data/lib/mms2r/cingular_me_media.rb +0 -23
- data/lib/mms2r/dobson_media.rb +0 -13
- data/lib/mms2r/helio_media.rb +0 -20
- data/lib/mms2r/m_mode_media.rb +0 -13
- data/lib/mms2r/my_cingular_media.rb +0 -15
- data/lib/mms2r/nextel_media.rb +0 -17
- data/lib/mms2r/orange_france_media.rb +0 -10
- data/lib/mms2r/orange_poland_media.rb +0 -10
- data/lib/mms2r/sprint_media.rb +0 -182
- data/lib/mms2r/sprint_pcs_media.rb +0 -16
- data/lib/mms2r/t_mobile_media.rb +0 -21
- data/lib/mms2r/verizon_media.rb +0 -19
- data/lib/mms2r/vtext_media.rb +0 -16
- data/lib/vendor/text/format.rb +0 -1466
- data/lib/vendor/tmail.rb +0 -3
- data/lib/vendor/tmail/address.rb +0 -242
- data/lib/vendor/tmail/attachments.rb +0 -39
- data/lib/vendor/tmail/base64.rb +0 -71
- data/lib/vendor/tmail/config.rb +0 -69
- data/lib/vendor/tmail/encode.rb +0 -467
- data/lib/vendor/tmail/facade.rb +0 -552
- data/lib/vendor/tmail/header.rb +0 -914
- data/lib/vendor/tmail/info.rb +0 -35
- data/lib/vendor/tmail/loader.rb +0 -1
- data/lib/vendor/tmail/mail.rb +0 -447
- data/lib/vendor/tmail/mailbox.rb +0 -433
- data/lib/vendor/tmail/mbox.rb +0 -1
- data/lib/vendor/tmail/net.rb +0 -280
- data/lib/vendor/tmail/obsolete.rb +0 -135
- data/lib/vendor/tmail/parser.rb +0 -1522
- data/lib/vendor/tmail/port.rb +0 -377
- data/lib/vendor/tmail/quoting.rb +0 -131
- data/lib/vendor/tmail/scanner.rb +0 -41
- data/lib/vendor/tmail/scanner_r.rb +0 -263
- data/lib/vendor/tmail/stringio.rb +0 -277
- data/lib/vendor/tmail/tmail.rb +0 -1
- data/lib/vendor/tmail/utils.rb +0 -238
- data/test/fixtures/broken_from_spam.mail +0 -80
- data/test/fixtures/hello_world_empty_text.mail +0 -7
- data/test/fixtures/hello_world_mail_multipart.mail +0 -24
- data/test/fixtures/hello_world_mail_plain_no_content_type.mail +0 -7
- data/test/fixtures/hello_world_mail_plain_with_content_type.mail +0 -8
- data/test/fixtures/simple-with-two-images-two-texts.mail +0 -49
- data/test/fixtures/simple_image.mail +0 -19
- data/test/fixtures/simple_multipart_alternative.mail +0 -42
- data/test/test_mms2r_att_media.rb +0 -54
- data/test/test_mms2r_cingular_me_media.rb +0 -51
- data/test/test_mms2r_dobson_media.rb +0 -46
- data/test/test_mms2r_helio_media.rb +0 -49
- data/test/test_mms2r_m_mode_media.rb +0 -36
- data/test/test_mms2r_my_cingular_media.rb +0 -31
- data/test/test_mms2r_orange_france_media.rb +0 -53
- data/test/test_mms2r_orange_poland_media.rb +0 -42
- data/test/test_mms2r_sprint_media.rb +0 -269
- data/test/test_mms2r_vtext_media.rb +0 -28
data/lib/vendor/tmail/facade.rb
DELETED
@@ -1,552 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# facade.rb
|
3
|
-
#
|
4
|
-
#--
|
5
|
-
# Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
|
6
|
-
#
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
8
|
-
# a copy of this software and associated documentation files (the
|
9
|
-
# "Software"), to deal in the Software without restriction, including
|
10
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
11
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
13
|
-
# the following conditions:
|
14
|
-
#
|
15
|
-
# The above copyright notice and this permission notice shall be
|
16
|
-
# included in all copies or substantial portions of the Software.
|
17
|
-
#
|
18
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
-
#
|
26
|
-
# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
|
27
|
-
# with permission of Minero Aoki.
|
28
|
-
#++
|
29
|
-
|
30
|
-
require 'tmail/utils'
|
31
|
-
|
32
|
-
|
33
|
-
module TMail
|
34
|
-
|
35
|
-
class Mail
|
36
|
-
|
37
|
-
def header_string( name, default = nil )
|
38
|
-
h = @header[name.downcase] or return default
|
39
|
-
h.to_s
|
40
|
-
end
|
41
|
-
|
42
|
-
###
|
43
|
-
### attributes
|
44
|
-
###
|
45
|
-
|
46
|
-
include TextUtils
|
47
|
-
|
48
|
-
def set_string_array_attr( key, strs )
|
49
|
-
strs.flatten!
|
50
|
-
if strs.empty?
|
51
|
-
@header.delete key.downcase
|
52
|
-
else
|
53
|
-
store key, strs.join(', ')
|
54
|
-
end
|
55
|
-
strs
|
56
|
-
end
|
57
|
-
private :set_string_array_attr
|
58
|
-
|
59
|
-
def set_string_attr( key, str )
|
60
|
-
if str
|
61
|
-
store key, str
|
62
|
-
else
|
63
|
-
@header.delete key.downcase
|
64
|
-
end
|
65
|
-
str
|
66
|
-
end
|
67
|
-
private :set_string_attr
|
68
|
-
|
69
|
-
def set_addrfield( name, arg )
|
70
|
-
if arg
|
71
|
-
h = HeaderField.internal_new(name, @config)
|
72
|
-
h.addrs.replace [arg].flatten
|
73
|
-
@header[name] = h
|
74
|
-
else
|
75
|
-
@header.delete name
|
76
|
-
end
|
77
|
-
arg
|
78
|
-
end
|
79
|
-
private :set_addrfield
|
80
|
-
|
81
|
-
def addrs2specs( addrs )
|
82
|
-
return nil unless addrs
|
83
|
-
list = addrs.map {|addr|
|
84
|
-
if addr.address_group?
|
85
|
-
then addr.map {|a| a.spec }
|
86
|
-
else addr.spec
|
87
|
-
end
|
88
|
-
}.flatten
|
89
|
-
return nil if list.empty?
|
90
|
-
list
|
91
|
-
end
|
92
|
-
private :addrs2specs
|
93
|
-
|
94
|
-
|
95
|
-
#
|
96
|
-
# date time
|
97
|
-
#
|
98
|
-
|
99
|
-
def date( default = nil )
|
100
|
-
if h = @header['date']
|
101
|
-
h.date
|
102
|
-
else
|
103
|
-
default
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def date=( time )
|
108
|
-
if time
|
109
|
-
store 'Date', time2str(time)
|
110
|
-
else
|
111
|
-
@header.delete 'date'
|
112
|
-
end
|
113
|
-
time
|
114
|
-
end
|
115
|
-
|
116
|
-
def strftime( fmt, default = nil )
|
117
|
-
if t = date
|
118
|
-
t.strftime(fmt)
|
119
|
-
else
|
120
|
-
default
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
|
125
|
-
#
|
126
|
-
# destination
|
127
|
-
#
|
128
|
-
|
129
|
-
def to_addrs( default = nil )
|
130
|
-
if h = @header['to']
|
131
|
-
h.addrs
|
132
|
-
else
|
133
|
-
default
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def cc_addrs( default = nil )
|
138
|
-
if h = @header['cc']
|
139
|
-
h.addrs
|
140
|
-
else
|
141
|
-
default
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
def bcc_addrs( default = nil )
|
146
|
-
if h = @header['bcc']
|
147
|
-
h.addrs
|
148
|
-
else
|
149
|
-
default
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
def to_addrs=( arg )
|
154
|
-
set_addrfield 'to', arg
|
155
|
-
end
|
156
|
-
|
157
|
-
def cc_addrs=( arg )
|
158
|
-
set_addrfield 'cc', arg
|
159
|
-
end
|
160
|
-
|
161
|
-
def bcc_addrs=( arg )
|
162
|
-
set_addrfield 'bcc', arg
|
163
|
-
end
|
164
|
-
|
165
|
-
def to( default = nil )
|
166
|
-
addrs2specs(to_addrs(nil)) || default
|
167
|
-
end
|
168
|
-
|
169
|
-
def cc( default = nil )
|
170
|
-
addrs2specs(cc_addrs(nil)) || default
|
171
|
-
end
|
172
|
-
|
173
|
-
def bcc( default = nil )
|
174
|
-
addrs2specs(bcc_addrs(nil)) || default
|
175
|
-
end
|
176
|
-
|
177
|
-
def to=( *strs )
|
178
|
-
set_string_array_attr 'To', strs
|
179
|
-
end
|
180
|
-
|
181
|
-
def cc=( *strs )
|
182
|
-
set_string_array_attr 'Cc', strs
|
183
|
-
end
|
184
|
-
|
185
|
-
def bcc=( *strs )
|
186
|
-
set_string_array_attr 'Bcc', strs
|
187
|
-
end
|
188
|
-
|
189
|
-
|
190
|
-
#
|
191
|
-
# originator
|
192
|
-
#
|
193
|
-
|
194
|
-
def from_addrs( default = nil )
|
195
|
-
if h = @header['from']
|
196
|
-
h.addrs
|
197
|
-
else
|
198
|
-
default
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
def from_addrs=( arg )
|
203
|
-
set_addrfield 'from', arg
|
204
|
-
end
|
205
|
-
|
206
|
-
def from( default = nil )
|
207
|
-
addrs2specs(from_addrs(nil)) || default
|
208
|
-
end
|
209
|
-
|
210
|
-
def from=( *strs )
|
211
|
-
set_string_array_attr 'From', strs
|
212
|
-
end
|
213
|
-
|
214
|
-
def friendly_from( default = nil )
|
215
|
-
h = @header['from']
|
216
|
-
a, = h.addrs
|
217
|
-
return default unless a
|
218
|
-
return a.phrase if a.phrase
|
219
|
-
return h.comments.join(' ') unless h.comments.empty?
|
220
|
-
a.spec
|
221
|
-
end
|
222
|
-
|
223
|
-
|
224
|
-
def reply_to_addrs( default = nil )
|
225
|
-
if h = @header['reply-to']
|
226
|
-
h.addrs
|
227
|
-
else
|
228
|
-
default
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
def reply_to_addrs=( arg )
|
233
|
-
set_addrfield 'reply-to', arg
|
234
|
-
end
|
235
|
-
|
236
|
-
def reply_to( default = nil )
|
237
|
-
addrs2specs(reply_to_addrs(nil)) || default
|
238
|
-
end
|
239
|
-
|
240
|
-
def reply_to=( *strs )
|
241
|
-
set_string_array_attr 'Reply-To', strs
|
242
|
-
end
|
243
|
-
|
244
|
-
|
245
|
-
def sender_addr( default = nil )
|
246
|
-
f = @header['sender'] or return default
|
247
|
-
f.addr or return default
|
248
|
-
end
|
249
|
-
|
250
|
-
def sender_addr=( addr )
|
251
|
-
if addr
|
252
|
-
h = HeaderField.internal_new('sender', @config)
|
253
|
-
h.addr = addr
|
254
|
-
@header['sender'] = h
|
255
|
-
else
|
256
|
-
@header.delete 'sender'
|
257
|
-
end
|
258
|
-
addr
|
259
|
-
end
|
260
|
-
|
261
|
-
def sender( default )
|
262
|
-
f = @header['sender'] or return default
|
263
|
-
a = f.addr or return default
|
264
|
-
a.spec
|
265
|
-
end
|
266
|
-
|
267
|
-
def sender=( str )
|
268
|
-
set_string_attr 'Sender', str
|
269
|
-
end
|
270
|
-
|
271
|
-
|
272
|
-
#
|
273
|
-
# subject
|
274
|
-
#
|
275
|
-
|
276
|
-
def subject( default = nil )
|
277
|
-
if h = @header['subject']
|
278
|
-
h.body
|
279
|
-
else
|
280
|
-
default
|
281
|
-
end
|
282
|
-
end
|
283
|
-
alias quoted_subject subject
|
284
|
-
|
285
|
-
def subject=( str )
|
286
|
-
set_string_attr 'Subject', str
|
287
|
-
end
|
288
|
-
|
289
|
-
|
290
|
-
#
|
291
|
-
# identity & threading
|
292
|
-
#
|
293
|
-
|
294
|
-
def message_id( default = nil )
|
295
|
-
if h = @header['message-id']
|
296
|
-
h.id || default
|
297
|
-
else
|
298
|
-
default
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
def message_id=( str )
|
303
|
-
set_string_attr 'Message-Id', str
|
304
|
-
end
|
305
|
-
|
306
|
-
def in_reply_to( default = nil )
|
307
|
-
if h = @header['in-reply-to']
|
308
|
-
h.ids
|
309
|
-
else
|
310
|
-
default
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
def in_reply_to=( *idstrs )
|
315
|
-
set_string_array_attr 'In-Reply-To', idstrs
|
316
|
-
end
|
317
|
-
|
318
|
-
def references( default = nil )
|
319
|
-
if h = @header['references']
|
320
|
-
h.refs
|
321
|
-
else
|
322
|
-
default
|
323
|
-
end
|
324
|
-
end
|
325
|
-
|
326
|
-
def references=( *strs )
|
327
|
-
set_string_array_attr 'References', strs
|
328
|
-
end
|
329
|
-
|
330
|
-
|
331
|
-
#
|
332
|
-
# MIME headers
|
333
|
-
#
|
334
|
-
|
335
|
-
def mime_version( default = nil )
|
336
|
-
if h = @header['mime-version']
|
337
|
-
h.version || default
|
338
|
-
else
|
339
|
-
default
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
def mime_version=( m, opt = nil )
|
344
|
-
if opt
|
345
|
-
if h = @header['mime-version']
|
346
|
-
h.major = m
|
347
|
-
h.minor = opt
|
348
|
-
else
|
349
|
-
store 'Mime-Version', "#{m}.#{opt}"
|
350
|
-
end
|
351
|
-
else
|
352
|
-
store 'Mime-Version', m
|
353
|
-
end
|
354
|
-
m
|
355
|
-
end
|
356
|
-
|
357
|
-
|
358
|
-
def content_type( default = nil )
|
359
|
-
if h = @header['content-type']
|
360
|
-
h.content_type || default
|
361
|
-
else
|
362
|
-
default
|
363
|
-
end
|
364
|
-
end
|
365
|
-
|
366
|
-
def main_type( default = nil )
|
367
|
-
if h = @header['content-type']
|
368
|
-
h.main_type || default
|
369
|
-
else
|
370
|
-
default
|
371
|
-
end
|
372
|
-
end
|
373
|
-
|
374
|
-
def sub_type( default = nil )
|
375
|
-
if h = @header['content-type']
|
376
|
-
h.sub_type || default
|
377
|
-
else
|
378
|
-
default
|
379
|
-
end
|
380
|
-
end
|
381
|
-
|
382
|
-
def set_content_type( str, sub = nil, param = nil )
|
383
|
-
if sub
|
384
|
-
main, sub = str, sub
|
385
|
-
else
|
386
|
-
main, sub = str.split(%r</>, 2)
|
387
|
-
raise ArgumentError, "sub type missing: #{str.inspect}" unless sub
|
388
|
-
end
|
389
|
-
if h = @header['content-type']
|
390
|
-
h.main_type = main
|
391
|
-
h.sub_type = sub
|
392
|
-
h.params.clear
|
393
|
-
else
|
394
|
-
store 'Content-Type', "#{main}/#{sub}"
|
395
|
-
end
|
396
|
-
@header['content-type'].params.replace param if param
|
397
|
-
|
398
|
-
str
|
399
|
-
end
|
400
|
-
|
401
|
-
alias content_type= set_content_type
|
402
|
-
|
403
|
-
def type_param( name, default = nil )
|
404
|
-
if h = @header['content-type']
|
405
|
-
h[name] || default
|
406
|
-
else
|
407
|
-
default
|
408
|
-
end
|
409
|
-
end
|
410
|
-
|
411
|
-
def charset( default = nil )
|
412
|
-
if h = @header['content-type']
|
413
|
-
h['charset'] or default
|
414
|
-
else
|
415
|
-
default
|
416
|
-
end
|
417
|
-
end
|
418
|
-
|
419
|
-
def charset=( str )
|
420
|
-
if str
|
421
|
-
if h = @header[ 'content-type' ]
|
422
|
-
h['charset'] = str
|
423
|
-
else
|
424
|
-
store 'Content-Type', "text/plain; charset=#{str}"
|
425
|
-
end
|
426
|
-
end
|
427
|
-
str
|
428
|
-
end
|
429
|
-
|
430
|
-
|
431
|
-
def transfer_encoding( default = nil )
|
432
|
-
if h = @header['content-transfer-encoding']
|
433
|
-
h.encoding || default
|
434
|
-
else
|
435
|
-
default
|
436
|
-
end
|
437
|
-
end
|
438
|
-
|
439
|
-
def transfer_encoding=( str )
|
440
|
-
set_string_attr 'Content-Transfer-Encoding', str
|
441
|
-
end
|
442
|
-
|
443
|
-
alias encoding transfer_encoding
|
444
|
-
alias encoding= transfer_encoding=
|
445
|
-
alias content_transfer_encoding transfer_encoding
|
446
|
-
alias content_transfer_encoding= transfer_encoding=
|
447
|
-
|
448
|
-
|
449
|
-
def disposition( default = nil )
|
450
|
-
if h = @header['content-disposition']
|
451
|
-
h.disposition || default
|
452
|
-
else
|
453
|
-
default
|
454
|
-
end
|
455
|
-
end
|
456
|
-
|
457
|
-
alias content_disposition disposition
|
458
|
-
|
459
|
-
def set_disposition( str, params = nil )
|
460
|
-
if h = @header['content-disposition']
|
461
|
-
h.disposition = str
|
462
|
-
h.params.clear
|
463
|
-
else
|
464
|
-
store('Content-Disposition', str)
|
465
|
-
h = @header['content-disposition']
|
466
|
-
end
|
467
|
-
h.params.replace params if params
|
468
|
-
end
|
469
|
-
|
470
|
-
alias disposition= set_disposition
|
471
|
-
alias set_content_disposition set_disposition
|
472
|
-
alias content_disposition= set_disposition
|
473
|
-
|
474
|
-
def disposition_param( name, default = nil )
|
475
|
-
if h = @header['content-disposition']
|
476
|
-
h[name] || default
|
477
|
-
else
|
478
|
-
default
|
479
|
-
end
|
480
|
-
end
|
481
|
-
|
482
|
-
###
|
483
|
-
### utils
|
484
|
-
###
|
485
|
-
|
486
|
-
def create_reply
|
487
|
-
mail = TMail::Mail.parse('')
|
488
|
-
mail.subject = 'Re: ' + subject('').sub(/\A(?:\[[^\]]+\])?(?:\s*Re:)*\s*/i, '')
|
489
|
-
mail.to_addrs = reply_addresses([])
|
490
|
-
mail.in_reply_to = [message_id(nil)].compact
|
491
|
-
mail.references = references([]) + [message_id(nil)].compact
|
492
|
-
mail.mime_version = '1.0'
|
493
|
-
mail
|
494
|
-
end
|
495
|
-
|
496
|
-
|
497
|
-
def base64_encode
|
498
|
-
store 'Content-Transfer-Encoding', 'Base64'
|
499
|
-
self.body = Base64.folding_encode(self.body)
|
500
|
-
end
|
501
|
-
|
502
|
-
def base64_decode
|
503
|
-
if /base64/i === self.transfer_encoding('')
|
504
|
-
store 'Content-Transfer-Encoding', '8bit'
|
505
|
-
self.body = Base64.decode(self.body, @config.strict_base64decode?)
|
506
|
-
end
|
507
|
-
end
|
508
|
-
|
509
|
-
|
510
|
-
def destinations( default = nil )
|
511
|
-
ret = []
|
512
|
-
%w( to cc bcc ).each do |nm|
|
513
|
-
if h = @header[nm]
|
514
|
-
h.addrs.each {|i| ret.push i.address }
|
515
|
-
end
|
516
|
-
end
|
517
|
-
ret.empty? ? default : ret
|
518
|
-
end
|
519
|
-
|
520
|
-
def each_destination( &block )
|
521
|
-
destinations([]).each do |i|
|
522
|
-
if Address === i
|
523
|
-
yield i
|
524
|
-
else
|
525
|
-
i.each(&block)
|
526
|
-
end
|
527
|
-
end
|
528
|
-
end
|
529
|
-
|
530
|
-
alias each_dest each_destination
|
531
|
-
|
532
|
-
|
533
|
-
def reply_addresses( default = nil )
|
534
|
-
reply_to_addrs(nil) or from_addrs(nil) or default
|
535
|
-
end
|
536
|
-
|
537
|
-
def error_reply_addresses( default = nil )
|
538
|
-
if s = sender(nil)
|
539
|
-
[s]
|
540
|
-
else
|
541
|
-
from_addrs(default)
|
542
|
-
end
|
543
|
-
end
|
544
|
-
|
545
|
-
|
546
|
-
def multipart?
|
547
|
-
main_type('').downcase == 'multipart'
|
548
|
-
end
|
549
|
-
|
550
|
-
end # class Mail
|
551
|
-
|
552
|
-
end # module TMail
|