background image
C H A P T E R 2 2
Transport Interface
Using the Transport Interface
e-mail address to the sender's internet address. Here's an example of code that sets
the appropriate e-mail address in the
if owner and GetRoot().cardfile then begin
addrs := GetRoot().cardfile:BcEmailAddress(owner,
if addrs then
fromRef := clone(addrs[0]);
You can find a description of
and other similar functions that
extract information from Names soup entries in "Names Functions and Methods"
(page 16-5) in Newton Programmer's Reference.
If, instead of extracting the address and sending it as a string, your transport sends
addressing information as a frame, like the beam transport, you must remove any
soup entry aliases from the name reference before it is transmitted. You can do
this by using the name reference data definition method
as follows:
// strip the aliases from a name ref
fromRef := datadef:PrepareForRouting(fromRef);
In general, however, you should not send all the information in a user's persona
with a message, since it can include personal or confidential information such as
credit card numbers.
For more information about name references and the methods of name reference
data definitions, see the section "Creating a Name Reference" beginning on
page 21-27, and "Name References" (page 5-1) in Newton Programmer's
The following is an example of how to override the
method during a
send operation to add a
// a sample overridden NewItem method
mytransport.NewItem := func(context) begin
// first call inherited method to get default frame
local item := inherited:NewItem(context);
// get sender info and insert fromRef slot
local persona:= GetUserConfig('currentPersona);
local dataDef := GetDataDefs(addressingClass);
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна