Package org.xmpp.packet

Examples of org.xmpp.packet.Message


                    Element addresses = DocumentHelper.createElement(QName.get("addresses", "http://jabber.org/protocol/address"));
                    Element address = addresses.addElement("address");
                    address.addAttribute("type", "replyto");
                    address.addAttribute("jid", publisher.toString());

                    Message extendedMessage = message.createCopy();
                    extendedMessage.addExtension(new PacketExtension(addresses));

                    extendedMessage.setTo(recipientFullJID);
                    router.route(extendedMessage);
                }
            }
            catch (IndexOutOfBoundsException e) {
                // Do not add addressing extension to message.
View Full Code Here


            if (!subscription.canSendPublicationEvent(leafLastPublishedItem.getNode(), leafLastPublishedItem)) {
                return;
            }

            // Send event notification to the subscriber
            Message notification = new Message();
            Element event = notification.getElement().addElement("event", "http://jabber.org/protocol/pubsub#event");
            Element items = event.addElement("items");
            items.addAttribute("node", leafLastPublishedItem.getNode().getNodeID());
            Element item = items.addElement("item");
            if (((LeafNode) leafLastPublishedItem.getNode()).isItemRequired()) {
                item.addAttribute("id", leafLastPublishedItem.getID());
            }
            if (leafLastPublishedItem.getNode().isPayloadDelivered() && leafLastPublishedItem.getPayload() != null) {
                item.add(leafLastPublishedItem.getPayload().createCopy());
            }
            // Add a message body (if required)
            if (subscription.isIncludingBody()) {
                notification.setBody(LocaleUtils.getLocalizedString("pubsub.notification.message.body"));
            }
            // Include date when published item was created
            notification.getElement().addElement("delay", "urn:xmpp:delay").addAttribute("stamp", fastDateFormat.format(leafLastPublishedItem.getCreationDate()));
            // Send the event notification to the subscriber
            this.sendNotification(subscription.getNode(), notification, subscription.getJID());
        }
    }
View Full Code Here

        String subject = "Content filter notification! ("
                + originalPacket.getFrom().getNode() + ")";

        String body;
        if (originalPacket instanceof Message) {
            Message originalMsg = (Message) originalPacket;
            body = "Disallowed content detected in message from:"
                    + originalMsg.getFrom()
                    + " to:"
                    + originalMsg.getTo()
                    + ", message was "
                    + (allowOnMatch ? "allowed" + (contentFilter.isMaskingContent() ? " and masked." : " but not masked.") : "rejected.")
                    + (violationIncludeOriginalPacketEnabled ? "\nOriginal subject:"
                            + (originalMsg.getSubject() != null ? originalMsg
                                    .getSubject() : "")
                            + "\nOriginal content:"
                            + (originalMsg.getBody() != null ? originalMsg
                                    .getBody() : "")
                            : "");

        } else {
            // presence
View Full Code Here

            sendViolationNotificationEmail(subject, body);
        }
    }

    private void sendViolationNotificationIM(String subject, String body) {
        Message message = createServerMessage(subject, body);
        // TODO consider spining off a separate thread here,
        // in high volume situations, it will result in
        // in faster response and notification is not required
        // to be real time.
        messageRouter.route(message);
View Full Code Here

        // to be real time.
        messageRouter.route(message);
    }

    private Message createServerMessage(String subject, String body) {
        Message message = new Message();
        message.setTo(violationContact + "@"
                + violationNotificationFrom.getDomain());
        message.setFrom(violationNotificationFrom);
        message.setSubject(subject);
        message.setBody(body);
        return message;
    }
View Full Code Here

     *
     * @param child the newly created node that was added to this node.
     */
    void childNodeAdded(Node child) {
        // Build packet to broadcast to subscribers
        Message message = new Message();
        Element event = message.addChildElement("event", "http://jabber.org/protocol/pubsub#event");
        Element item = event.addElement("items").addElement("item");
        item.addAttribute("id", child.getNodeID());
        if (deliverPayloads) {
            item.add(child.getMetadataForm().getElement());
        }
View Full Code Here

     *
     * @param child the deleted node that was removed from this node.
     */
    void childNodeDeleted(Node child) {
        // Build packet to broadcast to subscribers
        Message message = new Message();
        Element event = message.addChildElement("event", "http://jabber.org/protocol/pubsub#event");
        event.addElement("delete").addAttribute("node", child.getNodeID());
        // Broadcast event notification to subscribers
        broadcastCollectionNodeEvent(child, message);
    }
View Full Code Here

        if (field == null) {
            return;
        }
        if (field.getAnswerType() == WorkgroupForm.FormEnum.hidden) {
            // Auto accept hidden fields
            Message fakeMessage = message.createCopy();
            StringBuilder builder = new StringBuilder();
            for (Iterator<String> it=field.getAnswers().iterator(); it.hasNext();) {
                builder.append(it.next());
                if (it.hasNext()) {
                    builder.append("/");
                }
            }
            fakeMessage.setBody(builder.toString());
            // Set that we are currently waiting for a response to the next question
            session.setCurrentSubstep(position);
            // Simulate that the user sent this message (with the hidden field)
            onMessage(session, fakeMessage);
        }
View Full Code Here

        }
        return false;
    }

    private void sendReply(Message message, String reply) {
        Message packet = new Message();
        packet.setTo(message.getFrom());
        packet.setFrom(message.getTo());
        packet.setThread(message.getThread());
        packet.setType(message.getType());
        packet.setBody(reply);
        send(packet);
    }
View Full Code Here

        packet.setBody(reply);
        send(packet);
    }

    private void sendMessage(JID receiver, String thread, String body) {
        Message packet = new Message();
        packet.setTo(receiver);
        packet.setFrom(workgroup.getJID());
        packet.setThread(thread);
        if (thread != null) {
            packet.setType(Message.Type.chat);
        }
        packet.setBody(body);
        send(packet);
    }
View Full Code Here

TOP

Related Classes of org.xmpp.packet.Message

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.