Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
d3d3960f
Commit
d3d3960f
authored
9 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Fix 'er up.
Now appears to work.
parent
a6d0b93c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/hatchit.js
+243
-2
243 additions, 2 deletions
exec/hatchit.js
with
243 additions
and
2 deletions
exec/hatchit.js
+
243
−
2
View file @
d3d3960f
...
...
@@ -33,7 +33,7 @@ function pick_file()
files
=
filedir
.
map
(
function
(
v
){
return
format
(
"
%-12s - %s
"
,
v
.
name
,
v
.
desc
);});
file
=
uifc
.
list
(
WIN_SAV
|
WIN_ACT
|
WIN_RHT
,
"
Select File
"
,
files
,
fctx
[
dir
]);
if
(
file
>=
0
)
return
file
s
[
file
];
return
file
dir
[
file
];
return
undefined
;
}
...
...
@@ -71,9 +71,250 @@ function pick_file()
return
undefined
;
}
function
pick_area
()
{
areas
=
Object
.
keys
(
tickit
.
acfg
).
sort
();
areas
=
areas
.
map
(
function
(
v
){
return
v
.
toUpperCase
();});
area
=
uifc
.
list
(
WIN_ORG
|
WIN_SAV
|
WIN_BOT
|
WIN_MID
,
"
Select Area
"
,
areas
);
if
(
area
>=
0
)
return
areas
[
area
];
return
undefined
;
}
function
pick_origin
()
{
var
addr
=
uifc
.
list
(
WIN_ORG
|
WIN_SAV
|
WIN_BOT
|
WIN_MID
,
"
Select Origin
"
,
system
.
fido_addr_list
);
if
(
addr
>=
0
)
return
system
.
fido_addr_list
[
addr
];
return
undefined
;
}
function
add_links
(
seenbys
,
links
,
list
)
{
var
l
;
var
i
;
l
=
list
.
split
(
/,/
);
for
(
i
=
0
;
i
<
l
.
length
;
i
++
)
{
if
(
seenbys
[
l
[
i
]]
!==
undefined
)
{
log
(
LOG_DEBUG
,
"
Node
"
+
l
[
i
]
+
"
has already seen this.
"
);
continue
;
}
links
[
l
[
i
]]
=
''
;
}
}
function
file_crc
(
fname
)
{
var
f
=
new
File
(
fname
);
var
crc
;
if
(
!
f
.
open
(
"
rb
"
))
{
uifc
.
msg
(
"
Unable to open file '
"
+
f
.
name
+
"
'.
"
);
log
(
LOG_WARNING
,
"
Unable to open file '
"
+
f
.
name
+
"
'.
"
);
return
false
;
}
crc32
=
crc32_calc
(
f
.
read
());
f
.
close
();
return
crc32
;
}
function
parse_addr
(
addr
)
{
var
m
;
var
ret
=
{};
m
=
addr
.
match
(
/^
([
0-9
]
+
)
:/
);
if
(
m
!==
null
)
ret
.
zone
=
parseInt
(
m
[
1
],
10
);
m
=
addr
.
match
(
/
([
0-9
]
+
)\/
/
);
if
(
m
!==
null
)
ret
.
net
=
parseInt
(
m
[
1
],
10
);
m
=
addr
.
match
(
/
\/([
0-9
]
+
)
/
);
if
(
m
!==
null
)
ret
.
node
=
parseInt
(
m
[
1
],
10
);
m
=
addr
.
match
(
/
\.([
0-9
]
+
)
/
);
if
(
m
!==
null
)
ret
.
point
=
parseInt
(
m
[
1
],
10
);
m
=
addr
.
match
(
/@.+$/
);
if
(
m
!==
null
)
ret
.
domain
=
m
[
1
];
return
ret
;
}
function
get_zone
(
addr
)
{
var
m
;
// Figure out the default zone.
m
=
addr
.
match
(
/^
([
0-9
]
+
)
:/
);
if
(
m
===
null
)
return
undefined
;
return
parseInt
(
m
[
1
],
10
);
}
function
hatch_file
(
file
,
area
,
origin
)
{
var
seenbys
=
{};
var
links
=
{};
var
cfg
;
var
link
;
var
tf
;
var
ff
;
var
bf
;
var
defzone
;
var
addr
;
var
outb
;
var
flobase
;
var
pw
;
var
i
;
var
tic
=
{
path
:[],
seenby
:[]};
var
lfile
;
var
ldesc
;
defzone
=
get_zone
(
system
.
fido_addr_list
[
0
]);
if
(
defzone
===
undefined
)
{
log
(
LOG_ERROR
,
"
Unable to detect default zone!
"
);
return
false
;
}
// Add us to the path...
tic
.
path
.
push
(
system
.
fido_addr_list
[
0
]);
// Add all our addresses...
system
.
fido_addr_list
.
forEach
(
function
(
addr
)
{
seenbys
[
addr
]
=
''
;
});
// Calculate links
if
(
tickit
.
gcfg
.
links
!==
undefined
)
add_links
(
seenbys
,
links
,
tickit
.
gcfg
.
links
);
cfg
=
tickit
.
acfg
[
area
.
toLowerCase
()];
if
(
cfg
!==
undefined
&&
cfg
.
links
!==
undefined
)
add_links
(
seenbys
,
links
,
cfg
.
links
);
// Add links to seenbys
for
(
i
in
links
)
tic
.
seenby
.
push
(
i
);
// Now, start generating the TIC/FLO files...
for
(
link
in
links
)
{
if
(
!
sbbsecho
.
is_flo
)
{
log
(
LOG_ERROR
,
"
TickIT doesn't support non-FLO mailers.
"
);
return
false
;
}
pw
=
sbbsecho
.
get_pw
(
link
);
if
(
pw
===
undefined
)
pw
=
''
;
// Figure out the outbound dir...
addr
=
parse_addr
(
link
);
if
(
addr
.
zone
===
undefined
)
addr
.
zone
=
defzone
;
if
(
addr
.
zone
===
undefined
||
addr
.
net
===
undefined
||
addr
.
node
===
undefined
)
{
log
(
LOG_ERROR
,
"
Address '
"
+
link
+
"
' is invalid!
"
);
continue
;
}
outb
=
sbbsecho
.
outbound
.
replace
(
/
[\\\/]
+$/g
,
''
);
if
(
addr
.
zone
!==
defzone
)
outb
+=
format
(
"
.%03x
"
,
addr
.
zone
);
outb
=
fullpath
(
outb
);
outb
=
backslash
(
outb
);
// Create TIC file first...
tf
=
new
File
(
outb
+
tickit
.
get_next_tic_filename
());
if
(
!
tf
.
open
(
"
wb
"
))
{
log
(
LOG_ERROR
,
"
Unable to create TIC file for
"
+
link
+
"
. He will not get file '
"
+
file
.
name
+
"
'!
"
);
continue
;
}
tf
.
write
(
'
Area
'
+
area
+
'
\r\n
'
);
tf
.
write
(
'
Origin
'
+
origin
+
'
\r\n
'
);
tf
.
write
(
'
From
'
+
system
.
fido_addr_list
[
0
]
+
'
\r\n
'
);
tf
.
write
(
'
To
'
+
link
+
'
\r\n
'
);
tf
.
write
(
'
File
'
+
file
.
name
+
'
\r\n
'
);
if
(
file_getcase
(
file
.
path
).
length
>
file
.
path
.
length
)
{
lfile
=
file_getcase
(
file
.
path
);
lfile
.
replace
(
/^.*
\\\/([^\\\/]
+
)
$/
,
'
$1
'
);
tf
.
write
(
'
Lfile
'
+
lfile
+
'
\r\n
'
);
}
tf
.
write
(
'
Size
'
+
file_size
(
file
.
path
)
+
'
\r\n
'
);
tf
.
write
(
'
Date
'
+
file_date
(
file
.
path
)
+
'
\r\n
'
);
tf
.
write
(
'
Desc
'
+
file
.
desc
+
'
\r\n
'
);
if
(
file
.
extdesc
!==
undefined
)
{
ldesc
=
file
.
extdesc
.
split
(
/
\r?\n
/
);
ldesc
.
forEach
(
function
(
line
)
{
tf
.
write
(
'
Ldesc
'
+
line
+
'
\r\n
'
);
});
}
tf
.
write
(
'
Created by TickIT
'
+
"
$Revision$
"
.
split
(
'
'
)[
1
]
+
'
\r\n
'
);
tf
.
write
(
'
Crc
'
+
file_crc
(
file
.
path
)
+
'
\r\n
'
);
for
(
i
=
0
;
i
<
tic
.
path
.
length
;
i
++
)
tf
.
write
(
'
Path
'
+
tic
.
path
[
i
]
+
'
\r\n
'
);
for
(
i
=
0
;
i
<
tic
.
seenby
.
length
;
i
++
)
tf
.
write
(
'
Seenby
'
+
tic
.
seenby
[
i
]
+
'
\r\n
'
);
tf
.
write
(
'
Pw
'
+
pw
+
'
\r\n
'
);
tf
.
close
();
// Create bsy file...
flobase
=
outb
+
format
(
"
%04x%04x
"
,
addr
.
net
,
addr
.
node
);
bf
=
new
File
(
flobase
+
'
.bsy
'
);
while
(
!
bf
.
open
(
'
web+
'
))
{
// TODO: This waits forever...
log
(
LOG_WARNING
,
"
Waiting for BSY file '
"
+
bf
.
name
+
"
'...
"
);
mswait
(
1000
);
}
// Append to FLO file...
ff
=
new
File
(
flobase
+
'
.flo
'
);
if
(
!
ff
.
open
(
'
ab+
'
))
{
log
(
LOG_ERROR
,
"
Unable to append to '
"
+
ff
.
name
+
"
' for
"
+
link
+
"
. He will not get file '
"
+
file
.
name
+
"
'!
"
);
bf
.
close
();
bf
.
remove
();
continue
;
}
ff
.
writeln
(
file
.
path
);
ff
.
writeln
(
'
^
'
+
tf
.
name
);
ff
.
close
();
bf
.
close
();
bf
.
remove
();
}
return
true
;
}
function
main
()
{
var
file
;
var
area
;
var
origin
;
uifc
.
init
(
'
HatchIT
'
);
log
(
"
Hatching file:
"
+
pick_file
());
file
=
pick_file
();
if
(
file
===
undefined
||
file
.
path
===
undefined
)
return
;
area
=
pick_area
();
if
(
area
===
undefined
)
return
;
origin
=
pick_origin
();
if
(
origin
===
undefined
)
return
;
var
msg
=
'
Hatch file
'
+
file
.
name
+
'
into
'
+
area
+
'
from
'
+
origin
+
'
\r\n\r\n
'
+
'
Desc:
'
+
file
.
desc
+
'
\r\n\r\n
'
+
'
Long Desc:
\r\n
'
+
file
.
extdesc
;
if
(
uifc
.
showhelp
!==
undefined
)
{
uifc
.
help_text
=
msg
;
uifc
.
showhelp
();
}
if
(
uifc
.
list
(
WIN_MID
,
"
Proceed?
"
,
[
"
No
"
,
"
Yes
"
])
==
1
)
{
hatch_file
(
file
,
area
,
origin
);
}
uifc
.
bail
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment