MCSmtpRepository.st
author Patrik Svestka <patrik.svestka@gmail.com>
Wed, 14 Nov 2018 12:57:13 +0100
branchjv
changeset 1095 87f223484bc3
parent 900 34c44e0f7cee
child 1022 b561a6a0a2d7
permissions -rw-r--r--
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present - All source *.st files are now Unicode UTF8 without BOM Files are in two groups (fileOut works this way in Smalltalk/X): - containing a unicode character have "{ Encoding: utf8 }" at the header - ASCII only are without the header

"{ Package: 'stx:goodies/monticello' }"

MCWriteOnlyRepository subclass:#MCSmtpRepository
	instanceVariableNames:'email'
	classVariableNames:''
	poolDictionaries:''
	category:'SCM-Monticello-Repositories'
!


!MCSmtpRepository class methodsFor:'as yet unclassified'!

morphicConfigure
	| address |
	address := UIManager default request: 'Email address:' translated.
	^ address isEmpty ifFalse: [self new emailAddress: address]
! !

!MCSmtpRepository class methodsFor:'queries'!

description
	^ 'SMTP'
! !

!MCSmtpRepository methodsFor:'accessing'!

description
	^ 'mailto://', email
! !

!MCSmtpRepository methodsFor:'as yet unclassified'!

bodyForVersion: aVersion
	^ String streamContents:
		[ :s |
		s nextPutAll: 'from version info:'; cr; cr.
		s nextPutAll:  aVersion info summary]
!

emailAddress: aString
	email := aString	
!

messageForVersion: aVersion
	| message data |
	message := MailMessage empty.
	message setField: 'from' toString: MailSender userName.
	message setField: 'to' toString: email.
	message setField: 'subject' toString: (self subjectForVersion: aVersion). 

	message body:
		(MIMEDocument
			contentType: 'text/plain'
			content: (self bodyForVersion: aVersion)).

	"Prepare the gzipped data"
	data := RWBinaryOrTextStream on: String new.
	aVersion fileOutOn: data.
	message addAttachmentFrom: data reset withName: aVersion fileName.
	^ message
! !

!MCSmtpRepository methodsFor:'printing & storing'!

basicStoreVersion: aVersion
	MailSender sendMessage: (self messageForVersion: aVersion)
! !

!MCSmtpRepository methodsFor:'queries'!

subjectForVersion: aVersion
	^ '[Package] ', aVersion info name
! !

!MCSmtpRepository class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCSmtpRepository.st,v 1.5 2014-02-12 14:53:31 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCSmtpRepository.st,v 1.5 2014-02-12 14:53:31 cg Exp $'
!

version_SVN
    ^ '$Id: MCSmtpRepository.st,v 1.5 2014-02-12 14:53:31 cg Exp $'
! !