beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 799

background image

C H A P T E R 2 2

Transport Interface

Using the Transport Interface

22-11

After downloading all the remote data, you must refresh the In Box view, so the
items are updated. To do so, send the

Refresh

message to the application

identified by the

ownerApp

slot in the transport, like this:

ownerApp:Refresh();

Note

In Newton OS version 2.0, the

ownerApp

slot in the transport

must first be set up by using the NTK platform file function

kSetupOwnerAppFunc

in the transport

InstallScript

method.

To delete partially downloaded (remote) items from the In Box, send the

RemoveTempItems

message to the application identified by the

ownerApp

slot

in the transport, like this:

ownerApp:RemoveTempItems(

transportSym

);

// then refresh the in box view

ownerApp:Refresh();

Typically, after disconnecting, transports that handle remote items delete those
items from the In Box that the user has not chosen to fully download. Also, you
must send the

Refresh

message following

RemoveTempItems

.

Setting the timeStamp Slot of an Item

22

The

timeStamp

slot of the item frame holds the time that an item was submitted

to the In/Out Box. This slot is ordinarily set by the In/Out Box when an item is
received or submitted for sending. Many transports won’t need to do anything
special, but some transports must set this slot themselves. Such transports include
those that receive data that contains internal information about when an item was
sent, and where the time the item was sent typically differs from the time it was
received by the transport.

For example, this applies to most e-mail transports. Typically an e-mail message is
sent by a user to a mail system where it waits to be downloaded by a client transport
running on a Newton device. The time the item was originally sent always differs
from the time the item is eventually received by the Newton transport.

In this case, your transport will need to set the

item.timeStamp

slot to the time

the original mail was sent. You must decode this information however it is stored in
the mail message and set it in the

item.timeStamp

slot before you call the

ItemCompleted

method. The

timeStamp

slot must contain the time in the

same format as returned by the

Time

function; that is, the number of minutes since

midnight, January 1, 1904.

If your transport sets the

timeStamp

slot, the In/Out Box does not override it.