From d5c9f4d88c8e47fff71ef16178053558fd92d375 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Fri, 14 Feb 2025 00:18:07 +1300 Subject: [PATCH] add ok and err events --- src/connection/connection.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/connection/connection.js b/src/connection/connection.js index ae459b5..5dae842 100644 --- a/src/connection/connection.js +++ b/src/connection/connection.js @@ -155,7 +155,11 @@ class Connection extends EventEmitter { const bufferReader = new BufferReader(frame); const responseCode = bufferReader.readByte(); - if(responseCode === Constants.ResponseCodes.SelfInfo){ + if(responseCode === Constants.ResponseCodes.Ok){ + this.onOkResponse(bufferReader); + } else if(responseCode === Constants.ResponseCodes.Err){ + this.onErrResponse(bufferReader); + } else if(responseCode === Constants.ResponseCodes.SelfInfo){ this.onSelfInfoResponse(bufferReader); } else if(responseCode === Constants.ResponseCodes.CurrTime){ this.onCurrTimeResponse(bufferReader); @@ -212,6 +216,18 @@ class Connection extends EventEmitter { }); } + onOkResponse(bufferReader) { + this.emit(Constants.ResponseCodes.Ok, { + + }); + } + + onErrResponse(bufferReader) { + this.emit(Constants.ResponseCodes.Err, { + + }); + } + onContactsStartResponse(bufferReader) { this.emit(Constants.ResponseCodes.ContactsStart, { count: bufferReader.readUInt32LE(),