-
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 #68 from HPI-SWA-Teaching/origin/develop
Origin/develop
- Loading branch information
Showing
69 changed files
with
244 additions
and
304 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
packages/IMAPClient-Core.package/ICEmail.class/instance/maildirFileName.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 @@ | ||
accessing | ||
maildirFileName | ||
^ 'Maildir' , | ||
FileDirectory slash, | ||
self folder endpoint serverInfo host asString, | ||
FileDirectory slash, | ||
self folder path copyReplaceAll: '.' with: '_' |
5 changes: 2 additions & 3 deletions
5
packages/IMAPClient-Core.package/ICEmail.class/instance/saveInMaildir.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,7 +1,6 @@ | ||
accessing | ||
saveInMaildir | ||
|
||
ICFileReadWriter new | ||
^ ICFileReadWriter new | ||
write: self | ||
in: ('Maildir' , FileDirectory slash , self folder endpoint serverInfo host asString , FileDirectory slash , self folder path copyReplaceAll: '.' with: '_') | ||
in: self maildirFileName | ||
as: self uid |
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
6 changes: 5 additions & 1 deletion
6
packages/IMAPClient-Core.package/ICEndPoint.class/class/fetchHeaderCommand..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,8 @@ | ||
commands | ||
fetchHeaderCommand: messageId | ||
|
||
^ {self protocolCommandStart . 'FETCH' . messageId . '(body[HEADER.FIELDS (from to subject date)])'} joinSeparatedBy: self protocolBlank | ||
^ {self protocolCommandStart. | ||
'FETCH'. | ||
messageId. | ||
'(body[HEADER.FIELDS (from to subject date)])'} | ||
joinSeparatedBy: self protocolBlank |
21 changes: 21 additions & 0 deletions
21
packages/IMAPClient-Core.package/ICEndPoint.class/instance/createEmailsWith.andName..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,21 @@ | ||
connection | ||
createEmailsWith: maildir_directory andName: directory_name | ||
| server_directory filereader existing_emails email folder | | ||
server_directory := maildir_directory 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 | | ||
|
||
Transcript show: 'folderName:' , (directory_name, FileDirectory slash, foldername); cr. | ||
email := (filereader get: filename in: ('Maildir', FileDirectory slash, directory_name, FileDirectory slash, foldername)). | ||
email folder: folder. | ||
existing_emails add: email ]]. | ||
|
||
^ existing_emails. |
45 changes: 8 additions & 37 deletions
45
packages/IMAPClient-Core.package/ICEndPoint.class/instance/fetchHeadersFrom.to..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,42 +1,13 @@ | ||
fetching | ||
fetchHeadersFrom: aBeginId to: anEndId | ||
|
||
| uidSize start end filename files files2 currentMails | | ||
|
||
| start end | | ||
self getCurrentUIDs. | ||
uidSize := uids size. | ||
|
||
aBeginId > uidSize | ||
aBeginId > (self uids size) | ||
ifTrue: [ ^ OrderedCollection new ]. | ||
|
||
anEndId = '*' | ||
ifTrue: [ start := uids first ] | ||
ifFalse: [ anEndId > uidSize | ||
ifTrue: [start := uids first ] | ||
ifFalse: [start := uids at: uidSize - anEndId + 1 ] ]. | ||
|
||
end := uids at: uidSize - aBeginId + 1. | ||
filename := 'Maildir' , FileDirectory slash, (self serverInfo host replaceAll: '.' with: '_') , FileDirectory slash , self currentFolderName. | ||
Transcript show: filename; | ||
cr. | ||
Transcript show: end; | ||
cr. | ||
files := (FileDirectory uri: filename) | ||
fileNamesMatching: end. | ||
files2 := (FileDirectory uri: filename) | ||
fileNamesMatching: start. | ||
Transcript show: files; | ||
cr; | ||
show: files2; | ||
cr. | ||
files size > 0 & (files2 size > 0) | ||
ifTrue: [Transcript show: 'Do nothing. Newest Mailrange already loaded'. | ||
currentMails := rootFolder | ||
childFolderNamed: self currentFolderName | ||
ifAbsent: [OrderedCollection new]. | ||
currentMails := currentMails emails. | ||
^ currentMails]. | ||
^ self | ||
sendCommand: (self class fetchHeadersWithUIDRange: start to: end); | ||
fetchNextResponse; | ||
parseFetchHeaders: self lastResponse | ||
ifTrue: [ start := self uids first ] | ||
ifFalse: [ anEndId > (self uids size) | ||
ifTrue: [start := self uids first ] | ||
ifFalse: [start := self uids at: (self uids size) - anEndId + 1 ] ]. | ||
end := self uids at: (self uids size) - aBeginId + 1. | ||
^ self maildirDiffFetchHeadersFrom: start to: end |
13 changes: 0 additions & 13 deletions
13
packages/IMAPClient-Core.package/ICEndPoint.class/instance/fetchHeadersIn..st
This file was deleted.
Oops, something went wrong.
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
4 changes: 0 additions & 4 deletions
4
packages/IMAPClient-Core.package/ICEndPoint.class/instance/folderFromResponse..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
11 changes: 0 additions & 11 deletions
11
packages/IMAPClient-Core.package/ICEndPoint.class/instance/getAllUIDs.st
This file was deleted.
Oops, something went wrong.
6 changes: 2 additions & 4 deletions
6
packages/IMAPClient-Core.package/ICEndPoint.class/instance/getCurrentUIDs.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,11 +1,9 @@ | ||
fetching | ||
getCurrentUIDs | ||
|
||
self | ||
sendCommand: self class getAllUIDs; | ||
fetchNextResponse. | ||
|
||
uids := ((self lastResponse at: 1) subStrings: ' ') asOrderedCollection | ||
self uids: (((self lastResponse at: 1) subStrings: ' ') asOrderedCollection | ||
removeFirst; | ||
removeFirst; | ||
yourself | ||
yourself) |
3 changes: 1 addition & 2 deletions
3
packages/IMAPClient-Core.package/ICEndPoint.class/instance/hierarchyDelimiter..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,6 +1,5 @@ | ||
accessing | ||
hierarchyDelimiter: aSymbol | ||
|
||
hierachyDelimiter := aSymbol | ||
hierarchyDelimiter := aSymbol | ||
|
||
|
3 changes: 1 addition & 2 deletions
3
packages/IMAPClient-Core.package/ICEndPoint.class/instance/hierarchyDelimiter.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,5 +1,4 @@ | ||
accessing | ||
hierarchyDelimiter | ||
|
||
^ hierachyDelimiter | ||
^ hierarchyDelimiter | ||
|
1 change: 0 additions & 1 deletion
1
packages/IMAPClient-Core.package/ICEndPoint.class/instance/initialize.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,6 +1,5 @@ | ||
initialization | ||
initialize | ||
|
||
super initialize. | ||
self | ||
loggedIn: false; | ||
|
9 changes: 5 additions & 4 deletions
9
packages/IMAPClient-Core.package/ICEndPoint.class/instance/listFoldersIn.using..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,10 +1,11 @@ | ||
message handling | ||
listFoldersIn: root using: filter | ||
|
||
self | ||
checkConnected; | ||
checkLoggedIn. | ||
|
||
self stream sendCommand: ({ self class listCommand . self class asProtocolQuote: root . self class asProtocolQuote: filter } joinSeparatedBy: self class protocolBlank). | ||
|
||
self stream sendCommand: ( | ||
{self class listCommand. | ||
self class asProtocolQuote: root. | ||
self class asProtocolQuote: filter} | ||
joinSeparatedBy: self class protocolBlank). | ||
^ self parseListResponse |
25 changes: 10 additions & 15 deletions
25
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,16 +1,11 @@ | ||
login | ||
loadEmailsFromMaildir | ||
|
||
| directory_name server_directory filereader | | ||
|
||
directory_name := (self serverInfo host) copyReplaceAll: '.' with: '_'. | ||
(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 | self loadEmailsInFolder: foldername andDirectory: server_directory ] | ||
loadEmailsFromMaildir | ||
| directory_name maildir_directory default_directory | | ||
default_directory := FileDirectory default. | ||
(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) ]. | ||
^ self createEmailsWith: maildir_directory andName: directory_name. |
17 changes: 0 additions & 17 deletions
17
...ges/IMAPClient-Core.package/ICEndPoint.class/instance/loadEmailsInFolder.andDirectory..st
This file was deleted.
Oops, something went wrong.
23 changes: 11 additions & 12 deletions
23
packages/IMAPClient-Core.package/ICEndPoint.class/instance/login.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,15 +1,14 @@ | ||
message handling | ||
login | ||
|
||
self checkConnected. | ||
self authenticationInfo isValid ifFalse: [ ^ false ]. | ||
self | ||
sendCommand: ({ self class loginCommand . self authenticationInfo username . self authenticationInfo password } joinSeparatedBy: self class protocolBlank); | ||
fetchNextResponse; | ||
loggedIn: self commandSucceeded; | ||
checkLoggedIn. | ||
self | ||
loadEmailsFromMaildir. | ||
^ true | ||
self authenticationInfo isValid ifFalse: [ ^ false ]. | ||
self sendCommand: ( | ||
{ self class loginCommand. | ||
self authenticationInfo username. | ||
self authenticationInfo password } | ||
joinSeparatedBy: self class protocolBlank); | ||
fetchNextResponse; | ||
loggedIn: self commandSucceeded; | ||
checkLoggedIn. | ||
self loadEmailsFromMaildir. | ||
^ true |
19 changes: 19 additions & 0 deletions
19
...ages/IMAPClient-Core.package/ICEndPoint.class/instance/maildirDiffFetchHeadersFrom.to..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,19 @@ | ||
connection | ||
maildirDiffFetchHeadersFrom: start to: end | ||
| searchBegin searchEnd currentMails | | ||
searchBegin := (FileDirectory uri: self maildirFileName) | ||
fileNamesMatching: end. | ||
searchEnd := (FileDirectory uri: self maildirFileName) | ||
fileNamesMatching: start. | ||
|
||
searchBegin size > 0 & (searchEnd size > 0) | ||
ifTrue: [Transcript show: 'Do nothing. Newest Mailrange already loaded'. | ||
currentMails := rootFolder | ||
childFolderNamed: self currentFolderName | ||
ifAbsent: [OrderedCollection new]. | ||
currentMails := currentMails emails. | ||
^ currentMails]. | ||
^ self | ||
sendCommand: (self class fetchHeadersWithUIDRange: start to: end); | ||
fetchNextResponse; | ||
parseFetchHeaders: self lastResponse |
7 changes: 0 additions & 7 deletions
7
packages/IMAPClient-Core.package/ICEndPoint.class/instance/maildirDirectory.st
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
packages/IMAPClient-Core.package/ICEndPoint.class/instance/maildirFileName.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 @@ | ||
connection | ||
maildirFileName | ||
^ 'Maildir' , | ||
FileDirectory slash, | ||
(self serverInfo host replaceAll: '.' with: '_'), | ||
FileDirectory slash, | ||
self currentFolderName. |
5 changes: 1 addition & 4 deletions
5
packages/IMAPClient-Core.package/ICEndPoint.class/instance/parseFetchHeader.withId..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
Oops, something went wrong.