-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from HPI-SWA-Teaching/origin/develop2
Origin/develop2
- Loading branch information
Showing
11 changed files
with
62 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 8 additions & 21 deletions
29
packages/IMAPClient-Core.package/ICEndPoint.class/instance/loadEmailsFromMaildir.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,16 @@ | ||
login | ||
loadEmailsFromMaildir | ||
|
||
| directory_name maildir_directory default_directory server_directory existing_emails filereader folder email | | ||
default_directory := FileDirectory default. | ||
| directory_name server_directory filereader | | ||
|
||
(default_directory directoryExists: 'Maildir') | ||
ifFalse: [default_directory createDirectory: 'Maildir']. | ||
maildir_directory := default_directory directoryNamed: 'Maildir'. | ||
directory_name := (self serverInfo host) copyReplaceAll: '.' with: '_'. | ||
(maildir_directory directoryExists: directory_name) | ||
ifFalse: [ Transcript show: 'Maildir doesnt exist'. ^ (OrderedCollection new) ]. | ||
server_directory := maildir_directory directoryNamed: directory_name. | ||
(self maildirDirectory directoryExists: directory_name) | ||
ifFalse: [ | ||
Transcript show: 'Maildir doesnt exist'. | ||
^ (OrderedCollection new) ]. | ||
|
||
server_directory := self maildirDirectory directoryNamed: directory_name. | ||
|
||
filereader := ICFileReadWriter new. | ||
(server_directory directoryNames) do: | ||
[ :foldername | | ||
existing_emails := OrderedCollection new. | ||
folder := ((ICFolder new) name: foldername; | ||
emails: existing_emails; | ||
endpoint: self; yourself). | ||
self rootFolder addFolder: folder. | ||
(server_directory directoryNamed: foldername) fileNames do: | ||
[ :filename | | ||
email := (filereader get: filename in: (directory_name, FileDirectory slash, foldername)). | ||
email folder: folder. | ||
existing_emails add: email ]]. | ||
|
||
^ existing_emails | ||
[ :foldername | self loadEmailsInFolder: foldername andDirectory: server_directory ] |
17 changes: 17 additions & 0 deletions
17
...ges/IMAPClient-Core.package/ICEndPoint.class/instance/loadEmailsInFolder.andDirectory..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
login | ||
loadEmailsInFolder: aFolder andDirectory: aDirectory | ||
|
||
| existing_emails filereader folder email | | ||
|
||
filereader := ICFileReadWriter new. | ||
existing_emails := OrderedCollection new. | ||
folder := ((ICFolder new) name: aFolder; | ||
emails: existing_emails; | ||
endpoint: self; yourself). | ||
self rootFolder addFolder: folder. | ||
((aDirectory directoryNamed: aFolder) fileNames do: | ||
[ :filename | | ||
email := (filereader get: filename in: (aDirectory, FileDirectory slash, aFolder)). | ||
email folder: folder. | ||
existing_emails add: email ]). | ||
^ existing_emails |
7 changes: 7 additions & 0 deletions
7
packages/IMAPClient-Core.package/ICEndPoint.class/instance/maildirDirectory.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
maildir | ||
maildirDirectory | ||
|
||
(FileDirectory default directoryExists: 'Maildir') | ||
ifFalse: [FileDirectory default createDirectory: 'MailDir']. | ||
|
||
^ FileDirectory default directoryNamed: 'Maildir' |
2 changes: 1 addition & 1 deletion
2
packages/IMAPClient-Core.package/ICEndPoint.class/instance/parseFetchHeaders..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/IMAPClient-Core.package/ICFileReadWriter.class/instance/createPathIfNotExisting..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
write file | ||
createPathIfNotExisting: aPath | ||
|
||
| current_directory | | ||
current_directory := FileDirectory default. | ||
(aPath subStrings: (FileDirectory slash)) reverseDo: | ||
[ :path | | ||
(current_directory directoryExists: path) ifFalse: [current_directory createDirectory: path]. | ||
current_directory := current_directory directoryNamed: path.]. | ||
^ current_directory |
21 changes: 8 additions & 13 deletions
21
packages/IMAPClient-Core.package/ICFileReadWriter.class/instance/write.in.as..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
write file | ||
write: anICEmail in: aFolder as: aString | ||
|
||
| jsonFile renderedJson fileDirectory subDir | | ||
jsonFile := JsonObject newFrom: { | ||
| json_object rendered_json directory | | ||
json_object := JsonObject newFrom: { | ||
'header' -> (self createJsonHeaderFrom: anICEmail header). | ||
'body' -> anICEmail body. | ||
'messageID' -> anICEmail messageID. | ||
'uid' -> anICEmail uid}. | ||
|
||
fileDirectory := (FileDirectory startUp; default). | ||
subDir := ((aFolder subStrings: (FileDirectory slash)) allButLast) joinSeparatedBy: (FileDirectory slash). | ||
|
||
(fileDirectory directoryExists: subDir) | ||
ifFalse: [ fileDirectory createDirectory: subDir ]. | ||
(fileDirectory directoryExists: aFolder) | ||
ifFalse: [ fileDirectory createDirectory: aFolder ]. | ||
|
||
renderedJson := Json render: jsonFile. | ||
FileStream forceNewFileNamed: (aFolder, FileDirectory slash, aString) do: | ||
directory := self createPathIfNotExisting: aFolder. | ||
|
||
|
||
rendered_json := Json render: json_object. | ||
(FileStream forceNewFileNamed: (directory fullNameFor: aString)) do: | ||
[ :stream | stream | ||
nextPutAll: renderedJson; | ||
nextPutAll: rendered_json; | ||
flush; | ||
close ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/IMAPClient-UI.package/ICFolderDialog.class/instance/chooseNumberOfMails.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
accessing | ||
get emails | ||
chooseNumberOfMails | ||
|
||
| numberOfMails | | ||
|
2 changes: 1 addition & 1 deletion
2
packages/IMAPClient-UI.package/ICFolderDialog.class/instance/fetchHeaderProcess.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
accessing | ||
get emails | ||
fetchHeaderProcess | ||
|
||
selectedFolder fetchHeadersFor: self numberOfHeadersToFetch. | ||
|