File: StreamHandler.html

package info (click to toggle)
ruby-rubymail 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,056 kB
  • sloc: ruby: 6,061; makefile: 7
file content (326 lines) | stat: -rw-r--r-- 10,946 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: RMail::StreamHandler</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel=StyleSheet href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript" language="JavaScript">
  <!--
  function popCode(url) {
    window.open(url, "Code", 
          "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }
  //-->
  </script>
</head>

<body bgcolor="white">

<table summary="Information on class" width="100%" border="0" cellspacing="0">
 <tr class="title-row">
 <td class="big-title-font">
   <sup><font color="aqua">Class</font></sup> RMail::StreamHandler
 </td>
 <td align="right">
   <table summary="layout" cellspacing="0" cellpadding="2">
     <tr valign="top">
      <td class="small-title-font">In:</td>
      <td class="small-title-font">
        <a href="../../files/lib/rmail/parser_rb.html" class="aqua">
lib/rmail/parser.rb
         </a>
<br />
      </td>
     </tr>
     <tr>
      <td class="small-title-font">Parent:</td>
      <td class="small-title-font">
Object
      </td>
     </tr>
   </table>
  </td>
  </tr>
</table>
  <!-- banner header -->



<div class="description"><h1>Overview</h1>
<p>
An <a href="StreamHandler.html">RMail::StreamHandler</a> documents the set
of methods a <a href="StreamParser.html">RMail::StreamParser</a> handler
must implement. See <a
href="StreamParser.html">RMail::StreamParser</a>.parse. This is a low level
interface to the <a href="../RMail.html">RMail</a> message parser.
</p>
<h1>Order of Method Calls (Grammar)</h1>
<p>
Calls to the methods of this class follow a specific grammar, described
informally below. The words in all caps are productions in the grammar,
while the lower case words are method calls to this object.
</p>
<table>
<tr><td valign="top">MESSAGE:</td><td>[ <a href="Header.html#M000078">#mbox_from</a> ] *( <a
href="StreamHandler.html#M000027">#header_field</a> ) ( BODY /
MULTIPART_BODY )

</td></tr>
<tr><td valign="top">BODY:</td><td>*<a href="StreamHandler.html#M000028">body_begin</a> *( <a
href="StreamHandler.html#M000029">#body_chunk</a> ) <a
href="StreamHandler.html#M000030">#body_end</a>

</td></tr>
<tr><td valign="top">MULTIPART_BODY:</td><td><a href="StreamHandler.html#M000031">#multipart_body_begin</a> *( <a
href="StreamHandler.html#M000032">#preamble_chunk</a> ) *( <a
href="StreamHandler.html#M000033">#part_begin</a> MESSAGE <a
href="StreamHandler.html#M000034">#part_end</a>) *( <a
href="StreamHandler.html#M000035">#epilogue_chunk</a> ) <a
href="StreamHandler.html#M000036">#multipart_body_end</a>

</td></tr>
</table>
<h1>Order of Method Calls (English)</h1>
<p>
If the grammar above is not clear, here is a description in English.
</p>
<p>
The parser begins calling <a
href="StreamHandler.html#M000027">#header_field</a>, possibly calling <a
href="Header.html#M000078">#mbox_from</a> for the first line. Then it
determines if the message was a MIME multipart message.
</p>
<p>
If the message is a not a MIME multipart, the parser calls <a
href="StreamHandler.html#M000028">#body_begin</a> once, then <a
href="StreamHandler.html#M000029">#body_chunk</a> any number of times, then
<a href="StreamHandler.html#M000030">#body_end</a>.
</p>
<p>
If the message header is a MIME multipart message, then <a
href="StreamHandler.html#M000031">#multipart_body_begin</a> is called,
followed by any number of calls to <a
href="StreamHandler.html#M000032">#preamble_chunk</a>. Then for each part
parsed, <a href="StreamHandler.html#M000033">#part_begin</a> is called,
followed by a recursive set of calls described by the &quot;MESSAGE&quot;
production above, and then <a
href="StreamHandler.html#M000034">#part_end</a>. After all parts are
parsed, any number of calls to <a
href="StreamHandler.html#M000035">#epilogue_chunk</a> are followed by a
single call to <a
href="StreamHandler.html#M000036">#multipart_body_end</a>.
</p>
<p>
The recursive nature of MIME multipart messages is represented by the
recursive invocation of the &quot;MESSAGE&quot; production in the grammar
above.
</p>
</div>


<table summary="Methods" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Methods</td></tr>
</table>
<div class="name-list">
<a href="#M000028">body_begin</a>&nbsp; &nbsp;
<a href="#M000029">body_chunk</a>&nbsp; &nbsp;
<a href="#M000030">body_end</a>&nbsp; &nbsp;
<a href="#M000035">epilogue_chunk</a>&nbsp; &nbsp;
<a href="#M000027">header_field</a>&nbsp; &nbsp;
<a href="#M000026">mbox_from</a>&nbsp; &nbsp;
<a href="#M000031">multipart_body_begin</a>&nbsp; &nbsp;
<a href="#M000036">multipart_body_end</a>&nbsp; &nbsp;
<a href="#M000033">part_begin</a>&nbsp; &nbsp;
<a href="#M000034">part_end</a>&nbsp; &nbsp;
<a href="#M000032">preamble_chunk</a>&nbsp; &nbsp;
</div>





<table summary="Method list" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Public Instance methods</td></tr>
</table>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000026"></a>
<a href="StreamHandler.src/M000026.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000026.html');return false;">
<b>mbox_from</b>(line)
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called for Unix MBOX &quot;From &quot; lines in the message
header, it calls this method with the text.
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000027"></a>
<a href="StreamHandler.src/M000027.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000027.html');return false;">
<b>header_field</b>(field, name, value)
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called when a header field is parsed. The <tt>field</tt> is
the full text of the field, the <tt>name</tt> is the name of the field and
the <tt>value</tt> is the field&#8217;s value with leading and trailing
whitespace removed. Note that both <tt>field</tt> and <tt>value</tt> may be
multi-line strings.
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000028"></a>
<a href="StreamHandler.src/M000028.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000028.html');return false;">
<b>body_begin</b>()
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called before a non-multipart message body is about to be
parsed.
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000029"></a>
<a href="StreamHandler.src/M000029.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000029.html');return false;">
<b>body_chunk</b>(chunk)
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called with a string chunk of data from a non-multipart
message body. The string does not necessarily begin or end on any
particular boundary.
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000030"></a>
<a href="StreamHandler.src/M000030.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000030.html');return false;">
<b>body_end</b>()
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called after all of the non-multipart message body has been
parsed.
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000031"></a>
<a href="StreamHandler.src/M000031.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000031.html');return false;">
<b>multipart_body_begin</b>()
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called before a multipart message body is about to be
parsed.
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000032"></a>
<a href="StreamHandler.src/M000032.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000032.html');return false;">
<b>preamble_chunk</b>(chunk)
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called with a chunk of data from a multipart message
body&#8217;s preamble. The preamble is any text that appears before the
first part of the multipart message body.
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000033"></a>
<a href="StreamHandler.src/M000033.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000033.html');return false;">
<b>part_begin</b>()
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called when a part of a multipart body begins.
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000034"></a>
<a href="StreamHandler.src/M000034.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000034.html');return false;">
<b>part_end</b>()
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called when a part of a multipart body ends.
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000035"></a>
<a href="StreamHandler.src/M000035.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000035.html');return false;">
<b>epilogue_chunk</b>(chunk)
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called with a chunk of data from a multipart message
body&#8217;s epilogue. The epilogue is any text that appears after the last
part of the multipart message body.
</p>
</div>
<table summary="method"  width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="M000036"></a>
<a href="StreamHandler.src/M000036.html" target="Code" class="methodtitle"
 onClick="popCode('StreamHandler.src/M000036.html');return false;">
<b>multipart_body_end</b>(delimiters, boundary)
</a>
</td></tr>
</table>
<div class="description">
<p>
This method is called after a multipart message body has been completely
parsed.
</p>
<p>
The <tt>delimiters</tt> is an Array of strings, one for each boundary
string found in the multipart body. The <tt>boundary</tt> is the boundary
string used to delimit each part in the multipart body. You can normally
ignore both <tt>delimiters</tt> and <tt>boundary</tt> if you are concerned
only about message content.
</p>
</div>

</body>
</html>