Skip to content

Commit

Permalink
implemented ICEndPoint and connection establishment
Browse files Browse the repository at this point in the history
Commands:
* NOOP
* Login
  • Loading branch information
Johannes Schneider authored and Johannes Schneider committed May 15, 2016
1 parent 8b943fe commit 878bbb1
Show file tree
Hide file tree
Showing 32 changed files with 186 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"propertyFileExtension" : ".json",
"packageExtension" : ".package" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
responses
commandFailed

^ ICStringFormatter concatinate: (self protocolCommandStart, 'NO') with: self protocolBlank
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
responses
commandSucceeded

^ ICStringFormatter concatinate: (self protocolCommandStart, 'OK') with: self protocolBlank
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
errors
errorBadProtocol

^ 'server protocol not supported'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
errors
errorLoginFailed

^ 'authentification failed'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
errors
errorNoConnection

^ 'connection not established'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
errors
errorNoPasswordSet

^ 'no password set'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
errors
errorNoUsernameSet

^ 'username not set'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
commands
loginCommand

^ ICStringFormatter concatinate: (self protocolCommandStart, 'LOGIN') with: self protocolBlank
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
commands
noopCommand

^ ICStringFormatter concatinate: (self protocolCommandStart, 'NOOP') with: self protocolBlank
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
protocolBlank

^ ' '
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
protocolCommandStart

^ '.'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
responses
protocolError

^ ICStringFormatter concatinate: (self protocolCommandStart, 'BAD') with: self protocolBlank
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message handling
commandSucceeded

^ self lastResponse beginsWith: self class commandSucceeded
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
connection
connectTo: host on: port

self openOnHost: (NetNameResolver addressForName: host) port: port.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
connection
connectTo: host on: port using: username and: password

self user: username.
self password: password.

self openOnHost: (NetNameResolver addressForName: host) port: port.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initialization
initialize

super initialize.

self loggedIn: false.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
isLoggedIn

^ self loggedIn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
loggedIn: anObject

loggedIn := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
loggedIn

^ loggedIn
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
message handling
login

self isConnected ifFalse: [ ^ Error signal: self class errorNoConnection ].
self user ifNil: [ ^ Error signal: self class errorNoUsernameSet ].
self password ifNil: [ ^ Error signal: self class errorNoPasswordSet ].

self
sendCommand: (ICStringFormatter concatinate: (self class loginCommand, self user, self password) with: self class protocolBlank);
fetchNextResponse.

self responseIsError ifTrue: [ ^ Error signal: self class errorBadProtocol ].
self loggedIn: self commandSucceeded.
self isLoggedIn ifFalse: [ ^ Error signal: self class errorLoginFailed ].
^ true
11 changes: 11 additions & 0 deletions packages/IMAPClient-Core.package/ICEndpoint.class/instance/ping.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
message handling
ping

self isConnected ifFalse: [ ^ Error signal: self class errorNoConnection ].

self
sendCommand: self class noopCommand;
fetchNextResponse.

self responseIsError ifTrue: [ ^ Error signal: self class errorBadProtocol ].
^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error handling
responseIsError

^ self lastResponse beginsWith: self class protocolError
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error handling
responseIsWarning

^ false.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"class" : {
"commandFailed" : "js 5/15/2016 13:39",
"commandSucceeded" : "js 5/15/2016 13:39",
"errorBadProtocol" : "js 5/15/2016 13:55",
"errorLoginFailed" : "js 5/15/2016 13:55",
"errorNoConnection" : "js 5/15/2016 13:50",
"errorNoPasswordSet" : "js 5/15/2016 13:51",
"errorNoUsernameSet" : "js 5/15/2016 13:51",
"loginCommand" : "js 5/15/2016 13:39",
"noopCommand" : "js 5/15/2016 13:58",
"protocolBlank" : "js 5/15/2016 13:37",
"protocolCommandStart" : "js 5/15/2016 13:37",
"protocolError" : "js 5/15/2016 13:38" },
"instance" : {
"commandSucceeded" : "js 5/15/2016 13:20",
"connectTo:on:" : "js 5/15/2016 14:03",
"connectTo:on:using:and:" : "js 5/15/2016 14:02",
"initialize" : "js 5/15/2016 13:11",
"isLoggedIn" : "js 5/15/2016 13:09",
"loggedIn" : "js 5/15/2016 13:09",
"loggedIn:" : "js 5/15/2016 13:09",
"login" : "js 5/15/2016 14:00",
"ping" : "js 5/15/2016 14:00",
"responseIsError" : "js 5/15/2016 14:03",
"responseIsWarning" : "js 5/15/2016 12:36" } }
14 changes: 14 additions & 0 deletions packages/IMAPClient-Core.package/ICEndpoint.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "IMAPClient-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"loggedIn" ],
"name" : "ICEndpoint",
"pools" : [
],
"super" : "ProtocolClient",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
formatter
concatinate: strings with: symbol

| result |

result := strings first.
strings allButFirst do: [ :s | result := symbol, result ].

^ result
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
"concatinate:with:" : "js 5/15/2016 13:31" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "IMAPClient-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "ICStringFormatter",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
2 changes: 1 addition & 1 deletion packages/IMAPClient-Core.package/monticello.meta/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(name 'IMAPClient-Core-AR.2' message 'set up Travis' id 'd69c12e8-3bd3-4f1b-a6bd-e6c5fc59aaa6' date '2 May 2016' time '5:38:41.570308 pm' author 'AR' ancestors ((name 'IMAPClient-Core-AR.1' message 'set up Travis' id 'a6b34deb-b0ba-40c0-81a6-db2ff2b261f7' date '2 May 2016' time '5:35:04.891975 pm' author 'AR' ancestors () stepChildren ())) stepChildren ())
(name 'IMAPClient-Core-js.3' message 'implemented ICEndPoint and connection establishmentCommands:* NOOP* Login' id '7894aa44-dc72-4d46-82da-26d1b0b0d898' date '15 May 2016' time '2:05:00.720022 pm' author 'js' ancestors ((name 'IMAPClient-Core-AR.2' message 'set up Travis' id 'd69c12e8-3bd3-4f1b-a6bd-e6c5fc59aaa6' date '2 May 2016' time '5:38:41.570308 pm' author 'AR' ancestors ((name 'IMAPClient-Core-AR.1' message 'set up Travis' id 'a6b34deb-b0ba-40c0-81a6-db2ff2b261f7' date '2 May 2016' time '5:35:04.891975 pm' author 'AR' ancestors () stepChildren ())) stepChildren ())) stepChildren ())
Expand Down

0 comments on commit 878bbb1

Please sign in to comment.