Skip to content

Commit

Permalink
Prevent Recalling Messages (Prototype)
Browse files Browse the repository at this point in the history
Change recalling command to a system message.

Todo: mark the should-be-recalled message, maybe with `<del>`?
  • Loading branch information
arrowrowe committed Feb 25, 2016
1 parent 7d25ecc commit 3126eee
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/inject-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ Object.defineProperty(angular, 'bootstrap', {
$httpProvider.defaults.transformResponse.push((value) => {
if (typeof value === 'object' && value !== null && value.AddMsgList instanceof Array) {
value.AddMsgList.forEach((msg) => {
if (msg.MsgType !== constants.MSGTYPE_EMOTICON) {
return;
}
const rec = msg.Content.match(/^&lt;msg&gt;&lt;emoji.+cdnurl = "(.+?)".+thumburl = "(.+?)"/);
if (rec !== null) {
lock(msg, 'MsgType', constants.MSGTYPE_IMAGE);
lock(msg, 'MMPreviewSrc', rec[1]);
lock(msg, 'MMThumbSrc', rec[2]);
switch (msg.MsgType) {
case constants.MSGTYPE_EMOTICON:
const rec = msg.Content.match(/^&lt;msg&gt;&lt;emoji.+cdnurl = "(.+?)".+thumburl = "(.+?)"/);
if (rec !== null) {
lock(msg, 'MsgType', constants.MSGTYPE_IMAGE);
lock(msg, 'MMPreviewSrc', rec[1]);
lock(msg, 'MMThumbSrc', rec[2]);
}
break;
case constants.MSGTYPE_RECALLED:
lock(msg, 'MsgType', constants.MSGTYPE_SYS);
lock(msg, 'MMActualContent', '阻止了一次撤回');
lock(msg, 'MMDigest', '阻止了一次撤回');
break;
}
});
}
Expand Down

0 comments on commit 3126eee

Please sign in to comment.