[Oberon] Re (2): Copy a text buffer to a string?

joerg.straube at iaeth.ch joerg.straube at iaeth.ch
Sat May 13 00:19:24 CEST 2023


Peter

Here my proposal to include the date field in the mail header:

PROCEDURE RFC5322Date(VAR s: ARRAY OF CHAR);
VAR
x, t, d: LONGINT;
m: ARRAY 40 OF CHAR;
BEGIN
                m := “JanFebMarAprMayJunJulAugSepOctNovDec“;
s := “DD MMM 20YY hh:mm:ss +0200”;
                Oberon.GetClock(t, d);
                x := d MOD 32;                        s[0] := CHR(x DIV 10+ORD(“0”);   s[1] := CHR(x MOD 10+ORD(“0”));
                x := (d DIV 32 MOD 16-1)*3; s[3] := m[x]; s[4] := m[x+1]; s[5] := m[x+2];
                x := d DIV 512 MOD 100;       s[9] := CHR(x DIV 10+ORD(“0”); s[10] := CHR(x MOD 10+ORD(“0”));
                x := t DIV 4096 MOD 32;      s[12] := CHR(x DIV 10+ORD(“0”); s[13] := CHR(x MOD 10+ORD(“0”));
                x := t DIV 64 MOD 64;           s[15] := CHR(x DIV 10+ORD(“0”); s[16] := CHR(x MOD 10+ORD(“0”));
                x := t MOD 64;                        s[18] := CHR(x DIV 10+ORD(“0”); s[19] := CHR(x MOD 10+ORD(“0”));
END RFC5322Date;

PROCEDURE SendText*(S: SMTPSession; head, body: Texts.Text; beg, end: LONGINT; cont: MIME.Content);
VAR
enc: LONGINT;
                               ascii: Texts.Text;
                               dateTime: ARRAY 30 OF CHAR;
                BEGIN
                               enc := cont.encoding; cont.len := MAX(LONGINT);
                               SendCmd(S,"From: ", S.from);
                               RFC5322Date(dateTime);
                               SendCmd(S, “Date:”, dateTime);
SendCmd(S, "X-Mailer:", mailer);
…
END SendText;


Jörg

Von: Oberon <oberon-bounces at lists.inf.ethz.ch> im Auftrag von peter at easthope.ca <peter at easthope.ca>
Datum: Freitag, 12. Mai 2023 um 15:40
An: oberon at lists.inf.ethz.ch <oberon at lists.inf.ethz.ch>
Betreff: [Oberon] Re (2): Copy a text buffer to a string?
From:   Paul Reed <paulreed at paddedcell.com>
Date:   Fri, 12 May 2023 10:18:23 +0100
> ... note the writer W seems to be in Oberon.Mail.Mod ostensibly for
> logging, so it would be an abuse of that variable.

Thanks for mentioning that.  To continue with Text, I should declare
another Writer.

With SendCmd requiring an ARRAY OF CHAR and none of the existing code
particularly relevant to the required objective, I decided to avoid
Text and stick with characters.  Will post the revision soon.

Thanks for the feedback,           ... P.L.

-
mobile: +1 778 951 5147
VoIP: +1 604 670 0140
sip:461697 at sip.diamondcard.us
https://en.wikibooks.org/wiki/User:PeterEasthope

--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20230512/c10a834a/attachment.html>


More information about the Oberon mailing list