[Pkg] The Trunk: Network-nice.237.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Nov 17 15:42:34 UTC 2019
Nicolas Cellier uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-nice.237.mcz
==================== Summary ====================
Name: Network-nice.237
Author: nice
Time: 17 November 2019, 4:42:30.116383 pm
UUID: 5ea94de6-4e06-4dd0-b3af-d52548545d65
Ancestors: Network-mt.236
Use substrings and lines idiom instead of findTokens:
Note: findTokens: feeded with a CharacterSet (CharacterSet separators or CharacterSet crlf) would be equally efficient as above specialized selectors, just a bit longer to write.
=============== Diff against Network-mt.236 ===============
Item was changed:
----- Method: HTTPServerDirectory>>entries (in category 'file directory') -----
entries
| answer ftpEntries |
answer := HTTPSocket httpGetDocument: self dirListUrl.
answer isString
ifTrue: [^self error: 'Listing failed: ' , answer]
ifFalse: [answer := answer content].
+ answer first = $<
- answer first == $<
ifTrue: [self error: 'Listing failed: ' , answer].
+ ftpEntries := answer lines.
- ftpEntries := answer findTokens: String crlf.
^ ftpEntries
collect:[:ftpEntry | self class parseFTPEntry: ftpEntry]
thenSelect: [:entry | entry notNil]!
Item was changed:
----- Method: POP3Client>>messageCount (in category 'public protocol') -----
messageCount
"Query the server and answer the number of messages that are in the user's mailbox."
| numMessages |
self ensureConnection.
self sendCommand: 'STAT'.
self checkResponse.
self logProgress: self lastResponse.
[ | answerString |
+ answerString := (self lastResponse substrings) second.
- answerString := (self lastResponse findTokens: Character separators) second.
numMessages := answerString asNumber asInteger]
on: Error
do: [:ex | (ProtocolClientError protocolInstance: self) signal: 'Invalid STAT response.'].
^numMessages!
Item was changed:
----- Method: ServerDirectory>>entries (in category 'file directory') -----
entries
"Return a collection of directory entries for the files and directories in this directory. Each entry is a five-element array: (<name> <creationTime> <modificationTime> <dirFlag> <fileSize>)."
| dir ftpEntries |
"We start with ftp directory entries of the form...
d--------- 1 owner group 0 Apr 27 22:01 blasttest
---------- 1 owner group 93812 Jul 21 1997 COMMAND.COM
1 2 3 4 5 6 7 8 9 -- token index"
self isTypeFile ifTrue: [
urlObject isAbsolute ifFalse: [urlObject default].
^ (FileDirectory on: urlObject pathForDirectory) entries
].
dir := self getDirectory.
(dir respondsTo: #contentsOfEntireFile) ifFalse: [^ #()].
+ ftpEntries := dir contentsOfEntireFile lines.
- ftpEntries := dir contentsOfEntireFile findTokens: String crlf.
- "ftpEntries inspect."
^ ftpEntries
collect:[:ftpEntry | self class parseFTPEntry: ftpEntry]
thenSelect: [:entry | entry notNil]!
More information about the Packages
mailing list