help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] POP and SMTP assistance


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] POP and SMTP assistance
Date: Wed, 05 Sep 2007 08:25:07 +0200
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)


I got this error output after updating MIME.st and running the program again. Is the problem something that is obvious?

Yes, the code was tested with MIME messages but not with MIME messages *read from POP3*. Sorry.

The attached patch should fix it.

Paolo
2007-09-05  Paolo Bonzini  <address@hidden>

        * MIME.st: Try not to use negative #skip:.

* looking for address@hidden/smalltalk--devo--2.2--patch-545 to compare with
* auto-adding address@hidden/smalltalk--devo--2.2--patch-545 to greedy revision 
library /Users/bonzinip/Archives/revlib
* found immediate ancestor revision in library 
(address@hidden/smalltalk--devo--2.2--patch-544)
* patching for this revision (address@hidden/smalltalk--devo--2.2--patch-545)
* comparing to address@hidden/smalltalk--devo--2.2--patch-545
M  packages/net/MIME.st

* modified files

--- orig/packages/net/MIME.st
+++ mod/packages/net/MIME.st
@@ -705,8 +705,11 @@ upTo: anObject
     If anObject is not found answer everything."
 
     | str |
-    lookahead isNil ifFalse: [ source skip: -1 ].
+    lookahead = anObject ifTrue: [
+       self sourceTrailNextPut: lookahead.
+       ^'' ].
     str := source upTo: anObject.
+    lookahead isNil ifFalse: [ str := lookahead asString, str ].
     self
        sourceTrailNextPutAll: str;
        sourceTrailNextPut: anObject.
@@ -723,8 +726,8 @@ upToAll: pattern 
 
 upToEnd
     | str |
-    lookahead isNil ifFalse: [ source skip: -1 ].
     str := source upToEnd.
+    lookahead isNil ifFalse: [ str := lookahead asString, str ].
     self sourceTrailNextPutAll: str.
     ^str! !
 
@@ -2430,11 +2433,6 @@ decodeUUEncodedFrom: startIndex to: farE
                    count := count - 3]]].
     ^data copyFrom: 1 to: output position! !
 
-!MimeScanner methodsFor: 'constants'!
-
-boundaryDashes
-    ^'--'! !
-
 !MimeScanner methodsFor: 'multi-character scans'!
 
 scanText
@@ -2448,13 +2446,12 @@ scanToBoundary: boundary
 " Scan for specified boundary (RFC2046, p5.1). Answer two-element array. First 
element is the scanned text from current position up to the beginning of the 
boundary. Second element is either #next or #last. #next means the boundary 
found is not the last one. #last means the boundary is the closing boundary for 
the multi-part body (that is, it looks like '--<boundary>--) "
 
     | pattern string kind |
-    pattern := (String with: Character nl), self boundaryDashes , boundary.
+    pattern := (String with: Character nl), '--' , boundary.
     string := self upToAll: pattern.
-    self next: pattern size.                    " Skip over pattern "
-    kind := (self next: 2) = self boundaryDashes
+    kind := (self peekFor: $- and: [ self peekFor: $- ])
                ifTrue: [#last]
-               ifFalse:[self skip: -2. #next].
-    self upTo: Character nl.                    " Skip to the end of line "
+               ifFalse:[#next].
+    self upTo: Character nl.
     ^Array with: string with: kind.!
 
 scanToken




reply via email to

[Prev in Thread] Current Thread [Next in Thread]