Nicolas Cellier uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-nice.56.mcz ==================== Summary ==================== Name: Network-nice.56 Author: nice Time: 8 February 2010, 5:54:40.071 pm UUID: bd17add1-42b4-bb43-8e7b-58d21f59cfe3 Ancestors: Network-mtf.55 Push a few temp declarations inside blocks. Push a few temp assignments outside blocks. =============== Diff against Network-mtf.55 =============== Item was changed: ----- Method: ServerDirectory>>getFileNamed: (in category 'up/download') ----- getFileNamed: fileNameOnServer "Just FTP a file from a server. Return contents. (Later -- Use a proxy server if one has been registered.)" | result | client := self openFTPClient. + result := [client getFileNamed: fileNameOnServer] - [result := client getFileNamed: fileNameOnServer] ensure: [self quit]. ^result! Item was changed: ----- Method: ServerDirectory class>>storeCurrentServersIn: (in category 'server prefs') ----- storeCurrentServersIn: aDirectory - | file | self servers do: [:each | + | file | file := aDirectory fileNamed: (ServerDirectory nameForServer: each). each storeServerEntryOn: file. file close]. self localProjectDirectories do: [:each | + | file | file := aDirectory fileNamed: each localName. each storeServerEntryOn: file. file close]. ! Item was changed: ----- Method: ServerDirectory>>getFileList (in category 'up/download') ----- getFileList "Return a stream with a list of files in the current server directory. (Later -- Use a proxy server if one has been registered.)" | listing | client := self openFTPClient. + listing := [client getFileList] - [listing := client getFileList] ensure: [self quit]. ^ReadStream on: listing! Item was changed: ----- Method: ServerDirectory>>getDirectory (in category 'up/download') ----- getDirectory "Return a stream with a listing of the current server directory. (Later -- Use a proxy server if one has been registered.)" | listing | client := self openFTPClient. + listing := [client getDirectory] - [listing := client getDirectory] ensure: [self quit]. ^ReadStream on: listing! Item was changed: ----- Method: ServerDirectory>>putFile:named:retry: (in category 'up/download') ----- putFile: fileStream named: fileNameOnServer retry: aBool "ar 11/24/1998 Do the usual putFile:named: operation but retry if some error occurs and aBool is set. Added due to having severe transmission problems on shell.webpage.com." | resp | self isTypeFile ifTrue: [ ^ (FileDirectory on: urlObject pathForDirectory) putFile: fileStream named: fileNameOnServer]. + [resp := [self putFile: fileStream named: fileNameOnServer] + ifError:[:err :rcvr| '5xx ',err]. "Report as error" - [[resp := self putFile: fileStream named: fileNameOnServer] - ifError:[:err :rcvr| resp := '5xx ',err]. "Report as error" aBool and:[((resp isString) and: [resp size > 0]) and:[resp first ~= $2]]] whileTrue:[ (self confirm:('Error storing ',fileNameOnServer,' on the server.\(',resp,',)\Retry operation?') withCRs) ifFalse:[^resp]. ]. ^resp! Item was changed: ----- Method: ServerDirectory>>openFTPClient (in category 'dis/connect') ----- openFTPClient + | loginSuccessful | - | loginSuccessful what | client ifNotNil: [client isConnected ifTrue: [^client] ifFalse: [client := nil]]. client := FTPClient openOnHostNamed: server. loginSuccessful := false. [loginSuccessful] whileFalse: [ [loginSuccessful := true. client loginUser: self user password: self password] on: LoginFailedException do: [:ex | + | what | passwordHolder := nil. what := UIManager default chooseFrom: #('enter password' 'give up') title: 'Would you like to try another password?'. what = 1 ifFalse: [self error: 'Login failed.'. ^nil]. loginSuccessful := false]]. client changeDirectoryTo: directory. ^client! |
Free forum by Nabble | Edit this page |