Package tigase.xml

Examples of tigase.xml.Element.addChild()


    throws NotAuthorizedException, TigaseDBException {
    Element update = new Element("iq");
    update.setAttribute("type", StanzaType.set.toString());
    Element query = new Element("query");
    query.setXMLNS(ROSTER_XMLNS);
    query.addChild(item);
    update.addChild(query);
    for (XMPPResourceConnection conn: session.getActiveSessions()) {
      Element conn_update = update.clone();
      conn_update.setAttribute("to", conn.getJID());
      conn_update.setAttribute("id", "rst"+session.nextStanzaId());
View Full Code Here


        if (value != null) {
          eItem.addAttribute(VALUE, value);
        } // end of if (value != null)
        if (stanzas != null) {
          for (String stanza: stanzas) {
          eItem.addChild(new Element(stanza));
          } // end of for (String stanza: stanzas)
        } // end of if (stanzas != null)
        eList.addChild(eItem);
      } // end of for (String item: items)
      return eList;
View Full Code Here

      long rid = takeCurrentRidTail();
      if (rid > 0) {
        body.setAttribute(ACK_ATTR, ""+rid);
      }
      if (waiting_packets.size() > 0) {
        body.addChild(applyFilters(waiting_packets.poll()));
        while (waiting_packets.size() > 0
          && body.getChildren().size() < MAX_PACKETS) {
          body.addChild(applyFilters(waiting_packets.poll()));
        }
      }
View Full Code Here

      }
      if (waiting_packets.size() > 0) {
        body.addChild(applyFilters(waiting_packets.poll()));
        while (waiting_packets.size() > 0
          && body.getChildren().size() < MAX_PACKETS) {
          body.addChild(applyFilters(waiting_packets.poll()));
        }
      }
    }
    try {
      if (terminate) {
View Full Code Here

      return;
    }
    if (packet.getType() == StanzaType.get) {
      Element query = new Element("query");
      query.setXMLNS("jabber:iq:gateway");
      query.addChild(new Element("desc", gw_desc));
      query.addChild(new Element("prompt"));
      addOutPacket(packet.okResult(query, 0));
    }
    if (packet.getType() == StanzaType.set) {
      String legacyName = packet.getElemCData("/iq/query/prompt");
View Full Code Here

    }
    if (packet.getType() == StanzaType.get) {
      Element query = new Element("query");
      query.setXMLNS("jabber:iq:gateway");
      query.addChild(new Element("desc", gw_desc));
      query.addChild(new Element("prompt"));
      addOutPacket(packet.okResult(query, 0));
    }
    if (packet.getType() == StanzaType.set) {
      String legacyName = packet.getElemCData("/iq/query/prompt");
      String jid = formatJID(legacyName);
View Full Code Here

      new String[] {"to", "from", "type"},
      new String[] {to, from, type.toString()});
    if (nick != null) {
      //<x xmlns="vcard-temp:x:update"><nickname>tus</nickname></x>
      //<nick xmlns="http://jabber.org/protocol/nick">tus</nick>
      presence.addChild(new Element("nick", nick,
          new String[] {"xmlns"},
          new String[] {"http://jabber.org/protocol/nick"}));
    }
    if (status != null) {
      presence.addChild(new Element("status", status));
View Full Code Here

      presence.addChild(new Element("nick", nick,
          new String[] {"xmlns"},
          new String[] {"http://jabber.org/protocol/nick"}));
    }
    if (status != null) {
      presence.addChild(new Element("status", status));
    }
    return new Packet(presence);
  }

  public static Packet getPresence(String to, String from, StanzaType type) {
View Full Code Here

//   }

  public Packet packRouted() {
    Element routed = new Element("route", new String[] {"to", "from"},
      new String[] {getTo(), getFrom()});
    routed.addChild(elem);
    return new Packet(routed);
  }

  public Packet swapFromTo(final Element el) {
    Packet packet = new Packet(el);
View Full Code Here

    Element message = new Element("message",
      new Element[] {new Element("body", body)},
      new String[] {"to", "from", "type"},
      new String[] {to, from, type.toString()});
    if (subject != null) {
      message.addChild(new Element("subject", subject));
    }
    if (thread != null) {
      message.addChild(new Element("thread", thread));
    }
    return new Packet(message);
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.