'From Squeak3.1alpha of 6 February 2001 [latest update: #4347] on 27 September 2001 at 8:39:42 pm'! "Change Set: MailOutTweaks Date: 24 April 2001 Author: Bijan Parsia and Doug Way Lets you use the 'mail to list' feature of changesets, without having to set up a Celeste database. No preference is added; if a Celeste smtpServer isn't already set, you are prompted for a server and email address. Also refactors ChangeSet>>mailOut, adds the timestamp to the beginning of the changeset (promoting #timeStamp to WriteStream), and adds the name of the author to the email from the changeset preamble (or prompts for a name if there is no preamble)."! CelesteComposition subclass: #AdHocComposition instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Network-Mail Reader'! !AdHocComposition methodsFor: 'as yet unclassified' stamp: 'BJP 4/24/2001 00:10'! submit | message | "submit the message" textEditor ifNotNil: [self hasUnacceptedEdits ifTrue: [textEditor accept]]. message := MailMessage from: messageText asString. self breakLinesInMessage: message. SMTPSocket deliverMailFrom: message from to: (Array with: message to) text: message text usingServer: celeste. morphicWindow ifNotNil: [morphicWindow delete]. mvcWindow ifNotNil: [mvcWindow controller close]! ! !Celeste class methodsFor: 'user preferences' stamp: 'raok 9/14/2001 01:47'! isSmtpServerSet ^ SmtpServer notNil and: [SmtpServer notEmpty] ! ! !Celeste class methodsFor: 'user preferences' stamp: 'raok 9/14/2001 01:47'! smtpServer "Answer the server for sending email" self isSmtpServerSet ifFalse: [self setSmtpServer]. SmtpServer isEmpty ifTrue: [ self error: 'no SMTP server specified' ]. ^SmtpServer! ! !ChangeSet methodsFor: 'accessing' stamp: 'BJP 4/24/2001 00:23'! author | author | self assurePreambleExists. author _ self preambleString lineNumber: 3. author _ author copyFrom: 8 to: author size. "Strip the 'Author:' prefix. Ugly ugly." ^author withBlanksTrimmed. ! ! !ChangeSet methodsFor: 'fileIn/Out' stamp: 'dew 9/27/2001 20:27'! buildMessageForMailOutWithUser: userName | message compressBuffer compressStream data compressedStream compressTarget | "prepare the message" message := MailMessage empty. message setField: 'from' toString: '"', self author, '" <', userName, '>'. message setField: 'to' toString: 'squeak-dev@lists.squeakfoundation.org'. message setField: 'subject' toString: (self chooseSubjectPrefixForEmail, name). message body: (MIMEDocument contentType: 'text/plain' content: (String streamContents: [ :str | str nextPutAll: 'from preamble:'; cr; cr. self fileOutPreambleOn: str ])). "Prepare the gzipped data" data _ WriteStream on: String new. data header; timeStamp. self fileOutPreambleOn: data. self fileOutOn: data. self fileOutPostscriptOn: data. data trailer. data _ ReadStream on: data contents. compressBuffer _ ByteArray new: 1000. compressStream _ GZipWriteStream on: (compressTarget _ WriteStream on: (ByteArray new: 1000)). [data atEnd] whileFalse: [compressStream nextPutAll: (data nextInto: compressBuffer)]. compressStream close. compressedStream _ ReadStream on: compressTarget contents asString. message addAttachmentFrom: compressedStream withName: (name, '.cs.gz'). ^ message! ! !ChangeSet methodsFor: 'fileIn/Out' stamp: 'dew 9/25/2001 23:39'! mailOut "Email a compressed version of this changeset to the squeak-dev list, so that it can be shared with everyone. (You will be able to edit the email before it is sent.)" | usingCeleste userName server message slips | usingCeleste _ (Smalltalk includesKey: #Celeste) and: [Celeste isSmtpServerSet]. usingCeleste ifTrue: [server _ Celeste smtpServer. userName _ Celeste userName.] ifFalse: [server _ FillInTheBlank request: 'What is your mail server for outgoing mail?'. userName _ FillInTheBlank request: 'What is your email address?']. self checkForConversionMethods. Cursor write showWhile: [message _ self buildMessageForMailOutWithUser: userName]. usingCeleste ifTrue: [CelesteComposition openForCeleste: Celeste current initialText: message text] ifFalse: [AdHocComposition openForCeleste: server initialText: message text]. Preferences suppressCheckForSlips ifTrue: [^ self]. slips _ self checkForSlips. (slips size > 0 and: [self confirm: 'Methods in this fileOut have halts or references to the Transcript or other ''slips'' in them. Would you like to browse them?']) ifTrue: [Smalltalk browseMessageList: slips name: 'Possible slips in ' , name] ! ! !WriteStream methodsFor: 'fileIn/Out' stamp: 'dew 9/24/2001 23:45'! timeStamp "Append the current time to the receiver as a String." self nextChunkPut: "double string quotes and !!s" (String streamContents: [:s | Smalltalk timeStamp: s]) printString. self cr! ! ReadWriteStream removeSelector: #timeStamp!