The Trunk: Network-pre.219.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Network-pre.219.mcz

commits-2
Patrick Rein uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-pre.219.mcz

==================== Summary ====================

Name: Network-pre.219
Author: pre
Time: 23 February 2018, 8:01:29.067294 pm
UUID: 730b43c6-9824-ce4e-ba60-0c5639be4f65
Ancestors: Network-ul.218

Fixes a regression causing long lines in mail bodys to be broken into shorter lines. This should only have been done for header values and even for them it only is a recommendation not a requirement. Further, the current implementation was not used in the mail sending process before the restructuring of the mail message model.

=============== Diff against Network-ul.218 ===============

Item was changed:
  ----- Method: MailMessage>>asSendableText (in category 'printing/formatting') -----
  asSendableText
 
+ ^ self text!
- | serializedMail |
- serializedMail := self text.
- ^ self wrapLinesOf: serializedMail!

Item was removed:
- ----- Method: MailMessage>>wrapLinesOf: (in category 'printing/formatting') -----
- wrapLinesOf: aString
-
- "break lines in the given string into shorter lines"
- | result atAttachment width pastHeader |
- width := 72.
- result := WriteStream on: (String new: aString size * 50 // 49).
- pastHeader := false.
- atAttachment := false.
- aString asString
- linesDo:
- [:line | | end start |
- line isEmpty ifTrue: [pastHeader := true].
- pastHeader
- ifTrue:
- ["(line beginsWith: '--==')
- ifTrue: [atAttachment := true]."
- atAttachment
- ifTrue:
- ["at or after an attachment line; no more
- wrapping for the rest of the message"
- result nextPutAll: line.
- result cr]
- ifFalse: [(line beginsWith: '>')
- ifTrue:
- ["it's quoted text; don't wrap it"
- result nextPutAll: line.
- result cr]
- ifFalse:
- ["regular old line.  Wrap it to multiple
- lines "
- start := 1.
- "output one shorter line each time
- through this loop"
- [start + width <= line size]
- whileTrue:
- ["find the end of the line"
- end := start + width - 1.
- [end >= start and: [(line at: end + 1) isSeparator not]]
- whileTrue: [end := end - 1].
- end < start ifTrue: ["a word spans the entire
- width!! "
- end := start + width - 1].
- "copy the line to the output"
- result nextPutAll: (line copyFrom: start to: end).
- result cr.
- "get ready for next iteration"
- start := end + 1.
- (line at: start) isSeparator ifTrue: [start := start + 1]].
- "write out the final part of the line"
- result nextPutAll: (line copyFrom: start to: line size).
- result cr]]]
- ifFalse:
- [result nextPutAll: line.
- result cr]].
-
- ^ result contents!