From 7d9c09ac9f6d7fda50578af2eaad9647e0f8f905 Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Tue, 27 Sep 2016 21:31:09 -0400 Subject: [PATCH] update to newer version of Matrix SDK --- package.json | 2 +- src/matrix.coffee | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 547edb6..1d57e9c 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "parent-require": "^1.0.0", - "matrix-js-sdk": ">=0.3.0" + "matrix-js-sdk": "^0.6.0" }, "peerDependencies": { "hubot": ">=2.0" diff --git a/src/matrix.coffee b/src/matrix.coffee index bf29d46..964b8df 100644 --- a/src/matrix.coffee +++ b/src/matrix.coffee @@ -49,9 +49,11 @@ class Matrix extends Adapter baseUrl: process.env.HUBOT_MATRIX_HOST_SERVER || 'https://matrix.org' accessToken: @access_token userId: @user_id - @client.on 'syncComplete', => - @robot.logger.info "Synced #{@client.getRooms().length} rooms" - @emit 'connected' + @client.on 'sync', (state, prevState, data) => + switch state + when "PREPARED" + @robot.logger.info "Synced #{@client.getRooms().length} rooms" + @emit 'connected' @client.on 'Room.timeline', (event, room, toStartOfTimeline) => if event.getType() == 'm.room.message' and toStartOfTimeline == false message = event.getContent().body