Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
feat: update with more options
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphtheninja committed Jun 4, 2019
1 parent 4329aad commit 929d64d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -174,6 +174,11 @@ The `options` object takes the following properties:
- `options.selfavatar` _(string, optional)_: File containing avatar.
- `options.e2ee_enabled` _(boolean, optional)_: Enable E2EE. Defaults to `true`.
- `options.mdns_enabled` _(boolean, optional)_: Send and request read receipts. Defaults to `true`.
- `options.inbox_watch` _(boolean, optional)_: Watch `INBOX`-folder for changes. Defaults to `true`.
- `options.sentbox_watch` _(boolean, optional)_: Watch `Sent`-folder for changes. Defaults to `true`.
- `options.mvbox_watch` _(boolean, optional)_: Watch `DeltaChat`-folder for changes. Defaults to `true`.
- `options.mvbox_move` _(boolean, optional)_: Heuristically detect chat-messages and move them to the `DeltaChat`-folder. Defaults to `true`.
- `options.show_emails` _(integer, optional)_: `DC_SHOW_EMAILS_OFF` (0) show direct replies to chats only (default), `DC_SHOW_EMAILS_ACCEPTED_CONTACTS` (1) also show all mails of confirmed contacts, `DC_SHOW_EMAILS_ALL` (2) also show mails of unconfirmed contacts in the deaddrop.
- `options.save_mime_headers` _(boolean, optional)_: Set to `true` if you want to use <a href="#getmimeheaders">`dc.getMimeHeaders()`</a> later.

#### `dc.continueKeyTransfer(messageId, setupCode, callback)`
Expand Down
17 changes: 17 additions & 0 deletions lib/deltachat.js
Expand Up @@ -16,6 +16,11 @@ const pick = require('lodash.pick')
const debug = require('debug')('deltachat:node:index')

const noop = function () {}
const DC_SHOW_EMAILS = [
C.DC_SHOW_EMAILS_ACCEPTED_CONTACTS,
C.DC_SHOW_EMAILS_ALL,
C.DC_SHOW_EMAILS_OFF
]

/**
* Wrapper around dcn_context_t*
Expand Down Expand Up @@ -120,10 +125,22 @@ class DeltaChat extends EventEmitter {

this.setConfig('server_flags', String(opts.server_flags))
this.setConfig('displayname', opts.displayname)

this.setConfig('selfstatus', opts.selfstatus)
this.setConfig('selfavatar', opts.selfavatar)

this.setConfig('e2ee_enabled', String(opts.e2ee_enabled ? 1 : 0))
this.setConfig('mdns_enabled', String(opts.mdns_enabled ? 1 : 0))

this.setConfig('inbox_watch', String(opts.inbox_watch ? 1 : 0))
this.setConfig('sentbox_watch', String(opts.sentbox_watch ? 1 : 0))
this.setConfig('mvbox_watch', String(opts.mvbox_watch ? 1 : 0))
this.setConfig('mvbox_move', String(opts.mvbox_move ? 1 : 0))

if (DC_SHOW_EMAILS.includes(opts.show_emails)) {
this.setConfig('show_emails', String(opts.show_emails))
}

this.setConfig('save_mime_headers', String(opts.save_mime_headers ? 1 : 0))

binding.dcn_configure(this.dcn_context)
Expand Down

0 comments on commit 929d64d

Please sign in to comment.