From 3bc7bba2625e291fcbf0c30f30c20fc2d1756a49 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 4 Sep 2014 09:40:15 -0700 Subject: switch IRC-style command parser to use regexps rather than split(" ") so that it doesn't choke on consecutive whitespaces yield better errors for invalid commands don't pass invalid commands through as messages support kick reasons --- webclient/components/matrix/matrix-service.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'webclient/components') diff --git a/webclient/components/matrix/matrix-service.js b/webclient/components/matrix/matrix-service.js index 25222a9e9e..436ff5462a 100644 --- a/webclient/components/matrix/matrix-service.js +++ b/webclient/components/matrix/matrix-service.js @@ -169,14 +169,19 @@ angular.module('matrixService', []) // Change the membership of an another user setMembership: function(room_id, user_id, membershipValue) { + return this.setMemberShipObject(room_id, user_id, { + membership : membershipValue + }); + }, + + // Change the membership of an another user + setMembershipObject: function(room_id, user_id, membershipObject) { // The REST path spec var path = "/rooms/$room_id/state/m.room.member/$user_id"; path = path.replace("$room_id", encodeURIComponent(room_id)); path = path.replace("$user_id", user_id); - return doRequest("PUT", path, undefined, { - membership: membershipValue - }); + return doRequest("PUT", path, undefined, membershipObject); }, // Bans a user from from a room -- cgit 1.5.1