Skip to content

Commit

Permalink
修改delivery和acked的格式,补全windowssdk的空位
Browse files Browse the repository at this point in the history
  • Loading branch information
clock committed Jul 10, 2017
1 parent ad6f949 commit 1dcfa5f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions demo/javascript/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ module.exports = {
},

sendRead: function (message) {
// TODO: Window SDK
if (WebIM.config.isWindowSDK) {

}
if (!WebIM.config.read)
return;
// 阅读消息时反馈一个已阅读
Expand Down
8 changes: 8 additions & 0 deletions demo/javascript/src/components/chat/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ module.exports = React.createClass({
}
},
onDeliveredMessage: function (message) {
// TODO: Window SDK
if (WebIM.config.isWindowSDK) {

}
var msg = document.getElementsByName(message.mid);
// 记录消息的状态
for (var targetId in Demo.chatRecord) {
Expand All @@ -315,6 +319,10 @@ module.exports = React.createClass({
}
},
onReadMessage: function (message) {
// TODO: Window SDK
if (WebIM.config.isWindowSDK) {

}
var msg = document.getElementsByName(message.mid);
if (msg) {
if (msg[0]) {
Expand Down
16 changes: 12 additions & 4 deletions sdk/src/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,20 +269,28 @@ var CryptoJS = require('crypto-js');
dom.up().c('roomtype', {xmlns: 'easemob:x:roomtype', type: 'chatroom'});
}
if (message.bodyId) {
dom.up().c('body').t(message.bodyId);
dom = $msg({
to: message.toJid
, id: message.id
, xmlns: 'jabber:client'
}).c('body').t(message.bodyId);
var delivery = {
xmlns: 'urn:xmpp:receipts'
, id: message.bodyId
};
dom.up().c('delivery').t(_utils.stringify(delivery));
dom.up().c('delivery', delivery);
}
if (message.ackId) {
dom.up().c('body').t(message.ackId);
dom = $msg({
to: message.toJid
, id: message.id
, xmlns: 'jabber:client'
}).c('body').t(message.ackId);
var read = {
xmlns: 'urn:xmpp:receipts'
, id: message.ackId
};
dom.up().c('acked').t(_utils.stringify(read));
dom.up().c('acked', read);
}

setTimeout(function () {
Expand Down

0 comments on commit 1dcfa5f

Please sign in to comment.