From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:34:05 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <class> <name>POP3State</name> <environment>Net</environment> <super>Net.NetClientState</super> <private>false</private> none <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3State
Superclass for all POP3 states. Publishes command signatures, implements them all as invalid for the state
</comment> <class> <name>POP3UpdateState</name> <environment>Net</environment> <super>Net.POP3State</super> <private>false</private> none <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3UpdateState
POP3UpdateState implements the POP3 client Update state. The client issues the QUIT command and the POP3 session enters the UPDATE state
</comment> <class> <name>POP3StateError</name> <environment>Net</environment> <super>Net.NetClientError</super> <private>false</private> none <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3StateError
Signal to be raised for commands taht are invalid in the current state
</comment> <class> <name>POP3Mailbox</name> <environment>Net</environment> <super>Net.Mailbox</super> <private>false</private> none <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3Mailbox
POP3Mailbox provides POP3 mail box support
</comment> <class> <name>POP3TransactionState</name> <environment>Net</environment> <super>Net.POP3State</super> <private>false</private> none <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3TransactionState
Transaction state is when the user has logged in and authorized himself to POP3 server. Actual message retrieval/manipulations are valid now
</comment> <class> <name>POP3Client</name> <environment>Net</environment> <super>Net.NetClient</super> <private>false</private> none serverResponse <imports> private OS.IOConstants.* </imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3Client
The POP3Client implements RFC 1939. Because most commands are only valid in certain states, the state variable holds and instance of (subclass of) POP3State. All commands are delegated to the state which either rejects them as inappropriate in the given state, or calls client back to send the command to a POP3 server. Instance Variables: serverResponse <String> server response Shared Variables: LastServer <type> Last server -- if we don't care TerminationOctet <Character> comment TerminationSequence <String> comment
</comment> <class> <name>Pop3Client</name> <environment>Net</environment> <super>Net.POP3Client</super> <private>false</private> none <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.Pop3Client
Pop3Client is obsolete. Use POP3Client class
</comment> <class> <name>POP3NotConnectedState</name> <environment>Net</environment> <super>Net.POP3State</super> <private>false</private> none <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3NotConnectedState
POP3NotConnectedState is set when the client is not connected to a server
</comment> <class> <name>POP3Connection</name> <environment>Net</environment> <super>Net.NetConnection</super> <private>false</private> none <imports> private OS.IOConstants.* </imports> <category>Net-SMTP-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3Connection
Pop3Connection is the POP3 connection stream wrapper
</comment> <class> <name>POP3Status</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none messages octets <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3Status
POP3 command status. In order to simplify parsing, all POP3 servers are required to use a certain format for scan listings. A can listing consists of the message-number of the message, followed by a single space and the exact size of the message in octets. Instance Variables: messages <Number> message number octets <Number> the exact size of the message in octets
</comment> <class> <name>POP3ProtocolInterpreter</name> <environment>Net</environment> <super>Net.NetProtocolInterpreter</super> <private>false</private> none <imports></imports> <category>POP3</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3ProtocolInterpreter
POP3ProtocolInterpreter manages POP3 server connection and provides interface for sending POP3 commands and handling POP3 responses.
</comment> <class> <name>POP3AuthorizationState</name> <environment>Net</environment> <super>Net.POP3State</super> <private>false</private> none <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.POP3AuthorizationState
Pop3 Authorization state is used when the user has to be authorized to Pop3 server. Only autorization commands are valid
</comment> <class> <name>FailedToDeleteId</name> <environment>Net</environment> <super>Net.NetNotification</super> <private>false</private> none <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.FailedToDeleteId
FailedToDeleteId is raise if the client was not able to delete id's
</comment> <class> <name>Pop3Mailbox</name> <environment>Net</environment> <super>Net.POP3Mailbox</super> <private>false</private> none <imports></imports> <category>Net-POP3-Support</category> <attributes> <package>POP3</package> </attributes> </class> <comment> Net.Pop3Mailbox
Pop3Mailbox is obsolete. Use POP3Mailbox class
</comment> <name>LastServer</name> <environment>Net.POP3Mailbox</environment> <private>false</private> <constant>false</constant> <category>local globals</category> <attributes> <package>POP3</package> </attributes> <name>MinTransferRate</name> <environment>Net.POP3Mailbox</environment> <private>false</private> <constant>false</constant> <category>debugging</category> <initializer>Core.Dictionary new</initializer> <attributes> <package>POP3</package> </attributes> <name>MaxTransferRate</name> <environment>Net.POP3Mailbox</environment> <private>false</private> <constant>false</constant> <category>debugging</category> <initializer>Core.Dictionary new</initializer> <attributes> <package>POP3</package> </attributes> <name>LastServer</name> <environment>Net.POP3Client</environment> <private>false</private> <constant>false</constant> <category>local globals</category> <attributes> <package>POP3</package> </attributes> <name>TerminationOctet</name> <environment>Net.POP3Client</environment> <private>false</private> <constant>true</constant> <category>local globals</category> <initializer>Core.Character value: 46</initializer> <attributes> <package>POP3</package> </attributes> <name>TerminationSequence</name> <environment>Net.POP3Client</environment> <private>false</private> <constant>true</constant> <category>local globals</category> <initializer>Core.String with: (Core.Character value: 46) with: Core.Character cr with: Core.Character lf</initializer> <attributes> <package>POP3</package> </attributes> <methods> Net.POP3State <category>commands</category>
apopName: aStringName digest: aStringDigest for: aClient self signalError
delete: message for: aClient self signalError
deleteMessageIds: aSequenceOfUniqueIDs for: aClient self signalError
list: number for: aClient self signalError
listMessage: number for: aClient self signalError
noop: aClient self signalError
pass: aClient self signalError
quit: aClient self signalError
reset: aClient self signalError
retrieveMessage: number for: aClient self signalError
retrieveMessageID: number for: aClient self signalError
retrieveMessageLines: number for: aClient self signalError
stat: aClient self signalError
top: lines of: msg for: aClient self signalError
user: aClient self signalError
</methods> <methods> Net.POP3State <category>accessing</category>
stateErrorClass ^POP3StateError
</methods> <methods> Net.POP3Mailbox <category>commands</category>
allHeaders | messageCount | ^self connectedDo: [messageCount := connection status messages. (1 to: messageCount) collect: [:i | MailIncrementNotification raiseSignal. MimeEntity readHeaderFrom: (connection top: 10 of: i) readStream]]
anyNewMail "Any new mail to get?" ^self messageCount > self lastMessage
getMessage: number "Get the <number> message from the Pop3server" ^self safelyExecute: [self getMessageNumber: number]
messageCount "How many messages are on the server?" ^self safelyExecute: [connection status messages].
</methods> <methods> Net.POP3Mailbox <category>private</category>
clientSpecies ^POP3Client
deleteMessageNumbers: aSequenceOfUids "Delete all messages which have unique ids in the argument. Answer the number of messages remaining on the server." ^self connectedDo: [| remaining | remaining := connection deleteMessageIds: aSequenceOfUids. self lastMessage: remaining. remaining]
deliverFrom: startCount to: messageCount self log: [(#DownloadingMessages << #net >> 'Downloading <1p> messages from <2s>') expandMacrosWith: messageCount with: server] level: #IPOP3Download. messageCount timesRepeat: [ | message n milliseconds | milliseconds := Time millisecondsToRun: [message := self getMessageNumber: (n := self lastMessage + 1)]. self lastMessage: n. n - startCount \\ 10 = 0 ifTrue: [self log: [(#DownloadedMessages << #net >> 'Downloaded <1p> messages from <2s>')expandMacrosWith: n - startCount with: server] level: #POP3Download]. self deliver: message. self debug: [self class processTransferRate: milliseconds ofSize: message size fromServer: server] level: #POP3TransferRate. Processor yield "be nice to other mail polling processes" ]
getMessageNumber: number "Get the <number> message from a Pop3 server on connection and return the message as a string." | lines id stream | IncrementNotification raiseSignal. lines := connection retrieveMessageLines: number. id := connection retrieveMessageID: number. stream := (String new: 512) writeStream. lines do: [ :each | stream nextPutAll: (each copyFrom: 1 to: ( each size - 1)) ]. ^LetterInTransit new letterText: stream contents; uid: id; server: self serverName; serverType: self serverType; deliveryAction: [self saveSettings: number]; yourself
</methods> <methods> Net.POP3Mailbox <category>mail delivery</category>
deliverAllMail "Queue up all new messages onto the queue. Clients of this method should be aware that the state should be such that there is new mail to download." self safelyExecute: [| messageCount | messageCount := connection status messages. self deliverFrom: 1 to: messageCount. self log: [(#DoneDownloaded << #net >> 'Done; downloaded <1p> messages from <2s>') expandMacrosWith: messageCount with: server] level: #POP3Download ]
deliverMail "Queue up a message onto the queue." | n | self deliver: (self getMessage: (n := self lastMessage + 1)). self lastMessage: n.
deliverNewMail "Queue up all new messages onto the queue. Clients of this method should be aware that the state should be such that there is new mail to download." self safelyExecute: [| startCount messageCount | messageCount := connection status messages - (startCount := self lastMessage). self deliverFrom: startCount to: messageCount. self log: [(#DoneDownloaded << #net >> 'Done; downloaded <1p> messages from <2s>') expandMacrosWith: (self lastMessage - startCount) with: server] level: #POP3Download ]
</methods> <methods> Net.POP3Mailbox <category>accessing</category>
logout connection notNil ifTrue: [connection close. connection := nil]
serverType ^'POP3'
</methods> <methods> Net.POP3Mailbox class <category>utilities</category>
processTransferRate: milliseconds ofSize: size fromServer: server "self processTransferRate: 32 ofSize: 1836 fromServer: 'sulu.cincom.com' " | bytesPerSecond kiloBytesPerSecond maxTransferRate minTransferRate | bytesPerSecond := (size / milliseconds) * 1000. kiloBytesPerSecond := (bytesPerSecond / 1024) asFloat. maxTransferRate := (MaxTransferRate at: server ifAbsentPut: [0]) max: kiloBytesPerSecond. maxTransferRate = kiloBytesPerSecond ifTrue: [MaxTransferRate at: server put: kiloBytesPerSecond]. minTransferRate := (MinTransferRate at: server ifAbsentPut: [1024*1024]) min: kiloBytesPerSecond. minTransferRate = kiloBytesPerSecond ifTrue: [MinTransferRate at: server put: kiloBytesPerSecond]. self log: [(#TransferRateOfKbps << #net >> 'Transfer Rate of <1p> Kbps from <2s>. Max: <3p> Min: <4p>') expandMacrosWith: kiloBytesPerSecond with: server with: maxTransferRate with: minTransferRate] level: #POP3TransferRate.
promptForConnection "Pop3Mailbox promptForConnection" | connection user host | user := NetUser request. user isNil ifTrue: [^self]. host := Dialog request: (#PopServerOn << #net >> 'Pop server on:') initialAnswer: (LastServer isNil ifTrue: [(#postofficepacbellnet << #net >> 'xxxx.com')] ifFalse: [LastServer]) onCancel: [^nil]. LastServer := host. connection := POP3Client host: host. connection user: user. ^connection
request "Pop3Mailbox request" | username password host cancel | username := (NetUser lastUser isNil ifTrue: [''] ifFalse: [NetUser lastUser]) asValue. password := '' asValue. host := (LastServer isNil ifTrue: [(#postofficepacbellnet << #net >> 'xxxx.com')] ifFalse: [LastServer]) asValue. cancel := (SimpleDialog initializedFor: nil) setInitialGap; addMessage: (#WhatPOP3ServerAndLogin << #net >> 'What POP3 Server and login?') centered: true; addGap; addMessage: (#UsernameC << #net >> 'Username:') textLine: username boundary: 0.4; addGap; addMessage: (#PasswordC << #net >> 'Password:') textLine: password type: #password boundary: 0.4; addGap; addMessage: (#POP3Server << #net >> 'POP3 Server:') textLine: host boundary: 0.4; addGap; addOK: [true]; openDialog; cancel. cancel value ifTrue: [^nil]. ^self user: (NetUser username: username value password: password value) server: host value
</methods> <methods> Net.POP3Mailbox class <category>debugging</category>
debugLabelsAndValues ^OrderedCollection new add: ((#Pop3MailboxDownloads << #net >> 'Pop3Mailbox Downloads')->#POP3Download); add: ((#Pop3MailboxServerChecking << #net >> 'Pop3Mailbox Server Checking')->#POP3Check); add: ((#Pop3MailboxTransferRate << #net >> 'Pop3Mailbox Transfer Rate')->#POP3TransferRate); yourself
initialize self registerToDebug
menuItemName ^(#POP3MailboxMessages << #net >> 'POP3 Mailbox Messages')
</methods> <methods> Net.POP3TransactionState <category>commands</category>
delete: message for: aClient ^aClient sendDeleteMessage: message
deleteMessageIds: aSequenceOfUniqueIDs for: aClient ^aClient sendDeleteMessageIds: aSequenceOfUniqueIDs
list: aClient ^aClient sendList
list: number for: aClient ^aClient sendList: number
listMessage: number for: aClient ^aClient sendList: number
noop: aClient ^aClient sendNoop
quit: aClient aClient sendQuit. aClient state: POP3UpdateState new.
reset: aClient ^aClient sendReset
retrieveMessage: number for: aClient ^aClient sendRetrieveMessage: number
retrieveMessageID: number for: aClient ^aClient sendRetrieveMessageID: number
retrieveMessageLines: number for: aClient ^aClient sendRetrieveMessageLines: number
stat: aClient ^aClient sendStat
top: lines of: msg for: aClient ^aClient sendTop: lines of: msg
</methods> <methods> Net.POP3Client <category>private</category>
sendApopName: aStringName digest: aStringDigest self executeCommand: ('APOP ', aStringName, ' ', aStringDigest) onError: [NetClientError signalWith: #APOP message: self serverResponse].
sendDeleteMessage: number self executeCommand: ('DELE <1p>' expandMacrosWith: number) onError: [NetClientError signalWith: #DELE message: self serverResponse]
sendDeleteMessageIds: aSequenceOfUniqueIDs "Delete all messages whose unique ids appear in aSequenceOfUniqueIDs. Do so by doing a UIDL list, computing matching message numbers, and deleting by message number." | count map | count := self sendStat messages. map := Dictionary new: count * 2. self executeCommand: 'UIDL' onError: [NetClientError signalWith: #UIDL message: self serverResponse]. self retrieveMultiLineResponseDo: [:line | | msgnum | msgnum := Integer readFrom: (ReadStream on: line). map at: (line copyFrom: (line lastIndexOf: Character space) + 1 to: line size - 2) put: msgnum]. aSequenceOfUniqueIDs do: [ :uid | | msgnum | (msgnum := map at: uid ifAbsent: []) notNil and: [self executeCommand: ('DELE <1p>' expandMacrosWith: msgnum) onError: [FailedToDeleteId signalWith: (#failedToDeleteId << #net >> 'failed to delete id '), uid ]]]. ^self sendStat messages
sendList | messageStatuses | self executeCommand: 'LIST' onError: [^self]. messageStatuses := OrderedCollection new: 30. self retrieveMultiLineResponseInto: (String new: 256) writeStream process: [:line | |result| IncrementNotification signalWith: line size. result := line tokensBasedOn: Character space. messageStatuses add: (POP3Status new messages: (Number readFrom: (result at: 1) readStream); octets: (Number readFrom: (result at: 2) readStream); yourself). line]. ^messageStatuses
sendList: messageNumber | result | self executeCommand: ('LIST <1p>' expandMacrosWith: messageNumber) onError: [NetClientError signalWith: #LIST message: self serverResponse]. result := self serverResponse tokensBasedOn: Character space. ^POP3Status new messages: (Number readFrom: (result at: 2) readStream); octets: (Number readFrom: (result at: 3) readStream); yourself
sendNoop "It should always be positive" self executeCommand: 'NOOP' onError: [^self].
sendPassword self executeCommand: ('PASS <1s>' expandMacrosWith: self user password) onError: [^NetClientError signalWith: #login message: self serverResponse ].
sendQuit self executeCommand: 'QUIT' onError: [^NetClientError signalWith: #QUIT message: self serverResponse ].
sendReset "Should never be false" self executeCommand: 'RSET' onError: [^NetClientError signalWith: #RSET message: self serverResponse ].
sendRetrieveMessage: number | lines size result resultStream | self executeCommand: ('RETR <1p>' expandMacrosWith: number) onError: [^NetClientError signalWith: #RETR message: self serverResponse ]. lines := LinkedList new. size := 0. self retrieveMultiLineResponseDo: [:line | | lineSize | lineSize := line size. size := size + lineSize - 1. IncrementNotification signalWith: lineSize. lines addLast: (LinkValue value: line)]. result := String new: size. resultStream := result writeStream. lines do: [:lv| | line | line := lv value. resultStream next: line size - 1 putAll: line startingAt: 1]. (result size ~= size or: [resultStream position ~= size]) ifTrue: [self error: (#WrongNumberOfElementsWritten << #net >> 'wrong number of elements written to resultStream')]. ^result
sendRetrieveMessageID: number "Return a message's unique id as a String, or nil if the server does not support the UIDL command." | response | self executeCommand: ('UIDL <1p>' expandMacrosWith: number) onError: [^nil ]. ^(response := self serverResponse) notEmpty ifTrue: [response copyFrom: (response lastIndexOf: Character space) + 1 to: response size - 2] ifFalse: [nil]
sendRetrieveMessageLines: number "Return a message as an OrderedCollection of lines with CRLF termination." | lines count result | self executeCommand: ('RETR <1p>' expandMacrosWith: number) onError: [^NetClientError signalWith: #RETR message: self serverResponse ]. lines := LinkedList new. count := 0. self retrieveMultiLineResponseDo: [:line | count := count + 1. IncrementNotification signalWith: line size. lines addLast: (LinkValue value: line)]. result := OrderedCollection new: count + 10. lines do: [:lv| result addLast: lv value]. ^result
sendStat | result | "It should always be positive" self executeCommand: 'STAT' onError: [^NetClientError signalWith: #STAT message: self serverResponse ]. result := (self serverResponse tokensBasedOn: Character space). ^POP3Status new messages: (Number readFrom: (result at: 2) readStream); octets: (Number readFrom: (result at: 3) readStream); yourself
sendTop: number of: msg | lines size result resultStream | self executeCommand: ('TOP <1p> <2p>' expandMacrosWith: msg with: number) onError: [^NetClientError signalWith: #TOP message: self serverResponse ]. lines := LinkedList new. size := 0. self retrieveMultiLineResponseDo: [:line | | lineSize | lineSize := line size. size := size + lineSize - 1. IncrementNotification signalWith: lineSize. lines addLast: (LinkValue value: line)]. result := String new: size. resultStream := result writeStream. lines do: [:lv| | line | line := lv value. resultStream next: line size - 1 putAll: line startingAt: 1]. (result size ~= size or: [resultStream position ~= size]) ifTrue: [self error: (#WrongNumberOfElementsWritten << #net >> 'wrong number of elements written to resultStream')]. ^result
sendUser self executeCommand: ('USER <1s>' expandMacrosWith: self user username) onError: [^NetClientError signalWith: #login message: self serverResponse ].
</methods> <methods> Net.POP3Client <category>connection management</category>
close self quit; disconnect.
connect | retriesx | retriesx := self retries. "Just in case our server is busy, prepare for an error." [super connect. self state: POP3AuthorizationState new. serverResponse := self clientPI waitForResponses ] on: OSErrorHolder peerFaultSignal, OsInaccessibleError do: [:ex | retriesx := retriesx - 1. (ex getSignal = OSErrorHolder peerFaultSignal and: [(self handlePeerFaultError: ex retries: retriesx )]) ifTrue: [^self connectionError "Unable to connect to the server."]. ex class = OsInaccessibleError ifTrue: [^self connectionError "Pop3Server is not accessible."]]
connectionError ^NetClientError signalWith: #connection
disconnect super disconnect. self state: POP3NotConnectedState new.
handlePeerFaultError: exception retries: retriesx "The Pop3Server we are connecting to might be too busy to handle our connection request. In this case, delay for a little while and try again. Once we have hit our connection retry limit, return true to the client so that it can handle the error as it sees fit." retriesx > 0 ifTrue: [(Delay forSeconds: self delaySeconds) wait. self log: [(#FailedToConnectWillTryMore << #net >> 'Failed to connect to <1s>. Will try <2p> more times.') expandMacrosWith: self hostName with: retriesx] level: #POP3Client. exception retry]. ^true
</methods> <methods> Net.POP3Client <category>commands</category>
apop: aStringName digest: aStringDigest self state apopName: aStringName digest: aStringDigest for: self. self state: POP3TransactionState new. ^true
delete: message ^self state delete: message for: self
deleteMessageIds: aCollectionOfUniqueIDs "Delete all messages which have unique ids in the argument. Answer the number of messages remaining on the server." ^self state deleteMessageIds: aCollectionOfUniqueIDs for: self
list ^self state list: self
list: messageNumber ^self state list: messageNumber for: self
login self state user: self. self state pass: self. self state: POP3TransactionState new. ^true
noop ^self state noop: self
quit " When the client issues the QUIT command from the TRANSACTION state, the POP3 session enters the UPDATE state. There is no disconnect from the server " self state quit: self
reset ^self state reset: self
retrieveMessage: number ^self state retrieveMessage: number for: self
retrieveMessageID: number ^self state retrieveMessageID: number for: self
retrieveMessageLines: number ^self state retrieveMessageLines: number for: self
status ^self state stat: self
top: lines of: messageID ^self state top: lines of: messageID for: self
uidl: aNumber ^self retrieveMessageID: aNumber
</methods> <methods> Net.POP3Client <category>testing</category>
hasNegativeResponse ^(self serverResponse indexOfSubCollection: '-ERR' startingAt: 1) > 0
hasPositiveResponse ^(self serverResponse indexOfSubCollection: '+OK' startingAt: 1) > 0
successful ^self hasPositiveResponse
</methods> <methods> Net.POP3Client <category>low-level command interface</category>
executeCommand: aString onError: aBlock serverResponse := self clientPI executeCommand: aString. self hasPositiveResponse ifFalse: [ aBlock value]
retrieveMultiLineResponseDo: block | result | [result := self clientPI getNextLine. result isEmpty or: [result = TerminationSequence]] whileFalse: [result first = TerminationOctet ifTrue: [result := result copyFrom: 2 to: result size]. serverResponse := result. block value: result]
retrieveMultiLineResponseInto: aStream process: block | result | result := self clientPI getNextLine. [result isEmpty or: [result = TerminationSequence]] whileFalse: [result := result first = TerminationOctet ifTrue: [result copyFrom: 2 to: result size] ifFalse: [result]. serverResponse := result. aStream nextPutAll: (block value: result). result := self clientPI getNextLine]
</methods> <methods> Net.POP3Client <category>accessing</category>
serverResponse ^serverResponse isNil ifTrue: [serverResponse := String new] ifFalse: [serverResponse]
</methods> <methods> Net.POP3Client <category>initialize-release</category>
initialize super initialize. self state: POP3NotConnectedState new
</methods> <methods> Net.POP3Client class <category>testing</category>
isIncomingMailClient ^true
isMailClient ^true
isOutgoingMailClient ^false
</methods> <methods> Net.POP3Client class <category>utilities</category>
messageCount "How many messages are on the server?" "self messageCount" | connection | connection := self promptForConnection. ^[connection status messages] ensure: [connection disconnect]
promptForConnection "Pop3Connection promptForConnection" | connection user host | user := NetUser request. user isNil ifTrue: [^self]. host := Dialog request: 'Pop server on:' initialAnswer: (LastServer isNil ifTrue: ['xxxx.com'] ifFalse: [LastServer]) onCancel: [^nil]. LastServer := host. connection := self host: host. connection user: user. connection connect; login. ^connection
showProgress: aString complete: anInteger while: aBlock "Show a progress indicator window while executing a block of code. anInteger is the completeness count (ie = 100%). IncrementNotification is raised to denote progress." "self showProgress: 'X' complete: 10000 while: [ 10000 timesRepeat: [ IncrementNotification raiseSignal ] ]" | increment progress pw res | increment := 1.0 / anInteger. progress := 0.0 asValue. pw := ProgressWidgetView progressOpenOn: progress label: aString asText allBold. [ [ Cursor wait showWhile: [ res := aBlock value ] ] on: IncrementNotification do: [ :not | progress value: ( progress value + ( not ticks * increment ) ). not resume. ] ] ensure: [ pw closeAndUnschedule ]. ^res
timestampFormat "This is simply moronic." |policy| policy := (OrderedCollection new: 10) add: #ddd; add: Character space; add: #mmm; add: Character space; add: #d; add: Character space; add: #h; add: $: ; add: #mm; add: Character space; add: #yyyy; yourself. ^policy asArray
</methods> <methods> Net.POP3Client class <category>instance creation</category>
new ^super new initialize
</methods> <methods> Net.POP3Client class <category>constants</category>
description ^(#incomingMailServer << #net >> 'incoming mail server') asString
serverType ^#POP3
</methods> <methods> Net.POP3Client class <category>private</category>
update: anAspect with: arguments from: anObject
</methods> <methods> Net.POP3Client class <category>class initialization</category>
initialize "self initialize." super initialize. self registerToDebug.
registerClass self mailRegistry at: self serverType put: self name
</methods> <methods> Net.POP3Client class <category>default values</category>
defaultProtocolInterpreterClassValue ^POP3ProtocolInterpreter
</methods> <methods> Net.POP3Connection class <category>default values</category>
defaultLineEndConvention ^LineEndTransparent
defaultPortNumber ^SocketAccessor IPPORT_POP3
</methods> <methods> Net.POP3Status <category>accessing</category>
messages ^messages isNil ifTrue: [messages := 0] ifFalse: [messages]
messages: count messages := count
octets ^octets isNil ifTrue: [octets := 0] ifFalse: [octets]
octets: count octets := count
</methods> <methods> Net.POP3ProtocolInterpreter <category>ssl connection</category>
loadSecureConnection super loadSecureConnection. #{Net.POP3SSLConnection} valueOrDo: [URI tryToLoad: 'POP3S']
sslConnectionClass ^#{Net.POP3SSLConnection} value
</methods> <methods> Net.POP3ProtocolInterpreter <category>public</category>
executeCommand: aString self sendCommand: aString. ^self waitForResponses.
sendCommand: aString self isConnected ifFalse: [^NetClientError signalWith: #POP3Client message: (#Pop3ClientConnectionIsClosed << #net >>'Pop3Client: Connection is closed') asString.]. self log: ['C: <1s> ' expandMacrosWith: aString ] level: #POP3Client. self stream nextPutAll: aString; nextPutAll: CRLF; flush.
</methods> <methods> Net.POP3ProtocolInterpreter <category>responses</category>
getNextLine | line | line := self connection getResponseStream throughAll: CRLF. self log: ['S: <1s> ' expandMacrosWith: line ] level: #POP3Server. ^line
waitForResponses | result | result := self connection getResponseStream throughAll: CRLF. self log: ['S: <1s> ' expandMacrosWith: result ] level: #POP3Server. ^result
</methods> <methods> Net.POP3ProtocolInterpreter class <category>debugging</category>
debugLabelsAndValues ^(OrderedCollection new) add: ((#Pop3ClientMessages << #net >> 'Pop3 Client Messages')->#POP3Client); add: (#Pop3ServerMessages << #net >> 'Pop3 Server Messages')->#POP3Server; yourself
menuItemName ^(#POP3ClientMessages << #net >> 'POP3 Client Messages') asString
</methods> <methods> Net.POP3ProtocolInterpreter class <category>class initialization</category>
initialize "self initialize." self registerToDebug.
</methods> <methods> Net.POP3ProtocolInterpreter class <category>default values</category>
defaultNetConnectionValue ^POP3Connection
</methods> <methods> Net.POP3AuthorizationState <category>commands</category>
apopName: aStringName digest: aStringDigest for: aClient ^aClient sendApopName: aStringName digest: aStringDigest
pass: aClient aClient sendPassword
quit: aClient aClient sendQuit. aClient disconnect.
user: aClient aClient sendUser
</methods> <methods> Net.FailedToDeleteId <category>private</category>
defaultResumeValue ^self parameter asString
</methods> <initialize> Net.POP3Mailbox </initialize> <initialize> Net.POP3Client </initialize> <initialize> Net.POP3ProtocolInterpreter </initialize> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>Object</name> <environment>Core</environment> <super></super> <private>false</private> none <imports></imports> <category>Kernel-Objects</category> <attributes> <package>Kernel-Objects</package> </attributes> </class> <class> <name>NetProtocolInterpreter</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none connection defaultNetConnection <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <class> <name>NetClientState</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none client <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <class> <name>NetConnection</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none stream encoding <imports> private OS.IOConstants.* </imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <class> <name>NetClientError</name> <environment>Net</environment> <super>Net.NetError</super> <private>false</private> none <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <class> <name>Mailbox</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none user server lastMessage keepMail deleteMail deliveryQueue pollingProcess delaySemaphore sync settingsSync connection <imports></imports> <category>Net-Mail</category> <attributes> <package>Mail</package> </attributes> </class> <class> <name>NetNotification</name> <environment>Net</environment> <super>Core.Notification</super> <private>false</private> none <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <class> <name>NetClient</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none user hostName portNumber clientPI retries timeout delaySeconds state defaultProtocolInterpreterClass <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class>