powered by Jive Software

Message receipts using AbstractComponent


#1

When an External Component implemented by Whack using the AbstractComponent method receives a XMPP message of the form

My lord, dispatch; read o'er these articles.

It should reply with a message of the form

<message from=‘externalcomp.mycompany.com’ id=‘bi29sg183b4v’ to=‘dummy@mycompany.com/MSGID1’

I noticed that Tinder has no way of respecting this delivery receipts XEP-0184.

I tried to implement it using:

if (message.getChildElement("received", "urn:xmpp:receipts") != null) {
   String messageId = message.getFrom().toString();
           sendReceiptMessage(to, from, messageId);
   }

where SendReceiptMessage is

private boolean sendReceiptMessage(String from, String to,String messageId) {        Message xmppMsg = new Message();
       xmppMsg.setFrom(from);
       xmppMsg.setTo(to);
       xmppMsg.addChildElement("received", "urn:xmpp:receipts");
              if(messageId!=null) xmppMsg.setID(messageId);
              try {
           manager.sendPacket(xmppMsg);
           return true;
       } catch (Exception e) {
            e.printStackTrace();
       }        return false;
   }

However, it is not working as getChildElement(“received”, “urn:xmpp:receipts”) always return NULL.

Any idea how to implement (recognize and form) a delivery receipt?


#2

Solved…

Message xmppMsg = new Message();
xmppMsg.setFrom(from);
xmppMsg.setTo(to);
xmppMsg.addChildElement(“received”, “urn:xmpp:receipts”).addAttribute(“id”, messageId);