|
|
@@ -54,7 +54,7 @@ function initHljs() {
|
|
|
* @param {function(boolean)} cb
|
|
|
**/
|
|
|
function fetchHistory(room, cb) {
|
|
|
- HttpRequestWrapper("api/hist?room=" +room.id)
|
|
|
+ HttpRequestWrapper("api/hist?room=" +HttpRequestWrapper.encode(room.id))
|
|
|
.setResponseType(HttpRequestResponseType.JSON)
|
|
|
.callbackSuccess(function(code, status, resp) {
|
|
|
if (resp) {
|
|
|
@@ -134,7 +134,7 @@ function outOfSync() {
|
|
|
* @param {Room} room
|
|
|
**/
|
|
|
function sendTyping(room) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.POST, "api/typing?room=" +room.id).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.POST, "api/typing?room=" +HttpRequestWrapper.encode(room.id)).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -207,14 +207,14 @@ function setRoomFromHashBang() {
|
|
|
* @param {Room} room
|
|
|
**/
|
|
|
function starChannel(room) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.POST, "api/starChannel?room=" +room.id).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.POST, "api/starChannel?room=" +HttpRequestWrapper.encode(room.id)).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @param {Room} room
|
|
|
**/
|
|
|
function unstarChannel(room) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.POST, "api/unstarChannel?room=" +room.id).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.POST, "api/unstarChannel?room=" +HttpRequestWrapper.encode(room.id)).send();
|
|
|
}
|
|
|
|
|
|
function unselectRoom() {
|
|
|
@@ -235,7 +235,7 @@ function uploadFile(chan, filename, file, callback) {
|
|
|
// FIXME NATIVE !
|
|
|
formData.append("file", file);
|
|
|
formData.append("filename", filename);
|
|
|
- HttpRequestWrapper(HttpRequestMethod.POST, "api/file?room=" +chan.id)
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.POST, "api/file?room=" +HttpRequestWrapper.encode(chan.id))
|
|
|
.callbackSuccess(function() { callback(null); })
|
|
|
.callbackError(function(sCode, sText, resp) { callback(sText); })
|
|
|
.send(formData);
|
|
|
@@ -247,7 +247,7 @@ function uploadFile(chan, filename, file, callback) {
|
|
|
* @param {(function((string|null)))=} callback
|
|
|
**/
|
|
|
function sendCommand(payload, serviceId, callback) {
|
|
|
- var xhr = HttpRequestWrapper(HttpRequestMethod.POST, "api/attachmentAction?serviceId=" +serviceId);
|
|
|
+ var xhr = HttpRequestWrapper(HttpRequestMethod.POST, "api/attachmentAction?serviceId=" +HttpRequestWrapper.encode(serviceId));
|
|
|
if (callback)
|
|
|
xhr.callbackSuccess(function() {
|
|
|
callback(null);
|
|
|
@@ -275,7 +275,7 @@ function getActionPayload(channelId, msg, attachment, action) {
|
|
|
* @param {string} args
|
|
|
**/
|
|
|
function doCommand(chan, cmd, args) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.POST, "api/cmd?room=" +chan.id +"&cmd=" +encodeURIComponent(cmd.name.substr(1)) +"&args=" +encodeURIComponent(args)).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.POST, "api/cmd?room=" +HttpRequestWrapper.encode(chan.id) +"&cmd=" +HttpRequestWrapper.encode(cmd.name.substr(1)) +"&args=" +HttpRequestWrapper.encode(args)).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -285,7 +285,7 @@ function doCommand(chan, cmd, args) {
|
|
|
* @param {Message|null=} replyTo
|
|
|
**/
|
|
|
function sendMsg(chan, msg, pendingObj, replyTo) {
|
|
|
- var url = 'api/msg?room=' +chan.id +"&text=" +encodeURIComponent(msg);
|
|
|
+ var url = 'api/msg?room=' +HttpRequestWrapper.encode(chan.id) +"&text=" +HttpRequestWrapper.encode(msg);
|
|
|
if (replyTo) {
|
|
|
var sender = DATA.context.getUser(replyTo.userId),
|
|
|
footer = chan.isPrivate ? locale.message : chan.name;
|
|
|
@@ -297,7 +297,7 @@ function sendMsg(chan, msg, pendingObj, replyTo) {
|
|
|
"footer": footer,
|
|
|
"ts": replyTo.ts
|
|
|
};
|
|
|
- url += "&attachments=" +encodeURIComponent(JSON.stringify([attachment]));
|
|
|
+ url += "&attachments=" +HttpRequestWrapper.encode(JSON.stringify([attachment]));
|
|
|
}
|
|
|
HttpRequestWrapper(HttpRequestMethod.POST, url).setResponseType(HttpRequestResponseType.JSON).callbackSuccess(function(code, text, resp) {
|
|
|
if (resp && resp["pendingId"] !== undefined) {
|
|
|
@@ -312,7 +312,7 @@ function sendMsg(chan, msg, pendingObj, replyTo) {
|
|
|
* @param {Message} msg
|
|
|
**/
|
|
|
function editMsg(chan, text, msg) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.PUT, "api/msg?room=" +chan.id +"&ts=" +msg.id +"&text=" +encodeURIComponent(text)).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.PUT, "api/msg?room=" +HttpRequestWrapper.encode(chan.id) +"&ts=" +msg.id +"&text=" +HttpRequestWrapper.encode(text)).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -320,7 +320,7 @@ function editMsg(chan, text, msg) {
|
|
|
* @param {Message} msg
|
|
|
**/
|
|
|
function removeMsg(chan, msg) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.DELETE, "api/msg?room=" +chan.id +"&ts=" +msg.id).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.DELETE, "api/msg?room=" +HttpRequestWrapper.encode(chan.id) +"&ts=" +msg.id).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -328,7 +328,7 @@ function removeMsg(chan, msg) {
|
|
|
* @param {Message} msg
|
|
|
**/
|
|
|
function pinMsg(chan, msg) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.POST, "api/pinMsg?room=" +chan.id +"&msgId=" +msg.id).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.POST, "api/pinMsg?room=" +HttpRequestWrapper.encode(chan.id) +"&msgId=" +msg.id).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -336,7 +336,7 @@ function pinMsg(chan, msg) {
|
|
|
* @param {Message} msg
|
|
|
**/
|
|
|
function starMsg(chan, msg) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.POST, "api/starMsg?room=" +chan.id +"&msgId=" +msg.id).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.POST, "api/starMsg?room=" +HttpRequestWrapper.encode(chan.id) +"&msgId=" +msg.id).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -344,7 +344,7 @@ function starMsg(chan, msg) {
|
|
|
* @param {Message} msg
|
|
|
**/
|
|
|
function unpinMsg(chan, msg) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.DELETE, "api/pinMsg?room=" +chan.id +"&msgId=" +msg.id).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.DELETE, "api/pinMsg?room=" +HttpRequestWrapper.encode(chan.id) +"&msgId=" +msg.id).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -352,7 +352,7 @@ function unpinMsg(chan, msg) {
|
|
|
* @param {Message} msg
|
|
|
**/
|
|
|
function unstarMsg(chan, msg) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.DELETE, "api/starMsg?room=" +chan.id +"&msgId=" +msg.id).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.DELETE, "api/starMsg?room=" +HttpRequestWrapper.encode(chan.id) +"&msgId=" +msg.id).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -361,7 +361,7 @@ function unstarMsg(chan, msg) {
|
|
|
* @param {number} ts
|
|
|
**/
|
|
|
function sendReadMarker(chan, id, ts) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.POST, "api/markread?room=" +chan.id +"&id=" +id +"&ts=" +ts).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.POST, "api/markread?room=" +HttpRequestWrapper.encode(chan.id) +"&id=" +id +"&ts=" +ts).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -370,7 +370,7 @@ function sendReadMarker(chan, id, ts) {
|
|
|
* @param {string} reaction
|
|
|
**/
|
|
|
function addReaction(channelId, msgId, reaction) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.POST, "api/reaction?room=" +channelId +"&msg=" +msgId +"&reaction=" +encodeURIComponent(reaction)).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.POST, "api/reaction?room=" +HttpRequestWrapper.encode(channelId) +"&msg=" +msgId +"&reaction=" +HttpRequestWrapper.encode(reaction)).send();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -379,7 +379,7 @@ function addReaction(channelId, msgId, reaction) {
|
|
|
* @param {string} reaction
|
|
|
**/
|
|
|
function removeReaction(channelId, msgId, reaction) {
|
|
|
- HttpRequestWrapper(HttpRequestMethod.DELETE, "api/reaction?room=" +channelId +"&msg=" +msgId +"&reaction=" +encodeURIComponent(reaction)).send();
|
|
|
+ HttpRequestWrapper(HttpRequestMethod.DELETE, "api/reaction?room=" +HttpRequestWrapper.encode(channelId) +"&msg=" +msgId +"&reaction=" +HttpRequestWrapper.encode(reaction)).send();
|
|
|
}
|
|
|
|
|
|
function logout() {
|