pull latest changes from deltachat-node

This commit is contained in:
missytake
2022-05-05 15:52:10 +02:00
committed by Simon Laux
parent e9511ebfc3
commit b238c7e743
3 changed files with 60 additions and 13 deletions

View File

@@ -2,6 +2,34 @@
## [Unreleased][unreleased]
## [1.79.3] - 2022-05-03
### Fixed
- fix standalone context: configure promise would still not return (wrong account id)
## [1.79.2] - 2022-05-02
### Fixed
- fix standalone context: configure promise would not return, ALL event did not contain event name
## [1.79.1] - 2022-05-02
### Fixed
- don't ignore core sourcefiles, prevented npm installation on architectures with no prebuild
## [1.79.0] - 2022-05-02
### Changed
- Upgrade to deltachat-core version `1.79.0`
## [1.78.0] - 2022-05-02
### Changed
- Upgrade to deltachat-core version `1.78.0`
### Fixed
- fix standalone (without account manager) context events (remove accountid, and add `ALL` event)
## [1.77.1] - 2022-04-26
### BREAKING: we now use node 16
@@ -13,7 +41,7 @@ Please update if you use an older version! ([`nvm`](https://github.com/nvm-sh/nv
- move `Context.getSystemInfo()` to `AccountManager.getSystemInfo()`
### Fixed
- fix that context was not usable standalone without account managrer anymore.
- fix that context was not usable standalone without account manager anymore.
## [1.77.0] - 2022-04-14
@@ -1432,9 +1460,19 @@ const { C } = require('deltachat-node')
- Remove `dc_msg_has_deviating_timestamp` prototype [**@link2xt**](https://github.com/link2xt)
[unreleased]: https://github.com/deltachat/deltachat-node/compare/v1.77.1...HEAD
[unreleased]: https://github.com/deltachat/deltachat-node/compare/v1.79.3...HEAD
[1.77.1]: https://github.com/deltachat/deltachat-node/compare/v1.76.0...v1.77.1
[1.79.3]: https://github.com/deltachat/deltachat-node/compare/v1.79.2...v1.79.3
[1.79.2]: https://github.com/deltachat/deltachat-node/compare/v1.79.1...v1.79.2
[1.79.1]: https://github.com/deltachat/deltachat-node/compare/v1.79.0...v1.79.1
[1.79.0]: https://github.com/deltachat/deltachat-node/compare/v1.78.0...v1.79.0
[1.78.0]: https://github.com/deltachat/deltachat-node/compare/v1.77.1...v1.78.0
[1.77.1]: https://github.com/deltachat/deltachat-node/compare/v1.77.0...v1.77.1
[1.77.0]: https://github.com/deltachat/deltachat-node/compare/v1.76.0...v1.77.0

View File

@@ -27,7 +27,7 @@ export class Context extends EventEmitter {
constructor(
readonly manager: AccountManager | null,
private inner_dcn_context: NativeContext,
readonly account_id: number
readonly account_id: number | null
) {
super()
debug('DeltaChat constructor')
@@ -37,7 +37,7 @@ export class Context extends EventEmitter {
* automatically starts the event handler */
static open(cwd: string): Context {
const dbFile = join(cwd, 'db.sqlite')
const context = new Context(null, binding.dcn_context_new(dbFile), 42)
const context = new Context(null, binding.dcn_context_new(dbFile), null)
debug('Opened context')
function handleCoreEvent(
eventId: number,
@@ -48,10 +48,11 @@ export class Context extends EventEmitter {
debug(eventString, data1, data2)
if (!context.emit) {
console.log('Received an event but EventEmitter is already destroyed.')
console.log(eventString, 42, data1, data2)
console.log(eventString, data1, data2)
return
}
context.emit(eventString, 42, data1, data2)
context.emit(eventString, data1, data2)
context.emit('ALL', eventString, data1, data2)
}
binding.dcn_start_event_handler(
context.dcn_context,
@@ -170,12 +171,20 @@ export class Context extends EventEmitter {
reject(new Error(error))
}
const onConfigure = (accountId: number, data1: number, data2: string) => {
if (this.account_id !== accountId) {
return
let onConfigure: (...args: any[]) => void
if (this.account_id === null) {
onConfigure = (data1: number, data2: string) => {
if (data1 === 0) return onFail(data2)
else if (data1 === 1000) return onSuccess()
}
} else {
onConfigure = (accountId: number, data1: number, data2: string) => {
if (this.account_id !== accountId) {
return
}
if (data1 === 0) return onFail(data2)
else if (data1 === 1000) return onSuccess()
}
if (data1 === 0) return onFail(data2)
else if (data1 === 1000) return onSuccess()
}
const removeListeners = () => {

View File

@@ -1,6 +1,6 @@
{
"name": "deltachat-node",
"version": "1.77.1",
"version": "1.79.3",
"description": "node.js bindings for deltachat-core",
"main": "dist/index.js",
"types": "dist/index.d.ts",