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
This commit is contained in:
Matthew Hodgson 2014-09-04 09:40:15 -07:00
parent 9c82276760
commit 3bc7bba262
2 changed files with 96 additions and 55 deletions

View file

@ -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