Commit b7522c38 authored by Rob Swindell's avatar Rob Swindell

Support BBSID-based network-user avatar lookups and via MD5 digest

SBBSecho v3.12 exports the originating system's BBSID via a new
"BBSID" kludge and this allows avatar lookups (e.g. of FTN-posted
messages) using this solution.

Also, support MD5-obscured name (i.e. real name) avatar lookups.
parent 5f088ad2
......@@ -192,7 +192,7 @@ function read_netuser(username, netaddr)
return obj;
}
function read(usernum, username, netaddr)
function read(usernum, username, netaddr, bbsid)
{
var usernum = parseInt(usernum, 10);
var obj = cache_get(usernum >= 1 ? usernum : username, netaddr);
......@@ -202,8 +202,17 @@ function read(usernum, username, netaddr)
obj = read_localuser(usernum);
else if(!netaddr)
obj = read_localuser(system.matchuser(username));
else
else {
obj = read_netuser(username, netaddr);
if(!obj && bbsid)
obj = read_netuser(username, bbsid);
if(!obj) {
var namehash = "md5:" + md5_calc(username);
obj = read_netuser(namehash, netaddr);
if(!obj && bbsid)
obj = read_netuser(namehash, bbsid);
}
}
cache_set(usernum >= 1 ? usernum : username, obj, netaddr);
return obj;
}
......@@ -262,7 +271,7 @@ function is_enabled(obj)
// Uses Graphic.draw() at an absolute screen coordinate
function draw(usernum, username, netaddr, above, right, top)
{
var avatar = this.read(usernum, username, netaddr);
var avatar = this.read(usernum, username, netaddr, usernum);
if(!is_enabled(avatar))
return false;
return draw_bin(avatar.data, above, right, top);
......@@ -297,7 +306,7 @@ function draw_bin(data, above, right, top)
// Uses console.write() where-ever the cursor happens to be
function show(usernum, username, netaddr)
{
var avatar = this.read(usernum, username, netaddr);
var avatar = this.read(usernum, username, netaddr, usernum);
if(!is_enabled(avatar))
return false;
return show_bin(avatar.data);
......
......@@ -50,7 +50,8 @@ if(!(bbs.msg_attr&bbs.mods.smbdefs.MSG_ANONYMOUS)) {
if(!bbs.mods.avatar_lib)
bbs.mods.avatar_lib = load({}, 'avatar_lib.js');
var options = get_options();
var success = bbs.mods.avatar_lib.draw(bbs.msg_from_ext, bbs.msg_from, bbs.msg_from_net
var success = bbs.mods.avatar_lib.draw(bbs.msg_from_ext || bbs.msg_from_bbsid
,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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment