mail: resolve list members

This commit is contained in:
Girish Ramakrishnan
2019-11-06 16:45:44 -08:00
parent 1942a7ecf4
commit 58d66b5293
4 changed files with 71 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ exports = module.exports = {
listMailboxes: listMailboxes,
getLists: getLists,
get: get,
getMailbox: getMailbox,
getList: getList,
getAlias: getAlias,
@@ -169,6 +170,20 @@ function updateName(oldName, oldDomain, newName, newDomain, callback) {
});
}
function get(name, domain, callback) {
assert.strictEqual(typeof name, 'string');
assert.strictEqual(typeof domain, 'string');
assert.strictEqual(typeof callback, 'function');
database.query('SELECT ' + MAILBOX_FIELDS + ' FROM mailboxes WHERE name = ? AND domain = ?',
[ name, domain ], function (error, results) {
if (error) return callback(new BoxError(BoxError.DATABASE_ERROR, error));
if (results.length === 0) return callback(new BoxError(BoxError.NOT_FOUND, 'Mailbox not found'));
callback(null, postProcess(results[0]));
});
}
function getMailbox(name, domain, callback) {
assert.strictEqual(typeof name, 'string');
assert.strictEqual(typeof domain, 'string');