Skip to content

Commit

Permalink
futher linting
Browse files Browse the repository at this point in the history
  • Loading branch information
timgarrels committed Jul 25, 2019
1 parent b5c5b21 commit f705ae4
Show file tree
Hide file tree
Showing 34 changed files with 86 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ retrieveBody

| mailbody |

self folder endpoint
select: self folder path;
fillBodyFor: self.
self folder fillBodyFor: self.

"add the Content-Type to mail body --> necessary for correct parsing"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"modifyFlag:" : "C.G. 7/25/2018 13:48",
"moveEmail:" : "mt 7/24/2019 16:39",
"open" : "lvm 5/20/2018 20:10",
"retrieveBody" : "C.G. 7/25/2018 13:48",
"retrieveBody" : "tg 7/25/2019 16:04",
"retrieveFlags" : "pm 6/2/2019 15:58",
"saveInMaildir" : "pm 6/2/2019 15:58",
"seen" : "C.G. 7/25/2018 13:49",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
storage
createEmailsWith: maildirDirectory andName: directoryName and: relativeRootFolder

"this loads mails from storage and create ICFolder with ICMails in it."


| serverDirectory filereader email folder |

serverDirectory := maildirDirectory directoryNamed: directoryName.
filereader := ICFileReadWriter new.

"for each directory create Folder"
(serverDirectory directoryNames) do: [:foldername |
folder := (ICFolder new)
folderName: foldername;
Expand All @@ -18,7 +15,6 @@ createEmailsWith: maildirDirectory andName: directoryName and: relativeRootFolde
relativeRootFolder addFolder: folder.
self createEmailsWith: serverDirectory andName: foldername and: folder].

"add mails in a directory to parent folder"
relativeRootFolder emails addAll: (serverDirectory fileNames collect: [:filename |
email := (filereader get: filename in: (maildirDirectory fullPathFor: directoryName)).
email folder: relativeRootFolder])
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ maildirDiffFetchHeadersFrom: start to: end

| searchBegin searchEnd mailFolder |

(FileDirectory default directoryExists: (FileDirectory default fullPathFor: self maildirFileName))
ifTrue: [
self needDiffCheck ifTrue: [
mailFolder := FileDirectory default on: self maildirFileName.
searchBegin := mailFolder fileNamesMatching: (end asString).
searchEnd := mailFolder fileNamesMatching: (start asString).

searchBegin size > 0 & (searchEnd size > 0) ifTrue: [
(searchBegin notEmpty and: searchEnd notEmpty) ifTrue: [
^ OrderedCollection new]].

self sendCommand: (self class fetchHeadersWithUIDRange: start to: end);
self sendCommand: (self class fetchHeadersWithUIDRange: start to: end);
fetchNextResponse.

^ self parseFetchHeaders: self lastResponse
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fetching
needDiffCheck

^ (FileDirectory default directoryExists: (FileDirectory default fullPathFor: self maildirFileName))
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"connect" : "tg 7/15/2019 13:27",
"connectAndLoginWith:" : "tg 7/15/2019 12:28",
"connectWith:" : "tg 7/18/2019 23:00",
"createEmailsWith:andName:and:" : "mt 7/24/2019 14:42",
"createEmailsWith:andName:and:" : "tg 7/25/2019 15:38",
"currentFolderName" : "C.G. 7/25/2018 13:50",
"currentFolderName:" : "C.G. 7/25/2018 13:50",
"currentUIDs" : "pm 6/3/2019 18:35",
Expand All @@ -76,9 +76,10 @@
"login" : "tg 7/18/2019 22:57",
"logout" : "js 6/14/2016 16:59",
"maildirDiffFetchHeadersFrom:" : "tg 7/15/2019 13:31",
"maildirDiffFetchHeadersFrom:to:" : "mt 7/24/2019 18:30",
"maildirDiffFetchHeadersFrom:to:" : "tg 7/25/2019 15:53",
"maildirFileName" : "mt 7/24/2019 16:42",
"moveEmail:to:" : "DH 7/9/2018 21:29",
"needDiffCheck" : "tg 7/25/2019 15:49",
"parseFetchBody" : "C.G. 7/25/2018 13:54",
"parseFetchFlagsOnly:" : "mt 7/24/2019 16:42",
"parseFetchHeader:withId:" : "pm 6/2/2019 15:58",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
folder hierarchy
childFolderNamed: childFolderName with: delimiter ifAbsent: block

| rootPart childPart child parts |

^ self childFolders
detect: [:child | child folderName = childFolderName]
ifNone: [
| rootPart childPart child parts |
"splice at delimiter and ask child"
detect: [:childFolder | childFolder folderName = childFolderName]
ifNone: [
parts := childFolderName subStrings: delimiter.
(parts size > 1)
ifTrue: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
updateEmails
fillBodyFor: anICMail

self endpoint select: self path.
self endpoint fillBodyFor: anICMail.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
"childFolderNamed:" : "C.G. 7/25/2018 14:02",
"childFolderNamed:ifAbsent:" : "tg 7/19/2019 09:19",
"childFolderNamed:with:" : "C.G. 6/26/2018 11:01",
"childFolderNamed:with:ifAbsent:" : "tg 7/19/2019 12:58",
"childFolderNamed:with:ifAbsent:" : "tg 7/25/2019 15:44",
"childFolders" : "pm 6/9/2019 13:12",
"countFolders" : "C.G. 7/25/2018 14:02",
"emails" : "mt 7/24/2019 15:43",
"emails:" : "ms 6/28/2016 09:52",
"endpoint" : "ms 7/10/2016 13:24",
"endpoint:" : "pm 6/9/2019 16:56",
"fetchHeadersNewerThan:" : "mt 7/24/2019 18:35",
"fillBodyFor:" : "tg 7/25/2019 16:03",
"folderName" : "tg 7/19/2019 09:17",
"folderName:" : "tg 7/19/2019 09:17",
"highestUniqueID" : "pm 6/3/2019 18:34",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
helper methods
makeParameterCollection: aCollection

"It is sorted by the order in which the data needs to be inserted in the ICLoginDialog"

| sortedCollection |

sortedCollection := OrderedCollection new.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"accountDictionariesToEndpoints:" : "mt 7/24/2019 16:25",
"allFolders:" : "pm 6/3/2019 18:35",
"hashNameForAccount:and:" : "pm 6/3/2019 18:36",
"makeParameterCollection:" : "mt 7/24/2019 16:11" },
"makeParameterCollection:" : "tg 7/25/2019 15:39" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
constants
preambleString

^ 'self fileInMonticelloZipVersionNamed: ''IMAPClient-Core.mcz''.
self fileInMonticelloZipVersionNamed: ''IMAPClient-UI.mcz''.
ICFolderDialog install.'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
releaseName

^ 'IMAPClient-Release.sar'
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
deployment
addPackageMSZ: aPackageName to: aZip

| mczStream workingCopy version |

mczStream := RWBinaryOrTextStream on: (String new: 10000).
workingCopy := MCWorkingCopy forPackage: (MCPackage new name: aPackageName).
version := workingCopy newVersionWithName: aPackageName message: ('new ', aPackageName, ' release').
version fileOutOn: mczStream.
(aZip addString: mczStream contents as: (aPackageName, '.mcz')) desiredCompressionLevel: 0.
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
deployment
testDeployment

|zip mczStream workingCopy version |
| zip |

zip := ZipArchive new.

mczStream := RWBinaryOrTextStream on: (String new: 10000).
workingCopy := MCWorkingCopy forPackage: (MCPackage new name: 'IMAPClient-Core').
version := workingCopy newVersionWithName: 'IMAPClient-Core' message: 'new core release'.
version fileOutOn: mczStream.
(zip addString: mczStream contents as: 'IMAPClient-Core.mcz') desiredCompressionLevel: 0.
self addPackageMSZ: 'IMAPClient-Core' to: zip.
self addPackageMSZ: 'IMAPClient-UI' to: zip.

mczStream := RWBinaryOrTextStream on: (String new: 10000).
workingCopy := MCWorkingCopy forPackage: (MCPackage new name: 'IMAPClient-UI').
version := workingCopy newVersionWithName: 'IMAPClient-UI' message: 'new ui release'.
version fileOutOn: mczStream.
(zip addString: mczStream contents as: 'IMAPClient-UI.mcz') desiredCompressionLevel: 0.

zip addString: 'self fileInMonticelloZipVersionNamed:
''IMAPClient-Core.mcz''.
self fileInMonticelloZipVersionNamed:
''IMAPClient-UI.mcz''.
ICFolderDialog install.' as: 'install/preamble'.

zip writeToFileNamed: 'newRelease.sar'.
zip addString: self class preambleString as: 'install/preamble';
writeToFileNamed: self class releaseName.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"class" : {
},
"preambleString" : "tg 7/25/2019 16:13",
"releaseName" : "tg 7/25/2019 16:14" },
"instance" : {
"testDeployment" : "tg 6/5/2019 16:17" } }
"addPackageMSZ:to:" : "tg 7/25/2019 16:10",
"testDeployment" : "tg 7/25/2019 16:23" } }
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
fetch
testFetchMailsBeginningAtWithFoundMails

"the uids of the mock server are 3 4 42 43 44 45 46
so fetchMailsBeginningAt:42 with 2 should return mails 3+4"

| path emailObjects mailAPath mailBPath folderName |

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
fetch
testFetchMailsBeginningAtWithoutFoundMails

"the uids of the mock server are 3 4 42 43 44 45 46
so fetchMailsBeginningAt:3 with 5 should return no mails"

| result |

result := self endPoint fetchMailsBeginningAt: 3 number: 5.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"rootFolder" : "C.G. 7/25/2018 17:54",
"rootFolder:" : "pm 6/9/2019 17:17",
"setUp" : "mt 7/24/2019 11:42",
"testFetchMailsBeginningAtWithFoundMails" : "mt 7/24/2019 15:50",
"testFetchMailsBeginningAtWithoutFoundMails" : "C.G. 7/25/2018 17:55",
"testFetchMailsBeginningAtWithFoundMails" : "tg 7/25/2019 15:36",
"testFetchMailsBeginningAtWithoutFoundMails" : "tg 7/25/2019 15:36",
"testFillMessageBody" : "pm 6/2/2019 15:58",
"testFillMessageBodyWithMultilineBody" : "pm 6/2/2019 15:58",
"testListAllFolders" : "mt 7/24/2019 14:00",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
constants
defaultMockServerConfig

| mockServer |

mockServer := ICMockServer new.
^ mockServer
^ ICMockServer new
validPort: self validPort;
validHostIP: self validHostIP;
validHost: self validHost;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"defaultMockServerConfig" : "C.G. 7/25/2018 18:22",
"defaultMockServerConfig" : "tg 7/25/2019 16:24",
"invalidHost" : "tg 7/10/2019 19:36",
"invalidHostAccountInfo" : "mt 7/24/2019 14:30",
"invalidPort" : "AR 5/31/2016 22:00",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ givenJsonObject

| header object |

Transcript show: 'Debug'.
Transcript show: JsonObject.
header := JsonObject newFrom: {
'date' -> 'Fri, 10 Jun 2016 12:51:42 +0200'.
'from' -> 'sender'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"class" : {
"expectedJsonHeader" : "C.G. 7/25/2018 18:21",
"expectedMailObject" : "DH 6/6/2018 20:10",
"givenJsonObject" : "C.G. 7/25/2018 18:21" },
"givenJsonObject" : "tg 7/25/2019 16:25" },
"instance" : {
"readWriter" : "dl 7/20/2017 10:54",
"readWriter:" : "pm 6/9/2019 17:18",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addFolder
testing
testAddFolder

| subfolder1 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
childFolderNamed
testing
testChildFolderNamedWithSubfolderNotPresent

| subfolder1 subfolder2 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
childFolderNamed
testing
testChildFolderNamedWithSubfolderPresent

| subfolder1 subfolder2 result |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
countFolders
testing
testCountFolders

| subfolder1 subfolder2 subfolder3 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
emailInFolder
testing
testEmailInFolder

| folder |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
removeFolder
testing
testRemoveFolder

| subfolder1 subfolder2 subfolder3 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
removeFolder
testing
testRemoveFolderWithFolderNotExisting

| subfolder1 subfolder2 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
accountManagment
editAccount: anAccountInfo with: anEndPoint

ICEndPoint removeConfiguration: anEndPoint.
self emailAccounts remove: anEndPoint.

ICEndPoint addConfiguration: anAccountInfo asDictionary.
self updateAccountConfiguration: anAccountInfo with: anEndPoint.

self emailAccounts add: ((ICHelper accountDictionariesToEndpoints: {anAccountInfo asDictionary}) first).
self selectedFolder: nil.
self rootFolder: nil.

self changed: #selectedFolder.
self changed: #rootFolder.
self changed: #childFolders.
self changed: #emailsOfSelectedFolder.
self changed: #emailAccounts
self updateUI.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accountManagment
updateAccountConfiguration: anAccountInfo with: anEndPoint

ICEndPoint removeConfiguration: anEndPoint.
self emailAccounts remove: anEndPoint.

ICEndPoint addConfiguration: anAccountInfo asDictionary.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
accountManagment
updateUI

self changed: #selectedFolder.
self changed: #rootFolder.
self changed: #childFolders.
self changed: #emailsOfSelectedFolder.
self changed: #emailAccounts.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"deleteAccountButton:" : "pm 6/19/2019 14:52",
"deleteEmail" : "mt 7/24/2019 16:44",
"dialogTitle" : "ms 6/26/2016 13:50",
"editAccount:with:" : "mt 7/24/2019 16:06",
"editAccount:with:" : "tg 7/25/2019 16:22",
"editAccountButton:" : "mt 7/24/2019 16:07",
"emailAccounts" : "C.G. 7/25/2018 14:16",
"emailAccounts:" : "C.G. 7/25/2018 14:16",
Expand Down Expand Up @@ -72,5 +72,7 @@
"uninitializedAccounts" : "pm 6/9/2019 13:16",
"uninitializedAccounts:" : "C.G. 7/25/2018 14:21",
"update" : "pm 6/3/2019 18:35",
"updateAccountConfiguration:with:" : "tg 7/25/2019 16:19",
"updateProcess" : "C.G. 7/12/2018 08:16",
"updateUI" : "tg 7/25/2019 16:22",
"userListMenu:" : "C.G. 6/21/2018 10:56" } }

0 comments on commit f705ae4

Please sign in to comment.