help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] POP and SMTP assistance


From: Stephen
Subject: Re: [Help-smalltalk] POP and SMTP assistance
Date: Wed, 05 Sep 2007 11:18:35 +1200
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)



In this case, it's because your code is in the Smalltalk namespace,
whereas POPClient is in Smalltalk.NetClients.  You should refer to it by
qualifying it with the namespace, like NetClients.POPClient.
Aha - found the problem. It is actually NetClients.POP.POPClient

If you are compiling methods of a class, you can also "import" all
NetClients names for use in those methods by adding the namespace to
"poolDictionaries".
So thats what that is for. Thanks.

Note that, as with Common Lisp, the namespace
system is separate from the package loading system, so you still need to
load the package.
That is a key statement... I don't think I've seen that in the docs or at least not as clear as you've said it.

The code is running now, however I'm getting an error on output when there are new messages. Error text is below and it refers to a tokensBaseOn call. I assume I have to load another Package... can you tell me how I would find what package to add in (so that I know what to do next time this happens).

Thanks
Stephen

Relevant info below...


In the MIME.st class, there is this method
--------
version: string

    | arr |
    arr := string tokensBasedOn: $..
arr size < 2 ifTrue: [ self notify: 'Version should be specified as <major version>.<minor version>' ].
    self majorVersion: arr first.
    self minorVersion: arr last.! !
--------


Here is the output of the script running
---------------------------------------
~/projects_smalltalk $ gst -i pop1.st
"Global garbage collection... done"
Loading package TCP
Loading package SUnit
SUnitTest->14 run, 14 passed, 0 failed, 0 errors
TestSuitesScriptTest->10 run, 10 passed, 0 failed, 0 errors
Loading package NetClients
Recompiling classes...
New messages: 2
bytes 3240
ids (1 2 )
sizes LookupTable (
        1->1620
        2->1620
)
Object: '1.0' error: did not understand #tokensBasedOn:
MessageNotUnderstood(Exception)>>#signal
String(Object)>>#doesNotUnderstand:
NetClients.MIME.VersionField>>#version:
NetClients.MIME.VersionField>>#value:
NetClients.MIME.VersionField(NetClients.MIME.ScalarField)>>#parse:
NetClients.MIME.VersionField(NetClients.MIME.HeaderField)>>#readFrom:
NetClients.MIME.HeaderField class>>#readFrom:
NetClients.MIME.MimeEntity>>#parseFieldFrom:
NetClients.MIME.MimeEntity>>#parseFieldsFrom:
NetClients.MIME.MimeEntity>>#readFrom:
NetClients.MIME.MimeEntity class>>#readFrom:
NetClients.MIME.MimeEntity class(NetClients.MIME.MessageElement class)>>#readFromClient:
NetClients.POP.POPProtocolInterpreter>>#popRetrieve:
NetClients.POP.POPClient>>#getNewMailMessages:delete:
[] in UndefinedObject>>#executeStatements
BlockClosure>>#ensure:
UndefinedObject>>#executeStatements
Object: POPProtocolInterpreter new "<-0x4c2b8560>" error: Protocol error: address@hidden
NetClients.ProtocolError(Exception)>>#signal
NetClients.ProtocolError(Exception)>>#signal:
NetClients.POP.POPProtocolInterpreter(NetClients.NetProtocolInterpreter)>>#protocolError:
[] in NetClients.POP.POPProtocolInterpreter>>#checkResponse:
NetClients.POP.POPProtocolInterpreter>>#checkResponse:ifError:
NetClients.POP.POPProtocolInterpreter>>#checkResponse:
NetClients.POP.POPProtocolInterpreter(NetClients.NetProtocolInterpreter)>>#checkResponse
NetClients.POP.POPProtocolInterpreter>>#popQuit
NetClients.POP.POPClient>>#logout
NetClients.POP.POPClient(NetClients.NetClient)>>#close
[] in UndefinedObject>>#executeStatements<disabled>
BlockClosure>>#ensure:

---------------------------------------

Here is the code I ran...
---------------------------------------
address@hidden ~/projects_smalltalk $ cat pop1.st
"NetClients.POP.POPClient exampleHost: ... etc."

PackageLoader fileInPackages: #('NetClients')!
Smalltalk addSubspace: #NetClients!
#Namespace current: NetClients!

    | client host username password popClient|
    host := 'host.fqdn'.
    username := 'mailacct'.
    password := 'mailacctPW'.
    client := NetClients.POP.POPClient connectToHost: host.
    [client
        username: username
        password: password.

        client login.
Transcript showCr: 'New messages: ', client newMessagesCount printString.
        Transcript showCr: 'bytes ', client newMessagesSize printString.
        Transcript showCr: 'ids ', client newMessagesIds printString.
        Transcript showCr: 'sizes ', client newMessages printString.

        client
            getNewMailMessages: [:m | m inspect]
            delete: false
    ] ensure: [client close] ! !





reply via email to

[Prev in Thread] Current Thread [Next in Thread]