Package rocks.xmpp.extensions.receipts.model

Examples of rocks.xmpp.extensions.receipts.model.Received


                        // If a client requests a receipt, send an ack message.
                        if (message.getExtension(Request.class) != null && message.getId() != null) {
                            // Add an empty body. Otherwise some servers, won't store it in offline storage.
                            Message receiptMessage = new Message(message.getFrom(), Message.Type.NORMAL, " ");
                            receiptMessage.getExtensions().add(new Received(message.getId()));
                            xmppSession.send(receiptMessage);
                        }
                        // If the message is a receipt.
                        Received received = message.getExtension(Received.class);
                        if (received != null) {
                            DelayedDelivery delayedDelivery = message.getExtension(DelayedDelivery.class);
                            Date deliveryDate;
                            if (delayedDelivery != null) {
                                deliveryDate = delayedDelivery.getTimeStamp();
                            } else {
                                deliveryDate = new Date();
                            }

                            // Notify the listeners about the reception.
                            for (MessageDeliveredListener messageDeliveredListener : messageDeliveredListeners) {
                                try {
                                    messageDeliveredListener.messageDelivered(new MessageDeliveredEvent(MessageDeliveryReceiptsManager.this, received.getId(), deliveryDate));
                                } catch (Exception ex) {
                                    logger.log(Level.WARNING, ex.getMessage(), ex);
                                }
                            }
                        }
View Full Code Here


                "    to='northumberland@shakespeare.lit/westminster'>\n" +
                "  <received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/>\n" +
                "</message>\n";

        Message message = unmarshal(xml, Message.class);
        Received received = message.getExtension(Received.class);
        Assert.assertNotNull(received);
        Assert.assertEquals(received.getId(), "richard2-4.1.247");
    }
View Full Code Here

TOP

Related Classes of rocks.xmpp.extensions.receipts.model.Received

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.