Better MCI handling

This commit is contained in:
Bryan Ashby 2018-11-17 13:24:16 -07:00
parent 8702e309ae
commit ac0f54dc9b
2 changed files with 3 additions and 2 deletions

View File

@ -110,7 +110,8 @@ function renegadeToAnsi(s, client) {
result += s.substr(lastIndex, m.index - lastIndex) + attr; result += s.substr(lastIndex, m.index - lastIndex) + attr;
} else if(m[4] || m[1]) { } else if(m[4] || m[1]) {
// |AA MCI code or |Cx## movement where ## is in m[1] // |AA MCI code or |Cx## movement where ## is in m[1]
const val = getPredefinedMCIValue(client, m[4] || m[1], m[2]) || (m[0]); // value itself or literal let val = getPredefinedMCIValue(client, m[4] || m[1], m[2]);
val = _.isString(val) ? val : m[0]; // value itself or literal
result += s.substr(lastIndex, m.index - lastIndex) + val; result += s.substr(lastIndex, m.index - lastIndex) + val;
} else if(m[5]) { } else if(m[5]) {
// || -- literal '|', that is. // || -- literal '|', that is.

View File

@ -95,7 +95,7 @@ const PREDEFINED_MCI_GENERATORS = {
ST : function serverName(client) { return client.session.serverName; }, ST : function serverName(client) { return client.session.serverName; },
FN : function activeFileBaseFilterName(client) { FN : function activeFileBaseFilterName(client) {
const activeFilter = FileBaseFilters.getActiveFilter(client); const activeFilter = FileBaseFilters.getActiveFilter(client);
return activeFilter ? activeFilter.name : ''; return activeFilter ? activeFilter.name : '(Unknown)';
}, },
DN : function userNumDownloads(client) { return userStatAsString(client, 'dl_total_count', 0); }, // Obv/2 DN : function userNumDownloads(client) { return userStatAsString(client, 'dl_total_count', 0); }, // Obv/2
DK : function userByteDownload(client) { // Obv/2 uses DK=downloaded Kbytes DK : function userByteDownload(client) { // Obv/2 uses DK=downloaded Kbytes