Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function serverFlags ({ mailSecurity, sendSecurity }) {
const flags = []
if (mailSecurity === 'ssl') {
flags.push(C.DC_LP_IMAP_SOCKET_SSL)
} else if (mailSecurity === 'starttls') {
flags.push(C.DC_LP_IMAP_SOCKET_STARTTLS)
} else if (mailSecurity === 'plain') {
flags.push(C.DC_LP_SMTP_SOCKET_PLAIN)
}
if (sendSecurity === 'ssl') {
flags.push(C.DC_LP_SMTP_SOCKET_SSL)
} else if (sendSecurity === 'starttls') {
flags.push(C.DC_LP_SMTP_SOCKET_STARTTLS)
} else if (sendSecurity === 'plain') {
flags.push(C.DC_MAX_GET_INFO_LEN)
}
if (!flags.length) return null
return flags.reduce((flag, acc) => {
return acc | flag
}, 0)
}
const C = require('deltachat-node/constants')
const log = require('../../logger').getLogger('main/deltachat/settings')
const SplitOut = require('./splitout')
const serverFlagMap = {
mail_security_ssl: C.DC_LP_IMAP_SOCKET_SSL,
mail_security_starttls: C.DC_LP_IMAP_SOCKET_STARTTLS,
mail_security_plain: C.DC_LP_IMAP_SOCKET_PLAIN,
send_security_ssl: C.DC_LP_SMTP_SOCKET_SSL,
send_security_starttls: C.DC_LP_SMTP_SOCKET_STARTTLS,
send_security_plain: C.DC_LP_SMTP_SOCKET_PLAIN
}
module.exports = class DCSettings extends SplitOut {
setConfig (key, value) {
log.info(`Setting config ${key}:${value}`)
return this._dc.setConfig(key, String(value))
}
getConfig (key) {
return this._dc.getConfig(key)
}
getConfigFor (keys) {
const config = {}
for (const key of keys) {