Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.866.mcz
==================== Summary ====================
Name: Collections-mt.866
Author: mt
Time: 3 December 2019, 2:05:26.496677 pm
UUID: d4ee3e01-f703-8b47-88e2-5c3d52dbaf11
Ancestors: Collections-cmm.865
Complements Morphic-mt.1598 to bring all those find*-parsing methods together. We might want to put it into an extension category? Maybe "*Tools-converting"?
=============== Diff against Collections-cmm.865 ===============
Item was added:
+ ----- Method: String>>findLiteral (in category 'converting') -----
+ findLiteral
+ "Scan the receiver for tokens that represent Smalltalk code literals. Return the first token or nil if non were found."
+
+ | tokens |
+ tokens := Scanner new typedScanTokens: self.
+ ^tokens isEmpty ifFalse: [tokens first]!
Item was added:
+ ----- Method: String>>findSymbol (in category 'converting') -----
+ findSymbol
+ "Return the currently selected symbol, or nil if none. Spaces, tabs and returns are ignored. Note that we do never return the empty symbol."
+
+ | aString |
+ aString := self copyWithoutAll: CharacterSet separators.
+ aString size = 0 ifTrue: [^ nil].
+ ^ Symbol lookup: aString!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1598.mcz
==================== Summary ====================
Name: Morphic-mt.1598
Author: mt
Time: 3 December 2019, 2:02:47.214677 pm
UUID: 8ee5a31c-f69f-6049-b274-c3dcbbdec38e
Ancestors: Morphic-eem.1597
Harmonize all find*-parsing methods used in text editors.
=============== Diff against Morphic-eem.1597 ===============
Item was changed:
----- Method: TextEditor>>selectedLiteral (in category 'menu messages') -----
selectedLiteral
+ "Try to make a Smalltalk literal out of the current text selection."
+
+ ^ self selection string findLiteral!
- "Try to make a literal out of the current text selection"
- | tokens |
- tokens := Scanner new typedScanTokens: self selection string.
- ^tokens isEmpty ifFalse: [tokens first]!
Item was changed:
----- Method: TextEditor>>selectedSelector (in category 'menu messages') -----
selectedSelector
+ "Try to make a selector out of the current text selection."
+
+ ^ self selection string findSelector!
- "Try to make a selector out of the current text selection"
- ^self selection string findSelector!
Item was changed:
----- Method: TextEditor>>selectedSymbol (in category 'menu messages') -----
selectedSymbol
+ "Try to make a symbol out of the current text selection."
- "Return the currently selected symbol, or nil if none. Spaces, tabs and returns are ignored"
+ ^ self selection string findSymbol!
- | aString |
- self hasCaret ifTrue: [^ nil].
- aString := self selection string copyWithoutAll: CharacterSet separators.
- aString size = 0 ifTrue: [^ nil].
- Symbol hasInterned: aString ifTrue: [:sym | ^ sym].
-
- ^ nil!
tim Rowledge uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-tpr.238.mcz
==================== Summary ====================
Name: Network-tpr.238
Author: tpr
Time: 2 December 2019, 9:45:46.30357 pm
UUID: abb2a42a-56c3-467b-b070-8e49f1a18016
Ancestors: Network-nice.237
minor refactor and extension of email sending code.
Add support for user name & password when sending emails with a quick utility method - hence SMTPClient class>>#deliverMailFrom:to:text:usingServer:userName:password:
This required a minor refactor to make sure the login was actually done when opening the connection.
=============== Diff against Network-nice.237 ===============
Item was changed:
----- Method: ProtocolClient class>>openOnHostNamed: (in category 'instance creation') -----
+ openOnHostNamed: hostNameAndPort
+ "If the hostname uses the colon syntax to express a certain port number we use that instead of the default port number."
- openOnHostNamed: hostName
- "If the hostname uses the colon syntax to express a certain portnumber
- we use that instead of the default port number."
+ ^self new openOnHostNamed: hostNameAndPort
- | i |
- i := hostName indexOf: $:.
- i = 0 ifTrue: [
- ^self openOnHostNamed: hostName port: self defaultPortNumber]
- ifFalse: [
- | s p |
- s := hostName truncateTo: i - 1.
- p := (hostName copyFrom: i + 1 to: hostName size) asInteger.
- ^self openOnHostNamed: s port: p]
!
Item was changed:
----- Method: ProtocolClient class>>openOnHostNamed:port: (in category 'instance creation') -----
openOnHostNamed: hostName port: portNumber
- | serverIP |
- serverIP := NetNameResolver addressForName: hostName timeout: 20.
- serverIP ifNil:[ ^ nil].
+ ^ self new openOnHostNamed: hostName port: portNumber!
- ^ (self openOnHost: serverIP port: portNumber)
- hostName: hostName;
- yourself
- !
Item was changed:
----- Method: ProtocolClient>>openOnHost:port: (in category 'private') -----
openOnHost: hostIP port: portNumber
+ "open a connection to a specific port on a host for which we have the IP number.
+ We handle any login if the user and password are set"
self host: hostIP.
self port: portNumber.
self ensureConnection!
Item was added:
+ ----- Method: ProtocolClient>>openOnHostNamed: (in category 'private') -----
+ openOnHostNamed: hostNameAndPort
+ "If the hostname uses the colon syntax to express a certain port number
+ we use that instead of the default port number."
+
+ | thing hostName port |
+ "derive a host name and port number"
+ thing := hostNameAndPort splitBy: ':'.
+ hostName := thing first.
+ port := (thing at: 2 ifAbsent: [self defaultPortNumber]) asInteger.
+
+ ^self openOnHostNamed: hostName port: port
+ !
Item was added:
+ ----- Method: ProtocolClient>>openOnHostNamed:port: (in category 'private') -----
+ openOnHostNamed: hostName port: portNumber
+ "open a connection to a specific port on a server"
+ | serverIP |
+ serverIP := NetNameResolver addressForName: hostName timeout: 20.
+ self
+ hostName: hostName;
+ openOnHost: serverIP port: portNumber!
Item was changed:
----- Method: SMTPClient class>>deliverMailFrom:to:text:usingServer: (in category 'sending mail') -----
deliverMailFrom: fromAddress to: recipientList text: messageText usingServer: serverName
+ "Deliver a single email to a list of users and then close the connection - for delivering multiple messages, it is best to create a single connection and send all mail over it.
+ The serverName can include the port number - simply append ':587' for example to over ride the default port number.
+ No user name or password is used in this method; see deliverMailFrom:to:text:usingServer:userName:password: for more.
+ NOTE: the recipient list should be a collection of simple internet style addresses -- no '<>' or '()' stuff"
- "Deliver a single email to a list of users and then close the connection. For delivering multiple messages, it is best to create a single connection and send all mail over it. NOTE: the recipient list should be a collection of simple internet style addresses -- no '<>' or '()' stuff"
+ self deliverMailFrom: fromAddress to: recipientList text: messageText usingServer: serverName userName: nil password: nil
- | smtpClient |
- smtpClient := self openOnHostNamed: serverName.
- [smtpClient mailFrom: fromAddress to: recipientList text: messageText.
- smtpClient quit]
- ensure: [smtpClient close]
!
Item was added:
+ ----- Method: SMTPClient class>>deliverMailFrom:to:text:usingServer:userName:password: (in category 'sending mail') -----
+ deliverMailFrom: fromAddress to: recipientList text: messageText usingServer: serverName userName: uNameString password: pwdString
+ "Deliver a single email to a list of users and then close the connection - for delivering multiple messages, it is best to create a single connection and send all mail over it.
+ The serverName can include the port number - simply append ':587' for example to over ride the default port number.
+ If uNameString or pwdString are non-nil, set the uid/pwd for the client. It is inadvisable to try setting a uid and not a pwd, or indeed vice versa.
+ NOTE: the recipient list should be a collection of simple internet style addresses -- no '<>' or '()' stuff"
+
+ | smtpClient |
+ smtpClient := self new.
+
+ uNameString ifNotNil:[smtpClient user: uNameString].
+ pwdString ifNotNil:[smtpClient password: pwdString].
+ smtpClient openOnHostNamed: serverName.
+ [smtpClient mailFrom: fromAddress to: recipientList text: messageText.
+ smtpClient quit]
+ ensure: [smtpClient close]
+ !
Item was removed:
- ----- Method: SMTPClient class>>openOnHost:port: (in category 'instance creation') -----
- openOnHost: hostIP port: portNumber
-
- | client |
- client := super openOnHost: hostIP port: portNumber.
- client initiateSession.
- ^client!
I've been having 'fun' again with my personal squeaksource adventures.
This time it is getting commit mails to actually send; in case I probably need to modify things to use SecureSMTPClient (assuming anyone thinks it still works?) and in another test case I need to change the default port.
Adding a port number to the squeaksource settings page won't be too much of a pain (I hope, assuming I remember any of it after a couple of months) but I'd much rather hear that someone has already solved this and save the time. Anyone?
tim
--
tim Rowledge; tim(a)rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: LCD: Launch Cartridge Disk
Chris Muller uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-cmm.865.mcz
==================== Summary ====================
Name: Collections-cmm.865
Author: cmm
Time: 30 November 2019, 9:33:26.626104 pm
UUID: 8a7c3294-372d-431b-b1f2-1daff3cb3a9e
Ancestors: Collections-mt.864
Let the printString of an OrderedDictionary reveal its key sequence.
=============== Diff against Collections-mt.864 ===============
Item was added:
+ ----- Method: Dictionary>>keysInOrder (in category 'accessing') -----
+ keysInOrder
+ "Answer the keys of the receiver in a particular sequence. This default is alphabetical, but subclasses like OrderedDictionary maintain their own sequence."
+ ^ self keysSortedSafely!
Item was changed:
----- Method: Dictionary>>printElementsOn: (in category 'printing') -----
printElementsOn: aStream
aStream nextPut: $(.
self size > 100
ifTrue: [aStream nextPutAll: 'size '.
self size printOn: aStream]
+ ifFalse: [self keysInOrder
- ifFalse: [self keysSortedSafely
do: [:key | aStream print: key;
nextPutAll: '->';
print: (self at: key);
space]].
aStream nextPut: $)!
Item was added:
+ ----- Method: OrderedDictionary>>keysInOrder (in category 'accessing') -----
+ keysInOrder
+ "Overridden. Preserve the order of the receiver."
+ ^ self keys!