I am working on seen feature for boxchat of conversejs , I create a function when gender the messages will check , if not viewed will send the viewed message , I have successfully sent the newsletter but I don't know in the right message_text function how to call the seen save function. someone please help me.
const sendSeen = el => {
if (el.model.get("sender") == "them" && !el.model.get('seen')) {
console.log(el.model);
const msg = model_$msg({
'from': shared_converse.connection.jid,
'id': model_u.getUniqueId(),
'to': el.model.get("from"),
'type': 'chat'
}).c('seen', {
'xmlns': "urn:xmpp:ringme:seen",
'id': el.model.get("msgid")
}).up().c('store', {
'xmlns': model_Strophe.NS.HINTS
}).up()
.c('contentType', {
'xmlns': "urn:xmpp:ringme:contentType",
'name': "seen"
}).root();
core_api.send(msg);
const message = this.messages.findWhere({
'msgid': el.model.get("msgid")
});
// headless_log.log("handleSeen -> message: " + JSON.stringify(message));
if (message && !message.get('seen')) {
message.save({
'seen': new Date().toISOString()
});
}
return;
}
}
I don't know how to get const message