mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-04 19:57:20 +02:00
* MailPacket class: read() and write() with event emits
* FTNMailPacket WIP derived from MailPacket
This commit is contained in:
parent
7fa27e46a5
commit
aebf494ae7
5 changed files with 189 additions and 15 deletions
|
@ -12,10 +12,11 @@ var util = require('util');
|
|||
|
||||
exports.stringFromFTN = stringFromFTN;
|
||||
exports.getFormattedFTNAddress = getFormattedFTNAddress;
|
||||
exports.getDateFromFtnDateTime = getDateFromFtnDateTime;
|
||||
|
||||
// See list here: https://github.com/Mithgol/node-fidonet-jam
|
||||
|
||||
|
||||
// :TODO: proably move this elsewhere as a general method
|
||||
function stringFromFTN(buf, encoding) {
|
||||
var nullPos = buf.length;
|
||||
for(var i = 0; i < buf.length; ++i) {
|
||||
|
@ -28,6 +29,20 @@ function stringFromFTN(buf, encoding) {
|
|||
return buf.slice(0, nullPos).toString(encoding || 'utf-8');
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Convert a FTN style DateTime string to a Date object
|
||||
//
|
||||
function getDateFromFtnDateTime(dateTime) {
|
||||
//
|
||||
// Examples seen in the wild (Working):
|
||||
// "12 Sep 88 18:17:59"
|
||||
// "Tue 01 Jan 80 00:00"
|
||||
// "27 Feb 15 00:00:03"
|
||||
//
|
||||
return (new Date(Date.parse(dateTime))).toISOString();
|
||||
}
|
||||
|
||||
function getFormattedFTNAddress3D(zone, net, node) {
|
||||
return util.format('%d:%d/%d', zone, net, node);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue