...
 
Commits (1)
  • Rob Swindell's avatar
    Allow configurable placement of avatar in message headers · 7260c60c
    Rob Swindell authored
    Set the following in the modopts.ini [avatars] section:
    msghdr_draw_top (default is true)
    msghdr_draw_above (default is true)
    msghdr_draw_right (default is true)
    
    Set any of these to false to override the default behavior -
    for DesotoFireflite (VALHALLA).
    
    This commit also includes a couple of changes I've been apparently
    sitting on:
    - display avatars even for non-ANSI/non-CP437 terminal users
    - cache the smbdefs.js in bbs.mods.smbdefs (I don't recall why)
    7260c60c
......@@ -10,34 +10,49 @@
// If you do not want the avatar right-justified, copy this file to your
// mods directory and change that parameter below.
require("smbdefs.js", 'MSG_ANONYMOUS');
require("userdefs.js", 'USER_ANSI');
if(!bbs.mods.smbdefs)
load(bbs.mods.smbdefs = {}, "smbdefs.js");
function draw_default_avatar(sub)
function get_options()
{
var options = bbs.mods.avatars_options;
if(!options) {
options = load({}, "modopts.js", "avatars");
if(!options)
options = { cached: true };
if(options.msghdr_draw_top === undefined)
options.msghdr_draw_top = true;
if(options.msghdr_draw_above === undefined)
options.msghdr_draw_above = true;
if(options.msghdr_draw_right === undefined)
options.msghdr_draw_right = true;
bbs.mods.avatars_options = options; // cache the options
}
return options;
}
function draw_default_avatar(sub)
{
var options = get_options();
var avatar = options[sub + "_default"];
if(!avatar)
avatar = options[msg_area.sub[sub].grp_name.toLowerCase() + "_default"];
if(!avatar)
avatar = options.msg_default;
if(avatar)
bbs.mods.avatar_lib.draw_bin(avatar, /* above: */true, /* right-justified: */true, bbs.msghdr_top_of_screen);
bbs.mods.avatar_lib.draw_bin(avatar
,options.msghdr_draw_above, options.msghdr_draw_right
,options.msghdr_draw_top && bbs.msghdr_top_of_screen);
}
// Avatar support here:
if(!(bbs.msg_attr&MSG_ANONYMOUS)
&& (console.term_supports()&(USER_ANSI|USER_NO_EXASCII)) == USER_ANSI) {
if(!(bbs.msg_attr&bbs.mods.smbdefs.MSG_ANONYMOUS)) {
if(!bbs.mods.avatar_lib)
bbs.mods.avatar_lib = load({}, 'avatar_lib.js');
var success = bbs.mods.avatar_lib.draw(bbs.msg_from_ext, bbs.msg_from, bbs.msg_from_net, /* above: */true, /* right-justified: */true
,bbs.msghdr_top_of_screen);
var options = get_options();
var success = bbs.mods.avatar_lib.draw(bbs.msg_from_ext, bbs.msg_from, bbs.msg_from_net
,options.msghdr_draw_above, options.msghdr_draw_right
,options.msghdr_draw_top && bbs.msghdr_top_of_screen);
if(!success && bbs.smb_sub_code) {
draw_default_avatar(bbs.smb_sub_code);
}
......