diff options
Diffstat (limited to '')
-rw-r--r-- | webclient/components/matrix/event-handler-service.js | 1 | ||||
-rw-r--r-- | webclient/components/matrix/matrix-service.js | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js index 8232e3b4b0..5a3e92186e 100644 --- a/webclient/components/matrix/event-handler-service.js +++ b/webclient/components/matrix/event-handler-service.js @@ -149,6 +149,7 @@ angular.module('eventHandlerService', []) $rootScope.$broadcast(NAME_EVENT, event, isLiveEvent); }; + // TODO: Can this just be a generic "I am a room state event, can haz store?" var handleRoomTopic = function(event, isLiveEvent) { console.log("handleRoomTopic live="+isLiveEvent); diff --git a/webclient/components/matrix/matrix-service.js b/webclient/components/matrix/matrix-service.js index 6864726ba4..62aff091d4 100644 --- a/webclient/components/matrix/matrix-service.js +++ b/webclient/components/matrix/matrix-service.js @@ -235,6 +235,25 @@ angular.module('matrixService', []) return doRequest("GET", path, undefined, {}); }, + + setTopic: function(room_id, topic) { + var data = { + topic: topic + }; + return this.sendStateEvent(room_id, "m.room.topic", data); + }, + + + sendStateEvent: function(room_id, eventType, content, state_key) { + var path = "/rooms/$room_id/state/"+eventType; + if (state_key !== undefined) { + path += "/" + state_key; + } + room_id = encodeURIComponent(room_id); + path = path.replace("$room_id", room_id); + + return doRequest("PUT", path, undefined, content); + }, sendEvent: function(room_id, eventType, txn_id, content) { // The REST path spec |