New MCI codes & user status flags support additions

* New MCI and WFC properties for user new private and "addressed to" mail
* Additional support for user status flags in connection lists, etc.
This commit is contained in:
Bryan Ashby
2022-05-11 20:30:25 -06:00
parent 6502f3b55e
commit 868e14aa8e
16 changed files with 135 additions and 18 deletions

View File

@@ -40,6 +40,7 @@ exports.filterMessageListByReadACS = filterMessageListByReadACS;
exports.tempChangeMessageConfAndArea = tempChangeMessageConfAndArea;
exports.getMessageListForArea = getMessageListForArea;
exports.getNewMessageCountInAreaForUser = getNewMessageCountInAreaForUser;
exports.getNewMessageCountAddressedToUser = getNewMessageCountAddressedToUser;
exports.getNewMessagesInAreaForUser = getNewMessagesInAreaForUser;
exports.getMessageIdNewerThanTimestampByArea = getMessageIdNewerThanTimestampByArea;
exports.getMessageAreaLastReadId = getMessageAreaLastReadId;
@@ -489,6 +490,26 @@ function getNewMessageCountInAreaForUser(userId, areaTag, cb) {
});
}
// New message count -- for all areas available to the user
// that are addressed to that user (ie: matching username)
// Does NOT Include private messages.
function getNewMessageCountAddressedToUser(client, cb) {
const areaTags = getAllAvailableMessageAreaTags(client).filter(areaTag => areaTag !== Message.WellKnownAreaTags.Private);
let newMessageCount = 0;
async.forEach(areaTags, (areaTag, nextAreaTag) => {
getMessageAreaLastReadId(client.user.userId, areaTag, (_, lastMessageId) => {
lastMessageId = lastMessageId || 0;
getNewMessageCountInAreaForUser(client.user.userId, areaTag, (err, count) => {
newMessageCount += count;
return nextAreaTag(err);
});
});
}, () => {
return cb(null, newMessageCount);
});
}
function getNewMessagesInAreaForUser(userId, areaTag, cb) {
getMessageAreaLastReadId(userId, areaTag, (err, lastMessageId) => {
lastMessageId = lastMessageId || 0;
@@ -509,6 +530,7 @@ function getNewMessagesInAreaForUser(userId, areaTag, cb) {
});
}
function getMessageListForArea(client, areaTag, filter, cb)
{
if(!cb && _.isFunction(filter)) {