From a4266cadc55b13df9fbdd79ed6670a4334b4ed1a Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Mon, 15 Jan 2018 03:41:02 +0000
Subject: [PATCH] Alternatively, a new-user default avatar may be imported (as
 needed) from a .bin file. Use the "avatar_file" key to specify a filename to
 pull from and (optionally) "avatar_offset" to specify the (0-based) record
 number of the avatar to use. If no "avatar_offset" value is specified, an
 avatar is choosen at random from the .bin file. If there is only one avatar
 in the file, then that's the one they'll get (regardless of avatar_offset
 value).

---
 exec/newuser.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/exec/newuser.js b/exec/newuser.js
index 77ace4d28d..2a166a77cf 100644
--- a/exec/newuser.js
+++ b/exec/newuser.js
@@ -18,9 +18,12 @@ if(options && (bbs.sys_status&SS_RLOGIN))
 if(options && options.qwk_settings)
 	user.qwk_settings = eval(options.qwk_settings);
 
-if(options && options.avatar) {
-	var avatar = load({}, 'avatar_lib.js');
-	avatar.update_localuser(user.number, options.avatar);
+if(options && (options.avatar || options.avatar_file)) {
+	var avatar_lib = load({}, 'avatar_lib.js');
+	if(options.avatar_file)
+		avatar_lib.import_file(user.number, options.avatar_file, options.avatar_offset);
+	else
+		avatar_lib.update_localuser(user.number, options.avatar);
 }	
 
 console.clear();
-- 
GitLab