Skip to content
Snippets Groups Projects
Commit fee59b1d authored by rswindell's avatar rswindell
Browse files

Add support for a "default sub-board" avatar (sub_default) in the [avatars]

section of modopts.ini (the value is base64-encoded avatar data). If
the <sub_code>_default or <group_name>_default keys exist, those defaults will
be used as appropriate (both <sub_code> and <group_name> are lower-case).
The avatar options ([avatars] section) of modopts.ini is cached (in bbs.mods)
for performance reasons, so changes require a log-off/on to see.
parent bc8621fe
No related branches found
No related tags found
No related merge requests found
......@@ -13,11 +13,32 @@
require("smbdefs.js", 'MSG_ANONYMOUS');
require("userdefs.js", 'USER_ANSI');
function draw_default_avatar(sub)
{
var options = bbs.mods.avatars_options;
if(!options) {
options = load({}, "modopts.js", "avatars");
if(!options)
options = { cached: true };
bbs.mods.avatars_options = options; // cache the options
}
var avatar = options[sub + "_default"];
if(!avatar)
avatar = options[msg_area.sub[sub].grp_name.toLowerCase() + "_default"];
if(!avatar)
avatar = options.sub_default;
if(avatar)
Avatar.draw_bin(avatar, /* above: */true, /* right-justified: */true, bbs.msghdr_top_of_screen);
}
// Avatar support here:
if(!(bbs.msg_attr&MSG_ANONYMOUS)
&& (console.term_supports()&(USER_ANSI|USER_NO_EXASCII)) == USER_ANSI) {
var Avatar = load({}, 'avatar_lib.js');
Avatar.draw(bbs.msg_from_ext, bbs.msg_from, bbs.msg_from_net, /* above: */true, /* right-justified: */true
var success = Avatar.draw(bbs.msg_from_ext, bbs.msg_from, bbs.msg_from_net, /* above: */true, /* right-justified: */true
,bbs.msghdr_top_of_screen);
if(!success) {
draw_default_avatar(bbs.smb_sub_code);
}
console.attributes = 7; // Clear the background attribute as the next line might scroll, filling with BG attribute
}
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