• Home
  • Raw
  • Download

Lines Matching refs:line

59         line = self.file.readline()
60 if not line:
61 return line
63 if line == self.boundary + '\n':
64 self.peek = line
66 if line == self.boundary + '--\n':
67 self.peek = line
69 return line
78 line = self.peek
81 line = self.file.readline()
82 if not line:
83 return line
84 if he.match(line):
85 return line
90 return line
91 line = line + self.peek
94 def mime_decode(line): argument
99 res = mime_code.search(line, pos)
102 newline = newline + line[pos:res.start(0)] + \
105 return newline + line[pos:]
107 def mime_decode_header(line): argument
112 res = mime_head.search(line, pos)
118 newline = newline + line[pos:res.start(0)] + mime_decode(match)
120 return newline + line[pos:]
136 line = hfile.readline()
137 if not line:
139 if prefix and line[:len(prefix)] == prefix:
140 line = line[len(prefix):]
144 line = mime_decode_header(line)
145 if qp.match(line):
148 if decode_base64 and base64_re.match(line):
151 ofile.write(pref + line)
152 if not prefix and repl.match(line):
155 mp_res = mp.match(line)
158 if he.match(line):
165 line = ifile.readline()
166 if not line:
168 line = re.sub(mime_head, '\\1', line)
169 if prefix and line[:len(prefix)] == prefix:
170 line = line[len(prefix):]
177 if line == multipart + '--\n':
178 ofile.write(pref + line)
180 line = None
182 if line == multipart + '\n':
183 ofile.write(pref + line)
186 line = nifile.peek
187 if not line:
193 if line and quoted_printable:
194 while line[-2:] == '=\n':
195 line = line[:-2]
199 line = line + newline
200 line = mime_decode(line)
201 if line and is_base64 and not pref:
203 line = base64.decodestring(line)
204 if line:
205 ofile.write(pref + line)
228 def mime_encode(line, header): argument
237 if len(line) >= 5 and line[:5] == 'From ':
242 res = reg.search(line, pos)
245 newline = newline + line[pos:res.start(0)] + \
248 line = newline + line[pos:]
251 while len(line) >= 75:
253 while line[i] == '=' or line[i-1] == '=':
256 newline = newline + line[:i] + '=\n'
257 line = line[i:]
258 return newline + line
262 def mime_encode_header(line): argument
267 res = mime_header.search(line, pos)
271 (newline, line[pos:res.start(0)], res.group(1),
274 return newline + line[pos:]
293 line = hfile.readline()
294 if not line:
296 if not must_quote_header and iso_char.search(line):
298 if mv.match(line):
300 if cte.match(line):
302 if qp.match(line):
304 elif base64_re.match(line):
306 mp_res = mp.match(line)
309 if he.match(line):
310 header_end = line
312 header.append(line)
316 line = ifile.readline()
317 if not line:
320 if line == multipart + '--\n':
321 message_end = line
323 if line == multipart + '\n':
324 message_end = line
327 message.append(line)
330 while line[-2:] == '=\n':
331 line = line[:-2]
335 line = line + newline
336 line = mime_decode(line)
337 message.append(line)
339 if iso_char.search(line):
342 if len(line) > MAXLEN:
346 for line in header:
348 line = mime_encode_header(line)
349 chrset_res = chrset.match(line)
354 line = '%s%s%s' % (chrset_res.group(1),
359 line = '%sus-ascii%s' % chrset_res.group(1, 3)
360 if has_cte and cte.match(line):
361 line = 'Content-Transfer-Encoding: '
363 line = line + 'base64\n'
365 line = line + 'quoted-printable\n'
367 line = line + '7bit\n'
368 ofile.write(line)
380 for line in message:
382 line = mime_encode(line, 0)
383 ofile.write(line)
386 line = message_end
388 if line == multipart + '--\n':
391 line = ifile.readline()
392 if not line:
395 line = mime_encode(line, 0)
396 ofile.write(line)
397 if line == multipart + '\n':
400 line = nifile.peek
401 if not line:
404 ofile.write(line)
408 line = ifile.readline()
409 if not line:
412 line = mime_encode(line, 0)
413 ofile.write(line)