【发布时间】:2019-01-04 15:38:51
【问题描述】:
我正在使用以下代码检索聊天记录。在视图中,我需要显示消息的刻度,无论它们是否已传递。但是对于已传递和未传递的消息,消息节结构是相同的。那么如何在不建立外部数据库的情况下区分已投递和未投递的消息。
这是我的 service.ts 文件中的代码:
this.Connection.mam.query(from, {
with: to,
before: '',
max: '10',
onMessage: (message) = > {
console.log(message);
},
onComplete: (response) = > {
console.log('Got all the messages');
}
});
我得到的输出是:
<message
xmlns="jabber:client" to="sashank@localhost/9158846669251631426100" from="sashank@localhost">
<result
xmlns="urn:xmpp:mam:2" id="1546597812368545">
<forwarded
xmlns="urn:xmpp:forward:0">
<message
xmlns="jabber:client" xml:lang="en"
to="murali@localhost" from="sashank@localhost/18846625227131105454610" type="chat" id="0777d27e-7238-42ba-9063-78185c05e76d">
<archived
xmlns="urn:xmpp:mam:tmp" by="sashank@localhost" id="1546597812368545">
</archived>
<stanza-id
xmlns="urn:xmpp:sid:0" by="sashank@localhost" id="1546597812368545">
</stanza-id>
<request
xmlns="urn:xmpp:receipts">
</request>
<body>Hello buddy! How are you</body>
</message>
<delay
xmlns="urn:xmpp:delay" from="localhost" stamp="2019-01-04T10:30:12.368545Z">
</delay>
</forwarded>
</result>
</message>
这是已传递的消息,未传递的消息在节结构中也看起来相同,没有额外的属性。提前致谢。
【问题讨论】:
标签: xmpp ejabberd strophe.js