Skip to content
Snippets Groups Projects
Commit b65016a0 authored by echicken's avatar echicken
Browse files

Clean up temp file after download.

Allow upload of avatar, use avatar_lib import method after file received.
parent 8bed1241
No related branches found
No related tags found
No related merge requests found
......@@ -109,12 +109,21 @@ function download_avatar() {
};
sauce_lib.write(fn, sauce);
bbs.send_file(fn);
file_remove(fn);
return true;
} else {
return false;
}
}
function upload_avatar() {
const fn = system.temp_dir + format('avatar-%04d.bin', user.number);
bbs.receive_file(fn);
const success = avatar_lib.import_file(user.number, fn, 0);
file_remove(fn);
return success;
}
function CollectionBrowser(filename, parent_frame) {
const frames = {
......@@ -473,7 +482,15 @@ function MainMenu(parent_frame) {
);
state.tree.addItem(
'Upload an avatar', function () {
// placeholder
console.clear(WHITE);
console.putmsg('Comments go here');
if (upload_avatar()) {
console.putmsg('Your avatar has been updated.');
} else {
console.putmsg('An error was encountered. Your avatar has nto been updated.');
}
console.clear(LIGHTGRAY);
frames.parent.invalidate();
}
);
state.tree.addItem(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment