Package org.xmpp.packet

Examples of org.xmpp.packet.Message.addChildElement()


    // Generate an explicit Message receipt.
    Message response = new Message();
    response.setTo(packet.getFrom());
    response.setID(packet.getID());
    response.setFrom(packet.getTo());
    response.addChildElement("received", XmppNamespace.NAMESPACE_XMPP_RECEIPTS);
    server1.manager.receivePacket(response);

    // Confirm that an error callback is invoked.
    ArgumentCaptor<FederationError> returnedError = ArgumentCaptor.forClass(FederationError.class);
    verify(callback).error(returnedError.capture());
View Full Code Here


      remote.update(message, new IncomingCallback(message));
    } else if (message.getChildElement("ping", XmppNamespace.NAMESPACE_WAVE_SERVER) != null) {
      // Respond inline to the ping.
      LOG.info("Responding to ping from: " + message.getFrom());
      Message response = XmppUtil.createResponseMessage(message);
      response.addChildElement("received", XmppNamespace.NAMESPACE_XMPP_RECEIPTS);
      transport.sendPacket(response);
    } else {
      sendErrorResponse(message, FederationError.Code.BAD_REQUEST, "Unhandled message type");
    }
  }
View Full Code Here

    Message message = new Message();
    message.setType(Message.Type.normal);
    message.setFrom(jid);
    message.setTo(remoteJid);
    message.setID(XmppUtil.generateUniqueId());
    message.addChildElement("request", XmppNamespace.NAMESPACE_XMPP_RECEIPTS);

    final String encodedWaveletName;
    try {
      encodedWaveletName = XmppUtil.waveletNameCodec.waveletNameToURI(waveletName);
    } catch (EncodingException e) {
View Full Code Here

    } catch (EncodingException e) {
      callback.onFailure(FederationErrors.badRequest("Bad wavelet name " + waveletName));
      return;
    }

    Element itemElement = message.addChildElement("event", XmppNamespace.NAMESPACE_PUBSUB_EVENT)
        .addElement("items").addElement("item");
    if (deltaList != null) {
      for (ByteString delta : deltaList) {
        Element waveletUpdate =
            itemElement.addElement("wavelet-update", XmppNamespace.NAMESPACE_WAVE_SERVER)
View Full Code Here

    final Runnable countDown = new Runnable() {
      @Override
      public void run() {
        if (callbackCount.decrementAndGet() == 0 && receiptRequested != null) {
          Message response = XmppUtil.createResponseMessage(updateMessage);
          response.addChildElement("received", XmppNamespace.NAMESPACE_XMPP_RECEIPTS);
          responseCallback.run(response);
        }
      }
    };
View Full Code Here

                if (notify) {
                    try {
                        Message message = new Message();
                        message.setFrom(serverName);
                        message.setTo(componentJID);
                        Element childElement = message.addChildElement("copy",
                                "http://jabber.org/protocol/packet#event");
                        childElement.addAttribute("incoming", subscription.isIncoming() ? "true" : "false");
                        childElement.addAttribute("processed", subscription.isProcessed() ? "true" : "false");
                        childElement.addAttribute("date", dateFormat.format(interceptedPacket.getCreationDate()));
                        childElement.add(interceptedPacket.getElement().createCopy());
View Full Code Here

            // Set the room as the sender of the message
            message.setFrom(room.getRole().getRoleAddress());
        }

        // Add the delay information to the message
        Element delayInformation = message.addChildElement("delay", "urn:xmpp:delay");
        Element delayInformationOld = message.addChildElement("x", "jabber:x:delay");
        delayInformation.addAttribute("stamp", UTC_FORMAT.format(sentDate));
        delayInformationOld.addAttribute("stamp", UTC_FORMAT_OLD.format(sentDate));
        if (room.canAnyoneDiscoverJID()) {
            // Set the Full JID as the "from" attribute
View Full Code Here

            message.setFrom(room.getRole().getRoleAddress());
        }

        // Add the delay information to the message
        Element delayInformation = message.addChildElement("delay", "urn:xmpp:delay");
        Element delayInformationOld = message.addChildElement("x", "jabber:x:delay");
        delayInformation.addAttribute("stamp", UTC_FORMAT.format(sentDate));
        delayInformationOld.addAttribute("stamp", UTC_FORMAT_OLD.format(sentDate));
        if (room.canAnyoneDiscoverJID()) {
            // Set the Full JID as the "from" attribute
            delayInformation.addAttribute("from", senderJID);
View Full Code Here

            return;
        }

        // Build packet to broadcast to subscribers
        Message message = new Message();
        Element event = message.addChildElement("event", "http://jabber.org/protocol/pubsub#event");
        Element config = event.addElement("configuration");
        config.addAttribute("node", nodeID);

        if (deliverPayloads) {
            config.add(getConfigurationChangeForm().getElement());
View Full Code Here

            deletingNode();
            // Broadcast delete notification to subscribers (if enabled)
            if (isNotifiedOfDelete()) {
                // Build packet to broadcast to subscribers
                Message message = new Message();
                Element event = message.addChildElement("event", "http://jabber.org/protocol/pubsub#event");
                Element items = event.addElement("delete");
                items.addAttribute("node", nodeID);
                // Send notification that the node was deleted
                broadcastNodeEvent(message, true);
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.