I want to implement XEP-0012 when by default its not supported by Stanza.io.
Im following how to create plugin from its documentation but its not working.
Heres my code (last.js):
'use strict';
module.exports = function (client) {
client.disco.addFeature('jabber:iq:last');
client.on('jabber:iq:last', function (iq) {
client.sendIq(iq.resultReply({
last: new Date().getTime()
}));
});
client.getLastActivity = function (jid, cb) {
return this.sendIq({
to: jid,
type: 'get',
last: true
}, cb);
};
};
and then i use it with: client.use(require('last'))
but when i call the function its returning an error bad request
<bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error>
what am i missing?
thanks
We basically need to create a custom stanza and send it as iq
and to get the lastActivity of a user having jid as id
you can get the result of last Activity in two ways: Either getting the response from promise
or