From 02b29c157f54b55a5109b65e690a91d36f6b559a Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 12 May 2015 14:24:05 +0100 Subject: [PATCH] Add getStateEvent API (used by IRC AS to get display names for people) --- lib/matrix.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/matrix.js b/lib/matrix.js index 508c1a602..7ae783e75 100644 --- a/lib/matrix.js +++ b/lib/matrix.js @@ -100,6 +100,21 @@ var init = function(exports){ ); }, + getStateEvent: function(roomId, eventType, stateKey) { + var pathParams = { + $roomId: roomId, + $eventType: eventType, + $stateKey: stateKey + }; + var path = encodeUri("/rooms/$roomId/state/$eventType", pathParams); + if (stateKey !== undefined) { + path = encodeUri(path + "/$stateKey", pathParams); + } + return this._doAuthedRequest( + callback, "GET", path, undefined, content + ); + }, + sendStateEvent: function(roomId, eventType, content, stateKey, callback) { var pathParams = {