[Oberon] Re (2): Export of Oberon Mail.SendCmd().

Joerg joerg.straube at iaeth.ch
Thu Jun 15 17:21:29 CEST 2023


I had a look at Oberon.Base64.Mod.
Is it that module you want to use?
If yes, the only procedure it offers is Base64.EncodeFile(F, T);
So, your input must be in file F and the base64 output is in text T.

If you want a string to be base64-encoded you have to go the extra mile to write it to a (temporary) file and read it back from a (temporary) text.

   F: Files.File; fR: Files.Rider;
  T: Texts.Text; tR: Texts.Reader;
  NEW(T); Texts.Open(T, ““);
  F := Files.New(““);
  Files.Set(fR, F, 0); Files.WriteString(fR, in);
  Base64.EncodeFile(F, T);
  i := 0; Texts.OpenReader(tR, T, 0);
    Texts.Read(tR, out[i]); INC(i)
  UNTIL Out.eot;
  out[i] := 0X
END Enc64;

Hopefully, it works. I did neither compile nor test it. To make it more robust, checks on NIL and LEN(out) should be added…


> Am 15.06.2023 um 15:41 schrieb peter at easthope.ca:
> From:    Joerg <joerg.straube at iaeth.ch>
> Date:    Thu, 15 Jun 2023 08:56:14 +0300
>> Generally, re-using code instead of copying is a good approach.
>> If you do so, then the whole code of Mail is imported in News.
> Currently working in the Oberon subsystem of A2 where News imports 
> Mail. I don't have an ETH Oberon system at hand but will speculate 
> that Mail was written before News and that News imported Mail from 
> the beginning or early in development.
>> What about this: try to separate all common code in an own module (e.g 
>> call it Communication.Mod or MsgBase.Mod or Utilities.Mod or so) and 
>> import this new module in Mail and in News.
> Good.  Keeping in mind for possible future work.  For now I'm happy to 
> have succeeded to add authentication to SMTP and NNTP.  For me, Oberon 
> Mail and News are good alternatives to mutt, Thunderbird, pan & etc. 
> in Linux. I also want to make the current revisions available in A2.  
> What's useful to me may benefit others.
> Thanks for the help,                ... P. 
> Footnote
> Still need to understand Streams well enough to automate base64 
> encoding for submission of the user and password for SMTP.
> - 
> mobile: +1 778 951 5147
> VoIP:   +1 604 670 0140
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon

More information about the Oberon mailing list