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
8bed1241
Commit
8bed1241
authored
7 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Made the 'download your avatar' menu item actually do things.
parent
65e2c8bb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/avatar_chooser.js
+41
-6
41 additions, 6 deletions
exec/avatar_chooser.js
with
41 additions
and
6 deletions
exec/avatar_chooser.js
+
41
−
6
View file @
8bed1241
...
@@ -88,6 +88,33 @@ function bury_cursor() {
...
@@ -88,6 +88,33 @@ function bury_cursor() {
console
.
gotoxy
(
console
.
screen_columns
,
console
.
screen_rows
);
console
.
gotoxy
(
console
.
screen_columns
,
console
.
screen_rows
);
}
}
function
download_avatar
()
{
const
user_avatar
=
avatar_lib
.
read_localuser
(
user
.
number
);
if
(
user_avatar
)
{
const
fn
=
system
.
temp_dir
+
format
(
'
avatar-%04d.bin
'
,
user
.
number
);
var
f
=
new
File
(
fn
);
f
.
open
(
'
wb
'
);
f
.
write
(
base64_decode
(
user_avatar
.
data
));
f
.
close
();
const
sauce
=
{
title
:
user
.
alias
+
'
avatar
'
,
author
:
user
.
alias
,
group
:
system
.
name
,
datatype
:
sauce_lib
.
defs
.
datatype
.
bin
,
tinfo1
:
avatar_lib
.
defs
.
width
,
tinfo2
:
avatar_lib
.
defs
.
height
,
tinfo3
:
0
,
tinfo4
:
0
,
comment
:
[
''
]
};
sauce_lib
.
write
(
fn
,
sauce
);
bbs
.
send_file
(
fn
);
return
true
;
}
else
{
return
false
;
}
}
function
CollectionBrowser
(
filename
,
parent_frame
)
{
function
CollectionBrowser
(
filename
,
parent_frame
)
{
const
frames
=
{
const
frames
=
{
...
@@ -281,7 +308,7 @@ function CollectionLister(dir, parent_frame) {
...
@@ -281,7 +308,7 @@ function CollectionLister(dir, parent_frame) {
0
,
0
,
frames
.
container
frames
.
container
);
);
frames
.
info
=
new
Frame
(
frames
.
info
=
new
Frame
(
frames
.
tree
.
x
+
frames
.
tree
.
width
+
1
,
frames
.
tree
.
x
+
frames
.
tree
.
width
+
1
,
frames
.
container
.
y
+
2
,
frames
.
container
.
y
+
2
,
...
@@ -290,7 +317,7 @@ function CollectionLister(dir, parent_frame) {
...
@@ -290,7 +317,7 @@ function CollectionLister(dir, parent_frame) {
15
,
15
,
frames
.
container
frames
.
container
);
);
if
(
frames
.
parent
.
is_open
)
frames
.
container
.
open
();
if
(
frames
.
parent
.
is_open
)
frames
.
container
.
open
();
state
.
tree
=
new
Tree
(
frames
.
tree
,
'
Avatar collections
'
);
state
.
tree
=
new
Tree
(
frames
.
tree
,
'
Avatar collections
'
);
...
@@ -322,7 +349,7 @@ function CollectionLister(dir, parent_frame) {
...
@@ -322,7 +349,7 @@ function CollectionLister(dir, parent_frame) {
function
get_avatar
(
i
)
{
function
get_avatar
(
i
)
{
const
f
=
new
File
(
state
.
collection
);
const
f
=
new
File
(
state
.
collection
);
f
.
open
(
'
rb
'
);
f
.
open
(
'
rb
'
);
const
contents
=
f
.
read
();
const
contents
=
f
.
read
();
f
.
close
();
f
.
close
();
return
contents
.
substr
(
i
*
avatar_lib
.
size
,
avatar_lib
.
size
);
return
contents
.
substr
(
i
*
avatar_lib
.
size
,
avatar_lib
.
size
);
}
}
...
@@ -429,7 +456,7 @@ function MainMenu(parent_frame) {
...
@@ -429,7 +456,7 @@ function MainMenu(parent_frame) {
if
(
frames
.
parent
.
is_open
)
{
if
(
frames
.
parent
.
is_open
)
{
frames
.
tree
.
open
();
frames
.
tree
.
open
();
frames
.
user_avatar
.
open
();
frames
.
user_avatar
.
open
();
}
}
state
.
tree
=
new
Tree
(
frames
.
tree
,
'
Avatar collections
'
);
state
.
tree
=
new
Tree
(
frames
.
tree
,
'
Avatar collections
'
);
state
.
tree
.
colors
.
fg
=
WHITE
;
state
.
tree
.
colors
.
fg
=
WHITE
;
...
@@ -451,7 +478,15 @@ function MainMenu(parent_frame) {
...
@@ -451,7 +478,15 @@ function MainMenu(parent_frame) {
);
);
state
.
tree
.
addItem
(
state
.
tree
.
addItem
(
'
Download your avatar
'
,
function
()
{
'
Download your avatar
'
,
function
()
{
// placeholder
console
.
clear
(
WHITE
);
console
.
putmsg
(
'
Avatars are
'
+
avatar_lib
.
defs
.
width
+
'
x
'
+
avatar_lib
.
defs
.
height
+
'
characters in size, and are sent in binary format.
\r\n
'
);
download_avatar
();
console
.
clear
(
LIGHTGRAY
);
frames
.
parent
.
invalidate
();
}
}
);
);
state
.
tree
.
addItem
(
state
.
tree
.
addItem
(
...
@@ -534,4 +569,4 @@ function clean_up() {
...
@@ -534,4 +569,4 @@ function clean_up() {
init
();
init
();
main
();
main
();
clean_up
();
clean_up
();
\ No newline at end of file
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